Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ sealed class AppKitModalWalletListing with _$AppKitModalWalletListing {
required String homepage,
@JsonKey(name: 'image_id') required String imageId,
required int order,
@JsonKey(name: 'application_id') String? applicationId,
@JsonKey(name: 'mobile_link') String? mobileLink,
@JsonKey(name: 'desktop_link') String? desktopLink,
@JsonKey(name: 'link_mode') String? linkMode,
Expand Down

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ class ExplorerService with ExplorerStorage implements IExplorerService {
customWallet = customWallet.copyWith(listing: listing);
final installed = await _uriService.isInstalled(
customWallet.listing.mobileLink,
applicationId: customWallet.listing.applicationId,
);
if (installed || customWallet.listing.webappLink != null) {
customWallet = customWallet.copyWith(installed: true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'package:reown_appkit/modal/utils/platform_utils.dart';
import 'package:reown_appkit/modal/services/explorer_service/models/redirect.dart';

abstract class IUriService {
Future<bool> isInstalled(String? uri, {String? id});
Future<bool> isInstalled(String? uri, {String? id, String? applicationId});

Future<bool> launchUrl(Uri url, {dynamic mode});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,15 @@ import 'package:reown_appkit/modal/services/explorer_service/models/redirect.dar

class UriService extends IUriService {
UriService({required IReownCore core}) : _core = core;

final IReownCore _core;

@override
Future<bool> isInstalled(String? uri, {String? id}) async {
Future<bool> isInstalled(
String? uri, {
String? id,
String? applicationId,
}) async {
if (uri == null || uri.isEmpty) {
return false;
}
Expand All @@ -25,7 +30,7 @@ class UriService extends IUriService {
final p = PlatformUtils.getPlatformExact();
try {
if (p == PlatformExact.android) {
return await _androidAppCheck(uri);
return await _androidAppCheck(uri, applicationId);
} else if (p == PlatformExact.ios) {
return await ReownCoreUtils.canOpenUrl(Uri.parse(uri).toString());
}
Expand Down Expand Up @@ -96,11 +101,31 @@ class UriService extends IUriService {
}
}

Future<bool> _androidAppCheck(String uri) async {
Future<bool> _androidAppCheck(String uri, String? applicationId) async {
try {
final installed = await AppCheck().isAppInstalled(uri);
final enabled = await AppCheck().isAppEnabled(uri);
return installed || enabled;
bool installed = false;
if (applicationId != null && applicationId.isNotEmpty) {
installed = await AppCheck().isAppInstalled(applicationId);
}
if (installed) {
return true;
}

installed = await AppCheck().isAppInstalled(uri);
if (installed) {
return true;
}

bool enabled = false;
if (applicationId != null && applicationId.isNotEmpty) {
enabled = await AppCheck().isAppEnabled(applicationId);
}
if (enabled) {
return true;
}

enabled = await AppCheck().isAppEnabled(uri);
return enabled;
} catch (e) {
return false;
}
Expand Down
Loading