1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-22 19:26:13 +02:00
Commit Graph

3499 Commits

Author SHA1 Message Date
Mark Stacey
3620146e63
Remove unused transForward state and actions (#8401)
The `transForward` app state is no longer used, so it has been removed.
Associated actions have been removed as well.

This state dates back a few years, so I was unable to determine when it
was made obsolete.
2020-04-23 20:32:08 -03:00
Mark Stacey
24a8689090
Remove unused addNewKeyring action (#8400)
Keyrings are added either through the `getKeyringForDevice` background
method (as part of the hardware wallet connect flow), or via
`importAccountWithStrategy` (when importing an account). The
`addNewKeyring` action and corresponding background method has not been
used in a long time.
2020-04-23 20:31:59 -03:00
Mark Stacey
4d76f5b7ca
Promisify gas estimation (#8387)
The `estimateGasMethod` function passed to `estimateGas` is now an
async function. It is now invoked using `async/await` rather than a
Promise constructor.

This was done as part of a broader effort to use Promises rather than
callbacks when interacting with the background.
2020-04-23 15:01:38 -03:00
Mark Stacey
0d6dc380b4
Simplify use of promisified background connection (#8396)
The background connection used in `actions.js` was being promisified
in specific actions. Instead it's now promisified once. This was made
possible by changes in `pify` v5.0.0 that ensure the binding works
correctly when passing in an object to `pify` (e.g. the `this` value
is correctly set to the wrapped background connection).

This async background connection has been temporarily assigned to a
separate variable, until we can transition all of our actions to using
this. This was done to reduce the size of this PR. There are a lot of
actions.
2020-04-23 14:10:15 -03:00
Mark Stacey
5fe25e41b7
Remove unused network nonce state (#8395)
This state hasn't been used since #5886. The nonce we display in our UI
is now from the background, rather than queried directly from the
front-end.

This also means we save making this network call each time a pending
transaction is added, and each time the transaction list is mounted.
2020-04-23 13:23:22 -03:00
Jenny Pollack
940bd81f0f fix-typos-in-actions 2020-04-23 14:16:05 +02:00
Mark Stacey
d0e7f4beaf
Fix comment above callBackgroundThenUpdateNoSpinner function (#8382)
The comment above this function was originally written for a different
function: `callBackgroundThenUpdate`. It was mistakenly left above
`callBackgroundThenUpdateNoSpinner` in #1603 when this function was
added.

The original `callBackgroundThenUpdate` function this was written for
was removed recently in #7675, as it was no longer used.

The format of the comment has also been updated to match our
conventions, and JSDoc params have been added.
2020-04-22 16:15:46 -03:00
Mark Stacey
4598b1844e
Await completion of markPasswordForgotten (#8381)
`markPasswordForgotten` is an asynchronous function, but it was being
called synchronously. The page was redirected without waiting for the
operation to complete.

We now wait for the operation to complete before continuing. Failure is
still not being handled correctly, but that will be addressed in a
separate PR.
2020-04-22 16:15:22 -03:00
Dan J Miller
01985b2cff
Connected indicator info popup (#8293)
* Add popover for informing user about the connected status indicator

* Ensure user only sees connected status info popover once

* Default connectedStatusPopoverHasBeenShown to true and set it to false in a migration

* Add unit test for migration 42

* Initialize AppStateController if it does not exist in migration 42

* Update connect indicator popup locale text

* Code cleanup for connected-indicator-info-popup

* Code cleanup for connected-indicator-info-popup
2020-04-22 14:41:36 -02:30
Erik Marks
a2a51e78d1
Add PermissionsController.removePermittedAccount (#8354)
* add PermissionsController.removePermittedAccount and corresponding UI action

* remove eth_accounts permission on removing last account
2020-04-20 11:34:56 -07:00
Erik Marks
62777a81b4
Close notification UI if no unapproved confirmations (#8358)
* close notification UI if no pending confirmations

* change benchmark page to 'home'
2020-04-20 10:21:57 -07:00
Erik Marks
50451341a0
Route to home page after connecting in popup (#8357)
* after connecting in popup, route to home page
2020-04-17 12:48:13 -07:00
Mark Stacey
15616a33ca
Add 'addPermittedAccount' method to permissions controller (#8344)
This method adds the given account to the given origin's list of
exposed accounts. This method is not yet used, but it will be in
subsequent PRs (e.g. #8312)

This method has been added to the background API, and a wrapper action
creator has been written as well.
2020-04-16 19:23:36 -03:00
Erik Marks
1f49772ca3
Create new tabs instead of windows in most cases (#8347)
* openExtensionInBrowser: create tab, not window

* open tabs instead of windows in most cases
2020-04-16 14:34:40 -07:00
Mark Stacey
b2882aa778
Handle account selection on all domains that can view the selection (#8341)
Selecting a new account now results in all domains that can view this
change being notified. Previously only the dapp in the active tab was
being notified (though not correctly, as the `origin` was accidentally
set to the MetaMask chrome extension origin).

This handling of account selection has been moved into the background
to minimize the gap between account selection and the notification
being sent out. It's simpler for the UI to not be involved anyway.
2020-04-16 13:16:53 -03:00
Mark Stacey
5ee1291662
Prevent accidental use of globals (#8340)
Previously all browser globals were allowed to be used anywhere by
ESLint because we had set the `env` property to `browser` in the ESLint
config. This has made it easy to accidentally use browser globals
(e.g. #8338), so it has been removed. Instead we now have a short list
of allowed globals.

All browser globals are now accessed as properties on `window`.

Unfortunately this change resulted in a few different confusing unit
test errors, as some of our unit tests setup assumed that a particular
global would be used via `window` or `global`. In particular,
`window.fetch` didn't work correctly because it wasn't patched by the
AbortController polyfill (only `global.fetch` was being patched).
The `jsdom-global` package we were using complicated matters by setting
all of the JSDOM `window` properties directly on `global`, overwriting
the `AbortController` for example.

The `helpers.js` test setup module has been simplified somewhat by
removing `jsdom-global` and constructing the JSDOM instance manually.
The JSDOM window is set on `window`, and a few properties are set on
`global` as well as needed by various dependencies. `node-fetch` and
the AbortController polyfill/patch now work as expected as well,
though `fetch` is only available on `window` now.
2020-04-15 14:23:27 -03:00
Mark Stacey
be84a7c2cf
Use correct history object on Permissions Connect page (#8338)
The browser global `history` was being used here instead of the React
Router `history` object. This was accidentally broken when refactoring
in #8269
2020-04-15 11:41:53 -03:00
Mark Stacey
8e03a96470
Rename non-existent selectedAccount prop to fromAccount (#8337)
The prop passed into the SignatureRequestHeader was changed from
`selectedAccount` to `fromAccount` in #8079, but the header component
itself was never updated to use the new prop name.
2020-04-15 11:41:34 -03:00
Mark Stacey
ec40c1fdeb
Remove undeclared name variable from render (#8336)
The header component for the new Signature Request screen has an
undeclared variable called `name` in it. This was present in the
original implementation of this component in #6891. It's unclear what
this was supposed to be, and it doesn't seem to reference anything that
exists.
2020-04-15 11:41:11 -03:00
Whymarrh Whitby
1775d9b163
Update fetchWithCacheTests to use assert.rejects (#8334) 2020-04-14 13:03:33 -02:30
Mark Stacey
3955a4091d
Remove unused getActiveTab selector (#8319)
This selector was added as part of #7004, but wasn't used by the time
it was merged.
2020-04-09 21:17:43 -03:00
Mark Stacey
b628ff05d1
Rewrite checkbox component (#8305)
This new checkbox component uses a plain `input` component internally,
so the browser treats it like a native checkbox. It is styled by hiding
the native checkbox and replacing it with Font Awesome icons (the same
that we are using in Figma).

Support for a 'disabled' state and an indeterminate state has been
added as well. The `onClick` prop has been made optional, as it may not
be required if the parent component is intercepting the click instead.

The `regular` Font Awesome font style needed to be added so that we
could use the `far fa-square` icon for the unchecked checkbox.
2020-04-09 18:51:12 -03:00
Mark Stacey
b0b99fa748
Move action constants to separate module (#8308)
The "global" action constants (the ones previously in `actions.js`)
have been moved to a separate module. This was necessary to avoid a
circular dependency in an upcoming change that was causing problems.

In general the "ducks" pattern of organizing Redux stores does result
in circular dependency problems. This is because reuse of actions
between reducers is encouraged, so it's not uncommon for two reducers
to want to reference an action from the other. Going forward we can
avoid this problem by moving action constants that are shared between
reducers into this shared module.
2020-04-08 21:35:37 -03:00
Whymarrh Whitby
be23ed5b2d
Tidy getAccountsWithLabels selector (#8311) 2020-04-08 20:45:36 -02:30
Whymarrh Whitby
d131014b5e
Fix Connected Sites data selector (#8310)
This change replaces `getRenderablePermissionsDomains` with a new selector `getConnectedDomainsForSelectedAddress` that works better. The data returned from this selector is used to populated the _Connected Sites_ modal, which (as of #8262) didn't use most of the data returned from the old selector.

The old selector only looked at the first address that was exposed, making it not work for anything other than the first account connected to a particular origin.
2020-04-08 20:38:48 -02:30
Mark Stacey
2e67751efe
Delete unused UNLOCK_METAMASK action (#8307)
This action was never triggered in practice, as MetaMask is never
unlocked from the UI. The unlock always occurs as a result of a
background state update.
2020-04-08 10:22:04 -03:00
Mark Stacey
5b64a3d75e
Use ISO-8601 date format for last active time (#8306)
The last active time for each account in the Connected Sites list was
formatted as `yyyy-M-d` (i.e. without the zero-padding for the month
and the day). This didn't match the designs, isn't compliant with
ISO-8601, and generally isn't a common date format.

The month and day are now zero-padded.
2020-04-08 10:21:56 -03:00
Whymarrh Whitby
55228ef08c
Show correct description for empty Connected Sites modal (#8298) 2020-04-08 10:14:54 -02:30
Thomas Huang
a67ac8dd61
Change fa-refresh to fa-sync (#8301)
fa-sync has replaces fa-refresh in version 5 of font-awsome
https://fontawesome.com/icons/sync?style=solid
2020-04-07 14:51:22 -07:00
Whymarrh Whitby
6aa8e78006
Make ConnectedStatusIndicator clickable (#8297) 2020-04-07 18:53:18 -02:30
Whymarrh Whitby
049b98e965
Close Account Details dropdown after opening Connected Sites (#8299) 2020-04-07 18:21:35 -02:30
Dan J Miller
d1e078b8de
Connect flow via popup (#8269)
* Connect screen popup redesign

* Open permission request in notification instead of tab

* Remove no longer user locales

* Update permissions unit test mock to accout for change of opts passed to permissions controller

* Lint fix

* Inline broken line svg in permission-page-container-content.component.js for faster loading

* Add back button to second screen on connect flow

* Add xOfY locale and use for the page count in the connect flow

* Lint fix for svgs permission-page-container-content.component.js

* Fix rebase error

* Lint fix

* Clean up styles on the connect-screen-into-popup branch

* Use closeCurrentWindow to close window on cancel when in full screen connect flow

* Handle errors in rejectPermissionsRequest

* Full screen styles for connect flow

* Lint fixed in permissions-connect and actions.js

* Redirect screen now shows metamask icon instead of users identicon

* Fix subtitle spacing in permissions-connect-header'

* Use window.close instead of closeCurrentWindow() in cancelPermissionsRequest

* Use permissions-connect-header__subtitle in permissions-connect-header.component
2020-04-07 16:08:15 -02:30
Whymarrh Whitby
d8e0c9edd9
Use @metamask/etherscan-link@1.1.0 (#8294) 2020-04-06 13:38:44 -02:30
Mark Stacey
addbf4c62a
Add footer to Popover (#8291)
There were two existing cases where a footer was added to a popover by
putting it in the popover contents. This has been refactored to place
the footer in the popover instead, so that styles common to all
popover footers could be shared.

The popover now has a `section` element instead, giving the `header`
and `footer` elements a correct section context.
2020-04-02 14:43:50 -03:00
Mark Stacey
b09895b8b4
Replace static popover height with responsive max-height (#8290)
The height of the popover is now set to a maximum of 94% of the
viewport height, rather than a static height of 564px. This setting
ensures that the popover has a maximum height of exactly 564px in the
popup, which matches the designs. However it is now able to shrink or
grow to accommodate larger viewports or smaller popovers.
2020-04-02 13:37:46 -03:00
Whymarrh Whitby
f9e8a01dca
Remove z-index from IconWithFallBack (#8289) 2020-04-02 12:48:40 -02:30
Dan J Miller
af24309dc0
Connect screen multi accounts tooltip (#8181)
* Implement tooltip and styled sentence parts on header text of second screen of multi-account-select flow

* Clean up code related to the multi-accounts tooltip implementation
2020-04-02 12:47:10 -02:30
Whymarrh Whitby
09450fe765
Remove selectedAddress from SelectedAccount component (#8285) 2020-04-02 11:49:19 -02:30
Whymarrh Whitby
1b38b4867a
Delete Close icon component (#8286) 2020-04-02 11:49:07 -02:30
Dan J Miller
d8179ff030
Connect Screen Multi Select (#8078)
* Add UI for selecting multiple accounts on the first permissions connect screen

* Make accounts list scrollable on connect screen

* Change title wording on connect screen to 'select your accounts'

* Add select all tooltip to info circle on top of connect screen account list

* Add security info footer to the first screen of the connect flow

* Apply redesigns to page 2 of connect flow

* Display number of accounts on connect flow second screen if there are multiple to connect

* Update e2e tests for connect screen multi-select changes

* Remove unused chooseAnAcount message

* Fix styling/display of redirect elements on second page of connect flow

* Assorted small fixes in permissions connect

* Remove unnecessary tiny delays in spec files

* Remove incorrect use of bem modified in choose-account

* Remove unused locale

* Use Set for managing selected accounts in choose-acount and permissions-connect componets

* Compone!

* Move connect flow header into a reusable component, and implement new header designs

* Update locales and add missing locales

* Improve permission list item design (second screen of connect flow)

* Check box component improvements

* Fixes in variables.scss

* Simplfy code in selectAll of choose-account.component

* Hide checkboxes on first pages on connect flow when there is only one account

* Allow autofill of default new account modal text with right arrow

* Disable next button on first screen of connect flow when no accounts selected

* Improve choose-account/index.scss

* Remove metamask secure graphic

* Fix connect flow redirect screen

* Fix connectToMultiple locale

* Remove locales no longer used after connect flow multiple connect updates

* Fix size of dapp icon on redirect screen of connect flow

* Clean up choose-account code

* Stop using placeholder in new-account-modal

* Remove unused styles in permission-page-container/index.scss

* Pass origin instead of site name to PermissionsConnectHeader in connect flow

* Make iconName a required prop in permissions-connect-header

* Show checkbox in cases where there is one account in the choose-account list

* Do not render select all checkbox when only 1 list item, instead of just hiding it

* Small cleanup in choose-account/index.scss
2020-04-02 06:39:53 -02:30
Mark Stacey
4efa6caec7
Fix home container height (#8284)
* Fix home container height

The home container element's height was not set, so the lower half of
the home component was showing as the wrong color when the user had no
transactions or tokens.

This was broken in #8271, which was a fix for a different CSS problem.
Both problems should remain fixed now with height being set explicitly.

* Remove obsolete `flex` rule

This element is no longer within a flex container as of #8271, so this
rule doesn't do anything.
2020-04-02 00:06:27 -03:00
Whymarrh Whitby
4229892fca
Refactor Menubar and AccountDetailsDropdown styles (#8278) 2020-04-02 00:08:45 -02:30
Whymarrh Whitby
ccf5d5d36c
Undefine Tooltip default wrapperClassName (#8283) 2020-04-01 23:12:19 -02:30
Whymarrh Whitby
e32417d51f
Remove unused 2nd argument to checksumAddress (#8282) 2020-04-01 23:12:03 -02:30
Mark Stacey
12536aa47f
Remove unused isPopup state (#8280)
This property was being set upon each change to background state.
2020-04-01 20:01:47 -03:00
Mark Stacey
44effa0d91
Replace METAMASK_UI_TYPE global with helper function (#8279)
We don't need to store the current UI type as a global. We're already
using the `getEnvironmentType` helper function throughout the UI, so
we'd might as well use that instead of this global state.
2020-04-01 19:28:10 -03:00
Mark Stacey
043ed6cbdb
Restore History title on wide viewport (#8277)
The `History` title above the transaction history was changed in #8264
to only show when there are pending transactions, because it was
redundant to show an additional `History` title below a tab called
`History`. It was preserved when there were pending transactions
because the pending transactions are shown first in the list, followed
by the history, so the title served to divide the two lists.

This ended up breaking the fullscreen view though, which doesn't use
tabs yet. It has been updated to always show on fullscreen.
2020-04-01 18:11:50 -03:00
Whymarrh Whitby
6b6615be27
Enable react/jsx-first-prop-new-line for multiline, single prop JSX (#8276)
* Enable react/jsx-first-prop-new-line for multiline, single prop JSX
* yarn lint --fix
2020-04-01 18:08:19 -02:30
Whymarrh Whitby
8459e8dda1
Don't render the ConnectedStatusIndicator outside of the popup (#8275) 2020-04-01 17:11:42 -02:30
Dan J Miller
d1cd2bb618
Fix centering of account info in menu bar (#8274) 2020-04-01 17:11:26 -02:30