Skip to content

Commit

Permalink
avoid rough consuming OpenURL
Browse files Browse the repository at this point in the history
  • Loading branch information
JarvanMo committed Nov 18, 2023
1 parent 4f74ec5 commit 7630935
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion ios/Classes/FluwxPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,12 @@ - (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDiction
__strong typeof(weakSelf) strongSelf = weakSelf;
[WXApi handleOpenURL:url delegate:strongSelf];
};

// Let's hold this until the PR contributor send feedback.
// if ([url.absoluteString contains:[self fetchWeChatAppId]]){
// return YES;
// } else {
// return NO;
// }

// simply return YES to indicate that we can handle open url request later
return NO;
Expand Down Expand Up @@ -1607,4 +1612,14 @@ - (SendMessageToWXReq *)requestWithText:(NSString *)text
return req;
}

-(NSString*)fetchWeChatAppId{
NSDictionary *infoDic = [[NSBundle mainBundle] infoDictionary];
NSArray* types = infoDic[@"CFBundleURLTypes"];
for(NSDictionary* dic in types){
if([@"weixin" isEqualToString:dic[@"CFBundleURLName"]]){
return dic[@"CFBundleURLSchemes"][0];
}
}
return nil;
}
@end

0 comments on commit 7630935

Please sign in to comment.