Store firebase login locally

We have an app that uses firebase to log people in for a local chat app. The app doesn’t store the login locally though, so that a lot of the time especially on a slow connection the user sees the login screen and thinks they have been logged out. The app then finds their account and jumps to their account screen, which is a pretty jarring experience.

I’ve had a look online and can’t seem to find what i need, can anyone point me in the right direction?

thanks

Are you using Firebase Authentication and angularfire2?

hi, yes I’m using both.

I have an AuthService that I inject into the AppComponent. In the AppComponent's ngOnInit() I subscribe to the authState:

  public ngOnInit() {

    this.platform.ready().then(() => {

      ...

      this.authSubscription = this.authService.afAuth.authState.subscribe(subscriber => {

        if (subscriber) {
          this.rootPage = 'TabsPage';
        } else {
          this.rootPage = 'SignInPage';
        }

      }, () => {
        this.logger.error('AppComponent: rootPage = SignInPage');
        this.rootPage = 'SignInPage';
      });

    });

  }

While loading the PWA display’s a splash screen. For example, Android:

iOS:

That looks great, i’ll check it out thanks!