コード例 #1
0
            public override void DidFinish(SFSafariViewController controller)
            {
                var nav = controller.ParentViewController.NavigationController;

                controller.DismissViewController(true, null);
                nav.PopViewController(false);
            }
        public void DidFinish(SFSafariViewController controller)
        {
            controller.DismissViewController(true, null);

            if (returnedUriReady != null)
            {
                authorizationResult = AuthorizationResult.FromStatus(AuthorizationStatus.UserCancel);
                returnedUriReady.Release();
            }
        }
コード例 #3
0
        public void DidFinish(SFSafariViewController controller)
        {
            controller.DismissViewController(true, null);

            if (ReturnedUriReady != null)
            {
                AuthorizationResult = new AuthorizationResult(AuthorizationStatus.UserCancel, null);
                ReturnedUriReady.Release();
            }
        }
コード例 #4
0
        public async Task <AuthorizationResult> AcquireAuthorizationAsync(Uri authorizationUri, Uri redirectUri,
                                                                          CallState callState)
        {
            returnedUriReady = new SemaphoreSlim(0);
            Authenticate(authorizationUri, redirectUri, callState);
            await returnedUriReady.WaitAsync().ConfigureAwait(false);

            //dismiss safariviewcontroller
            this.parameters.CallerViewController.InvokeOnMainThread(() =>
                                                                    { safariViewController.DismissViewController(false, null); });

            return(authorizationResult);
        }
コード例 #5
0
        private async void FinishAuthentication(NSNotification notification)
        {
            sfViewController.DismissViewController(true, null);

            try
            {
                string url = notification.Object.ToString();

                if (url.Contains("access_token"))
                {
                    BTProgressHUD.Show("Checking your credentials...", -1, ProgressHUD.MaskType.Clear);

                    string accessToken = url.Split('#')[1].Split('=')[1].Split('&')[0];
                    string tokenType   = url.Split('=')[2].Split('&')[0];
                    string expiresIn   = url.Split('=')[3];

                    Console.WriteLine("Access Token = " + accessToken);

                    userModel = await loginManager.GetUserById(accessToken);

                    if (tokenModel == null)
                    {
                        tokenModel = new TokenModel();
                        tokenModel.access_token = accessToken;
                        tokenModel.userName     = userModel.userName;
                        tokenModel.expires_in   = Int32.Parse(expiresIn);
                        tokenModel.token_type   = tokenType;
                        tokenModel.expires      = DateTime.Now.AddSeconds(tokenModel.expires_in);
                    }

                    CredentialsService.SaveCredentials(tokenModel, userModel);

                    Console.WriteLine("User = "******"User Logged!");
                }

                if (url.Contains("#error=access_denied"))
                {
                    BTProgressHUD.Dismiss();
                }
            }
            catch (Exception ex)
            {
                BTProgressHUD.Dismiss();
                Utils.HandleException(ex);
            }
        }
コード例 #6
0
        public async Task <AuthorizationResult> AcquireAuthorizationAsync(Uri authorizationUri, Uri redirectUri,
                                                                          RequestContext requestContext)
        {
            UIViewController vc = null;

            InvokeOnMainThread(() => {
                UIWindow window = UIApplication.SharedApplication.KeyWindow;
                vc = FindCurrentViewController(window.RootViewController);
            });

            returnedUriReady = new SemaphoreSlim(0);
            Authenticate(authorizationUri, redirectUri, vc, requestContext);
            await returnedUriReady.WaitAsync().ConfigureAwait(false);

            //dismiss safariviewcontroller
            vc.InvokeOnMainThread(() =>
                                  { safariViewController.DismissViewController(false, null); });

            return(authorizationResult);
        }
コード例 #7
0
 public void DidFinish(SFSafariViewController controller)
 {
     controller.DismissViewController(true, null);
     SetAuthorizationResult(new AuthorizationResult(AuthorizationStatus.UserCancel, null));
 }
コード例 #8
0
 public override void DidFinish(SFSafariViewController controller)
 {
     controller.DismissViewController(true, null);
 }