Skip to content
This repository has been archived by the owner on Oct 4, 2023. It is now read-only.

[PAY-1742] Remove useMetaMask on invalid account #3920

Merged
merged 1 commit into from
Aug 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/web/src/common/store/account/sagas.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,10 @@ export function* fetchAccountAsync({ isSignUp = false }) {
reason: 'ACCOUNT_NOT_FOUND'
})
)
if (!isNativeMobile) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I know @rickyrombo was seeing some Sentry errors with localStorage recently on Safari mobile. Just wondering if it's safe to always clear this regardless of whether we've actually set it and if there were any learnings from that issue we should apply here to fail safely if localStorage isn't accessible?

Copy link
Member Author

Choose a reason for hiding this comment

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

Tested on ios safari. it seems ok. i thought about getting & then removing if it exists, but it's just strictly more work because the implementation of remove per spec is

https://html.spec.whatwg.org/multipage/webstorage.html


The removeItem(key) method steps are:

If this's map[key] does not exist, then return null.

Set oldValue to this's map[key].

Remove this's map[key].

Reorder this.

Broadcast this with key, oldValue, and null.

const localStorage = yield getContext('localStorage')
yield call([localStorage, 'removeItem'], 'useMetaMask')
}
return
}
if (account.is_deactivated) {
Expand Down
2 changes: 1 addition & 1 deletion packages/web/src/components/banner/Web3ErrorBanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const messages = {
}

const META_MASK_SETUP_URL =
'https://medium.com/@audius/configuring-metamask-for-use-with-audius-91e24bf6840'
'https://help.audius.co/help/configuring-metamask-for-use-with-audius-2d446'

/**
* Displays an error banner if the user is trying to use Metamask but it's configured incorrectly
Expand Down
1 change: 0 additions & 1 deletion packages/web/src/hooks/useTabs/useTabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,6 @@ const BodyContainer = memo(
dimensionsAreDirty,
didSetDimensions
}: BodyContainerProps) => {
console.log('hmm', elements, activeIndex)
raymondjacobson marked this conversation as resolved.
Show resolved Hide resolved
// Get a ref to the element to use for calculating height
const {
containerWidth,
Expand Down
2 changes: 1 addition & 1 deletion packages/web/src/pages/sign-on/SignOnProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const messages = {
}

const META_MASK_SETUP_URL =
'https://support.audius.co/help/Configuring-MetaMask-For-Use-With-Audius'
'https://help.audius.co/help/configuring-metamask-for-use-with-audius-2d446'

type OwnProps = {
children: ComponentType<MobileSignOnProps> | ComponentType<DesktopSignOnProps>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,6 @@ const animatedStyle = {
}
}

/**
* TODO: When the user selects the metamask option, set the localStorage key 'useMetaMask' to true
* Reference the setup function in Audius backend. A new instance of Audiusbackend will have to be created
*/
const SignOnPage = ({
title,
description,
Expand Down