isInstalled method

  1. @override
Future<bool> isInstalled(
  1. String? uri, {
  2. String? id,
})
override

Implementation

@override
Future<bool> isInstalled(String? uri, {String? id}) async {
  if (uri == null || uri.isEmpty) {
    return false;
  }

  // If the wallet is just a generic wc:// then it is not installed
  if (uri.contains('wc://')) {
    return false;
  }

  if (PlatformUtils.canDetectInstalledApps()) {
    final p = PlatformUtils.getPlatformExact();
    try {
      if (p == PlatformExact.android) {
        return await _androidAppCheck(uri);
      } else if (p == PlatformExact.ios) {
        return await ReownCoreUtils.canOpenUrl(Uri.parse(uri).toString());
      }
    } on FormatException catch (e) {
      if (id != null) {
        _core.logger.i('[$runtimeType] $uri ($id): ${e.message}');
      } else {
        _core.logger.i('[$runtimeType] $uri: ${e.message}');
      }
    } catch (e) {
      rethrow;
    }
  }

  return false;
}