feat: localisation with lyricist
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user