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: zulip#340
  • Loading branch information
rajveermalviya committed Sep 11, 2024
1 parent c10165c commit c5d12fb
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
Binary file added android/app/src/main/res/raw/chime3.m4a
Binary file not shown.
2 changes: 1 addition & 1 deletion android/app/src/main/res/raw/keep.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
https://github.com/zulip/zulip-flutter/issues/528
-->
<resources xmlns:tools="http://schemas.android.com/tools"
tools:keep="@drawable/zulip_notification"
tools:keep="@drawable/zulip_notification,@raw/chime3"
/>
7 changes: 5 additions & 2 deletions lib/notifications/display.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ AndroidNotificationHostApi get _androidHost => ZulipBinding.instance.androidNoti
/// Service for configuring our Android "notification channel".
class NotificationChannelManager {
@visibleForTesting
static const kChannelId = 'messages-1';
static const kChannelId = 'messages-2';

@visibleForTesting
static const kDefaultSoundResourceName = 'chime3'; // 'Zulip - Chime.m4a'

/// The vibration pattern we set for notifications.
// We try to set a vibration pattern that, with the phone in one's pocket,
Expand Down Expand Up @@ -78,8 +81,8 @@ class NotificationChannelManager {
name: 'Messages', // TODO(i18n)
importance: NotificationImportance.high,
lightsEnabled: true,
soundResourceName: kDefaultSoundResourceName,
vibrationPattern: kVibrationPattern,
// TODO(#340) sound
));
}
}
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 @@ -127,7 +127,7 @@ void main() {
..name.equals('Messages')
..importance.equals(NotificationImportance.high)
..lightsEnabled.equals(true)
..soundResourceName.isNull()
..soundResourceName.equals(NotificationChannelManager.kDefaultSoundResourceName)
..vibrationPattern.isNotNull().deepEquals(
NotificationChannelManager.kVibrationPattern)
;
Expand Down

0 comments on commit c5d12fb

Please sign in to comment.