Skip to content

Commit 9d84cdd

Browse files
authored
Merge pull request #259 from DimensionDev/bugfix/create_wallet_route
2 parents eb20f48 + 9abc3d7 commit 9d84cdd

1 file changed

Lines changed: 13 additions & 18 deletions

File tree

  • wallet/src/androidMain/kotlin/com/dimension/maskbook/wallet/route

wallet/src/androidMain/kotlin/com/dimension/maskbook/wallet/route/WalletsRoute.kt

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ import androidx.navigation.NavController
4242
import androidx.navigation.navOptions
4343
import com.dimension.maskbook.common.bigDecimal.BigDecimal
4444
import com.dimension.maskbook.common.ext.decodeBase64
45+
import com.dimension.maskbook.common.ext.navigateWithPopSelf
4546
import com.dimension.maskbook.common.ext.observeAsState
4647
import com.dimension.maskbook.common.ext.openUrl
4748
import com.dimension.maskbook.common.ext.shareText
@@ -599,7 +600,7 @@ internal fun navigateWalletCreate(
599600
) {
600601
val route = if (shouldShowLegalScene) {
601602
WalletRoute.WalletIntroHostLegal(type.name)
602-
} else if (password.isNullOrEmpty()) {
603+
} else if (password.isEmpty()) {
603604
WalletRoute.WalletIntroHostPassword(type.name)
604605
} else if (!enableBiometric && biometricEnableViewModel.isSupported(context) && wallets.isEmpty()) {
605606
WalletRoute.WalletIntroHostFaceId(type.name)
@@ -608,12 +609,6 @@ internal fun navigateWalletCreate(
608609
}
609610
navController.navigate(
610611
route,
611-
navOptions {
612-
navController.currentDestination?.id?.let { popId ->
613-
popUpTo(popId) { inclusive = true }
614-
}
615-
launchSingleTop = true
616-
}
617612
)
618613
}
619614

@@ -647,15 +642,15 @@ fun WalletIntroHostLegal(
647642
} else {
648643
WalletRoute.CreateOrImportWallet(type.name)
649644
}
650-
navController.navigate(
651-
route,
652-
navOptions {
653-
navController.currentDestination?.id?.let { popId ->
654-
popUpTo(popId) { inclusive = true }
655-
}
656-
launchSingleTop = true
657-
}
658-
)
645+
if (password.isNullOrEmpty()) {
646+
navController.navigate(
647+
route,
648+
)
649+
} else {
650+
navController.navigateWithPopSelf(
651+
route,
652+
)
653+
}
659654
},
660655
onBrowseAgreement = {
661656
context.startActivity(
@@ -687,9 +682,9 @@ fun WalletIntroHostPassword(
687682
SetUpPaymentPassword(
688683
onNext = {
689684
if (!enableBiometric && biometricEnableViewModel.isSupported(context) && wallets.isEmpty()) {
690-
navController.navigate(WalletRoute.WalletIntroHostFaceId(type.name))
685+
navController.navigateWithPopSelf(WalletRoute.WalletIntroHostFaceId(type.name))
691686
} else {
692-
navController.navigate(WalletRoute.CreateOrImportWallet(type.name))
687+
navController.navigateWithPopSelf(WalletRoute.CreateOrImportWallet(type.name))
693688
}
694689
}
695690
)

0 commit comments

Comments
 (0)