public UserModel(string userID, string name, string phone, Constants.UserType userType = Constants.UserType.User) { this.userID = userID; this.name = name; this.phone = phone; this.userType = userType.ToString(); appoitments = new Dictionary <string, object> (); messages = new Dictionary <string, object> (); }
public void CreateNewUserWithEmailAndPassword(string name, string phone, string email, string password, Constants.UserType userType, Delegates.CreateNewUser success, Delegates.GeneralListenerFail fail) { auth.CreateUserWithEmailAndPasswordAsync(email, password).ContinueWith(task => { if (task.IsCanceled) { Debug.LogError("CreateUserWithEmailAndPasswordAsync was canceled."); fail("Criação cancelada"); return; } if (task.IsFaulted) { fail(GetErrorMessage(task.Exception.InnerExceptions [0] as FirebaseException)); Debug.LogError("CreateUserWithEmailAndPasswordAsync encountered an error: " + task.Exception); return; } // Firebase user has been created. user = task.Result; if (userType == Constants.UserType.User) { DataManager.currentUser = FireBaseManager.GetFireBaseInstance().CreateNewUser(auth.CurrentUser.UserId, name, phone); } var profile = new Firebase.Auth.UserProfile { DisplayName = name }; UpdateUserProfile(profile); success(user.UserId); Debug.LogFormat("Firebase user created successfully: {0} ({1})", user.DisplayName, user.UserId); }); }