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-Italic.ttf</string>
|
||||||
<string>JetBrainsMonoNerdFontMono-BoldItalic.ttf</string>
|
<string>JetBrainsMonoNerdFontMono-BoldItalic.ttf</string>
|
||||||
</array>
|
</array>
|
||||||
|
<key>UIBackgroundModes</key>
|
||||||
|
<array>
|
||||||
|
<string>location</string>
|
||||||
|
</array>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ class Backgrounder: NSObject, CLLocationManagerDelegate, ObservableObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func startBgTracking() {
|
func startBgTracking() {
|
||||||
|
// guard mana
|
||||||
manager.allowsBackgroundLocationUpdates = true
|
manager.allowsBackgroundLocationUpdates = true
|
||||||
manager.pausesLocationUpdatesAutomatically = false
|
manager.pausesLocationUpdatesAutomatically = false
|
||||||
manager.startMonitoringSignificantLocationChanges()
|
manager.startMonitoringSignificantLocationChanges()
|
||||||
@@ -53,6 +54,6 @@ class Backgrounder: NSObject, CLLocationManagerDelegate, ObservableObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
|
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)
|
.frame(height: 30)
|
||||||
.onDisappear {
|
|
||||||
UIApplication.shared.isIdleTimerDisabled = false
|
|
||||||
if container.sessions.isEmpty {
|
|
||||||
Backgrounder.shared.stopBgTracking()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.onAppear {
|
.onAppear {
|
||||||
if selectedID == nil {
|
if selectedID == nil {
|
||||||
if let handler {
|
if let handler {
|
||||||
@@ -163,10 +157,6 @@ struct ShellTabView: View {
|
|||||||
dismiss()
|
dismiss()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
UIApplication.shared.isIdleTimerDisabled = hostsManager.settings.caffeinate
|
|
||||||
if hostsManager.settings.locationPersist {
|
|
||||||
Backgrounder.shared.startBgTracking()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -177,6 +167,12 @@ struct ShellTabView: View {
|
|||||||
handler: session.handler,
|
handler: session.handler,
|
||||||
hostsManager: hostsManager
|
hostsManager: hostsManager
|
||||||
)
|
)
|
||||||
|
.onAppear {
|
||||||
|
UIApplication.shared.isIdleTimerDisabled = hostsManager.settings.caffeinate
|
||||||
|
if hostsManager.settings.locationPersist {
|
||||||
|
Backgrounder.shared.startBgTracking()
|
||||||
|
}
|
||||||
|
}
|
||||||
.onDisappear {
|
.onDisappear {
|
||||||
if !checkShell(session.handler.state) {
|
if !checkShell(session.handler.state) {
|
||||||
if let lastSession = container.sessionIDs.last {
|
if let lastSession = container.sessionIDs.last {
|
||||||
@@ -185,6 +181,10 @@ struct ShellTabView: View {
|
|||||||
dismiss()
|
dismiss()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
UIApplication.shared.isIdleTimerDisabled = false
|
||||||
|
if container.sessions.isEmpty {
|
||||||
|
Backgrounder.shared.stopBgTracking()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.id(selectedID)
|
.id(selectedID)
|
||||||
.transition(.opacity)
|
.transition(.opacity)
|
||||||
|
|||||||
Reference in New Issue
Block a user