Merge branch 'develop' into master

# Conflicts:
#	Podfile.lock
#	WeChatTweak.framework/Versions/A/Resources/Info.plist
#	WeChatTweak.framework/Versions/A/WeChatTweak
This commit is contained in:
Jeason.L 2020-04-13 16:15:36 +08:00
commit fa3e906216
8 changed files with 16 additions and 8 deletions

View File

@ -13,7 +13,7 @@ DEPENDENCIES:
- YYModel
SPEC REPOS:
https://github.com/cocoapods/specs.git:
trunk:
- GCDWebServer
- JRSwizzle
- MMKV
@ -27,4 +27,4 @@ SPEC CHECKSUMS:
PODFILE CHECKSUM: fb1b1e412c5f88813595570bd6f951a741cda575
COCOAPODS: 1.7.5
COCOAPODS: 1.9.1

View File

@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>18G95</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>11A420a</string>
<string>11E146</string>
<key>DTPlatformVersion</key>
<string>GM</string>
<key>DTSDKBuild</key>
<string>19A547</string>
<string>19E258</string>
<key>DTSDKName</key>
<string>macosx10.15</string>
<key>DTXcode</key>
<string>1100</string>
<string>1140</string>
<key>DTXcodeBuild</key>
<string>11A420a</string>
<string>11E146</string>
<key>LSMinimumSystemVersion</key>
<string>10.10</string>
<key>NSHumanReadableCopyright</key>

View File

@ -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);
@ -420,7 +422,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];
@ -437,11 +440,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