-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
feat: add Contentful version segmentation #19529
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
Changes from all commits
2d85cbd
4d9a443
4d24049
2e31c46
6fa5893
c0911ce
fa9a7e7
87763da
39040f2
a15be6f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ import { ExtractedNotification, isOfTypeNodeGuard } from '../node-guard'; | |
import { NotificationState } from '../types/NotificationState'; | ||
import { getNotificationBadge } from '../../methods/common'; | ||
import METAMASK_FOX from '../../../../images/branding/fox.png'; | ||
import { hasMinimumRequiredVersion } from '../../../remoteFeatureFlag'; | ||
|
||
type FeatureAnnouncementNotification = | ||
ExtractedNotification<TRIGGER_TYPES.FEATURES_ANNOUNCEMENT>; | ||
|
@@ -12,6 +13,26 @@ const isFeatureAnnouncementNotification = isOfTypeNodeGuard([ | |
TRIGGER_TYPES.FEATURES_ANNOUNCEMENT, | ||
]); | ||
|
||
export const isFilteredFeatureAnnonucementNotification = ( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This filtering/segmentation can be done in CORE. I can have this as a follow up (need to think how we can pass app version into core for mobile vs extension) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see we have a |
||
n: FeatureAnnouncementNotification, | ||
) => { | ||
if (!isFeatureAnnouncementNotification(n)) { | ||
return false; | ||
} | ||
|
||
// Field is not set, so show by default | ||
if (!n.data.mobileMinimumVersionNumber) { | ||
return true; | ||
} | ||
|
||
try { | ||
return hasMinimumRequiredVersion(n.data.mobileMinimumVersionNumber); | ||
} catch { | ||
// Invalid mobile version number, not showing notification | ||
return false; | ||
} | ||
}; | ||
|
||
const state: NotificationState<FeatureAnnouncementNotification> = { | ||
guardFn: isFeatureAnnouncementNotification, | ||
createMenuItem: (notification) => ({ | ||
|
Uh oh!
There was an error while loading. Please reload this page.