public override void ViewDidAppear(bool animated)
        {
            base.ViewDidAppear(animated);
                         
            if (!isShown)
            {
                isShown = true;

                var authUrl = new Uri(WebAPI.BaseURI, loginPage.AuthProvider.Url);
                var auth = new SocialLoginAuthenticator(authUrl, WebAPI.BaseURI); 

                auth.Completed += async (sender, eventArgs) =>
                {
                    DismissViewController(true, null);
                    isShown = false;

                    if (eventArgs.IsAuthenticated)
                    {
                        await loginPage.CompleteLoginAsync(eventArgs.Account.Properties["access_token"]);
                    }
                    else
                    {
                        Debug.WriteLine("LoginPage failed to authenticate or was canceled.");                        
                        await loginPage.CancelLoginAsync();
                    }
                };

                PresentViewController(auth.GetUI(), true, null);

            }
        }
Esempio n. 2
0
        public override void ViewDidAppear(bool animated)
        {
            base.ViewDidAppear(animated);

            if (!isShown)
            {
                isShown = true;

                var authUrl = new Uri(WebAPI.BaseURI, loginPage.AuthProvider.Url);
                var auth    = new SocialLoginAuthenticator(authUrl, WebAPI.BaseURI);

                auth.Completed += async(sender, eventArgs) =>
                {
                    DismissViewController(true, null);
                    isShown = false;

                    if (eventArgs.IsAuthenticated)
                    {
                        await loginPage.CompleteLoginAsync(eventArgs.Account.Properties["access_token"]);
                    }
                    else
                    {
                        Debug.WriteLine("LoginPage failed to authenticate or was canceled.");
                        await loginPage.CancelLoginAsync();
                    }
                };

                PresentViewController(auth.GetUI(), true, null);
            }
        }