Skip to content
This repository has been archived by the owner on Sep 17, 2024. It is now read-only.

Pre main qa #283

Merged
merged 2 commits into from
Sep 2, 2024
Merged
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
35 changes: 31 additions & 4 deletions lib/features/dapps/subfeatures/open_dapp/open_dapp_presenter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -230,16 +230,43 @@ class OpenDAppPresenter extends CompletePresenter<OpenDAppState> {
final url = await state.webviewController?.getUrl();
final deepLink = navigationAction.request.url;

if (deepLink != null &&
collectLog('checkDeepLink:url ${url.toString()}');
collectLog('checkDeepLink:deepLink ${deepLink.toString()}');

// Discord gg for redirecting to App
if (deepLink != null && (deepLink.host == "discord.gg")) {
return await launchDeepLinking(deepLink, allowNavigation: true);
} else if (deepLink != null &&
url != navigationAction.request.url &&
(deepLink.scheme != 'https' && deepLink.scheme != 'http')) {
_launcherUseCase.launchUrlInExternalApp(deepLink);
return NavigationActionPolicy.CANCEL;
(deepLink.scheme != 'https' &&
deepLink.scheme != 'http' &&
deepLink.scheme != 'data' &&
deepLink.toString() != "about:blank")) {
Uri? modifiedDeepLink;
if (deepLink.scheme == 'intent') {
modifiedDeepLink = deepLink.replace(scheme: 'https');
}
return await launchDeepLinking(modifiedDeepLink ?? deepLink);
}

return NavigationActionPolicy.ALLOW;
}

Future<NavigationActionPolicy> launchDeepLinking(Uri deepLink,
{bool allowNavigation = false}) async {
try {
await _launcherUseCase.launchUrlInExternalApp(deepLink);
} catch (e) {
addError(e.toString());
return NavigationActionPolicy.ALLOW;
}
if (allowNavigation) {
return NavigationActionPolicy.ALLOW;
} else {
return NavigationActionPolicy.CANCEL;
}
}

injectScrollDetector() {
state.webviewController!
.evaluateJavascript(source: JSChannelScripts.overScrollScript);
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 2.4.9
version: 2.5.0

environment:
sdk: ">=2.19.0 <3.0.0"
Expand Down
Loading