From ed1e428fba75b03eae532ef46e33d1bff6b94788 Mon Sep 17 00:00:00 2001 From: FivePixels Date: Sun, 14 Jun 2020 13:16:31 -0500 Subject: 1.0 --- Tweak.x | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 Tweak.x (limited to 'Tweak.x') diff --git a/Tweak.x b/Tweak.x new file mode 100644 index 0000000..b784a87 --- /dev/null +++ b/Tweak.x @@ -0,0 +1,72 @@ +static BOOL isEnabled; + +@interface SBThermalController : NSObject { +} +@property (nonatomic,readonly) long long level; +@property (getter=isInSunlight,nonatomic,readonly) BOOL inSunlight; ++(id)sharedInstance; +-(BOOL)_isBlocked; +-(BOOL)isThermalBlocked; +@end + +static void updatePrefs() { + NSMutableDictionary *prefs = [[NSMutableDictionary alloc] initWithContentsOfFile:@"/var/mobile/Library/Preferences/com.5px.intemperate.plist"]; + if (prefs) { + isEnabled = [prefs objectForKey:@"isEnabled"] ? [[prefs objectForKey:@"isEnabled"] intValue] : isEnabled; + } +} + +%group latestSyntax +%hook SBThermalController +-(void)startListeningForThermalEvents { +} +-(void)_setBlocked:(BOOL)arg1 { + arg1 = NO; + %orig(arg1); +} +-(BOOL)isThermalBlocked { + return NO; +} +-(BOOL)_isBlocked { + return NO; +} +-(BOOL)isInSunlight { + return NO; +} +-(int)level { + return 0; +} +%end +%end + +%group previousSyntax +%hook SBThermalController +-(void)respondToCurrentThermalCondition { +} +-(void)showThermalAlertIfNecessary { +} +-(BOOL)isInSunlight { + %orig; + return NO; +} +-(int)level { + %orig; + return 0; +} +%end +%end + +%ctor { + updatePrefs(); + if (isEnabled) { + float version = [[[UIDevice currentDevice] systemVersion] floatValue]; + if (version >= 10) { + NSLog(@"Intemperate - iOS 10+"); + %init(latestSyntax); + } else if (version >= 8 && version < 10) { + NSLog(@"Intemperate - iOS 8/9"); + %init(previousSyntax); + } + } + +} -- cgit v1.2.3