This repository has been archived by the owner on Apr 25, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Alexandra
authored and
Alexandra
committed
Sep 23, 2022
1 parent
48fe5d2
commit 8874209
Showing
22 changed files
with
842 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
export ARCHS = arm64 arm64e | ||
export TARGET = iphone:clang:14.4:13.0 | ||
export SYSROOT = $(THEOS)/sdks/iPhoneOS14.4.sdk | ||
#export PREFIX = $(THEOS)/toolchain/Xcode.xctoolchain/usr/bin/ | ||
export PREFIX = $(THEOS)/toolchain/Xcode.xctoolchain/usr/bin/ | ||
|
||
INSTALL_TARGET_PROCESSES = SpringBoard | ||
SUBPROJECTS = Tweak | ||
SUBPROJECTS = Tweak Preferences | ||
|
||
include $(THEOS)/makefiles/common.mk | ||
include $(THEOS_MAKE_PATH)/aggregate.mk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// | ||
// BatteryBuddyAppearanceSettings.m | ||
// BatteryBuddy | ||
// | ||
// Created by Alexandra (@Traurige) | ||
// | ||
|
||
#import "BatteryBuddyRootListController.h" | ||
|
||
@implementation BatteryBuddyAppearanceSettings | ||
- (UIColor *)tintColor { | ||
return [UIColor colorWithRed:0.31 green:0.92 blue:0.51 alpha:1]; | ||
} | ||
|
||
- (UIStatusBarStyle)statusBarStyle { | ||
return UIStatusBarStyleDarkContent; | ||
} | ||
|
||
- (UIColor *)navigationBarTitleColor { | ||
return [UIColor whiteColor]; | ||
} | ||
|
||
- (UIColor *)navigationBarTintColor { | ||
return [UIColor whiteColor]; | ||
} | ||
|
||
- (UIColor *)tableViewCellSeparatorColor { | ||
return [[UIColor whiteColor] colorWithAlphaComponent:0]; | ||
} | ||
|
||
- (UIColor *)navigationBarBackgroundColor { | ||
return [UIColor colorWithRed:0.31 green:0.92 blue:0.51 alpha:1]; | ||
} | ||
|
||
- (BOOL)translucentNavigationBar { | ||
return YES; | ||
} | ||
@end |
22 changes: 22 additions & 0 deletions
22
Preferences/BatteryBuddyCreditsSubPreferencesListController.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// | ||
// BatteryBuddyCreditsSubPreferencesListController.h | ||
// BatteryBuddy | ||
// | ||
// Created by Alexandra (@Traurige) | ||
// | ||
|
||
#import <Preferences/PSListController.h> | ||
#import <Preferences/PSListItemsController.h> | ||
#import <Preferences/PSSpecifier.h> | ||
#import <CepheiPrefs/HBListController.h> | ||
#import <CepheiPrefs/HBAppearanceSettings.h> | ||
|
||
@interface BatteryBuddyAppearanceSettings : HBAppearanceSettings | ||
@end | ||
|
||
@interface BatteryBuddyCreditsSubPreferencesListController : HBListController | ||
@property(nonatomic, retain)BatteryBuddyAppearanceSettings* appearanceSettings; | ||
@property(nonatomic, retain)UILabel* titleLabel; | ||
@property(nonatomic, retain)UIBlurEffect* blur; | ||
@property(nonatomic, retain)UIVisualEffectView* blurView; | ||
@end |
55 changes: 55 additions & 0 deletions
55
Preferences/BatteryBuddyCreditsSubPreferencesListController.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// | ||
// BatteryBuddyCreditsSubPreferencesListController.m | ||
// BatteryBuddy | ||
// | ||
// Created by Alexandra (@Traurige) | ||
// | ||
|
||
#import "BatteryBuddyCreditsSubPreferencesListController.h" | ||
|
||
@implementation BatteryBuddyCreditsSubPreferencesListController | ||
- (void)viewDidLoad { | ||
[super viewDidLoad]; | ||
|
||
self.appearanceSettings = [[BatteryBuddyAppearanceSettings alloc] init]; | ||
self.hb_appearanceSettings = [self appearanceSettings]; | ||
|
||
self.blur = [UIBlurEffect effectWithStyle:UIBlurEffectStyleRegular]; | ||
self.blurView = [[UIVisualEffectView alloc] initWithEffect:[self blur]]; | ||
} | ||
|
||
- (void)viewWillAppear:(BOOL)animated { | ||
[super viewWillAppear:animated]; | ||
|
||
[[self blurView] setFrame:[[self view] bounds]]; | ||
[[self blurView] setAlpha:1]; | ||
[[self view] addSubview:[self blurView]]; | ||
|
||
[UIView animateWithDuration:0.4 delay:0 options:UIViewAnimationOptionCurveEaseOut animations:^{ | ||
[[self blurView] setAlpha:0]; | ||
} completion:nil]; | ||
} | ||
|
||
- (id)specifiers { | ||
return _specifiers; | ||
} | ||
|
||
- (void)loadFromSpecifier:(PSSpecifier *)specifier { | ||
NSString* sub = [specifier propertyForKey:@"BatteryBuddySub"]; | ||
NSString* title = [specifier name]; | ||
|
||
_specifiers = [self loadSpecifiersFromPlistName:sub target:self]; | ||
|
||
[self setTitle:title]; | ||
[[self navigationItem] setTitle:title]; | ||
} | ||
|
||
- (void)setSpecifier:(PSSpecifier *)specifier { | ||
[self loadFromSpecifier:specifier]; | ||
[super setSpecifier:specifier]; | ||
} | ||
|
||
- (BOOL)shouldReloadSpecifiersOnResume { | ||
return false; | ||
} | ||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// | ||
// BatteryBuddyRootListController.h | ||
// BatteryBuddy | ||
// | ||
// Created by Alexandra (@Traurige) | ||
// | ||
|
||
#import <Preferences/PSListController.h> | ||
#import <Preferences/PSSpecifier.h> | ||
#import <CepheiPrefs/HBRootListController.h> | ||
#import <CepheiPrefs/HBAppearanceSettings.h> | ||
#import <Cephei/HBPreferences.h> | ||
#import <Cephei/HBRespringController.h> | ||
#import <LocalAuthentication/LocalAuthentication.h> | ||
|
||
@interface BatteryBuddyAppearanceSettings : HBAppearanceSettings | ||
@end | ||
|
||
@interface BatteryBuddyRootListController : HBRootListController | ||
@property(nonatomic, retain)BatteryBuddyAppearanceSettings* appearanceSettings; | ||
@property(nonatomic, retain)HBPreferences* preferences; | ||
@property(nonatomic, retain)UISwitch* enableSwitch; | ||
@property(nonatomic, retain)UIBarButtonItem* item; | ||
@property(nonatomic, retain)UIView* headerView; | ||
@property(nonatomic, retain)UIImageView* headerImageView; | ||
@property(nonatomic, retain)UILabel* titleLabel; | ||
@property(nonatomic, retain)UIImageView* iconView; | ||
@property(nonatomic, retain)UIBlurEffect* blur; | ||
@property(nonatomic, retain)UIVisualEffectView* blurView; | ||
- (void)setEnabled; | ||
- (void)setEnabledState; | ||
- (void)resetPrompt; | ||
- (void)resetPreferences; | ||
- (void)respring; | ||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,194 @@ | ||
// | ||
// BatteryBuddyRootListController.m | ||
// BatteryBuddy | ||
// | ||
// Created by Alexandra (@Traurige) | ||
// | ||
|
||
#include "BatteryBuddyRootListController.h" | ||
|
||
@implementation BatteryBuddyRootListController | ||
- (void)viewDidLoad { | ||
[super viewDidLoad]; | ||
|
||
self.appearanceSettings = [[BatteryBuddyAppearanceSettings alloc] init]; | ||
self.hb_appearanceSettings = [self appearanceSettings]; | ||
self.preferences = [[HBPreferences alloc] initWithIdentifier:@"dev.traurige.batterybuddypreferences"]; | ||
|
||
|
||
// enable switch | ||
self.enableSwitch = [[UISwitch alloc] init]; | ||
[[self enableSwitch] setOnTintColor:[UIColor colorWithRed:0.31 green:0.78 blue:0.55 alpha:1]]; | ||
[[self enableSwitch] addTarget:self action:@selector(setEnabled) forControlEvents:UIControlEventTouchUpInside]; | ||
|
||
|
||
// item that holds the enable switch | ||
self.item = [[UIBarButtonItem alloc] initWithCustomView:[self enableSwitch]]; | ||
[[self navigationItem] setRightBarButtonItem:[self item]]; | ||
|
||
|
||
// version label | ||
self.navigationItem.titleView = [[UIView alloc] init]; | ||
self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 10, 10)]; | ||
[[self titleLabel] setFont:[UIFont boldSystemFontOfSize:17]]; | ||
[[self titleLabel] setText:@"1.1"]; | ||
[[self titleLabel] setTextColor:[UIColor whiteColor]]; | ||
[[self titleLabel] setTextAlignment:NSTextAlignmentCenter]; | ||
[[[self navigationItem] titleView] addSubview:[self titleLabel]]; | ||
|
||
[[self titleLabel] setTranslatesAutoresizingMaskIntoConstraints:NO]; | ||
[NSLayoutConstraint activateConstraints:@[ | ||
[[[self titleLabel] topAnchor] constraintEqualToAnchor:[[[self navigationItem] titleView] topAnchor]], | ||
[[[self titleLabel] leadingAnchor] constraintEqualToAnchor:[[[self navigationItem] titleView] leadingAnchor]], | ||
[[[self titleLabel] trailingAnchor] constraintEqualToAnchor:[[[self navigationItem] titleView] trailingAnchor]], | ||
[[[self titleLabel] bottomAnchor] constraintEqualToAnchor:[[[self navigationItem] titleView] bottomAnchor]], | ||
]]; | ||
|
||
|
||
// icon | ||
self.iconView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 10, 10)]; | ||
[[self iconView] setContentMode:UIViewContentModeScaleAspectFit]; | ||
[[self iconView] setImage:[UIImage imageWithContentsOfFile:@"/Library/PreferenceBundles/BatteryBuddyPreferences.bundle/Icon.png"]]; | ||
[[self iconView] setAlpha:0]; | ||
[[[self navigationItem] titleView] addSubview:[self iconView]]; | ||
|
||
[[self iconView] setTranslatesAutoresizingMaskIntoConstraints:NO]; | ||
[NSLayoutConstraint activateConstraints:@[ | ||
[[[self iconView] topAnchor] constraintEqualToAnchor:[[[self navigationItem] titleView] topAnchor]], | ||
[[[self iconView] leadingAnchor] constraintEqualToAnchor:[[[self navigationItem] titleView] leadingAnchor]], | ||
[[[self iconView] trailingAnchor] constraintEqualToAnchor:[[[self navigationItem] titleView] trailingAnchor]], | ||
[[[self iconView] bottomAnchor] constraintEqualToAnchor:[[[self navigationItem] titleView] bottomAnchor]], | ||
]]; | ||
|
||
|
||
// blur | ||
self.blur = [UIBlurEffect effectWithStyle:UIBlurEffectStyleRegular]; | ||
self.blurView = [[UIVisualEffectView alloc] initWithEffect:[self blur]]; | ||
|
||
|
||
// header | ||
self.headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 200, 200)]; | ||
self.headerImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 200, 200)]; | ||
[[self headerImageView] setContentMode:UIViewContentModeScaleAspectFill]; | ||
[[self headerImageView] setImage:[UIImage imageWithContentsOfFile:@"/Library/PreferenceBundles/BatteryBuddyPreferences.bundle/Banner.png"]]; | ||
[[self headerImageView] setClipsToBounds:YES]; | ||
[[self headerView] addSubview:[self headerImageView]]; | ||
|
||
[[self headerImageView] setTranslatesAutoresizingMaskIntoConstraints:NO]; | ||
[NSLayoutConstraint activateConstraints:@[ | ||
[[[self headerImageView] topAnchor] constraintEqualToAnchor:[[self headerView] topAnchor]], | ||
[[[self headerImageView] leadingAnchor] constraintEqualToAnchor:[[self headerView] leadingAnchor]], | ||
[[[self headerImageView] trailingAnchor] constraintEqualToAnchor:[[self headerView] trailingAnchor]], | ||
[[[self headerImageView] bottomAnchor] constraintEqualToAnchor:[[self headerView] bottomAnchor]], | ||
]]; | ||
} | ||
|
||
- (void)viewWillAppear:(BOOL)animated { | ||
[super viewWillAppear:animated]; | ||
|
||
CGRect frame = self.table.bounds; | ||
frame.origin.y = -frame.size.height; | ||
|
||
[[[[self navigationController] navigationController] navigationBar] setBarTintColor:[UIColor whiteColor]]; | ||
[[[[self navigationController] navigationController] navigationBar] setTintColor:[UIColor whiteColor]]; | ||
[[[[self navigationController] navigationController] navigationBar] setShadowImage:[UIImage new]]; | ||
[[[[self navigationController] navigationController] navigationBar] setTranslucent:YES]; | ||
|
||
[[self blurView] setFrame:[[self view] bounds]]; | ||
[[self blurView] setAlpha:1]; | ||
[[self view] addSubview:[self blurView]]; | ||
|
||
[UIView animateWithDuration:0.4 delay:0 options:UIViewAnimationOptionCurveEaseOut animations:^{ | ||
[[self blurView] setAlpha:0]; | ||
} completion:nil]; | ||
} | ||
|
||
- (void)viewDidAppear:(BOOL)animated { | ||
[super viewDidAppear:animated]; | ||
[self setEnabledState]; | ||
} | ||
|
||
- (NSArray *)specifiers { | ||
if (!_specifiers) { | ||
_specifiers = [self loadSpecifiersFromPlistName:@"Root" target:self]; | ||
} | ||
|
||
return _specifiers; | ||
} | ||
|
||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { | ||
tableView.tableHeaderView = [self headerView]; | ||
return [super tableView:tableView cellForRowAtIndexPath:indexPath]; | ||
} | ||
|
||
- (void)scrollViewDidScroll:(UIScrollView *)scrollView { | ||
CGFloat offsetY = scrollView.contentOffset.y; | ||
|
||
if (offsetY > 200) { | ||
[UIView animateWithDuration:0.2 animations:^{ | ||
[[self iconView] setAlpha:1]; | ||
[[self titleLabel] setAlpha:0]; | ||
}]; | ||
} else { | ||
[UIView animateWithDuration:0.2 animations:^{ | ||
[[self iconView] setAlpha:0]; | ||
[[self titleLabel] setAlpha:1]; | ||
}]; | ||
} | ||
} | ||
|
||
- (void)setEnabled { | ||
if ([[[self preferences] objectForKey:@"enabled"] isEqual:@(YES)] || ![[self preferences] objectForKey:@"enabled"]) { | ||
[[self preferences] setBool:NO forKey:@"enabled"]; | ||
} else { | ||
[[self preferences] setBool:YES forKey:@"enabled"]; | ||
} | ||
|
||
[self respring]; | ||
} | ||
|
||
- (void)setEnabledState { | ||
if ([[[self preferences] objectForKey:@"enabled"] isEqual:@(YES)] || ![[self preferences] objectForKey:@"enabled"]) { | ||
[[self enableSwitch] setOn:YES animated:YES]; | ||
} else { | ||
[[self enableSwitch] setOn:NO animated:YES]; | ||
} | ||
} | ||
|
||
- (void)resetPrompt { | ||
UIAlertController* resetAlert = [UIAlertController alertControllerWithTitle:@"BatteryBuddy" message:@"Do you really want to reset your preferences?" preferredStyle:UIAlertControllerStyleActionSheet]; | ||
|
||
UIAlertAction* confirmAction = [UIAlertAction actionWithTitle:@"Yes" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * action) { | ||
[self resetPreferences]; | ||
}]; | ||
|
||
UIAlertAction* cancelAction = [UIAlertAction actionWithTitle:@"No" style:UIAlertActionStyleCancel handler:nil]; | ||
|
||
[resetAlert addAction:confirmAction]; | ||
[resetAlert addAction:cancelAction]; | ||
|
||
[self presentViewController:resetAlert animated:YES completion:nil]; | ||
} | ||
|
||
- (void)resetPreferences { | ||
[[self preferences] removeAllObjects]; | ||
[[self enableSwitch] setOn:NO animated:YES]; | ||
[self respring]; | ||
} | ||
|
||
- (void)respring { | ||
[[self blurView] setFrame:[[self view] bounds]]; | ||
[[self blurView] setAlpha:0]; | ||
[[self view] addSubview:[self blurView]]; | ||
|
||
[UIView animateWithDuration:1 delay:0 options:UIViewAnimationOptionCurveEaseOut animations:^{ | ||
[[self blurView] setAlpha:1]; | ||
} completion:^(BOOL finished) { | ||
if (![[NSFileManager defaultManager] fileExistsAtPath:@"/Library/MobileSubstrate/DynamicLibraries/shuffle.dylib"]) { | ||
[HBRespringController respringAndReturnTo:[NSURL URLWithString:@"prefs:root=BatteryBuddy"]]; | ||
} else { | ||
[HBRespringController respringAndReturnTo:[NSURL URLWithString:@"prefs:root=Tweaks&path=BatteryBuddy"]]; | ||
} | ||
}]; | ||
} | ||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// | ||
// CallaTwitterCell.h | ||
// CallaTwitterCell | ||
// | ||
// Created by Alexandra (@Traurige) | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
#import <Preferences/PSSpecifier.h> | ||
|
||
@interface CallaTwitterCell : PSTableCell | ||
@property(nonatomic, retain)UIImageView* leftUserAvatarImageView; | ||
@property(nonatomic, retain)UILabel* leftUserDisplayNameLabel; | ||
@property(nonatomic, retain)UILabel* leftUserUsernameLabel; | ||
@property(nonatomic, retain)UIView* leftUserTapRecognizerView; | ||
@property(nonatomic, retain)UITapGestureRecognizer* leftUserTap; | ||
@property(nonatomic, retain)UIView* separatorView; | ||
@property(nonatomic, retain)UIImageView* rightUserAvatarImageView; | ||
@property(nonatomic, retain)UILabel* rightUserDisplayNameLabel; | ||
@property(nonatomic, retain)UILabel* rightUserUsernameLabel; | ||
@property(nonatomic, retain)UIView* rightUserTapRecognizerView; | ||
@property(nonatomic, retain)UITapGestureRecognizer* rightUserTap; | ||
@property(nonatomic, retain)NSString* leftUserDisplayName; | ||
@property(nonatomic, retain)NSString* leftUserUsername; | ||
@property(nonatomic, retain)NSString* rightUserDisplayName; | ||
@property(nonatomic, retain)NSString* rightUserUsername; | ||
- (void)visitLeftUserProfile; | ||
- (void)visitRightUserProfile; | ||
@end |
Oops, something went wrong.