Skip to content

Commit 16b9f47

Browse files
notif: Use Zulip's notification sound on Android
Updates: #340
1 parent 8ff71a2 commit 16b9f47

File tree

4 files changed

+7
-4
lines changed

4 files changed

+7
-4
lines changed
8.28 KB
Binary file not shown.

android/app/src/main/res/raw/keep.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@
1212
https://github.com/zulip/zulip-flutter/issues/528
1313
-->
1414
<resources xmlns:tools="http://schemas.android.com/tools"
15-
tools:keep="@drawable/zulip_notification"
15+
tools:keep="@drawable/zulip_notification,@raw/chime3"
1616
/>

lib/notifications/display.dart

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ AndroidNotificationHostApi get _androidHost => ZulipBinding.instance.androidNoti
2626
/// Service for configuring our Android "notification channel".
2727
class NotificationChannelManager {
2828
@visibleForTesting
29-
static const kChannelId = 'messages-1';
29+
static const kChannelId = 'messages-2';
30+
31+
@visibleForTesting
32+
static const kDefaultSoundResourceName = 'chime3'; // 'Zulip - Chime.m4a'
3033

3134
/// The vibration pattern we set for notifications.
3235
// We try to set a vibration pattern that, with the phone in one's pocket,
@@ -78,8 +81,8 @@ class NotificationChannelManager {
7881
name: 'Messages', // TODO(i18n)
7982
importance: NotificationImportance.high,
8083
lightsEnabled: true,
84+
soundResourceName: kDefaultSoundResourceName,
8185
vibrationPattern: kVibrationPattern,
82-
// TODO(#340) sound
8386
));
8487
}
8588
}

test/notifications/display_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ void main() {
127127
..name.equals('Messages')
128128
..importance.equals(NotificationImportance.high)
129129
..lightsEnabled.equals(true)
130-
..soundResourceName.isNull()
130+
..soundResourceName.equals(NotificationChannelManager.kDefaultSoundResourceName)
131131
..vibrationPattern.isNotNull().deepEquals(
132132
NotificationChannelManager.kVibrationPattern)
133133
;

0 commit comments

Comments
 (0)