File tree Expand file tree Collapse file tree 4 files changed +9
-4
lines changed
app/src/main/java/to/bitkit Expand file tree Collapse file tree 4 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -83,7 +83,8 @@ class LightningRepo @Inject constructor(
8383 private val scope = CoroutineScope (bgDispatcher + SupervisorJob ())
8484
8585 private var cachedEventHandler: NodeEventHandler ? = null
86- private var isRecoveryMode: Boolean = false
86+ private val _isRecoveryMode = MutableStateFlow (false )
87+ val isRecoveryMode = _isRecoveryMode .asStateFlow()
8788
8889 /* *
8990 * Executes the provided operation only if the node is running.
@@ -170,7 +171,7 @@ class LightningRepo @Inject constructor(
170171 customServerUrl : String? = null,
171172 customRgsServerUrl : String? = null,
172173 ): Result <Unit > = withContext(bgDispatcher) {
173- if (isRecoveryMode ) {
174+ if (_isRecoveryMode .value ) {
174175 return @withContext Result .failure(
175176 RecoveryModeException (" App in recovery mode, skipping node start" )
176177 )
@@ -254,7 +255,7 @@ class LightningRepo @Inject constructor(
254255 }
255256
256257 fun setRecoveryMode (enabled : Boolean ) {
257- isRecoveryMode = enabled
258+ _isRecoveryMode .value = enabled
258259 }
259260
260261 suspend fun updateGeoBlockState () {
Original file line number Diff line number Diff line change @@ -88,7 +88,8 @@ class MainActivity : FragmentActivity() {
8888 }
8989 ) {
9090 val scope = rememberCoroutineScope()
91- if (! walletViewModel.walletExists) {
91+ val isRecoveryMode by walletViewModel.isRecoveryMode.collectAsStateWithLifecycle()
92+ if (! walletViewModel.walletExists && ! isRecoveryMode) {
9293 OnboardingNav (
9394 startupNavController = rememberNavController(),
9495 scope = scope,
Original file line number Diff line number Diff line change @@ -146,6 +146,7 @@ private fun Content(
146146
147147 SecondaryButton (
148148 text = stringResource(R .string.security__wipe_app),
149+ enabled = walletExists,
149150 onClick = onWipeApp,
150151 )
151152 }
Original file line number Diff line number Diff line change @@ -55,6 +55,8 @@ class WalletViewModel @Inject constructor(
5555 var walletExists by mutableStateOf(walletRepo.walletExists())
5656 private set
5757
58+ val isRecoveryMode = lightningRepo.isRecoveryMode
59+
5860 var restoreState by mutableStateOf<RestoreState >(RestoreState .NotRestoring )
5961 private set
6062
You can’t perform that action at this time.
0 commit comments