-
Notifications
You must be signed in to change notification settings - Fork 9
Beta full import export #611
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
08e0c02
Harden Cryptor to prevent nonce reuse
praveenperera d34393e
Improve keychain error handling and robustness
praveenperera 5b6df7a
Add encrypted backup module with Argon2 crypto
praveenperera 6a6f816
Integrate backup with app, keychain, and database
praveenperera 4e33f0a
Add About screen for iOS and Android
praveenperera 483711a
Add backup export/import UI for iOS
praveenperera eab21cf
Add backup export/import UI for Android
praveenperera 43b172d
Validate PID in logcat recipe before calling adb logcat
praveenperera 9f850a4
Move http client builder to cove-http crate
praveenperera 20f6dea
Add beta import/export toggle with experimental warning
praveenperera 20f3045
Update build.gradle.kts
praveenperera File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
238 changes: 238 additions & 0 deletions
238
android/app/src/main/java/org/bitcoinppl/cove/flows/SettingsFlow/AboutSettingsScreen.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,238 @@ | ||
| package org.bitcoinppl.cove.flows.SettingsFlow | ||
|
|
||
| import android.content.Intent | ||
| import android.net.Uri | ||
| import androidx.compose.foundation.clickable | ||
| import androidx.compose.foundation.layout.Arrangement | ||
| import androidx.compose.foundation.layout.Column | ||
| import androidx.compose.foundation.layout.Row | ||
| import androidx.compose.foundation.layout.WindowInsets | ||
| import androidx.compose.foundation.layout.asPaddingValues | ||
| import androidx.compose.foundation.layout.fillMaxSize | ||
| import androidx.compose.foundation.layout.fillMaxWidth | ||
| import androidx.compose.foundation.layout.padding | ||
| import androidx.compose.foundation.layout.safeDrawing | ||
| import androidx.compose.foundation.rememberScrollState | ||
| import androidx.compose.foundation.verticalScroll | ||
| import androidx.compose.material.icons.Icons | ||
| import androidx.compose.material.icons.automirrored.filled.ArrowBack | ||
| import androidx.compose.material3.AlertDialog | ||
| import androidx.compose.material3.ExperimentalMaterial3Api | ||
| import androidx.compose.material3.Icon | ||
| import androidx.compose.material3.IconButton | ||
| import androidx.compose.material3.MaterialTheme | ||
| import androidx.compose.material3.Scaffold | ||
| import androidx.compose.material3.Text | ||
| import androidx.compose.material3.TextButton | ||
| import androidx.compose.material3.TopAppBar | ||
| import androidx.compose.runtime.Composable | ||
| import androidx.compose.runtime.LaunchedEffect | ||
| import androidx.compose.runtime.getValue | ||
| import androidx.compose.runtime.mutableIntStateOf | ||
| import androidx.compose.runtime.mutableStateOf | ||
| import androidx.compose.runtime.remember | ||
| import androidx.compose.runtime.setValue | ||
| import androidx.compose.ui.Modifier | ||
| import androidx.compose.ui.platform.LocalContext | ||
| import androidx.compose.ui.text.style.TextAlign | ||
| import androidx.compose.ui.unit.dp | ||
| import kotlinx.coroutines.delay | ||
| import org.bitcoinppl.cove.BuildConfig | ||
| import org.bitcoinppl.cove.views.MaterialDivider | ||
| import org.bitcoinppl.cove.views.MaterialSection | ||
| import org.bitcoinppl.cove.views.SectionHeader | ||
| import org.bitcoinppl.cove_core.Database | ||
| import org.bitcoinppl.cove_core.GlobalFlagKey | ||
|
|
||
| @OptIn(ExperimentalMaterial3Api::class) | ||
| @Composable | ||
| fun AboutSettingsScreen( | ||
| app: org.bitcoinppl.cove.AppManager, | ||
| modifier: Modifier = Modifier, | ||
| ) { | ||
| val context = LocalContext.current | ||
| var buildTapCount by remember { mutableIntStateOf(0) } | ||
| var showBetaDialog by remember { mutableStateOf(false) } | ||
| var showBetaEnabledDialog by remember { mutableStateOf(false) } | ||
| var isBetaEnabled by remember { | ||
| mutableStateOf( | ||
| Database().globalFlag().getBoolConfig(GlobalFlagKey.BETA_FEATURES_ENABLED) | ||
| ) | ||
| } | ||
| var betaError by remember { mutableStateOf<String?>(null) } | ||
|
|
||
| LaunchedEffect(buildTapCount) { | ||
| if (buildTapCount > 0) { | ||
| delay(2000) | ||
| buildTapCount = 0 | ||
| } | ||
| } | ||
|
|
||
| Scaffold( | ||
| modifier = | ||
| modifier | ||
| .fillMaxSize() | ||
| .padding(WindowInsets.safeDrawing.asPaddingValues()), | ||
| topBar = @Composable { | ||
| TopAppBar( | ||
| title = { | ||
| Text( | ||
| style = MaterialTheme.typography.bodyLarge, | ||
| text = "About", | ||
| textAlign = TextAlign.Center, | ||
| modifier = Modifier.fillMaxWidth(), | ||
| ) | ||
| }, | ||
| navigationIcon = { | ||
| IconButton(onClick = { app.popRoute() }) { | ||
| Icon(Icons.AutoMirrored.Default.ArrowBack, contentDescription = "Back") | ||
| } | ||
| }, | ||
| actions = { }, | ||
| ) | ||
| }, | ||
| content = { paddingValues -> | ||
| Column( | ||
| modifier = | ||
| Modifier | ||
| .fillMaxSize() | ||
| .verticalScroll(rememberScrollState()) | ||
| .padding(paddingValues), | ||
| ) { | ||
| SectionHeader("App Info", showDivider = false) | ||
| MaterialSection { | ||
| Column { | ||
| AboutRow( | ||
| label = "Version", | ||
| value = BuildConfig.VERSION_NAME, | ||
| ) | ||
| MaterialDivider() | ||
| AboutRow( | ||
| label = "Build Number", | ||
| value = BuildConfig.VERSION_CODE.toString(), | ||
| onClick = { | ||
| buildTapCount++ | ||
| if (buildTapCount >= 5) { | ||
| buildTapCount = 0 | ||
| showBetaDialog = true | ||
| } | ||
| }, | ||
| ) | ||
| MaterialDivider() | ||
| AboutRow( | ||
| label = "Git Commit", | ||
| value = app.rust.gitShortHash(), | ||
| ) | ||
| } | ||
| } | ||
|
|
||
| SectionHeader("Support") | ||
| MaterialSection { | ||
| Column { | ||
| AboutRow( | ||
| label = "Feedback", | ||
| value = "feedback@covebitcoinwallet.com", | ||
| valueStyle = MaterialTheme.typography.bodySmall, | ||
| onClick = { | ||
| val intent = Intent(Intent.ACTION_SENDTO).apply { | ||
| data = Uri.parse("mailto:feedback@covebitcoinwallet.com") | ||
| } | ||
| context.startActivity(intent) | ||
| }, | ||
| ) | ||
| } | ||
| } | ||
| } | ||
| }, | ||
| ) | ||
|
|
||
| if (showBetaDialog) { | ||
| val currentlyEnabled = isBetaEnabled | ||
| AlertDialog( | ||
| onDismissRequest = { showBetaDialog = false }, | ||
| title = { Text(if (currentlyEnabled) "Disable Beta Features?" else "Enable Beta Features?") }, | ||
| text = { Text(if (currentlyEnabled) "This will hide experimental features" else "This will enable experimental features") }, | ||
| confirmButton = { | ||
| TextButton(onClick = { | ||
| val newValue = !currentlyEnabled | ||
| try { | ||
| Database().globalFlag().set(GlobalFlagKey.BETA_FEATURES_ENABLED, newValue) | ||
| isBetaEnabled = newValue | ||
| } catch (e: Exception) { | ||
| betaError = "Failed to update beta features: ${e.message}" | ||
| } | ||
| showBetaDialog = false | ||
| if (newValue) showBetaEnabledDialog = true | ||
| }) { | ||
| Text(if (currentlyEnabled) "Disable" else "Enable") | ||
| } | ||
| }, | ||
| dismissButton = { | ||
| TextButton(onClick = { showBetaDialog = false }) { | ||
| Text("Cancel") | ||
| } | ||
| }, | ||
| ) | ||
| } | ||
|
|
||
| betaError?.let { error -> | ||
| AlertDialog( | ||
| onDismissRequest = { betaError = null }, | ||
| title = { Text("Something went wrong!") }, | ||
| text = { Text(error) }, | ||
| confirmButton = { | ||
| TextButton(onClick = { betaError = null }) { | ||
| Text("OK") | ||
| } | ||
| }, | ||
| ) | ||
| } | ||
|
|
||
| if (showBetaEnabledDialog) { | ||
| AlertDialog( | ||
| onDismissRequest = { | ||
| showBetaEnabledDialog = false | ||
| app.popRoute() | ||
| }, | ||
| title = { Text("Beta Features Enabled") }, | ||
| text = { Text("Beta features have been enabled") }, | ||
| confirmButton = { | ||
| TextButton(onClick = { | ||
| showBetaEnabledDialog = false | ||
| app.popRoute() | ||
| }) { | ||
| Text("OK") | ||
| } | ||
| }, | ||
| ) | ||
| } | ||
| } | ||
|
|
||
| @Composable | ||
| private fun AboutRow( | ||
| label: String, | ||
| value: String, | ||
| onClick: (() -> Unit)? = null, | ||
| valueStyle: androidx.compose.ui.text.TextStyle = MaterialTheme.typography.bodyMedium, | ||
| ) { | ||
| Row( | ||
| modifier = | ||
| Modifier | ||
| .fillMaxWidth() | ||
| .then( | ||
| if (onClick != null) Modifier.clickable(onClick = onClick) else Modifier, | ||
| ) | ||
| .padding(horizontal = 16.dp, vertical = 14.dp), | ||
| horizontalArrangement = Arrangement.SpaceBetween, | ||
| ) { | ||
| Text( | ||
| text = label, | ||
| style = MaterialTheme.typography.bodyLarge, | ||
| ) | ||
| Text( | ||
| text = value, | ||
| style = valueStyle, | ||
| color = MaterialTheme.colorScheme.onSurfaceVariant, | ||
| ) | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.