public static async Task Logout(ListsActivity thisActivity) { if (AppData.auth.CurrentUser == null) { return; } AppData.auth.SignOut(); AlertShow.Show(thisActivity, "Logged out", "You are now in offline mode"); //reload everything await thisActivity.ReloadListView(); }
public static async Task Login(ListsActivity thisActivity, string inpEmail, string inpPassword) { await AppData.auth.SignInWithEmailAndPasswordAsync(inpEmail, inpPassword); UserClass newLocalUser = new UserClass() { Name = AppData.auth.CurrentUser.DisplayName, Email = AppData.auth.CurrentUser.Email, Uid = AppData.auth.CurrentUser.Uid }; SetLocalUser.Set(newLocalUser); AlertShow.Show(thisActivity, "Welcome " + newLocalUser.Name, "You can now share your lists online"); await thisActivity.ReloadListView(); }
public static async Task Register(ListsActivity thisActivity, string name, string email, string password) { await AppData.auth.CreateUserWithEmailAndPasswordAsync(email, password); var profileUpdate = new UserProfileChangeRequest.Builder() .SetDisplayName(name) .Build(); AppData.auth.CurrentUser.UpdateProfile(profileUpdate); UserClass localUser = new UserClass() { Name = name, Email = email, Uid = AppData.auth.CurrentUser.Uid }; SetLocalUser.Set(localUser); await AppData.usersNode .Child(AppData.auth.CurrentUser.Uid) .PutAsync(localUser); foreach (GroceryListClass any in AppData.currentLists) { if (any.Owner.Uid == AppData.currentUser.Uid) { SaveListOnCloud.Save(any); } } AlertShow.Show(thisActivity, "Welcome " + AppData.currentUser.Name, "You are now registered online and can share your lists with your friends"); await thisActivity.ReloadListView(); }