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); }
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); }
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"), });
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); } }