Commit d0471c88 by ludi

修复fb分享返回码错误的问题

parent d328e912
...@@ -118,6 +118,64 @@ NSString * const FUSSocializedIsSafariLoginKey = @"FUSSocializedIsSafariLoginKey ...@@ -118,6 +118,64 @@ NSString * const FUSSocializedIsSafariLoginKey = @"FUSSocializedIsSafariLoginKey
@implementation FUSThirdAccountLoginHelper @implementation FUSThirdAccountLoginHelper
/**
刷新第三方登录回调使用的 URL Scheme 配置
*/
- (void)fus_refreshSocialPlatformURLKeys
{
NSDictionary *infoDict = [[NSBundle mainBundle] infoDictionary];
NSArray *urlSchemes = [infoDict objectForKey:@"CFBundleURLTypes"];
for (NSDictionary *subDict in urlSchemes) {
NSArray *keyArr = [subDict objectForKey:@"CFBundleURLSchemes"];
for (NSString *urlKey in keyArr) {
NSString *lowercasedKey = urlKey.lowercaseString;
if ([lowercasedKey hasPrefix:@"fb"]) {
self.facebookKey = urlKey;
}
if ([lowercasedKey containsString:@"google"]) {
self.googleKey = urlKey;
}
if ([lowercasedKey containsString:@"twitter"]) {
self.twitterKey = urlKey;
}
if ([lowercasedKey containsString:@"line"]) {
self.lineKey = urlKey;
}
if ([lowercasedKey containsString:@"wx"]) {
self.weixinKey = urlKey;
}
}
}
}
/**
判断回调 URL 是否是 Facebook Scheme
*/
- (BOOL)fus_isFacebookOpenURL:(NSURL *)url
{
if (self.facebookKey.length == 0) {
[self fus_refreshSocialPlatformURLKeys];
}
NSString *scheme = url.scheme.lowercaseString;
NSString *facebookScheme = self.facebookKey.lowercaseString;
if (scheme.length == 0 || ![scheme hasPrefix:@"fb"]) {
return NO;
}
if (facebookScheme.length == 0) {
return YES;
}
return [scheme isEqualToString:facebookScheme];
}
#pragma mark - 获取单例 #pragma mark - 获取单例
/** /**
获取单例 获取单例
...@@ -674,44 +732,18 @@ NSString * const FUSSocializedIsSafariLoginKey = @"FUSSocializedIsSafariLoginKey ...@@ -674,44 +732,18 @@ NSString * const FUSSocializedIsSafariLoginKey = @"FUSSocializedIsSafariLoginKey
self.googleKey.length == 0 || self.googleKey.length == 0 ||
self.twitterKey.length == 0 || self.twitterKey.length == 0 ||
self.lineKey.length == 0) { self.lineKey.length == 0) {
[self fus_refreshSocialPlatformURLKeys];
NSDictionary *infoDict = [[NSBundle mainBundle] infoDictionary];
NSArray *urlSchemes = [infoDict objectForKey:@"CFBundleURLTypes"];
for (NSDictionary *subDict in urlSchemes) {
NSArray *keyArr = [subDict objectForKey:@"CFBundleURLSchemes"];
for (NSString *urlKey in keyArr) {
if ([urlKey hasPrefix:@"fb"]) {
self.facebookKey = urlKey;
}
if ([urlKey containsString:@"google"]) {
self.googleKey = urlKey;
}
if ([urlKey containsString:@"twitter"]) {
self.twitterKey = urlKey;
}
if ([urlKey containsString:@"line"]) {
self.lineKey = urlKey;
}
}
}
} }
FUSLogInfo(@"第三方企图打开:%@",url.absoluteURL); FUSLogInfo(@"第三方企图打开:%@",url.absoluteURL);
if ([url.absoluteString containsString:self.googleKey]) { if ([self fus_isFacebookOpenURL:url]) {
// 是 google 的 key // 是 Facebook 的 Key
return YES; return YES;
} }
if ([url.absoluteString containsString:self.facebookKey]) { if ([url.absoluteString containsString:self.googleKey]) {
// 是 Facebook 的 Key // 是 google 的 key
return YES; return YES;
} }
...@@ -725,6 +757,11 @@ NSString * const FUSSocializedIsSafariLoginKey = @"FUSSocializedIsSafariLoginKey ...@@ -725,6 +757,11 @@ NSString * const FUSSocializedIsSafariLoginKey = @"FUSSocializedIsSafariLoginKey
return YES; return YES;
} }
if ([url.absoluteString hasPrefix:@"fb"]) {
// 是 Facebook 的 Key
return YES;
}
return NO; return NO;
} }
...@@ -804,41 +841,10 @@ NSString * const FUSSocializedIsSafariLoginKey = @"FUSSocializedIsSafariLoginKey ...@@ -804,41 +841,10 @@ NSString * const FUSSocializedIsSafariLoginKey = @"FUSSocializedIsSafariLoginKey
if (self.facebookKey.length == 0 || if (self.facebookKey.length == 0 ||
self.googleKey.length == 0 || self.twitterKey.length == 0 || self.googleKey.length == 0 || self.twitterKey.length == 0 ||
self.lineKey.length == 0 || self.weixinKey.length == 0) { self.lineKey.length == 0 || self.weixinKey.length == 0) {
[self fus_refreshSocialPlatformURLKeys];
NSDictionary *infoDict = [[NSBundle mainBundle] infoDictionary];
NSArray *urlSchemes = [infoDict objectForKey:@"CFBundleURLTypes"];
for (NSDictionary *subDict in urlSchemes) {
NSArray *keyArr = [subDict objectForKey:@"CFBundleURLSchemes"];
for (NSString *urlKey in keyArr) {
if ([urlKey hasPrefix:@"fb"]) {
self.facebookKey = urlKey;
}
if ([urlKey containsString:@"google"]) {
self.googleKey = urlKey;
}
if ([urlKey containsString:@"twitter"]) {
self.twitterKey = urlKey;
} }
if ([urlKey containsString:@"line"]) { if ([self fus_isFacebookOpenURL:url]) {
self.lineKey = urlKey;
}
if ([urlKey containsString:@"wx"]) {
self.weixinKey = urlKey;
}
}
}
}
if ([url.absoluteString containsString:self.facebookKey]) {
return FUSSocializedPlatformFacebook; return FUSSocializedPlatformFacebook;
} }
...@@ -858,6 +864,10 @@ NSString * const FUSSocializedIsSafariLoginKey = @"FUSSocializedIsSafariLoginKey ...@@ -858,6 +864,10 @@ NSString * const FUSSocializedIsSafariLoginKey = @"FUSSocializedIsSafariLoginKey
return FUSSocializedPlatformWeChat; return FUSSocializedPlatformWeChat;
} }
if ([url.absoluteString hasPrefix:@"fb"]) {
return FUSSocializedPlatformFacebook;
}
return 0; return 0;
} }
......
...@@ -251,7 +251,7 @@ extension FUSFacebookHelper: SharingDelegate{ ...@@ -251,7 +251,7 @@ extension FUSFacebookHelper: SharingDelegate{
public func sharerDidCancel(_ sharer: any FBSDKShareKit.Sharing) { public func sharerDidCancel(_ sharer: any FBSDKShareKit.Sharing) {
Settings.shared.appID = FUSConfig.sharedInstanced().sdkConfigs.facebookShareKey Settings.shared.appID = FUSConfig.sharedInstanced().sdkConfigs.facebookShareKey
Settings.shared.clientToken = FUSConfig.sharedInstanced().sdkConfigs.facebookShareSecret Settings.shared.clientToken = FUSConfig.sharedInstanced().sdkConfigs.facebookShareSecret
shareSuccessHandle?() shareFailureHandle?(true)
self.shareSuccessHandle = nil self.shareSuccessHandle = nil
self.shareFailureHandle = nil self.shareFailureHandle = nil
Settings.shared.appID = FUSConfig.sharedInstanced().sdkConfigs.facebookShareKey Settings.shared.appID = FUSConfig.sharedInstanced().sdkConfigs.facebookShareKey
......
...@@ -691,7 +691,7 @@ ...@@ -691,7 +691,7 @@
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
CODE_SIGN_ENTITLEMENTS = FuSiLive/FuSiLive.entitlements; CODE_SIGN_ENTITLEMENTS = FuSiLive/FuSiLive.entitlements;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 20260546; CURRENT_PROJECT_VERSION = 20260547;
DEFINES_MODULE = YES; DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 6GG26BHUMC; DEVELOPMENT_TEAM = 6GG26BHUMC;
ENABLE_ON_DEMAND_RESOURCES = NO; ENABLE_ON_DEMAND_RESOURCES = NO;
...@@ -956,7 +956,7 @@ ...@@ -956,7 +956,7 @@
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
CODE_SIGN_ENTITLEMENTS = FuSiLive/FuSiLive.entitlements; CODE_SIGN_ENTITLEMENTS = FuSiLive/FuSiLive.entitlements;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 20260546; CURRENT_PROJECT_VERSION = 20260547;
DEFINES_MODULE = YES; DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 6GG26BHUMC; DEVELOPMENT_TEAM = 6GG26BHUMC;
ENABLE_ON_DEMAND_RESOURCES = NO; ENABLE_ON_DEMAND_RESOURCES = NO;
......
...@@ -191,6 +191,11 @@ typedef NS_ENUM(NSInteger, FFOutsideJumpAPPType) { ...@@ -191,6 +191,11 @@ typedef NS_ENUM(NSInteger, FFOutsideJumpAPPType) {
return [[FUSThirdAccountLoginHelper sharedInstanse] fus_sociallizedPlatform:platform OpenApplication:app openURL:url options:options]; return [[FUSThirdAccountLoginHelper sharedInstanse] fus_sociallizedPlatform:platform OpenApplication:app openURL:url options:options];
} }
// NSString *urlScheme = url.scheme.lowercaseString;
// if ([urlScheme hasPrefix:@"fb"]) {
// return [[FUSThirdAccountLoginHelper sharedInstanse] fus_sociallizedPlatform:FUSSocializedPlatformFacebook OpenApplication:app openURL:url options:options];
// }
NSString *urlDecodingString = [FUSUrlDecode fus_urlDecodedString:url.absoluteString]; NSString *urlDecodingString = [FUSUrlDecode fus_urlDecodedString:url.absoluteString];
//TODO:看看这是要做咩: added By Pidan //TODO:看看这是要做咩: added By Pidan
if ([urlDecodingString containsString:@"FusiClub://www.fusiclub.com"]) { if ([urlDecodingString containsString:@"FusiClub://www.fusiclub.com"]) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment