Skip to content

Commit

Permalink
notif: Use Zulip's notification sound on Android
Browse files Browse the repository at this point in the history
Updates: #340
  • Loading branch information
rajveermalviya committed Jun 6, 2024
1 parent 7102382 commit 0ffeefa
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
Binary file added android/app/src/main/res/raw/chime3.m4a
Binary file not shown.
7 changes: 5 additions & 2 deletions lib/notifications/display.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import '../widgets/theme.dart';
/// Service for configuring our Android "notification channel".
class NotificationChannelManager {
@visibleForTesting
static const kChannelId = 'messages-1';
static const kChannelId = 'messages-2';

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

@visibleForTesting
static const kDefaultSound = RawResourceAndroidNotificationSound('chime3');

/// Create our notification channel, if it doesn't already exist.
//
// NOTE when changing anything here: the changes will not take effect
Expand Down Expand Up @@ -83,7 +86,7 @@ class NotificationChannelManager {
importance: Importance.high,
enableLights: true,
vibrationPattern: kVibrationPattern,
// TODO(#340) sound
sound: kDefaultSound,
));
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/notifications/display_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ void main() {
..groupId.isNull()
..importance.equals(Importance.high)
..playSound.isTrue()
..sound.isNull()
..sound.equals(NotificationChannelManager.kDefaultSound)
..enableVibration.isTrue()
..vibrationPattern.isNotNull().deepEquals(
NotificationChannelManager.kVibrationPattern)
Expand Down

0 comments on commit 0ffeefa

Please sign in to comment.