示例#1
0
        public async Task <TryResult <string> > FacebookLogin()
        {
            var result = await facebookLoginService.Login();

            if (!result.OperationSucceeded)
            {
                if (result.Result?.LoginState == SocialLoginStateEnum.Canceled)
                {
                    return(TryResult.Create(false, Translator.GetText("FacebookLoginCanceled")));
                }
                if (result.Result?.LoginState == SocialLoginStateEnum.Failed)
                {
                    return(TryResult.Create(false, result.Result?.ErrorString));
                }
            }

            var loginInfo = new LoginInfo
            {
                Fb = new LoginInfo.Types.FacebookInfo
                {
                    Token = result.Result.Token
                }
            };

            var loginResult = await _client.loginAsync(loginInfo, new CallOptions());

            if (loginResult?.Error != null)
            {
                return(TryResult.Create(false, loginResult?.Error?.Message));
            }

            this.timelessTokenService.AuthorizationToken = loginResult.AuthToken;
            return(TryResult.Create(true, string.Empty));
        }
 private void SignIn()
 {
     _facebookLoginService.Login(OnFacebookLoginCompleted);
 }