11
11
12
12
ASWebAuthenticationSession *_authSession;
13
13
14
- // Remove the global automation mode variable
15
- static NSString* _pendingRedirectScheme = nil;
16
-
17
14
@implementation ImmutableMac
18
15
19
16
- (instancetype)init {
@@ -66,7 +63,7 @@ static NSString* _pendingRedirectScheme = nil;
66
63
// For automation, use the browser-based method
67
64
if (GIsAutomationTesting) {
68
65
NSLog (@" Using automation mode for authentication (GIsAutomationTesting is true)" );
69
- [self launchUrlInBrowser:url forRedirectUri:redirectUri ];
66
+ [self launchUrlInBrowser:url];
70
67
return ;
71
68
}
72
69
@@ -107,7 +104,7 @@ static NSString* _pendingRedirectScheme = nil;
107
104
}
108
105
}
109
106
110
- - (void )launchUrlInBrowser:(const char *)url forRedirectUri:( const char *)redirectUri {
107
+ - (void )launchUrlInBrowser:(const char *)url {
111
108
// Add redundant check to ensure this only runs for automated testing
112
109
if (!GIsAutomationTesting) {
113
110
return ;
@@ -116,29 +113,6 @@ static NSString* _pendingRedirectScheme = nil;
116
113
// Create URL object
117
114
NSURL *URL = [NSURL URLWithString:[[NSString alloc] initWithUTF8String:url]];
118
115
119
- // Extract the callback scheme from redirect URI
120
- NSString *redirectUriString = [[NSString alloc] initWithUTF8String:redirectUri];
121
- NSString *callbackURLScheme = [[redirectUriString componentsSeparatedByString:@" :" ] objectAtIndex:0 ];
122
-
123
- // Store the redirect scheme for use when handling the callback
124
- _pendingRedirectScheme = callbackURLScheme;
125
-
126
- // Register for custom URL scheme notifications (will need to be implemented in AppDelegate)
127
- [[NSNotificationCenter defaultCenter] addObserverForName:@" ImmutableCustomURLSchemeCallback"
128
- object:nil
129
- queue:[NSOperationQueue mainQueue]
130
- usingBlock:^(NSNotification *notification) {
131
- if (notification.userInfo ) {
132
- NSString *callbackURLString = notification.userInfo [@" url" ];
133
- if (callbackURLString) {
134
- UImmutablePassport* passport = [ImmutableMac getPassport];
135
- if (passport) {
136
- passport->HandleDeepLink (callbackURLString);
137
- }
138
- }
139
- }
140
- }];
141
-
142
116
// Open URL in default browser
143
117
[[NSWorkspace sharedWorkspace] openURL:URL];
144
118
NSLog (@" Opened URL in browser for automation: %@" , URL);
0 commit comments