Hide linked devices pref for unregistered users

Fixes #4860
Closes #5872
// FREEBIE
This commit is contained in:
FeuRenard 2016-11-18 22:10:59 +01:00 committed by Moxie Marlinspike
parent 8fdcff9f20
commit 3e008f6752

View File

@ -149,6 +149,7 @@ public class ApplicationPreferencesActivity extends PassphraseRequiredActionBarA
super.onResume();
((ApplicationPreferencesActivity) getActivity()).getSupportActionBar().setTitle(R.string.text_secure_normal__menu_settings);
setCategorySummaries();
setCategoryVisibility();
}
private void setCategorySummaries() {
@ -164,6 +165,13 @@ public class ApplicationPreferencesActivity extends PassphraseRequiredActionBarA
.setSummary(ChatsPreferenceFragment.getSummary(getActivity()));
}
private void setCategoryVisibility() {
Preference devicePreference = this.findPreference(PREFERENCE_CATEGORY_DEVICES);
if (devicePreference != null && !TextSecurePreferences.isPushRegistered(getActivity())) {
getPreferenceScreen().removePreference(devicePreference);
}
}
private class CategoryClickListener implements Preference.OnPreferenceClickListener {
private MasterSecret masterSecret;
private String category;