예제 #1
0
            static async Task HandleCallbackUri(Uri callbackUri)
            {
                await ViewControllerServices.CloseSFSafariViewController().ConfigureAwait(false);

                var gitHubAuthenticationService = ContainerService.Container.Resolve <GitHubAuthenticationService>();
                await gitHubAuthenticationService.AuthorizeSession(callbackUri, CancellationToken.None).ConfigureAwait(false);
            }
예제 #2
0
            static async Task HandleCallbackUri(Uri callbackUri)
            {
                await ViewControllerServices.CloseSFSafariViewController().ConfigureAwait(false);

                using var scope = ContainerService.Container.BeginLifetimeScope();
                var gitHubAuthenticationService = scope.Resolve <GitHubAuthenticationService>();
                await gitHubAuthenticationService.AuthorizeSession(callbackUri).ConfigureAwait(false);
            }
예제 #3
0
        public Theme GetOperatingSystemTheme()
        {
            var currentUIViewController = ViewControllerServices.GetVisibleViewController();

            var userInterfaceStyle = currentUIViewController.TraitCollection.UserInterfaceStyle;

            return(userInterfaceStyle switch
            {
                UIUserInterfaceStyle.Light => Theme.Light,
                UIUserInterfaceStyle.Dark => Theme.Dark,
                _ => throw new NotSupportedException($"UIUserInterfaceStyle {userInterfaceStyle} not supported"),
            });
예제 #4
0
        public override bool OpenUrl(UIApplication app, NSUrl url, NSDictionary options)
        {
            var callbackUri = new Uri(url.AbsoluteString);

            HandleCallbackUri().SafeFireAndForget(onException: x => Debug.WriteLine(x));

            return(true);

            async Task HandleCallbackUri()
            {
                await ViewControllerServices.CloseSFSafariViewController().ConfigureAwait(false);

                using var scope = ContainerService.Container.BeginLifetimeScope();
                var gitHubAuthenticationService = scope.Resolve <GitHubAuthenticationService>();
                await gitHubAuthenticationService.AuthorizeSession(callbackUri).ConfigureAwait(false);
            }
        }