Skip to content

[Due for payment 2026-03-09] [$250] Notification - Sound still plays when 'Mute all sounds from Expensify' is toggled on #81282

Closed

Description

@jponikarchuk

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: v9.3.11-24
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #80624
Email or phone of affected tester (no customers): N/A
Issue reported by: Applause Internal Team
Bug source: Pull Request QA execution
Device used: iPhone SE 3rd gen, iOS 26.2.1
App Component: Notifications

Action Performed:

Preconditions:

  • The device has sound enabled and the volume is set high enough.
  • App notifications enabled.
  1. Open the app.
  2. Tap Account > Preferences.
  3. Toggle on 'Mute all sounds from Expensify'.
  4. Sign in on another device and send a message to the main account.

Expected Result:

When the 'Mute all sounds from Expensify' toggle is on, no sounds should play when receiving a message.

Actual Result:

Even with the 'Mute all sounds from Expensify' toggle on, sounds still play after receiving a message.

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari

Screenshots/Videos

Bug7065064_1770112106239.Issue.mp4

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @twisterdotcom

Activity

  1. added
    ExternalAdded to denote the issue can be worked on by a contributor
    BugSomething is broken. Auto assigns a BugZero manager.
    on Feb 3, 2026
  2. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Feb 3, 2026
  3. melvin-bot commented on Feb 3, 2026

    @melvin-bot

    Triggered auto assignment to Contributor-plus team member for initial proposal review - @eh2077 (External)

  4. melvin-bot commented on Feb 3, 2026

    @melvin-bot

    Triggered auto assignment to @twisterdotcom (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

  5. MobileMage commented on Feb 3, 2026

    @MobileMage
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    When "Mute all sounds from Expensify" is toggled on in Preferences, iOS push notifications still play a sound when a message is received.

    What is the root cause of that problem?

    The iOS foreground notification configuration always includes Sound in the presentation options. When the callback checks whether to show a notification, it returns null to use the default options (which include Sound) or [] to hide entirely. It never checks the user's mute preference.

    // Set a callback to override our foreground presentation per notification depending on the app's current state.
    // Returning null keeps the default presentation. Returning [] uses no presentation (hides the notification).
    Airship.push.iOS.setForegroundPresentationOptionsCallback((pushPayload) => Promise.resolve(shouldShowPushNotification(pushPayload) ? null : []));

    What changes do you think we should make in order to solve the problem?

    We should import getIsMuted from BaseSound and modify the callback to return presentation options without Sound when the user has muted sounds. The getIsMuted function already tracks the mute state via an Onyx connection, so we can reuse it here.

     import Airship, {iOS} from '@ua/react-native-airship';
     import shouldShowPushNotification from '@libs/Notification/PushNotification/shouldShowPushNotification';
    +import {getIsMuted} from '@libs/Sound/BaseSound';
     import type ForegroundNotificationsModule from './types';
    
     function configureForegroundNotifications() {
         Airship.push.iOS.setForegroundPresentationOptions([
             iOS.ForegroundPresentationOption.List,
             iOS.ForegroundPresentationOption.Banner,
             iOS.ForegroundPresentationOption.Sound,
             iOS.ForegroundPresentationOption.Badge,
         ]);
    
    -    Airship.push.iOS.setForegroundPresentationOptionsCallback((pushPayload) => Promise.resolve(shouldShowPushNotification(pushPayload) ? null : []));
    +    Airship.push.iOS.setForegroundPresentationOptionsCallback((pushPayload) => {
    +        if (!shouldShowPushNotification(pushPayload)) {
    +            return Promise.resolve([]);
    +        }
    +        if (getIsMuted()) {
    +            return Promise.resolve([
    +                iOS.ForegroundPresentationOption.List,
    +                iOS.ForegroundPresentationOption.Banner,
    +                iOS.ForegroundPresentationOption.Badge,
    +            ]);
    +        }
    +        return Promise.resolve(null);
    +    });
     }

    What alternative solutions did you explore? (Optional)

    N/A

  6. twinkle-react commented on Feb 3, 2026

    @twinkle-react

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    iOS foreground notification sounds play even when the user has enabled “Mute all sounds from Expensify” because the iOS foreground presentation always includes the Sound option and the presentation decision does not check the platform mute NVP.

    What is the root cause of that problem?

    In this implementation, the earliest incorrect assumption is in src/libs/Notification/PushNotification/ForegroundNotifications/index.ios.ts, where the default foreground presentation includes iOS.ForegroundPresentationOption.Sound and the setForegroundPresentationOptionsCallback only decides whether to show a notification, not whether sound should be included; this assumption is wrong because it never consults ONYXKEYS.NVP_MUTED_PLATFORMS via getIsMuted(), which directly allows the OS presentation to include Sound even when the platform is muted.

    What changes do you think we should make in order to solve the problem?

    For iOS foreground notifications, the notification presentation must exclude the Sound option whenever the platform NVP_MUTED_PLATFORMS state indicates the current platform is muted.

    Change only the notification presentation layer. Modify configureForegroundNotifications in src/libs/Notification/PushNotification/ForegroundNotifications/index.ios.ts to synchronously call getIsMuted() and remove Sound from the computed presentation when muted. Notification presentation is the only layer that decides whether the OS emits a sound.

    Exact code delta and scope
    File(s) changed:
    src/libs/Notification/PushNotification/ForegroundNotifications/index.ios.ts

    Function / logic modified:
    configureForegroundNotifications — the Airship.push.iOS.setForegroundPresentationOptionsCallback implementation and import list

    // src/libs/Notification/PushNotification/ForegroundNotifications/index.ios.ts
    
    import Airship, {iOS} from '@ua/react-native-airship';
    import shouldShowPushNotification from '@libs/Notification/PushNotification/shouldShowPushNotification';
    import {getIsMuted} from '@libs/Sound/BaseSound';
    import type ForegroundNotificationsModule from './types';
    
    function configureForegroundNotifications() {
        // Set our default iOS foreground presentation to be loud with a banner
        Airship.push.iOS.setForegroundPresentationOptions([
            iOS.ForegroundPresentationOption.List,
            iOS.ForegroundPresentationOption.Banner,
            iOS.ForegroundPresentationOption.Sound,
            iOS.ForegroundPresentationOption.Badge,
        ]);
    
        // Per-notification override: compute presentation synchronously and exclude Sound when platform is muted.
        // Returning null keeps the default presentation. Returning [] uses no presentation (hides the notification).
        Airship.push.iOS.setForegroundPresentationOptionsCallback((pushPayload) => {
            if (!shouldShowPushNotification(pushPayload)) {
                return Promise.resolve([]);
            }
    
            const presentation = [
                iOS.ForegroundPresentationOption.List,
                iOS.ForegroundPresentationOption.Banner,
                // Only include Sound if the platform is not muted.
                ...(getIsMuted() ? [] : [iOS.ForegroundPresentationOption.Sound]),
                iOS.ForegroundPresentationOption.Badge,
            ];
    
            return Promise.resolve(presentation);
        });
    }
    
    function disableForegroundNotifications() {
        Airship.push.iOS.setForegroundPresentationOptionsCallback(() => Promise.resolve([]));
    }
    
    const ForegroundNotifications: ForegroundNotificationsModule = {
        configureForegroundNotifications,
        disableForegroundNotifications,
    };
    
    export default ForegroundNotifications;

    This approach always returns a clear list of notification options. It adds Sound only when the app is not muted and removes it when muted. Because of this, it does not depend on any default settings, and the notification behavior is predictable and fully controlled in one place.

    What alternative solutions did you explore? (Optional)

    Changing Pusher to Onyx ordering or deferring sound decisions adds cross-layer responsibility and timing complexity.
    Adding guards in sound utilities spreads responsibility and increases the chance of missed cases.
    The notification-layer change is single-responsibility, synchronous, and minimal.

  7. blazejkustra commented on Feb 3, 2026

    @blazejkustra
    Contributor

    It's a regression from my PR, I'll take care of it.

  8. abbasifaizan70 commented on Feb 3, 2026

    @abbasifaizan70
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    When the user enables "Mute all sounds from Expensify" in Preferences, sounds still play when a new message is received (e.g. when someone sends a message from another device). The preference should silence all in-app and notification sounds.

    What is the root cause of that problem?

    When a message arrives with the app in the foreground, sound can come from two places:

    1. In-app (Pusher) – playSoundForMessageType in User.ts calls playSound(), which already checks getIsMuted() in the Sound layer, so this path respects the preference.
    2. Native push notification – On iOS the default foreground presentation includes Sound. The app decides whether to show the notification via shouldShowPushNotification(), but that function did not consider the "Mute all sounds" preference. So the system could still show the notification and play its sound when the user had muted.

    The bug is that foreground push notification handling ignored the mute preference; the in-app sound path already respected it.

    What changes do you think we should make in order to solve the problem?

    Respect the "Mute all sounds from Expensify" preference in shouldShowPushNotification(). When the user has muted, return false so the foreground notification is not shown (and the system does not play the notification sound). This uses the same mute state as the rest of the app via getIsMuted() from BaseSound.

    Change – Respect mute in foreground push notification

    import type {PushPayload} from '@ua/react-native-airship';
    import Log from '@libs/Log';
    import * as ReportActionUtils from '@libs/ReportActionsUtils';
    import * as Report from '@userActions/Report';
    import parsePushNotificationPayload from './parsePushNotificationPayload';
    /**
    * Returns whether the given Airship notification should be shown depending on the current state of the app
    */
    export default function shouldShowPushNotification(pushPayload: PushPayload): boolean {
    Log.info('[PushNotification] push notification received', false, {pushPayload});
    const data = parsePushNotificationPayload(pushPayload.extras.payload);
    if (!data) {
    return true;
    }
    let shouldShow = false;
    if (data.type === 'transaction') {
    shouldShow = true;

    After:

    import type {PushPayload} from '@ua/react-native-airship';
    import Log from '@libs/Log';
    import {getIsMuted} from '@libs/Sound/BaseSound';
    import * as ReportActionUtils from '@libs/ReportActionsUtils';
    import * as Report from '@userActions/Report';
    import parsePushNotificationPayload from './parsePushNotificationPayload';
    
    /**
     * Returns whether the given Airship notification should be shown depending on the current state of the app
     */
    export default function shouldShowPushNotification(pushPayload: PushPayload): boolean {
        Log.info('[PushNotification] push notification received', false, {pushPayload});
    
        // When "Mute all sounds from Expensify" is on, don't show foreground notifications so the system won't play notification sound
        if (getIsMuted()) {
            return false;
        }
    
        const data = parsePushNotificationPayload(pushPayload.extras.payload);
    
        if (!data) {
            return true;
        }
        // ... rest unchanged
    }

    Summary of change:
    Import getIsMuted from @libs/Sound/BaseSound and, at the start of shouldShowPushNotification, return false when getIsMuted() is true. That prevents the system from showing the foreground notification (and playing its sound) when "Mute all sounds from Expensify" is on. Both iOS (foreground presentation callback) and Android (foreground display predicate) use this function, so the fix applies to both platforms.

    What alternative solutions did you explore? (Optional)

    1. Only change iOS foreground presentation options (e.g. pass options without Sound when muted)
      The Airship iOS API used here returns either null (default, with sound) or [] (no presentation). There is no way in this callback to show the banner without sound. So to avoid sound when muted, we must not show the notification (return false / []). The implemented solution does that.

    2. Play sound only from in-app (Pusher) and disable push sound entirely
      That would require broader changes and would affect all users. Respecting the existing mute preference in shouldShowPushNotification is a minimal, consistent fix.

  9. blazejkustra commented on Feb 3, 2026

    @blazejkustra
    Contributor

    @jponikarchuk could you record a video where the app is in the background and you send a message from the second device?

    One recording with audio muted in Expensify's settings and one with audio enabled in Expensify's settings 🙏

  10. blazejkustra commented on Feb 3, 2026

    @blazejkustra
    Contributor

    Reproducible in production?: Yes

    Wait, you can reproduce it in production? @jponikarchuk 🤔

  11. 38 remaining items

  12. MobileMage commented on Mar 9, 2026

    @MobileMage
    Contributor

    Accepted contract @twisterdotcom

  13. eh2077 commented on Mar 11, 2026

    @eh2077
    Contributor

    BugZero Checklist:

    Regression Test Proposal

    Precondition:

    • NA

    Test:

    1. Log into the app on a physical iOS device
    2. Go to Settings > Troubleshoot > toggle on "Mute all sounds from Expensify"
    3. Have another user send you a message while the app is in the foreground
    4. Verify the notification banner appears but no sound plays
    5. Toggle off "Mute all sounds from Expensify"
    6. Have another user send you a message again
    7. Verify the notification banner appears with sound

    Do we agree 👍 or 👎

    Zapier Logs Run ID: 00040eee-b03c-adcb-313c-b2df460fab04
  14. eh2077 commented on Mar 11, 2026

    @eh2077
    Contributor

    @twisterdotcom checklist done, thanks 🙇

  15. changed the title [-][Awaiting checklist completion] [Due for payment 2026-03-09] [$250] Notification - Sound still plays when 'Mute all sounds from Expensify' is toggled on[/-] [+][Due for payment 2026-03-09] [$250] Notification - Sound still plays when 'Mute all sounds from Expensify' is toggled on[/+] on Mar 11, 2026
  16. melvin-bot commented on Mar 11, 2026

    @melvin-bot

    Triggered auto assignment to @johncschuster (Awaiting Payment)

  17. arosiclair commented on Mar 11, 2026

    @arosiclair
    Contributor

    TBH I'm not sure I agree with the expected result here. The "mute all sounds" setting only affected in-app sounds so push notifications were not affected. It's been that way for years so I'm not sure why Applause is reporting that as a bug now.

    In any case, if we really do want this change, I think we also need to update Android since it has the same problem @Julesssss

  18. Julesssss commented on Mar 11, 2026

    @Julesssss
    Contributor

    Hmm yeah I agree. I didn't think to check the original issue, but original test case correctly pointed this out and the test step was missunderstood.

    **Notifications - Receive message backgrounded app**
    - Navigate to a conversation that is not the one with the secondary user
    - Background the app / Navigate to another tab or minimize the window in web
    - Secondary device - Send a message to the user in the main testing device
    - Verify the user receives a notification with a sound
    
  19. Julesssss commented on Mar 11, 2026

    @Julesssss
    Contributor

    This test case doesn't explicitly say whether the received message is a push notification.

    @arosiclair so we can update this to specify that notifications sounds is expected when associated with a push notification? I kinda thought we suppressed the notification if user was on that chat. So perhaps we should also add a step to navigate away. Unless that has since changed...

    Image
  20. arosiclair commented on Mar 12, 2026

    @arosiclair
    Contributor

    @arosiclair so we can update this to specify that notifications sounds is expected when associated with a push notification? I kinda thought we suppressed the notification if user was on that chat. So perhaps we should also add a step to navigate away. Unless that has since changed...

    Yeah the notification should be suppressed for the current chat. They tested in a different chat, so the notification came through and made a sound. I think we should update that test to say the main user should have the chat with the secondary user open. Then there should be no sounds.

  21. Julesssss commented on Mar 13, 2026

    @Julesssss
    Contributor

    Okay updated. So lets also revert this and go back to our previously expected behaviour.

    Image
  22. JmillsExpensify commented on Mar 24, 2026

    @JmillsExpensify
    Contributor

    $250 approved for @eh2077

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.ExternalAdded to denote the issue can be worked on by a contributorWeeklyKSv2

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions