Disable SC defaults button in non-internal builds

It is in the "Dev Tools" section, and it tells you to not click it.
Apparently, users have a serious problem with that.

Closes https://github.com/SchildiChat/SchildiChat-android/issues/212

Change-Id: I3e5101b107127d7d7f1dfb92ca2df225bb8a79a7
This commit is contained in:
SpiritCroc 2023-11-29 09:17:56 +01:00
parent 0cff637113
commit 3c974e0085
1 changed files with 16 additions and 10 deletions

View File

@ -26,6 +26,7 @@ import im.vector.app.core.platform.VectorBaseActivity
import im.vector.app.core.preference.VectorPreference
import im.vector.app.core.preference.VectorPreferenceCategory
import im.vector.app.core.preference.VectorSwitchPreference
import im.vector.app.core.resources.BuildMeta
import im.vector.app.core.utils.copyToClipboard
import im.vector.app.features.analytics.plan.MobileScreen
import im.vector.app.features.home.NightlyProxy
@ -43,6 +44,8 @@ class VectorSettingsAdvancedSettingsFragment :
@Inject lateinit var nightlyProxy: NightlyProxy
@Inject lateinit var buildMeta: BuildMeta
private var rageshake: RageShake? = null
override fun onCreate(savedInstanceState: Bundle?) {
@ -112,16 +115,19 @@ class VectorSettingsAdvancedSettingsFragment :
findPreference<VectorPreferenceCategory>("SETTINGS_RAGE_SHAKE_CATEGORY_KEY")!!.isVisible = false
}
findPreference<VectorPreference>("SETTINGS_APPLY_SC_DEFAULT_SETTINGS")?.onPreferenceClickListener = Preference.OnPreferenceClickListener {
MaterialAlertDialogBuilder(requireContext())
.setTitle(R.string.settings_apply_sc_default_settings_dialog_title)
.setMessage(R.string.settings_apply_sc_default_settings_dialog_summary)
.setPositiveButton(R.string._continue) { _, _ ->
vectorPreferences.applyScDefaultValues()
}
.setNegativeButton(R.string.action_cancel) { _, _ -> /* Just close dialog */ }
.show()
true
findPreference<VectorPreference>("SETTINGS_APPLY_SC_DEFAULT_SETTINGS")?.let {
it.onPreferenceClickListener = Preference.OnPreferenceClickListener {
MaterialAlertDialogBuilder(requireContext())
.setTitle(R.string.settings_apply_sc_default_settings_dialog_title)
.setMessage(R.string.settings_apply_sc_default_settings_dialog_summary)
.setPositiveButton(R.string._continue) { _, _ ->
vectorPreferences.applyScDefaultValues()
}
.setNegativeButton(R.string.action_cancel) { _, _ -> /* Just close dialog */ }
.show()
true
}
it.isVisible = buildMeta.isInternalBuild
}
}