removed global notifications switch

This commit is contained in:
Daniel Gultsch 2018-09-06 16:56:31 +02:00
parent d86f4ce3a6
commit 39b86de698
4 changed files with 5 additions and 26 deletions

View File

@ -158,17 +158,12 @@ public class NotificationService {
public boolean notify(final Message message) {
final Conversation conversation = (Conversation) message.getConversation();
return message.getStatus() == Message.STATUS_RECEIVED
&& notificationsEnabled()
&& !conversation.isMuted()
&& (conversation.alwaysNotify() || wasHighlightedOrPrivate(message))
&& (!conversation.isWithStranger() || notificationsFromStrangers())
;
}
private boolean notificationsEnabled() {
return mXmppConnectionService.getBooleanPreference("show_notification", R.bool.show_notification);
}
private boolean notificationsFromStrangers() {
return mXmppConnectionService.getBooleanPreference("notifications_from_strangers", R.bool.notifications_from_strangers);
}

View File

@ -10,7 +10,6 @@
<bool name="confirm_messages">true</bool>
<bool name="chat_states">true</bool>
<bool name="last_activity">false</bool>
<bool name="show_notification">true</bool>
<bool name="vibrate_on_notification">true</bool>
<bool name="led">true</bool>
<bool name="enable_quiet_hours">false</bool>

View File

@ -108,8 +108,6 @@
<string name="pref_return_to_previous">Quick Sharing</string>
<string name="pref_return_to_previous_summary">Immediately return to previous activity instead of opening the conversation after sharing something</string>
<string name="pref_notification_settings">Notification</string>
<string name="pref_notifications">Notifications</string>
<string name="pref_notifications_summary">Notify when a new message arrives</string>
<string name="pref_vibrate">Vibrate</string>
<string name="pref_vibrate_summary">Vibrate when a new message arrives</string>
<string name="pref_led">LED Notification</string>

View File

@ -43,20 +43,8 @@
<PreferenceCategory
android:title="@string/pref_notification_settings"
android:key="notification_category">
<CheckBoxPreference
android:defaultValue="@bool/show_notification"
android:key="show_notification"
android:summary="@string/pref_notifications_summary"
android:title="@string/pref_notifications" />
<CheckBoxPreference
android:defaultValue="@bool/notifications_from_strangers"
android:dependency="show_notification"
android:key="notifications_from_strangers"
android:summary="@string/pref_notifications_from_strangers_summary"
android:title="@string/pref_notifications_from_strangers" />
<PreferenceScreen
android:key="more_notification_settings"
android:dependency="show_notification"
android:summary="@string/pref_more_notification_settings_summary"
android:title="@string/pref_more_notification_settings">
<intent android:action="android.settings.CHANNEL_NOTIFICATION_SETTINGS">
@ -68,33 +56,33 @@
android:value="messages" />
</intent>
</PreferenceScreen>
<CheckBoxPreference
android:defaultValue="@bool/notifications_from_strangers"
android:key="notifications_from_strangers"
android:summary="@string/pref_notifications_from_strangers_summary"
android:title="@string/pref_notifications_from_strangers" />
<CheckBoxPreference
android:defaultValue="@bool/headsup_notifications"
android:dependency="show_notification"
android:key="notification_headsup"
android:summary="@string/pref_headsup_notifications_summary"
android:title="@string/pref_headsup_notifications" />
<CheckBoxPreference
android:defaultValue="@bool/vibrate_on_notification"
android:dependency="show_notification"
android:key="vibrate_on_notification"
android:summary="@string/pref_vibrate_summary"
android:title="@string/pref_vibrate" />
<CheckBoxPreference
android:defaultValue="@bool/led"
android:dependency="show_notification"
android:key="led"
android:summary="@string/pref_led_summary"
android:title="@string/pref_led" />
<RingtonePreference
android:defaultValue="@string/notification_ringtone"
android:dependency="show_notification"
android:key="notification_ringtone"
android:ringtoneType="notification"
android:summary="@string/pref_sound_summary"
android:title="@string/pref_sound" />
<PreferenceScreen
android:dependency="show_notification"
android:key="quiet_hours"
android:summary="@string/pref_quiet_hours_summary"
android:title="@string/title_pref_quiet_hours">
@ -126,7 +114,6 @@
</PreferenceScreen>
<ListPreference
android:defaultValue="@integer/grace_period"
android:dependency="show_notification"
android:entries="@array/grace_periods"
android:entryValues="@array/grace_periods_values"
android:key="grace_period_length"