Skip to content

Commit c82baa1

Browse files
notif: Use Zulip's notification sound on Android
Updates: #340
1 parent 2696bc1 commit c82baa1

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

+1-1
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

+5-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ AndroidNotificationHostApi get _androidHost => ZulipBinding.instance.androidNoti
2525
/// Service for configuring our Android "notification channel".
2626
class NotificationChannelManager {
2727
@visibleForTesting
28-
static const kChannelId = 'messages-1';
28+
static const kChannelId = 'messages-2';
29+
30+
@visibleForTesting
31+
static const kDefaultSoundResourceName = 'chime3'; // 'Zulip - Chime.m4a'
2932

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

test/notifications/display_test.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ void main() {
126126
..name.equals('Messages')
127127
..importance.equals(NotificationImportance.high)
128128
..lightsEnabled.equals(true)
129-
..soundResourceName.isNull()
129+
..soundResourceName.equals(NotificationChannelManager.kDefaultSoundResourceName)
130130
..vibrationPattern.isNotNull().deepEquals(
131131
NotificationChannelManager.kVibrationPattern)
132132
;

0 commit comments

Comments
 (0)