diff --git a/src/main/java/eu/siacs/conversations/entities/Conversation.java b/src/main/java/eu/siacs/conversations/entities/Conversation.java
index 1dcac5624..fa5f89e72 100644
--- a/src/main/java/eu/siacs/conversations/entities/Conversation.java
+++ b/src/main/java/eu/siacs/conversations/entities/Conversation.java
@@ -1111,7 +1111,7 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
}
public long getNotificationThrottlingPeriod() {
- return this.getLongAttribute(ATTRIBUTE_NOTIFICATIONS_THROTTLING_PERIOD, -1);
+ return this.getLongAttribute(ATTRIBUTE_NOTIFICATIONS_THROTTLING_PERIOD, -2);
}
public boolean alwaysNotify() {
diff --git a/src/main/java/eu/siacs/conversations/services/NotificationService.java b/src/main/java/eu/siacs/conversations/services/NotificationService.java
index 9df0c09ad..a30ffa78e 100644
--- a/src/main/java/eu/siacs/conversations/services/NotificationService.java
+++ b/src/main/java/eu/siacs/conversations/services/NotificationService.java
@@ -969,6 +969,10 @@ public class NotificationService {
long throttlingPeriod = c.getNotificationThrottlingPeriod();
+ if (throttlingPeriod < -1) {
+ throttlingPeriod = mXmppConnectionService.getLongPreference("notification_throttling_period", R.integer.default_notification_throttling_period);
+ }
+
if (throttlingPeriod <= 0) {
return false;
}
diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java
index dc97956b6..d426ddecc 100644
--- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java
+++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java
@@ -2517,7 +2517,8 @@ public class ConversationFragment extends XmppFragment
protected void throttleNoisyNoftificationsDialog(final Conversation conversation) {
final AlertDialog.Builder builder = new AlertDialog.Builder(activity);
builder.setTitle(R.string.pref_noisy_notifications_throttling);
- final int[] durations = activity.getResources().getIntArray(R.array.notification_throttling_periods_values);
+ final int[] durations = activity.getResources().getIntArray(R.array.notification_throttling_periods_values_per_conversation);
+
final CharSequence[] labels = new CharSequence[durations.length];
int checkedIndex = -1;
long period = conversation.getNotificationThrottlingPeriod();
@@ -2528,6 +2529,8 @@ public class ConversationFragment extends XmppFragment
if (durations[i] == -1) {
labels[i] = activity.getString(R.string.never);
+ } else if (durations[i] == -2) {
+ labels[i] = activity.getString(R.string.inherit);
} else {
labels[i] = TimeFrameUtils.resolve(activity, durations[i]);
}
diff --git a/src/main/res/values/arrays.xml b/src/main/res/values/arrays.xml
index b09030556..3ddf86d9c 100644
--- a/src/main/res/values/arrays.xml
+++ b/src/main/res/values/arrays.xml
@@ -26,7 +26,22 @@
- -1
-
+
+ - -1
+ - 5000
+ - 15000
+ - 30000
+ - 60000
+ - 120000
+ - 180000
+ - 300000
+ - 600000
+ - 900000
+ - 1800000
+
+
+
+ - -2
- -1
- 5000
- 15000
@@ -40,6 +55,20 @@
- 1800000
+
+ - @string/never
+ - 5 sec
+ - 15 sec
+ - 30 sec
+ - 1 min
+ - 2 min
+ - 3 min
+ - 5 min
+ - 10 min
+ - 15 min
+ - 30 min
+
+
- @string/none
- @string/recently_used
diff --git a/src/main/res/values/defaults.xml b/src/main/res/values/defaults.xml
index 52f74aaf2..322f21f8a 100644
--- a/src/main/res/values/defaults.xml
+++ b/src/main/res/values/defaults.xml
@@ -16,7 +16,7 @@
content://settings/system/notification_sound
content://settings/system/ringtone
144
- 0
+ -1
524288
auto
true
diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml
index 3b943362f..804e6a697 100644
--- a/src/main/res/values/strings.xml
+++ b/src/main/res/values/strings.xml
@@ -418,6 +418,7 @@
Modified group chat options!
Could not modify group chat options
Never
+ Inherit
Until further notice
Snooze
Reply
diff --git a/src/main/res/xml/preferences.xml b/src/main/res/xml/preferences.xml
index fcf2fbb0c..8570cd1d7 100644
--- a/src/main/res/xml/preferences.xml
+++ b/src/main/res/xml/preferences.xml
@@ -79,6 +79,13 @@
android:key="grace_period_length"
android:summary="@string/pref_notification_grace_period_summary"
android:title="@string/pref_notification_grace_period" />
+