Skip to content

Commit

Permalink
fix: updated onDeviceResume method calls in testbed
Browse files Browse the repository at this point in the history
tested √
  • Loading branch information
ethanneff committed Nov 18, 2016
1 parent c69ef56 commit b3593e2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 54 deletions.
37 changes: 9 additions & 28 deletions testbed/www/js.es6/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
'use strict';

// app

var app = {
initialize: function() {
this.bindEvents();
Expand All @@ -11,51 +8,35 @@ var app = {
document.addEventListener('resume', this.onDeviceReady, false);
},
onDeviceReady: function() {
app.branchInit();
BranchInit(true);
},
onDeviceResume: function() {
app.branchInit();
},
branchInit: function() {
// Branch debug
Branch.setDebug(true);

// Branch initialization
Branch.initSession(function(data) {
// read deep link data on click
alert('Deep Link Data: ' + JSON.stringify(data));
});
BranchInit(true);
}
};
app.initialize();

// branch

function BranchInit(isDebug) {
console.log('Trigger BranchInit()');

// for development and debugging only
Branch.setDebug(isDebug);

// sync with mixpanel if installed
// sync with Mixpanel if installed
Branch.setMixpanelToken('your_mixpanel_token');

// init
Branch.initSession(BranchLinkData).then(function(res) {
// Branch initialization
Branch.initSession(function(data) {
// read deep link data on click
console.log('Trigger DeepLinkHandler()');
alert('Deep Link Data: ' + JSON.stringify(data));
}).then(function(res) {
console.log(res);
}).catch(function(err) {
console.error(err);
});

// handler for deep link data
function BranchLinkData(data) {
console.log('Trigger BranchLinkData()');

if (data) {
alert(JSON.stringify(data));
}
}

// optional
Branch.onNonBranchLink(function NonBranchLinkHandler(data) {
console.log('Trigger NonBranchLinkData()');
Expand Down
35 changes: 9 additions & 26 deletions testbed/www/js/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';

// app

var app = {
initialize: function initialize() {
this.bindEvents();
Expand All @@ -11,51 +10,35 @@ var app = {
document.addEventListener('resume', this.onDeviceReady, false);
},
onDeviceReady: function onDeviceReady() {
app.branchInit();
BranchInit(true);
},
onDeviceResume: function onDeviceResume() {
app.branchInit();
},
branchInit: function branchInit() {
// Branch debug
Branch.setDebug(true);

// Branch initialization
Branch.initSession(function (data) {
// read deep link data on click
alert('Deep Link Data: ' + JSON.stringify(data));
});
BranchInit(true);
}
};
app.initialize();

// branch

function BranchInit(isDebug) {
console.log('Trigger BranchInit()');

// for development and debugging only
Branch.setDebug(isDebug);

// sync with mixpanel if installed
// sync with Mixpanel if installed
Branch.setMixpanelToken('your_mixpanel_token');

// init
Branch.initSession(BranchLinkData).then(function (res) {
// Branch initialization
Branch.initSession(function (data) {
// read deep link data on click
console.log('Trigger DeepLinkHandler()');
alert('Deep Link Data: ' + JSON.stringify(data));
}).then(function (res) {
console.log(res);
}).catch(function (err) {
console.error(err);
});

// handler for deep link data
function BranchLinkData(data) {
console.log('Trigger BranchLinkData()');

if (data) {
alert(JSON.stringify(data));
}
}

// optional
Branch.onNonBranchLink(function NonBranchLinkHandler(data) {
console.log('Trigger NonBranchLinkData()');
Expand Down

0 comments on commit b3593e2

Please sign in to comment.