Skip to content

Commit

Permalink
fix: hide ui
Browse files Browse the repository at this point in the history
  • Loading branch information
IsaccoSordo committed Sep 20, 2024
1 parent c53a043 commit c522979
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
1 change: 1 addition & 0 deletions packages/beacon-core/src/utils/multi-tab-channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ type BCMessageType =
| 'DISCONNECT'
| 'REQUEST_PAIRING'
| 'RESPONSE_PAIRING'
| 'HIDE_UI'
| BeaconMessageType

type BCMessage = {
Expand Down
16 changes: 12 additions & 4 deletions packages/beacon-dapp/src/dapp-client/DAppClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,9 @@ export class DAppClient extends Client {
case 'RESPONSE_PAIRING':
this.handlePairingResponse(message.data)
break
case 'HIDE_UI':
this.hideUI(message.data)
break
default:
logger.error('onBCMessageHandler', 'message type not recognized', message)
}
Expand Down Expand Up @@ -535,15 +538,20 @@ export class DAppClient extends Client {
const { message, connectionInfo } = await this.makeRequest<
PermissionRequest,
PermissionResponse
>(request).catch((err) => {
throw new Error(err.message)
})
>(request)

await this.hideUI(['toast'])

const accountInfo = await this.onNewAccount(message, connectionInfo)
await this.accountManager.addAccount(accountInfo)
// todo output

this.walletConnectTransport?.connect()

this.multiTabChannel.postMessage({
type: 'HIDE_UI',
recipient,
data: ['alert', 'toast']
})
})
.catch(console.error)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export class WalletConnectTransport<

public async connect(): Promise<void> {
if ([TransportStatus.CONNECTED, TransportStatus.CONNECTING].includes(this._isConnected)) {
this.isReady.isPending() && this.isReady.resolve(true)
return
}

Expand Down

0 comments on commit c522979

Please sign in to comment.