#451 #455 Refactor Alfred module

1. Remove Alfred workflow Python dependency
2. Remove Alfred JSON compressing
This commit is contained in:
Sunnyyoung
2022-03-21 13:01:09 +08:00
parent 82e7f6e113
commit f6482b1d96
15 changed files with 79 additions and 240 deletions
+1 -1
View File
@@ -6,7 +6,7 @@
// Copyright © 2017年 Sunnyyoung. All rights reserved.
//
#import <YYModel/YYModel.h>
#import <objc/runtime.h>
#import <GCDWebServer/GCDWebServer.h>
#import <GCDWebServer/GCDWebServerDataResponse.h>
+39 -26
View File
@@ -17,8 +17,6 @@
@implementation AlfredManager
static int port = 48065;
+ (void)load {
[AlfredManager.sharedInstance startListener];
}
@@ -37,17 +35,19 @@ static int port = 48065;
return;
}
self.server = [[GCDWebServer alloc] init];
// Search contancts
// Search contacts
[self.server addHandlerForMethod:@"GET" path:@"/wechat/search" requestClass:[GCDWebServerRequest class] processBlock:^GCDWebServerResponse * _Nullable(__kindof GCDWebServerRequest * _Nonnull request) {
NSString *path = ({
NSString *path = nil;
if ([objc_getClass("PathUtility") respondsToSelector:@selector(GetCurUserDocumentPath)]) {
path = [objc_getClass("PathUtility") GetCurUserDocumentPath];
} else {
path = nil;
}
path;
});
NSString *keyword = [request.query[@"keyword"] lowercaseString] ? : @"";
NSString *hostname = request.headers[@"Host"];
NSString *url1 = [NSString stringWithFormat:@"127.0.0.1:%d", port];
NSString *url2 = [NSString stringWithFormat:@"localhost:%d", port];
if(!([hostname isEqualToString:url1] | [hostname isEqualToString:url2])){
return [GCDWebServerResponse responseWithStatusCode:404];
}
NSArray<WCContactData *> *contacts = ({
MMServiceCenter *serviceCenter = [objc_getClass("MMServiceCenter") defaultCenter];
ContactStorage *contactStorage = [serviceCenter getService:objc_getClass("ContactStorage")];
@@ -57,9 +57,10 @@ static int port = 48065;
[array addObjectsFromArray:[groupStorage GetGroupContactList:2 ContactType:0]];
array;
});
NSArray<WCContactData *> *results = ({
NSMutableArray<WCContactData *> *results = [NSMutableArray array];
NSArray<NSDictionary<NSString *, id> *> *items = ({
NSMutableArray<NSDictionary<NSString *, id> *> *items = NSMutableArray.array;
for (WCContactData *contact in contacts) {
NSString *avatar = [NSString stringWithFormat:@"%@/Avatar/%@.jpg", path, [contact.m_nsUsrName md5String]];
BOOL isOfficialAccount = (contact.m_uiCertificationFlag >> 0x3 & 0x1) == 1;
BOOL containsNickName = [contact.m_nsNickName.lowercaseString containsString:keyword];
BOOL containsUsername = [contact.m_nsUsrName.lowercaseString containsString:keyword];
@@ -69,23 +70,33 @@ static int port = 48065;
BOOL containsRemarkPinyin = [contact.m_nsRemarkPYFull.lowercaseString containsString:keyword];
BOOL matchRemarkShortPinyin = [contact.m_nsRemarkPYShort.lowercaseString isEqualToString:keyword];
if (!isOfficialAccount && (containsNickName || containsUsername || containsAliasName || containsRemark || containsNickNamePinyin || containsRemarkPinyin || matchRemarkShortPinyin)) {
[results addObject:contact];
[items addObject:@{
@"icon": @{
@"path": [NSFileManager.defaultManager fileExistsAtPath:avatar] ? avatar : NSNull.null
},
@"title": ({
id value = nil;
if (contact.m_nsRemark.length) {
value = contact.m_nsRemark;
} else if (contact.m_nsNickName.length) {
value = contact.m_nsNickName;
} else {
value = NSNull.null;
}
value;
}),
@"subtitle": contact.m_nsNickName.length ? contact.m_nsNickName : NSNull.null,
@"arg": contact.m_nsUsrName.length ? contact.m_nsUsrName : NSNull.null,
@"valid": @(contact.m_nsUsrName.length > 0)
}];
}
}
results;
items;
});
return [GCDWebServerDataResponse responseWithJSONObject:[results yy_modelToJSONObject]];
return [GCDWebServerDataResponse responseWithJSONObject:@{@"items": items}];
}];
// Start chat
// Start session
[self.server addHandlerForMethod:@"GET" path:@"/wechat/start" requestClass:[GCDWebServerRequest class] processBlock:^GCDWebServerResponse * _Nullable(__kindof GCDWebServerRequest * _Nonnull request) {
NSString *hostname = request.headers[@"Host"];
NSString *url1 = [NSString stringWithFormat:@"127.0.0.1:%d", port];
NSString *url2 = [NSString stringWithFormat:@"localhost:%d", port];
if(!([hostname isEqualToString:url1] | [hostname isEqualToString:url2])){
return [GCDWebServerResponse responseWithStatusCode:404];
}
WCContactData *contact = ({
NSString *session = request.query[@"session"];
WCContactData *contact = nil;
@@ -108,8 +119,10 @@ static int port = 48065;
});
return [GCDWebServerResponse responseWithStatusCode:200];
}];
[self.server startWithOptions:@{GCDWebServerOption_Port: [NSNumber numberWithInt:port],
GCDWebServerOption_BindToLocalhost: @(YES)} error:nil];
[self.server startWithOptions:@{
GCDWebServerOption_Port: @(48065),
GCDWebServerOption_BindToLocalhost: @(YES)
} error:nil];
}
- (void)stopListener {
-48
View File
@@ -1,48 +0,0 @@
//
// ContactData.m
// WeChatTweak
//
// Created by Sunny Young on 2022/2/1.
// Copyright © 2022 Sunnyyoung. All rights reserved.
//
#import "WeChatTweak.h"
@implementation NSObject (ContactData)
static void __attribute__((constructor)) tweak(void) {
objc_property_attribute_t type = { "T", "@\"NSString\"" }; // NSString
objc_property_attribute_t atom = { "N", "" }; // nonatomic
objc_property_attribute_t ownership = { "&", "" }; // C = copy & = strong
objc_property_attribute_t backingivar = { "V", "_m_nsHeadImgUrl" }; // ivar name
objc_property_attribute_t attrs[] = { type, atom, ownership, backingivar };
class_addProperty(objc_getClass("WCContactData"), "wt_avatarPath", attrs, 4);
class_addMethod(objc_getClass("WCContactData"), @selector(wt_avatarPath), method_getImplementation(class_getInstanceMethod(objc_getClass("WCContactData"), @selector(wt_avatarPath))), "@@:");
class_addMethod(objc_getClass("WCContactData"), @selector(setWt_avatarPath:), method_getImplementation(class_getInstanceMethod(objc_getClass("WCContactData"), @selector(setWt_avatarPath:))), "v@:@");
class_addMethod(objc_getClass("WCContactData"), @selector(modelPropertyWhitelist), method_getImplementation(class_getClassMethod(objc_getClass("WCContactData"), @selector(modelPropertyWhitelist))), "v@:");
}
- (NSString *)wt_avatarPath {
if (![objc_getClass("PathUtility") respondsToSelector:@selector(GetCurUserDocumentPath)]) {
return @"";
}
NSString *pathString = [NSString stringWithFormat:@"%@/Avatar/%@.jpg", [objc_getClass("PathUtility") GetCurUserDocumentPath], [((WCContactData *)self).m_nsUsrName md5String]];
return [NSFileManager.defaultManager fileExistsAtPath:pathString] ? pathString : @"";
}
- (void)setWt_avatarPath:(NSString *)avatarPath {
// For readonly
return;
}
+ (NSArray *)modelPropertyWhitelist {
NSArray *list =@[
@"wt_avatarPath",
@"m_nsRemark",
@"m_nsNickName",
@"m_nsUsrName"
];
return WeChatTweak.compressedJSONEnabled ? list : nil;
}
@end
@@ -1,14 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="19529" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="20037" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="19529"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="20037"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="TweakPreferencesController">
<connections>
<outlet property="compressedJSONEnabledButton" destination="ylY-lF-oFq" id="yqW-Bl-hNf"/>
<outlet property="notificationTypeButton" destination="6x2-KV-p8w" id="Kfn-2a-Yup"/>
<outlet property="revokedMessageStyleButton" destination="eqS-1n-9dO" id="QVg-Sy-CoY"/>
<outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
@@ -17,11 +16,11 @@
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<customView id="Hz6-mo-xeY">
<rect key="frame" x="0.0" y="0.0" width="431" height="122"/>
<rect key="frame" x="0.0" y="0.0" width="431" height="88"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="1000" translatesAutoresizingMaskIntoConstraints="NO" id="B87-eD-uhI">
<rect key="frame" x="10" y="86" width="186" height="16"/>
<rect key="frame" x="10" y="52" width="186" height="16"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" refusesFirstResponder="YES" sendsActionOnEndEditing="YES" alignment="right" title="Message recalled notification:" usesSingleLineMode="YES" id="UKv-CM-nGt">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
@@ -29,7 +28,7 @@
</textFieldCell>
</textField>
<popUpButton verticalHuggingPriority="750" horizontalCompressionResistancePriority="1000" translatesAutoresizingMaskIntoConstraints="NO" id="6x2-KV-p8w">
<rect key="frame" x="199" y="80" width="93" height="25"/>
<rect key="frame" x="199" y="46" width="93" height="25"/>
<popUpButtonCell key="cell" type="push" title="Inherited" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="axesIndependently" inset="2" selectedItem="gec-CY-E1x" id="wek-GT-N5V">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/>
@@ -51,52 +50,16 @@
<action selector="switchNotificationTypeAction:" target="-2" id="xjO-Ck-wem"/>
</connections>
</popUpButton>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="zsd-Bb-6l4">
<rect key="frame" x="32" y="54" width="164" height="16"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" refusesFirstResponder="YES" sendsActionOnEndEditing="YES" alignment="right" title="Alfred JSON compressing:" usesSingleLineMode="YES" id="jHw-2a-B2t">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="7wK-v5-BgQ">
<rect key="frame" x="46" y="22" width="150" height="16"/>
<rect key="frame" x="46" y="20" width="150" height="16"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" refusesFirstResponder="YES" sendsActionOnEndEditing="YES" alignment="right" title="Revoked message style:" usesSingleLineMode="YES" id="mPT-nA-idf">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="ylY-lF-oFq">
<rect key="frame" x="199" y="48" width="92" height="25"/>
<popUpButtonCell key="cell" type="push" title="Disabled" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="axesIndependently" inset="2" selectedItem="MEN-Kg-wfj" id="taL-8q-Quu">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/>
<menu key="menu" id="2qr-A3-Yo5">
<items>
<menuItem title="Enabled" id="10G-t9-s4T">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem title="Disabled" state="on" id="MEN-Kg-wfj">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
</items>
</menu>
</popUpButtonCell>
<connections>
<action selector="switchCompressedJSONEnabledAction:" target="-2" id="HLt-oc-7An"/>
</connections>
</popUpButton>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="kNm-y0-HmG">
<rect key="frame" x="295" y="54" width="96" height="16"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" refusesFirstResponder="YES" sendsActionOnEndEditing="YES" title="Need to restart" usesSingleLineMode="YES" id="2vl-mc-m3L">
<font key="font" metaFont="system"/>
<color key="textColor" name="disabledControlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="eqS-1n-9dO">
<rect key="frame" x="199" y="16" width="83" height="25"/>
<rect key="frame" x="199" y="14" width="83" height="25"/>
<popUpButtonCell key="cell" type="push" title="Classic" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="axesIndependently" inset="2" selectedItem="wRC-UO-k1G" id="6UY-90-fFH">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/>
@@ -116,7 +79,7 @@
</connections>
</popUpButton>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="ftV-1F-OnB">
<rect key="frame" x="286" y="22" width="130" height="16"/>
<rect key="frame" x="286" y="20" width="130" height="16"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" refusesFirstResponder="YES" sendsActionOnEndEditing="YES" alignment="left" title="Experimental feature" usesSingleLineMode="YES" id="lHs-du-a6F">
<font key="font" metaFont="system"/>
<color key="textColor" name="systemRedColor" catalog="System" colorSpace="catalog"/>
@@ -125,29 +88,21 @@
</textField>
</subviews>
<constraints>
<constraint firstItem="zsd-Bb-6l4" firstAttribute="top" secondItem="B87-eD-uhI" secondAttribute="bottom" constant="16" id="62W-9V-E2u"/>
<constraint firstItem="B87-eD-uhI" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" constant="12" id="9tt-Vb-9e8"/>
<constraint firstItem="7wK-v5-BgQ" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="Hz6-mo-xeY" secondAttribute="leading" constant="12" id="BjP-RS-ASM"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="ftV-1F-OnB" secondAttribute="trailing" constant="12" id="Bug-Cf-VNT"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="kNm-y0-HmG" secondAttribute="trailing" constant="12" id="Le8-Ns-wyj"/>
<constraint firstItem="ylY-lF-oFq" firstAttribute="leading" secondItem="zsd-Bb-6l4" secondAttribute="trailing" constant="8" id="Mat-Em-quG"/>
<constraint firstItem="eqS-1n-9dO" firstAttribute="centerY" secondItem="7wK-v5-BgQ" secondAttribute="centerY" id="Pbm-17-TcF"/>
<constraint firstItem="7wK-v5-BgQ" firstAttribute="top" secondItem="zsd-Bb-6l4" secondAttribute="bottom" constant="16" id="Ynk-No-M1P"/>
<constraint firstItem="7wK-v5-BgQ" firstAttribute="top" secondItem="B87-eD-uhI" secondAttribute="bottom" constant="16" id="Rqw-MY-e4X"/>
<constraint firstItem="B87-eD-uhI" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" constant="20" id="acJ-lS-NeF"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="6x2-KV-p8w" secondAttribute="trailing" constant="12" id="e8z-dC-BAg"/>
<constraint firstItem="kNm-y0-HmG" firstAttribute="centerY" secondItem="ylY-lF-oFq" secondAttribute="centerY" id="eMk-RJ-Mbw"/>
<constraint firstItem="ftV-1F-OnB" firstAttribute="leading" secondItem="eqS-1n-9dO" secondAttribute="trailing" constant="10" id="g0f-zV-Ldd"/>
<constraint firstItem="eqS-1n-9dO" firstAttribute="leading" secondItem="7wK-v5-BgQ" secondAttribute="trailing" constant="8" symbolic="YES" id="ghN-pe-dKr"/>
<constraint firstItem="6x2-KV-p8w" firstAttribute="centerY" secondItem="B87-eD-uhI" secondAttribute="centerY" id="gqp-om-e0O"/>
<constraint firstItem="ylY-lF-oFq" firstAttribute="centerY" secondItem="zsd-Bb-6l4" secondAttribute="centerY" id="h7g-u6-ZwV"/>
<constraint firstItem="6x2-KV-p8w" firstAttribute="leading" secondItem="B87-eD-uhI" secondAttribute="trailing" constant="8" id="i7Z-7c-5cX"/>
<constraint firstItem="zsd-Bb-6l4" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="Hz6-mo-xeY" secondAttribute="leading" constant="12" id="icK-YZ-ZLo"/>
<constraint firstItem="zsd-Bb-6l4" firstAttribute="trailing" secondItem="B87-eD-uhI" secondAttribute="trailing" id="ujT-Pv-nBx"/>
<constraint firstItem="kNm-y0-HmG" firstAttribute="leading" secondItem="ylY-lF-oFq" secondAttribute="trailing" constant="10" id="urr-9v-Okd"/>
<constraint firstItem="ftV-1F-OnB" firstAttribute="centerY" secondItem="eqS-1n-9dO" secondAttribute="centerY" id="v6d-17-iac"/>
<constraint firstItem="7wK-v5-BgQ" firstAttribute="trailing" secondItem="B87-eD-uhI" secondAttribute="trailing" id="ydo-VW-YRZ"/>
</constraints>
<point key="canvasLocation" x="138.5" y="179"/>
<point key="canvasLocation" x="138.5" y="162"/>
</customView>
</objects>
</document>
@@ -12,7 +12,6 @@
@interface TweakPreferencesController () <MASPreferencesViewController>
@property (weak) IBOutlet NSPopUpButton *notificationTypeButton;
@property (weak) IBOutlet NSPopUpButton *compressedJSONEnabledButton;
@property (weak) IBOutlet NSPopUpButton *revokedMessageStyleButton;
@end
@@ -32,7 +31,6 @@
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
RevokeNotificationType notificationType = [userDefaults integerForKey:WeChatTweakPreferenceRevokeNotificationTypeKey];
[self.notificationTypeButton selectItemAtIndex:notificationType];
[self.compressedJSONEnabledButton selectItemAtIndex:WeChatTweak.compressedJSONEnabled ? 0 : 1];
[self.revokedMessageStyleButton selectItemAtIndex:WeChatTweak.revokedMessageStyle];
}
@@ -43,11 +41,6 @@
[[NSUserDefaults standardUserDefaults] setInteger:type forKey:WeChatTweakPreferenceRevokeNotificationTypeKey];
}
- (IBAction)switchCompressedJSONEnabledAction:(NSPopUpButton *)sender {
BOOL enabled = sender.indexOfSelectedItem == 0;
WeChatTweak.compressedJSONEnabled = enabled;
}
- (IBAction)switchRevokedMessageStyleButton:(NSPopUpButton *)sender {
WeChatTweak.revokedMessageStyle = sender.indexOfSelectedItem;
}
@@ -1,25 +1,10 @@
/* Class = "NSMenuItem"; title = "Enabled"; ObjectID = "10G-t9-s4T"; */
"10G-t9-s4T.title" = "Enabled";
/* Class = "NSTextFieldCell"; title = "Need to restart"; ObjectID = "2vl-mc-m3L"; */
"2vl-mc-m3L.title" = "Need to restart";
/* Class = "NSMenuItem"; title = "Enabled"; ObjectID = "KQg-jN-y9a"; */
"KQg-jN-y9a.title" = "Enabled";
/* Class = "NSMenuItem"; title = "Disabled"; ObjectID = "MEN-Kg-wfj"; */
"MEN-Kg-wfj.title" = "Disabled";
/* Class = "NSTextFieldCell"; title = "Message recalled notification:"; ObjectID = "UKv-CM-nGt"; */
"UKv-CM-nGt.title" = "Message recalled notification:";
/* Class = "NSMenuItem"; title = "Disabled"; ObjectID = "Uk9-Oc-Jtv"; */
"Uk9-Oc-Jtv.title" = "Disabled";
/* Class = "NSMenuItem"; title = "Disabled"; ObjectID = "Vcv-eD-OM9"; */
"Vcv-eD-OM9.title" = "Disabled";
/* Class = "NSMenuItem"; title = "All"; ObjectID = "da4-aJ-lEy"; */
"da4-aJ-lEy.title" = "All";
@@ -29,9 +14,6 @@
/* Class = "NSMenuItem"; title = "Inherited"; ObjectID = "gec-CY-E1x"; */
"gec-CY-E1x.title" = "Inherited";
/* Class = "NSTextFieldCell"; title = "Alfred JSON compressing:"; ObjectID = "jHw-2a-B2t"; */
"jHw-2a-B2t.title" = "Alfred JSON compressing:";
/* Class = "NSTextFieldCell"; title = "Experimental feature"; ObjectID = "lHs-du-a6F"; */
"lHs-du-a6F.title" = "Experimental feature";
@@ -1,42 +1,24 @@
/* Class = "NSMenuItem"; title = "开启"; ObjectID = "10G-t9-s4T"; */
"10G-t9-s4T.title" = "开启";
/* Class = "NSTextFieldCell"; title = "需重启客户端"; ObjectID = "2vl-mc-m3L"; */
"2vl-mc-m3L.title" = "需重启客户端";
/* Class = "NSMenuItem"; title = "开启"; ObjectID = "KQg-jN-y9a"; */
"KQg-jN-y9a.title" = "开启";
/* Class = "NSMenuItem"; title = "关闭"; ObjectID = "MEN-Kg-wfj"; */
"MEN-Kg-wfj.title" = "关闭";
/* Class = "NSTextFieldCell"; title = "消息撤回通知:"; ObjectID = "UKv-CM-nGt"; */
/* Class = "NSTextFieldCell"; title = "Message recalled notification:"; ObjectID = "UKv-CM-nGt"; */
"UKv-CM-nGt.title" = "消息撤回通知:";
/* Class = "NSMenuItem"; title = "关闭"; ObjectID = "Uk9-Oc-Jtv"; */
/* Class = "NSMenuItem"; title = "Disabled"; ObjectID = "Uk9-Oc-Jtv"; */
"Uk9-Oc-Jtv.title" = "关闭";
/* Class = "NSMenuItem"; title = "关闭"; ObjectID = "Vcv-eD-OM9"; */
"Vcv-eD-OM9.title" = "关闭";
/* Class = "NSMenuItem"; title = "全部接收"; ObjectID = "da4-aJ-lEy"; */
/* Class = "NSMenuItem"; title = "All"; ObjectID = "da4-aJ-lEy"; */
"da4-aJ-lEy.title" = "全部接收";
/* Class = "NSMenuItem"; title = "遮罩"; ObjectID = "gH0-wV-Bx0"; */
/* Class = "NSMenuItem"; title = "Mask"; ObjectID = "gH0-wV-Bx0"; */
"gH0-wV-Bx0.title" = "遮罩";
/* Class = "NSMenuItem"; title = "跟随聊天设置"; ObjectID = "gec-CY-E1x"; */
/* Class = "NSMenuItem"; title = "Inherited"; ObjectID = "gec-CY-E1x"; */
"gec-CY-E1x.title" = "跟随聊天设置";
/* Class = "NSTextFieldCell"; title = "Alfred JSON 压缩:"; ObjectID = "jHw-2a-B2t"; */
"jHw-2a-B2t.title" = "Alfred JSON 压缩:";
/* Class = "NSTextFieldCell"; title = "试验性功能"; ObjectID = "lHs-du-a6F"; */
/* Class = "NSTextFieldCell"; title = "Experimental feature"; ObjectID = "lHs-du-a6F"; */
"lHs-du-a6F.title" = "试验性功能";
/* Class = "NSTextFieldCell"; title = "消息撤回样式:"; ObjectID = "mPT-nA-idf"; */
/* Class = "NSTextFieldCell"; title = "Revoked message style:"; ObjectID = "mPT-nA-idf"; */
"mPT-nA-idf.title" = "消息撤回样式:";
/* Class = "NSMenuItem"; title = "经典"; ObjectID = "wRC-UO-k1G"; */
/* Class = "NSMenuItem"; title = "Classic"; ObjectID = "wRC-UO-k1G"; */
"wRC-UO-k1G.title" = "经典";
@@ -1,42 +1,24 @@
/* Class = "NSMenuItem"; title = "開啟"; ObjectID = "10G-t9-s4T"; */
"10G-t9-s4T.title" = "開啟";
/* Class = "NSTextFieldCell"; title = "需重啟客戶端"; ObjectID = "2vl-mc-m3L"; */
"2vl-mc-m3L.title" = "需重啟客戶端";
/* Class = "NSMenuItem"; title = "開啟"; ObjectID = "KQg-jN-y9a"; */
"KQg-jN-y9a.title" = "開啟";
/* Class = "NSMenuItem"; title = "關閉"; ObjectID = "MEN-Kg-wfj"; */
"MEN-Kg-wfj.title" = "關閉";
/* Class = "NSTextFieldCell"; title = "消息撤回通知:"; ObjectID = "UKv-CM-nGt"; */
/* Class = "NSTextFieldCell"; title = "Message recalled notification:"; ObjectID = "UKv-CM-nGt"; */
"UKv-CM-nGt.title" = "消息撤回通知:";
/* Class = "NSMenuItem"; title = "關閉"; ObjectID = "Uk9-Oc-Jtv"; */
/* Class = "NSMenuItem"; title = "Disabled"; ObjectID = "Uk9-Oc-Jtv"; */
"Uk9-Oc-Jtv.title" = "關閉";
/* Class = "NSMenuItem"; title = "關閉"; ObjectID = "Vcv-eD-OM9"; */
"Vcv-eD-OM9.title" = "關閉";
/* Class = "NSMenuItem"; title = "全部接收"; ObjectID = "da4-aJ-lEy"; */
/* Class = "NSMenuItem"; title = "All"; ObjectID = "da4-aJ-lEy"; */
"da4-aJ-lEy.title" = "全部接收";
/* Class = "NSMenuItem"; title = "遮罩"; ObjectID = "gH0-wV-Bx0"; */
/* Class = "NSMenuItem"; title = "Mask"; ObjectID = "gH0-wV-Bx0"; */
"gH0-wV-Bx0.title" = "遮罩";
/* Class = "NSMenuItem"; title = "跟隨聊天設置"; ObjectID = "gec-CY-E1x"; */
/* Class = "NSMenuItem"; title = "Inherited"; ObjectID = "gec-CY-E1x"; */
"gec-CY-E1x.title" = "跟隨聊天設置";
/* Class = "NSTextFieldCell"; title = "Alfred JSON 壓縮:"; ObjectID = "jHw-2a-B2t"; */
"jHw-2a-B2t.title" = "Alfred JSON 壓縮:";
/* Class = "NSTextFieldCell"; title = "試驗性功能"; ObjectID = "lHs-du-a6F"; */
/* Class = "NSTextFieldCell"; title = "Experimental feature"; ObjectID = "lHs-du-a6F"; */
"lHs-du-a6F.title" = "試驗性功能";
/* Class = "NSTextFieldCell"; title = "消息撤回樣式:"; ObjectID = "mPT-nA-idf"; */
/* Class = "NSTextFieldCell"; title = "Revoked message style:"; ObjectID = "mPT-nA-idf"; */
"mPT-nA-idf.title" = "消息撤回樣式:";
/* Class = "NSMenuItem"; title = "經典"; ObjectID = "wRC-UO-k1G"; */
/* Class = "NSMenuItem"; title = "Classic"; ObjectID = "wRC-UO-k1G"; */
"wRC-UO-k1G.title" = "經典";
-1
View File
@@ -18,7 +18,6 @@ typedef NS_ENUM(NSUInteger, WTRevokedMessageStyle) {
@interface WeChatTweak : NSObject
@property (nonatomic, assign, class) BOOL compressedJSONEnabled;
@property (nonatomic, assign, class) WTRevokedMessageStyle revokedMessageStyle;
@end
-10
View File
@@ -8,20 +8,10 @@
#import "WeChatTweak.h"
static NSString * const WeChatTweakCompressedJSONEnabledKey = @"WeChatTweakCompressedJSONEnabledKey";
static NSString * const WeChatTweakRevokedMessageStyleKey = @"WeChatTweakRevokedMessageStyleKey";
@implementation WeChatTweak
+ (BOOL)compressedJSONEnabled {
return [NSUserDefaults.standardUserDefaults boolForKey:WeChatTweakCompressedJSONEnabledKey];
}
+ (void)setCompressedJSONEnabled:(BOOL)compressedJSONEnabled {
[NSUserDefaults.standardUserDefaults setBool:compressedJSONEnabled forKey:WeChatTweakCompressedJSONEnabledKey];
[NSUserDefaults.standardUserDefaults synchronize];
}
+ (WTRevokedMessageStyle)revokedMessageStyle {
return [NSUserDefaults.standardUserDefaults integerForKey:WeChatTweakRevokedMessageStyleKey];
}