Merge branch 'mantra' into claude/proposals-signature-card-090e46
This commit is contained in:
@@ -30,7 +30,6 @@ import kotlinx.coroutines.flow.first
|
||||
@Composable
|
||||
fun SovereignWalletStartupScreen(
|
||||
sovereignWalletViewModel: press.mantra.compose.ui.view.model.SovereignWalletViewModel,
|
||||
onNavigateToWalletIntroPage: () -> Unit,
|
||||
onNavigateToWalletLandingPage: () -> Unit,
|
||||
onSuccessfulStartup: () -> Unit,
|
||||
forceWalletId: WalletId?,
|
||||
@@ -41,10 +40,11 @@ fun SovereignWalletStartupScreen(
|
||||
)
|
||||
)
|
||||
|
||||
val showIntro = sovereignWalletStartupViewModel.getShowIntroFlow().collectAsState(initial = null)
|
||||
if (showIntro.value == true) {
|
||||
LaunchedEffect(Unit) { onNavigateToWalletIntroPage.invoke() }
|
||||
}
|
||||
// Deliberately no intro gate. `getShowIntro` defaults to true and nothing in this app ever
|
||||
// writes it back to false, so gating on it navigated away from this screen on every cold boot
|
||||
// — and a screen that has been left behind never gets to start the wallet. Startup has to run
|
||||
// to completion here: everything downstream reads the node's key manager. An intro screen has
|
||||
// to be a step inside this flow, not a detour around it.
|
||||
|
||||
Box(
|
||||
modifier = Modifier
|
||||
|
||||
@@ -372,21 +372,14 @@ fun MantraNavHost(
|
||||
|
||||
SovereignWalletStartupScreen(
|
||||
sovereignWalletViewModel = sovereignWalletViewModel,
|
||||
// No seed on this device, so there is no wallet to start: the user has to make or
|
||||
// restore one, and that lives behind the landing screen. This used to park them on
|
||||
// a loading screen with nothing left to load.
|
||||
onNavigateToWalletLandingPage = {
|
||||
navController.navigate(
|
||||
route = LoadingRoute(
|
||||
text = "Loading... Torch"
|
||||
)
|
||||
)
|
||||
},
|
||||
onNavigateToWalletIntroPage = {
|
||||
navController.navigate(
|
||||
route = LoadingRoute(
|
||||
text = "Introducing... Torch"
|
||||
)
|
||||
)
|
||||
applicationIOScope.launch {
|
||||
navigationViewModel.loadNostrProfile(route)
|
||||
route = LandingRoute
|
||||
) {
|
||||
popUpTo(0)
|
||||
}
|
||||
},
|
||||
onSuccessfulStartup = {
|
||||
|
||||
@@ -18,6 +18,7 @@ import kotlinx.coroutines.flow.StateFlow
|
||||
import kotlinx.coroutines.flow.asStateFlow
|
||||
import kotlinx.coroutines.flow.collectLatest
|
||||
import kotlinx.coroutines.flow.distinctUntilChanged
|
||||
import kotlinx.coroutines.flow.firstOrNull
|
||||
import kotlinx.coroutines.flow.getAndUpdate
|
||||
import kotlinx.coroutines.launch
|
||||
import press.mantra.compose.extensions.nostrPublicKey
|
||||
@@ -76,19 +77,21 @@ class NavigationViewModel(
|
||||
NavigationUIState.StartupPhoenix
|
||||
}
|
||||
}
|
||||
} else if (startupRoute != null) {
|
||||
// This branch was commented out when `observeProfile` was renamed to
|
||||
// `observeLocalAccount`, which turned the whole call into a no-op for anyone who
|
||||
// already had an account: the caller had navigated to a loading screen first and then
|
||||
// nothing ever moved the user off it. Every path out of here must leave the navigation
|
||||
// state pointing somewhere.
|
||||
processLocalAccount(
|
||||
nostrRepository.observeLocalAccount(
|
||||
publicKey = activeUserPublicKey
|
||||
).firstOrNull()
|
||||
)
|
||||
} else {
|
||||
// if (startupRoute != null) {
|
||||
// val localAccount = nostrRepository.observeProfile(
|
||||
// publicKey = activeUserPublicKey
|
||||
// ).firstOrNull()
|
||||
//
|
||||
// processLocalAccount(localAccount)
|
||||
//
|
||||
// } else {
|
||||
// _navigationUIState.getAndUpdate {
|
||||
// NavigationUIState.StartupPhoenix
|
||||
// }
|
||||
// }
|
||||
_navigationUIState.getAndUpdate {
|
||||
NavigationUIState.StartupPhoenix
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user