Skip to content

Instantly share code, notes, and snippets.

@captaincole
Created February 23, 2018 23:14
Show Gist options
  • Select an option

  • Save captaincole/a882e615aa062bba5fa73085adf6b917 to your computer and use it in GitHub Desktop.

Select an option

Save captaincole/a882e615aa062bba5fa73085adf6b917 to your computer and use it in GitHub Desktop.
// sample app.component.js
import { Component } from '@angular/core';
import { Platform } from 'ionic-angular';
import { StatusBar, Splashscreen } from 'ionic-native';
import { TabsPage } from '../pages/tabs/tabs';
// Branch import
declare var Branch;
@Component({
template: `<ion-nav [root]="rootPage"></ion-nav>`
})
export class MyApp {
rootPage = TabsPage;
constructor(platform: Platform) {
platform.ready().then(() => {
StatusBar.styleDefault();
Splashscreen.hide();
branchInit();
});
platform.resume.subscribe(() => {
branchInit();
});
// Branch initialization
const branchInit = () => {
// only on devices
if (!platform.is('cordova')) { return }
Branch.initSession(data => {
// read deep link data on click
doSomethingWithOurDeeplink(data);
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment