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