Skip to content

Commit

Permalink
Fix URL opening action on iOS (#6384)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandreSi authored Feb 26, 2024
1 parent 3a2a662 commit e345b27
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
5 changes: 5 additions & 0 deletions GDJS/GDJS/Extensions/Builtin/NetworkExtension.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ NetworkExtension::NetworkExtension() {
"gdjs.evtTools.network.enableMetrics");
GetAllActions()["LaunchFile"].SetFunctionName("gdjs.evtTools.window.openURL");

AddDependency()
.SetName("InAppBrowser Cordova plugin")
.SetDependencyType("cordova")
.SetExportName("cordova-plugin-inappbrowser");

StripUnimplementedInstructionsAndExpressions();
}

Expand Down
12 changes: 9 additions & 3 deletions GDJS/Runtime/pixi-renderers/runtimegame-pixi-renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -859,10 +859,16 @@ namespace gdjs {
const electron = this.getElectron();
if (electron) {
electron.shell.openExternal(url);
} else {
} else if (
// @ts-ignore
typeof window.cordova !== 'undefined' &&
// @ts-ignore
const target = window.cordova ? '_system' : '_blank';
window.open(url, target);
typeof window.cordova.InAppBrowser !== 'undefined'
) {
// @ts-ignore
window.cordova.InAppBrowser.open(url, '_system', 'location=yes');
} else {
window.open(url, '_blank');
}
}
}
Expand Down

0 comments on commit e345b27

Please sign in to comment.