Last active
November 22, 2020 18:13
-
-
Save username0x0a/ed96f5e7382ac3fbca6ab430d02bf05b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma clang diagnostic push | |
#pragma clang diagnostic ignored "-Wundeclared-selector" | |
+ (void)initialize | |
{ | |
[super initialize]; | |
#if __IPHONE_13_0 | |
// IOS-13-TODO: Work-around for Facebook SDK to force-use Safari auth session | |
// instead of AuthServices session as this requires specific | |
// presentation context in iOS 13 | |
if (isIOS13) | |
[self swizzleSelector:@selector(swiz_fbsdkbridgeapi_opURLWAuthSess:) ofClass:self | |
withSelector:@selector(_openURLWithAuthenticationSession:) ofClass:NSClassFromString(@"FBSDKBridgeAPI")]; | |
#endif | |
} | |
- (void)swiz_fbsdkbridgeapi_opURLWAuthSess:(NSURL *)url | |
{ | |
id val = [self valueForKey:@"_authenticationSession"]; | |
if (val) [val cancel]; | |
NSString *urlScheme = [NSClassFromString(@"FBSDKInternalUtility") performSelector:@selector(appURLScheme)]; | |
SFAuthenticationSession *_authenticationSession = [[SFAuthenticationSession alloc] initWithURL:url | |
callbackURLScheme:urlScheme | |
completionHandler:[self valueForKey:@"_authenticationSessionCompletionHandler"]]; | |
[self setValue:@YES forKey:@"_isRequestingSFAuthenticationSession"]; | |
[self setValue:_authenticationSession forKey:@"_authenticationSession"]; | |
[_authenticationSession start]; | |
} | |
#pragma clang diagnostic pop |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment