コード例 #1
0
 public FirebaseClientSingleton(IFirebaseAuthService firebaseAuthService)
     : base(
         Constants.FIREBASE_REALTIME_DATABASE_BASE_URL,
         new FirebaseOptions()
 {
     AuthTokenAsyncFactory = async() => (await firebaseAuthService.GetAuth()).FirebaseToken
 })
 {
 }
コード例 #2
0
 public async Task SendMessage(string text)
 {
     await _firebaseClient
     .Child("messages")
     .PostAsync(new Message()
     {
         Text   = text,
         Date   = DateTime.Now,
         UserId = (await _firebaseAuthService.GetAuth()).User.Email
     });
 }
コード例 #3
0
        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.");
            }
        }