Move silent signin to MainActivity

KlottrAppShell now fully platform independent
This commit is contained in:
Olof Hedman
2025-09-29 11:58:52 +02:00
parent 9a1a2b6e14
commit 8b699056d2
2 changed files with 2 additions and 6 deletions

View File

@@ -28,11 +28,9 @@ import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.decodeToImageBitmap
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.unit.dp
import app.cash.sqldelight.coroutines.asFlow // SQLDelight coroutine-extensions (Flow-stöd för queries)
import app.cash.sqldelight.coroutines.mapToList // SQLDelight coroutine-extensions (Flow-stöd för queries)
import app.klottr.auth.AuthPlatform
import app.klottr.create.CreateNoteOutcome
import app.klottr.create.QueueOutboxOutcome
import app.klottr.create.createNoteFlow
@@ -111,12 +109,8 @@ fun KlottrAppShell(
val currentLoc = locService.location.collectAsState(initial = null)
val scope = rememberCoroutineScope()
// Hämta Android-Context (behövs för att skapa databasen på Android).
val context = LocalContext.current
// Inloggning
val loggedIn by AuthShared.loggedIn.collectAsState(initial = false)
LaunchedEffect(Unit) { AuthPlatform.refreshSilently(context) { } }
// Initiera SQLDelight-databasen med hjälp av DatabaseFactory.
val db = remember {

View File

@@ -120,6 +120,8 @@ class MainActivity : ComponentActivity() {
Log.d("Klottr", "Shared ping = $sharedPing")
}
LaunchedEffect(Unit) { AuthPlatform.refreshSilently(applicationContext) { } }
// Säkerställ att delad ImageReader har appContext på Android
ImageReader.init(applicationContext)
ImageWriter.init(applicationContext)