async void OnInsertContactClicked() { if (string.IsNullOrEmpty(Name)) { dialogHelper.ShowMessageDialog("Name cannot be empty!"); return; } if (string.IsNullOrEmpty(EmailID)) { dialogHelper.ShowMessageDialog("Email ID cannot be empty!"); return; } var resultInsert = await FirebaseServiceHelper.Instance.InsetContact(new Contact { Name = Name, EmailID = EmailID }); if (resultInsert.Success) { RefreshContacts(); } else { dialogHelper.ShowMessageDialog("Insert failed!"); } }
async void OnLoginClicked() { if (string.IsNullOrEmpty(EmailID)) { dialogHelper.ShowMessageDialog("Email ID cannot be empty!"); return; } if (!Utility.Utility.IsValidEmailID(EmailID)) { dialogHelper.ShowMessageDialog("Invalid Email ID format!"); return; } if (string.IsNullOrEmpty(Password)) { dialogHelper.ShowMessageDialog("Password cannot be empty!"); return; } var response = await FirebaseServiceHelper.Instance.Login(new Model.User { EmailID = EmailID, Password = Password }); if (response.Success == false) { dialogHelper.ShowMessageDialog("Login failed."); } else if (response.Code == Utility.Code.EmailNotVerified) { dialogHelper.ShowMessageDialog("Email NOT Verified."); } else { navigationService.Navigate("Home", null); navigationService.ClearHistory(); } }
async void OnRegisterClicked() { if (string.IsNullOrEmpty(Username)) { dialogHelper.ShowMessageDialog("Username cannot be empty!"); return; } if (string.IsNullOrEmpty(EmailID)) { dialogHelper.ShowMessageDialog("Email ID cannot be empty!"); return; } if (!Utility.Utility.IsValidEmailID(EmailID)) { dialogHelper.ShowMessageDialog("Invalid Email ID format!"); return; } if (string.IsNullOrEmpty(Password)) { dialogHelper.ShowMessageDialog("Password cannot be empty!"); return; } if (string.IsNullOrEmpty(RetypePassword)) { dialogHelper.ShowMessageDialog("Retype Password cannot be empty!"); return; } if (!Password.Equals(RetypePassword, StringComparison.CurrentCulture)) { dialogHelper.ShowMessageDialog("Password mismatch!"); return; } Registering = true; bool result = await FirebaseServiceHelper.Instance.Register(new Model.User { EmailID = EmailID, Password = Password, Username = Username }); Registering = false; if (result) { dialogHelper.ShowMessageDialog("Verification link sent to your email address. Please verify to activate your account."); } }