Skip to content
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

Merged
merged 5 commits into from
Dec 21, 2023

Conversation

atomrc
Copy link
Contributor

@atomrc atomrc commented Dec 20, 2023

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

  • PR has been self reviewed by the author;
  • Hard-to-understand areas of the code have been commented;
  • If it is a core feature, unit tests have been added;

@@ -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);
Copy link
Contributor Author

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);
Copy link
Contributor Author

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);
Copy link
Contributor Author

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,
Copy link
Contributor Author

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

Copy link

codecov bot commented Dec 21, 2023

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (59addd3) 45.49% compared to head (81bfdb0) 45.49%.
Report is 2 commits behind head on dev.

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     

Copy link
Contributor

@przemvs przemvs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice change! 🚀

@atomrc atomrc merged commit 188ca68 into dev Dec 21, 2023
8 checks passed
@atomrc atomrc deleted the refactor/no-amplify-audio branch December 21, 2023 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants