Skip to content

Commit

Permalink
Add a developer option to trigger syncing all documents.
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
kdeus committed Nov 20, 2024
1 parent 5366a31 commit bc4448c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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))
}
}
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions wallet/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -566,4 +566,6 @@
<string name="qr_alert_dialog_bt_disabled_text">Bluetooth must be enabled to share a QR connection code</string>
<string name="qr_alert_dialog_bt_enable_button">Enable</string>
<string name="presentation_result_no_matching_document_message">No available documents can fulfill the request.</string>
<string name="settings_screen_debug_actions_section">Debug actions</string>
<string name="settings_screen_trigger_periodic_sync_button">Trigger Periodic Sync</string>
</resources>

0 comments on commit bc4448c

Please sign in to comment.