Add search current/home region to debug screen. (#17015)

upstream-sync
Sebastian Kaspari 4 years ago committed by GitHub
parent d0b09b7d69
commit 46813dd89c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -9,6 +9,7 @@ import androidx.preference.Preference
import androidx.preference.PreferenceFragmentCompat
import com.leanplum.Leanplum
import org.mozilla.fenix.R
import org.mozilla.fenix.ext.requireComponents
import org.mozilla.fenix.ext.showToolbar
class SecretDebugSettingsFragment : PreferenceFragmentCompat() {
@ -21,6 +22,8 @@ class SecretDebugSettingsFragment : PreferenceFragmentCompat() {
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
setPreferencesFromResource(R.xml.secret_info_settings_preferences, rootKey)
val store = requireComponents.core.store
requirePreference<Preference>(R.string.pref_key_leanplum_user_id).apply {
summary = Leanplum.getUserId().let {
if (it.isNullOrEmpty()) {
@ -40,5 +43,13 @@ class SecretDebugSettingsFragment : PreferenceFragmentCompat() {
}
}
}
requirePreference<Preference>(R.string.pref_key_search_region_home).apply {
summary = store.state.search.region?.home ?: "Unknown"
}
requirePreference<Preference>(R.string.pref_key_search_region_current).apply {
summary = store.state.search.region?.current ?: "Unknown"
}
}
}

@ -237,4 +237,6 @@
<string name="pref_key_secret_debug_info" translatable="false">pref_key_secret_debug_info</string>
<string name="pref_key_leanplum_user_id" translatable="false">pref_key_leanplum_user_id</string>
<string name="pref_key_leanplum_device_id" translatable="false">pref_key_leanplum_device_id</string>
<string name="pref_key_search_region_home" translatable="false">pref_key_search_region_home</string>
<string name="pref_key_search_region_current" translatable="false">pref_key_search_region_current</string>
</resources>

@ -68,4 +68,7 @@
<string name="debug_info_telemetry_title" translatable="false">Telemetry</string>
<string name="debug_info_leanplum_user_id" translatable="false">Leanplum User Id</string>
<string name="debug_info_leanplum_device_id" translatable="false">Leanplum Device Id</string>
<string name="debug_info_search_title" translatable="false">Search</string>
<string name="debug_info_region_home" translatable="false">Home region</string>
<string name="debug_info_region_current" translatable="false">Current region</string>
</resources>

@ -16,4 +16,17 @@
android:enabled="false" />
</PreferenceCategory>
<PreferenceCategory
android:title="@string/debug_info_search_title">
<Preference
android:key="@string/pref_key_search_region_home"
android:title="@string/debug_info_region_home"
android:enabled="false" />
<Preference
android:key="@string/pref_key_search_region_current"
android:title="@string/debug_info_region_current"
android:enabled="false" />
</PreferenceCategory>
</PreferenceScreen>

Loading…
Cancel
Save