BranchMetrics / cordova-ionic-phonegap-branch-deep-linking-attribution

The Branch Cordova Ionic Phonegap SDK for deep linking and attribution. Branch helps mobile apps grow with deep links / deeplinks that power paid acquisition and re-engagement campaigns, referral programs, content sharing, deep linked emails, smart banners, custom user onboarding, and more.
https://docs.branch.io/apps/cordova-phonegap-ionic/
MIT License
234 stars 144 forks source link

URI Scheme not working on Cold Start #650

Open NassB opened 4 years ago

NassB commented 4 years ago

We are trying to open our iOS application with URI Scheme to redirect users to a specific state, in our handleBranch method we are looking for "+non_branch_link" property in the data returned by initSession().

handleBranch: function () {
                Branch.initSession().then(function (data) {
                    console.warn('### handleBranch ###', data);
                    if (data && data['+clicked_branch_link']) {
                          // do something
                    } else if (data["+non_branch_link"]) {
                        // REDIRECT TO SOME STATE
                    } else {
                        console.log("clicked_branch_link is FALSE");
                    }
                });
}

The content of data is the following on cold start : {+clicked_branch_link: false, +is_first_session: false}

And on next calls data is the following : {+clicked_branch_link: false, +is_first_session: false, +non_branch_link: "profonia://my-profonia.app.link/careservant-din"}

Notice that the non_branch_link property is missing on cold start.

We tried to delay the handleBranch method by one second in app.js with no luck.

It's working fine with Universal Link (branch links https://....) but we need to use URI Scheme.

Branch plugin version : 3.2.0 Cordova iOS : 5.0.1