Skip to content

Commit

Permalink
If enable wallet is broken while in iframe and using pjs, prompt user…
Browse files Browse the repository at this point in the history
… to go to chat page instead
  • Loading branch information
teodorus-nathaniel committed Aug 29, 2024
1 parent 8b4f592 commit b41cf5a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/stores/my-account.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { waitNewBlock } from '@/utils/blockchain'
import { currentNetwork } from '@/utils/network'
import { wait } from '@/utils/promise'
import { LocalStorage, LocalStorageAndForage } from '@/utils/storage'
import { isWebNotificationsEnabled } from '@/utils/window'
import { getIsInIframe, isWebNotificationsEnabled } from '@/utils/window'
import { Wallet, WalletAccount, getWallets } from '@talismn/connect-wallets'
import dayjs from 'dayjs'
import toast from 'react-hot-toast'
Expand Down Expand Up @@ -635,6 +635,15 @@ export async function enableWallet({
if (typeof unsub === 'function') unsub()
}
} catch (err) {
if (getIsInIframe() && preferredWallet.title === 'Polkadot.js') {
toast.custom((t) => (
<Toast
t={t}
title='Please retry this action in "Chat" page'
description='Click on "Chat" menu in the sidebar and retry your action in that page'
/>
))
}
console.error('Error enabling wallet', err)
onError(err)
}
Expand Down

0 comments on commit b41cf5a

Please sign in to comment.