diff --git a/vector/src/main/java/im/vector/activity/NotificationPrivacyActivity.java b/vector/src/main/java/im/vector/activity/NotificationPrivacyActivity.java index 7390950c27..03c2e7f5e9 100644 --- a/vector/src/main/java/im/vector/activity/NotificationPrivacyActivity.java +++ b/vector/src/main/java/im/vector/activity/NotificationPrivacyActivity.java @@ -16,10 +16,13 @@ package im.vector.activity; +import android.app.Activity; import android.content.Context; import android.content.Intent; +import android.net.Uri; import android.os.Build; import android.os.Bundle; +import android.provider.Settings; import android.support.v7.widget.Toolbar; import android.text.Layout; import android.view.MenuItem; @@ -31,7 +34,9 @@ import butterknife.BindView; import butterknife.ButterKnife; +import im.vector.Matrix; import im.vector.R; +import im.vector.gcm.GcmRegistrationManager; /* * This activity allows the user to choose a notifications privacy policy. @@ -105,49 +110,39 @@ protected void onCreate(Bundle savedInstanceState) { tvNoPermission.setVisibility(View.GONE); } + refreshNotificationPrivacy(); + rlyNormalPrivacy.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - rbPrivacyNormal.setChecked(true); - rbPrivacyLowDetail.setChecked(false); - rbPrivacyReduced.setChecked(false); - - rbPrivacyNormal.isChecked(); - Log.d(LOG_TAG, "RadioButton NotificationPrivacyNormal is selected"); - - //TODO + setNotificationPrivacy(NotificationPrivacyActivity.this, GcmRegistrationManager.NotificationPrivacy.NORMAL); + refreshNotificationPrivacy(); } }); rlyLowDetailNotifications.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - rbPrivacyNormal.setChecked(false); - rbPrivacyLowDetail.setChecked(true); - rbPrivacyReduced.setChecked(false); - - rbPrivacyLowDetail.isChecked(); - Log.d(LOG_TAG, "RadioButton NotificationPrivacyLowDetail is selected"); - - // TODO + setNotificationPrivacy(NotificationPrivacyActivity.this, GcmRegistrationManager.NotificationPrivacy.LOW_DETAIL); + refreshNotificationPrivacy(); } }); rlyReducedPrivacy.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - rbPrivacyNormal.setChecked(false); - rbPrivacyLowDetail.setChecked(false); - rbPrivacyReduced.setChecked(true); - - rbPrivacyReduced.isChecked(); - Log.d(LOG_TAG, "RadioButton NotificationPrivacyReduced is selected"); - - //TODO + setNotificationPrivacy(NotificationPrivacyActivity.this, GcmRegistrationManager.NotificationPrivacy.REDUCED); + refreshNotificationPrivacy(); } }); } + @Override + protected void onResume() { + super.onResume(); + refreshNotificationPrivacy(); + } + @Override public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == android.R.id.home) { @@ -158,4 +153,77 @@ public boolean onOptionsItemSelected(MenuItem item) { return super.onOptionsItemSelected(item); } + + private void refreshNotificationPrivacy() { + GcmRegistrationManager gcmRegistrationManager = Matrix.getInstance(this).getSharedGCMRegistrationManager(); + + switch (gcmRegistrationManager.getNotificationPrivacy()) { + case REDUCED: + rbPrivacyNormal.setChecked(false); + rbPrivacyLowDetail.setChecked(false); + rbPrivacyReduced.setChecked(true); + break; + case LOW_DETAIL: + rbPrivacyNormal.setChecked(false); + rbPrivacyLowDetail.setChecked(true); + rbPrivacyReduced.setChecked(false); + break; + case NORMAL: + rbPrivacyNormal.setChecked(true); + rbPrivacyLowDetail.setChecked(false); + rbPrivacyReduced.setChecked(false); + break; + } + } + + /** + * Set the new notification privacy setting. + * + * @param activity the activity from which to display the IgnoreBatteryOptimizations permission request dialog, if required + * @param notificationPrivacy the new setting + */ + static public void setNotificationPrivacy(Activity activity, GcmRegistrationManager.NotificationPrivacy notificationPrivacy) { + GcmRegistrationManager gcmRegistrationManager = Matrix.getInstance(activity).getSharedGCMRegistrationManager(); + + // first, set the new privacy setting + gcmRegistrationManager.setNotificationPrivacy(notificationPrivacy); + + // for the "NORMAL" privacy, the app needs to be able to run in background + // this requires the IgnoreBatteryOptimizations permission from android M + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M + && notificationPrivacy == GcmRegistrationManager.NotificationPrivacy.NORMAL) { + // display the system dialog for granting this permission. If previously granted, the + // system will not show it. + // Note: If the user finally does not grant the permission, gcmRegistrationManager.isBackgroundSyncAllowed() + // will return false and the notification privacy will fallback to "LOW_DETAIL". + Intent intent = new Intent(); + intent.setAction(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS); + intent.setData(Uri.parse("package:" + activity.getPackageName())); + activity.startActivity(intent); + } + } + + /** + * Get the displayed i18ned string for a notification privacy setting. + * + * @param context + * @param notificationPrivacy the setting to stringify + * @return a string + */ + static public String getNotificationPrivacyString(Context context, GcmRegistrationManager.NotificationPrivacy notificationPrivacy) { + String notificationPrivacyString = null; + + switch (notificationPrivacy) { + case REDUCED: + notificationPrivacyString = context.getString(R.string.settings_notification_privacy_reduced); + break; + case LOW_DETAIL: + notificationPrivacyString = context.getString(R.string.settings_notification_privacy_low_detail); + break; + case NORMAL: + notificationPrivacyString = context.getString(R.string.settings_notification_privacy_normal); + break;} + + return notificationPrivacyString; + } } diff --git a/vector/src/main/java/im/vector/activity/VectorHomeActivity.java b/vector/src/main/java/im/vector/activity/VectorHomeActivity.java index 252d42dc7a..0cac768e1c 100644 --- a/vector/src/main/java/im/vector/activity/VectorHomeActivity.java +++ b/vector/src/main/java/im/vector/activity/VectorHomeActivity.java @@ -610,9 +610,7 @@ private void checkNotificationPrivacySetting() { PreferencesManager.setDidAskUserToIgnoreBatteryOptimizations(this, true); // by default, use GCM and low detail notifications - gcmMgr.setContentSendingAllowed(false); - gcmMgr.setBackgroundSyncAllowed(false); - gcmMgr.forceSessionsRegistration(null); + gcmMgr.setNotificationPrivacy(GcmRegistrationManager.NotificationPrivacy.LOW_DETAIL); AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(R.string.startup_notification_privacy_title); @@ -624,20 +622,10 @@ public void onClick(DialogInterface dialog, int which) { Log.d(LOG_TAG, "checkNotificationPrivacySetting: user wants to grant the IgnoreBatteryOptimizations permission"); - // this is the normal policy on our "Notification Privacy" setting page: - // use GCM, share only meta data with it. Then, background sync to fetch message content - gcmMgr.setContentSendingAllowed(false); - gcmMgr.setBackgroundSyncAllowed(true); - gcmMgr.forceSessionsRegistration(null); - - // display the system dialog for granting the IgnoreBatteryOptimizations permission. - // If already granted, the system will not show it. - // Note: If the user finally does not grant the permission, gcmMgr.isBackgroundSyncAllowed() - // will return false and low detail notifications will be displayed. - Intent intent = new Intent(); - intent.setAction(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS); - intent.setData(Uri.parse("package:" + getPackageName())); - startActivity(intent); + // use NotificationPrivacyActivity in case we need to display the IgnoreBatteryOptimizations + // grant permission dialog + NotificationPrivacyActivity.setNotificationPrivacy(VectorHomeActivity.this, + GcmRegistrationManager.NotificationPrivacy.NORMAL); } }); @@ -647,7 +635,8 @@ public void onClick(DialogInterface dialog, int which) { Log.d(LOG_TAG, "checkNotificationPrivacySetting: user opens notification policy setting screen"); - // @TODO: Audrey: Open the notification policy setting screen + // open the notification policy setting screen + startActivity(NotificationPrivacyActivity.getIntent(VectorHomeActivity.this)); } }); diff --git a/vector/src/main/java/im/vector/fragments/VectorSettingsPreferencesFragment.java b/vector/src/main/java/im/vector/fragments/VectorSettingsPreferencesFragment.java index e86ddb0021..f0b508f204 100755 --- a/vector/src/main/java/im/vector/fragments/VectorSettingsPreferencesFragment.java +++ b/vector/src/main/java/im/vector/fragments/VectorSettingsPreferencesFragment.java @@ -141,8 +141,6 @@ public class VectorSettingsPreferencesFragment extends PreferenceFragment implem private static final int REQUEST_PHONEBOOK_COUNTRY = 789; private static final int REQUEST_LOCALE = 777; private static final int REQUEST_NOTIFICATION_RINGTONE = 888; - // TODO use this constant to handle startActivityForResult for notification privacy - private static final int REQUEST_NOTIFICATION_PRIVACY = 999; // rule Id <-> preference name private static HashMap mPushesRuleByResourceId = null; @@ -203,7 +201,6 @@ public void onAccountInfoUpdate(MyUser myUser) { private PreferenceCategory mIgnoredUserSettingsCategoryDivider; private PreferenceCategory mIgnoredUserSettingsCategory; // background sync category - private PreferenceCategory mBackgroundSyncCategory; private EditTextPreference mSyncRequestTimeoutPreference; private EditTextPreference mSyncRequestDelayPreference; private PreferenceCategory mLabsCategory; @@ -289,15 +286,16 @@ public boolean onPreferenceClick(Preference preference) { refreshNotificationRingTone(); EditTextPreference notificationPrivacyPreference = (EditTextPreference) findPreference(PreferencesManager.SETTINGS_NOTIFICATION_PRIVACY_PREFERENCE_KEY); - notificationPrivacyPreference.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { - @Override - public boolean onPreferenceClick(Preference preference) { - // TODO use startActivityForResult to get the notification privacy preference key selected - startActivity(NotificationPrivacyActivity.getIntent(getActivity())); - return true; - } - }); - refreshNotificationPrivacy(); + if (notificationPrivacyPreference != null) { + notificationPrivacyPreference.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { + @Override + public boolean onPreferenceClick(Preference preference) { + startActivity(NotificationPrivacyActivity.getIntent(getActivity())); + return true; + } + }); + refreshNotificationPrivacy(); + } // application version VectorCustomActionEditTextPreference versionTextPreference = (VectorCustomActionEditTextPreference) findPreference(PreferencesManager.SETTINGS_VERSION_PREFERENCE_KEY); @@ -372,7 +370,7 @@ public boolean onPreferenceChange(Preference preference, Object newValue) { // privacy policy EditTextPreference privacyPreference = (EditTextPreference) findPreference(PreferencesManager.SETTINGS_PRIVACY_POLICY_PREFERENCE_KEY); - if (null != termConditionsPreference) { + if (null != privacyPreference) { privacyPreference.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { @@ -622,90 +620,67 @@ public void onBingRuleUpdateFailure(String errorMessage) { } } - // background sync management - mBackgroundSyncCategory = (PreferenceCategory) findPreference(PreferencesManager.SETTINGS_BACKGROUND_SYNC_PREFERENCE_KEY); - mSyncRequestTimeoutPreference = (EditTextPreference) findPreference(PreferencesManager.SETTINGS_SET_SYNC_TIMEOUT_PREFERENCE_KEY); - mSyncRequestDelayPreference = (EditTextPreference) findPreference(PreferencesManager.SETTINGS_SET_SYNC_DELAY_PREFERENCE_KEY); - final CheckBoxPreference useBackgroundSyncPref = (CheckBoxPreference) findPreference(PreferencesManager.SETTINGS_ENABLE_BACKGROUND_SYNC_PREFERENCE_KEY); - final CheckBoxPreference allowContentSendingPref = (CheckBoxPreference) findPreference(PreferencesManager.SETTINGS_ENABLE_CONTENT_SENDING_PREFERENCE_KEY); - - if (null != useBackgroundSyncPref || null != allowContentSendingPref) { - final GcmRegistrationManager gcmMgr = Matrix.getInstance(appContext).getSharedGCMRegistrationManager(); + // background sync tuning settings + // these settings are useless and hidden if the app is registered to the GCM push service + final GcmRegistrationManager gcmMgr = Matrix.getInstance(appContext).getSharedGCMRegistrationManager(); + if (gcmMgr.useGCM() && gcmMgr.hasRegistrationToken()) { + // Hide the section + PreferenceScreen preferenceScreen = getPreferenceScreen(); + PreferenceCategory backgroundSyncCategory = (PreferenceCategory) findPreference(PreferencesManager.SETTINGS_BACKGROUND_SYNC_PREFERENCE_KEY); + PreferenceCategory backgroundSyncDivider = (PreferenceCategory) findPreference(PreferencesManager.SETTINGS_BACKGROUND_SYNC_DIVIDER_PREFERENCE_KEY); - final GcmRegistrationManager.ThirdPartyRegistrationListener listener = new GcmRegistrationManager.ThirdPartyRegistrationListener() { - - @Override - public void onThirdPartyRegistered() { - hideLoadingView(); - } - - @Override - public void onThirdPartyRegistrationFailed() { - hideLoadingView(); - } - - @Override - public void onThirdPartyUnregistered() { - hideLoadingView(); - } - - @Override - public void onThirdPartyUnregistrationFailed() { - hideLoadingView(); - } - }; + preferenceScreen.removePreference(backgroundSyncDivider); + preferenceScreen.removePreference(backgroundSyncCategory); + } + else { + mSyncRequestTimeoutPreference = (EditTextPreference) findPreference(PreferencesManager.SETTINGS_SET_SYNC_TIMEOUT_PREFERENCE_KEY); + mSyncRequestDelayPreference = (EditTextPreference) findPreference(PreferencesManager.SETTINGS_SET_SYNC_DELAY_PREFERENCE_KEY); + final CheckBoxPreference useBackgroundSyncPref = (CheckBoxPreference) findPreference(PreferencesManager.SETTINGS_ENABLE_BACKGROUND_SYNC_PREFERENCE_KEY); if (null != useBackgroundSyncPref) { - useBackgroundSyncPref.setChecked(gcmMgr.isBackgroundSyncAllowed()); - - useBackgroundSyncPref.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { - @Override - public boolean onPreferenceChange(Preference preference, Object aNewValue) { - final boolean newValue = (boolean) aNewValue; - if (newValue != gcmMgr.isBackgroundSyncAllowed()) { - gcmMgr.setBackgroundSyncAllowed(newValue); - } - - displayLoadingView(); - - Matrix.getInstance(VectorSettingsPreferencesFragment.this.getActivity()).getSharedGCMRegistrationManager().forceSessionsRegistration(listener); + final GcmRegistrationManager.ThirdPartyRegistrationListener listener = new GcmRegistrationManager.ThirdPartyRegistrationListener() { - // Display the content sending option only when the background sync is disabled whereas the GCM is supported. - if (newValue || !gcmMgr.hasRegistrationToken()) { - mBackgroundSyncCategory.removePreference(allowContentSendingPref); - } else { - mBackgroundSyncCategory.addPreference(allowContentSendingPref); - } + @Override + public void onThirdPartyRegistered() { + hideLoadingView(); + } - return true; + @Override + public void onThirdPartyRegistrationFailed() { + hideLoadingView(); } - }); - } - if (null != allowContentSendingPref) { - allowContentSendingPref.setChecked(gcmMgr.isContentSendingAllowed()); + @Override + public void onThirdPartyUnregistered() { + hideLoadingView(); + } - allowContentSendingPref.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { @Override - public boolean onPreferenceChange(Preference preference, Object aNewValue) { - final boolean newValue = (boolean) aNewValue; + public void onThirdPartyUnregistrationFailed() { + hideLoadingView(); + } + }; - if (newValue != gcmMgr.isContentSendingAllowed()) { - gcmMgr.setContentSendingAllowed(newValue); - } + if (null != useBackgroundSyncPref) { + useBackgroundSyncPref.setChecked(gcmMgr.isBackgroundSyncAllowed()); - displayLoadingView(); + useBackgroundSyncPref.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { + @Override + public boolean onPreferenceChange(Preference preference, Object aNewValue) { + final boolean newValue = (boolean) aNewValue; - Matrix.getInstance(VectorSettingsPreferencesFragment.this.getActivity()).getSharedGCMRegistrationManager().forceSessionsRegistration(listener); + if (newValue != gcmMgr.isBackgroundSyncAllowed()) { + gcmMgr.setBackgroundSyncAllowed(newValue); + } - return true; - } - }); + displayLoadingView(); - // Hide this pref if the background sync is allowed, or if the GCM is not supported - if (gcmMgr.isBackgroundSyncAllowed() || !gcmMgr.hasRegistrationToken()) { - mBackgroundSyncCategory.removePreference(allowContentSendingPref); + Matrix.getInstance(VectorSettingsPreferencesFragment.this.getActivity()).getSharedGCMRegistrationManager().forceSessionsRegistration(listener); + + return true; + } + }); } } } @@ -1065,11 +1040,14 @@ private void refreshDisplay() { // If notifications are disabled for the current user account or for the current user device // The others notifications settings have to be disable too boolean areNotifAllowed = rules.findDefaultRule(BingRule.RULE_ID_DISABLE_ALL).isEnabled; - Preference notificationSoundPreference = preferenceManager.findPreference(PreferencesManager.SETTINGS_NOTIFICATION_RINGTONE_SELECTION_PREFERENCE_KEY); - Preference notificationPrivacyPreference = preferenceManager.findPreference(PreferencesManager.SETTINGS_NOTIFICATION_PRIVACY_PREFERENCE_KEY); + Preference notificationSoundPreference = preferenceManager.findPreference(PreferencesManager.SETTINGS_NOTIFICATION_RINGTONE_SELECTION_PREFERENCE_KEY); notificationSoundPreference.setEnabled(!areNotifAllowed && gcmMgr.areDeviceNotificationsAllowed()); - notificationPrivacyPreference.setEnabled(!areNotifAllowed && gcmMgr.areDeviceNotificationsAllowed()); + + Preference notificationPrivacyPreference = preferenceManager.findPreference(PreferencesManager.SETTINGS_NOTIFICATION_PRIVACY_PREFERENCE_KEY); + if (notificationPrivacyPreference != null) { + notificationPrivacyPreference.setEnabled(!areNotifAllowed && gcmMgr.areDeviceNotificationsAllowed() && gcmMgr.useGCM()); + } } private void addButtons() { @@ -1415,17 +1393,31 @@ public void run() { } /** - * Refresh the nofication filename + * Refresh the notification ring tone */ private void refreshNotificationRingTone() { EditTextPreference notificationRingTonePreference = (EditTextPreference) findPreference(PreferencesManager.SETTINGS_NOTIFICATION_RINGTONE_SELECTION_PREFERENCE_KEY); notificationRingTonePreference.setSummary(PreferencesManager.getNotificationRingToneName(getActivity())); } + /** + * Refresh the notification privacy setting + */ private void refreshNotificationPrivacy() { EditTextPreference notificationPrivacyPreference = (EditTextPreference) findPreference(PreferencesManager.SETTINGS_NOTIFICATION_PRIVACY_PREFERENCE_KEY); - // TODO set the right notification privacy preference name - notificationPrivacyPreference.setSummary("Normal"); + + if (notificationPrivacyPreference != null) { + GcmRegistrationManager gcmRegistrationManager = Matrix.getInstance(getActivity()).getSharedGCMRegistrationManager(); + + // this setting apply only with GCM for the moment + if (gcmRegistrationManager.useGCM()) { + String notificationPrivacyString = NotificationPrivacyActivity.getNotificationPrivacyString(getActivity().getApplicationContext(), gcmRegistrationManager.getNotificationPrivacy()); + notificationPrivacyPreference.setSummary(notificationPrivacyString); + } else { + PreferenceCategory notificationsSettingsCategory = (PreferenceCategory) findPreference(PreferencesManager.SETTINGS_NOTIFICATIONS_KEY); + notificationsSettingsCategory.removePreference(notificationPrivacyPreference); + } + } } @Override @@ -1445,10 +1437,6 @@ public void onActivityResult(int requestCode, int resultCode, final Intent data) refreshNotificationRingTone(); break; } - case REQUEST_NOTIFICATION_PRIVACY: - refreshNotificationPrivacy(); - // TODO handle and display result of radio button selection - break; case REQUEST_E2E_FILE_REQUEST_CODE: importKeys(data); break; @@ -2338,16 +2326,6 @@ public void run() { } }); } - - // theses settings are dedicated when a client does not support GCM - if (gcmmgr.hasRegistrationToken()) { - final Preference autoStartSyncPref = findPreference(PreferencesManager.SETTINGS_START_ON_BOOT_PREFERENCE_KEY); - if (null != autoStartSyncPref) { - mBackgroundSyncCategory.removePreference(autoStartSyncPref); - } - mBackgroundSyncCategory.removePreference(mSyncRequestTimeoutPreference); - mBackgroundSyncCategory.removePreference(mSyncRequestDelayPreference); - } } //============================================================================================================== diff --git a/vector/src/main/java/im/vector/gcm/GcmRegistrationManager.java b/vector/src/main/java/im/vector/gcm/GcmRegistrationManager.java index ed883fac21..503161e508 100755 --- a/vector/src/main/java/im/vector/gcm/GcmRegistrationManager.java +++ b/vector/src/main/java/im/vector/gcm/GcmRegistrationManager.java @@ -1063,6 +1063,37 @@ public boolean isServerUnRegistred() { // GCM preferences //================================================================================ + /** + * Notification privacy policies as displayed to the end user. + * In the code, this enumeration is currently implemented with combinations of booleans. + */ + public enum NotificationPrivacy { + /** + * Reduced privacy: message metadata and content are sent through the push service. + * Notifications for messages in e2e rooms are displayed with low detail. + */ + REDUCED, + + /** + * Notifications are displayed with low detail (X messages in RoomY). + * Only message metadata is sent through the push service. + */ + LOW_DETAIL, + + /** + * Normal: full detailed notifications by keeping user privacy. + * Only message metadata is sent through the push service. The app then makes a sync in bg + * with the homeserver. + */ + NORMAL + + // Some hints for future usage + //UNKNOWN, // the policy has not been set yet + //NO_NOTIFICATIONS, // no notifications + + // TODO: This enum could turn into an enum class with methods like isContentSendingAllowed() + } + /** * Clear the GCM preferences */ @@ -1088,6 +1119,53 @@ public boolean useGCM() { return mUseGCM; } + /** + * @return the current notification privacy setting as displayed to the end user. + */ + public NotificationPrivacy getNotificationPrivacy() { + NotificationPrivacy notificationPrivacy = NotificationPrivacy.LOW_DETAIL; + + boolean isContentSendingAllowed = isContentSendingAllowed(); + boolean isBackgroundSyncAllowed = isBackgroundSyncAllowed(); + + if (isContentSendingAllowed && !isBackgroundSyncAllowed) + { + notificationPrivacy = NotificationPrivacy.REDUCED; + } + else if (!isContentSendingAllowed && isBackgroundSyncAllowed) + { + notificationPrivacy = NotificationPrivacy.NORMAL; + } + + return notificationPrivacy; + } + + /** + * Update the notification privacy setting. + * Translate the setting displayed to end user into internal booleans. + * + * @param notificationPrivacy the new notification privacy. + */ + public void setNotificationPrivacy(NotificationPrivacy notificationPrivacy) { + + switch (notificationPrivacy) { + case REDUCED: + setContentSendingAllowed(true); + setBackgroundSyncAllowed(false); + break; + case LOW_DETAIL: + setContentSendingAllowed(false); + setBackgroundSyncAllowed(false); + break; + case NORMAL: + setContentSendingAllowed(false); + setBackgroundSyncAllowed(true); + break; + } + + forceSessionsRegistration(null); + } + /** * @return true the notifications must be triggered on this device */ diff --git a/vector/src/main/java/im/vector/util/PreferencesManager.java b/vector/src/main/java/im/vector/util/PreferencesManager.java index 8899071cf8..2dcd895475 100755 --- a/vector/src/main/java/im/vector/util/PreferencesManager.java +++ b/vector/src/main/java/im/vector/util/PreferencesManager.java @@ -59,7 +59,6 @@ public class PreferencesManager { public static final String SETTINGS_CLEAR_CACHE_PREFERENCE_KEY = "SETTINGS_CLEAR_CACHE_PREFERENCE_KEY"; public static final String SETTINGS_CLEAR_MEDIA_CACHE_PREFERENCE_KEY = "SETTINGS_CLEAR_MEDIA_CACHE_PREFERENCE_KEY"; public static final String SETTINGS_ENABLE_BACKGROUND_SYNC_PREFERENCE_KEY = "SETTINGS_ENABLE_BACKGROUND_SYNC_PREFERENCE_KEY"; - public static final String SETTINGS_ENABLE_CONTENT_SENDING_PREFERENCE_KEY = "SETTINGS_ENABLE_CONTENT_SENDING_PREFERENCE_KEY"; public static final String SETTINGS_OTHERS_PREFERENCE_KEY = "SETTINGS_OTHERS_PREFERENCE_KEY"; public static final String SETTINGS_USER_SETTINGS_PREFERENCE_KEY = "SETTINGS_USER_SETTINGS_PREFERENCE_KEY"; public static final String SETTINGS_CONTACT_PREFERENCE_KEYS = "SETTINGS_CONTACT_PREFERENCE_KEYS"; @@ -80,6 +79,7 @@ public class PreferencesManager { public static final String SETTINGS_CONTACTS_PHONEBOOK_COUNTRY_PREFERENCE_KEY = "SETTINGS_CONTACTS_PHONEBOOK_COUNTRY_PREFERENCE_KEY"; public static final String SETTINGS_INTERFACE_LANGUAGE_PREFERENCE_KEY = "SETTINGS_INTERFACE_LANGUAGE_PREFERENCE_KEY"; public static final String SETTINGS_BACKGROUND_SYNC_PREFERENCE_KEY = "SETTINGS_BACKGROUND_SYNC_PREFERENCE_KEY"; + public static final String SETTINGS_BACKGROUND_SYNC_DIVIDER_PREFERENCE_KEY = "SETTINGS_BACKGROUND_SYNC_DIVIDER_PREFERENCE_KEY"; public static final String SETTINGS_ENCRYPTION_INFORMATION_DEVICE_NAME_PREFERENCE_KEY = "SETTINGS_ENCRYPTION_INFORMATION_DEVICE_NAME_PREFERENCE_KEY"; public static final String SETTINGS_ENCRYPTION_INFORMATION_DEVICE_ID_PREFERENCE_KEY = "SETTINGS_ENCRYPTION_INFORMATION_DEVICE_ID_PREFERENCE_KEY"; public static final String SETTINGS_ENCRYPTION_EXPORT_E2E_ROOM_KEYS_PREFERENCE_KEY = "SETTINGS_ENCRYPTION_EXPORT_E2E_ROOM_KEYS_PREFERENCE_KEY"; @@ -88,6 +88,7 @@ public class PreferencesManager { public static final String SETTINGS_ENCRYPTION_INFORMATION_DEVICE_KEY_PREFERENCE_KEY = "SETTINGS_ENCRYPTION_INFORMATION_DEVICE_KEY_PREFERENCE_KEY"; public static final String SETTINGS_DISPLAY_NAME_PREFERENCE_KEY = "SETTINGS_DISPLAY_NAME_PREFERENCE_KEY"; + public static final String SETTINGS_NOTIFICATIONS_KEY = "SETTINGS_NOTIFICATIONS_KEY"; public static final String SETTINGS_ENABLE_ALL_NOTIF_PREFERENCE_KEY = "SETTINGS_ENABLE_ALL_NOTIF_PREFERENCE_KEY"; public static final String SETTINGS_ENABLE_THIS_DEVICE_PREFERENCE_KEY = "SETTINGS_ENABLE_THIS_DEVICE_PREFERENCE_KEY"; public static final String SETTINGS_TURN_SCREEN_ON_PREFERENCE_KEY = "SETTINGS_TURN_SCREEN_ON_PREFERENCE_KEY"; diff --git a/vector/src/main/res/layout/activity_notification_privacy.xml b/vector/src/main/res/layout/activity_notification_privacy.xml index 5f29535e7d..bb0a522941 100644 --- a/vector/src/main/res/layout/activity_notification_privacy.xml +++ b/vector/src/main/res/layout/activity_notification_privacy.xml @@ -69,7 +69,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" - android:text="@string/normal" + android:text="@string/settings_notification_privacy_normal" android:textSize="20sp" android:layout_marginTop="2dp" android:layout_marginLeft="40dp" /> diff --git a/vector/src/main/res/values-bg/strings.xml b/vector/src/main/res/values-bg/strings.xml index 09bcbee20d..cc041e4fe9 100644 --- a/vector/src/main/res/values-bg/strings.xml +++ b/vector/src/main/res/values-bg/strings.xml @@ -893,6 +893,4 @@ Профилна снимка Профилна снимка Отвори заглавие - Остави детайлирани известия - Включи тази опция, когато фоновата синхронизация е изключвена за показване на детайлирани известия. Това изисква изпращането на съдържанието на нешифровани съобщения през сървъри за Google услуги diff --git a/vector/src/main/res/values-de/strings.xml b/vector/src/main/res/values-de/strings.xml index 710169ee06..09a17a9de8 100644 --- a/vector/src/main/res/values-de/strings.xml +++ b/vector/src/main/res/values-de/strings.xml @@ -953,6 +953,4 @@ Unbekannte Geräte: Öffne Chat-Kopf Lesebestätigungs-Profilbild Notiz-Avatar - Behalte detailierte Benachrichtigungen - Aktiviere diese Option, wenn die Hintergrundsynchronisierung für detaillierte Benachrichtigungen deaktiviert wurde. Dies führt dazu, dass unverschlüsselter Nachrichten-Inhalt durch Google-Server geleitet wird diff --git a/vector/src/main/res/values-es/strings.xml b/vector/src/main/res/values-es/strings.xml index 0fc9c31f5c..fcac828fda 100644 --- a/vector/src/main/res/values-es/strings.xml +++ b/vector/src/main/res/values-es/strings.xml @@ -928,6 +928,4 @@ Lo puedes hacer ahora o luego desde las configuraciones de la aplicación.1 miembro activo %d miembros activos - Mantener las notificaciones detalladas - Encender esta opción cuando la sincronización en segundo plano está desactivada para mostrar notificaciones detalladas. Esto requiere enviar el contenido de mensajes no cifrados a través de servidores de servicios de Google diff --git a/vector/src/main/res/values-eu/strings.xml b/vector/src/main/res/values-eu/strings.xml index 38eaed91c8..f7337ef305 100644 --- a/vector/src/main/res/values-eu/strings.xml +++ b/vector/src/main/res/values-eu/strings.xml @@ -908,6 +908,4 @@ Zifratutako mezuak ez dira zifratzea oraindik ezarrita ez duten beste gailuetan Jakinarazpen abatarra Abatarra -Mantendu jakinarazpen xehatuak - "Gaitu aukera hau bigarren planoko sinkronizazioa desgaituta dagoenean jakinarazpen xehatuak bistaratzeko. Honek zifratu gabeko mezuaren edukia Google zerbitzarien bidez igortzea eskatzen du" diff --git a/vector/src/main/res/values-hu/strings.xml b/vector/src/main/res/values-hu/strings.xml index b60ae74074..c758dad9a8 100644 --- a/vector/src/main/res/values-hu/strings.xml +++ b/vector/src/main/res/values-hu/strings.xml @@ -908,6 +908,4 @@ Ismeretlen eszközök: Visszaigazolási avatar Észlelés avatar - Részletes értesítések megtartása - Kapcsold be ezt a lehetőséget ha a részletes értesítésekhez a háttér szinkronizáció ki van kapcsolva. Ehhez az üzenetet titkosítatlanul kell küldeni a Google szolgáltatás szerverein keresztül diff --git a/vector/src/main/res/values-it/strings.xml b/vector/src/main/res/values-it/strings.xml index ec8575fa34..9607d06748 100644 --- a/vector/src/main/res/values-it/strings.xml +++ b/vector/src/main/res/values-it/strings.xml @@ -822,8 +822,6 @@ Permetti a Riot di accedere ai tuoi contatti? Silenzioso Aggiungi scorciatoia schermata iniziale - Mantieni notifiche dettagliate - Attiva questa opzione per mostrare notifiche dettagliate quando la sincronizzazione in background è disabilitata. Ciò richiede l\'invio di messaggi non cifrati attraverso i server dei servizi di Google Attiva le anteprime URL in modo predefinito Nascondi i messaggi di entrata/uscita (inviti/kick/ban esclusi) Vibra quando ti citano diff --git a/vector/src/main/res/values-ru/strings.xml b/vector/src/main/res/values-ru/strings.xml index 28d9d82157..029aa9bee3 100644 --- a/vector/src/main/res/values-ru/strings.xml +++ b/vector/src/main/res/values-ru/strings.xml @@ -965,8 +965,6 @@ Email также позволит вам при необходимости во - Сохранять подробные уведомления - Включите эту опцию при отключенной фоновой синхронизации для отображения подробных уведомлений. Для этого требуется отправлять нешифрованный контент через серверы служб Google 1 непрочитанное уведомление %d непрочитанных уведомления diff --git a/vector/src/main/res/values/strings.xml b/vector/src/main/res/values/strings.xml index 420ffbc125..2fcabd58af 100755 --- a/vector/src/main/res/values/strings.xml +++ b/vector/src/main/res/values/strings.xml @@ -534,6 +534,7 @@ Notification privacy Riot.im runs in the background to keep your notification message content private. You can change this option to reduce battery usage. + Normal Power-saving Options Low detail notifications Reduced privacy @@ -561,8 +562,6 @@ Start on boot Background synchronization Enable background sync - Keep detailed notifications - Turn on this option when the background sync is disabled to display detailed notifications. This requires to send non encrypted message content through Google services servers Sync request timeout Delay between two sync requests second diff --git a/vector/src/main/res/xml/vector_settings_preferences.xml b/vector/src/main/res/xml/vector_settings_preferences.xml index 45f5d2e407..d5c65c3b0a 100755 --- a/vector/src/main/res/xml/vector_settings_preferences.xml +++ b/vector/src/main/res/xml/vector_settings_preferences.xml @@ -135,7 +135,9 @@ - + - + - -