launchCurrentWallet method
Future<void>
launchCurrentWallet(
)
override
Implementation
@override
Future<void> launchCurrentWallet() async {
_checkInitialized();
if (_session == null) {
return;
}
final Redirect? redirect = _constructRedirect();
LoggerUtil.logger.i(
'Launching wallet: $redirect, ${_session?.peer.metadata}',
);
if (redirect == null) {
await urlUtils.instance.launchUrl(
Uri.parse(
_session!.peer.metadata.url,
),
);
} else {
// Get the native and universal URLs and add the 'wc' to the end
// in the redirect.
final String nativeUrl =
coreUtils.instance.createSafeUrl(redirect.native ?? '');
final String universalUrl =
coreUtils.instance.createPlainUrl(redirect.universal ?? '');
await urlUtils.instance.launchRedirect(
nativeUri: Uri.parse(
'${nativeUrl}wc?sessionTopic=${_session!.topic}',
),
universalUri: Uri.parse(
'${universalUrl}wc?sessionTopic=${_session!.topic}',
),
);
}
}