From 3e008f67522afbfe87cfae14b725a95c8e4a86f5 Mon Sep 17 00:00:00 2001 From: FeuRenard Date: Fri, 18 Nov 2016 22:10:59 +0100 Subject: [PATCH] Hide linked devices pref for unregistered users Fixes #4860 Closes #5872 // FREEBIE --- .../securesms/ApplicationPreferencesActivity.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/org/thoughtcrime/securesms/ApplicationPreferencesActivity.java b/src/org/thoughtcrime/securesms/ApplicationPreferencesActivity.java index 810ed4b65d..8cb41ced6e 100644 --- a/src/org/thoughtcrime/securesms/ApplicationPreferencesActivity.java +++ b/src/org/thoughtcrime/securesms/ApplicationPreferencesActivity.java @@ -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;