Fix issue in notification preference

This commit is contained in:
Benoit Marty 2019-06-26 17:37:03 +02:00
parent 7c47c6a033
commit ad3d303405
3 changed files with 5 additions and 73 deletions

View File

@ -51,8 +51,6 @@ public class PreferencesManager {
public static final String SETTINGS_APP_TERM_CONDITIONS_PREFERENCE_KEY = "SETTINGS_APP_TERM_CONDITIONS_PREFERENCE_KEY";
public static final String SETTINGS_PRIVACY_POLICY_PREFERENCE_KEY = "SETTINGS_PRIVACY_POLICY_PREFERENCE_KEY";

//TODO delete
public static final String SETTINGS_NOTIFICATION_PRIVACY_PREFERENCE_KEY = "SETTINGS_NOTIFICATION_PRIVACY_PREFERENCE_KEY";
public static final String SETTINGS_NOTIFICATION_TROUBLESHOOT_PREFERENCE_KEY = "SETTINGS_NOTIFICATION_TROUBLESHOOT_PREFERENCE_KEY";
public static final String SETTINGS_NOTIFICATION_ADVANCED_PREFERENCE_KEY = "SETTINGS_NOTIFICATION_ADVANCED_PREFERENCE_KEY";
public static final String SETTINGS_THIRD_PARTY_NOTICES_PREFERENCE_KEY = "SETTINGS_THIRD_PARTY_NOTICES_PREFERENCE_KEY";

View File

@ -59,19 +59,8 @@ class VectorSettingsNotificationPreferenceFragment : VectorSettingsBaseFragment(
private val notificationsSettingsCategory by lazy {
findPreference(PreferencesManager.SETTINGS_NOTIFICATIONS_KEY) as PreferenceCategory
}
private val mNotificationPrivacyPreference by lazy {
findPreference(PreferencesManager.SETTINGS_NOTIFICATION_PRIVACY_PREFERENCE_KEY)
}

override fun bindPref() {
// Notification privacy
mNotificationPrivacyPreference.onPreferenceClickListener = Preference.OnPreferenceClickListener {
notImplemented()
// TODO startActivity(NotificationPrivacyActivity.getIntent(activity))
true
}
refreshNotificationPrivacy()

for (preferenceKey in mPrefKeyToBingRuleId.keys) {
val preference = findPreference(preferenceKey)

@ -81,7 +70,7 @@ class VectorSettingsNotificationPreferenceFragment : VectorSettingsBaseFragment(
// on some old android APIs,
// the callback is called even if there is no user interaction
// so the value will be checked to ensure there is really no update.
onPushRuleClick(preference.key, newValueAsVoid as Boolean)
// TODO onPushRuleClick(preference.key, newValueAsVoid as Boolean)
true
}
}
@ -242,24 +231,6 @@ class VectorSettingsNotificationPreferenceFragment : VectorSettingsBaseFragment(
*/
}

/**
* Refresh the notification privacy setting
*/
private fun refreshNotificationPrivacy() {
/* TODO
val pushManager = Matrix.getInstance(activity).pushManager

// this setting apply only with FCM for the moment
if (pushManager.useFcm()) {
val notificationPrivacyString = NotificationPrivacyActivity.getNotificationPrivacyString(activity,
pushManager.notificationPrivacy)
mNotificationPrivacyPreference.summary = notificationPrivacyString
} else {
notificationsSettingsCategory.removePreference(mNotificationPrivacyPreference)
}
*/
}

/**
* Refresh the background sync preference
*/

View File

@ -2,51 +2,17 @@
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">

<!--<im.vector.riotredesign.core.preference.VectorSwitchPreference-->
<!--android:key="SETTINGS_ENABLE_ALL_NOTIF_PREFERENCE_KEY"-->
<!--android:title="@string/settings_enable_all_notif" />-->

<im.vector.riotredesign.core.preference.VectorSwitchPreference
android:defaultValue="true"
android:key="SETTINGS_ENABLE_THIS_DEVICE_PREFERENCE_KEY"
android:title="@string/settings_enable_this_device" />
<!--android:dependency="SETTINGS_ENABLE_ALL_NOTIF_PREFERENCE_KEY"-->

<!--<im.vector.riotredesign.core.preference.VectorSwitchPreference-->
<!--android:dependency="SETTINGS_ENABLE_ALL_NOTIF_PREFERENCE_KEY"-->
<!--android:key="SETTINGS_TURN_SCREEN_ON_PREFERENCE_KEY"-->
<!--android:title="@string/settings_turn_screen_on" />-->

<!--<im.vector.riotredesign.core.preference.VectorPreference-->
<!--android:dialogTitle="@string/settings_notification_privacy"-->
<!--android:key="SETTINGS_NOTIFICATION_PRIVACY_PREFERENCE_KEY"-->
<!--android:title="@string/settings_notification_privacy" />-->

<im.vector.riotredesign.core.preference.VectorPreference
android:dependency="SETTINGS_ENABLE_THIS_DEVICE_PREFERENCE_KEY"
android:enabled="false"
android:key="SETTINGS_NOTIFICATION_ADVANCED_PREFERENCE_KEY"
android:persistent="false"
android:summary="@string/settings_notification_advanced_summary"
android:title="@string/settings_notification_advanced"
android:visibility="gone"
app:fragment="im.vector.fragments.VectorSettingsNotificationsAdvancedFragment" />

<im.vector.riotredesign.core.preference.VectorPreference
android:key="SETTINGS_NOTIFICATION_TROUBLESHOOT_PREFERENCE_KEY"
android:title="@string/settings_notification_troubleshoot"
app:fragment="im.vector.riotredesign.features.settings.VectorSettingsNotificationsTroubleshootFragment" />


<im.vector.riotredesign.core.preference.VectorPreferenceCategory
android:key="SETTINGS_NOTIFICATIONS_KEY"
android:title="@string/settings_notifications">

<im.vector.riotredesign.core.preference.VectorSwitchPreference
android:defaultValue="true"
android:key="SETTINGS_ENABLE_ALL_NOTIF_PREFERENCE_KEY"
android:title="@string/settings_enable_all_notif" />

<im.vector.riotredesign.core.preference.VectorSwitchPreference
android:defaultValue="true"
android:dependency="SETTINGS_ENABLE_ALL_NOTIF_PREFERENCE_KEY"
android:key="SETTINGS_ENABLE_THIS_DEVICE_PREFERENCE_KEY"
android:title="@string/settings_enable_this_device" />
@ -56,17 +22,14 @@
android:key="SETTINGS_TURN_SCREEN_ON_PREFERENCE_KEY"
android:title="@string/settings_turn_screen_on" />

<im.vector.riotredesign.core.preference.VectorPreference
android:dialogTitle="@string/settings_notification_privacy"
android:key="SETTINGS_NOTIFICATION_PRIVACY_PREFERENCE_KEY"
android:title="@string/settings_notification_privacy" />

<im.vector.riotredesign.core.preference.VectorPreference
android:dependency="SETTINGS_ENABLE_THIS_DEVICE_PREFERENCE_KEY"
android:enabled="false"
android:key="SETTINGS_NOTIFICATION_ADVANCED_PREFERENCE_KEY"
android:persistent="false"
android:summary="@string/settings_notification_advanced_summary"
android:title="@string/settings_notification_advanced"
android:visibility="gone"
app:fragment="im.vector.fragments.VectorSettingsNotificationsAdvancedFragment" />

<im.vector.riotredesign.core.preference.VectorPreference