Skip to content

feat: add push pre-prompt integration (part 3) cp-7.80.0#30476

Merged
samir-acle merged 25 commits into
mainfrom
codex/ge-217-push-preprompt-integration
May 28, 2026
Merged

feat: add push pre-prompt integration (part 3) cp-7.80.0#30476
samir-acle merged 25 commits into
mainfrom
codex/ge-217-push-preprompt-integration

Conversation

@samir-acle

@samir-acle samir-acle commented May 20, 2026

Copy link
Copy Markdown
Contributor

Description

This is PR 3 of the GE-217 push pre-prompt rollout.

This PR mounts the push notification onboarding pre-prompt from Nav/Main and wires the production flow for the two currently supported startup variants:

  • push_permission: shown to eligible users who have not granted OS push permission or do not yet have notification preferences.
  • marketing_consent: shown to eligible existing users with push notifications enabled but marketing notification preferences disabled.

The prompt resolver now gates display on notification runtime eligibility, completed onboarding, the default-on feature flag, one-time “shown” storage, OS push permission status, Authenticated User Storage notification preferences, and pending social-login marketing-consent backfill. AUS preference reads stay behind the runtime gate, and resetting the developer “push pre prompt shown” flag does not immediately reopen the prompt until the app is restarted.

This PR also adds shared notification preference helpers used by Settings and startup onboarding, background enablement for the push pre-prompt path, marketing notification preference updates, toast copy, and MetaMetrics/identify instrumentation for pre-prompt actions, OS prompt responses, marketing consent, and push notification enablement.

Changelog

CHANGELOG entry: Added a startup prompt for eligible users to enable push notifications.

Related issues

Fixes: GE-217

Manual testing steps

Feature: Push notification startup pre-prompt

  Scenario: eligible user sees the push permission pre-prompt
    Given notifications are enabled for the build
    And the user is eligible for the push permission pre-prompt
    And the push pre-prompt has not already been shown

    When the user launches the app
    Then the push notification onboarding sheet is shown

    When the user taps "Yes"
    Then the native push permission prompt is requested
    And the startup surface is completed
    And notifications are enabled in the background

  Scenario: eligible user dismisses the push permission pre-prompt
    Given notifications are enabled for the build
    And the user is eligible for the push permission pre-prompt
    And the push pre-prompt has not already been shown

    When the user launches the app
    And the user taps "Not now"
    Then the push notification onboarding sheet closes
    And the startup surface is completed

  Scenario: existing user sees the marketing consent pre-prompt
    Given notifications are enabled for the build
    And the user already has notification preferences
    And the user has not enabled marketing consent
    And the push pre-prompt has not already been shown

    When the user launches the app
    Then the marketing consent onboarding sheet is shown

    When the user confirms marketing consent
    Then marketing consent is enabled
    And the startup surface is completed    

Manual Testing Steps

Preconditions

  • Use a build with the notifications feature flag enabled.
  • Use a device/simulator where OS notification permissions can be reset.
  • After seeing either pre-prompt once, go to Settings > Developer options and tap Reset push pre prompt shown, then fully kill and reopen the app before testing another prompt.
  • To force a clean first-run state, delete the app from the device and install it again.
  • To test update behavior, do not delete the app. Install/update the PR build over an existing installed build so app data is preserved.

Flow 1: New User / Push Permission Pre-Prompt

Setup

  1. Delete the app from the device.
  2. Install the PR build.
  3. If needed, reset OS notification permission for MetaMask from device settings.
  4. Open the app and complete onboarding with a new wallet or imported wallet.
  5. Keep marketing consent disabled during onboarding if the option is shown.
  6. Finish onboarding and land in the wallet.

Steps

  1. Confirm the push notification pre-prompt appears after onboarding.
  2. Confirm the sheet explains push notifications and personalized updates.
  3. Tap Not now.
  4. Confirm the sheet closes.
  5. Confirm a toast appears saying notifications can be enabled later in Settings > Notifications.
  6. Go to Settings > Developer options and tap Reset push pre prompt shown.
  7. Fully kill and reopen the app.
  8. Confirm the push notification pre-prompt appears again.
  9. Tap Yes.
  10. Confirm the native OS push notification prompt appears.
  11. Tap Allow.
  12. Confirm the sheet closes.
  13. Confirm a success toast appears.
  14. Go to Settings > Notifications.
  15. Confirm notifications are enabled.
  16. Confirm the relevant notification categories, including marketing/updates, are enabled where available.

Also Verify

  • Repeat the Yes path and tap Don’t Allow on the OS prompt.
  • Confirm the app does not crash.
  • Confirm the sheet closes and the user sees guidance to enable notifications later in settings.

Flow 2: Existing User / App Update With Push Enabled But Marketing Consent Disabled

Setup

  1. Start from an existing installed app with a completed wallet.
  2. Do not delete the app.
  3. Enable push notifications from Settings > Notifications.
  4. Disable marketing consent from Settings > Security & Privacy > Data collection for marketing.
  5. Install/update to the PR build over the existing app.
  6. Open the app and unlock the wallet.
  7. If the prompt was already seen, use Settings > Developer options > Reset push pre prompt shown, then fully kill and reopen the app.

Steps

  1. Confirm the existing-user marketing consent pre-prompt appears.
  2. Confirm the prompt asks for personalized/marketing updates.
  3. Tap Not now.
  4. Confirm the sheet closes.
  5. Confirm marketing consent remains disabled.
  6. Confirm push notifications remain enabled.
  7. Reset push pre prompt shown in Developer options.
  8. Fully kill and reopen the app.
  9. Confirm the existing-user marketing consent prompt appears again.
  10. Tap Confirm.
  11. Confirm the sheet closes.
  12. Confirm a success toast appears.
  13. Go to Settings > Security & Privacy.
  14. Confirm Data collection for marketing is enabled.
  15. Go to Settings > Notifications.
  16. Confirm Updates and Rewards / marketing notification preferences are enabled.

Flow 3: Existing User / App Update With Marketing Consent Enabled But Push Disabled

Setup

  1. Start from an existing installed app with a completed wallet but push not enabled (also not denied)
  2. Do not delete the app.
  3. Enable marketing consent from Settings > Security & Privacy > Data collection for marketing.
  4. Disable push notifications from device OS settings or Settings > Notifications.
  5. Install/update to the PR build over the existing app.
  6. Open the app and unlock the wallet.
  7. Reset push pre prompt shown in Developer options if needed, then fully kill and reopen.

Steps

  1. Confirm the push permission pre-prompt appears.
  2. Tap Yes.
  3. Confirm the native OS notification prompt appears.
  4. Tap Allow.
  5. Confirm notifications are enabled.
  6. Confirm marketing consent remains enabled.

Regression Checks

  • The pre-prompt should only show once per install/session unless reset from Developer options.
  • Resetting push pre prompt shown should not immediately reopen the prompt until the app is restarted.
  • Deleting and reinstalling the app should allow the new-user flow to be tested again.
  • Updating the app without deleting it should preserve user state and trigger the correct existing-user flow.
  • Users with both push notifications and marketing consent already enabled should not see either pre-prompt.

Screenshots/Recordings

Before

After

Pre-merge author checklist

Performance checks (if applicable)

  • I've tested on Android
    • Ideally on a mid-range device; emulator is acceptable
  • I've tested with a power user scenario
    • Use these power-user SRPs to import wallets with many accounts and tokens
  • I've instrumented key operations with Sentry traces for production performance metrics

For performance guidelines and tooling, see the Performance Guide.

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

@github-actions

Copy link
Copy Markdown
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@metamaskbotv2 metamaskbotv2 Bot added the INVALID-PR-TEMPLATE PR's body doesn't match template label May 20, 2026
@samir-acle samir-acle force-pushed the codex/ge-217-push-preprompt-integration branch 2 times, most recently from 299042a to 02a85c5 Compare May 20, 2026 19:16
@metamaskbotv2 metamaskbotv2 Bot removed the INVALID-PR-TEMPLATE PR's body doesn't match template label May 20, 2026
@samir-acle samir-acle changed the title Add push pre-prompt startup surface integration feat: add push pre-prompt startup surface integration (part 3) May 20, 2026
@samir-acle samir-acle force-pushed the codex/ge-217-push-preprompt-integration branch from 02a85c5 to 404275d Compare May 20, 2026 19:35
@samir-acle samir-acle force-pushed the codex/ge-217-push-preprompt-integration branch from 404275d to fca1ddd Compare May 20, 2026 19:58
- Add useNotificationsRuntimeGate (isUnlocked, isSignedIn, isBasicFunctionality, featureFlag)
- Wire as default enabled in useNotificationsMarketingConsent; prevents pre-auth AUS calls
- Add missing isSignedIn gate (present in useRegisterAndFetchNotifications, absent here)
- Simplify usePushPrePromptVariant: compose runtime gate + prompt-local conditions into canShowPrePrompt
@samir-acle samir-acle marked this pull request as ready for review May 21, 2026 18:17
@samir-acle samir-acle requested review from a team as code owners May 21, 2026 18:17
@samir-acle samir-acle enabled auto-merge May 21, 2026 18:17
@samir-acle samir-acle changed the title feat: add push pre-prompt startup surface integration (part 3) feat: add push pre-prompt integration (part 3) May 21, 2026
…In gate

- Split canShowPrePrompt into lightweight push-permission gate (completedOnboarding + featureFlag + basicFunctionality, no isSignedIn) and full marketing-consent gate (existing runtimeGate behaviour)
- Push-permission sheet now shows immediately after onboarding without waiting for AuthenticationController.performSignIn() network round-trip
- Gate useNotificationsMarketingConsent on the full gate so user-storage queries are not initiated on the new-user fast path
@samir-acle samir-acle force-pushed the codex/ge-217-push-preprompt-integration branch from 47f781d to 819d884 Compare May 22, 2026 00:07
samir-acle and others added 6 commits May 27, 2026 00:28
…atform

- Add isPushPermissionGranted and isPushPermissionPromptable helpers
  in NotificationService (Notifee) with explicit intent names
- Switch push-notification-status and pre-prompt eligibility to use
  isPushPermissionGranted (Notifee) directly
- Use isPushPermissionPromptable in PushNotificationOnboarding to
  guard the OS prompt call on both platforms

Co-authored-by: Cursor <cursoragent@cursor.com>
Comment thread app/actions/notification/helpers/index.ts Outdated
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.73756% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.38%. Comparing base (6d22177) to head (4ff8d82).
⚠️ Report is 43 commits behind head on main.

Files with missing lines Patch % Lines
...il/notifications/utils/push-notification-status.ts 72.72% 2 Missing and 1 partial ⚠️
...Notifications/PushNotificationOnboarding/index.tsx 97.22% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #30476      +/-   ##
==========================================
+ Coverage   82.32%   82.38%   +0.06%     
==========================================
  Files        5542     5568      +26     
  Lines      149438   150033     +595     
  Branches    34455    34595     +140     
==========================================
+ Hits       123028   123610     +582     
+ Misses      18036    18027       -9     
- Partials     8374     8396      +22     

☔ 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.

@samir-acle samir-acle force-pushed the codex/ge-217-push-preprompt-integration branch from cc05c94 to 5e9974d Compare May 27, 2026 16:22
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeNetworkAbstractions, SmokeSeedlessOnboarding, SmokeIdentity
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: medium
  • AI Confidence: 82%
click to see 🤖 AI reasoning details

E2E Test Selection:

The PR introduces a push notification pre-prompt system with several key changes:

  1. SmokeNetworkAbstractions (directly required): The E2E test tests/smoke/notifications/enable-notifications-after-onboarding.spec.ts is tagged with SmokeNetworkAbstractions and has been directly modified (scroll-to-item fix before assertion). The notification onboarding flow is the primary feature being tested. Must run to validate the test fix and the notification enabling flow changes.

  2. SmokeSeedlessOnboarding (required due to marketing consent changes): The backfillSocialLoginMarketingConsent.ts saga has been refactored with bug fixes - it now correctly calls setPendingSocialLoginMarketingConsentBackfill(null) in both success and error paths, and fixes the ordering of setDataCollectionForMarketing. The new useEnableMarketingConsent hook also integrates with seedless onboarding login flow detection (selectSeedlessOnboardingLoginFlow). These changes directly affect the social login / seedless onboarding flow.

  3. SmokeIdentity (required due to marketing consent and account sync): The useEnableMarketingConsent hook interacts with MetaMetrics opt-in and marketing consent tracking, which is part of the identity/sync system. The selectDataCollectionForMarketingEnabled selector is new and used in the pre-prompt variant logic. Changes to marketing consent backfill could affect identity sync behavior.

Why other tags are NOT selected:

  • Nav/Main/index.js adds PushNotificationOnboardingRoot but it explicitly returns null in E2E environments (isE2E check), so it won't affect other E2E test flows.
  • The useNotifications.ts change (adding registerPushNotifications parameter) is a refactor that doesn't change the default behavior for existing notification flows.
  • No changes to swap, stake, confirmations, browser, snaps, or other unrelated areas.
  • Performance impact is minimal - the new component is a no-op in E2E and the changes are primarily logic/analytics refactors.

Performance Test Selection:
No performance tests needed. The changes are focused on push notification pre-prompt logic, analytics tracking, and marketing consent management. The new PushNotificationOnboardingRoot component explicitly returns null in E2E environments and is a lightweight modal component. No changes to account list rendering, login flows, asset loading, or other performance-sensitive areas. The notification hooks and service changes are async utility functions that don't affect render performance.

View GitHub Actions results

@sonarqubecloud

Copy link
Copy Markdown

@baptiste-marchand baptiste-marchand moved this from Needs dev review to Has approvals, needs CODEOWNER in PR review queue May 28, 2026
@Montoya Montoya changed the title feat: add push pre-prompt integration (part 3) feat: add push pre-prompt integration (part 3) cp-7.80.0 May 28, 2026

@weitingsun weitingsun left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

mobile platform codeowner files app/util/metrics/UserSettingsAnalyticsMetaData/UserProfileAnalyticsMetaData.types.ts and app/core/Analytics/MetaMetrics.events.ts LGTM

@samir-acle samir-acle added this pull request to the merge queue May 28, 2026
@github-project-automation github-project-automation Bot moved this from Has approvals, needs CODEOWNER to Review finalised - Ready to be merged in PR review queue May 28, 2026
Merged via the queue into main with commit 6118389 May 28, 2026
187 of 192 checks passed
@samir-acle samir-acle deleted the codex/ge-217-push-preprompt-integration branch May 28, 2026 21:10
@github-project-automation github-project-automation Bot moved this from Review finalised - Ready to be merged to Merged, Closed or Archived in PR review queue May 28, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators May 28, 2026
@metamaskbotv2 metamaskbotv2 Bot added the release-7.81.0 Issue or pull request that will be included in release 7.81.0 label May 28, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.81.0 Issue or pull request that will be included in release 7.81.0 size-XL team-engagement

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants