-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTweak.x
More file actions
82 lines (69 loc) · 3.32 KB
/
Copy pathTweak.x
File metadata and controls
82 lines (69 loc) · 3.32 KB
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
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "CaptainHook.h"
CHDeclareClass(MPIncomingPhoneCallController);
CHOptimizedMethod(0, self, void, MPIncomingPhoneCallController, viewDidLoad) {
NSLog(@"opincall: Hooked viewDidLoad");
CHSuper(0, MPIncomingPhoneCallController, viewDidLoad);
UIView **_view = CHIvarRef(self, _view, UIView *);
NSString **_incomingCallNumber = CHIvarRef(self, _incomingCallNumber, NSString *);
NSString *incomingCallNumber = @"";
if (_incomingCallNumber) {
incomingCallNumber = *_incomingCallNumber;
if (!incomingCallNumber) {
*_incomingCallNumber = incomingCallNumber = @"NULL";
}
}
if (_view) {
UIView *bView = *_view;
if (bView) {
/*NSDictionary *attributes = @{NSFontAttributeName : [UIFont fontWithName:@"HelveticaNeue-Thin" size:48],
NSForegroundColorAttributeName : [UIColor whiteColor],
NSBackgroundColorAttributeName : [UIColor clearColor]};
UIImage *image = [OPImageHelper imageFromString:(incomingCallNumber) attributes:attributes size:bView.bounds.size];
UIImageView *numberImageView = [[UIImageView alloc] initWithImage:image];
[bView addSubview:numberImageView];*/
UILabel *bLabel = [[UILabel alloc] initWithFrame:CGRectMake(0.0, 117.0, bView.bounds.size.width, 100.0)];
bLabel.backgroundColor = [UIColor clearColor];
UIFont *font = [UIFont fontWithName:@"HelveticaNeue-Thin" size:71];
bLabel.font = font;
bLabel.numberOfLines = 0;
bLabel.userInteractionEnabled = NO;
CGRect drawRect = [incomingCallNumber boundingRectWithSize:CGSizeMake(bView.bounds.size.width, 2000.0)
options:NSStringDrawingUsesLineFragmentOrigin
attributes:@{NSFontAttributeName: font}
context: nil];
bLabel.frame = CGRectOffset(drawRect, 0.0, 120.0);
bLabel.lineBreakMode = NSLineBreakByCharWrapping;
bLabel.text = incomingCallNumber;
bLabel.textColor = [UIColor whiteColor];
bLabel.textAlignment = NSTextAlignmentCenter;
[bView addSubview: bLabel];
}
else {
/*UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"CAO"
message:(incomingCallNumber)
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil, nil];
[alert show];*/
NSLog(@"Incoming Number is [%@]", incomingCallNumber);
}
}
}
CHDeclareClass(SBPluginManager);
CHOptimizedMethod(1, self, Class, SBPluginManager, loadPluginBundle, NSBundle *, bundle) {
id ret = CHSuper(1, SBPluginManager, loadPluginBundle, bundle);
if ([[bundle bundleIdentifier] isEqualToString:@"com.apple.mobilephone.incomingcall"] && [bundle isLoaded]) {
NSLog(@"iAnnounce: SBPluginManager loaded com.apple.mobilephone.incomingcall");
CHLoadLateClass(MPIncomingPhoneCallController);
CHHook(0, MPIncomingPhoneCallController, viewDidLoad);
}
return ret;
}
CHConstructor {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
CHLoadLateClass(SBPluginManager);
CHHook(1, SBPluginManager, loadPluginBundle);
[pool drain];
}