Skip to content
This repository was archived by the owner on Jul 22, 2024. It is now read-only.

Commit fe7d6c8

Browse files
authored
Get deeplink URL from launch intent. Works around #3066 (#3067)
1 parent 96e0fa0 commit fe7d6c8

File tree

2 files changed

+28
-4
lines changed

2 files changed

+28
-4
lines changed

app/src/common/shared/org/mozilla/vrbrowser/VRBrowserActivity.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,26 @@ void loadFromIntent(final Intent intent) {
525525
Log.e(LOGTAG,"Loading from crash Intent");
526526
}
527527

528+
// FIXME https://github.com/MozillaReality/FirefoxReality/issues/3066
529+
if (DeviceType.isOculusBuild()) {
530+
Bundle bundle = intent.getExtras();
531+
if (bundle != null) {
532+
String cmd = (String) bundle.get("intent_cmd");
533+
if ((cmd != null) && (cmd.length() > 0)) {
534+
try {
535+
JSONObject object = new JSONObject(cmd);
536+
JSONObject launch = object.getJSONObject("ovr_social_launch");
537+
String msg = launch.getString("deeplink_message");
538+
Log.d(LOGTAG, "deeplink message: " + msg);
539+
onAppLink(msg);
540+
return;
541+
} catch (Exception ex) {
542+
Log.e(LOGTAG, "Error parsing deeplink JSON: " + ex.toString());
543+
}
544+
}
545+
}
546+
}
547+
528548
Uri uri = intent.getData();
529549

530550
boolean openInWindow = false;

app/src/oculusvr/cpp/DeviceDelegateOculusVR.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -825,10 +825,14 @@ DeviceDelegateOculusVR::ProcessEvents() {
825825
}
826826
break;
827827
case ovrMessage_Notification_ApplicationLifecycle_LaunchIntentChanged: {
828-
auto details = ovr_ApplicationLifecycle_GetLaunchDetails();
829-
const char *msg = ovr_LaunchDetails_GetDeeplinkMessage(details);
830-
if (msg) {
831-
VRBrowser::OnAppLink(msg);
828+
ovrLaunchDetailsHandle details = ovr_ApplicationLifecycle_GetLaunchDetails();
829+
if (ovr_LaunchDetails_GetLaunchType(details) == ovrLaunchType_Deeplink) {
830+
const char* msg = ovr_LaunchDetails_GetDeeplinkMessage(details);
831+
if (msg) {
832+
// FIXME see https://github.com/MozillaReality/FirefoxReality/issues/3066
833+
// Currently handled in VRBrowserActivity.loadFromIntent()
834+
// VRBrowser::OnAppLink(msg);
835+
}
832836
}
833837
break;
834838
}

0 commit comments

Comments
 (0)