From bc4448c0ea74b627162104bde858fb62f3f46e6d Mon Sep 17 00:00:00 2001 From: Kevin Deus Date: Tue, 19 Nov 2024 16:55:47 -0800 Subject: [PATCH] Add a developer option to trigger syncing all documents. When Developer Options are enabled, this adds a new button to the Settings screen to trigger our periodic sync that refreshes all documents/credentials. Tested by: - Manual testing - ./gradlew check - ./gradlew connectedCheck Signed-off-by: Kevin Deus --- .../ui/destination/settings/SettingsScreen.kt | 13 +++++++++++++ wallet/src/main/res/values/strings.xml | 2 ++ 2 files changed, 15 insertions(+) diff --git a/wallet/src/main/java/com/android/identity_credential/wallet/ui/destination/settings/SettingsScreen.kt b/wallet/src/main/java/com/android/identity_credential/wallet/ui/destination/settings/SettingsScreen.kt index 828024da0..de98a048f 100644 --- a/wallet/src/main/java/com/android/identity_credential/wallet/ui/destination/settings/SettingsScreen.kt +++ b/wallet/src/main/java/com/android/identity_credential/wallet/ui/destination/settings/SettingsScreen.kt @@ -40,6 +40,7 @@ import androidx.compose.ui.unit.dp import com.android.identity.document.DocumentStore import com.android.identity_credential.wallet.R import com.android.identity_credential.wallet.SettingsModel +import com.android.identity_credential.wallet.WalletApplication import com.android.identity_credential.wallet.WalletApplicationConfiguration import com.android.identity_credential.wallet.navigation.WalletDestination import com.android.identity_credential.wallet.ui.ScreenWithAppBarAndBackButton @@ -235,6 +236,18 @@ fun SettingsScreen( onClicked = { showMinServerUrlDialog = true } ) } + if (settingsModel.developerModeEnabled.value == true) { + SettingSectionSubtitle(title = stringResource(R.string.settings_screen_debug_actions_section)) + val context = LocalContext.current + val walletApplication = context.applicationContext as WalletApplication + Button( + onClick = { + walletApplication.documentModel.periodicSyncForAllDocuments() + } + ) { + Text(text = stringResource(R.string.settings_screen_trigger_periodic_sync_button)) + } + } } } } diff --git a/wallet/src/main/res/values/strings.xml b/wallet/src/main/res/values/strings.xml index e283893a1..f524996f6 100644 --- a/wallet/src/main/res/values/strings.xml +++ b/wallet/src/main/res/values/strings.xml @@ -566,4 +566,6 @@ Bluetooth must be enabled to share a QR connection code Enable No available documents can fulfill the request. + Debug actions + Trigger Periodic Sync