forked from PoomSmart/AppPad
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTweak.x
More file actions
65 lines (47 loc) · 1.39 KB
/
Tweak.x
File metadata and controls
65 lines (47 loc) · 1.39 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
#define tweakIdentifier @"com.ps.apppad"
#import <Foundation/Foundation.h>
#import <SpringBoard/SBApplication.h>
#import <AppList/AppList.h>
#import <theos/IOSMacros.h>
#import "../PSPrefs/PSPrefs.x"
@interface SBApplicationInfo : NSObject
@property (nonatomic, copy, readonly) NSString *bundleIdentifier;
@end
static BOOL shouldEnableForBundleIdentifier(NSString *bundleIdentifier) {
NSDictionary *preferences = Prefs();
NSArray <NSString *> *value = preferences[@"AppPad"];
return ![value containsObject:bundleIdentifier];
}
%hook UIApplication
- (BOOL)_shouldBigify {
return shouldEnableForBundleIdentifier(NSBundle.mainBundle.bundleIdentifier);
}
%end
%group SB
%hook SBApplicationInfo
- (bool)disableClassicMode {
return shouldEnableForBundleIdentifier(self.bundleIdentifier) ? true : %orig;
}
- (bool)wantsFullScreen {
return shouldEnableForBundleIdentifier(self.bundleIdentifier) ? false : %orig;
}
- (bool)_supportsApplicationType:(int)type {
return %orig(type & 2 && shouldEnableForBundleIdentifier(self.bundleIdentifier) ? 1 : type);
}
%end
%hook SBApplication
- (bool)_supportsApplicationType:(int)type {
return %orig(type & 2 && shouldEnableForBundleIdentifier(self.bundleIdentifier) ? 1 : type);
}
- (NSInteger)_defaultClassicMode {
return shouldEnableForBundleIdentifier(self.bundleIdentifier) ? 0 : %orig;
}
%end
%end
%ctor {
if (IN_SPRINGBOARD) {
%init(SB);
} else {
%init;
}
}