forked from dayanch96/ReachMyAbility
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTweak.x
More file actions
49 lines (39 loc) · 1.24 KB
/
Tweak.x
File metadata and controls
49 lines (39 loc) · 1.24 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
#import <UIKit/UIKit.h>
#import "RMAPrefs/RMAUserDefaults.h"
@interface SBReachabilityManager : NSObject
@property (nonatomic, assign, readonly) BOOL reachabilityModeActive;
+ (instancetype)sharedInstance;
@end
%hook SBReachabilitySettings
- (CGFloat)reachabilityDefaultKeepAlive {
if ([[RMAUserDefaults standardUserDefaults] boolForKey:@"enabled"]) {
CGFloat result = [[RMAUserDefaults standardUserDefaults] floatForKey:@"keepAlive"];
return result == 301 ? CGFLOAT_MAX : result;
}
return %orig;
}
%end
%hook SBReachabilityManager
- (CGFloat)reachabilityYOffset {
if ([[RMAUserDefaults standardUserDefaults] boolForKey:@"enabled"]) {
return [[RMAUserDefaults standardUserDefaults] floatForKey:@"downHeight"] ?: %orig;
}
return %orig;
}
- (void)deactivateReachability {
if (![[RMAUserDefaults standardUserDefaults] boolForKey:@"enabled"]) {
return %orig;
}
if (![[RMAUserDefaults standardUserDefaults] boolForKey:@"deactivation"]) {
%orig;
}
}
- (void)_screenDidDim {
if (![[RMAUserDefaults standardUserDefaults] boolForKey:@"enabled"]) {
return %orig;
}
if (![[RMAUserDefaults standardUserDefaults] boolForKey:@"keepOnDim"]) {
%orig;
}
}
%end