mirror of
https://github.com/FBukovina/Atoll.git
synced 2026-10-27 15:14:33 +00:00
BugFix: System Share Menu Close
This commit is contained in:
parent
78ae27a7fe
commit
7ce19dfe46
2 changed files with 21 additions and 5 deletions
|
|
@ -248,14 +248,14 @@ struct ContentView: View {
|
||||||
}
|
}
|
||||||
.onChange(of: vm.isBatteryPopoverActive) { _, newPopoverState in
|
.onChange(of: vm.isBatteryPopoverActive) { _, newPopoverState in
|
||||||
runAfter(0.1) {
|
runAfter(0.1) {
|
||||||
if !newPopoverState && !isHovering && vm.notchState == .open && !vm.isStatsPopoverActive && !vm.isMediaOutputPopoverActive && !vm.isReminderPopoverActive {
|
if !newPopoverState && !isHovering && vm.notchState == .open && !shouldPreventAutoClose() {
|
||||||
vm.close()
|
vm.close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.onChange(of: vm.isStatsPopoverActive) { _, newPopoverState in
|
.onChange(of: vm.isStatsPopoverActive) { _, newPopoverState in
|
||||||
runAfter(0.1) {
|
runAfter(0.1) {
|
||||||
if !newPopoverState && !isHovering && vm.notchState == .open && !vm.isBatteryPopoverActive && !vm.isClipboardPopoverActive && !vm.isColorPickerPopoverActive && !vm.isMediaOutputPopoverActive && !vm.isReminderPopoverActive {
|
if !newPopoverState && !isHovering && vm.notchState == .open && !shouldPreventAutoClose() {
|
||||||
vm.close()
|
vm.close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -263,7 +263,14 @@ struct ContentView: View {
|
||||||
.onChange(of: vm.shouldRecheckHover) { _, _ in
|
.onChange(of: vm.shouldRecheckHover) { _, _ in
|
||||||
// Recheck hover state when popovers are closed
|
// Recheck hover state when popovers are closed
|
||||||
runAfter(0.1) {
|
runAfter(0.1) {
|
||||||
if vm.notchState == .open && !vm.isBatteryPopoverActive && !vm.isClipboardPopoverActive && !vm.isColorPickerPopoverActive && !vm.isStatsPopoverActive && !vm.isMediaOutputPopoverActive && !vm.isReminderPopoverActive && !isHovering {
|
if vm.notchState == .open && !shouldPreventAutoClose() && !isHovering {
|
||||||
|
vm.close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.onReceive(NotificationCenter.default.publisher(for: .sharingDidFinish)) { _ in
|
||||||
|
runAfter(0.1) {
|
||||||
|
if vm.notchState == .open && !isHovering && !shouldPreventAutoClose() {
|
||||||
vm.close()
|
vm.close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -737,7 +744,9 @@ struct ContentView: View {
|
||||||
}
|
}
|
||||||
|
|
||||||
vm.dropEvent = false
|
vm.dropEvent = false
|
||||||
vm.close()
|
if !shouldPreventAutoClose() {
|
||||||
|
vm.close()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -800,7 +809,7 @@ struct ContentView: View {
|
||||||
self.isHovering = false
|
self.isHovering = false
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.vm.notchState == .open && !self.hasAnyActivePopovers() {
|
if self.vm.notchState == .open && !self.shouldPreventAutoClose() {
|
||||||
self.vm.close()
|
self.vm.close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -818,6 +827,10 @@ struct ContentView: View {
|
||||||
vm.isMediaOutputPopoverActive ||
|
vm.isMediaOutputPopoverActive ||
|
||||||
vm.isReminderPopoverActive
|
vm.isReminderPopoverActive
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private func shouldPreventAutoClose() -> Bool {
|
||||||
|
hasAnyActivePopovers() || SharingStateManager.shared.preventNotchClose
|
||||||
|
}
|
||||||
|
|
||||||
// Helper to prevent rapid haptic feedback
|
// Helper to prevent rapid haptic feedback
|
||||||
private func triggerHapticIfAllowed() {
|
private func triggerHapticIfAllowed() {
|
||||||
|
|
|
||||||
|
|
@ -87,9 +87,12 @@ struct FileShareView: View {
|
||||||
Text(selectedProvider.id)
|
Text(selectedProvider.id)
|
||||||
.font(.system(.headline, design: .rounded))
|
.font(.system(.headline, design: .rounded))
|
||||||
.foregroundColor(.white.opacity(0.8))
|
.foregroundColor(.white.opacity(0.8))
|
||||||
|
.multilineTextAlignment(.center)
|
||||||
|
.frame(maxWidth: .infinity)
|
||||||
|
|
||||||
}
|
}
|
||||||
.padding(18)
|
.padding(18)
|
||||||
|
.frame(maxWidth: .infinity)
|
||||||
|
|
||||||
// Loading overlay
|
// Loading overlay
|
||||||
if isProcessing || quickShare.isPickerOpen {
|
if isProcessing || quickShare.isPickerOpen {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue