mirror of
https://github.com/StikDebug/StikDebug.git
synced 2026-10-16 12:30:29 +00:00
Hopefully fix some weird issues
This commit is contained in:
parent
f9c1f46fad
commit
ec147679e1
49 changed files with 2458 additions and 2287 deletions
|
|
@ -8,10 +8,6 @@
|
|||
import SwiftUI
|
||||
import Foundation
|
||||
|
||||
extension Notification.Name {
|
||||
static let switchToTab = Notification.Name("MainTabSwitchNotification")
|
||||
}
|
||||
|
||||
private enum ExternalLocationAction: Identifiable {
|
||||
case simulate(URL, Double, Double)
|
||||
case clear
|
||||
|
|
@ -55,7 +51,6 @@ private enum ExternalLocationAction: Identifiable {
|
|||
|
||||
struct MainTabView: View {
|
||||
@AppStorage("primaryTabSelection") private var selection: String = AppFeature.home.id
|
||||
@State private var switchObserver: Any?
|
||||
@State private var detachedFeature: AppFeature?
|
||||
@State private var didSetInitialHome = false
|
||||
@State private var pendingLocationAction: ExternalLocationAction?
|
||||
|
|
@ -77,17 +72,6 @@ struct MainTabView: View {
|
|||
selection = AppFeature.home.id
|
||||
didSetInitialHome = true
|
||||
}
|
||||
guard switchObserver == nil else { return }
|
||||
switchObserver = NotificationCenter.default.addObserver(forName: .switchToTab, object: nil, queue: .main) { note in
|
||||
guard let id = note.object as? String else { return }
|
||||
openFeature(id: id)
|
||||
}
|
||||
}
|
||||
.onDisappear {
|
||||
if let observer = switchObserver {
|
||||
NotificationCenter.default.removeObserver(observer)
|
||||
switchObserver = nil
|
||||
}
|
||||
}
|
||||
.onOpenURL { url in
|
||||
handleURL(url)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue