Skip to content

Commit 0ffeefa

Browse files
notif: Use Zulip's notification sound on Android
Updates: #340
1 parent 7102382 commit 0ffeefa

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed
8.28 KB
Binary file not shown.

lib/notifications/display.dart

+5-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import '../widgets/theme.dart';
2121
/// Service for configuring our Android "notification channel".
2222
class NotificationChannelManager {
2323
@visibleForTesting
24-
static const kChannelId = 'messages-1';
24+
static const kChannelId = 'messages-2';
2525

2626
/// The vibration pattern we set for notifications.
2727
// We try to set a vibration pattern that, with the phone in one's pocket,
@@ -30,6 +30,9 @@ class NotificationChannelManager {
3030
@visibleForTesting
3131
static final kVibrationPattern = Int64List.fromList([0, 125, 100, 450]);
3232

33+
@visibleForTesting
34+
static const kDefaultSound = RawResourceAndroidNotificationSound('chime3');
35+
3336
/// Create our notification channel, if it doesn't already exist.
3437
//
3538
// NOTE when changing anything here: the changes will not take effect
@@ -83,7 +86,7 @@ class NotificationChannelManager {
8386
importance: Importance.high,
8487
enableLights: true,
8588
vibrationPattern: kVibrationPattern,
86-
// TODO(#340) sound
89+
sound: kDefaultSound,
8790
));
8891
}
8992
}

test/notifications/display_test.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ void main() {
9494
..groupId.isNull()
9595
..importance.equals(Importance.high)
9696
..playSound.isTrue()
97-
..sound.isNull()
97+
..sound.equals(NotificationChannelManager.kDefaultSound)
9898
..enableVibration.isTrue()
9999
..vibrationPattern.isNotNull().deepEquals(
100100
NotificationChannelManager.kVibrationPattern)

0 commit comments

Comments
 (0)