mirror of
https://github.com/Sunnyyoung/WeChatTweak-macOS.git
synced 2025-05-24 07:16:10 +08:00
Merge pull request #223 from JeasonL/feature/miniprogram
Fix open new WeChat and miniprogram conflict in WeChat beta2.4.0
This commit is contained in:
commit
e0754504e8
|
@ -27,4 +27,4 @@ SPEC CHECKSUMS:
|
||||||
|
|
||||||
PODFILE CHECKSUM: fb1b1e412c5f88813595570bd6f951a741cda575
|
PODFILE CHECKSUM: fb1b1e412c5f88813595570bd6f951a741cda575
|
||||||
|
|
||||||
COCOAPODS: 1.8.4
|
COCOAPODS: 1.9.1
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<dict>
|
||||||
<key>BuildMachineOSBuild</key>
|
<key>BuildMachineOSBuild</key>
|
||||||
<string>19B88</string>
|
<string>19C57</string>
|
||||||
<key>CFBundleDevelopmentRegion</key>
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
<string>en</string>
|
<string>en</string>
|
||||||
<key>CFBundleExecutable</key>
|
<key>CFBundleExecutable</key>
|
||||||
|
@ -27,17 +27,17 @@
|
||||||
<key>DTCompiler</key>
|
<key>DTCompiler</key>
|
||||||
<string>com.apple.compilers.llvm.clang.1_0</string>
|
<string>com.apple.compilers.llvm.clang.1_0</string>
|
||||||
<key>DTPlatformBuild</key>
|
<key>DTPlatformBuild</key>
|
||||||
<string>11B500</string>
|
<string>11E146</string>
|
||||||
<key>DTPlatformVersion</key>
|
<key>DTPlatformVersion</key>
|
||||||
<string>GM</string>
|
<string>GM</string>
|
||||||
<key>DTSDKBuild</key>
|
<key>DTSDKBuild</key>
|
||||||
<string>19B89</string>
|
<string>19E258</string>
|
||||||
<key>DTSDKName</key>
|
<key>DTSDKName</key>
|
||||||
<string>macosx10.15</string>
|
<string>macosx10.15</string>
|
||||||
<key>DTXcode</key>
|
<key>DTXcode</key>
|
||||||
<string>1120</string>
|
<string>1140</string>
|
||||||
<key>DTXcodeBuild</key>
|
<key>DTXcodeBuild</key>
|
||||||
<string>11B500</string>
|
<string>11E146</string>
|
||||||
<key>LSMinimumSystemVersion</key>
|
<key>LSMinimumSystemVersion</key>
|
||||||
<string>10.10</string>
|
<string>10.10</string>
|
||||||
<key>NSHumanReadableCopyright</key>
|
<key>NSHumanReadableCopyright</key>
|
||||||
|
|
Binary file not shown.
|
@ -16,6 +16,8 @@
|
||||||
#import "WTConfigManager.h"
|
#import "WTConfigManager.h"
|
||||||
#import "RecallCacheManager.h"
|
#import "RecallCacheManager.h"
|
||||||
|
|
||||||
|
static NSString * const WeChatTweakOpenNewWeChatKey = @"WeChatTweakOpenNewWeChatKey";
|
||||||
|
|
||||||
// Global Function
|
// Global Function
|
||||||
static NSString *(*original_NSHomeDirectory)(void);
|
static NSString *(*original_NSHomeDirectory)(void);
|
||||||
static NSArray<NSString *> *(*original_NSSearchPathForDirectoriesInDomains)(NSSearchPathDirectory directory, NSSearchPathDomainMask domainMask, BOOL expandTilde);
|
static NSArray<NSString *> *(*original_NSSearchPathForDirectoriesInDomains)(NSSearchPathDirectory directory, NSSearchPathDomainMask domainMask, BOOL expandTilde);
|
||||||
|
@ -281,7 +283,8 @@ static void __attribute__((constructor)) tweak(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (NSArray<NSRunningApplication *> *)tweak_runningApplicationsWithBundleIdentifier:(NSString *)bundleIdentifier {
|
+ (NSArray<NSRunningApplication *> *)tweak_runningApplicationsWithBundleIdentifier:(NSString *)bundleIdentifier {
|
||||||
if ([bundleIdentifier isEqualToString:NSBundle.mainBundle.bundleIdentifier]) {
|
BOOL openNewWeChat = [NSUserDefaults.standardUserDefaults boolForKey:WeChatTweakOpenNewWeChatKey];
|
||||||
|
if (openNewWeChat && [bundleIdentifier isEqualToString:NSBundle.mainBundle.bundleIdentifier] ) {
|
||||||
return @[NSRunningApplication.currentApplication];
|
return @[NSRunningApplication.currentApplication];
|
||||||
} else {
|
} else {
|
||||||
return [self tweak_runningApplicationsWithBundleIdentifier:bundleIdentifier];
|
return [self tweak_runningApplicationsWithBundleIdentifier:bundleIdentifier];
|
||||||
|
@ -298,11 +301,16 @@ static void __attribute__((constructor)) tweak(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)openNewWeChatInstace:(id)sender {
|
- (void)openNewWeChatInstace:(id)sender {
|
||||||
|
[NSUserDefaults.standardUserDefaults setBool:YES forKey:WeChatTweakOpenNewWeChatKey];
|
||||||
|
[NSUserDefaults.standardUserDefaults synchronize];
|
||||||
NSString *applicationPath = NSBundle.mainBundle.bundlePath;
|
NSString *applicationPath = NSBundle.mainBundle.bundlePath;
|
||||||
NSTask *task = [[NSTask alloc] init];
|
NSTask *task = [[NSTask alloc] init];
|
||||||
task.launchPath = @"/usr/bin/open";
|
task.launchPath = @"/usr/bin/open";
|
||||||
task.arguments = @[@"-n", applicationPath];
|
task.arguments = @[@"-n", applicationPath];
|
||||||
[task launch];
|
[task launch];
|
||||||
|
[task waitUntilExit];
|
||||||
|
[NSUserDefaults.standardUserDefaults removeObjectForKey:WeChatTweakOpenNewWeChatKey];
|
||||||
|
[NSUserDefaults.standardUserDefaults synchronize];
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - Auto Auth
|
#pragma mark - Auto Auth
|
||||||
|
|
Loading…
Reference in New Issue
Block a user