fix: Notifications platform links#24708
Conversation
|
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. |
app/scripts/controllers/metamask-notifications/services/feature-announcements.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Double check this getPlatform code.
This calls window.navigator, and the window does not exist on service workers.
We might want to replace this with global.navigator or self.navigator
@danjm is this function getPlatform used in other controllers? We are not seeing any regressions or errors using this? If it works, then feel free to keep using it @matteoscurati .
There was a problem hiding this comment.
@Prithpal-Sooriya everything seems to be working correctly. I tried generating the links by also printing the different steps and everything seems to work
There was a problem hiding this comment.
Because of this: https://github.com/MetaMask/metamask-extension/blob/develop/app/scripts/init-globals.js#L17
window, in our app/ code under mv3, refers to the ServiceWorkerGlobalScope and not an actual window. The ServiceWorkerGlobalScope has some, but not all, of the apis an actual window has. navigator is one of the APIs it does have, so this should be fine
ui/pages/notifications/notification-components/erc1155-sent-received/erc1155-sent-received.tsx
Outdated
Show resolved
Hide resolved
The base branch was changed.
2b6e4ac to
4fe125f
Compare
Builds ready [5ac245e]
Page Load Metrics (1316 ± 596 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
|
|
||
| const blockExplorerUrl = | ||
| defaultNetwork?.rpcPrefs?.blockExplorerUrl ?? | ||
| defaultNetwork?.rpcUrl ?? |
There was a problem hiding this comment.
I don't think ?? defaultNetwork?.rpcUrl should be here, as rpcUrl should never be a block explorer url
There was a problem hiding this comment.
@danjm you’re right. This is the type:
export type NetworkConfiguration = {
rpcUrl: string;
chainId: Hex;
ticker: string;
nickname?: string;
rpcPrefs?: {
blockExplorerUrl: string;
};
};
I removed defaultNetwork?.rpcUrl
Prithpal-Sooriya
left a comment
There was a problem hiding this comment.
Ok LGTM. We will get another Notification dev to review. This was previously approved by Dan too.
|
Missing release label release-12.0.0 on PR. Adding release label release-12.0.0 on PR and removing other release labels(release-12.1.0), as PR was cherry-picked in branch 12.0.0. |
Description
This PR introduces the logic to handle links within notifications to support the different platforms on which we can use the extension.
Related issues
Fixes:
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist