This commit is contained in:
Benoit Marty 2020-02-28 19:13:22 +01:00
parent 957b9eee23
commit c20de4feb0
3 changed files with 22 additions and 33 deletions

View file

@ -35,7 +35,6 @@ import javax.inject.Inject
class VectorPreferences @Inject constructor(private val context: Context) { class VectorPreferences @Inject constructor(private val context: Context) {
companion object { companion object {
const val SETTINGS_MESSAGES_SENT_BY_BOT_PREFERENCE_KEY = "SETTINGS_MESSAGES_SENT_BY_BOT_PREFERENCE_KEY"
const val SETTINGS_CHANGE_PASSWORD_PREFERENCE_KEY = "SETTINGS_CHANGE_PASSWORD_PREFERENCE_KEY" const val SETTINGS_CHANGE_PASSWORD_PREFERENCE_KEY = "SETTINGS_CHANGE_PASSWORD_PREFERENCE_KEY"
const val SETTINGS_VERSION_PREFERENCE_KEY = "SETTINGS_VERSION_PREFERENCE_KEY" const val SETTINGS_VERSION_PREFERENCE_KEY = "SETTINGS_VERSION_PREFERENCE_KEY"
const val SETTINGS_SDK_VERSION_PREFERENCE_KEY = "SETTINGS_SDK_VERSION_PREFERENCE_KEY" const val SETTINGS_SDK_VERSION_PREFERENCE_KEY = "SETTINGS_SDK_VERSION_PREFERENCE_KEY"
@ -114,16 +113,6 @@ class VectorPreferences @Inject constructor(private val context: Context) {
const val SETTINGS_SYSTEM_SILENT_NOTIFICATION_PREFERENCE_KEY = "SETTINGS_SYSTEM_SILENT_NOTIFICATION_PREFERENCE_KEY" const val SETTINGS_SYSTEM_SILENT_NOTIFICATION_PREFERENCE_KEY = "SETTINGS_SYSTEM_SILENT_NOTIFICATION_PREFERENCE_KEY"
const val SETTINGS_NOTIFICATION_RINGTONE_PREFERENCE_KEY = "SETTINGS_NOTIFICATION_RINGTONE_PREFERENCE_KEY" const val SETTINGS_NOTIFICATION_RINGTONE_PREFERENCE_KEY = "SETTINGS_NOTIFICATION_RINGTONE_PREFERENCE_KEY"
const val SETTINGS_NOTIFICATION_RINGTONE_SELECTION_PREFERENCE_KEY = "SETTINGS_NOTIFICATION_RINGTONE_SELECTION_PREFERENCE_KEY" const val SETTINGS_NOTIFICATION_RINGTONE_SELECTION_PREFERENCE_KEY = "SETTINGS_NOTIFICATION_RINGTONE_SELECTION_PREFERENCE_KEY"
const val SETTINGS_CONTAINING_MY_DISPLAY_NAME_PREFERENCE_KEY = "SETTINGS_CONTAINING_MY_DISPLAY_NAME_PREFERENCE_KEY"
const val SETTINGS_CONTAINING_MY_USER_NAME_PREFERENCE_KEY = "SETTINGS_CONTAINING_MY_USER_NAME_PREFERENCE_KEY"
const val SETTINGS_MESSAGES_IN_ONE_TO_ONE_PREFERENCE_KEY = "SETTINGS_MESSAGES_IN_ONE_TO_ONE_PREFERENCE_KEY"
const val SETTINGS_MESSAGES_IN_GROUP_CHAT_PREFERENCE_KEY = "SETTINGS_MESSAGES_IN_GROUP_CHAT_PREFERENCE_KEY"
const val SETTINGS_INVITED_TO_ROOM_PREFERENCE_KEY = "SETTINGS_INVITED_TO_ROOM_PREFERENCE_KEY"
const val SETTINGS_CALL_INVITATIONS_PREFERENCE_KEY = "SETTINGS_CALL_INVITATIONS_PREFERENCE_KEY"
const val SETTINGS_MESSAGES_CONTAINING_AT_ROOM_PREFERENCE_KEY = "SETTINGS_MESSAGES_CONTAINING_AT_ROOM_PREFERENCE_KEY"
const val SETTINGS_MESSAGES_IN_E2E_ONE_ONE_CHAT_PREFERENCE_KEY = "SETTINGS_MESSAGES_IN_E2E_ONE_ONE_CHAT_PREFERENCE_KEY"
const val SETTINGS_MESSAGES_IN_E2E_GROUP_CHAT_PREFERENCE_KEY = "SETTINGS_MESSAGES_IN_E2E_GROUP_CHAT_PREFERENCE_KEY"
const val SETTINGS_ROOMS_UPGRADED_KEY = "SETTINGS_ROOMS_UPGRADED_KEY"
// media // media
private const val SETTINGS_DEFAULT_MEDIA_COMPRESSION_KEY = "SETTINGS_DEFAULT_MEDIA_COMPRESSION_KEY" private const val SETTINGS_DEFAULT_MEDIA_COMPRESSION_KEY = "SETTINGS_DEFAULT_MEDIA_COMPRESSION_KEY"

View file

@ -170,17 +170,17 @@ class VectorSettingsAdvancedNotificationPreferenceFragment @Inject constructor(
// preference name <-> rule Id // preference name <-> rule Id
private val prefKeyToPushRuleId = mapOf( private val prefKeyToPushRuleId = mapOf(
VectorPreferences.SETTINGS_CONTAINING_MY_DISPLAY_NAME_PREFERENCE_KEY to PushRule.RULE_ID_CONTAIN_DISPLAY_NAME, "SETTINGS_PUSH_RULE_CONTAINING_MY_DISPLAY_NAME_PREFERENCE_KEY" to PushRule.RULE_ID_CONTAIN_DISPLAY_NAME,
VectorPreferences.SETTINGS_CONTAINING_MY_USER_NAME_PREFERENCE_KEY to PushRule.RULE_ID_CONTAIN_USER_NAME, "SETTINGS_PUSH_RULE_CONTAINING_MY_USER_NAME_PREFERENCE_KEY" to PushRule.RULE_ID_CONTAIN_USER_NAME,
VectorPreferences.SETTINGS_MESSAGES_IN_ONE_TO_ONE_PREFERENCE_KEY to PushRule.RULE_ID_ONE_TO_ONE_ROOM, "SETTINGS_PUSH_RULE_MESSAGES_IN_ONE_TO_ONE_PREFERENCE_KEY" to PushRule.RULE_ID_ONE_TO_ONE_ROOM,
VectorPreferences.SETTINGS_MESSAGES_IN_GROUP_CHAT_PREFERENCE_KEY to PushRule.RULE_ID_ALL_OTHER_MESSAGES_ROOMS, "SETTINGS_PUSH_RULE_MESSAGES_IN_GROUP_CHAT_PREFERENCE_KEY" to PushRule.RULE_ID_ALL_OTHER_MESSAGES_ROOMS,
VectorPreferences.SETTINGS_INVITED_TO_ROOM_PREFERENCE_KEY to PushRule.RULE_ID_INVITE_ME, "SETTINGS_PUSH_RULE_INVITED_TO_ROOM_PREFERENCE_KEY" to PushRule.RULE_ID_INVITE_ME,
VectorPreferences.SETTINGS_CALL_INVITATIONS_PREFERENCE_KEY to PushRule.RULE_ID_CALL, "SETTINGS_PUSH_RULE_CALL_INVITATIONS_PREFERENCE_KEY" to PushRule.RULE_ID_CALL,
VectorPreferences.SETTINGS_MESSAGES_SENT_BY_BOT_PREFERENCE_KEY to PushRule.RULE_ID_SUPPRESS_BOTS_NOTIFICATIONS, "SETTINGS_PUSH_RULE_MESSAGES_SENT_BY_BOT_PREFERENCE_KEY" to PushRule.RULE_ID_SUPPRESS_BOTS_NOTIFICATIONS,
VectorPreferences.SETTINGS_MESSAGES_CONTAINING_AT_ROOM_PREFERENCE_KEY to PushRule.RULE_ID_AT_ROOMS, "SETTINGS_PUSH_RULE_MESSAGES_CONTAINING_AT_ROOM_PREFERENCE_KEY" to PushRule.RULE_ID_AT_ROOMS,
VectorPreferences.SETTINGS_MESSAGES_IN_E2E_ONE_ONE_CHAT_PREFERENCE_KEY to PushRule.RULE_ID_E2E_ONE_TO_ONE_ROOM, "SETTINGS_PUSH_RULE_MESSAGES_IN_E2E_ONE_ONE_CHAT_PREFERENCE_KEY" to PushRule.RULE_ID_E2E_ONE_TO_ONE_ROOM,
VectorPreferences.SETTINGS_MESSAGES_IN_E2E_GROUP_CHAT_PREFERENCE_KEY to PushRule.RULE_ID_E2E_GROUP, "SETTINGS_PUSH_RULE_MESSAGES_IN_E2E_GROUP_CHAT_PREFERENCE_KEY" to PushRule.RULE_ID_E2E_GROUP,
VectorPreferences.SETTINGS_ROOMS_UPGRADED_KEY to PushRule.RULE_ID_TOMBSTONE "SETTINGS_PUSH_RULE_ROOMS_UPGRADED_KEY" to PushRule.RULE_ID_TOMBSTONE
) )
} }
} }

View file

@ -6,59 +6,59 @@
android:title="@string/settings_notification_by_event"> android:title="@string/settings_notification_by_event">
<im.vector.riotx.core.preference.BingRulePreference <im.vector.riotx.core.preference.BingRulePreference
android:key="SETTINGS_CONTAINING_MY_DISPLAY_NAME_PREFERENCE_KEY" android:key="SETTINGS_PUSH_RULE_CONTAINING_MY_DISPLAY_NAME_PREFERENCE_KEY"
android:persistent="false" android:persistent="false"
android:title="@string/settings_containing_my_display_name" /> android:title="@string/settings_containing_my_display_name" />
<im.vector.riotx.core.preference.BingRulePreference <im.vector.riotx.core.preference.BingRulePreference
android:key="SETTINGS_CONTAINING_MY_USER_NAME_PREFERENCE_KEY" android:key="SETTINGS_PUSH_RULE_CONTAINING_MY_USER_NAME_PREFERENCE_KEY"
android:persistent="false" android:persistent="false"
android:title="@string/settings_containing_my_user_name" /> android:title="@string/settings_containing_my_user_name" />
<im.vector.riotx.core.preference.BingRulePreference <im.vector.riotx.core.preference.BingRulePreference
android:key="SETTINGS_MESSAGES_CONTAINING_AT_ROOM_PREFERENCE_KEY" android:key="SETTINGS_PUSH_RULE_MESSAGES_CONTAINING_AT_ROOM_PREFERENCE_KEY"
android:persistent="false" android:persistent="false"
android:title="@string/settings_messages_at_room" /> android:title="@string/settings_messages_at_room" />
<!-- TODO Support message with keywords rule --> <!-- TODO Support message with keywords rule -->
<im.vector.riotx.core.preference.BingRulePreference <im.vector.riotx.core.preference.BingRulePreference
android:key="SETTINGS_MESSAGES_IN_ONE_TO_ONE_PREFERENCE_KEY" android:key="SETTINGS_PUSH_RULE_MESSAGES_IN_ONE_TO_ONE_PREFERENCE_KEY"
android:persistent="false" android:persistent="false"
android:title="@string/settings_messages_in_one_to_one" /> android:title="@string/settings_messages_in_one_to_one" />
<im.vector.riotx.core.preference.BingRulePreference <im.vector.riotx.core.preference.BingRulePreference
android:key="SETTINGS_MESSAGES_IN_E2E_ONE_ONE_CHAT_PREFERENCE_KEY" android:key="SETTINGS_PUSH_RULE_MESSAGES_IN_E2E_ONE_ONE_CHAT_PREFERENCE_KEY"
android:persistent="false" android:persistent="false"
android:title="@string/settings_messages_in_e2e_one_to_one" /> android:title="@string/settings_messages_in_e2e_one_to_one" />
<im.vector.riotx.core.preference.BingRulePreference <im.vector.riotx.core.preference.BingRulePreference
android:key="SETTINGS_MESSAGES_IN_GROUP_CHAT_PREFERENCE_KEY" android:key="SETTINGS_PUSH_RULE_MESSAGES_IN_GROUP_CHAT_PREFERENCE_KEY"
android:persistent="false" android:persistent="false"
android:title="@string/settings_messages_in_group_chat" /> android:title="@string/settings_messages_in_group_chat" />
<im.vector.riotx.core.preference.BingRulePreference <im.vector.riotx.core.preference.BingRulePreference
android:key="SETTINGS_MESSAGES_IN_E2E_GROUP_CHAT_PREFERENCE_KEY" android:key="SETTINGS_PUSH_RULE_MESSAGES_IN_E2E_GROUP_CHAT_PREFERENCE_KEY"
android:persistent="false" android:persistent="false"
android:title="@string/settings_messages_in_e2e_group_chat" /> android:title="@string/settings_messages_in_e2e_group_chat" />
<im.vector.riotx.core.preference.BingRulePreference <im.vector.riotx.core.preference.BingRulePreference
android:key="SETTINGS_INVITED_TO_ROOM_PREFERENCE_KEY" android:key="SETTINGS_PUSH_RULE_INVITED_TO_ROOM_PREFERENCE_KEY"
android:persistent="false" android:persistent="false"
android:title="@string/settings_invited_to_room" /> android:title="@string/settings_invited_to_room" />
<im.vector.riotx.core.preference.BingRulePreference <im.vector.riotx.core.preference.BingRulePreference
android:key="SETTINGS_CALL_INVITATIONS_PREFERENCE_KEY" android:key="SETTINGS_PUSH_RULE_CALL_INVITATIONS_PREFERENCE_KEY"
android:persistent="false" android:persistent="false"
android:title="@string/settings_call_invitations" /> android:title="@string/settings_call_invitations" />
<im.vector.riotx.core.preference.BingRulePreference <im.vector.riotx.core.preference.BingRulePreference
android:key="SETTINGS_MESSAGES_SENT_BY_BOT_PREFERENCE_KEY" android:key="SETTINGS_PUSH_RULE_MESSAGES_SENT_BY_BOT_PREFERENCE_KEY"
android:persistent="false" android:persistent="false"
android:title="@string/settings_messages_sent_by_bot" /> android:title="@string/settings_messages_sent_by_bot" />
<im.vector.riotx.core.preference.BingRulePreference <im.vector.riotx.core.preference.BingRulePreference
android:key="SETTINGS_ROOMS_UPGRADED_KEY" android:key="SETTINGS_PUSH_RULE_ROOMS_UPGRADED_KEY"
android:persistent="false" android:persistent="false"
android:title="@string/settings_when_rooms_are_upgraded" /> android:title="@string/settings_when_rooms_are_upgraded" />