Skip to content

Commit 6e84333

Browse files
authored
Merge pull request #314 from BranchMetrics/fix-duplicate-deep-link-data
Fix duplicate deep link data
2 parents fb0cc07 + da818e2 commit 6e84333

File tree

5 files changed

+12
-6
lines changed

5 files changed

+12
-6
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,6 @@
9090

9191
## Publish
9292

93-
- Pull reques code review from a Branch team member
93+
- Pull request code review from a Branch team member
9494

9595
- Merges will automatically add SDK to NPM

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "branch-cordova-sdk",
33
"description": "Branch Metrics Cordova SDK",
44
"main": "www/branch.js",
5-
"version": "2.5.13",
5+
"version": "2.5.14",
66
"homepage": "https://github.com/BranchMetrics/cordova-ionic-phonegap-branch-deep-linking",
77
"repository": {
88
"type": "git",

plugin.template.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ SOFTWARE.
2424
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
2525
xmlns:android="http://schemas.android.com/apk/res/android"
2626
id="branch-cordova-sdk"
27-
version="2.5.13">
27+
version="2.5.14">
2828

2929
<!-- DO NOT EDIT THIS FILE. MAKE ALL CHANGES TO plugin.template.xml INSTEAD -->
3030

plugin.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ SOFTWARE.
2424
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
2525
xmlns:android="http://schemas.android.com/apk/res/android"
2626
id="branch-cordova-sdk"
27-
version="2.5.13">
27+
version="2.5.14">
2828

2929
<!-- DO NOT EDIT THIS FILE. MAKE ALL CHANGES TO plugin.template.xml INSTEAD -->
3030

src/branch.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,21 @@ Branch.prototype.disableGlobalListenersWarnings = function () {
3737

3838
Branch.prototype.initSession = function (deepLinkDataListener) {
3939
// private method to filter out +clicked_branch_link = false in deep link callback
40+
var previous = ''
4041
var deepLinkDataParser = function (deepLinkData) {
4142
var isBranchLink = '+clicked_branch_link'
4243
var isNonBranchLink = '+non_branch_link'
44+
// TODO: figure out why iOS SDK passes data twice on Ionic 2 terminated and no network connection
45+
var isNewData = JSON.stringify(deepLinkData) !== previous
46+
var isBranchLinkClick = deepLinkData.hasOwnProperty(isBranchLink) && deepLinkData[isBranchLink] === true
47+
var isNonBranchLinkClick = deepLinkData.hasOwnProperty(isNonBranchLink)
4348

44-
// +clicked_branch_link' = true || +non_branch_link
45-
if ((deepLinkData.hasOwnProperty(isBranchLink) && deepLinkData[isBranchLink] === true) || (deepLinkData.hasOwnProperty(isNonBranchLink))) {
49+
// is +clicked_branch_link' = true || +non_branch_link
50+
if (isNewData && (isBranchLinkClick || isNonBranchLinkClick)) {
4651
// to Branch.initSession(function(data) {})
4752
deepLinkDataListener(deepLinkData)
4853
}
54+
previous = JSON.stringify(deepLinkData)
4955
}
5056

5157
if (!disableGlobalListenersWarnings && !deepLinkDataListener && !window.DeepLinkHandler) {

0 commit comments

Comments
 (0)