Skip to content

Commit c1a54e6

Browse files
committed
docs: fixed branch init being called twice because of premissions
1 parent 9a58cb3 commit c1a54e6

File tree

2 files changed

+24
-13
lines changed

2 files changed

+24
-13
lines changed

README.md

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,10 @@
122122
},
123123
branchInit: function() {
124124
// Branch initialization
125-
Branch.initSession(function(data) {
125+
if (data['+clicked_branch_link']) {
126126
// read deep link data on click
127-
alert('Deep Link Data: ' + JSON.stringify(data));
127+
console.log('Trigger DeepLinkHandler()')
128+
alert('Deep Link Data: ' + JSON.stringify(data))
128129
});
129130
}
130131
};
@@ -159,8 +160,10 @@
159160
function branchInit() {
160161
// Branch initialization
161162
Branch.initSession(function(data) {
162-
// read deep link data on click
163-
alert('Deep Link Data: ' + JSON.stringify(data));
163+
if (data['+clicked_branch_link']) {
164+
// read deep link data on click
165+
alert('Deep Link Data: ' + JSON.stringify(data));
166+
}
164167
});
165168
}
166169
});
@@ -202,8 +205,10 @@
202205
// only on devices
203206
if (!platform.is('cordova')) { return }
204207
Branch.initSession(data => {
205-
// read deep link data on click
206-
alert('Deep Link Data: ' + JSON.stringify(data));
208+
if (data['+clicked_branch_link']) {
209+
// read deep link data on click
210+
alert('Deep Link Data: ' + JSON.stringify(data));
211+
}
207212
});
208213
}
209214
}
@@ -256,8 +261,10 @@
256261

257262
// Branch initialization
258263
Branch.initSession(function(data) {
259-
// read deep link data on click
260-
alert('Deep Link Data: ' + JSON.stringify(data))
264+
if (data['+clicked_branch_link']) {
265+
// read deep link data on click
266+
alert('Deep Link Data: ' + JSON.stringify(data))
267+
}
261268
}).then(function(res) {
262269
alert('Response: ' + JSON.stringify(res))
263270
}).catch(function(err) {
@@ -401,8 +408,10 @@
401408
```js
402409
// Branch initialization within your deviceready and resume
403410
Branch.initSession(function(deepLinkData) {
404-
// handler for deep link data on click
405-
alert('Response: ' + JSON.stringify(deepLinkData))
411+
if (data['+clicked_branch_link']) {
412+
// handler for deep link data on click
413+
alert('Response: ' + JSON.stringify(deepLinkData))
414+
}
406415
})
407416
```
408417

testbed/www/js/index.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,11 @@ function BranchInit (isDebug) {
3535

3636
// Branch initialization
3737
Branch.initSession(function (data) {
38-
// read deep link data on click
39-
console.log('Trigger DeepLinkHandler()')
40-
alert('Deep Link Data: ' + JSON.stringify(data))
38+
if (data['+clicked_branch_link']) {
39+
// read deep link data on click
40+
console.log('Trigger DeepLinkHandler()')
41+
alert('Deep Link Data: ' + JSON.stringify(data))
42+
}
4143
}).then(function (res) {
4244
console.log(res)
4345
}).catch(function (err) {

0 commit comments

Comments
 (0)