Support MatchNotifications Bridget API to prevent duplicate notifications#15819
Draft
DanielCliftonGuardian wants to merge 9 commits into
Draft
Support MatchNotifications Bridget API to prevent duplicate notifications#15819DanielCliftonGuardian wants to merge 9 commits into
DanielCliftonGuardian wants to merge 9 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this change?
Bumps @guardian/bridget to consume the newly added MatchNotifications service and adds getMatchNotificationsClient to Bridget API wrappers. Updates the Notifications component within FootballMatchHeader to query the app for match notification availability (isAvailable) on mount. If the app returns isAvailable: false, the notification toggle is hidden and replaced with the unavailableReason message provided by the app (or a fallback message). If the Bridget call fails, it gracefully handles the error by logging to Sentry and defaulting to isAvailable: true so the button doesn't silently disappear. Also adds mock Bridget clients and an Unavailable state to Storybook to test the UI changes.
Why?
On match info and liveblog pages, we offer the ability to sign up for notifications about that match. However, the native apps also allow users to sign up for notifications about a particular team, which automatically includes the matches they're playing in. Therefore, we don't want to offer the option to sign up for these matches separately to those users, as it would result in duplicate notifications.
Currently, the apps solve this problem natively by removing the button and instead displaying a message explaining that the user has already signed up for team notifications. This PR implements the webview side of this interaction, utilising the new Bridget API to check the user's team subscription status with the app and adjusting the webview UI to match the native experience.
Part of #15591
Bridget PR guardian/bridget#245