Skip to content

Commit

Permalink
Update getRootUrl and open_DeeplinkUrl to handle schemaless urls
Browse files Browse the repository at this point in the history
  • Loading branch information
brambrink committed Jan 23, 2024
1 parent 6231200 commit bbc4d88
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
Binary file modified src/DeepLinkModule/[App Store] Deeplink.mpr
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// - the code between BEGIN USER CODE and END USER CODE
// - the code between BEGIN EXTRA CODE and END EXTRA CODE
// Other code you write will be lost the next time you deploy the project.
import "mx-global";
import { Big } from "big.js";

// BEGIN EXTRA CODE
Expand All @@ -16,6 +17,10 @@ import { Big } from "big.js";
*/
export async function Open_DeeplinkURL(deeplinkURL) {
// BEGIN USER CODE
window.open(deeplinkURL.get('URL'),'_blank');
const url = deeplinkURL.get('URL');

if(url.includes("://")) return window.open(url,'_blank');

window.open(window.location.protocol + "//" + url, '_blank')
// END USER CODE
}
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,9 @@ private static String ensureNoStartingSlash(String s) {
private static String getRootUrl(IMxRuntimeRequest request)
{
String url = request.getRootUrl();
String path = ensureStartingSlash(java.net.URI.create(url).getPath());
//When the root URL does not contain a schema, add it anyways
String completeUrl = url.contains("://") ? url : "https://" + url;
String path = ensureStartingSlash(java.net.URI.create(completeUrl).getPath());
if(path.endsWith("/"))
return path.substring(0, path.length() - 1);
return path;
Expand Down

0 comments on commit bbc4d88

Please sign in to comment.