mirror of
https://github.com/Sunnyyoung/WeChatTweak-macOS.git
synced 2025-07-07 07:56:06 +08:00
1. Remove Alfred workflow Python dependency 2. Remove Alfred JSON compressing
This commit is contained in:
parent
82e7f6e113
commit
f6482b1d96
10
Gemfile.lock
10
Gemfile.lock
|
@ -3,7 +3,7 @@ GEM
|
||||||
specs:
|
specs:
|
||||||
CFPropertyList (3.0.5)
|
CFPropertyList (3.0.5)
|
||||||
rexml
|
rexml
|
||||||
activesupport (6.1.4.4)
|
activesupport (6.1.5)
|
||||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||||
i18n (>= 1.6, < 2)
|
i18n (>= 1.6, < 2)
|
||||||
minitest (>= 5.1)
|
minitest (>= 5.1)
|
||||||
|
@ -16,10 +16,10 @@ GEM
|
||||||
json (>= 1.5.1)
|
json (>= 1.5.1)
|
||||||
atomos (0.1.3)
|
atomos (0.1.3)
|
||||||
claide (1.1.0)
|
claide (1.1.0)
|
||||||
cocoapods (1.11.2)
|
cocoapods (1.11.3)
|
||||||
addressable (~> 2.8)
|
addressable (~> 2.8)
|
||||||
claide (>= 1.0.2, < 2.0)
|
claide (>= 1.0.2, < 2.0)
|
||||||
cocoapods-core (= 1.11.2)
|
cocoapods-core (= 1.11.3)
|
||||||
cocoapods-deintegrate (>= 1.0.3, < 2.0)
|
cocoapods-deintegrate (>= 1.0.3, < 2.0)
|
||||||
cocoapods-downloader (>= 1.4.0, < 2.0)
|
cocoapods-downloader (>= 1.4.0, < 2.0)
|
||||||
cocoapods-plugins (>= 1.0.0, < 2.0)
|
cocoapods-plugins (>= 1.0.0, < 2.0)
|
||||||
|
@ -34,7 +34,7 @@ GEM
|
||||||
nap (~> 1.0)
|
nap (~> 1.0)
|
||||||
ruby-macho (>= 1.0, < 3.0)
|
ruby-macho (>= 1.0, < 3.0)
|
||||||
xcodeproj (>= 1.21.0, < 2.0)
|
xcodeproj (>= 1.21.0, < 2.0)
|
||||||
cocoapods-core (1.11.2)
|
cocoapods-core (1.11.3)
|
||||||
activesupport (>= 5.0, < 7)
|
activesupport (>= 5.0, < 7)
|
||||||
addressable (~> 2.8)
|
addressable (~> 2.8)
|
||||||
algoliasearch (~> 1.0)
|
algoliasearch (~> 1.0)
|
||||||
|
@ -63,7 +63,7 @@ GEM
|
||||||
fuzzy_match (2.0.4)
|
fuzzy_match (2.0.4)
|
||||||
gh_inspector (1.1.3)
|
gh_inspector (1.1.3)
|
||||||
httpclient (2.8.3)
|
httpclient (2.8.3)
|
||||||
i18n (1.9.1)
|
i18n (1.10.0)
|
||||||
concurrent-ruby (~> 1.0)
|
concurrent-ruby (~> 1.0)
|
||||||
json (2.6.1)
|
json (2.6.1)
|
||||||
minitest (5.15.0)
|
minitest (5.15.0)
|
||||||
|
|
1
Podfile
1
Podfile
|
@ -4,7 +4,6 @@ inhibit_all_warnings!
|
||||||
target 'WeChatTweak' do
|
target 'WeChatTweak' do
|
||||||
pod 'JRSwizzle'
|
pod 'JRSwizzle'
|
||||||
pod 'GCDWebServer'
|
pod 'GCDWebServer'
|
||||||
pod 'YYModel'
|
|
||||||
end
|
end
|
||||||
|
|
||||||
post_install do |installer|
|
post_install do |installer|
|
||||||
|
|
|
@ -3,24 +3,20 @@ PODS:
|
||||||
- GCDWebServer/Core (= 3.5.4)
|
- GCDWebServer/Core (= 3.5.4)
|
||||||
- GCDWebServer/Core (3.5.4)
|
- GCDWebServer/Core (3.5.4)
|
||||||
- JRSwizzle (1.0)
|
- JRSwizzle (1.0)
|
||||||
- YYModel (1.0.4)
|
|
||||||
|
|
||||||
DEPENDENCIES:
|
DEPENDENCIES:
|
||||||
- GCDWebServer
|
- GCDWebServer
|
||||||
- JRSwizzle
|
- JRSwizzle
|
||||||
- YYModel
|
|
||||||
|
|
||||||
SPEC REPOS:
|
SPEC REPOS:
|
||||||
trunk:
|
trunk:
|
||||||
- GCDWebServer
|
- GCDWebServer
|
||||||
- JRSwizzle
|
- JRSwizzle
|
||||||
- YYModel
|
|
||||||
|
|
||||||
SPEC CHECKSUMS:
|
SPEC CHECKSUMS:
|
||||||
GCDWebServer: 2c156a56c8226e2d5c0c3f208a3621ccffbe3ce4
|
GCDWebServer: 2c156a56c8226e2d5c0c3f208a3621ccffbe3ce4
|
||||||
JRSwizzle: dd5ead5d913a0f29e7f558200165849f006bb1e3
|
JRSwizzle: dd5ead5d913a0f29e7f558200165849f006bb1e3
|
||||||
YYModel: 2a7fdd96aaa4b86a824e26d0c517de8928c04b30
|
|
||||||
|
|
||||||
PODFILE CHECKSUM: cae308b81d1bbf94a739799a5bf2524cf9bec366
|
PODFILE CHECKSUM: 63b2e533dfa408b1a24337678cd9025cc987011f
|
||||||
|
|
||||||
COCOAPODS: 1.11.2
|
COCOAPODS: 1.11.3
|
||||||
|
|
Binary file not shown.
|
@ -13,7 +13,6 @@
|
||||||
7D54A05C20E74D9400CB5306 /* TweakPreferencesController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 7D54A05E20E74D9400CB5306 /* TweakPreferencesController.xib */; };
|
7D54A05C20E74D9400CB5306 /* TweakPreferencesController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 7D54A05E20E74D9400CB5306 /* TweakPreferencesController.xib */; };
|
||||||
7D54A06A20E74FE500CB5306 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 7D54A06C20E74FE500CB5306 /* Localizable.strings */; };
|
7D54A06A20E74FE500CB5306 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 7D54A06C20E74FE500CB5306 /* Localizable.strings */; };
|
||||||
7D64150827A9469900A8A398 /* ContextMenu.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D64150627A9469900A8A398 /* ContextMenu.m */; };
|
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 */; };
|
7D64150C27A94B9600A8A398 /* Directory.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D64150B27A94B9600A8A398 /* Directory.m */; };
|
||||||
7D64150E27A94BEA00A8A398 /* MultipleInstances.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D64150D27A94BEA00A8A398 /* MultipleInstances.m */; };
|
7D64150E27A94BEA00A8A398 /* MultipleInstances.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D64150D27A94BEA00A8A398 /* MultipleInstances.m */; };
|
||||||
7D64151027A94DE200A8A398 /* PreferencesWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D64150F27A94DE200A8A398 /* PreferencesWindow.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 = "<group>"; };
|
7D54A07120E7535F00CB5306 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Localizable.strings"; sourceTree = "<group>"; };
|
||||||
7D54A07220E7536300CB5306 /* zh-Hant */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant"; path = "zh-Hant.lproj/Localizable.strings"; sourceTree = "<group>"; };
|
7D54A07220E7536300CB5306 /* zh-Hant */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant"; path = "zh-Hant.lproj/Localizable.strings"; sourceTree = "<group>"; };
|
||||||
7D64150627A9469900A8A398 /* ContextMenu.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ContextMenu.m; sourceTree = "<group>"; };
|
7D64150627A9469900A8A398 /* ContextMenu.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ContextMenu.m; sourceTree = "<group>"; };
|
||||||
7D64150927A9481C00A8A398 /* ContactData.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ContactData.m; sourceTree = "<group>"; };
|
|
||||||
7D64150B27A94B9600A8A398 /* Directory.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Directory.m; sourceTree = "<group>"; };
|
7D64150B27A94B9600A8A398 /* Directory.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Directory.m; sourceTree = "<group>"; };
|
||||||
7D64150D27A94BEA00A8A398 /* MultipleInstances.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MultipleInstances.m; sourceTree = "<group>"; };
|
7D64150D27A94BEA00A8A398 /* MultipleInstances.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MultipleInstances.m; sourceTree = "<group>"; };
|
||||||
7D64150F27A94DE200A8A398 /* PreferencesWindow.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PreferencesWindow.m; sourceTree = "<group>"; };
|
7D64150F27A94DE200A8A398 /* PreferencesWindow.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PreferencesWindow.m; sourceTree = "<group>"; };
|
||||||
7D64B96727853C2100A07164 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/TweakPreferencesController.strings; sourceTree = "<group>"; };
|
|
||||||
7D64B96827853C2800A07164 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/TweakPreferencesController.strings"; sourceTree = "<group>"; };
|
|
||||||
7D64B96927853C2B00A07164 /* zh-Hant */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant"; path = "zh-Hant.lproj/TweakPreferencesController.strings"; sourceTree = "<group>"; };
|
|
||||||
7D9049F31F82A415004E6370 /* fishhook.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fishhook.c; sourceTree = "<group>"; };
|
7D9049F31F82A415004E6370 /* fishhook.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fishhook.c; sourceTree = "<group>"; };
|
||||||
7D9049F41F82A415004E6370 /* fishhook.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = fishhook.h; sourceTree = "<group>"; };
|
7D9049F41F82A415004E6370 /* fishhook.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = fishhook.h; sourceTree = "<group>"; };
|
||||||
|
7DAE1DD727E828960009C01E /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/TweakPreferencesController.strings; sourceTree = "<group>"; };
|
||||||
|
7DAE1DD927E828A50009C01E /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/TweakPreferencesController.strings"; sourceTree = "<group>"; };
|
||||||
|
7DAE1DDB27E828B00009C01E /* zh-Hant */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant"; path = "zh-Hant.lproj/TweakPreferencesController.strings"; sourceTree = "<group>"; };
|
||||||
7DF842271F40583F00D42D79 /* WeChatTweak.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = WeChatTweak.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
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 = "<group>"; };
|
7DF8422A1F40583F00D42D79 /* WeChatTweak.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WeChatTweak.h; sourceTree = "<group>"; };
|
||||||
7DF8422B1F40583F00D42D79 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
7DF8422B1F40583F00D42D79 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||||
|
@ -149,7 +147,6 @@
|
||||||
7D64150D27A94BEA00A8A398 /* MultipleInstances.m */,
|
7D64150D27A94BEA00A8A398 /* MultipleInstances.m */,
|
||||||
7D64150F27A94DE200A8A398 /* PreferencesWindow.m */,
|
7D64150F27A94DE200A8A398 /* PreferencesWindow.m */,
|
||||||
7D64150627A9469900A8A398 /* ContextMenu.m */,
|
7D64150627A9469900A8A398 /* ContextMenu.m */,
|
||||||
7D64150927A9481C00A8A398 /* ContactData.m */,
|
|
||||||
7D14E5A21F6447DB00D75132 /* Alfred.h */,
|
7D14E5A21F6447DB00D75132 /* Alfred.h */,
|
||||||
7D14E5A31F6447DB00D75132 /* Alfred.m */,
|
7D14E5A31F6447DB00D75132 /* Alfred.m */,
|
||||||
7D5AAF3720DF4BB300860EEE /* Vendor */,
|
7D5AAF3720DF4BB300860EEE /* Vendor */,
|
||||||
|
@ -314,7 +311,6 @@
|
||||||
7D64150827A9469900A8A398 /* ContextMenu.m in Sources */,
|
7D64150827A9469900A8A398 /* ContextMenu.m in Sources */,
|
||||||
7D2194CC264701950068F4CC /* AntiRevoke.m in Sources */,
|
7D2194CC264701950068F4CC /* AntiRevoke.m in Sources */,
|
||||||
7DF842341F4058AB00D42D79 /* WeChatTweak.m in Sources */,
|
7DF842341F4058AB00D42D79 /* WeChatTweak.m in Sources */,
|
||||||
7D64150A27A9481C00A8A398 /* ContactData.m in Sources */,
|
|
||||||
7D9049F51F82A41A004E6370 /* fishhook.c in Sources */,
|
7D9049F51F82A41A004E6370 /* fishhook.c in Sources */,
|
||||||
7D64151027A94DE200A8A398 /* PreferencesWindow.m in Sources */,
|
7D64151027A94DE200A8A398 /* PreferencesWindow.m in Sources */,
|
||||||
7D64150E27A94BEA00A8A398 /* MultipleInstances.m in Sources */,
|
7D64150E27A94BEA00A8A398 /* MultipleInstances.m in Sources */,
|
||||||
|
@ -330,9 +326,9 @@
|
||||||
isa = PBXVariantGroup;
|
isa = PBXVariantGroup;
|
||||||
children = (
|
children = (
|
||||||
7D54A05F20E74E4600CB5306 /* Base */,
|
7D54A05F20E74E4600CB5306 /* Base */,
|
||||||
7D64B96727853C2100A07164 /* en */,
|
7DAE1DD727E828960009C01E /* en */,
|
||||||
7D64B96827853C2800A07164 /* zh-Hans */,
|
7DAE1DD927E828A50009C01E /* zh-Hans */,
|
||||||
7D64B96927853C2B00A07164 /* zh-Hant */,
|
7DAE1DDB27E828B00009C01E /* zh-Hant */,
|
||||||
);
|
);
|
||||||
name = TweakPreferencesController.xib;
|
name = TweakPreferencesController.xib;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
// Copyright © 2017年 Sunnyyoung. All rights reserved.
|
// Copyright © 2017年 Sunnyyoung. All rights reserved.
|
||||||
//
|
//
|
||||||
|
|
||||||
#import <YYModel/YYModel.h>
|
#import <objc/runtime.h>
|
||||||
#import <GCDWebServer/GCDWebServer.h>
|
#import <GCDWebServer/GCDWebServer.h>
|
||||||
#import <GCDWebServer/GCDWebServerDataResponse.h>
|
#import <GCDWebServer/GCDWebServerDataResponse.h>
|
||||||
|
|
||||||
|
|
|
@ -17,8 +17,6 @@
|
||||||
|
|
||||||
@implementation AlfredManager
|
@implementation AlfredManager
|
||||||
|
|
||||||
static int port = 48065;
|
|
||||||
|
|
||||||
+ (void)load {
|
+ (void)load {
|
||||||
[AlfredManager.sharedInstance startListener];
|
[AlfredManager.sharedInstance startListener];
|
||||||
}
|
}
|
||||||
|
@ -37,17 +35,19 @@ static int port = 48065;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
self.server = [[GCDWebServer alloc] init];
|
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) {
|
[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 *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 = ({
|
NSArray<WCContactData *> *contacts = ({
|
||||||
MMServiceCenter *serviceCenter = [objc_getClass("MMServiceCenter") defaultCenter];
|
MMServiceCenter *serviceCenter = [objc_getClass("MMServiceCenter") defaultCenter];
|
||||||
ContactStorage *contactStorage = [serviceCenter getService:objc_getClass("ContactStorage")];
|
ContactStorage *contactStorage = [serviceCenter getService:objc_getClass("ContactStorage")];
|
||||||
|
@ -57,9 +57,10 @@ static int port = 48065;
|
||||||
[array addObjectsFromArray:[groupStorage GetGroupContactList:2 ContactType:0]];
|
[array addObjectsFromArray:[groupStorage GetGroupContactList:2 ContactType:0]];
|
||||||
array;
|
array;
|
||||||
});
|
});
|
||||||
NSArray<WCContactData *> *results = ({
|
NSArray<NSDictionary<NSString *, id> *> *items = ({
|
||||||
NSMutableArray<WCContactData *> *results = [NSMutableArray array];
|
NSMutableArray<NSDictionary<NSString *, id> *> *items = NSMutableArray.array;
|
||||||
for (WCContactData *contact in contacts) {
|
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 isOfficialAccount = (contact.m_uiCertificationFlag >> 0x3 & 0x1) == 1;
|
||||||
BOOL containsNickName = [contact.m_nsNickName.lowercaseString containsString:keyword];
|
BOOL containsNickName = [contact.m_nsNickName.lowercaseString containsString:keyword];
|
||||||
BOOL containsUsername = [contact.m_nsUsrName.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 containsRemarkPinyin = [contact.m_nsRemarkPYFull.lowercaseString containsString:keyword];
|
||||||
BOOL matchRemarkShortPinyin = [contact.m_nsRemarkPYShort.lowercaseString isEqualToString:keyword];
|
BOOL matchRemarkShortPinyin = [contact.m_nsRemarkPYShort.lowercaseString isEqualToString:keyword];
|
||||||
if (!isOfficialAccount && (containsNickName || containsUsername || containsAliasName || containsRemark || containsNickNamePinyin || containsRemarkPinyin || matchRemarkShortPinyin)) {
|
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) {
|
[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 = ({
|
WCContactData *contact = ({
|
||||||
NSString *session = request.query[@"session"];
|
NSString *session = request.query[@"session"];
|
||||||
WCContactData *contact = nil;
|
WCContactData *contact = nil;
|
||||||
|
@ -108,8 +119,10 @@ static int port = 48065;
|
||||||
});
|
});
|
||||||
return [GCDWebServerResponse responseWithStatusCode:200];
|
return [GCDWebServerResponse responseWithStatusCode:200];
|
||||||
}];
|
}];
|
||||||
[self.server startWithOptions:@{GCDWebServerOption_Port: [NSNumber numberWithInt:port],
|
[self.server startWithOptions:@{
|
||||||
GCDWebServerOption_BindToLocalhost: @(YES)} error:nil];
|
GCDWebServerOption_Port: @(48065),
|
||||||
|
GCDWebServerOption_BindToLocalhost: @(YES)
|
||||||
|
} error:nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)stopListener {
|
- (void)stopListener {
|
||||||
|
|
|
@ -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"?>
|
<?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>
|
<dependencies>
|
||||||
<deployment identifier="macosx"/>
|
<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"/>
|
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<objects>
|
<objects>
|
||||||
<customObject id="-2" userLabel="File's Owner" customClass="TweakPreferencesController">
|
<customObject id="-2" userLabel="File's Owner" customClass="TweakPreferencesController">
|
||||||
<connections>
|
<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="notificationTypeButton" destination="6x2-KV-p8w" id="Kfn-2a-Yup"/>
|
||||||
<outlet property="revokedMessageStyleButton" destination="eqS-1n-9dO" id="QVg-Sy-CoY"/>
|
<outlet property="revokedMessageStyleButton" destination="eqS-1n-9dO" id="QVg-Sy-CoY"/>
|
||||||
<outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
|
<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="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||||
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
|
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
|
||||||
<customView id="Hz6-mo-xeY">
|
<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"/>
|
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="1000" translatesAutoresizingMaskIntoConstraints="NO" id="B87-eD-uhI">
|
<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">
|
<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"/>
|
<font key="font" metaFont="system"/>
|
||||||
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
|
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
|
||||||
|
@ -29,7 +28,7 @@
|
||||||
</textFieldCell>
|
</textFieldCell>
|
||||||
</textField>
|
</textField>
|
||||||
<popUpButton verticalHuggingPriority="750" horizontalCompressionResistancePriority="1000" translatesAutoresizingMaskIntoConstraints="NO" id="6x2-KV-p8w">
|
<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">
|
<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"/>
|
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
|
||||||
<font key="font" metaFont="menu"/>
|
<font key="font" metaFont="menu"/>
|
||||||
|
@ -51,52 +50,16 @@
|
||||||
<action selector="switchNotificationTypeAction:" target="-2" id="xjO-Ck-wem"/>
|
<action selector="switchNotificationTypeAction:" target="-2" id="xjO-Ck-wem"/>
|
||||||
</connections>
|
</connections>
|
||||||
</popUpButton>
|
</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">
|
<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">
|
<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"/>
|
<font key="font" metaFont="system"/>
|
||||||
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
|
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
|
||||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||||
</textFieldCell>
|
</textFieldCell>
|
||||||
</textField>
|
</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">
|
<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">
|
<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"/>
|
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
|
||||||
<font key="font" metaFont="menu"/>
|
<font key="font" metaFont="menu"/>
|
||||||
|
@ -116,7 +79,7 @@
|
||||||
</connections>
|
</connections>
|
||||||
</popUpButton>
|
</popUpButton>
|
||||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="ftV-1F-OnB">
|
<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">
|
<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"/>
|
<font key="font" metaFont="system"/>
|
||||||
<color key="textColor" name="systemRedColor" catalog="System" colorSpace="catalog"/>
|
<color key="textColor" name="systemRedColor" catalog="System" colorSpace="catalog"/>
|
||||||
|
@ -125,29 +88,21 @@
|
||||||
</textField>
|
</textField>
|
||||||
</subviews>
|
</subviews>
|
||||||
<constraints>
|
<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="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 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="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="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 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 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="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="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="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="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="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"/>
|
<constraint firstItem="7wK-v5-BgQ" firstAttribute="trailing" secondItem="B87-eD-uhI" secondAttribute="trailing" id="ydo-VW-YRZ"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
<point key="canvasLocation" x="138.5" y="179"/>
|
<point key="canvasLocation" x="138.5" y="162"/>
|
||||||
</customView>
|
</customView>
|
||||||
</objects>
|
</objects>
|
||||||
</document>
|
</document>
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
@interface TweakPreferencesController () <MASPreferencesViewController>
|
@interface TweakPreferencesController () <MASPreferencesViewController>
|
||||||
|
|
||||||
@property (weak) IBOutlet NSPopUpButton *notificationTypeButton;
|
@property (weak) IBOutlet NSPopUpButton *notificationTypeButton;
|
||||||
@property (weak) IBOutlet NSPopUpButton *compressedJSONEnabledButton;
|
|
||||||
@property (weak) IBOutlet NSPopUpButton *revokedMessageStyleButton;
|
@property (weak) IBOutlet NSPopUpButton *revokedMessageStyleButton;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@ -32,7 +31,6 @@
|
||||||
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
|
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
|
||||||
RevokeNotificationType notificationType = [userDefaults integerForKey:WeChatTweakPreferenceRevokeNotificationTypeKey];
|
RevokeNotificationType notificationType = [userDefaults integerForKey:WeChatTweakPreferenceRevokeNotificationTypeKey];
|
||||||
[self.notificationTypeButton selectItemAtIndex:notificationType];
|
[self.notificationTypeButton selectItemAtIndex:notificationType];
|
||||||
[self.compressedJSONEnabledButton selectItemAtIndex:WeChatTweak.compressedJSONEnabled ? 0 : 1];
|
|
||||||
[self.revokedMessageStyleButton selectItemAtIndex:WeChatTweak.revokedMessageStyle];
|
[self.revokedMessageStyleButton selectItemAtIndex:WeChatTweak.revokedMessageStyle];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,11 +41,6 @@
|
||||||
[[NSUserDefaults standardUserDefaults] setInteger:type forKey:WeChatTweakPreferenceRevokeNotificationTypeKey];
|
[[NSUserDefaults standardUserDefaults] setInteger:type forKey:WeChatTweakPreferenceRevokeNotificationTypeKey];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction)switchCompressedJSONEnabledAction:(NSPopUpButton *)sender {
|
|
||||||
BOOL enabled = sender.indexOfSelectedItem == 0;
|
|
||||||
WeChatTweak.compressedJSONEnabled = enabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (IBAction)switchRevokedMessageStyleButton:(NSPopUpButton *)sender {
|
- (IBAction)switchRevokedMessageStyleButton:(NSPopUpButton *)sender {
|
||||||
WeChatTweak.revokedMessageStyle = sender.indexOfSelectedItem;
|
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"; */
|
/* Class = "NSTextFieldCell"; title = "Message recalled notification:"; ObjectID = "UKv-CM-nGt"; */
|
||||||
"UKv-CM-nGt.title" = "Message recalled notification:";
|
"UKv-CM-nGt.title" = "Message recalled notification:";
|
||||||
|
|
||||||
/* Class = "NSMenuItem"; title = "Disabled"; ObjectID = "Uk9-Oc-Jtv"; */
|
/* Class = "NSMenuItem"; title = "Disabled"; ObjectID = "Uk9-Oc-Jtv"; */
|
||||||
"Uk9-Oc-Jtv.title" = "Disabled";
|
"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"; */
|
/* Class = "NSMenuItem"; title = "All"; ObjectID = "da4-aJ-lEy"; */
|
||||||
"da4-aJ-lEy.title" = "All";
|
"da4-aJ-lEy.title" = "All";
|
||||||
|
|
||||||
|
@ -29,9 +14,6 @@
|
||||||
/* Class = "NSMenuItem"; title = "Inherited"; ObjectID = "gec-CY-E1x"; */
|
/* Class = "NSMenuItem"; title = "Inherited"; ObjectID = "gec-CY-E1x"; */
|
||||||
"gec-CY-E1x.title" = "Inherited";
|
"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"; */
|
/* Class = "NSTextFieldCell"; title = "Experimental feature"; ObjectID = "lHs-du-a6F"; */
|
||||||
"lHs-du-a6F.title" = "Experimental feature";
|
"lHs-du-a6F.title" = "Experimental feature";
|
||||||
|
|
||||||
|
|
|
@ -1,42 +1,24 @@
|
||||||
|
|
||||||
/* Class = "NSMenuItem"; title = "开启"; ObjectID = "10G-t9-s4T"; */
|
/* Class = "NSTextFieldCell"; title = "Message recalled notification:"; ObjectID = "UKv-CM-nGt"; */
|
||||||
"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"; */
|
|
||||||
"UKv-CM-nGt.title" = "消息撤回通知:";
|
"UKv-CM-nGt.title" = "消息撤回通知:";
|
||||||
|
|
||||||
/* Class = "NSMenuItem"; title = "关闭"; ObjectID = "Uk9-Oc-Jtv"; */
|
/* Class = "NSMenuItem"; title = "Disabled"; ObjectID = "Uk9-Oc-Jtv"; */
|
||||||
"Uk9-Oc-Jtv.title" = "关闭";
|
"Uk9-Oc-Jtv.title" = "关闭";
|
||||||
|
|
||||||
/* Class = "NSMenuItem"; title = "关闭"; ObjectID = "Vcv-eD-OM9"; */
|
/* Class = "NSMenuItem"; title = "All"; ObjectID = "da4-aJ-lEy"; */
|
||||||
"Vcv-eD-OM9.title" = "关闭";
|
|
||||||
|
|
||||||
/* Class = "NSMenuItem"; title = "全部接收"; ObjectID = "da4-aJ-lEy"; */
|
|
||||||
"da4-aJ-lEy.title" = "全部接收";
|
"da4-aJ-lEy.title" = "全部接收";
|
||||||
|
|
||||||
/* Class = "NSMenuItem"; title = "遮罩"; ObjectID = "gH0-wV-Bx0"; */
|
/* Class = "NSMenuItem"; title = "Mask"; ObjectID = "gH0-wV-Bx0"; */
|
||||||
"gH0-wV-Bx0.title" = "遮罩";
|
"gH0-wV-Bx0.title" = "遮罩";
|
||||||
|
|
||||||
/* Class = "NSMenuItem"; title = "跟随聊天设置"; ObjectID = "gec-CY-E1x"; */
|
/* Class = "NSMenuItem"; title = "Inherited"; ObjectID = "gec-CY-E1x"; */
|
||||||
"gec-CY-E1x.title" = "跟随聊天设置";
|
"gec-CY-E1x.title" = "跟随聊天设置";
|
||||||
|
|
||||||
/* Class = "NSTextFieldCell"; title = "Alfred JSON 压缩:"; ObjectID = "jHw-2a-B2t"; */
|
/* Class = "NSTextFieldCell"; title = "Experimental feature"; ObjectID = "lHs-du-a6F"; */
|
||||||
"jHw-2a-B2t.title" = "Alfred JSON 压缩:";
|
|
||||||
|
|
||||||
/* Class = "NSTextFieldCell"; title = "试验性功能"; ObjectID = "lHs-du-a6F"; */
|
|
||||||
"lHs-du-a6F.title" = "试验性功能";
|
"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" = "消息撤回样式:";
|
"mPT-nA-idf.title" = "消息撤回样式:";
|
||||||
|
|
||||||
/* Class = "NSMenuItem"; title = "经典"; ObjectID = "wRC-UO-k1G"; */
|
/* Class = "NSMenuItem"; title = "Classic"; ObjectID = "wRC-UO-k1G"; */
|
||||||
"wRC-UO-k1G.title" = "经典";
|
"wRC-UO-k1G.title" = "经典";
|
||||||
|
|
|
@ -1,42 +1,24 @@
|
||||||
|
|
||||||
/* Class = "NSMenuItem"; title = "開啟"; ObjectID = "10G-t9-s4T"; */
|
/* Class = "NSTextFieldCell"; title = "Message recalled notification:"; ObjectID = "UKv-CM-nGt"; */
|
||||||
"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"; */
|
|
||||||
"UKv-CM-nGt.title" = "消息撤回通知:";
|
"UKv-CM-nGt.title" = "消息撤回通知:";
|
||||||
|
|
||||||
/* Class = "NSMenuItem"; title = "關閉"; ObjectID = "Uk9-Oc-Jtv"; */
|
/* Class = "NSMenuItem"; title = "Disabled"; ObjectID = "Uk9-Oc-Jtv"; */
|
||||||
"Uk9-Oc-Jtv.title" = "關閉";
|
"Uk9-Oc-Jtv.title" = "關閉";
|
||||||
|
|
||||||
/* Class = "NSMenuItem"; title = "關閉"; ObjectID = "Vcv-eD-OM9"; */
|
/* Class = "NSMenuItem"; title = "All"; ObjectID = "da4-aJ-lEy"; */
|
||||||
"Vcv-eD-OM9.title" = "關閉";
|
|
||||||
|
|
||||||
/* Class = "NSMenuItem"; title = "全部接收"; ObjectID = "da4-aJ-lEy"; */
|
|
||||||
"da4-aJ-lEy.title" = "全部接收";
|
"da4-aJ-lEy.title" = "全部接收";
|
||||||
|
|
||||||
/* Class = "NSMenuItem"; title = "遮罩"; ObjectID = "gH0-wV-Bx0"; */
|
/* Class = "NSMenuItem"; title = "Mask"; ObjectID = "gH0-wV-Bx0"; */
|
||||||
"gH0-wV-Bx0.title" = "遮罩";
|
"gH0-wV-Bx0.title" = "遮罩";
|
||||||
|
|
||||||
/* Class = "NSMenuItem"; title = "跟隨聊天設置"; ObjectID = "gec-CY-E1x"; */
|
/* Class = "NSMenuItem"; title = "Inherited"; ObjectID = "gec-CY-E1x"; */
|
||||||
"gec-CY-E1x.title" = "跟隨聊天設置";
|
"gec-CY-E1x.title" = "跟隨聊天設置";
|
||||||
|
|
||||||
/* Class = "NSTextFieldCell"; title = "Alfred JSON 壓縮:"; ObjectID = "jHw-2a-B2t"; */
|
/* Class = "NSTextFieldCell"; title = "Experimental feature"; ObjectID = "lHs-du-a6F"; */
|
||||||
"jHw-2a-B2t.title" = "Alfred JSON 壓縮:";
|
|
||||||
|
|
||||||
/* Class = "NSTextFieldCell"; title = "試驗性功能"; ObjectID = "lHs-du-a6F"; */
|
|
||||||
"lHs-du-a6F.title" = "試驗性功能";
|
"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" = "消息撤回樣式:";
|
"mPT-nA-idf.title" = "消息撤回樣式:";
|
||||||
|
|
||||||
/* Class = "NSMenuItem"; title = "經典"; ObjectID = "wRC-UO-k1G"; */
|
/* Class = "NSMenuItem"; title = "Classic"; ObjectID = "wRC-UO-k1G"; */
|
||||||
"wRC-UO-k1G.title" = "經典";
|
"wRC-UO-k1G.title" = "經典";
|
||||||
|
|
|
@ -18,7 +18,6 @@ typedef NS_ENUM(NSUInteger, WTRevokedMessageStyle) {
|
||||||
|
|
||||||
@interface WeChatTweak : NSObject
|
@interface WeChatTweak : NSObject
|
||||||
|
|
||||||
@property (nonatomic, assign, class) BOOL compressedJSONEnabled;
|
|
||||||
@property (nonatomic, assign, class) WTRevokedMessageStyle revokedMessageStyle;
|
@property (nonatomic, assign, class) WTRevokedMessageStyle revokedMessageStyle;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -8,20 +8,10 @@
|
||||||
|
|
||||||
#import "WeChatTweak.h"
|
#import "WeChatTweak.h"
|
||||||
|
|
||||||
static NSString * const WeChatTweakCompressedJSONEnabledKey = @"WeChatTweakCompressedJSONEnabledKey";
|
|
||||||
static NSString * const WeChatTweakRevokedMessageStyleKey = @"WeChatTweakRevokedMessageStyleKey";
|
static NSString * const WeChatTweakRevokedMessageStyleKey = @"WeChatTweakRevokedMessageStyleKey";
|
||||||
|
|
||||||
@implementation WeChatTweak
|
@implementation WeChatTweak
|
||||||
|
|
||||||
+ (BOOL)compressedJSONEnabled {
|
|
||||||
return [NSUserDefaults.standardUserDefaults boolForKey:WeChatTweakCompressedJSONEnabledKey];
|
|
||||||
}
|
|
||||||
|
|
||||||
+ (void)setCompressedJSONEnabled:(BOOL)compressedJSONEnabled {
|
|
||||||
[NSUserDefaults.standardUserDefaults setBool:compressedJSONEnabled forKey:WeChatTweakCompressedJSONEnabledKey];
|
|
||||||
[NSUserDefaults.standardUserDefaults synchronize];
|
|
||||||
}
|
|
||||||
|
|
||||||
+ (WTRevokedMessageStyle)revokedMessageStyle {
|
+ (WTRevokedMessageStyle)revokedMessageStyle {
|
||||||
return [NSUserDefaults.standardUserDefaults integerForKey:WeChatTweakRevokedMessageStyleKey];
|
return [NSUserDefaults.standardUserDefaults integerForKey:WeChatTweakRevokedMessageStyleKey];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user