예제 #1
0
        public bool OpenUrlCallback(Uri uri)
        {
            // If we aren't waiting on a task, don't handle the url
            if (tcsResponse?.Task?.IsCompleted ?? true)
            {
                return(false);
            }

            try
            {
                // If we can't handle the url, don't
                if (!WebUtils.CanHandleCallback(redirectUri, uri))
                {
                    return(false);
                }

                currentViewController?.DismissViewControllerAsync(true);
                currentViewController = null;

                tcsResponse.TrySetResult(new WebAuthenticatorResult(uri));
                return(true);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
            return(false);
        }
예제 #2
0
        public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
        {
            var storyboard       = UIStoryboard.FromName("Main", null);
            var detailController = (PostingInfoViewController)storyboard.InstantiateViewController("PostingInfoViewController");

            detailController.Post = savedListings[indexPath.Row];

            detailController.ItemDeleted += async(sender, e) => {
                await owner.DismissViewControllerAsync(true);

                await AppDelegate.databaseConnection.DeletePostingAsync(savedListings[indexPath.Row]);

                savedListings.RemoveAt(indexPath.Row);
                tableView.DeleteRows(new [] { indexPath }, UITableViewRowAnimation.Fade);
                Console.WriteLine(AppDelegate.databaseConnection.StatusMessage);
            };

            owner.PresentViewController(detailController, true, null);
        }
예제 #3
0
        public virtual async Task <bool> CloseModalViewController(UIViewController viewController, MvxModalPresentationAttribute attribute)
        {
            if (viewController == null)
            {
                return(true);
            }

            if (viewController is UINavigationController modalNavController)
            {
                foreach (var item in modalNavController.ViewControllers)
                {
                    item.DidMoveToParentViewController(null);
                }
            }

            await viewController.DismissViewControllerAsync(attribute.Animated);

            ModalViewControllers.Remove(viewController);
            return(true);
        }
        private async void AuthenticatorOnCompleted(object sender,
                                                    AuthenticatorCompletedEventArgs authenticatorCompletedEventArgs)
        {
            await _viewController.DismissViewControllerAsync(false).ConfigureAwait(true);

            if (authenticatorCompletedEventArgs == null || !authenticatorCompletedEventArgs.IsAuthenticated ||
                authenticatorCompletedEventArgs.Account?.Properties == null ||
                authenticatorCompletedEventArgs.Account.Properties.Count < 2)
            {
                AuthenticatorOnError(sender, authenticatorCompletedEventArgs);
                return;
            }

            var properties = authenticatorCompletedEventArgs.Account.Properties;
            var identity   = new Identity();

            identity.AddClaims(new Claim(Claim.AccessTokenName, properties["access_token"]));
            identity.ExtractFromIdentityToken(properties["id_token"]);

            await StoreAndUpdateIdentityAsync(identity).ConfigureAwait(true);
        }
예제 #5
0
 public virtual async void UnlockWasCancelledForPadLockScreen(BaseLockScreenController padLockScreenController)
 {
     await parent.DismissViewControllerAsync(true);
 }