Ejemplo n.º 1
0
        public void Login(Authenticator authenticator)
        {
            authenticator.Completed += AuthenticatorCompleted;

            rootViewController = UIKit.UIApplication.SharedApplication.KeyWindow.RootViewController;
            rootViewController.PresentViewController(authenticator.GetUI(), true, null);
        }
Ejemplo n.º 2
0
        public virtual void OpenUrl(Uri url)
        {
            if (url == null)
            {
                throw new ArgumentNullException(nameof(url));
            }

#if Android
            var mgr = new Android.Support.CustomTabs.CustomTabsActivityManager((Android.App.Activity)_context);

            mgr.CustomTabsServiceConnected += delegate
            {
                mgr.LaunchUrl(url.ToString());
            };

            mgr.BindService();

            return;
#elif iOS
            Foundation.NSUrl destination = Foundation.NSUrl.FromString(url.AbsoluteUri);

            using (SafariServices.SFSafariViewController sfViewController = new SafariServices.SFSafariViewController(destination))
            {
                UIKit.UIWindow window = UIKit.UIApplication.SharedApplication.KeyWindow;

                UIKit.UIViewController controller = window.RootViewController;

                controller.PresentViewController(sfViewController, true, null);

                return;
            }
#else
            if (_deviceService.RuntimePlatform == RuntimePlatform.Android || _deviceService.RuntimePlatform == RuntimePlatform.iOS)
            {
                throw new InvalidOperationException($"Register {nameof(DefaultBrowserService)} using platform specific {nameof(IPlatformInitializer)}");
            }

            _deviceService.OpenUri(url);
#endif
        }