mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-20 00:29:11 +01:00
Add quickstart variant that launches with predefined credentials.
This commit is contained in:
committed by
Alex Hart
parent
9922621945
commit
e67307a961
@@ -65,6 +65,7 @@ import org.thoughtcrime.securesms.megaphone.Megaphones
|
||||
import org.thoughtcrime.securesms.payments.DataExportUtil
|
||||
import org.thoughtcrime.securesms.recipients.Recipient
|
||||
import org.thoughtcrime.securesms.recipients.RecipientId
|
||||
import org.thoughtcrime.securesms.registration.data.QuickstartCredentialExporter
|
||||
import org.thoughtcrime.securesms.storage.StorageSyncHelper
|
||||
import org.thoughtcrime.securesms.util.ConversationUtil
|
||||
import org.thoughtcrime.securesms.util.adapter.mapping.MappingAdapter
|
||||
@@ -164,6 +165,16 @@ class InternalSettingsFragment : DSLSettingsFragment(R.string.preferences__inter
|
||||
}
|
||||
)
|
||||
|
||||
if (BuildConfig.DEBUG) {
|
||||
clickPref(
|
||||
title = DSLSettingsText.from("Export quickstart credentials"),
|
||||
summary = DSLSettingsText.from("Export registration credentials to a JSON file for quickstart builds."),
|
||||
onClick = {
|
||||
exportQuickstartCredentials()
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
clickPref(
|
||||
title = DSLSettingsText.from("Unregister"),
|
||||
summary = DSLSettingsText.from("This will unregister your account without deleting it."),
|
||||
@@ -1144,6 +1155,21 @@ class InternalSettingsFragment : DSLSettingsFragment(R.string.preferences__inter
|
||||
}
|
||||
}
|
||||
|
||||
private fun exportQuickstartCredentials() {
|
||||
MaterialAlertDialogBuilder(requireContext())
|
||||
.setTitle("Export quickstart credentials?")
|
||||
.setMessage("This will export your account's private keys and credentials to an unencrypted file on disk. This is very dangerous! Only use it with test accounts.")
|
||||
.setPositiveButton("Export") { _, _ ->
|
||||
SimpleTask.run({
|
||||
QuickstartCredentialExporter.export(requireContext())
|
||||
}) { file ->
|
||||
Toast.makeText(requireContext(), "Exported to ${file.absolutePath}", Toast.LENGTH_LONG).show()
|
||||
}
|
||||
}
|
||||
.setNegativeButton(android.R.string.cancel, null)
|
||||
.show()
|
||||
}
|
||||
|
||||
private fun promptUserForSentTimestamp() {
|
||||
val input = EditText(requireContext()).apply {
|
||||
inputType = android.text.InputType.TYPE_CLASS_NUMBER
|
||||
|
||||
Reference in New Issue
Block a user