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.instance.canDetectInstalledApps()) {
    final p = platformUtils.instance.getPlatformExact();
    try {
      if (p == PlatformExact.android) {
        return await androidAppCheck(uri);
      } else if (p == PlatformExact.iOS) {
        return await canLaunchUrlFunc(Uri.parse(uri));
      }
    } on FormatException catch (e) {
      if (id != null) {
        loggerService.instance.d('[$runtimeType] $uri ($id): ${e.message}');
      } else {
        loggerService.instance.d('[$runtimeType] $uri: ${e.message}');
      }
    } catch (e) {
      rethrow;
    }
  }

  return false;
}