mirror of
https://github.com/Sunnyyoung/WeChatTweak-macOS.git
synced 2026-07-29 06:24:31 +08:00
Minor fixed
1. Cleanup the project 2. Compress the screenshot
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
// Copyright © 2017年 Sunnyyoung. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@interface NSString (WeChatTweak)
|
||||
|
||||
|
||||
@@ -57,18 +57,18 @@
|
||||
</popUpButton>
|
||||
<popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="6x2-KV-p8w">
|
||||
<rect key="frame" x="173" y="17" width="144" height="26"/>
|
||||
<popUpButtonCell key="cell" type="push" title="跟随消息通知设置" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" selectedItem="gec-CY-E1x" id="wek-GT-N5V">
|
||||
<popUpButtonCell key="cell" type="push" title="跟随聊天通知设置" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" selectedItem="gec-CY-E1x" id="wek-GT-N5V">
|
||||
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="menu"/>
|
||||
<menu key="menu" id="H2J-gJ-aGD">
|
||||
<items>
|
||||
<menuItem title="跟随消息通知设置" id="gec-CY-E1x">
|
||||
<menuItem title="跟随聊天通知设置" state="on" id="gec-CY-E1x">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
</menuItem>
|
||||
<menuItem title="全部接收" id="da4-aJ-lEy">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
</menuItem>
|
||||
<menuItem title="全部关闭" state="on" id="Uk9-Oc-Jtv">
|
||||
<menuItem title="全部关闭" id="Uk9-Oc-Jtv">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
</menuItem>
|
||||
</items>
|
||||
|
||||
@@ -23,7 +23,6 @@ static void __attribute__((constructor)) tweak(void) {
|
||||
[objc_getClass("MessageService") jr_swizzleMethod:NSSelectorFromString(@"onRevokeMsg:") withMethod:@selector(tweak_onRevokeMsg:) error:nil];
|
||||
[objc_getClass("CUtility") jr_swizzleClassMethod:NSSelectorFromString(@"HasWechatInstance") withClassMethod:@selector(tweak_HasWechatInstance) error:nil];
|
||||
[objc_getClass("MASPreferencesWindowController") jr_swizzleMethod:NSSelectorFromString(@"initWithViewControllers:") withMethod:@selector(tweak_initWithViewControllers:) error:nil];
|
||||
[objc_getClass("MASPreferencesWindowController") jr_swizzleMethod:NSSelectorFromString(@"viewControllerForIdentifier:") withMethod:@selector(tweak_viewControllerForIdentifier:) error:nil];
|
||||
}
|
||||
|
||||
#pragma mark - No Revoke Message
|
||||
@@ -97,15 +96,15 @@ static void __attribute__((constructor)) tweak(void) {
|
||||
}
|
||||
|
||||
- (NSMenu *)tweak_applicationDockMenu:(NSApplication *)sender {
|
||||
NSMenu *menu = [[objc_getClass("NSMenu") alloc] init];
|
||||
NSMenuItem *menuItem = [[objc_getClass("NSMenuItem") alloc] initWithTitle:@"登录新的微信账号" action:@selector(openNewWeChatInstace:) keyEquivalent:@""];
|
||||
NSMenu *menu = [[NSMenu alloc] init];
|
||||
NSMenuItem *menuItem = [[NSMenuItem alloc] initWithTitle:@"登录新的微信账号" action:@selector(openNewWeChatInstace:) keyEquivalent:@""];
|
||||
[menu insertItem:menuItem atIndex:0];
|
||||
return menu;
|
||||
}
|
||||
|
||||
- (void)openNewWeChatInstace:(id)sender {
|
||||
NSString *applicationPath = [[NSBundle mainBundle] bundlePath];
|
||||
NSTask *task = [[objc_getClass("NSTask") alloc] init];
|
||||
NSTask *task = [[NSTask alloc] init];
|
||||
task.launchPath = @"/usr/bin/open";
|
||||
task.arguments = @[@"-n", applicationPath];
|
||||
[task launch];
|
||||
@@ -115,8 +114,8 @@ static void __attribute__((constructor)) tweak(void) {
|
||||
|
||||
- (void)tweak_applicationDidFinishLaunching:(NSNotification *)notification {
|
||||
[self tweak_applicationDidFinishLaunching:notification];
|
||||
NSString *bundleIdentifier = [[objc_getClass("NSBundle") mainBundle] bundleIdentifier];
|
||||
NSArray *instances = [objc_getClass("NSRunningApplication") runningApplicationsWithBundleIdentifier:bundleIdentifier];
|
||||
NSString *bundleIdentifier = [[NSBundle mainBundle] bundleIdentifier];
|
||||
NSArray *instances = [NSRunningApplication runningApplicationsWithBundleIdentifier:bundleIdentifier];
|
||||
// Detect multiple instance conflict
|
||||
BOOL hasInstance = instances.count == 1;
|
||||
BOOL enabledAutoAuth = [[NSUserDefaults standardUserDefaults] boolForKey:WeChatTweakPreferenceAutoAuthKey];
|
||||
@@ -141,13 +140,9 @@ static void __attribute__((constructor)) tweak(void) {
|
||||
|
||||
- (id)tweak_initWithViewControllers:(NSArray *)arg1 {
|
||||
NSMutableArray *viewControllers = [NSMutableArray arrayWithArray:arg1];
|
||||
TweakPreferecesController *controller = [[objc_getClass("TweakPreferecesController") alloc] initWithNibName:nil bundle:[NSBundle tweakBundle]];
|
||||
TweakPreferecesController *controller = [[TweakPreferecesController alloc] initWithNibName:nil bundle:[NSBundle tweakBundle]];
|
||||
[viewControllers addObject:controller];
|
||||
return [self tweak_initWithViewControllers:viewControllers];
|
||||
}
|
||||
|
||||
- (id)tweak_viewControllerForIdentifier:(NSString *)arg1 {
|
||||
return [self tweak_viewControllerForIdentifier:arg1];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -75,16 +75,11 @@
|
||||
@optional
|
||||
@property(readonly, nonatomic) BOOL hasResizableHeight;
|
||||
@property(readonly, nonatomic) BOOL hasResizableWidth;
|
||||
- (NSView *)initialKeyView;
|
||||
- (void)viewDidDisappear;
|
||||
- (void)viewWillAppear;
|
||||
|
||||
@end
|
||||
|
||||
@interface MASPreferencesWindowController : NSWindowController
|
||||
|
||||
@property(readonly, nonatomic) NSMutableArray *viewControllers;
|
||||
|
||||
- (id)initWithViewControllers:(NSArray *)arg1;
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user