-
Notifications
You must be signed in to change notification settings - Fork 1
/
Tweak.xmi
43 lines (34 loc) · 1.07 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
#import "headers/SpringBoard.h"
#import "headers/TLITunesTone.h"
#import "headers/TLToneManager.h"
#import "rocketbootstrap.h"
#import <AVFoundation/AVFoundation.h>
#import <AppSupport/CPDistributedMessagingCenter.h>
static NSString *randomStringWithLength(int len, NSString *type){
NSString *letters;
if ([type isEqualToString:@"PID"]){
letters = @"0123456789";
}else if([type isEqualToString:@"GUID"]){
letters = @"ABCDEF0123456789";
}else{
letters = @"ABCDEFGHIJKLMNOPQRSTUVWXYZ";
}
NSMutableString *randomString = [NSMutableString stringWithCapacity: len];
for (int i=0; i<len; i++) {
[randomString appendFormat: @"%C", [letters characterAtIndex: arc4random_uniform([letters length])]];
}
return randomString;
}
#include "hooks/SpringBoardHook.xm"
#include "hooks/Ringtone4AllHook.xm"
%ctor{
NSString* bundleID = [[NSBundle mainBundle] bundleIdentifier];
if ([bundleID isEqualToString:@"com.apple.springboard"]){
%init(SpringBoard);
}else{
Class clazz = NSClassFromString(@"Ringtone4All");
if (clazz){
%init(Ringtone4All);
}
}
}