From fdae61a9ea79ff11a0cd5250b60e69b5f94657e2 Mon Sep 17 00:00:00 2001 From: Alexandra Date: Wed, 16 Aug 2023 21:51:02 +0200 Subject: [PATCH] true rootless paths --- Tweak/BatteryBuddy.h | 1 + Tweak/BatteryBuddy.m | 14 +++++++------- control | 2 +- layout/DEBIAN/postinst | 2 ++ 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/Tweak/BatteryBuddy.h b/Tweak/BatteryBuddy.h index b7692f3..a4aee3d 100644 --- a/Tweak/BatteryBuddy.h +++ b/Tweak/BatteryBuddy.h @@ -6,6 +6,7 @@ // #import "substrate.h" +#import #import #import "../Preferences/PreferenceKeys.h" diff --git a/Tweak/BatteryBuddy.m b/Tweak/BatteryBuddy.m index cc725fc..29c32a9 100644 --- a/Tweak/BatteryBuddy.m +++ b/Tweak/BatteryBuddy.m @@ -41,13 +41,13 @@ CGFloat override__UIBatteryView_chargePercent(_UIBatteryView* self, SEL _cmd) { int actualPercentage = orig * 100; if (actualPercentage <= 20 && !isCharging) { - [[self batteryBuddyStatusBarIconImageView] setImage:[UIImage imageWithContentsOfFile:@"/var/mobile/Documents/dev.traurige/BatteryBuddy/StatusBarSad.png"]]; + [[self batteryBuddyStatusBarIconImageView] setImage:[UIImage imageWithContentsOfFile:ROOT_PATH_NS_VAR(@"/var/mobile/Documents/dev.traurige/BatteryBuddy/StatusBarSad.png")]]; } else if (actualPercentage <= 49 && !isCharging) { - [[self batteryBuddyStatusBarIconImageView] setImage:[UIImage imageWithContentsOfFile:@"/var/mobile/Documents/dev.traurige/BatteryBuddy/StatusBarNeutral.png"]]; + [[self batteryBuddyStatusBarIconImageView] setImage:[UIImage imageWithContentsOfFile:ROOT_PATH_NS_VAR(@"/var/mobile/Documents/dev.traurige/BatteryBuddy/StatusBarNeutral.png")]]; } else if (actualPercentage > 49 && !isCharging) { - [[self batteryBuddyStatusBarIconImageView] setImage:[UIImage imageWithContentsOfFile:@"/var/mobile/Documents/dev.traurige/BatteryBuddy/StatusBarHappy.png"]]; + [[self batteryBuddyStatusBarIconImageView] setImage:[UIImage imageWithContentsOfFile:ROOT_PATH_NS_VAR(@"/var/mobile/Documents/dev.traurige/BatteryBuddy/StatusBarHappy.png")]]; } else if (isCharging) { - [[self batteryBuddyStatusBarIconImageView] setImage:[UIImage imageWithContentsOfFile:@"/var/mobile/Documents/dev.traurige/BatteryBuddy/StatusBarHappy.png"]]; + [[self batteryBuddyStatusBarIconImageView] setImage:[UIImage imageWithContentsOfFile:ROOT_PATH_NS_VAR(@"/var/mobile/Documents/dev.traurige/BatteryBuddy/StatusBarHappy.png")]]; } [self updateIconColor]; @@ -97,7 +97,7 @@ void _UIBatteryView_refreshIcon(_UIBatteryView* self, SEL _cmd) { [self setBatteryBuddyStatusBarChargerImageView:[[UIImageView alloc] initWithFrame:[self bounds]]]; [[self batteryBuddyStatusBarChargerImageView] setContentMode:UIViewContentModeScaleAspectFill]; [[self batteryBuddyStatusBarChargerImageView] setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight]; - [[self batteryBuddyStatusBarChargerImageView] setImage:[UIImage imageWithContentsOfFile:@"/var/mobile/Documents/dev.traurige/BatteryBuddy/StatusBarCharger.png"]]; + [[self batteryBuddyStatusBarChargerImageView] setImage:[UIImage imageWithContentsOfFile:ROOT_PATH_NS_VAR(@"/var/mobile/Documents/dev.traurige/BatteryBuddy/StatusBarCharger.png")]]; if (![[self batteryBuddyStatusBarChargerImageView] isDescendantOfView:self]) { [self addSubview:[self batteryBuddyStatusBarChargerImageView]]; } @@ -148,7 +148,7 @@ void override_CSBatteryFillView_didMoveToWindow(CSBatteryFillView* self, SEL _cm [self setBatteryBuddyLockScreenIconImageView:[[UIImageView alloc] initWithFrame:[self bounds]]]; [[self batteryBuddyLockScreenIconImageView] setContentMode:UIViewContentModeScaleAspectFill]; [[self batteryBuddyLockScreenIconImageView] setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight]; - [[self batteryBuddyLockScreenIconImageView] setImage:[UIImage imageWithContentsOfFile:@"/var/mobile/Documents/dev.traurige/BatteryBuddy/LockScreenHappy.png"]]; + [[self batteryBuddyLockScreenIconImageView] setImage:[UIImage imageWithContentsOfFile:ROOT_PATH_NS_VAR(@"/var/mobile/Documents/dev.traurige/BatteryBuddy/LockScreenHappy.png")]]; } [[self batteryBuddyLockScreenIconImageView] setImage:[[[self batteryBuddyLockScreenIconImageView] image] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]]; [[self batteryBuddyLockScreenIconImageView] setTintColor:[UIColor whiteColor]]; @@ -162,7 +162,7 @@ void override_CSBatteryFillView_didMoveToWindow(CSBatteryFillView* self, SEL _cm [self setBatteryBuddyLockScreenChargerImageView:[[UIImageView alloc] initWithFrame:CGRectMake(self.bounds.origin.x - 25, self.bounds.origin.y, self.bounds.size.width, self.bounds.size.height)]]; [[self batteryBuddyLockScreenChargerImageView] setContentMode:UIViewContentModeScaleAspectFill]; [[self batteryBuddyLockScreenChargerImageView] setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight]; - [[self batteryBuddyLockScreenChargerImageView] setImage:[UIImage imageWithContentsOfFile:@"/var/mobile/Documents/dev.traurige/BatteryBuddy/LockScreenCharger.png"]]; + [[self batteryBuddyLockScreenChargerImageView] setImage:[UIImage imageWithContentsOfFile:ROOT_PATH_NS_VAR(@"/var/mobile/Documents/dev.traurige/BatteryBuddy/LockScreenCharger.png")]]; } [[self batteryBuddyLockScreenChargerImageView] setImage:[[[self batteryBuddyLockScreenChargerImageView] image] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]]; [[self batteryBuddyLockScreenChargerImageView] setTintColor:[UIColor whiteColor]]; diff --git a/control b/control index c21bca6..69f91a1 100644 --- a/control +++ b/control @@ -2,7 +2,7 @@ Package: dev.traurige.batterybuddy Name: BatteryBuddy Depends: firmware (>= 13.0), mobilesubstrate, preferenceloader Conflicts: love.litten.batterybuddy -Version: 1.3.4 +Version: 1.3.5 Architecture: iphoneos-arm Description: Battery indicator, but cute Maintainer: Traurige diff --git a/layout/DEBIAN/postinst b/layout/DEBIAN/postinst index bd2d486..0dd8e3b 100755 --- a/layout/DEBIAN/postinst +++ b/layout/DEBIAN/postinst @@ -2,4 +2,6 @@ if [ -d /var/mobile/Documents/dev.traurige/ ]; then chown -R mobile:mobile /var/mobile/Documents/dev.traurige/ +elif [ -d /var/jb/var/mobile/Documents/dev.traurige/ ]; then + chown -R mobile:mobile /var/jb/var/mobile/Documents/dev.traurige/ fi