Created
February 23, 2018 23:14
-
-
Save captaincole/a882e615aa062bba5fa73085adf6b917 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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