Expensify / App

Welcome to New Expensify: a complete re-imagination of financial collaboration, centered around chat. Help us build the next generation of Expensify by sharing feedback and contributing to the code.
https://new.expensify.com
MIT License
3.03k stars 2.54k forks source link

feat: app sounds #31055

Closed lauridskern closed 3 months ago

lauridskern commented 6 months ago

Details

This PR implements sounds playing when message gets received (only when app is in foreground, i. e. not sounds for push notifications).

To play a sound I used react-native-sound ( and react-native-web-sound for web, underhood it uses howler.js). Initially I wanted to use expo-sound but was getting ridiculous errors and couldn't resolve them (on iOS and web).

Fixed Issues

$ https://github.com/Expensify/App/issues/29835 PROPOSAL: N/A

Tests

  1. Open app on two devices
  2. Send message from one device to another
    • Done sound -> when user sends a message/emoji/attachment/assigning task/sends money/request money (i. e. if user sends any content to another user we play done sound);
    • Success sound -> when someone completes task/someone completes money request/someone sends money to you (regardless of who marks the task as done, i. e. sender or receiver);
    • Attention sound -> someone mentioned you/someone request money from you/someone assigns a task to you (@here also should produce the sound);
    • Received sound -> when message (excluding success/attention cases from above) received
  3. go to setting and mute all sounds
  4. verify step 2 but be sure there is no audio actually played
  5. unmute sounds in app setting
  6. go to a particular channel -> open settings of this channel -> open "Notify me about new messages" -> set it to "Mute"
  7. verify step 2 but be sure there is no audio actually played (excluding "done" case - "done" sound should be played in any case).
  8. set "Daily" mode and repeat step 2 - be sure that all sounds are playable
  9. set "Immediately" mode and repeat step 2 - be sure that all sounds are playable
  10. mute sound in app settings and for channel - be sure that step 2 will not play any sound at all

Offline tests

QA Steps

  1. Open app on two devices
  2. Send message from one device to another
    • Done sound -> when user sends a message/emoji/attachment/assigning task/sends money/request money (i. e. if user sends any content to another user we play done sound);
    • Success sound -> when someone completes task/someone completes money request/someone sends money to you (regardless of who marks the task as done, i. e. sender or receiver);
    • Attention sound -> someone mentioned you/someone request money from you/someone assigns a task to you (@here also should produce the sound);
    • Received sound -> when message (excluding success/attention cases from above) received
  3. go to setting and mute all sounds
  4. verify step 2 but be sure there is no audio actually played

PR Author Checklist

Screenshots/Videos

Android: Native https://github.com/Expensify/App/assets/22820318/ee35fde4-056c-458b-8d75-32b30580dd44
Android: mWeb Chrome
iOS: Native https://github.com/Expensify/App/assets/22820318/e328f648-697c-4c29-a552-eb462d9d988f
iOS: mWeb Safari
MacOS: Chrome / Safari https://github.com/Expensify/App/assets/22820318/a8ebbe88-deab-4134-a107-573b269faf3c
MacOS: Desktop https://github.com/Expensify/App/assets/22820318/3c3072d0-98dc-4afd-8401-40fb7fd86c97
github-actions[bot] commented 4 months ago
:test_tube::test_tube: Use the links below to test this adhoc build on Android, iOS, Desktop, and Web. Happy testing! :test_tube::test_tube: Android :robot: iOS :apple:
https://ad-hoc-expensify-cash.s3.amazonaws.com/android/31055/index.html ❌ FAILED ❌
Android The QR code can't be generated, because the iOS build failed
Desktop :computer: Web :spider_web:
https://ad-hoc-expensify-cash.s3.amazonaws.com/desktop/31055/NewExpensify.dmg https://31055.pr-testing.expensify.com
Desktop Web

:eyes: View the workflow run that generated this build :eyes:

shawnborton commented 4 months ago

But wow yeah, web loads so fast that you can't even notice anything but a quick flash of green.

aimane-chnaif commented 4 months ago

still issue

glitch

https://github.com/Expensify/App/assets/96077027/65bad25b-db39-4976-9a95-47369aabacfb

Julesssss commented 4 months ago

If I already had an app running in the background and I switch to it, I don't expect to see any kind of boot/loading animation.

I still think a big % of users are unaware of the difference other than apps sometimes taking longer to load.

Without the audio, I think that most people would notice the difference. It's very noticeable. But let's save that discussion for later. My wider issue is with the audio and delay

hannojg commented 4 months ago
  1. Re audio: Given that the audio will be interrupted (as the app usually loads faster than the duration of the video), i'd also vote for having none audio versions (but maybe we need to bring that discussion up on slack again?)
  2. Re delay: Right now there is a delay of 300ms, I could remove that all together, then users with powerful devices are probably only going to see it rarely. or we all vote that we want the "netflix" or "prime" experience where we force show the animation. I'd personally opt against that, because you will open the expensify app many times a day, often just to quickly react to a message and waiting for the splash to finish (or run for a bit at least) would be imo a degradation in UX

still issue

Thank you @aimane-chnaif for testing! The workaround was for the bug where there was a cutout in the splash screen where you could see the content through. That seems to be fixed now! In your case i think its that the video takes a tad longer loading (which could be optimized once we switch format). Also in your video we can see that while we already fade out the splash screen the video starts to play, which looks odd. I guess if the video hasn't started while we are already fading the splash screen out we just shouldn't show the video anymore. Will add a fix for that soon.


So, as a list of outstanding items i see:

shawnborton commented 4 months ago

Re: Keep audio or not, we do want to keep all four versions with audio, because the whole point of this test was to help us decide on the final brand mnemonic.

Let me know when you get through with the other items - I'd love to get this to a point where we can generate the QR codes and have people test this on their own devices. Again, I think they will come to the same conclusion that I have in that the start up sound is just not working and we should ditch the idea.

It would also be nice for that same crowd of testers to test the other UI sound effects we chatted about in Slack, too.

hannojg commented 4 months ago

@shawnborton should we add the sound effects to this PR, or should it be separate? (I'd say it should be separate? But it could be based off this pr)

shawnborton commented 4 months ago

I think for testing purposes, ideally we’d be able to test both the opening animation PLUS ui sounds from the same build. This way we don’t need to ask people to download multiple different test apps. Let me know if you’re okay with that though!

On Fri, Jan 12, 2024 at 8:14 AM Hanno J. Gödecke @.***> wrote:

@shawnborton https://github.com/shawnborton should we add the sound effects to this PR, or should it be separate? (I'd say it should be separate? But it could be based off this pr)

— Reply to this email directly, view it on GitHub https://github.com/Expensify/App/pull/31055#issuecomment-1888547847, or unsubscribe https://github.com/notifications/unsubscribe-auth/AARWH5Q6LBUBZG3R5QJ5XU3YODPGFAVCNFSM6AAAAAA7CT3U4GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOBYGU2DOOBUG4 . You are receiving this because you were mentioned.Message ID: @.***>

shawnborton commented 4 months ago

How is this one moving along?

kirillzyusko commented 4 months ago

I have read the CLA Document and I hereby sign the CLA

kirillzyusko commented 4 months ago

recheck

github-actions[bot] commented 4 months ago
:test_tube::test_tube: Use the links below to test this adhoc build on Android, iOS, Desktop, and Web. Happy testing! :test_tube::test_tube: Android :robot: iOS :apple:
https://ad-hoc-expensify-cash.s3.amazonaws.com/android/31055/index.html https://ad-hoc-expensify-cash.s3.amazonaws.com/ios/31055/index.html
Android iOS
Desktop :computer: Web :spider_web:
❌ FAILED ❌ https://31055.pr-testing.expensify.com
The QR code can't be generated, because the Desktop build failed Web

:eyes: View the workflow run that generated this build :eyes:

shawnborton commented 4 months ago

cc @Expensify/design in case you wanna test out our sound effects! Still some more work to be done before we distribute this one for more testing, see this thread for more context

dubielzyk-expensify commented 4 months ago

Awesome! I tested it on Android and added feedback in that thread 👍

dannymcclain commented 4 months ago

I can't seem to get the ad hoc iOS app installed. I get the error message This app cannot be installed because its integrity could not be verified. But on web I am looooooving the "send" sound. Can't wait for more!

aimane-chnaif commented 4 months ago

I can't seem to get the ad hoc iOS app installed. I get the error message This app cannot be installed because its integrity could not be verified. But on web I am looooooving the "send" sound. Can't wait for more!

Because your iPhone udid isn't registered. If you wanna test on iPhone, please ask in slack to get your iPhone registered for adhoc build.

github-actions[bot] commented 4 months ago
:test_tube::test_tube: Use the links below to test this adhoc build on Android, iOS, Desktop, and Web. Happy testing! :test_tube::test_tube: Android :robot: iOS :apple:
https://ad-hoc-expensify-cash.s3.amazonaws.com/android/31055/index.html ❌ FAILED ❌
Android The QR code can't be generated, because the iOS build failed
Desktop :computer: Web :spider_web:
❌ FAILED ❌ https://31055.pr-testing.expensify.com
The QR code can't be generated, because the Desktop build failed Web

:eyes: View the workflow run that generated this build :eyes:

shawnborton commented 4 months ago

Hmm iOS and Desktop failed, any ideas why? I'll try to trigger a new build though and see if that fixes anything.

github-actions[bot] commented 4 months ago
:test_tube::test_tube: Use the links below to test this adhoc build on Android, iOS, Desktop, and Web. Happy testing! :test_tube::test_tube: Android :robot: iOS :apple:
https://ad-hoc-expensify-cash.s3.amazonaws.com/android/31055/index.html ❌ FAILED ❌
Android The QR code can't be generated, because the iOS build failed
Desktop :computer: Web :spider_web:
❌ FAILED ❌ https://31055.pr-testing.expensify.com
The QR code can't be generated, because the Desktop build failed Web

:eyes: View the workflow run that generated this build :eyes:

kirillzyusko commented 4 months ago

Hmm iOS and Desktop failed, any ideas why? I'll try to trigger a new build though and see if that fixes anything.

@shawnborton very strange, I didn't modify any XCode-related things since last successful build (but iOS build fails because of ObjC code compilation issues). I'll have a look tomorrow why it's failing 👀

In a meantime - would it be possible to test Android and web? (because most likely bugs will be identical across all platforms).

shawnborton commented 4 months ago

Maybe we just need a fresh pull of main?

On Mon, Jan 22, 2024 at 11:06 PM Kirill Zyusko @.***> wrote:

Hmm iOS and Desktop failed, any ideas why? I'll try to trigger a new build though and see if that fixes anything.

@shawnborton https://github.com/shawnborton very strange, I didn't modify any XCode-related things since last successful build (but iOS build fails because of ObjC code compilation issues). I'll have a look tomorrow why it's failing 👀

In a meantime - would it be possible to test Android and web? (because most likely bugs will be identical across all platforms).

— Reply to this email directly, view it on GitHub https://github.com/Expensify/App/pull/31055#issuecomment-1904907937, or unsubscribe https://github.com/notifications/unsubscribe-auth/AARWH5WQKYIQDRVSFUX3NBLYP3PHTAVCNFSM6AAAAAA7CT3U4GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMBUHEYDOOJTG4 . You are receiving this because you were mentioned.Message ID: @.***>

shawnborton commented 4 months ago

@kirillzyusko @hannojg on web, I am still getting two simultaneous sounds when I receive a message:

Is it possible to not have both of these sounds play at the same time? Not sure what our options are there, but it definitely does not feel right.

hannojg commented 4 months ago

The desktop build seemed to fail because of a timeout - should work next time we create a build I assume.

The iOS build seemed to fail due to the new library we introduced. Are we able to reproduce this build error when building for release mode @kirillzyusko ? CleanShot 2024-01-23 at 08 43 04

For the push notification, it should be possible to send a silent notification. We tried to make that happen from the code, but this might need to happen server side. Will figure it out with expensify crew on slack!

shawnborton commented 4 months ago

Sounds good, thanks for digging in!

github-actions[bot] commented 4 months ago
:test_tube::test_tube: Use the links below to test this adhoc build on Android, iOS, Desktop, and Web. Happy testing! :test_tube::test_tube: Android :robot: iOS :apple:
https://ad-hoc-expensify-cash.s3.amazonaws.com/android/31055/index.html https://ad-hoc-expensify-cash.s3.amazonaws.com/ios/31055/index.html
Android iOS
Desktop :computer: Web :spider_web:
https://ad-hoc-expensify-cash.s3.amazonaws.com/desktop/31055/NewExpensify.dmg https://31055.pr-testing.expensify.com
Desktop Web

:eyes: View the workflow run that generated this build :eyes:

shawnborton commented 4 months ago

One thing I noticed is that when the task creator marks a task as done, the Success sound didn't play.

On that note, can you actually out in simple plain english all of the cases where sounds do play? This way we can evaluate if we want to make any adjustments or changes to the various scenarios.

kirillzyusko commented 4 months ago

Sure @shawnborton

I added sounds in next cases:

when the task creator marks a task as done, the Success sound didn't play

This is because we receive a different data shape and I thought it's not the case "when someone completes task", because I thought that "someone" in this context means "not you". I hope it makes sense what I'm saying 😅

shawnborton commented 4 months ago

I hope it makes sense what I'm saying 😅

Makes sense but I kind of think we'd just play Success regardless of who marks the task as done.

shawnborton commented 4 months ago

Another small one - using @here should do the same sound as a mention

shawnborton commented 4 months ago

Hmm it looks like if I am viewing a task (basically a thread) and someone sends me a message, I don't get the message received sound. Can you make sure the message received sound is playing for all room types? DMs, #rooms, workspace chats, reports, expenses, threads, tasks, etc - this should all work the same I would think.

kirillzyusko commented 4 months ago

Okay @shawnborton I'll fix it tomorrow. Just to sum it up:

Thank you for your testing. I'll try to fix all these issues tomorrow 👀

shawnborton commented 4 months ago

whenever task gets completed we should play a sound (regardless of who marks the task as done)

Correct, whenever task is completed, let's do Success sound

using @here should also play sound (maybe you has also pre-defined words, such as @channel etc.? I'm not very familiar with the app yet so decided to ask first)

Fairly certainly we only have @here (not @channel) so let's only worry about that one

we should always play a sound when message arrives (doesn't matter on which screen is currently located)

Correct!

kirillzyusko commented 4 months ago

@shawnborton I fixed all these issues! Would you mind to test again and see if there is everything works as expected? (I hope it works as expected 😅 🤞)

shawnborton commented 4 months ago

Amazing! Going to trigger a new build now.

github-actions[bot] commented 4 months ago
:test_tube::test_tube: Use the links below to test this adhoc build on Android, iOS, Desktop, and Web. Happy testing! :test_tube::test_tube: Android :robot: iOS :apple:
https://ad-hoc-expensify-cash.s3.amazonaws.com/android/31055/index.html https://ad-hoc-expensify-cash.s3.amazonaws.com/ios/31055/index.html
Android iOS
Desktop :computer: Web :spider_web:
https://ad-hoc-expensify-cash.s3.amazonaws.com/desktop/31055/NewExpensify.dmg https://31055.pr-testing.expensify.com
Desktop Web

:eyes: View the workflow run that generated this build :eyes:

shawnborton commented 4 months ago

Nice, this is feeling pretty good! I think I'll distribute these for testing now.

shawnborton commented 4 months ago

One strange thing I noticed... if I change windows on my Mac away from the Expensify chrome window, then go back to that window, the first message I send does not have a sound. But the second and subsequent messages do have a sound. Any ideas there?

kirillzyusko commented 4 months ago

One strange thing I noticed... if I change windows on my Mac away from the Expensify chrome window, then go back to that window, the first message I send does not have a sound. But the second and subsequent messages do have a sound. Any ideas there?

@shawnborton I don't have any ideas 🤔 I'd suggest to keep it in mind and distribute the build to testers anyways. When we gather all bugs in one place I'll fix them all at once! How does it sound to you?

shawnborton commented 4 months ago

Works for me, will keep ya posted.

shawnborton commented 4 months ago

Okay so after some testing, we decided that we want to get rid of the start up sound/animation and just go back to our standard "E" icon. We can follow up later with the animated coin spinner or something different, but until then, let's just get rid of that part.

So if you don't mind, could you update this PR by reverting the start up animation/sound? Then we can have a test build that just has the UI sounds on it (please pull main when you get a chance, too). Thanks!

kirillzyusko commented 4 months ago

@shawnborton sure! Tomorrow I will:

shawnborton commented 4 months ago

Wonderful, thanks!

shawnborton commented 4 months ago

Let me know when this is ready for a new build!

kirillzyusko commented 4 months ago

@shawnborton sure! I merged upstream and reverted animated splash screen implementation - going to check the issue with missing sound now 👀

I'll let you know when I finish!

kirillzyusko commented 4 months ago

if I change windows on my Mac away from the Expensify chrome window, then go back to that window, the first message I send does not have a sound.

@shawnborton I can not reproduce the issue you've described 😔 I've tried to switch between tabs in Chrome as well as switching between windows (i. e. minimizing Chrome -> Finder -> Spotify -> Chrome) and I tried to combine these approaches, but I always hear first sound 🤔

Am I doing something wrong? Maybe you can send me a video and show your reproduction steps? Also which Chrome browser version are you using?

shawnborton commented 4 months ago

Hmm let's spin up a new test build and I'll try to capture it, but maybe it's nothing we need to worry about for now. Any more changes coming or should I trigger the build?

kirillzyusko commented 4 months ago

Any more changes coming or should I trigger the build?

No more upcoming changes - you can trigger a build 🙂

github-actions[bot] commented 4 months ago
:test_tube::test_tube: Use the links below to test this adhoc build on Android, iOS, Desktop, and Web. Happy testing! :test_tube::test_tube: Android :robot: iOS :apple:
https://ad-hoc-expensify-cash.s3.amazonaws.com/android/31055/index.html ❌ FAILED ❌
Android The QR code can't be generated, because the iOS build failed
Desktop :computer: Web :spider_web:
https://ad-hoc-expensify-cash.s3.amazonaws.com/desktop/31055/NewExpensify.dmg https://31055.pr-testing.expensify.com
Desktop Web

:eyes: View the workflow run that generated this build :eyes:

shawnborton commented 4 months ago

Hmm, iOS failed again. I'll retrigger the build but you might need to merge main in (again)?

kirillzyusko commented 4 months ago

@shawnborton I merged everything few hours ago. I think we just should retry a job, because it failed due to connection problems:

image