-
Notifications
You must be signed in to change notification settings - Fork 291
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: Do not rely on amplify for sound notifications #16408
Conversation
@@ -766,12 +768,12 @@ export class NotificationRepository { | |||
if (shouldPlaySound) { | |||
switch (messageEntity.super_type) { | |||
case SuperType.CONTENT: { | |||
amplify.publish(WebAppEvents.AUDIO.PLAY, AudioType.NEW_MESSAGE); | |||
void this.audioRepository.play(AudioType.NEW_MESSAGE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We now have direct calls to the audio repo (rather than implicit global events)
break; | ||
} | ||
|
||
case SuperType.PING: { | ||
amplify.publish(WebAppEvents.AUDIO.PLAY, AudioType.INCOMING_PING); | ||
void this.audioRepository.play(AudioType.INCOMING_PING); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We now have direct calls to the audio repo (rather than implicit global events)
@@ -240,7 +242,7 @@ export class MessageRepository { | |||
legalHoldStatus: conversation.legalHoldStatus(), | |||
}); | |||
|
|||
amplify.publish(WebAppEvents.AUDIO.PLAY, AudioType.OUTGOING_PING); | |||
void this.audioRepository.play(AudioType.OUTGOING_PING); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We now have direct calls to the audio repo (rather than implicit global events)
repositories.notification = new NotificationRepository( | ||
repositories.conversation, | ||
repositories.permission, | ||
repositories.audio, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not explicit that the notification repo will trigger sound
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## dev #16408 +/- ##
==========================================
- Coverage 45.49% 45.49% -0.01%
==========================================
Files 736 735 -1
Lines 23974 23966 -8
Branches 5453 5449 -4
==========================================
- Hits 10908 10904 -4
+ Misses 11666 11663 -3
+ Partials 1400 1399 -1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice change! 🚀
Description
This removes the implicit and untyped dependency between the
AudioRepository
and other Repositories.This should streamline and make it easier to understand what triggers sound in the app
Checklist