mirror of
https://github.com/Sunnyyoung/WeChatTweak-macOS.git
synced 2025-05-22 22:36:07 +08:00
parent
7ddf2fc7e1
commit
778990ac2c
|
@ -3,7 +3,7 @@
|
|||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>BuildMachineOSBuild</key>
|
||||
<string>18D42</string>
|
||||
<string>18E226</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>10B61</string>
|
||||
<string>10E1001</string>
|
||||
<key>DTPlatformVersion</key>
|
||||
<string>GM</string>
|
||||
<key>DTSDKBuild</key>
|
||||
<string>18B71</string>
|
||||
<string>18E219</string>
|
||||
<key>DTSDKName</key>
|
||||
<string>macosx10.14</string>
|
||||
<key>DTXcode</key>
|
||||
<string>1010</string>
|
||||
<string>1020</string>
|
||||
<key>DTXcodeBuild</key>
|
||||
<string>10B61</string>
|
||||
<string>10E1001</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>Copyright © 2017年 Sunnyyoung. All rights reserved.</string>
|
||||
</dict>
|
||||
|
|
Binary file not shown.
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1010"
|
||||
LastUpgradeVersion = "1020"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
|
|
@ -61,6 +61,7 @@ static void __attribute__((constructor)) tweak(void) {
|
|||
[objc_getClass("MessageService") jr_swizzleMethod:NSSelectorFromString(@"FFToNameFavChatZZ:") withMethod:@selector(tweak_onRevokeMsg:) error:nil];
|
||||
[objc_getClass("CUtility") jr_swizzleClassMethod:NSSelectorFromString(@"HasWechatInstance") withClassMethod:@selector(tweak_HasWechatInstance) error:nil];
|
||||
[objc_getClass("CUtility") jr_swizzleClassMethod:NSSelectorFromString(@"FFSvrChatInfoMsgWithImgZZ") withClassMethod:@selector(tweak_HasWechatInstance) error:nil];
|
||||
[objc_getClass("NSRunningApplication") jr_swizzleClassMethod:NSSelectorFromString(@"runningApplicationsWithBundleIdentifier:") withClassMethod:@selector(tweak_runningApplicationsWithBundleIdentifier:) error:nil];
|
||||
[objc_getClass("MASPreferencesWindowController") jr_swizzleMethod:NSSelectorFromString(@"initWithViewControllers:") withMethod:@selector(tweak_initWithViewControllers:) error:nil];
|
||||
|
||||
objc_property_attribute_t type = { "T", "@\"NSString\"" }; // NSString
|
||||
|
@ -176,6 +177,14 @@ static void __attribute__((constructor)) tweak(void) {
|
|||
return NO;
|
||||
}
|
||||
|
||||
+ (NSArray<NSRunningApplication *> *)tweak_runningApplicationsWithBundleIdentifier:(NSString *)bundleIdentifier {
|
||||
if ([bundleIdentifier isEqualToString:NSBundle.mainBundle.bundleIdentifier]) {
|
||||
return @[NSRunningApplication.currentApplication];
|
||||
} else {
|
||||
return [self tweak_runningApplicationsWithBundleIdentifier:bundleIdentifier];
|
||||
}
|
||||
}
|
||||
|
||||
- (NSMenu *)tweak_applicationDockMenu:(NSApplication *)sender {
|
||||
NSMenu *menu = [[NSMenu alloc] init];
|
||||
NSMenuItem *menuItem = [[NSMenuItem alloc] initWithTitle:[NSBundle.tweakBundle localizedStringForKey:@"Tweak.Title.LoginAnotherAccount"]
|
||||
|
@ -186,7 +195,7 @@ static void __attribute__((constructor)) tweak(void) {
|
|||
}
|
||||
|
||||
- (void)openNewWeChatInstace:(id)sender {
|
||||
NSString *applicationPath = [[NSBundle mainBundle] bundlePath];
|
||||
NSString *applicationPath = NSBundle.mainBundle.bundlePath;
|
||||
NSTask *task = [[NSTask alloc] init];
|
||||
task.launchPath = @"/usr/bin/open";
|
||||
task.arguments = @[@"-n", applicationPath];
|
||||
|
@ -197,8 +206,8 @@ static void __attribute__((constructor)) tweak(void) {
|
|||
|
||||
- (void)tweak_applicationDidFinishLaunching:(NSNotification *)notification {
|
||||
[self tweak_applicationDidFinishLaunching:notification];
|
||||
NSString *bundleIdentifier = [[NSBundle mainBundle] bundleIdentifier];
|
||||
NSArray *instances = [NSRunningApplication runningApplicationsWithBundleIdentifier:bundleIdentifier];
|
||||
NSString *bundleIdentifier = NSBundle.mainBundle.bundleIdentifier;
|
||||
NSArray *instances = [NSRunningApplication tweak_runningApplicationsWithBundleIdentifier:bundleIdentifier];
|
||||
// Detect multiple instance conflict
|
||||
BOOL hasInstance = instances.count == 1;
|
||||
BOOL enabledAutoAuth = [[NSUserDefaults standardUserDefaults] boolForKey:WeChatTweakPreferenceAutoAuthKey];
|
||||
|
|
Loading…
Reference in New Issue
Block a user