Add internal setting to copy service password.

This commit is contained in:
Greyson Parrelli
2026-09-11 13:48:17 -04:00
parent af920d71bb
commit baf9731a67
@@ -245,6 +245,14 @@ class InternalSettingsFragment : DSLSettingsFragment(R.string.preferences__inter
)
}
clickPref(
title = DSLSettingsText.from("Copy service password"),
summary = DSLSettingsText.from("Copy the password used to authenticate with the service."),
onClick = {
onCopyServicePasswordClicked()
}
)
clickPref(
title = DSLSettingsText.from("Unregister"),
summary = DSLSettingsText.from("This will unregister your account without deleting it."),
@@ -1147,6 +1155,24 @@ class InternalSettingsFragment : DSLSettingsFragment(R.string.preferences__inter
.show()
}
private fun onCopyServicePasswordClicked() {
val servicePassword = SignalStore.account.servicePassword
if (servicePassword == null) {
Toast.makeText(requireContext(), "No service password set!", Toast.LENGTH_SHORT).show()
return
}
MaterialAlertDialogBuilder(requireContext())
.setTitle("Copy service password?")
.setMessage("Your service password lets anyone who has it send messages as you on the service. Treat it like a password: don't paste it anywhere you don't fully trust. It will be cleared from the clipboard after ${Util.SENSITIVE_CLIPBOARD_TIMEOUT_SECONDS} seconds.")
.setPositiveButton("Copy") { _, _ ->
Util.copyToClipboardSensitive(requireContext(), servicePassword)
Toast.makeText(requireContext(), "Copied service password", Toast.LENGTH_SHORT).show()
}
.setNegativeButton(android.R.string.cancel, null)
.show()
}
private fun copyPaymentsDataToClipboard() {
MaterialAlertDialogBuilder(requireContext())
.setMessage(