launchConnectedWallet method
Opens the native wallet selectedWallet after connected
Implementation
@override
void launchConnectedWallet() async {
_checkInitialized();
final walletInfo = explorerService.instance.getConnectedWallet();
if (walletInfo == null) {
// if walletInfo is null could mean that either
// 1. There's no wallet connected (shouldn't happen)
// 2. Wallet is connected on another device through qr code
return;
}
final isCoinbase = _currentSession!.sessionService.isCoinbase == true;
if (walletInfo.isCoinbase || isCoinbase) {
// Coinbase Wallet is getting launched at every request by it's own SDK
// SO no need to do it here.
return;
}
if (_currentSession!.sessionService.isMagic) {
// There's no wallet to launch when connected with Email
return;
}
final metadataRedirect = _currentSession!.peer?.metadata.redirect;
final walletRedirect = explorerService.instance.getWalletRedirect(
walletInfo,
);
if (walletRedirect == null) {
return;
}
try {
final link = metadataRedirect?.native ?? metadataRedirect?.universal;
urlUtils.instance.openRedirect(
walletRedirect.copyWith(mobile: link),
pType: platformUtils.instance.getPlatformType(),
);
} catch (e) {
onModalError.broadcast(ErrorOpeningWallet());
}
}