Created
January 18, 2022 09:32
-
-
Save saimon24/ac95eabf44179a0bade744fc7ec7f99a 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
import { NgModule } from '@angular/core'; | |
import { BrowserModule } from '@angular/platform-browser'; | |
import { RouteReuseStrategy } from '@angular/router'; | |
import { IonicModule, IonicRouteStrategy } from '@ionic/angular'; | |
import { AppComponent } from './app.component'; | |
import { AppRoutingModule } from './app-routing.module'; | |
import { initializeApp, provideFirebaseApp } from '@angular/fire/app'; | |
import { environment } from '../environments/environment'; | |
import { provideAuth, getAuth } from '@angular/fire/auth'; | |
import { provideFirestore, getFirestore } from '@angular/fire/firestore'; | |
import { provideStorage, getStorage } from '@angular/fire/storage'; | |
import { Capacitor } from '@capacitor/core'; | |
import { indexedDBLocalPersistence, initializeAuth } from 'firebase/auth'; | |
import { getApp } from 'firebase/app'; | |
@NgModule({ | |
declarations: [AppComponent], | |
entryComponents: [], | |
imports: [ | |
BrowserModule, | |
IonicModule.forRoot(), | |
AppRoutingModule, | |
provideFirebaseApp(() => initializeApp(environment.firebase)), | |
provideAuth(() => { | |
if (Capacitor.isNativePlatform()) { | |
return initializeAuth(getApp(), { | |
persistence: indexedDBLocalPersistence, | |
}); | |
} else { | |
return getAuth(); | |
} | |
}), | |
provideFirestore(() => getFirestore()), | |
provideStorage(() => getStorage()), | |
], | |
providers: [{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy }], | |
bootstrap: [AppComponent], | |
}) | |
export class AppModule {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment