Skip to content

Fallback notification cleanup#6190

Merged
bmarty merged 8 commits intodevelopfrom
feature/bma/fallbackNotificationCleanup
Feb 12, 2026
Merged

Fallback notification cleanup#6190
bmarty merged 8 commits intodevelopfrom
feature/bma/fallbackNotificationCleanup

Conversation

@bmarty
Copy link
Member

@bmarty bmarty commented Feb 12, 2026

Content

  • Ensure that when the room list is displayed, the existing fallback notification is automatically dismissed.
  • Ensure that when the room list is displayed, no new fallback notification can be displayed

Add more test to ensure that incoming events are correctly ignored regarding the application state.

Motivation and context

Improve behavior of fallback notification.

Screenshots / GIFs

Tests

  • Have a fallback notification
  • Start the application using the launcher icon
  • The fallback notification should be automatically dismissed

Tested devices

  • Physical
  • Emulator
  • OS version(s):

Checklist

  • Changes have been tested on an Android device or Android emulator with API 24
  • UI change has been tested on both light and dark themes
  • Accessibility has been taken into account. See https://github.com/element-hq/element-x-android/blob/develop/CONTRIBUTING.md#accessibility
  • Pull request is based on the develop branch
  • Pull request title will be used in the release note, it clearly define what will change for the user
  • Pull request includes screenshots or videos if containing UI changes
  • You've made a self review of your PR

@bmarty bmarty requested a review from a team as a code owner February 12, 2026 13:44
@bmarty bmarty requested review from jmartinesp and removed request for a team February 12, 2026 13:44
@bmarty bmarty added the PR-Misc For other changes label Feb 12, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Feb 12, 2026

📱 Scan the QR code below to install the build (arm64 only) for this PR.
QR code
If you can't scan the QR code you can install the build via this link: https://i.diawi.com/wqaAxE

threadId == appNavigationState.navigationState.currentThreadId()
}
}
}
Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe changing the receiver and parameter is a bit clearer, what do you prefer @jmartinesp ?

/**
 * Used to check if a notifiableEvent should be ignored based on the current application navigation state.
 */
private fun AppNavigationState.shouldIgnoreEvent(event: NotifiableEvent): Boolean {
    if (!isInForeground) return false
    return navigationState.currentSessionId() == event.sessionId &&
        when (event) {
            is NotifiableRingingCallEvent -> {
                // Never ignore ringing call notifications
                // Note that NotifiableRingingCallEvent are not handled by DefaultNotificationDrawerManager
                false
            }
            is FallbackNotifiableEvent -> {
                // Ignore if the room list is currently displayed
                navigationState is NavigationState.Session
            }
            is InviteNotifiableEvent,
            is SimpleNotifiableEvent -> {
                event.roomId == navigationState.currentRoomId()
            }
            is NotifiableMessageEvent -> {
                event.roomId == navigationState.currentRoomId() &&
                    event.threadId == navigationState.currentThreadId()
            }
        }
}

Copy link
Member

Choose a reason for hiding this comment

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

Yes, it's easier to read like this I'd say.

Copy link
Member

@jmartinesp jmartinesp left a comment

Choose a reason for hiding this comment

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

It works like a charm, thanks! The proposed changes to shouldIgnoreRegardingApplicationState in the comment above make sense to me since they seem easier to understand than the current implementation.

Also, it seems like there are some issues with the tests to fix before merging.

Copy link
Member

@jmartinesp jmartinesp left a comment

Choose a reason for hiding this comment

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

Odd, the message above should have been an approval and not just a comment.

@sonarqubecloud
Copy link

@codecov
Copy link

codecov bot commented Feb 12, 2026

Codecov Report

❌ Patch coverage is 88.88889% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.46%. Comparing base (6ec35db) to head (d1d5fb9).
⚠️ Report is 21 commits behind head on develop.

Files with missing lines Patch % Lines
.../notifications/DefaultNotificationDrawerManager.kt 85.71% 1 Missing and 2 partials ⚠️
...id/services/appnavstate/test/AppNavStateFixture.kt 80.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #6190      +/-   ##
===========================================
+ Coverage    81.42%   81.46%   +0.04%     
===========================================
  Files         2569     2569              
  Lines        69699    69714      +15     
  Branches      8941     8943       +2     
===========================================
+ Hits         56751    56792      +41     
+ Misses        9628     9602      -26     
  Partials      3320     3320              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@bmarty bmarty merged commit 17cf0ef into develop Feb 12, 2026
31 of 32 checks passed
@bmarty bmarty deleted the feature/bma/fallbackNotificationCleanup branch February 12, 2026 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR-Misc For other changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants