diff --git a/app/src/main/java/com/babylon/wallet/android/presentation/settings/appsettings/AppSettingsNav.kt b/app/src/main/java/com/babylon/wallet/android/presentation/settings/appsettings/AppSettingsNav.kt index 1a5aa428f2..680cb56083 100644 --- a/app/src/main/java/com/babylon/wallet/android/presentation/settings/appsettings/AppSettingsNav.kt +++ b/app/src/main/java/com/babylon/wallet/android/presentation/settings/appsettings/AppSettingsNav.kt @@ -73,10 +73,6 @@ fun NavGraphBuilder.appSettingsScreen( SettingsItem.AppSettingsItem.Gateways -> { navController.navigate(Screen.SettingsEditGatewayApiDestination.route) } - - is SettingsItem.AppSettingsItem.Backups -> { - navController.backupScreen() - } is SettingsItem.AppSettingsItem.CrashReporting, is SettingsItem.AppSettingsItem.DeveloperMode -> {} SettingsItem.AppSettingsItem.EntityHiding -> { diff --git a/app/src/main/java/com/babylon/wallet/android/presentation/settings/appsettings/AppSettingsScreen.kt b/app/src/main/java/com/babylon/wallet/android/presentation/settings/appsettings/AppSettingsScreen.kt index 9c8be01c26..47d028c52f 100644 --- a/app/src/main/java/com/babylon/wallet/android/presentation/settings/appsettings/AppSettingsScreen.kt +++ b/app/src/main/java/com/babylon/wallet/android/presentation/settings/appsettings/AppSettingsScreen.kt @@ -11,6 +11,9 @@ import androidx.compose.material3.HorizontalDivider import androidx.compose.material3.Scaffold import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource @@ -20,6 +23,7 @@ import com.babylon.wallet.android.R import com.babylon.wallet.android.designsystem.theme.RadixTheme import com.babylon.wallet.android.designsystem.theme.RadixWalletTheme import com.babylon.wallet.android.presentation.settings.SettingsItem +import com.babylon.wallet.android.presentation.ui.composables.BasicPromptAlertDialog import com.babylon.wallet.android.presentation.ui.composables.DefaultSettingsItem import com.babylon.wallet.android.presentation.ui.composables.RadixCenteredTopAppBar import com.babylon.wallet.android.presentation.ui.composables.SwitchSettingsItem @@ -52,6 +56,19 @@ private fun AppSettingsContent( onBackClick: () -> Unit, onCrashReportingToggled: (Boolean) -> Unit, ) { + var crashReportingPromptVisible by remember { mutableStateOf(false) } + if (crashReportingPromptVisible) { + BasicPromptAlertDialog( + finish = { accepted -> + if (accepted) { + onCrashReportingToggled(true) + } + crashReportingPromptVisible = false + }, + title = "Crash Reporting", // TODO crowdin + text = "I'm aware Radix Wallet will send crash reports together with device state." // TODO crowdin + ) + } Scaffold( modifier = modifier, topBar = { @@ -92,6 +109,7 @@ private fun AppSettingsContent( onCheckedChange = onDeveloperModeToggled ) } + is SettingsItem.AppSettingsItem.CrashReporting -> { SwitchSettingsItem( modifier = Modifier @@ -100,9 +118,16 @@ private fun AppSettingsContent( titleRes = appSettingsItem.descriptionRes(), iconResource = appSettingsItem.getIcon(), checked = appSettingsItem.enabled, - onCheckedChange = onCrashReportingToggled + onCheckedChange = { selected -> + if (selected) { + crashReportingPromptVisible = true + } else { + onCrashReportingToggled(false) + } + } ) } + SettingsItem.AppSettingsItem.EntityHiding -> { DefaultSettingsItem( title = stringResource(id = appSettingsItem.descriptionRes()), diff --git a/app/src/main/java/com/babylon/wallet/android/presentation/settings/appsettings/AppSettingsViewModel.kt b/app/src/main/java/com/babylon/wallet/android/presentation/settings/appsettings/AppSettingsViewModel.kt index 580b68af0f..df9f414277 100644 --- a/app/src/main/java/com/babylon/wallet/android/presentation/settings/appsettings/AppSettingsViewModel.kt +++ b/app/src/main/java/com/babylon/wallet/android/presentation/settings/appsettings/AppSettingsViewModel.kt @@ -25,7 +25,6 @@ import javax.inject.Inject @HiltViewModel class AppSettingsViewModel @Inject constructor( private val getProfileUseCase: GetProfileUseCase, - private val getBackupStateUseCase: GetBackupStateUseCase, private val preferencesManager: PreferencesManager, private val updateDeveloperModeUseCase: UpdateDeveloperModeUseCase ) : StateViewModel() { @@ -65,23 +64,6 @@ class AppSettingsViewModel @Inject constructor( } } } - viewModelScope.launch { - getBackupStateUseCase().collect { backupState -> - _state.update { settingsUiState -> - val settingsList = if (settingsUiState.settings.any { it is SettingsItem.AppSettingsItem.Backups }) { - settingsUiState.settings.mapWhen( - predicate = { it is SettingsItem.AppSettingsItem.Backups }, - mutation = { SettingsItem.AppSettingsItem.Backups(backupState = backupState) } - ) - } else { - settingsUiState.settings.toMutableList().apply { - add(2, SettingsItem.AppSettingsItem.Backups(backupState)) - } - } - settingsUiState.copy(settings = settingsList.toPersistentSet()) - } - } - } } fun onDeveloperModeToggled(enabled: Boolean) = viewModelScope.launch { diff --git a/app/src/main/res/values-en/strings.xml b/app/src/main/res/values-en/strings.xml index ec25f67630..956ff5ead4 100644 --- a/app/src/main/res/values-en/strings.xml +++ b/app/src/main/res/values-en/strings.xml @@ -167,7 +167,7 @@ Deposit Guarantees Set your default guaranteed minimum for estimated deposits Set the guaranteed minimum deposit to be applied whenever a deposit in a transaction can only be estimated. - +\n\n You can always change the guarantee from this default in each transaction. Multi-Factor Setup Version: %s build #%s @@ -757,12 +757,12 @@ You can always change the guarantee from this default in each transaction.Green Ledger Nano S+ Save and Continue Backing up your wallet ensures that you can restore access to your Accounts, Personas, and wallet settings on a new phone by re-entering your seed phrase(s). - +\n\n **For security, backups do not contain any seed phrases or private keys. You must write them down separately.** Automatic Backups (recommended) Manual Backups A manually exported wallet backup file may also be used for recovery, along with your seed phrase(s). - +\n\n Only the **current configuration** of your wallet is backed up with each manual export. Export Wallet Backup File Encrypt this backup with a password? @@ -792,7 +792,7 @@ Only the **current configuration** of your wallet is backed up with each manual Backup Wallet Data to Cloud Warning: If disabled you might lose access to your Accounts and Personas. You may delete your wallet. This will clear the Radix Wallet app, clears its contents, and delete any cloud backup. - +\n\n **Access to any Accounts or Personas will be permanently lost unless you have a manual backup file.** Delete Wallet Enable Backup to iCloud @@ -814,7 +814,7 @@ Only the **current configuration** of your wallet is backed up with each manual Number of Personas: %d Incompatible Wallet data You may delete your wallet. This will clear the Radix Wallet app, clears its contents, and delete any iCloud backup. - +\n\n **Access to any Accounts or Personas will be permanently lost unless you have a manual backup file.** Delete Wallet and iCloud Backup Unable to find wallet backup in iCloud. @@ -844,9 +844,9 @@ Only the **current configuration** of your wallet is backed up with each manual Your **Personas** and the following **Accounts** are controlled by your main seed phrase. To recover control, you must re-enter it. The following **Accounts** are controlled by a seed phrase. To recover control, you must re-enter it. The Radix Wallet always uses a single main “Babylon” seed phrase to generate new Personas and new Accounts (when not using a Ledger device). - +\n\n If you do not have access to your previous main seed phrase, you can skip entering it for now. **The Radix Wallet will create a new one, which will be used for new Personas and Accounts.** - +\n\n Your old Accounts and Personas will still be listed, but you will have to enter their original seed phrase to use them. Alternatively, you can hide them if you no longer are interested in using them. Skip This Seed Phrase For Now I Don’t Have the Main Seed Phrase @@ -911,12 +911,12 @@ Your old Accounts and Personas will still be listed, but you will have to enter Continue Recovery Complete Accounts discovered in the scan have been added to your wallet. - +\n\n If you have any “Legacy” Accounts (created on the Olympia network) to import - or any Accounts using a Ledger hardware wallet device - please continue and then use the **Account Recovery Scan** option in your Radix Wallet settings under **Account Security**. Continue Recover Control Without Backup **If you have no wallet backup in the cloud or as an exported backup file**, you can still restore Account access only using your main “Babylon” seed phrase. You cannot recover your Account names or other wallet settings this way. - +\n\n You will be asked to enter your main seed phrase. This is a set of **24 words** that the Radix Wallet mobile app showed you to write down and save securely. Continue Recover Control Without Backup @@ -937,7 +937,7 @@ You will be asked to enter your main seed phrase. This is a set of **24 words** Scan for Accounts originally created on the **Babylon** network. Olympia Accounts Scan for Accounts originally created on the **Olympia** network. - +\n\n (If you have Olympia Accounts in the Radix Olympia Desktop Wallet, consider using **Import from a Legacy Wallet** instead. Note: You will still use the new **Radix Babylon** app on your Ledger device, not the old Radix Ledger app. Use Seed Phrase @@ -950,4 +950,5 @@ You will be asked to enter your main seed phrase. This is a set of **24 words** Continue Note: You must still use the new *Radix Babylon* app on your Ledger device, not the old Radix Ledger app. Deriving Accounts + Crash Reporting diff --git a/core/src/main/java/rdx/works/core/preferences/PreferencesManager.kt b/core/src/main/java/rdx/works/core/preferences/PreferencesManager.kt index 93df1ba36e..026676fb9f 100644 --- a/core/src/main/java/rdx/works/core/preferences/PreferencesManager.kt +++ b/core/src/main/java/rdx/works/core/preferences/PreferencesManager.kt @@ -13,6 +13,7 @@ import java.time.Instant import javax.inject.Inject import javax.inject.Singleton +@Suppress("TooManyFunctions") @Singleton class PreferencesManager @Inject constructor( private val dataStore: DataStore @@ -92,15 +93,6 @@ class PreferencesManager @Inject constructor( } } - fun getBackedUpFactorSourceIds(): Flow> { - return dataStore.data.map { preferences -> - preferences[KEY_BACKED_UP_FACTOR_SOURCE_IDS]?.split(",").orEmpty().toSet() - } - } - - suspend fun markFirstPersonaCreated() { - dataStore.edit { preferences -> - preferences[KEY_FIRST_PERSONA_CREATED] = true val isRadixBannerVisible: Flow = dataStore.data .map { preferences -> preferences[KEY_RADIX_BANNER_VISIBLE] ?: false