mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-22 01:40:07 +01:00
Basic client usage of CDSHv2.
This provides a basic (read: useful-for-development-yet-broken) client usage of CDSHv2.
This commit is contained in:
@@ -406,7 +406,28 @@ class InternalSettingsFragment : DSLSettingsFragment(R.string.preferences__inter
|
||||
|
||||
dividerPref()
|
||||
|
||||
sectionHeaderPref(R.string.preferences__internal_cds)
|
||||
|
||||
clickPref(
|
||||
title = DSLSettingsText.from(R.string.preferences__internal_clear_history),
|
||||
summary = DSLSettingsText.from(R.string.preferences__internal_clear_history_description),
|
||||
onClick = {
|
||||
clearCdsHistory()
|
||||
}
|
||||
)
|
||||
|
||||
clickPref(
|
||||
title = DSLSettingsText.from(R.string.preferences__internal_clear_all_service_ids),
|
||||
summary = DSLSettingsText.from(R.string.preferences__internal_clear_all_service_ids_description),
|
||||
onClick = {
|
||||
clearAllServiceIds()
|
||||
}
|
||||
)
|
||||
|
||||
dividerPref()
|
||||
|
||||
sectionHeaderPref(R.string.ConversationListTabs__stories)
|
||||
|
||||
switchPref(
|
||||
title = DSLSettingsText.from(R.string.preferences__internal_disable_stories),
|
||||
isChecked = state.disableStories,
|
||||
@@ -518,4 +539,23 @@ class InternalSettingsFragment : DSLSettingsFragment(R.string.preferences__inter
|
||||
private fun enqueueSubscriptionRedemption() {
|
||||
SubscriptionReceiptRequestResponseJob.createSubscriptionContinuationJobChain().enqueue()
|
||||
}
|
||||
|
||||
private fun clearCdsHistory() {
|
||||
SignalDatabase.cds.clearAll()
|
||||
SignalStore.misc().cdsToken = null
|
||||
Toast.makeText(context, "Cleared all CDS history.", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
|
||||
private fun clearAllServiceIds() {
|
||||
MaterialAlertDialogBuilder(requireContext())
|
||||
.setMessage("Are you sure? Never do this on a non-test device.")
|
||||
.setPositiveButton(android.R.string.ok) { _, _ ->
|
||||
SignalDatabase.recipients.debugClearServiceIds()
|
||||
Toast.makeText(context, "Cleared all service IDs.", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
.setNegativeButton(android.R.string.cancel) { d, _ ->
|
||||
d.dismiss()
|
||||
}
|
||||
.show()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user