diff --git a/lib/apis/sign_api/sign_engine.dart b/lib/apis/sign_api/sign_engine.dart index 49085640..85941160 100644 --- a/lib/apis/sign_api/sign_engine.dart +++ b/lib/apis/sign_api/sign_engine.dart @@ -75,6 +75,13 @@ class SignEngine implements ISignEngine { return; } + final validation = await WalletConnectUtils.validateRedirect( + metadata.redirect, + ); + if (validation != null) { + core.logger.e(validation); + } + await core.pairing.init(); await core.verify.init(verifyUrl: metadata.verifyUrl); await proposals.init(); diff --git a/lib/apis/utils/walletconnect_utils.dart b/lib/apis/utils/walletconnect_utils.dart index 4c605ecc..1a273906 100644 --- a/lib/apis/utils/walletconnect_utils.dart +++ b/lib/apis/utils/walletconnect_utils.dart @@ -214,6 +214,7 @@ class WalletConnectUtils { ); if (metaDataValue == null) { return 'CFBundleURLTypes\'s key is missing on iOS\'s Info.plist.\n' + 'If you want deep linking to work this key must be added.\n' 'Check out https://docs.walletconnect.com/web3wallet/mobileLinking on how to include it'; } final properties = metaDataValue as List; @@ -224,13 +225,17 @@ class WalletConnectUtils { final universalLink = redirect?.universal ?? ''; if (nativeSchema.isEmpty && universalLink.isEmpty) { return 'No metadata.redirect object has been set\n' - 'Check out https://docs.walletconnect.com/web3wallet/wallet-usage#initialization'; + 'If you want deep linking to work redirect object must be set.\n' + 'Check out https://docs.walletconnect.com/web3wallet/wallet-usage#initialization '; } if (nativeSchema.isEmpty) { return 'Metadata\'s native redirect value has not been set\n' - 'Check out https://docs.walletconnect.com/web3wallet/wallet-usage#initialization'; + 'Check out https://docs.walletconnect.com/web3wallet/wallet-usage#initialization '; } final uri = Uri.parse(nativeSchema); + if (uri.scheme.isEmpty) { + return 'Metadata\'s native redirect must be a valid scheme. E.g.: example:// '; + } if (!plistSchemas.contains(uri.scheme)) { return 'Metadata\'s native redirect ($uri) is not included under CFBundleURLSchemes\'s key.\n' 'Check out https://docs.walletconnect.com/web3wallet/mobileLinking on how to include it'; @@ -239,7 +244,7 @@ class WalletConnectUtils { } return null; } catch (e) { - return 'Web3Wallet: failed to get iOS configuration: $e'; + return 'Failed to get iOS configuration: $e'; } } } diff --git a/lib/apis/web3app/web3app.dart b/lib/apis/web3app/web3app.dart index 487a50ca..11f1167c 100644 --- a/lib/apis/web3app/web3app.dart +++ b/lib/apis/web3app/web3app.dart @@ -131,13 +131,6 @@ class Web3App implements IWeb3App { return; } - final validation = await WalletConnectUtils.validateRedirect( - metadata.redirect, - ); - if (validation != null) { - core.logger.e(validation); - } - await core.start(); await signEngine.init(); await authEngine.init(); diff --git a/lib/apis/web3wallet/web3wallet.dart b/lib/apis/web3wallet/web3wallet.dart index 9b879e5d..1f3b44a7 100644 --- a/lib/apis/web3wallet/web3wallet.dart +++ b/lib/apis/web3wallet/web3wallet.dart @@ -124,13 +124,6 @@ class Web3Wallet implements IWeb3Wallet { return; } - final validation = await WalletConnectUtils.validateRedirect( - metadata.redirect, - ); - if (validation != null) { - core.logger.e(validation); - } - await core.start(); await signEngine.init(); await authEngine.init();