diff --git a/Gemfile.lock b/Gemfile.lock index c2d2e98..d6df271 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -3,7 +3,7 @@ GEM specs: CFPropertyList (3.0.5) rexml - activesupport (6.1.4.4) + activesupport (6.1.5) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) @@ -16,10 +16,10 @@ GEM json (>= 1.5.1) atomos (0.1.3) claide (1.1.0) - cocoapods (1.11.2) + cocoapods (1.11.3) addressable (~> 2.8) claide (>= 1.0.2, < 2.0) - cocoapods-core (= 1.11.2) + cocoapods-core (= 1.11.3) cocoapods-deintegrate (>= 1.0.3, < 2.0) cocoapods-downloader (>= 1.4.0, < 2.0) cocoapods-plugins (>= 1.0.0, < 2.0) @@ -34,7 +34,7 @@ GEM nap (~> 1.0) ruby-macho (>= 1.0, < 3.0) xcodeproj (>= 1.21.0, < 2.0) - cocoapods-core (1.11.2) + cocoapods-core (1.11.3) activesupport (>= 5.0, < 7) addressable (~> 2.8) algoliasearch (~> 1.0) @@ -63,7 +63,7 @@ GEM fuzzy_match (2.0.4) gh_inspector (1.1.3) httpclient (2.8.3) - i18n (1.9.1) + i18n (1.10.0) concurrent-ruby (~> 1.0) json (2.6.1) minitest (5.15.0) diff --git a/Podfile b/Podfile index 894683f..d10ebf6 100644 --- a/Podfile +++ b/Podfile @@ -4,7 +4,6 @@ inhibit_all_warnings! target 'WeChatTweak' do pod 'JRSwizzle' pod 'GCDWebServer' - pod 'YYModel' end post_install do |installer| diff --git a/Podfile.lock b/Podfile.lock index 2af66a5..7b342ae 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -3,24 +3,20 @@ PODS: - GCDWebServer/Core (= 3.5.4) - GCDWebServer/Core (3.5.4) - JRSwizzle (1.0) - - YYModel (1.0.4) DEPENDENCIES: - GCDWebServer - JRSwizzle - - YYModel SPEC REPOS: trunk: - GCDWebServer - JRSwizzle - - YYModel SPEC CHECKSUMS: GCDWebServer: 2c156a56c8226e2d5c0c3f208a3621ccffbe3ce4 JRSwizzle: dd5ead5d913a0f29e7f558200165849f006bb1e3 - YYModel: 2a7fdd96aaa4b86a824e26d0c517de8928c04b30 -PODFILE CHECKSUM: cae308b81d1bbf94a739799a5bf2524cf9bec366 +PODFILE CHECKSUM: 63b2e533dfa408b1a24337678cd9025cc987011f -COCOAPODS: 1.11.2 +COCOAPODS: 1.11.3 diff --git a/WeChat.alfredworkflow b/WeChat.alfredworkflow index 49acdd3..0dac161 100644 Binary files a/WeChat.alfredworkflow and b/WeChat.alfredworkflow differ diff --git a/WeChatTweak.xcodeproj/project.pbxproj b/WeChatTweak.xcodeproj/project.pbxproj index 2700c8f..c6dbed9 100644 --- a/WeChatTweak.xcodeproj/project.pbxproj +++ b/WeChatTweak.xcodeproj/project.pbxproj @@ -13,7 +13,6 @@ 7D54A05C20E74D9400CB5306 /* TweakPreferencesController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 7D54A05E20E74D9400CB5306 /* TweakPreferencesController.xib */; }; 7D54A06A20E74FE500CB5306 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 7D54A06C20E74FE500CB5306 /* Localizable.strings */; }; 7D64150827A9469900A8A398 /* ContextMenu.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D64150627A9469900A8A398 /* ContextMenu.m */; }; - 7D64150A27A9481C00A8A398 /* ContactData.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D64150927A9481C00A8A398 /* ContactData.m */; }; 7D64150C27A94B9600A8A398 /* Directory.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D64150B27A94B9600A8A398 /* Directory.m */; }; 7D64150E27A94BEA00A8A398 /* MultipleInstances.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D64150D27A94BEA00A8A398 /* MultipleInstances.m */; }; 7D64151027A94DE200A8A398 /* PreferencesWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D64150F27A94DE200A8A398 /* PreferencesWindow.m */; }; @@ -40,15 +39,14 @@ 7D54A07120E7535F00CB5306 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Localizable.strings"; sourceTree = ""; }; 7D54A07220E7536300CB5306 /* zh-Hant */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant"; path = "zh-Hant.lproj/Localizable.strings"; sourceTree = ""; }; 7D64150627A9469900A8A398 /* ContextMenu.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ContextMenu.m; sourceTree = ""; }; - 7D64150927A9481C00A8A398 /* ContactData.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ContactData.m; sourceTree = ""; }; 7D64150B27A94B9600A8A398 /* Directory.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Directory.m; sourceTree = ""; }; 7D64150D27A94BEA00A8A398 /* MultipleInstances.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MultipleInstances.m; sourceTree = ""; }; 7D64150F27A94DE200A8A398 /* PreferencesWindow.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PreferencesWindow.m; sourceTree = ""; }; - 7D64B96727853C2100A07164 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/TweakPreferencesController.strings; sourceTree = ""; }; - 7D64B96827853C2800A07164 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/TweakPreferencesController.strings"; sourceTree = ""; }; - 7D64B96927853C2B00A07164 /* zh-Hant */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant"; path = "zh-Hant.lproj/TweakPreferencesController.strings"; sourceTree = ""; }; 7D9049F31F82A415004E6370 /* fishhook.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fishhook.c; sourceTree = ""; }; 7D9049F41F82A415004E6370 /* fishhook.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = fishhook.h; sourceTree = ""; }; + 7DAE1DD727E828960009C01E /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/TweakPreferencesController.strings; sourceTree = ""; }; + 7DAE1DD927E828A50009C01E /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/TweakPreferencesController.strings"; sourceTree = ""; }; + 7DAE1DDB27E828B00009C01E /* zh-Hant */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant"; path = "zh-Hant.lproj/TweakPreferencesController.strings"; sourceTree = ""; }; 7DF842271F40583F00D42D79 /* WeChatTweak.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = WeChatTweak.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 7DF8422A1F40583F00D42D79 /* WeChatTweak.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WeChatTweak.h; sourceTree = ""; }; 7DF8422B1F40583F00D42D79 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; @@ -149,7 +147,6 @@ 7D64150D27A94BEA00A8A398 /* MultipleInstances.m */, 7D64150F27A94DE200A8A398 /* PreferencesWindow.m */, 7D64150627A9469900A8A398 /* ContextMenu.m */, - 7D64150927A9481C00A8A398 /* ContactData.m */, 7D14E5A21F6447DB00D75132 /* Alfred.h */, 7D14E5A31F6447DB00D75132 /* Alfred.m */, 7D5AAF3720DF4BB300860EEE /* Vendor */, @@ -314,7 +311,6 @@ 7D64150827A9469900A8A398 /* ContextMenu.m in Sources */, 7D2194CC264701950068F4CC /* AntiRevoke.m in Sources */, 7DF842341F4058AB00D42D79 /* WeChatTweak.m in Sources */, - 7D64150A27A9481C00A8A398 /* ContactData.m in Sources */, 7D9049F51F82A41A004E6370 /* fishhook.c in Sources */, 7D64151027A94DE200A8A398 /* PreferencesWindow.m in Sources */, 7D64150E27A94BEA00A8A398 /* MultipleInstances.m in Sources */, @@ -330,9 +326,9 @@ isa = PBXVariantGroup; children = ( 7D54A05F20E74E4600CB5306 /* Base */, - 7D64B96727853C2100A07164 /* en */, - 7D64B96827853C2800A07164 /* zh-Hans */, - 7D64B96927853C2B00A07164 /* zh-Hant */, + 7DAE1DD727E828960009C01E /* en */, + 7DAE1DD927E828A50009C01E /* zh-Hans */, + 7DAE1DDB27E828B00009C01E /* zh-Hant */, ); name = TweakPreferencesController.xib; sourceTree = ""; diff --git a/WeChatTweak/Alfred.h b/WeChatTweak/Alfred.h index 64a1066..0113850 100644 --- a/WeChatTweak/Alfred.h +++ b/WeChatTweak/Alfred.h @@ -6,7 +6,7 @@ // Copyright © 2017年 Sunnyyoung. All rights reserved. // -#import +#import #import #import diff --git a/WeChatTweak/Alfred.m b/WeChatTweak/Alfred.m index ba1727f..131dbf9 100644 --- a/WeChatTweak/Alfred.m +++ b/WeChatTweak/Alfred.m @@ -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 *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 *results = ({ - NSMutableArray *results = [NSMutableArray array]; + NSArray *> *items = ({ + NSMutableArray *> *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 { diff --git a/WeChatTweak/ContactData.m b/WeChatTweak/ContactData.m deleted file mode 100644 index 716648f..0000000 --- a/WeChatTweak/ContactData.m +++ /dev/null @@ -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 diff --git a/WeChatTweak/Controller/Base.lproj/TweakPreferencesController.xib b/WeChatTweak/Controller/Base.lproj/TweakPreferencesController.xib index 16dffdd..d7b3750 100644 --- a/WeChatTweak/Controller/Base.lproj/TweakPreferencesController.xib +++ b/WeChatTweak/Controller/Base.lproj/TweakPreferencesController.xib @@ -1,14 +1,13 @@ - + - + - @@ -17,11 +16,11 @@ - + - + @@ -29,7 +28,7 @@ - + @@ -51,52 +50,16 @@ - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -116,7 +79,7 @@ - + @@ -125,29 +88,21 @@ - - - - + - - - - - - + diff --git a/WeChatTweak/Controller/TweakPreferencesController.m b/WeChatTweak/Controller/TweakPreferencesController.m index 88e8c83..30405e4 100644 --- a/WeChatTweak/Controller/TweakPreferencesController.m +++ b/WeChatTweak/Controller/TweakPreferencesController.m @@ -12,7 +12,6 @@ @interface TweakPreferencesController () @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; } diff --git a/WeChatTweak/Controller/en.lproj/TweakPreferencesController.strings b/WeChatTweak/Controller/en.lproj/TweakPreferencesController.strings index 2b419df..04a16ee 100644 --- a/WeChatTweak/Controller/en.lproj/TweakPreferencesController.strings +++ b/WeChatTweak/Controller/en.lproj/TweakPreferencesController.strings @@ -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"; diff --git a/WeChatTweak/Controller/zh-Hans.lproj/TweakPreferencesController.strings b/WeChatTweak/Controller/zh-Hans.lproj/TweakPreferencesController.strings index 08327e4..cc3726b 100644 --- a/WeChatTweak/Controller/zh-Hans.lproj/TweakPreferencesController.strings +++ b/WeChatTweak/Controller/zh-Hans.lproj/TweakPreferencesController.strings @@ -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" = "经典"; diff --git a/WeChatTweak/Controller/zh-Hant.lproj/TweakPreferencesController.strings b/WeChatTweak/Controller/zh-Hant.lproj/TweakPreferencesController.strings index 2d4bfba..2b6b543 100644 --- a/WeChatTweak/Controller/zh-Hant.lproj/TweakPreferencesController.strings +++ b/WeChatTweak/Controller/zh-Hant.lproj/TweakPreferencesController.strings @@ -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" = "經典"; diff --git a/WeChatTweak/WeChatTweak.h b/WeChatTweak/WeChatTweak.h index 2b0060f..a2c806d 100644 --- a/WeChatTweak/WeChatTweak.h +++ b/WeChatTweak/WeChatTweak.h @@ -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 diff --git a/WeChatTweak/WeChatTweak.m b/WeChatTweak/WeChatTweak.m index 1c31b04..d18b011 100755 --- a/WeChatTweak/WeChatTweak.m +++ b/WeChatTweak/WeChatTweak.m @@ -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]; }