mirror of
https://github.com/Sunnyyoung/WeChatTweak-macOS.git
synced 2025-08-24 03:06:38 +08:00
Add alfred result list avatar support
This commit is contained in:
parent
8942723431
commit
52c1c42b89
|
@ -17,4 +17,4 @@ SPEC CHECKSUMS:
|
||||||
|
|
||||||
PODFILE CHECKSUM: af44d62b300e2c55cb63386ec4be3227b93c7761
|
PODFILE CHECKSUM: af44d62b300e2c55cb63386ec4be3227b93c7761
|
||||||
|
|
||||||
COCOAPODS: 1.3.1
|
COCOAPODS: 1.4.0
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
- 重新打开应用无需手机认证
|
- 重新打开应用无需手机认证
|
||||||
- UI界面设置面板
|
- UI界面设置面板
|
||||||
- 支持 Alfred workflow
|
- 支持 Alfred workflow
|
||||||
|
- 支持 Launchbar action
|
||||||
|
|
||||||
## 使用
|
## 使用
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,7 @@ A dynamic library tweak for WeChat macOS.
|
||||||
- Auto login without authentication
|
- Auto login without authentication
|
||||||
- UI Interface settings panel
|
- UI Interface settings panel
|
||||||
- Alfred workflow support
|
- Alfred workflow support
|
||||||
|
- Lauchbar action support
|
||||||
|
|
||||||
## Quick Start
|
## Quick Start
|
||||||
|
|
||||||
|
|
Binary file not shown.
|
@ -3,7 +3,7 @@
|
||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<dict>
|
||||||
<key>BuildMachineOSBuild</key>
|
<key>BuildMachineOSBuild</key>
|
||||||
<string>17C205</string>
|
<string>17D102</string>
|
||||||
<key>CFBundleDevelopmentRegion</key>
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
<string>en</string>
|
<string>en</string>
|
||||||
<key>CFBundleExecutable</key>
|
<key>CFBundleExecutable</key>
|
||||||
|
|
Binary file not shown.
|
@ -51,6 +51,15 @@ static void __attribute__((constructor)) tweak(void) {
|
||||||
[objc_getClass("MessageService") jr_swizzleMethod:NSSelectorFromString(@"onRevokeMsg:") withMethod:@selector(tweak_onRevokeMsg:) error:nil];
|
[objc_getClass("MessageService") jr_swizzleMethod:NSSelectorFromString(@"onRevokeMsg:") withMethod:@selector(tweak_onRevokeMsg:) error:nil];
|
||||||
[objc_getClass("CUtility") jr_swizzleClassMethod:NSSelectorFromString(@"HasWechatInstance") withClassMethod:@selector(tweak_HasWechatInstance) error:nil];
|
[objc_getClass("CUtility") jr_swizzleClassMethod:NSSelectorFromString(@"HasWechatInstance") withClassMethod:@selector(tweak_HasWechatInstance) error:nil];
|
||||||
[objc_getClass("MASPreferencesWindowController") jr_swizzleMethod:NSSelectorFromString(@"initWithViewControllers:") withMethod:@selector(tweak_initWithViewControllers:) error:nil];
|
[objc_getClass("MASPreferencesWindowController") jr_swizzleMethod:NSSelectorFromString(@"initWithViewControllers:") withMethod:@selector(tweak_initWithViewControllers:) error:nil];
|
||||||
|
|
||||||
|
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@:@");
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - No Revoke Message
|
#pragma mark - No Revoke Message
|
||||||
|
@ -176,4 +185,17 @@ static void __attribute__((constructor)) tweak(void) {
|
||||||
return [self tweak_initWithViewControllers:viewControllers];
|
return [self tweak_initWithViewControllers:viewControllers];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma mark - WCContact Data
|
||||||
|
|
||||||
|
- (NSString *)wt_avatarPath {
|
||||||
|
MMAvatarService *avatarService = [[objc_getClass("MMServiceCenter") defaultCenter] getService:objc_getClass("MMAvatarService")];
|
||||||
|
NSString *pathString = [NSString stringWithFormat:@"%@/%@", [avatarService avatarCachePath], [((WCContactData *)self).m_nsHeadImgUrl md5String]];
|
||||||
|
return [NSFileManager.defaultManager fileExistsAtPath:pathString] ? pathString : @"";
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)setWt_avatarPath:(NSString *)avatarPath {
|
||||||
|
// For readonly
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -8,6 +8,14 @@
|
||||||
|
|
||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
|
#import <objc/runtime.h>
|
||||||
|
#import <objc/message.h>
|
||||||
|
|
||||||
|
@interface NSString (MD5)
|
||||||
|
|
||||||
|
- (NSString *)md5String;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
@interface WeChat : NSObject
|
@interface WeChat : NSObject
|
||||||
|
|
||||||
|
@ -44,6 +52,7 @@
|
||||||
@interface WCContactData : NSObject
|
@interface WCContactData : NSObject
|
||||||
|
|
||||||
@property(nonatomic) unsigned int m_uiCertificationFlag;
|
@property(nonatomic) unsigned int m_uiCertificationFlag;
|
||||||
|
@property(retain, nonatomic) NSString *m_nsHeadImgUrl;
|
||||||
@property(retain, nonatomic) NSString *m_nsNickName;
|
@property(retain, nonatomic) NSString *m_nsNickName;
|
||||||
@property(retain, nonatomic) NSString *m_nsUsrName;
|
@property(retain, nonatomic) NSString *m_nsUsrName;
|
||||||
@property(retain, nonatomic) NSString *m_nsAliasName;
|
@property(retain, nonatomic) NSString *m_nsAliasName;
|
||||||
|
@ -51,6 +60,7 @@
|
||||||
@property(retain, nonatomic) NSString *m_nsFullPY;
|
@property(retain, nonatomic) NSString *m_nsFullPY;
|
||||||
@property(retain, nonatomic) NSString *m_nsRemarkPYShort;
|
@property(retain, nonatomic) NSString *m_nsRemarkPYShort;
|
||||||
@property(retain, nonatomic) NSString *m_nsRemarkPYFull;
|
@property(retain, nonatomic) NSString *m_nsRemarkPYFull;
|
||||||
|
@property(retain, nonatomic) NSString *wt_avatarPath;
|
||||||
|
|
||||||
- (BOOL)isChatStatusNotifyOpen;
|
- (BOOL)isChatStatusNotifyOpen;
|
||||||
|
|
||||||
|
@ -101,6 +111,12 @@
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
@interface MMAvatarService: NSObject
|
||||||
|
|
||||||
|
- (NSString *)avatarCachePath;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
@protocol MASPreferencesViewController <NSObject>
|
@protocol MASPreferencesViewController <NSObject>
|
||||||
|
|
||||||
@property(readonly, nonatomic) NSString *toolbarItemLabel;
|
@property(readonly, nonatomic) NSString *toolbarItemLabel;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user