diff options
Diffstat (limited to 'android/app/src/main/java/io')
| -rw-r--r-- | android/app/src/main/java/io/coinos/app/LauncherActivity.java | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/android/app/src/main/java/io/coinos/app/LauncherActivity.java b/android/app/src/main/java/io/coinos/app/LauncherActivity.java new file mode 100644 index 0000000..d0b56bb --- /dev/null +++ b/android/app/src/main/java/io/coinos/app/LauncherActivity.java @@ -0,0 +1,27 @@ +package io.coinos.app; + +import android.net.Uri; + +/** + * Forwards scheme intents into the web app. A lightning:/bitcoin:/nostr:/ + * lnurl: URI arrives as this activity's data; the web app receives it as + * https://v3.coinos.io/?u=<encoded original URI> and routes it (send form + * for payments, profile for nostr npubs). https links to the site pass + * through untouched, everything else opens the default URL. + */ +public class LauncherActivity + extends com.google.androidbrowserhelper.trusted.LauncherActivity { + + @Override + protected Uri getLaunchingUrl() { + Uri data = getIntent().getData(); + if (data != null) { + String scheme = data.getScheme(); + if (scheme != null && !scheme.equals("https") && !scheme.equals("http")) { + return Uri.parse("https://v3.coinos.io/?u=" + Uri.encode(data.toString())); + } + if ("v3.coinos.io".equals(data.getHost())) return data; + } + return super.getLaunchingUrl(); + } +} |
