/// <summary>
        /// Load and display user profile image
        /// </summary>
        private void GetProfileImage()
        {
            RequestGetProfileImage _request = new RequestGetProfileImage();

            _request.Id   = CurrentUserID;
            _request.Size = EasyProfileManager.Instance.PROFILE_SETTING.ProfileAvatarSize;
            EasyProfileManager.Instance.GetProfileImage(_request, OnProfileImageGetted);
        }
        private void TestsCalls()
        {
            // get system data
            string currentDate = EasyProfileManager.Instance.GetSystemDate();

            // save user login data
            EasyProfileManager.Instance.SaveUserCredentials("*****@*****.**", "password123");
            // check if has user login data
            bool hasSavedCredendtials = EasyProfileManager.Instance.HasSavedCredentials();

            // clear user login data
            EasyProfileManager.Instance.ClearUserCredentials();
            // get saved user login data
            UserCredentials _userCred = EasyProfileManager.Instance.GetSavedCredentials();

            Debug.Log("Login" + _userCred.UserLogin);
            Debug.Log("Password" + _userCred.UserPassword);
            // init firebase
            EasyProfileManager.Instance.InitFirebase(OnFirebaseInited);
            // check is firebase is inited
            bool IsFirebaseInited = EasyProfileManager.Instance.IsFirebaseInited();

            // register new user
            EasyProfileManager.Instance.RegisterNewUser("*****@*****.**", "password123", OnRegistrationComplete);
            // register new user with custom token id
            User _newUser = new User();

            _newUser.DataRegistration = EasyProfileManager.Instance.GetSystemDate();
            _newUser.FirstName        = "First Name";
            _newUser.FullName         = "Full Name";
            _newUser.LastName         = "Last Name";
            _newUser.NickName         = "NickName";
            _newUser.Phone            = "+38093333333";
            EasyProfileManager.Instance.RegisterNewUserWithCustomTokenID("your custom token id", _newUser, OnRegistrationComplete);
            // register new user with custom auth system
            User _newUser3 = new User();

            _newUser3.DataRegistration = EasyProfileManager.Instance.GetSystemDate();
            _newUser3.FirstName        = "First Name";
            _newUser3.FullName         = "Full Name";
            _newUser3.LastName         = "Last Name";
            _newUser3.NickName         = "NickName";
            _newUser3.Phone            = "+38093333333";
            EasyProfileManager.Instance.RegisterNewUserWithCustomAuthSystem("your user id", _newUser3, OnRegistrationComplete);
            // register new user with Credential object
            UserCredentials _userCredential = new UserCredentials();

            _userCredential.UserLogin    = "******";
            _userCredential.UserPassword = "******";
            EasyProfileManager.Instance.RegisterNewUser(_userCredential, OnRegistrationComplete);
            // login user
            EasyProfileManager.Instance.LogIn("*****@*****.**", "password123", OnUserLogined);
            // login user with Credential object
            UserCredentials _userCredential2 = new UserCredentials();

            _userCredential2.UserLogin    = "******";
            _userCredential2.UserPassword = "******";
            EasyProfileManager.Instance.LogIn(_userCredential2, OnUserLogined);
            // login user with custom token id
            EasyProfileManager.Instance.LogInWithCustomTokenID("your custom token id", OnUserLogined);
            // login user with custom auth system
            EasyProfileManager.Instance.LogInWithCustomAuthSystem("your user id", OnUserLogined);
            // upload image avatar
            Texture2D          TestTexture         = null;
            RequestUploadImage _imageUploadRequset = new RequestUploadImage();

            _imageUploadRequset.OwnerId = EasyProfileManager.Instance.PROFILE_CONTROLLER.USER_ID;
            _imageUploadRequset.Texture = TestTexture;
            EasyProfileManager.Instance.UploadAvatar(_imageUploadRequset, OnUploadAvatarImageComplete);
            // get image avatar
            RequestGetProfileImage _imageGetRequest = new RequestGetProfileImage();

            _imageGetRequest.Id   = EasyProfileManager.Instance.PROFILE_CONTROLLER.USER_ID;
            _imageGetRequest.Size = ImageSize.Size_512;
            EasyProfileManager.Instance.GetProfileImage(_imageGetRequest, OnGetProfileImageComplete);
            // get user data
            EasyProfileManager.Instance.GetUserData(OnGetUserDataComplete);
            // get user data by user id
            EasyProfileManager.Instance.GetUserDataByID(EasyProfileManager.Instance.PROFILE_CONTROLLER.USER_ID, OnGetUserDataComplete);
            // send verification mail
            EasyProfileManager.Instance.SendMailVerification(OnVerificationEmailSended);
            // send reset password
            EasyProfileManager.Instance.SendResetPasswordEmail("*****@*****.**", OnResetPasswordToEmailSended);
            // set user data
            User _newUser2 = new User();

            _newUser2.UserID           = "userID"; // get it from registration complete message or login complete message
            _newUser2.DataRegistration = EasyProfileManager.Instance.GetSystemDate();
            _newUser2.FirstName        = "First Name";
            _newUser2.FullName         = "Full Name";
            _newUser2.LastName         = "Last Name";
            _newUser2.NickName         = "NickName";
            _newUser2.Phone            = "+38093333333";
            EasyProfileManager.Instance.SetUserData(_newUser2, OnSetUserDataComplete);
            // get/set user full name
            EasyProfileManager.Instance.GetUserFullName(OnGetUserFullName);
            EasyProfileManager.Instance.GetUserFullNameByID("userID", OnGetUserFullName);
            EasyProfileManager.Instance.SetUserFullName("new value", OnSetUserValueComplete);
            // get/set user last name
            EasyProfileManager.Instance.GetUserLastName(OnGetUserLastName);
            EasyProfileManager.Instance.GetUserLastNameByID("userID", OnGetUserLastName);
            EasyProfileManager.Instance.SetUserLastName("new value", OnSetUserValueComplete);
            // get/set user first name
            EasyProfileManager.Instance.GetUserFirstName(OnGetUserFirstName);
            EasyProfileManager.Instance.GetUserFirstNameByID("userID", OnGetUserFirstName);
            EasyProfileManager.Instance.SetUserFirstName("new value", OnSetUserValueComplete);
            // get/set user nick name
            EasyProfileManager.Instance.GetUserNickName(OnGetUserNickName);
            EasyProfileManager.Instance.GetUserNickNameByID("userID", OnGetUserNickName);
            EasyProfileManager.Instance.SetUserNickName("new value", OnSetUserValueComplete);
            // get/set user phone number
            EasyProfileManager.Instance.GetUserPhone(OnGetUserPhone);
            EasyProfileManager.Instance.GetUserPhoneByID("userID", OnGetUserPhone);
            EasyProfileManager.Instance.SetUserPhone("new value", OnSetUserValueComplete);
            // get user registration date
            EasyProfileManager.Instance.GetUserRegistrationDate(OnGetRegistrationDate);
            EasyProfileManager.Instance.GetUserRegistrationDateByID("userID", OnGetRegistrationDate);
            // get all users
            EasyProfileManager.Instance.GetAllUsers(OnGetAllUsers);
            // log out
            EasyProfileManager.Instance.LogOut(OnLogOut);
            // search user
            EasyProfileManager.Instance.SearchUsers("Jack", OnSearchUserComplete);
            // set user custom data
            EasyProfileManager.Instance.SetCustomValue("Gold", 150, OnSetCustomValueComplete);
            // set user custom data by user id
            EasyProfileManager.Instance.SetCustomValueByUserID("UserID", "Gold", 150, OnSetCustomValueComplete);
            // get user custom data
            EasyProfileManager.Instance.GetCustomValue("Gold", OnGetCustomValueComplete);
            // get user custom data by user id
            EasyProfileManager.Instance.GetCustomValueByUserID("UserID", "Gold", OnGetCustomValueComplete);
            // update activity
            EasyProfileManager.Instance.UpdateUserActivity(OnUpdateActivityComplete);
            // get user activity
            EasyProfileManager.Instance.GetUserLastActivity("UserID", OnActivityGetted);
            // get server timestamp
            EasyProfileManager.Instance.GetServerTimestamp(OnServerTimeStampGetted);


            if (EasyProfileManager.Instance.PROFILE_CONTROLLER.IsLogined())
            {
                // get last saved user data
                User _user = EasyProfileManager.Instance.PROFILE_CONTROLLER.CURRENT_USER_DATA;
                Debug.Log(_user.NickName);
                // get last cached user avatar
                if (EasyProfileManager.Instance.PROFILE_CONTROLLER.PROFILE_IMAGE_LOADED)
                {
                    Texture2D _avatarTexture = EasyProfileManager.Instance.PROFILE_CONTROLLER.CACHED_AVATAR;
                }
                // get firebase user object
                FirebaseUser fUSer = EasyProfileManager.Instance.PROFILE_CONTROLLER.FIREBASE_USER;
                Debug.Log(fUSer.UserId);
                string UserID = EasyProfileManager.Instance.PROFILE_CONTROLLER.USER_ID;
            }
            // show login windows
            EasyProfileManager.Instance.VIEW_CONTROLLER.ShowLogin();
            // show loading windows
            EasyProfileManager.Instance.VIEW_CONTROLLER.ShowLoading();
            // show popup windows
            PopupMessage _popupMSG = new PopupMessage();

            _popupMSG.Callback = OnPopupMessageClosed;
            _popupMSG.Title    = "Some Title";
            _popupMSG.Message  = "Some Message";
            EasyProfileManager.Instance.VIEW_CONTROLLER.ShowPopupMessage(_popupMSG);
            // show registration windows
            EasyProfileManager.Instance.VIEW_CONTROLLER.ShowRegistration();
            // show restore password windows
            EasyProfileManager.Instance.VIEW_CONTROLLER.ShowRestorePassword();
            // show user profile windows
            EasyProfileManager.Instance.VIEW_CONTROLLER.ShowUserProfileView();
        }
Beispiel #3
0
 /// <summary>
 /// Get user avatar image from Firebase Storage.
 /// </summary>
 /// <param name="_request">Request object. Use RequestGetProfileImage _request = new RequestGetProfileImage()</param>
 /// <param name="_callback">Add completion method</param>
 public void GetProfileImage(RequestGetProfileImage _request, Action <CallbackGetProfileImage> _callback = null)
 {
     FIREBASE_CONTROLLER.GetProfileImage(_request, _callback);
 }