Location refactor compiles and seemingly works

Location updates now handled in a more compose friendly way via StateFlow
Lots of small changed in MainActivity and DetailDialogShell to make them platform independent
Add new platform apis for openUrl, openMap (AppNavigator)
Add Platform independent OutboxScheduler
Try to clean up event handling of FoundEvents and location updates (need more cleanup)
New wrapper for handling App Context in shared (could be used to clean up integration further)
This commit is contained in:
Olof Hedman
2025-09-24 16:23:38 +02:00
parent 0d1e54fcd8
commit 642e546a09
20 changed files with 317 additions and 230 deletions

View File

@@ -0,0 +1,25 @@
package app.klottr.platform
import platform.Foundation.NSURL
import platform.UIKit.UIApplication
import platform.UIKit.UIApplicationOpenSettingsURLString
import platform.UIKit.UIApplicationSharedApplication
actual object AppNavigator {
actual fun openUrl(url: String) {
val nsUrl = NSURL.URLWithString(url) ?: return
UIApplication.sharedApplication.openURL(nsUrl)
}
actual fun openMap(lat: Double, lon: Double, label: String?) {
// Use Apple Maps URL scheme
val encoded = label?.let { it } ?: "Place"
val url = "http://maps.apple.com/?ll=$lat,$lon&q=$encoded"
openUrl(url)
}
}
actual object UiFeedback {
actual fun showMessage(text: String, duration: UiFeedbackDuration) {
// No-op or implement a lightweight HUD; keeping no-op by default.
}
}

View File

@@ -0,0 +1,7 @@
package app.klottr.platform
actual object OutboxScheduler {
actual fun scheduleUpload() {
// iOS can use BGTaskScheduler / background URLSession; left as future hook.
}
}