-
Notifications
You must be signed in to change notification settings - Fork 0
/
Tweak.m
83 lines (65 loc) · 1.46 KB
/
Tweak.m
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
#import <substrate.h>
#import <sys/sysctl.h>
static NSString *mobileName = nil;
static NSString *mobileNameKey = @"deviceName";
%ctor
{
mobileName = [[NSUserDefaults standardUserDefaults] objectForKey:mobileNameKey];
}
NSString *mobieNameByOriginName(NSString *oldName)
{
if (mobileName)
{
return mobileName;
}
else
{
return oldName;
}
}
%hook QQChatViewController
- (BOOL)sendTextMsg:(id)arg1 showText:(NSString *)arg2
{
if ([arg2 containsString:@"设备型号"]) {
mobileName = [arg2 substringFromIndex:@"设备型号".length];
[[NSUserDefaults standardUserDefaults] setObject:mobileName forKey:mobileNameKey];
[[NSUserDefaults standardUserDefaults] synchronize];
}
if ([arg2 containsString:@"设备型号原值"])
{
mobileName = nil;
[[NSUserDefaults standardUserDefaults] setObject:mobileName forKey:mobileNameKey];
[[NSUserDefaults standardUserDefaults] synchronize];
}
return %orig;
}
%end
%hook UIDevice
- (id)platform
{
id ret = %orig;
return mobieNameByOriginName(ret);
}
%end
%hook APMDeviceInfo
+ (id)platform
{
id ret = %orig;
return mobieNameByOriginName(ret);
}
%end
%hook BeaconDeviceUtil
//对应手机在线状态
+ (id)model {
id ret = %orig;
return mobieNameByOriginName(ret);
}
%end
%hook QZDevice
//对应QQ空间说说手机型号
- (id)getModel
{
id ret = %orig;
return mobieNameByOriginName(ret);
}
%end