private async void LoginWithFacebook(string id, string email, string name, string profilePicture)
        {
            UserApiRequest user = new UserApiRequest();

            user.RegisterProfileId = id;
            user.Email             = email;
            user.Name           = name;
            user.ProfilePicture = new ImageApiRequest()
            {
                Url = profilePicture
            };
            user.RegisterType = (int)ERegisterType.FACEBOOK;

            var response = await UserApiService.Login(user);

            if (ResponseValidator.Validate(response))
            {
                AppStatus.UserLogged = response;
                CheckUserLogged();
                StopLoading();
            }
            else
            {
                StopLoading();
            }
        }
示例#2
0
        private async void LoginWithFacebook(Profile profile, string email)
        {
            try
            {
                StartLoading();

                UserApiRequest user = new UserApiRequest();

                user.Name              = profile.Name.ToString();
                user.RegisterType      = (int)ERegisterType.FACEBOOK;
                user.RegisterProfileId = profile.Id.ToString();
                user.Email             = email;

                user.ProfilePicture     = new ImageApiRequest();
                user.ProfilePicture.Url = profile.GetProfilePictureUri(200, 200).ToString();

                var response = await UserApiService.Login(user);

                if (ResponseValidator.Validate(response, this))
                {
                    AppStatus.UserLogged = response;
                    CheckUserLogged();
                }
                else
                {
                    StopLoading();
                }
            }
            catch (Exception exception)
            {
                InsightsUtils.LogException(exception);
            }
        }