Skip to content

Commit

Permalink
docs: updated Ionic 1 and Ionic 2 code snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanneff authored Feb 16, 2017
1 parent 6905169 commit 417a9b6
Showing 1 changed file with 27 additions and 7 deletions.
34 changes: 27 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,21 @@
StatusBar.styleDefault();
}
// Branch initialization
Branch.initSession(function(data) {
// read deep link data on click
alert('Deep Link Data: ' + JSON.stringify(data));
// Branch
$ionicPlatform.on('deviceready', function(){
branchInit();
});
$ionicPlatform.on('resume', function(){
branchInit();
});
function branchInit() {
// Branch initialization
Branch.initSession(function(data) {
// read deep link data on click
alert('Deep Link Data: ' + JSON.stringify(data));
});
}
});
})
// ...
Expand All @@ -176,6 +186,7 @@
import { Component } from '@angular/core';
import { Platform } from 'ionic-angular';
import { StatusBar, Splashscreen } from 'ionic-native';
import { TabsPage } from '../pages/tabs/tabs';
// Branch import
Expand All @@ -191,13 +202,22 @@
platform.ready().then(() => {
StatusBar.styleDefault();
Splashscreen.hide();
BranchInit();
});
// Branch initialization
Branch.initSession(function(data) {
platform.resume.subscribe(() => {
BranchInit();
});
// Branch initialization
function BranchInit() {
// only on devices
if (platform.is('core')) { return }
Branch.initSession(data => {
// read deep link data on click
alert('Deep Link Data: ' + JSON.stringify(data));
});
});
}
}
}
```
Expand Down

0 comments on commit 417a9b6

Please sign in to comment.