mirror of
https://github.com/neon443/ShhShell.git
synced 2026-03-11 13:26:16 +00:00
okay i got it to work
had to enable bg modes and stuff
and made it call on appear of the shell and not the tab strip 💀
This commit is contained in:
@@ -22,5 +22,9 @@
|
||||
<string>JetBrainsMonoNerdFontMono-Italic.ttf</string>
|
||||
<string>JetBrainsMonoNerdFontMono-BoldItalic.ttf</string>
|
||||
</array>
|
||||
<key>UIBackgroundModes</key>
|
||||
<array>
|
||||
<string>location</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
@@ -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")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user