Skip to content
This repository has been archived by the owner on Apr 25, 2024. It is now read-only.

Commit

Permalink
true rootless paths
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexandra authored and Alexandra committed Aug 16, 2023
1 parent 4a3da94 commit fdae61a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
1 change: 1 addition & 0 deletions Tweak/BatteryBuddy.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//

#import "substrate.h"
#import <rootless.h>
#import <UIKit/UIKit.h>
#import "../Preferences/PreferenceKeys.h"

Expand Down
14 changes: 7 additions & 7 deletions Tweak/BatteryBuddy.m
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -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]];
}
Expand Down Expand Up @@ -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]];
Expand All @@ -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]];
Expand Down
2 changes: 1 addition & 1 deletion control
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>
Expand Down
2 changes: 2 additions & 0 deletions layout/DEBIAN/postinst
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit fdae61a

Please sign in to comment.