diff --git a/ios/Klottr/Klottr/AppDelegate.swift b/ios/Klottr/Klottr/AppDelegate.swift
index fc96705..8ba4320 100644
--- a/ios/Klottr/Klottr/AppDelegate.swift
+++ b/ios/Klottr/Klottr/AppDelegate.swift
@@ -11,10 +11,18 @@ import UIKit
import GoogleSignIn
import shared
+@main
class AppDelegate: UIResponder, UIApplicationDelegate {
+ var window: UIWindow?
+
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
PlatformAuthStorage.shared.install(delegate: KeychainStorage())
+
+ window = UIWindow(frame: UIScreen.main.bounds)
+ window?.rootViewController = MainKt.MainViewController() // adjust pkg
+ window?.makeKeyAndVisible()
+
return true
}
func application(_ app: UIApplication,
diff --git a/ios/Klottr/Klottr/Info.plist b/ios/Klottr/Klottr/Info.plist
index 33ce163..c6458ea 100644
--- a/ios/Klottr/Klottr/Info.plist
+++ b/ios/Klottr/Klottr/Info.plist
@@ -27,5 +27,6 @@
508890452239-66lqrsbphlmqltb6aoe3c0d6dlgtjse8.apps.googleusercontent.com
GIDServerClientID
508890452239-5hdoedc9b4rk3k5mmru176lj7f04135r.apps.googleusercontent.com
+ CADisableMinimumFrameDurationOnPhone
diff --git a/ios/Klottr/Klottr/KlottrApp.swift b/ios/Klottr/Klottr/KlottrApp.swift
index de0ac3c..1d47b92 100644
--- a/ios/Klottr/Klottr/KlottrApp.swift
+++ b/ios/Klottr/Klottr/KlottrApp.swift
@@ -7,14 +7,14 @@
import SwiftUI
-@main
-struct KlottrApp: App {
- // Make AppDelegate participate in the SwiftUI lifecycle
- @UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
-
- var body: some Scene {
- WindowGroup {
- ContentView()
- }
- }
-}
+//@main
+//struct KlottrApp: App {
+// // Make AppDelegate participate in the SwiftUI lifecycle
+// @UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
+//
+// var body: some Scene {
+// WindowGroup {
+// ContentView()
+// }
+// }
+//}
diff --git a/shared/build.gradle.kts b/shared/build.gradle.kts
index ee0966e..6789127 100644
--- a/shared/build.gradle.kts
+++ b/shared/build.gradle.kts
@@ -94,6 +94,10 @@ kotlin {
// Lämna AndroidX Compose BOM/runtimes utanför :shared.
implementation(compose.runtime)
implementation(compose.foundation)
+ implementation(compose.material)
+ implementation(compose.material3)
+ // Material Icons (Icons.Filled.*, Icons.Outlined.*)
+ implementation(compose.materialIconsExtended)
// för Compose i :shared (Android-del)
// OBS: Dessa AndroidX Compose-rader ska förbli utkommenterade i :shared.
diff --git a/shared/src/commonMain/kotlin/app/klottr/KlottrRoot.kt b/shared/src/commonMain/kotlin/app/klottr/KlottrRoot.kt
new file mode 100644
index 0000000..d30f30b
--- /dev/null
+++ b/shared/src/commonMain/kotlin/app/klottr/KlottrRoot.kt
@@ -0,0 +1,363 @@
+// :shared/src/commonMain/kotlin/app/klottr/KlottrRoot.kt
+package app.klottr
+
+import androidx.compose.foundation.layout.Arrangement
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.Row
+import androidx.compose.foundation.layout.Spacer
+import androidx.compose.foundation.layout.fillMaxSize
+import androidx.compose.foundation.layout.fillMaxWidth
+import androidx.compose.foundation.layout.height
+import androidx.compose.foundation.layout.padding
+import androidx.compose.material.icons.Icons
+import androidx.compose.material.icons.filled.Info
+import androidx.compose.material.icons.filled.Map
+import androidx.compose.material.icons.filled.NearMe
+import androidx.compose.material.icons.filled.Settings
+import androidx.compose.material.icons.filled.Edit
+import androidx.compose.material3.AlertDialog
+import androidx.compose.material3.Button
+import androidx.compose.material3.CenterAlignedTopAppBar
+import androidx.compose.material3.ExperimentalMaterial3Api
+import androidx.compose.material3.FilterChip
+import androidx.compose.material3.Icon
+import androidx.compose.material3.IconButton
+import androidx.compose.material3.MaterialTheme
+import androidx.compose.material3.Scaffold
+import androidx.compose.material3.Text
+import androidx.compose.material3.TextButton
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.LaunchedEffect
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.remember
+import androidx.compose.runtime.rememberCoroutineScope
+import androidx.compose.runtime.setValue
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.unit.dp
+
+@OptIn(ExperimentalMaterial3Api::class)
+@Composable
+fun KlottrRoot(
+ onRequestPerms: () -> Unit = {},
+ onLogin: () -> Unit = {},
+ onLogout: () -> Unit = {}
+) {
+ val scope = rememberCoroutineScope()
+
+ // --- Settings/state (kept local; wire to SettingsStore later) ----------------------
+ var night by remember { mutableStateOf(false) }
+ var showCoords by remember { mutableStateOf(false) }
+
+ var showKlotter by remember { mutableStateOf(true) }
+ var showWiki by remember { mutableStateOf(true) }
+ var showDm by remember { mutableStateOf(true) }
+ var showFornsok by remember { mutableStateOf(true) }
+
+ var wikiRadius by remember { mutableStateOf(500) }
+ var dmRadius by remember { mutableStateOf(500) }
+ var fornsokRadius by remember { mutableStateOf(500) }
+
+ var satellite by remember { mutableStateOf(false) }
+ var onlyNew by remember { mutableStateOf(false) }
+
+ // --- Top-level UI mode flags (dialogs/sheets) -------------------------------------
+ var showWrite by remember { mutableStateOf(false) }
+ var showNearby by remember { mutableStateOf(false) }
+ var showMap by remember { mutableStateOf(false) }
+ var showSettings by remember { mutableStateOf(false) }
+ var showLoginRequired by remember { mutableStateOf(false) }
+ var showAbout by remember { mutableStateOf(false) }
+
+ // --- Auth (local stub; replace with shared Auth later) ----------------------------
+ var loggedIn by remember { mutableStateOf(false) }
+
+ LaunchedEffect(Unit) {
+ // TODO(shared Auth): collect Auth.loggedIn and refresh silently.
+ // val logged by Auth.loggedIn.collectAsState(false)
+ // Auth.refreshSilently() { }
+ }
+
+ Scaffold(
+ topBar = {
+ CenterAlignedTopAppBar(
+ title = { Text("") },
+ actions = {
+ IconButton(onClick = { showAbout = true }) {
+ Icon(imageVector = Icons.Filled.Info, contentDescription = "Om")
+ }
+ IconButton(onClick = { showSettings = true }) {
+ Icon(imageVector = Icons.Filled.Settings, contentDescription = "Inställningar")
+ }
+ }
+ )
+ }
+ ) { padding ->
+ Column(
+ modifier = Modifier
+ .fillMaxSize()
+ .padding(padding)
+ .padding(horizontal = 16.dp, vertical = 8.dp)
+ ) {
+ // --- Quick actions (Write / Nearby / Map) ---------------------------------
+ Row(
+ modifier = Modifier.fillMaxWidth(),
+ horizontalArrangement = Arrangement.spacedBy(8.dp)
+ ) {
+ Button(
+ onClick = {
+ if (!loggedIn) {
+ showLoginRequired = true
+ } else {
+ showWrite = true
+ }
+ }
+ ) {
+ Icon(Icons.Filled.Edit, contentDescription = null)
+ Spacer(Modifier.padding(2.dp))
+ Text("Klottra")
+ }
+ Button(
+ onClick = {
+ // TODO(location): fetch current/last known location via expect/actual.
+ // val gp = LocationProvider.currentOrLastKnown()
+ showNearby = true
+ }
+ ) {
+ Icon(Icons.Filled.NearMe, contentDescription = null)
+ Spacer(Modifier.padding(2.dp))
+ Text("Närliggande")
+ }
+ Button(
+ onClick = {
+ // TODO(map): present map dialog (UIKitView on iOS; GoogleMap on Android).
+ showMap = true
+ }
+ ) {
+ Icon(Icons.Filled.Map, contentDescription = null)
+ Spacer(Modifier.padding(2.dp))
+ Text("Karta")
+ }
+ }
+
+ Spacer(Modifier.height(8.dp))
+
+ // --- Filters row -----------------------------------------------------------
+ Row(
+ modifier = Modifier.fillMaxWidth(),
+ horizontalArrangement = Arrangement.spacedBy(8.dp),
+ verticalAlignment = Alignment.CenterVertically
+ ) {
+ FilterChip(
+ selected = showKlotter,
+ onClick = { showKlotter = !showKlotter },
+ label = { Text("Klotter") }
+ )
+ FilterChip(
+ selected = showWiki,
+ onClick = { showWiki = !showWiki },
+ label = { Text("Wikipedia") }
+ )
+ FilterChip(
+ selected = showDm,
+ onClick = { showDm = !showDm },
+ label = { Text("Digitalt Museum") }
+ )
+ FilterChip(
+ selected = showFornsok,
+ onClick = { showFornsok = !showFornsok },
+ label = { Text("Fornsök") }
+ )
+ }
+
+ Spacer(Modifier.height(12.dp))
+
+ // --- Latest / Found list ---------------------------------------------------
+ // NOTE: Hook the real data once shared store + use-cases are wired on iOS.
+ // val entries = remember(foundRefresh, showKlotter, showWiki, showDm, showFornsok) {
+ // FoundStore.getAllFiltered(onlyNew, showKlotter, showWiki, showDm, showFornsok)
+ // }
+ // FoundContent(
+ // entries = entries,
+ // currentLat = /* last known lat */ null,
+ // currentLon = /* last known lon */ null,
+ // showCoords = showCoords,
+ // labelOverrides = emptyMap(),
+ // isClickable = { it.layer != FoundStore.LAYER_UNKNOWN },
+ // onEntryClick = { /* TODO(open wiki/fornsök/dm/klotter) */ },
+ // isBold = { f -> /* !FoundStore.isAway(, f.layer, f.id) */ false },
+ // distanceFormatter = ::formatDistance,
+ // coordsFormatter = ::formatCoords,
+ // rowTextStyle = MaterialTheme.typography.bodyMedium
+ // )
+ PlaceholderFoundList()
+ }
+ }
+
+ // --- About ------------------------------------------------------------------------
+ if (showAbout) {
+ AlertDialog(
+ onDismissRequest = { showAbout = false },
+ title = { Text("Om") },
+ text = {
+ Text("Klottr – Compose Multiplatform. (Denna dialog är delad mellan Android & iOS.)")
+ },
+ confirmButton = {
+ TextButton(onClick = { showAbout = false }) { Text("OK") }
+ }
+ )
+ }
+
+ // --- Settings ---------------------------------------------------------------------
+ if (showSettings) {
+ // If you already have SettingsDialog in :shared, you can uncomment and use it.
+// SettingsDialog(
+// onlyNew = onlyNew,
+// satellite = satellite,
+// night = night,
+// showCoords = showCoords,
+// onShowCoordsChanged = { /* SettingsStore.setShowCoordinates(it); */ showCoords = it },
+// showKlotter = showKlotter,
+// showWiki = showWiki,
+// wikiRadius = wikiRadius,
+// showDm = showDm,
+// dmRadius = dmRadius,
+// showFornsok = showFornsok,
+// fornsokRadius = fornsokRadius,
+// onOnlyNewChanged = { /* SettingsStore.setOnlyNew(it); */ onlyNew = it },
+// onSatelliteChanged = { /* SettingsStore.setSatellite(it); */ satellite = it },
+// onNightChanged = { /* SettingsStore.setNightMode(it); */ night = it },
+// onShowKlotterChanged = { /* SettingsStore.setShowKlotter(it); */ showKlotter = it },
+// onShowWikiChanged = { /* SettingsStore.setShowWikipedia(it); */ showWiki = it },
+// onWikiRadiusChanged = { /* SettingsStore.setWikiRadiusMeters(it); */ wikiRadius = it },
+// onShowDmChanged = { /* SettingsStore.setShowDigitaltMuseum(it); */ showDm = it },
+// onDmRadiusChanged = { /* SettingsStore.setDigitaltMuseumRadiusMeters(it); */ dmRadius = it },
+// onShowFornsokChanged = { /* SettingsStore.setShowFornsok(it); */ showFornsok = it },
+// onFornsokRadiusChanged = { /* SettingsStore.setFornsokRadiusMeters(it); */ fornsokRadius = it },
+// onClearFinds = {
+// // TODO(shared): FoundStore.clearAll()
+// },
+// onClose = { showSettings = false }
+// )
+// SimpleSettingsDialog(
+// onlyNew = onlyNew,
+// satellite = satellite,
+// night = night,
+// showCoords = showCoords,
+// onOnlyNewChanged = { onlyNew = it },
+// onSatelliteChanged = { satellite = it },
+// onNightChanged = { night = it },
+// onShowCoordsChanged = { showCoords = it },
+// onClose = { showSettings = false }
+// )
+ }
+
+ // --- Write / Nearby / Map (left commented-out so iOS builds immediately) ----------
+ if (showWrite) {
+ // WriteDocDialog(
+ // onClose = { showWrite = false },
+ // onDone = { /* TODO(upload note + refresh */ showWrite = false }
+ // )
+ // Placeholder:
+ AlertDialog(
+ onDismissRequest = { showWrite = false },
+ title = { Text("Klottra") },
+ text = { Text("TODO: Implementera skriv-notering för iOS (kamera/foto/position).") },
+ confirmButton = { TextButton({ showWrite = false }) { Text("Stäng") } }
+ )
+ }
+
+ if (showNearby) {
+ // NearbyDialog(
+ // /* inputs incl. last-known location & filters */,
+ // onMarkedFound = { /* refresh found list */ },
+ // onClose = { showNearby = false }
+ // )
+ AlertDialog(
+ onDismissRequest = { showNearby = false },
+ title = { Text("Närliggande") },
+ text = { Text("TODO: Visa närliggande fynd (kräver platsbehörighet).") },
+ confirmButton = { TextButton({ showNearby = false }) { Text("Stäng") } }
+ )
+ }
+
+ if (showMap) {
+ // MapDialog(
+ // onClose = { showMap = false },
+ // onKlotterClick = { id, la, lo -> /* TODO(open) */ },
+ // onWikiClick = { pageId -> /* TODO(open) */ },
+ // onDmClick = { item -> /* TODO(open) */ },
+ // onFornsokClick = { item -> /* TODO(open) */ }
+ // )
+ AlertDialog(
+ onDismissRequest = { showMap = false },
+ title = { Text("Karta") },
+ text = { Text("TODO: Karta via expect/actual (UIKitView på iOS).") },
+ confirmButton = { TextButton({ showMap = false }) { Text("Stäng") } }
+ )
+ }
+
+ // --- Login required ---------------------------------------------------------------
+ if (showLoginRequired) {
+ AlertDialog(
+ onDismissRequest = { showLoginRequired = false },
+ title = { Text("Inloggning krävs") },
+ text = { Text("Du måste logga in för att kunna klottra.") },
+ confirmButton = {
+ TextButton(onClick = {
+ showLoginRequired = false
+ onLogin()
+ // TODO(shared Auth): set loggedIn=true when Auth completes.
+ }) { Text("Logga in") }
+ },
+ dismissButton = {
+ TextButton(onClick = { showLoginRequired = false }) { Text("Stäng") }
+ }
+ )
+ }
+}
+
+// --- Helpers --------------------------------------------------------------------------
+
+@Composable
+private fun PlaceholderFoundList() {
+ Column(
+ modifier = Modifier
+ .fillMaxWidth()
+ .padding(top = 12.dp),
+ verticalArrangement = Arrangement.spacedBy(8.dp)
+ ) {
+ Text(
+ "Inga fynd ännu.",
+ style = MaterialTheme.typography.bodyMedium,
+ color = MaterialTheme.colorScheme.onSurface
+ )
+ // TIP: Replace with FoundContent(...) once wired on iOS.
+ }
+}
+
+// Keep these signatures handy if you want to pass formatters into FoundContent later.
+private fun formatDistance(meters: Double?): String =
+ meters?.let { if (it >= 1000.0) "${(it / 1000.0).toStringAsFixed(1)} km" else "${it.toInt()} m" } ?: ""
+
+private fun formatCoords(lat: Double?, lon: Double?): String =
+ if (lat == null || lon == null) "" else "${lat.toStringAsFixed(5)}, ${lon.toStringAsFixed(5)}"
+
+// Small utility (MPP-friendly) for 1 decimal formatting without Locale issues
+private fun Double.toStringAsFixed(decimals: Int): String {
+ val pow = pow10(decimals)
+ val v = kotlin.math.round(this * pow) / pow
+ var s = v.toString()
+ if (!s.contains('.')) s += "."
+ val idx = s.indexOf('.')
+ val need = decimals - (s.length - idx - 1)
+ if (need > 0) s += "0".repeat(need)
+ return s
+}
+
+private fun pow10(exp: Int): Double {
+ var p = 1.0
+ repeat(exp) { p *= 10.0 }
+ return p
+}
\ No newline at end of file
diff --git a/shared/src/iosMain/kotlin/app/klottr/Main.kt b/shared/src/iosMain/kotlin/app/klottr/Main.kt
new file mode 100644
index 0000000..c2f9f91
--- /dev/null
+++ b/shared/src/iosMain/kotlin/app/klottr/Main.kt
@@ -0,0 +1,7 @@
+package app.klottr
+
+import androidx.compose.ui.window.ComposeUIViewController
+import platform.UIKit.UIViewController
+
+fun MainViewController(): UIViewController =
+ ComposeUIViewController { KlottrRoot() }