From 9217c524429ec44a88b09ca6cf08f575e2b6599e Mon Sep 17 00:00:00 2001 From: Duy Tran Khanh <40482367+khanhduytran0@users.noreply.github.com> Date: Fri, 23 Sep 2022 11:24:14 +0700 Subject: [PATCH] Fix b806c5d: retain authVC for callback to work again --- Natives/LoginViewController.m | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Natives/LoginViewController.m b/Natives/LoginViewController.m index af0bb581..90485ba9 100644 --- a/Natives/LoginViewController.m +++ b/Natives/LoginViewController.m @@ -25,6 +25,7 @@ extern NSMutableDictionary *prefDict; #pragma mark - LoginViewController @interface LoginViewController () {} +@property ASWebAuthenticationSession *authVC; @end @implementation LoginViewController @@ -263,7 +264,7 @@ extern NSMutableDictionary *prefDict; - (void)loginMicrosoft { NSURL *url = [NSURL URLWithString:@"https://login.live.com/oauth20_authorize.srf?client_id=00000000402b5328&response_type=code&scope=service%3A%3Auser.auth.xboxlive.com%3A%3AMBI_SSL&redirect_url=https%3A%2F%2Flogin.live.com%2Foauth20_desktop.srf"]; - ASWebAuthenticationSession *authVC = + self.authVC = [[ASWebAuthenticationSession alloc] initWithURL:url callbackURLScheme:@"ms-xal-00000000402b5328" completionHandler:^(NSURL * _Nullable callbackURL, @@ -292,11 +293,11 @@ extern NSMutableDictionary *prefDict; }]; if (@available(iOS 13.0, *)) { - authVC.prefersEphemeralWebBrowserSession = YES; - authVC.presentationContextProvider = self; + self.authVC.prefersEphemeralWebBrowserSession = YES; + self.authVC.presentationContextProvider = self; } - if ([authVC start] == NO) { + if ([self.authVC start] == NO) { showDialog(self, NSLocalizedString(@"Error", nil), @"Unable to open Safari"); } }