From d4f31fda32fc0189dc369ba9242e0a9e4cf9bf8c Mon Sep 17 00:00:00 2001 From: neon443 <69979447+neon443@users.noreply.github.com> Date: Sun, 24 Aug 2025 21:00:59 +0100 Subject: [PATCH] =?UTF-8?q?okay=20i=20got=20it=20to=20work=20had=20to=20en?= =?UTF-8?q?able=20bg=20modes=20and=20stuff=20and=20made=20it=20call=20on?= =?UTF-8?q?=20appear=20of=20the=20shell=20and=20not=20the=20tab=20strip=20?= =?UTF-8?q?=F0=9F=92=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ShhShell/Info.plist | 4 ++++ ShhShell/Misc/Backgrounder.swift | 3 ++- ShhShell/Views/Terminal/ShellTabView.swift | 20 ++++++++++---------- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/ShhShell/Info.plist b/ShhShell/Info.plist index 06d521d..6e66e9e 100644 --- a/ShhShell/Info.plist +++ b/ShhShell/Info.plist @@ -22,5 +22,9 @@ JetBrainsMonoNerdFontMono-Italic.ttf JetBrainsMonoNerdFontMono-BoldItalic.ttf + UIBackgroundModes + + location + diff --git a/ShhShell/Misc/Backgrounder.swift b/ShhShell/Misc/Backgrounder.swift index e6161b4..4b07b3d 100644 --- a/ShhShell/Misc/Backgrounder.swift +++ b/ShhShell/Misc/Backgrounder.swift @@ -23,6 +23,7 @@ class Backgrounder: NSObject, CLLocationManagerDelegate, ObservableObject { } func startBgTracking() { +// guard mana manager.allowsBackgroundLocationUpdates = true manager.pausesLocationUpdatesAutomatically = false manager.startMonitoringSignificantLocationChanges() @@ -53,6 +54,6 @@ class Backgrounder: NSObject, CLLocationManagerDelegate, ObservableObject { } func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) { - print("tracking started yay") + print("tracking started fr") } } diff --git a/ShhShell/Views/Terminal/ShellTabView.swift b/ShhShell/Views/Terminal/ShellTabView.swift index 5b57c32..0f0f9d9 100644 --- a/ShhShell/Views/Terminal/ShellTabView.swift +++ b/ShhShell/Views/Terminal/ShellTabView.swift @@ -149,12 +149,6 @@ struct ShellTabView: View { } } .frame(height: 30) - .onDisappear { - UIApplication.shared.isIdleTimerDisabled = false - if container.sessions.isEmpty { - Backgrounder.shared.stopBgTracking() - } - } .onAppear { if selectedID == nil { if let handler { @@ -163,10 +157,6 @@ struct ShellTabView: View { dismiss() } } - UIApplication.shared.isIdleTimerDisabled = hostsManager.settings.caffeinate - if hostsManager.settings.locationPersist { - Backgrounder.shared.startBgTracking() - } } } @@ -177,6 +167,12 @@ struct ShellTabView: View { handler: session.handler, hostsManager: hostsManager ) + .onAppear { + UIApplication.shared.isIdleTimerDisabled = hostsManager.settings.caffeinate + if hostsManager.settings.locationPersist { + Backgrounder.shared.startBgTracking() + } + } .onDisappear { if !checkShell(session.handler.state) { if let lastSession = container.sessionIDs.last { @@ -185,6 +181,10 @@ struct ShellTabView: View { dismiss() } } + UIApplication.shared.isIdleTimerDisabled = false + if container.sessions.isEmpty { + Backgrounder.shared.stopBgTracking() + } } .id(selectedID) .transition(.opacity)