-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathTweak.xmi
120 lines (78 loc) · 2.58 KB
/
Tweak.xmi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#import "wechatbot-prefix-header.h"
#import <WCBFWStatic/WCBFWStatic.h>
#import <WCBFWDynamic/WCBFWDynamic.h>
#import <WCBStatic/WCBStatic.h>
#import <WCBDyLib/WCBDyLib.h>
#define kWCBSrcPath @"/Library/AppSupport/WeChatBot/"
#define kWCBImgSrcPath @"/Library/AppSupport/WeChatBot/imgs"
typedef void(^LogTestBlk)(void);
#pragma mark - XiaoMing
@interface WCBXiaoming: NSObject
@property (nonatomic, copy) NSString *name;
@property (nonatomic, assign) NSInteger age;
- (void)logInfo;
+ (void)sayHello;
@end
SUBCLASS(WCBXiaoming, NSObject)
NEWPROPERTY_T(NSInteger, assign, age);
NEWPROPERTY(NSString, copy, name);
NEW()
+(void)sayHello {
NSLog(@"xiaoming say hello.");
}
NEW()
- (void)logInfo {
NSLog(@"log info name: %@ age: %zd", self.name, self.age);
}
END_SUBCLASS()
#pragma mark - MicroMessengerAppDelegate
@interface MicroMessengerAppDelegate()
@property (nonatomic, strong) UIImage *img;
@property (nonatomic, assign) NSTimeInterval duration;
@property (nonatomic, copy) LogTestBlk logTest;
- (void)testXcTheosLogos;
@end
HOOK(MicroMessengerAppDelegate)
NEWPROPERTY(UIImage, retain, img);
NEWPROPERTY_T(double, assign, duration);
NEWPROPERTY_Block(LogTestBlk, logTest);
-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
BOOL rel = ORIG_T();
[self testHook];
[self testXcTheosLogos];
return rel;
}
NEW()
- (void)testHook {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Works for logos hook" message:nil delegate:nil cancelButtonTitle:@"cancel" otherButtonTitles:nil, nil];
[alert show];
[WCBStatic logInfo];
[WCBDyLib logInfo];
[WCBFWStatic logInfo];
[WCBFWDynamic logInfo];
UIImage *img = [UIImage imageWithContentsOfFile:[NSString stringWithFormat:@"%@/wcb_icon.png", kWCBImgSrcPath]];
self.img = img;
NSLog(@"[WeChatBot] img: %@", self.img);
UIImageView *imgView = [[UIImageView alloc] initWithImage:self.img];
[imgView sizeToFit];
imgView.center = CGPointMake(46, 60);
[self.window addSubview:imgView];
}
NEW()
- (void)testXcTheosLogos {
self.duration = [[NSDate date] timeIntervalSince1970];
__weak typeof(self)weakSelf = self;
self.logTest = ^{
NSLog(@"[WeChatBot] img: %@", weakSelf.img);
NSLog(@"[WeChatBot] duration: %f", weakSelf.duration);
};
if(self.logTest) {
self.logTest();
}
[GET_CLASS(WCBXiaoming) sayHello];
WCBXiaoming *xm = [GET_CLASS(WCBXiaoming) new];
xm.age = 18;
xm.name = @"wang xiao ming";
[xm logInfo];
}
END()