public FirebaseClientSingleton(IFirebaseAuthService firebaseAuthService) : base( Constants.FIREBASE_REALTIME_DATABASE_BASE_URL, new FirebaseOptions() { AuthTokenAsyncFactory = async() => (await firebaseAuthService.GetAuth()).FirebaseToken }) { }
public async Task SendMessage(string text) { await _firebaseClient .Child("messages") .PostAsync(new Message() { Text = text, Date = DateTime.Now, UserId = (await _firebaseAuthService.GetAuth()).User.Email }); }
private async void CheckAuthAndRedirect() { try { var auth = await _firebaseAuthService.GetAuth(); if (auth == null) { MainPage = new NavigationPage(new LoginView()); } else { MainPage = new NavigationPage(new MessageView()); } } catch (Exception ex) { HandleStartupException(ex, "Error refreshing authentication. Please log in again."); } }