Skip to content

Instantly share code, notes, and snippets.

@sejr
Created March 1, 2017 16:50
Show Gist options
  • Select an option

  • Save sejr/7bc2d31d30ae4c907656b24aa98ec727 to your computer and use it in GitHub Desktop.

Select an option

Save sejr/7bc2d31d30ae4c907656b24aa98ec727 to your computer and use it in GitHub Desktop.
constructor(
platform: Platform,
public af: AngularFire,
public loadingCtrl: LoadingController,
public authData: AuthData,
public storage: Storage,
public menuCtrl: MenuController,
) {
platform.ready().then(() => {
// Okay, so the platform is ready and our plugins are available.
// Here you can do any higher level native things you might need.
this.storage.get('introShown').then((result) => {
if (result) {
const authObserver = af.auth.subscribe( user => {
if (user) {
this.user = af.database.object('/users/' + user.uid);
this.rootPage = HomePage;
authObserver.unsubscribe();
} else {
this.rootPage = LoginPage;
authObserver.unsubscribe();
}
});
} else {
this.rootPage = IntroPage;
this.storage.set('introShown', true);
}
});
StatusBar.styleDefault();
Splashscreen.hide();
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment