-
Notifications
You must be signed in to change notification settings - Fork 5k
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
Add web3 shim usage notification #10039
Conversation
Builds ready [26c9536]
Page Load Metrics (597 ± 24 ms)
|
26c9536
to
d555463
Compare
Builds ready [b7b3d3f]
Page Load Metrics (550 ± 11 ms)
|
app/scripts/controllers/alert.js
Outdated
unconnectedAccountAlertShownOrigins: {}, | ||
web3ShimUsageOrigins: {}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Q: should you just spread ...defaultState
before alertEnabledness
and remove the empty objects here? That way if default state changes in the future it is easily extensible here? No strong opinions on this, it is safe the way it is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually, in retrospect -- do we want persistence for web3ShimUsageOrigins
? Then we'd want to spread initState.web3ShimUsageOrigins
into the state declaration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't want to persist web3ShimUsageOrigins
, because we want dismissed web3 shim usage notifications to reappear if the extension is restarted (assuming the notification is enabled), and storing the origins could contribute to state bloat over time.
Nevertheless, I followed your suggestion about spreading defaultState
first, it's better!
Builds ready [995f518]
Page Load Metrics (507 ± 29 ms)
|
Builds ready [6fd5a07]
Page Load Metrics (601 ± 33 ms)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Builds ready [4cb4bfa]
Page Load Metrics (545 ± 12 ms)
|
Implements the web3 shim usage notification, using the
AlertController
andHomeNotification
. The new notification has been tested in Firefox and Chrome.The web3 shim usage logging state now lives in the alert controller. Its lifecycle is coterminous with the extension background process, as it's erased on boot. The notification is shown in the popup only if the current website has any permissions and attempted to use web3. The user can:
In sum, the following changes were made:
shared/constants/alerts
, adds new constantsdefaultState.alertEnabledness
rather than merging it, meaning that new alerts wouldn't be added to state. This hasn't bitten us because the only other alert added since the controller was created can't be toggled.HomeNotification
component, which is used for disabling the alertapp/images/icons/connect.svg
, which we missed deleting in Disable console in contentscript #10040