Skip to content

Commit

Permalink
Merge pull request #700 from airgap-it/fix/other_wallet
Browse files Browse the repository at this point in the history
Fix/other wallet
  • Loading branch information
AndreasGassmann authored Jan 11, 2024
2 parents 5f5cb97 + 6ab9337 commit 70ed3c0
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 18 deletions.
6 changes: 6 additions & 0 deletions assets/logos/beacon_logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 6 additions & 6 deletions packages/beacon-dapp/src/dapp-client/DAppClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,6 @@ import {
PermissionResponseV3,
BeaconBaseMessage,
AcknowledgeResponse,
App,
DesktopApp,
ExtensionApp,
WebApp,
ExtendedWalletConnectPairingResponse,
ProofOfEventChallengeRequest,
ProofOfEventChallengeResponse,
Expand All @@ -66,7 +62,11 @@ import {
ProofOfEventChallengeRecordedMessageInput,
ChangeAccountRequest,
PeerInfoType,
AppBase
App,
AppBase,
DesktopApp,
ExtensionApp,
WebApp
// PermissionRequestV3
// RequestEncryptPayloadInput,
// EncryptPayloadResponseOutput,
Expand Down Expand Up @@ -114,10 +114,10 @@ import {
setExtensionList,
setWebList,
setiOSList,
getiOSList,
getDesktopList,
getExtensionList,
getWebList,
getiOSList,
isBrowser,
isDesktop
} from '@airgap/beacon-ui'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,13 @@ export interface StorageKeyReturnType {
[StorageKey.TRANSPORT_POSTMESSAGE_PEERS_WALLET]: ExtendedPostMessagePairingResponse[]
[StorageKey.TRANSPORT_WALLETCONNECT_PEERS_DAPP]: ExtendedWalletConnectPairingResponse[]
[StorageKey.LAST_SELECTED_WALLET]:
| { key: string; type: 'extension' | 'mobile' | 'web' | 'desktop'; icon: string }
| {
key: string
name: string
type: 'extension' | 'mobile' | 'web' | 'desktop'
icon: string
url?: string
}
| undefined
[StorageKey.ACCOUNTS]: AccountInfo[]
[StorageKey.ACTIVE_ACCOUNT]: AccountIdentifier | undefined
Expand Down
3 changes: 3 additions & 0 deletions packages/beacon-ui/src/ui/alert/getDefautlLogo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default function getDefaultLogo(): string {
return 'data:image/svg+xml;base64,PHN2ZyBpZD0iZjYzZTk1YTktZmQxOS00NDg3LWJjMWEtMDllYjJmMDY2NzA0IiBkYXRhLW5hbWU9Ikd1aWRlcyIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB3aWR0aD0iNjUiIGhlaWdodD0iNjUiIHZpZXdCb3g9IjAgMCA2NSA2NSI+CiAgICA8dGl0bGU+IGJlYWNvbl9sb2dvPC90aXRsZT4KICAgIDxwYXRoIHN0eWxlPSJmaWxsOiByZ2IoMjYsIDEyOCwgMjUwKTsiIGQ9Ik01OS42NiwyOS41MnYxLjA2YzAsLjM3LS4xOCw5LjA3LTQuMTEsMTUuODhTNDQuMTYsNTcuNzUsNDMuODQsNTcuOTNsLS45MS41NC0xLjYxLS45My05LjE5LTUuM2ExNC42OCwxNC42OCwwLDAsMS0xLjYzLTEuMDZoMGExNC4wOSwxNC4wOSwwLDAsMS0xLjI5LTEsMTcuNjMsMTcuNjMsMCwwLDEtMi41Ni0yLjcsMTguNTgsMTguNTgsMCwwLDEtMi41Ni00LjUxLDIxLjUzLDIxLjUzLDAsMCwxLTEuNS05LDYuMjEsNi4yMSwwLDAsMSwyLjkzLS43M2MuMjUsMCwuNDksMCwuNzQsMGExOC4yOSwxOC4yOSwwLDAsMCwxLDcuOTMsMTUuMDYsMTUuMDYsMCwwLDAsNi42Nyw4bDguOTMsNS4xNmMuMi0uMTMuNDMtLjMuNjgtLjQ4LDIuMjYtMS42LDYuNDItNC45Miw4Ljg2LTkuMTNDNTUuMTIsMzkuOTQsNTUuOCwzNCw1NiwzMS41N2wtMy43OS0yLjE5YTIzLDIzLDAsMCwwLC42LTMuODNaIiAvPgogICAgPHBhdGggc3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LjE5LDAsMjEuNDksMjEuNDksMCwwLDEsOC41NSwzLjI0LDYuMjksNi4yOSwwLDAsMS0xLjI1LDMuNTEsMTcuOSwxNy45LDAsMCwwLTcuMy0zLjA2QTE1LjE0LDE1LjE0LDAsMCwwLDE4LDI2LjRaIi8+Cjwvc3ZnPgo='
}
27 changes: 16 additions & 11 deletions packages/beacon-ui/src/ui/alert/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import { getTzip10Link } from '../../utils/get-tzip10-link'
import { isAndroid, isIOS, isMobileOS, isTwBrowser } from '../../utils/platform'
import { getColorMode } from '../../utils/colorMode'
import PairOther from '../../components/pair-other/pair-other'
import getDefaultLogo from './getDefautlLogo'

const logger = new Logger('Alert')

Expand Down Expand Up @@ -463,6 +464,7 @@ const openAlert = async (config: AlertConfig): Promise<string> => {
StorageKey.LAST_SELECTED_WALLET,
JSON.stringify({
key: wallet.key,
name: wallet.name,
type: 'web',
icon: currentWallet()?.image
})
Expand Down Expand Up @@ -498,6 +500,7 @@ const openAlert = async (config: AlertConfig): Promise<string> => {
StorageKey.LAST_SELECTED_WALLET,
JSON.stringify({
key: wallet.key,
name: wallet.name,
type: 'mobile',
icon: currentWallet()?.image
})
Expand Down Expand Up @@ -563,15 +566,6 @@ const openAlert = async (config: AlertConfig): Promise<string> => {
}
}

localStorage.setItem(
StorageKey.LAST_SELECTED_WALLET,
JSON.stringify({
key: wallet.key,
type: 'mobile',
icon: currentWallet()?.image
})
)

setIsLoading(false)
} else {
setIsLoading(false)
Expand All @@ -582,7 +576,15 @@ const openAlert = async (config: AlertConfig): Promise<string> => {

const handleClickOther = async () => {
analytics()?.track('click', 'ui', 'other wallet')

localStorage.setItem(
StorageKey.LAST_SELECTED_WALLET,
JSON.stringify({
key: 'wallet',
name: 'wallet',
type: 'mobile',
icon: getDefaultLogo()
})
)
setCurrentInfo('qr')
}

Expand Down Expand Up @@ -619,6 +621,7 @@ const openAlert = async (config: AlertConfig): Promise<string> => {
StorageKey.LAST_SELECTED_WALLET,
JSON.stringify({
key: currentWallet()?.key,
name: currentWallet()?.name,
type: 'extension',
icon: currentWallet()?.image
})
Expand Down Expand Up @@ -647,6 +650,7 @@ const openAlert = async (config: AlertConfig): Promise<string> => {
StorageKey.LAST_SELECTED_WALLET,
JSON.stringify({
key: currentWallet()?.key,
name: currentWallet()?.name,
type: 'desktop',
icon: currentWallet()?.image
})
Expand All @@ -671,6 +675,7 @@ const openAlert = async (config: AlertConfig): Promise<string> => {
StorageKey.LAST_SELECTED_WALLET,
JSON.stringify({
key: currentWallet()?.key,
name: currentWallet()?.name,
type: 'mobile',
icon: currentWallet()?.image
})
Expand All @@ -681,7 +686,7 @@ const openAlert = async (config: AlertConfig): Promise<string> => {
currentWallet()?.supportedInteractionStandards?.includes('wallet_connect') || false
}
isMobile={isMobile}
walletName={currentWallet()?.name || 'AirGap'}
walletName={currentWallet()?.name || 'wallet'}
code={codeQR()}
onClickLearnMore={handleClickLearnMore}
onClickQrCode={handleClickQrCode}
Expand Down

0 comments on commit 70ed3c0

Please sign in to comment.