feat: localisation with lyricist

This commit is contained in:
2026-06-05 23:52:30 +02:00
parent 039f1c430a
commit ed3371aa6f
12 changed files with 453 additions and 243 deletions
@@ -36,6 +36,9 @@ import com.bitcointxoko.gudariwallet.util.IntentUtils
import kotlinx.coroutines.flow.MutableSharedFlow
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import cafe.adriel.lyricist.ProvideStrings
import cafe.adriel.lyricist.rememberStrings
import com.bitcointxoko.gudariwallet.i18n.AppStrings
class MainActivity : AppCompatActivity() {
@@ -113,29 +116,36 @@ class MainActivity : AppCompatActivity() {
setContent {
GudariWalletTheme {
val credentials by credentialsState.collectAsState()
// Treat null (loading) the same as not-onboarded to avoid a flash
val isOnboarded = credentials?.isOnboarded == true
// ── Lyricist ──────────────────────────────────────────────────
val lyricist = rememberAppStrings()
ProvideStrings(lyricist, LocalAppStrings) {
// ─────────────────────────────────────────────────────────────
if (isOnboarded) {
LaunchedEffect(Unit) {
WalletNotificationService.start(this@MainActivity)
requestNotificationPermissionIfNeeded()
promptBatteryOptimizationIfNeeded()
val credentials by credentialsState.collectAsState()
val isOnboarded = credentials?.isOnboarded == true
if (isOnboarded) {
LaunchedEffect(Unit) {
WalletNotificationService.start(this@MainActivity)
requestNotificationPermissionIfNeeded()
promptBatteryOptimizationIfNeeded()
}
WalletScreen(
vm = vm,
nfcVm = nfcVm,
pendingPaymentHash = pendingPaymentHash,
pendingPaymentUri = pendingPaymentUri,
lyricist = lyricist // ← pass down
)
} else {
OnboardingScreen(
secretStore = secretStore,
onComplete = { }
)
}
WalletScreen(
vm = vm,
nfcVm = nfcVm,
pendingPaymentHash = pendingPaymentHash,
pendingPaymentUri = pendingPaymentUri
)
} else {
OnboardingScreen(
secretStore = secretStore,
onComplete = { /* no-op: Flow update triggers recomposition automatically */ }
)
}
} // end ProvideStrings
}
}
}