Inline internal-only strings.

This commit is contained in:
Greyson Parrelli 2022-11-04 16:08:50 -04:00 committed by Cody Henthorne
parent 9bdf65c4e4
commit b419eb4cd5
9 changed files with 119 additions and 223 deletions

View file

@ -88,35 +88,35 @@ class InternalSettingsFragment : DSLSettingsFragment(R.string.preferences__inter
private fun getConfiguration(state: InternalSettingsState): DSLConfiguration {
return configure {
sectionHeaderPref(R.string.preferences__internal_account)
sectionHeaderPref(DSLSettingsText.from("Account"))
clickPref(
title = DSLSettingsText.from(R.string.preferences__internal_refresh_attributes),
summary = DSLSettingsText.from(R.string.preferences__internal_refresh_attributes_description),
title = DSLSettingsText.from("Refresh attributes"),
summary = DSLSettingsText.from("Forces a write of capabilities on to the server followed by a read."),
onClick = {
refreshAttributes()
}
)
clickPref(
title = DSLSettingsText.from(R.string.preferences__internal_refresh_profile),
summary = DSLSettingsText.from(R.string.preferences__internal_refresh_profile_description),
title = DSLSettingsText.from("Refresh profile"),
summary = DSLSettingsText.from("Forces a refresh of your own profile."),
onClick = {
refreshProfile()
}
)
clickPref(
title = DSLSettingsText.from(R.string.preferences__internal_rotate_profile_key),
summary = DSLSettingsText.from(R.string.preferences__internal_rotate_profile_key_description),
title = DSLSettingsText.from("Rotate profile key"),
summary = DSLSettingsText.from("Creates a new versioned profile, and triggers an update of any GV2 group you belong to."),
onClick = {
rotateProfileKey()
}
)
clickPref(
title = DSLSettingsText.from(R.string.preferences__internal_refresh_remote_config),
summary = DSLSettingsText.from(R.string.preferences__internal_refresh_remote_config_description),
title = DSLSettingsText.from("Refresh remote config"),
summary = DSLSettingsText.from("Forces a refresh of the remote config locally instead of waiting for the elapsed time."),
onClick = {
refreshRemoteValues()
}
@ -124,11 +124,11 @@ class InternalSettingsFragment : DSLSettingsFragment(R.string.preferences__inter
dividerPref()
sectionHeaderPref(R.string.preferences__internal_misc)
sectionHeaderPref(DSLSettingsText.from("Miscellaneous"))
switchPref(
title = DSLSettingsText.from(R.string.preferences__internal_user_details),
summary = DSLSettingsText.from(R.string.preferences__internal_user_details_description),
title = DSLSettingsText.from("'Internal Details' button"),
summary = DSLSettingsText.from("Show a button in conversation settings that lets you see more information about a user."),
isChecked = state.seeMoreUserDetails,
onClick = {
viewModel.setSeeMoreUserDetails(!state.seeMoreUserDetails)
@ -136,8 +136,8 @@ class InternalSettingsFragment : DSLSettingsFragment(R.string.preferences__inter
)
switchPref(
title = DSLSettingsText.from(R.string.preferences__internal_shake_to_report),
summary = DSLSettingsText.from(R.string.preferences__internal_shake_to_report_description),
title = DSLSettingsText.from("Shake to Report"),
summary = DSLSettingsText.from("Shake your phone to easily submit and share a debug log."),
isChecked = state.shakeToReport,
onClick = {
viewModel.setShakeToReport(!state.shakeToReport)
@ -145,7 +145,7 @@ class InternalSettingsFragment : DSLSettingsFragment(R.string.preferences__inter
)
clickPref(
title = DSLSettingsText.from(R.string.preferences__internal_clear_keep_longer_logs),
title = DSLSettingsText.from("Clear keep longer logs"),
onClick = {
clearKeepLongerLogs()
}
@ -153,11 +153,11 @@ class InternalSettingsFragment : DSLSettingsFragment(R.string.preferences__inter
dividerPref()
sectionHeaderPref(R.string.preferences__internal_payments)
sectionHeaderPref(DSLSettingsText.from("Payments"))
clickPref(
title = DSLSettingsText.from(R.string.preferences__internal_payment_copy_data),
summary = DSLSettingsText.from(R.string.preferences__internal_payment_copy_data_description),
title = DSLSettingsText.from("Copy payments data"),
summary = DSLSettingsText.from("Copy all payment records to clipboard."),
onClick = {
copyPaymentsDataToClipboard()
}
@ -165,11 +165,11 @@ class InternalSettingsFragment : DSLSettingsFragment(R.string.preferences__inter
dividerPref()
sectionHeaderPref(R.string.preferences__internal_storage_service)
sectionHeaderPref(DSLSettingsText.from("Storage Service"))
switchPref(
title = DSLSettingsText.from(R.string.preferences__internal_disable_storage_service),
summary = DSLSettingsText.from(R.string.preferences__internal_disable_storage_service_description),
title = DSLSettingsText.from("Disable syncing"),
summary = DSLSettingsText.from("Prevent syncing any data to/from storage service."),
isChecked = state.disableStorageService,
onClick = {
viewModel.setDisableStorageService(!state.disableStorageService)
@ -177,16 +177,16 @@ class InternalSettingsFragment : DSLSettingsFragment(R.string.preferences__inter
)
clickPref(
title = DSLSettingsText.from(R.string.preferences__internal_sync_now),
summary = DSLSettingsText.from(R.string.preferences__internal_sync_now_description),
title = DSLSettingsText.from("Sync now"),
summary = DSLSettingsText.from("Enqueue a normal storage service sync."),
onClick = {
enqueueStorageServiceSync()
}
)
clickPref(
title = DSLSettingsText.from(R.string.preferences__internal_force_storage_service_sync),
summary = DSLSettingsText.from(R.string.preferences__internal_force_storage_service_sync_description),
title = DSLSettingsText.from("Overwrite remote data"),
summary = DSLSettingsText.from("Forces remote storage to match the local device state."),
onClick = {
enqueueStorageServiceForcePush()
}
@ -194,11 +194,11 @@ class InternalSettingsFragment : DSLSettingsFragment(R.string.preferences__inter
dividerPref()
sectionHeaderPref(R.string.preferences__internal_preferences_groups_v2)
sectionHeaderPref(DSLSettingsText.from("Groups V2"))
switchPref(
title = DSLSettingsText.from(R.string.preferences__internal_force_gv2_invites),
summary = DSLSettingsText.from(R.string.preferences__internal_force_gv2_invites_description),
title = DSLSettingsText.from("Force invites"),
summary = DSLSettingsText.from("Members will not be added directly to a GV2 even if they could be."),
isChecked = state.gv2forceInvites,
onClick = {
viewModel.setGv2ForceInvites(!state.gv2forceInvites)
@ -206,8 +206,8 @@ class InternalSettingsFragment : DSLSettingsFragment(R.string.preferences__inter
)
switchPref(
title = DSLSettingsText.from(R.string.preferences__internal_ignore_gv2_server_changes),
summary = DSLSettingsText.from(R.string.preferences__internal_ignore_gv2_server_changes_description),
title = DSLSettingsText.from("Ignore server changes"),
summary = DSLSettingsText.from("Changes in server's response will be ignored, causing passive voice update messages if P2P is also ignored."),
isChecked = state.gv2ignoreServerChanges,
onClick = {
viewModel.setGv2IgnoreServerChanges(!state.gv2ignoreServerChanges)
@ -215,8 +215,8 @@ class InternalSettingsFragment : DSLSettingsFragment(R.string.preferences__inter
)
switchPref(
title = DSLSettingsText.from(R.string.preferences__internal_ignore_gv2_p2p_changes),
summary = DSLSettingsText.from(R.string.preferences__internal_ignore_gv2_server_changes_description),
title = DSLSettingsText.from("Ignore P2P changes"),
summary = DSLSettingsText.from("Changes sent P2P will be ignored. In conjunction with ignoring server changes, will cause passive voice."),
isChecked = state.gv2ignoreP2PChanges,
onClick = {
viewModel.setGv2IgnoreP2PChanges(!state.gv2ignoreP2PChanges)
@ -225,7 +225,7 @@ class InternalSettingsFragment : DSLSettingsFragment(R.string.preferences__inter
dividerPref()
sectionHeaderPref(R.string.preferences__internal_network)
sectionHeaderPref(DSLSettingsText.from("Network"))
switchPref(
title = DSLSettingsText.from("Force websocket mode"),
@ -247,8 +247,8 @@ class InternalSettingsFragment : DSLSettingsFragment(R.string.preferences__inter
)
switchPref(
title = DSLSettingsText.from(R.string.preferences__internal_allow_censorship_toggle),
summary = DSLSettingsText.from(R.string.preferences__internal_allow_censorship_toggle_description),
title = DSLSettingsText.from("Allow censorship circumvention toggle"),
summary = DSLSettingsText.from("Allow changing the censorship circumvention toggle regardless of network connectivity."),
isChecked = state.allowCensorshipSetting,
onClick = {
viewModel.setAllowCensorshipSetting(!state.allowCensorshipSetting)
@ -257,11 +257,11 @@ class InternalSettingsFragment : DSLSettingsFragment(R.string.preferences__inter
dividerPref()
sectionHeaderPref(R.string.preferences__internal_conversations_and_shortcuts)
sectionHeaderPref(DSLSettingsText.from("Conversations and Shortcuts"))
clickPref(
title = DSLSettingsText.from(R.string.preferences__internal_delete_all_dynamic_shortcuts),
summary = DSLSettingsText.from(R.string.preferences__internal_click_to_delete_all_dynamic_shortcuts),
title = DSLSettingsText.from("Delete all dynamic shortcuts"),
summary = DSLSettingsText.from("Click to delete all dynamic shortcuts"),
onClick = {
deleteAllDynamicShortcuts()
}
@ -269,20 +269,16 @@ class InternalSettingsFragment : DSLSettingsFragment(R.string.preferences__inter
dividerPref()
sectionHeaderPref(R.string.preferences__internal_emoji)
sectionHeaderPref(DSLSettingsText.from("Emoji"))
val emojiSummary = if (state.emojiVersion == null) {
getString(R.string.preferences__internal_use_built_in_emoji_set)
"Use built-in emoji set"
} else {
getString(
R.string.preferences__internal_current_version_d_at_density_s,
state.emojiVersion.version,
state.emojiVersion.density
)
"Current version: ${state.emojiVersion.version} at density ${state.emojiVersion.density}"
}
switchPref(
title = DSLSettingsText.from(R.string.preferences__internal_use_built_in_emoji_set),
title = DSLSettingsText.from("Use built-in emoji set"),
summary = DSLSettingsText.from(emojiSummary),
isChecked = state.useBuiltInEmojiSet,
onClick = {
@ -291,16 +287,16 @@ class InternalSettingsFragment : DSLSettingsFragment(R.string.preferences__inter
)
clickPref(
title = DSLSettingsText.from(R.string.preferences__internal_force_emoji_download),
summary = DSLSettingsText.from(R.string.preferences__internal_force_emoji_download_description),
title = DSLSettingsText.from("Force emoji download"),
summary = DSLSettingsText.from("Download the latest emoji set if it\\'s newer than what we have."),
onClick = {
ApplicationDependencies.getJobManager().add(DownloadLatestEmojiDataJob(true))
}
)
clickPref(
title = DSLSettingsText.from(R.string.preferences__internal_force_search_index_download),
summary = DSLSettingsText.from(R.string.preferences__internal_force_search_index_download_description),
title = DSLSettingsText.from("Force search index download"),
summary = DSLSettingsText.from("Download the latest emoji search index if it\\'s newer than what we have."),
onClick = {
EmojiSearchIndexDownloadJob.scheduleImmediately()
}
@ -308,27 +304,27 @@ class InternalSettingsFragment : DSLSettingsFragment(R.string.preferences__inter
dividerPref()
sectionHeaderPref(R.string.preferences__internal_sender_key)
sectionHeaderPref(DSLSettingsText.from("Sender Key"))
clickPref(
title = DSLSettingsText.from(R.string.preferences__internal_clear_all_state),
summary = DSLSettingsText.from(R.string.preferences__internal_click_to_delete_all_sender_key_state),
title = DSLSettingsText.from("Clear all state"),
summary = DSLSettingsText.from("Click to delete all sender key state"),
onClick = {
clearAllSenderKeyState()
}
)
clickPref(
title = DSLSettingsText.from(R.string.preferences__internal_clear_shared_state),
summary = DSLSettingsText.from(R.string.preferences__internal_click_to_delete_all_sharing_state),
title = DSLSettingsText.from("Clear shared state"),
summary = DSLSettingsText.from("Click to delete all sharing state"),
onClick = {
clearAllSenderKeySharedState()
}
)
switchPref(
title = DSLSettingsText.from(R.string.preferences__internal_remove_two_person_minimum),
summary = DSLSettingsText.from(R.string.preferences__internal_remove_the_requirement_that_you_need),
title = DSLSettingsText.from("Remove 2 person minimum"),
summary = DSLSettingsText.from("Remove the requirement that you need at least 2 recipients to use sender key."),
isChecked = state.removeSenderKeyMinimium,
onClick = {
viewModel.setRemoveSenderKeyMinimum(!state.removeSenderKeyMinimium)
@ -336,8 +332,8 @@ class InternalSettingsFragment : DSLSettingsFragment(R.string.preferences__inter
)
switchPref(
title = DSLSettingsText.from(R.string.preferences__internal_delay_resends),
summary = DSLSettingsText.from(R.string.preferences__internal_delay_resending_messages_in_response_to_retry_receipts),
title = DSLSettingsText.from("Delay resends"),
summary = DSLSettingsText.from("Delay resending messages in response to retry receipts by 10 seconds."),
isChecked = state.delayResends,
onClick = {
viewModel.setDelayResends(!state.delayResends)
@ -346,11 +342,11 @@ class InternalSettingsFragment : DSLSettingsFragment(R.string.preferences__inter
dividerPref()
sectionHeaderPref(R.string.preferences__internal_local_metrics)
sectionHeaderPref(DSLSettingsText.from("Local Metrics"))
clickPref(
title = DSLSettingsText.from(R.string.preferences__internal_clear_local_metrics),
summary = DSLSettingsText.from(R.string.preferences__internal_click_to_clear_all_local_metrics_state),
title = DSLSettingsText.from("Clear local metrics"),
summary = DSLSettingsText.from("Click to clear all local metrics state."),
onClick = {
clearAllLocalMetricsState()
}
@ -358,10 +354,10 @@ class InternalSettingsFragment : DSLSettingsFragment(R.string.preferences__inter
dividerPref()
sectionHeaderPref(R.string.preferences__internal_calling_server)
sectionHeaderPref(DSLSettingsText.from("Group call server"))
radioPref(
title = DSLSettingsText.from(R.string.preferences__internal_calling_server_default),
title = DSLSettingsText.from("Default"),
summary = DSLSettingsText.from(BuildConfig.SIGNAL_SFU_URL),
isChecked = state.callingServer == BuildConfig.SIGNAL_SFU_URL,
onClick = {
@ -372,7 +368,7 @@ class InternalSettingsFragment : DSLSettingsFragment(R.string.preferences__inter
BuildConfig.SIGNAL_SFU_INTERNAL_NAMES.zip(BuildConfig.SIGNAL_SFU_INTERNAL_URLS)
.forEach { (name, server) ->
radioPref(
title = DSLSettingsText.from(requireContext().getString(R.string.preferences__internal_calling_server_s, name)),
title = DSLSettingsText.from("$name server"),
summary = DSLSettingsText.from(server),
isChecked = state.callingServer == server,
onClick = {
@ -381,10 +377,10 @@ class InternalSettingsFragment : DSLSettingsFragment(R.string.preferences__inter
)
}
sectionHeaderPref(R.string.preferences__internal_calling)
sectionHeaderPref(DSLSettingsText.from("Calling options"))
radioListPref(
title = DSLSettingsText.from(R.string.preferences__internal_calling_audio_processing_method),
title = DSLSettingsText.from("Audio processing method"),
listItems = CallManager.AudioProcessingMethod.values().map { it.name }.toTypedArray(),
selected = CallManager.AudioProcessingMethod.values().indexOf(state.callingAudioProcessingMethod),
onSelected = {
@ -393,7 +389,7 @@ class InternalSettingsFragment : DSLSettingsFragment(R.string.preferences__inter
)
radioListPref(
title = DSLSettingsText.from(R.string.preferences__internal_calling_bandwidth_mode),
title = DSLSettingsText.from("Bandwidth mode"),
listItems = CallManager.BandwidthMode.values().map { it.name }.toTypedArray(),
selected = CallManager.BandwidthMode.values().indexOf(state.callingBandwidthMode),
onSelected = {
@ -402,7 +398,7 @@ class InternalSettingsFragment : DSLSettingsFragment(R.string.preferences__inter
)
switchPref(
title = DSLSettingsText.from(R.string.preferences__internal_calling_disable_telecom),
title = DSLSettingsText.from("Disable Telecom integration"),
isChecked = state.callingDisableTelecom,
onClick = {
viewModel.setInternalCallingDisableTelecom(!state.callingDisableTelecom)
@ -412,24 +408,24 @@ class InternalSettingsFragment : DSLSettingsFragment(R.string.preferences__inter
if (SignalStore.donationsValues().getSubscriber() != null) {
dividerPref()
sectionHeaderPref(R.string.preferences__internal_badges)
sectionHeaderPref(DSLSettingsText.from("Badges"))
clickPref(
title = DSLSettingsText.from(R.string.preferences__internal_badges_enqueue_redemption),
title = DSLSettingsText.from("Enqueue redemption."),
onClick = {
enqueueSubscriptionRedemption()
}
)
clickPref(
title = DSLSettingsText.from(R.string.preferences__internal_badges_enqueue_keep_alive),
title = DSLSettingsText.from("Enqueue keep-alive."),
onClick = {
enqueueSubscriptionKeepAlive()
}
)
clickPref(
title = DSLSettingsText.from(R.string.preferences__internal_badges_set_error_state),
title = DSLSettingsText.from("Set error state."),
onClick = {
findNavController().safeNavigate(InternalSettingsFragmentDirections.actionInternalSettingsFragmentToDonorErrorConfigurationFragment())
}
@ -438,17 +434,17 @@ class InternalSettingsFragment : DSLSettingsFragment(R.string.preferences__inter
dividerPref()
sectionHeaderPref(R.string.preferences__internal_release_channel)
sectionHeaderPref(DSLSettingsText.from("Release channel"))
clickPref(
title = DSLSettingsText.from(R.string.preferences__internal_release_channel_set_last_version),
title = DSLSettingsText.from("Set last version seen back 10 versions"),
onClick = {
SignalStore.releaseChannelValues().highestVersionNoteReceived = max(SignalStore.releaseChannelValues().highestVersionNoteReceived - 10, 0)
}
)
clickPref(
title = DSLSettingsText.from(R.string.preferences__internal_reset_donation_megaphone),
title = DSLSettingsText.from("Reset donation megaphone"),
onClick = {
SignalDatabase.remoteMegaphones.debugRemoveAll()
MegaphoneDatabase.getInstance(ApplicationDependencies.getApplication()).let {
@ -461,7 +457,7 @@ class InternalSettingsFragment : DSLSettingsFragment(R.string.preferences__inter
)
clickPref(
title = DSLSettingsText.from(R.string.preferences__internal_fetch_release_channel),
title = DSLSettingsText.from("Fetch release channel"),
onClick = {
SignalStore.releaseChannelValues().previousManifestMd5 = ByteArray(0)
RetrieveRemoteAnnouncementsJob.enqueue(force = true)
@ -469,7 +465,7 @@ class InternalSettingsFragment : DSLSettingsFragment(R.string.preferences__inter
)
clickPref(
title = DSLSettingsText.from(R.string.preferences__internal_add_sample_note),
title = DSLSettingsText.from("Add sample note"),
onClick = {
viewModel.addSampleReleaseNote()
}
@ -477,27 +473,27 @@ class InternalSettingsFragment : DSLSettingsFragment(R.string.preferences__inter
dividerPref()
sectionHeaderPref(R.string.preferences__internal_cds)
sectionHeaderPref(DSLSettingsText.from("CDS"))
clickPref(
title = DSLSettingsText.from(R.string.preferences__internal_clear_history),
summary = DSLSettingsText.from(R.string.preferences__internal_clear_history_description),
title = DSLSettingsText.from("Clear history"),
summary = DSLSettingsText.from("Clears all CDS history, meaning the next sync will consider all numbers to be new."),
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),
title = DSLSettingsText.from("Clear all service IDs"),
summary = DSLSettingsText.from("Clears all known service IDs (except your own) for people that have phone numbers. Do not use on your personal device!"),
onClick = {
clearAllServiceIds()
}
)
clickPref(
title = DSLSettingsText.from(R.string.preferences__internal_clear_all_profile_keys),
summary = DSLSettingsText.from(R.string.preferences__internal_clear_all_profile_keys_description),
title = DSLSettingsText.from("Clear all profile keys"),
summary = DSLSettingsText.from("Clears all known profile keys (except your own). Do not use on your personal device!"),
onClick = {
clearAllProfileKeys()
}
@ -505,11 +501,11 @@ class InternalSettingsFragment : DSLSettingsFragment(R.string.preferences__inter
dividerPref()
sectionHeaderPref(R.string.ConversationListTabs__stories)
sectionHeaderPref(DSLSettingsText.from("Stories"))
clickPref(
title = DSLSettingsText.from(R.string.preferences__internal_clear_onboarding_state),
summary = DSLSettingsText.from(R.string.preferences__internal_clears_onboarding_flag_and_triggers_download_of_onboarding_stories),
title = DSLSettingsText.from("Clear onboarding state"),
summary = DSLSettingsText.from("Clears onboarding flag and triggers download of onboarding stories."),
isEnabled = state.canClearOnboardingState,
onClick = {
viewModel.onClearOnboardingState()
@ -525,7 +521,7 @@ class InternalSettingsFragment : DSLSettingsFragment(R.string.preferences__inter
)
clickPref(
title = DSLSettingsText.from(R.string.preferences__internal_stories_dialog_launcher),
title = DSLSettingsText.from("Stories dialog launcher"),
onClick = {
findNavController().safeNavigate(InternalSettingsFragmentDirections.actionInternalSettingsFragmentToStoryDialogsLauncherFragment())
}

View file

@ -9,7 +9,7 @@ import org.thoughtcrime.securesms.components.settings.configure
import org.thoughtcrime.securesms.stories.dialogs.StoryDialogs
import org.thoughtcrime.securesms.util.adapter.mapping.MappingAdapter
class StoryDialogLauncherFragment : DSLSettingsFragment(titleId = R.string.preferences__internal_stories_dialog_launcher) {
class InternalStoryDialogLauncherFragment : DSLSettingsFragment(titleId = R.string.preferences__internal_stories_dialog_launcher) {
override fun bindAdapter(adapter: MappingAdapter) {
adapter.submitList(getConfiguration().toMappingModelList())
}
@ -17,25 +17,25 @@ class StoryDialogLauncherFragment : DSLSettingsFragment(titleId = R.string.prefe
private fun getConfiguration(): DSLConfiguration {
return configure {
clickPref(
title = DSLSettingsText.from(R.string.preferences__internal_remove_group_story),
title = DSLSettingsText.from("Remove group story"),
onClick = {
StoryDialogs.removeGroupStory(requireContext(), "Family") {
Toast.makeText(requireContext(), R.string.preferences__internal_remove_group_story, Toast.LENGTH_SHORT).show()
Toast.makeText(requireContext(), "Remove group story", Toast.LENGTH_SHORT).show()
}
}
)
clickPref(
title = DSLSettingsText.from(R.string.preferences__internal_retry_send),
title = DSLSettingsText.from("Retry send"),
onClick = {
StoryDialogs.resendStory(requireContext()) {
Toast.makeText(requireContext(), R.string.preferences__internal_retry_send, Toast.LENGTH_SHORT).show()
Toast.makeText(requireContext(), "Retry send", Toast.LENGTH_SHORT).show()
}
}
)
clickPref(
title = DSLSettingsText.from(R.string.preferences__internal_story_or_profile_selector),
title = DSLSettingsText.from("Story or profile selector"),
onClick = {
StoryDialogs.displayStoryOrProfileImage(
context = requireContext(),
@ -46,37 +46,37 @@ class StoryDialogLauncherFragment : DSLSettingsFragment(titleId = R.string.prefe
)
clickPref(
title = DSLSettingsText.from(R.string.preferences__internal_hide_story),
title = DSLSettingsText.from("Hide story"),
onClick = {
StoryDialogs.hideStory(requireContext(), "Spiderman") {
Toast.makeText(requireContext(), R.string.preferences__internal_hide_story, Toast.LENGTH_SHORT).show()
Toast.makeText(requireContext(), "Hide story", Toast.LENGTH_SHORT).show()
}
}
)
clickPref(
title = DSLSettingsText.from(R.string.preferences__internal_turn_off_stories),
title = DSLSettingsText.from("Turn off stories"),
onClick = {
StoryDialogs.disableStories(requireContext(), false) {
Toast.makeText(requireContext(), R.string.preferences__internal_turn_off_stories, Toast.LENGTH_SHORT).show()
Toast.makeText(requireContext(), "Turn off stories", Toast.LENGTH_SHORT).show()
}
}
)
clickPref(
title = DSLSettingsText.from(R.string.preferences__internal_turn_off_stories_with_stories_on_disk),
title = DSLSettingsText.from("Turn off stories (with stories on disk)"),
onClick = {
StoryDialogs.disableStories(requireContext(), true) {
Toast.makeText(requireContext(), R.string.preferences__internal_turn_off_stories_with_stories_on_disk, Toast.LENGTH_SHORT).show()
Toast.makeText(requireContext(), "Turn off stories (with stories on disk)", Toast.LENGTH_SHORT).show()
}
}
)
clickPref(
title = DSLSettingsText.from(R.string.preferences__internal_delete_custom_story),
title = DSLSettingsText.from("Delete custom story"),
onClick = {
StoryDialogs.deleteDistributionList(requireContext(), "Family") {
Toast.makeText(requireContext(), R.string.preferences__internal_delete_custom_story, Toast.LENGTH_SHORT).show()
Toast.makeText(requireContext(), "Delete custom story", Toast.LENGTH_SHORT).show()
}
}
)

View file

@ -3,7 +3,6 @@ package org.thoughtcrime.securesms.components.settings.app.internal.donor
import androidx.fragment.app.viewModels
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
import org.signal.donations.StripeDeclineCode
import org.thoughtcrime.securesms.R
import org.thoughtcrime.securesms.components.settings.DSLConfiguration
import org.thoughtcrime.securesms.components.settings.DSLSettingsFragment
import org.thoughtcrime.securesms.components.settings.DSLSettingsText
@ -12,9 +11,9 @@ import org.thoughtcrime.securesms.components.settings.configure
import org.thoughtcrime.securesms.util.LifecycleDisposable
import org.thoughtcrime.securesms.util.adapter.mapping.MappingAdapter
class DonorErrorConfigurationFragment : DSLSettingsFragment() {
class InternalDonorErrorConfigurationFragment : DSLSettingsFragment() {
private val viewModel: DonorErrorConfigurationViewModel by viewModels()
private val viewModel: InternalDonorErrorConfigurationViewModel by viewModels()
private val lifecycleDisposable = LifecycleDisposable()
override fun bindAdapter(adapter: MappingAdapter) {
@ -23,17 +22,17 @@ class DonorErrorConfigurationFragment : DSLSettingsFragment() {
}
}
private fun getConfiguration(state: DonorErrorConfigurationState): DSLConfiguration {
private fun getConfiguration(state: InternalDonorErrorConfigurationState): DSLConfiguration {
return configure {
radioListPref(
title = DSLSettingsText.from(R.string.preferences__internal_donor_error_expired_badge),
title = DSLSettingsText.from("Expired Badge"),
selected = state.badges.indexOf(state.selectedBadge),
listItems = state.badges.map { it.name }.toTypedArray(),
onSelected = { viewModel.setSelectedBadge(it) }
)
radioListPref(
title = DSLSettingsText.from(R.string.preferences__internal_donor_error_cancelation_reason),
title = DSLSettingsText.from("Cancellation Reason"),
selected = UnexpectedSubscriptionCancellation.values().indexOf(state.selectedUnexpectedSubscriptionCancellation),
listItems = UnexpectedSubscriptionCancellation.values().map { it.status }.toTypedArray(),
onSelected = { viewModel.setSelectedUnexpectedSubscriptionCancellation(it) },
@ -41,7 +40,7 @@ class DonorErrorConfigurationFragment : DSLSettingsFragment() {
)
radioListPref(
title = DSLSettingsText.from(R.string.preferences__internal_donor_error_charge_failure),
title = DSLSettingsText.from("Charge Failure"),
selected = StripeDeclineCode.Code.values().indexOf(state.selectedStripeDeclineCode),
listItems = StripeDeclineCode.Code.values().map { it.code }.toTypedArray(),
onSelected = { viewModel.setStripeDeclineCode(it) },
@ -49,14 +48,14 @@ class DonorErrorConfigurationFragment : DSLSettingsFragment() {
)
primaryButton(
text = DSLSettingsText.from(R.string.preferences__internal_donor_error_save_and_finish),
text = DSLSettingsText.from("Save and Finish"),
onClick = {
lifecycleDisposable += viewModel.save().subscribe { requireActivity().finish() }
}
)
secondaryButtonNoOutline(
text = DSLSettingsText.from(R.string.preferences__internal_donor_error_clear),
text = DSLSettingsText.from("Clear"),
onClick = {
lifecycleDisposable += viewModel.clearErrorState().subscribe()
}

View file

@ -4,7 +4,7 @@ import org.signal.donations.StripeDeclineCode
import org.thoughtcrime.securesms.badges.models.Badge
import org.thoughtcrime.securesms.components.settings.app.subscription.errors.UnexpectedSubscriptionCancellation
data class DonorErrorConfigurationState(
data class InternalDonorErrorConfigurationState(
val badges: List<Badge> = emptyList(),
val selectedBadge: Badge? = null,
val selectedUnexpectedSubscriptionCancellation: UnexpectedSubscriptionCancellation? = null,

View file

@ -18,12 +18,12 @@ import org.thoughtcrime.securesms.util.rx.RxStore
import org.whispersystems.signalservice.api.subscriptions.ActiveSubscription
import java.util.Locale
class DonorErrorConfigurationViewModel : ViewModel() {
class InternalDonorErrorConfigurationViewModel : ViewModel() {
private val store = RxStore(DonorErrorConfigurationState())
private val store = RxStore(InternalDonorErrorConfigurationState())
private val disposables = CompositeDisposable()
val state: Flowable<DonorErrorConfigurationState> = store.stateFlowable
val state: Flowable<InternalDonorErrorConfigurationState> = store.stateFlowable
init {
val giftBadges: Single<List<Badge>> = Single
@ -131,20 +131,20 @@ class DonorErrorConfigurationViewModel : ViewModel() {
}
}
private fun handleBoostExpiration(state: DonorErrorConfigurationState) {
private fun handleBoostExpiration(state: InternalDonorErrorConfigurationState) {
SignalStore.donationsValues().setExpiredBadge(state.selectedBadge)
}
private fun handleGiftExpiration(state: DonorErrorConfigurationState) {
private fun handleGiftExpiration(state: InternalDonorErrorConfigurationState) {
SignalStore.donationsValues().setExpiredGiftBadge(state.selectedBadge)
}
private fun handleSubscriptionExpiration(state: DonorErrorConfigurationState) {
private fun handleSubscriptionExpiration(state: InternalDonorErrorConfigurationState) {
SignalStore.donationsValues().setExpiredBadge(state.selectedBadge)
handleSubscriptionPaymentFailure(state)
}
private fun handleSubscriptionPaymentFailure(state: DonorErrorConfigurationState) {
private fun handleSubscriptionPaymentFailure(state: InternalDonorErrorConfigurationState) {
SignalStore.donationsValues().unexpectedSubscriptionCancelationReason = state.selectedUnexpectedSubscriptionCancellation?.status
SignalStore.donationsValues().unexpectedSubscriptionCancelationTimestamp = System.currentTimeMillis()
SignalStore.donationsValues().setUnexpectedSubscriptionCancelationChargeFailure(

View file

@ -2279,7 +2279,7 @@ open class RecipientDatabase(context: Context, databaseHelper: SignalDatabase) :
db.beginTransaction()
try {
for ((e164, result) in mapping) {
ids += processPnpTuple(e164, result.pni, result.aci, false).finalId
ids += getAndPossiblyMerge(serviceId = result.aci, pni = result.pni, e164 = e164, pniVerified = false, changeSelf = false)
}
db.setTransactionSuccessful()

View file

@ -504,12 +504,12 @@
<fragment
android:id="@+id/donorErrorConfigurationFragment"
android:name="org.thoughtcrime.securesms.components.settings.app.internal.donor.DonorErrorConfigurationFragment"
android:name="org.thoughtcrime.securesms.components.settings.app.internal.donor.InternalDonorErrorConfigurationFragment"
android:label="donor_error_configuration_fragment" />
<fragment
android:id="@+id/storyDialogsLauncherFragment"
android:name="org.thoughtcrime.securesms.components.settings.app.internal.StoryDialogLauncherFragment"
android:name="org.thoughtcrime.securesms.components.settings.app.internal.InternalStoryDialogLauncherFragment"
android:label="story_dialogs_launcher_fragment" />
<!-- endregion -->

View file

@ -2875,7 +2875,6 @@
<string name="preferences__internal_force_gv2_invites" translatable="false">Force Invites</string>
<string name="preferences__internal_force_gv2_invites_description" translatable="false">Members will not be added directly to a GV2 even if they could be.</string>
<string name="preferences__internal_ignore_gv2_server_changes" translatable="false">Ignore server changes</string>
<string name="preferences__internal_ignore_gv2_server_changes_description" translatable="false">Changes in server\&apos;s response will be ignored, causing passive voice update messages if P2P is also ignored.</string>
<string name="preferences__internal_ignore_gv2_p2p_changes" translatable="false">Ignore P2P changes</string>
<string name="preferences__internal_ignore_gv2_p2p_changes_description" translatable="false">Changes sent P2P will be ignored. In conjunction with ignoring server changes, will cause passive voice.</string>
<string name="preferences__internal_payments" translatable="false">Payments</string>

View file

@ -2867,107 +2867,9 @@
<string name="configurable_single_select__customize_option">Customize option</string>
<!-- Internal only preferences -->
<string name="preferences__internal_turn_off_stories_with_stories_on_disk" translatable="false">Turn off stories (with stories on disk)</string>
<string name="preferences__internal_turn_off_stories" translatable="false">Turn off stories</string>
<string name="preferences__internal_delete_custom_story" translatable="false">Delete custom story</string>
<string name="preferences__internal_hide_story" translatable="false">Hide story</string>
<string name="preferences__internal_story_or_profile_selector" translatable="false">Story or profile selector</string>
<string name="preferences__internal_stories_dialog_launcher" translatable="false">Stories dialog launcher</string>
<string name="preferences__internal_retry_send" translatable="false">Retry send</string>
<string name="preferences__internal_remove_group_story" translatable="false">Remove group story</string>
<string name="preferences__internal_clear_onboarding_state" translatable="false">Clear onboarding state</string>
<string name="preferences__internal_clears_onboarding_flag_and_triggers_download_of_onboarding_stories" translatable="false">Clears onboarding flag and triggers download of onboarding stories.</string>
<string name="preferences__internal_preferences" translatable="false">Internal Preferences</string>
<string name="preferences__internal_preferences_groups_v2" translatable="false">Groups V2</string>
<string name="preferences__internal_force_gv2_invites" translatable="false">Force Invites</string>
<string name="preferences__internal_force_gv2_invites_description" translatable="false">Members will not be added directly to a GV2 even if they could be.</string>
<string name="preferences__internal_ignore_gv2_server_changes" translatable="false">Ignore server changes</string>
<string name="preferences__internal_ignore_gv2_server_changes_description" translatable="false">Changes in server\'s response will be ignored, causing passive voice update messages if P2P is also ignored.</string>
<string name="preferences__internal_ignore_gv2_p2p_changes" translatable="false">Ignore P2P changes</string>
<string name="preferences__internal_ignore_gv2_p2p_changes_description" translatable="false">Changes sent P2P will be ignored. In conjunction with ignoring server changes, will cause passive voice.</string>
<string name="preferences__internal_payments" translatable="false">Payments</string>
<string name="preferences__internal_payment_copy_data" translatable="false">Copy payments data</string>
<string name="preferences__internal_payment_copy_data_description" translatable="false">Copy all payment records to clipboard.</string>
<string name="preferences__internal_account" translatable="false">Account</string>
<string name="preferences__internal_refresh_attributes" translatable="false">Refresh attributes</string>
<string name="preferences__internal_refresh_attributes_description" translatable="false">Forces a write of capabilities on to the server followed by a read.</string>
<string name="preferences__internal_refresh_profile" translatable="false">Refresh profile</string>
<string name="preferences__internal_refresh_profile_description" translatable="false">Forces a refresh of your own profile.</string>
<string name="preferences__internal_rotate_profile_key" translatable="false">Rotate profile key</string>
<string name="preferences__internal_rotate_profile_key_description" translatable="false">Creates a new versioned profile, and triggers an update of any GV2 group you belong to.</string>
<string name="preferences__internal_refresh_remote_config" translatable="false">Refresh remote config</string>
<string name="preferences__internal_refresh_remote_config_description" translatable="false">Forces a refresh of the remote config locally instead of waiting for the elapsed time.</string>
<string name="preferences__internal_misc" translatable="false">Miscellaneous</string>
<string name="preferences__internal_user_details" translatable="false">\'Internal Details\' button</string>
<string name="preferences__internal_user_details_description" translatable="false">Show a button in conversation settings that lets you see more information about a user.</string>
<string name="preferences__internal_shake_to_report" translatable="false">Shake to Report</string>
<string name="preferences__internal_shake_to_report_description" translatable="false">Shake your phone to easily submit and share a debug log.</string>
<string name="preferences__internal_clear_keep_longer_logs" translatable="false">Clear keep longer logs</string>
<string name="preferences__internal_storage_service" translatable="false">Storage service</string>
<string name="preferences__internal_disable_storage_service" translatable="false">Disable syncing</string>
<string name="preferences__internal_disable_storage_service_description" translatable="false">Prevent syncing any data to/from storage service.</string>
<string name="preferences__internal_force_storage_service_sync" translatable="false">Overwrite remote data</string>
<string name="preferences__internal_sync_now" translatable="false">Sync now</string>
<string name="preferences__internal_sync_now_description" translatable="false">Enqueue a normal storage service sync.</string>
<string name="preferences__internal_force_storage_service_sync_description" translatable="false">Forces remote storage to match the local device state.</string>
<string name="preferences__internal_network" translatable="false">Network</string>
<string name="preferences__internal_allow_censorship_toggle" translatable="false">Allow censorship circumvention toggle</string>
<string name="preferences__internal_allow_censorship_toggle_description" translatable="false">Allow changing the censorship circumvention toggle regardless of network connectivity.</string>
<string name="preferences__internal_conversations_and_shortcuts" translatable="false">Conversations and Shortcuts</string>
<string name="preferences__internal_emoji" translatable="false">Emoji</string>
<string name="preferences__internal_use_built_in_emoji_set" translatable="false">Use built-in emoji set</string>
<string name="preferences__internal_force_emoji_download" translatable="false">Force emoji download</string>
<string name="preferences__internal_force_emoji_download_description" translatable="false">Download the latest emoji set if it\'s newer than what we have.</string>
<string name="preferences__internal_force_search_index_download" translatable="false">Force search index download</string>
<string name="preferences__internal_force_search_index_download_description" translatable="false">Download the latest emoji search index if it\'s newer than what we have.</string>
<string name="preferences__internal_current_version_builtin" translatable="false">Current version: Built-In</string>
<string name="preferences__internal_current_version_d_at_density_s" translatable="false">Current version: %1$d at density %2$s</string>
<string name="preferences__internal_delete_all_dynamic_shortcuts" translatable="false">Delete all dynamic shortcuts</string>
<string name="preferences__internal_click_to_delete_all_dynamic_shortcuts" translatable="false">Click to delete all dynamic shortcuts</string>
<string name="preferences__internal_details" translatable="false">Internal Details</string>
<string name="preferences__internal_disable_profile_sharing" translatable="false">Disable Profile Sharing</string>
<string name="preferences__internal_delete_session" translatable="false">Delete Session</string>
<string name="preferences__internal_sender_key" translatable="false">Sender Key</string>
<string name="preferences__internal_clear_all_state" translatable="false">Clear all state</string>
<string name="preferences__internal_click_to_delete_all_sender_key_state" translatable="false">Click to delete all sender key state</string>
<string name="preferences__internal_clear_shared_state" translatable="false">Clear shared state</string>
<string name="preferences__internal_click_to_delete_all_sharing_state" translatable="false">Click to delete all sharing state</string>
<string name="preferences__internal_remove_two_person_minimum" translatable="false">Remove 2 person minimum</string>
<string name="preferences__internal_remove_the_requirement_that_you_need" translatable="false">Remove the requirement that you need at least 2 recipients to use sender key.</string>
<string name="preferences__internal_delay_resends" translatable="false">Delay resends</string>
<string name="preferences__internal_delay_resending_messages_in_response_to_retry_receipts" translatable="false">Delay resending messages in response to retry receipts by 10 seconds.</string>
<string name="preferences__internal_local_metrics" translatable="false">Local Metrics</string>
<string name="preferences__internal_clear_local_metrics" translatable="false">Clear local metrics</string>
<string name="preferences__internal_click_to_clear_all_local_metrics_state" translatable="false">Click to clear all local metrics state.</string>
<string name="preferences__internal_calling_server" translatable="false">Group call server</string>
<string name="preferences__internal_calling_server_default" translatable="false">Default</string>
<string name="preferences__internal_calling_server_s" translatable="false">%1$s server</string>
<string name="preferences__internal_calling" translatable="false">Calling options</string>
<string name="preferences__internal_calling_audio_processing_method" translatable="false">Audio processing method</string>
<string name="preferences__internal_calling_bandwidth_mode" translatable="false">Bandwidth mode</string>
<string name="preferences__internal_calling_disable_telecom" translatable="false">Disable Telecom integration</string>
<string name="preferences__internal_badges" translatable="false">Badges</string>
<string name="preferences__internal_badges_enqueue_redemption" translatable="false">Enqueue redemption.</string>
<string name="preferences__internal_badges_enqueue_keep_alive" translatable="false">Enqueue keep-alive.</string>
<string name="preferences__internal_badges_set_error_state" translatable="false">Set error state.</string>
<string name="preferences__internal_release_channel" translatable="false">Release channel</string>
<string name="preferences__internal_fetch_release_channel" translatable="false">Fetch release channel</string>
<string name="preferences__internal_release_channel_set_last_version" translatable="false">Set last version seen back 10 versions</string>
<string name="preferences__internal_reset_donation_megaphone" translatable="false">Reset donation megaphone</string>
<string name="preferences__internal_add_sample_note" translatable="false">Add sample note</string>
<string name="preferences__internal_disable_stories" translatable="false">Disable stories</string>
<string name="preferences__internal_cds" translatable="false">CDS</string>
<string name="preferences__internal_clear_history" translatable="false">Clear history</string>
<string name="preferences__internal_clear_history_description" translatable="false">Clears all CDS history, meaning the next sync will consider all numbers to be new.</string>
<string name="preferences__internal_clear_all_service_ids" translatable="false">Clear all service IDs</string>
<string name="preferences__internal_clear_all_service_ids_description" translatable="false">Clears all known service IDs (except your own) for people that have phone numbers. Do not use on your personal device!</string>
<string name="preferences__internal_clear_all_profile_keys" translatable="false">Clear all profile keys</string>
<string name="preferences__internal_clear_all_profile_keys_description" translatable="false">Clears all known profile keys (except your own). Do not use on your personal device!</string>
<string name="preferences__internal_donor_error_expired_badge" translatable="false">Expired Badge</string>
<string name="preferences__internal_donor_error_charge_failure" translatable="false">Charge Failure</string>
<string name="preferences__internal_donor_error_cancelation_reason" translatable="false">Cancelation Reason</string>
<string name="preferences__internal_donor_error_save_and_finish" translatable="false">Save and Finish</string>
<string name="preferences__internal_donor_error_clear" translatable="false">Clear</string>
<string name="preferences__internal_stories_dialog_launcher" translatable="false">Stories dialog launcher</string>
<!-- Payments -->