Skip to content

Commit

Permalink
长版本号判断
Browse files Browse the repository at this point in the history
  • Loading branch information
yanmao committed Apr 26, 2020
1 parent d2b9c21 commit b1ec696
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion WeChatExtension/WeChatExtension/Sources/Hook/WeChat+hook.m
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ - (void)hook_handleWebViewDataItem:(id)arg1 windowId:(id)arg2 {
WebViewDataItem *item = (WebViewDataItem *)arg1;
if ([[TKWeChatPluginConfig sharedConfig] systemBrowserEnable]) {
MMURLHandler *urlHander = [objc_getClass("MMURLHandler") defaultHandler];
if (LargerOrEqualVersion(@"2.4.0")) {
if (LargerOrEqualLongVersion(@"2.4.0.149")) {
[urlHander openURLWithDefault:item.urlString];
} else if (LargerOrEqualVersion(@"2.3.26")) {
[urlHander openURLWithDefault:item.urlString useA8Key:NO];
Expand Down
4 changes: 2 additions & 2 deletions WeChatExtension/WeChatExtension/Sources/Utils/YMUtility.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
#import <Foundation/Foundation.h>

#define LargerOrEqualVersion(version) [YMUtility isLargerOrEqualVersion:version]
#define LargerOrEqualLongVersion(version) [YMUtility isLargeOrEqualLongVersion:version]
NS_ASSUME_NONNULL_BEGIN

@interface YMUtility : NSObject

+ (BOOL)isLargerOrEqualVersion:(NSString *)version;

+ (BOOL)isLargeOrEqualLongVersion:(NSString *)version;
@end

NS_ASSUME_NONNULL_END
10 changes: 10 additions & 0 deletions WeChatExtension/WeChatExtension/Sources/Utils/YMUtility.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,14 @@ + (BOOL)isLargerOrEqualVersion:(NSString *)version
return YES;
}
}

+ (BOOL)isLargeOrEqualLongVersion:(NSString *)version
{
NSDictionary *dict = [NSBundle mainBundle].infoDictionary;
if ([dict[@"MMBundleVersion"] compare:version options:NSNumericSearch] == NSOrderedAscending) {
return NO;
} else {
return YES;
}
}
@end

0 comments on commit b1ec696

Please sign in to comment.