diff options
author | Cameron Katri <me@cameronkatri.com> | 2021-12-30 14:14:31 -0500 |
---|---|---|
committer | Cameron Katri <me@cameronkatri.com> | 2021-12-30 14:14:31 -0500 |
commit | 0a51fcb19809e59c108883462fda6739164db4c9 (patch) | |
tree | 13c14da5dba0e7949686892f645c730469a4c5d7 /QuickActions/Tweak.x | |
parent | dbb81e49619702f4dc8aea826439cff80cbcdfd4 (diff) | |
download | tweaks-0a51fcb19809e59c108883462fda6739164db4c9.tar.gz tweaks-0a51fcb19809e59c108883462fda6739164db4c9.tar.zst tweaks-0a51fcb19809e59c108883462fda6739164db4c9.zip |
Fixes requested by Chariz
Diffstat (limited to 'QuickActions/Tweak.x')
-rw-r--r-- | QuickActions/Tweak.x | 39 |
1 files changed, 26 insertions, 13 deletions
diff --git a/QuickActions/Tweak.x b/QuickActions/Tweak.x index 02871ee..79a3195 100644 --- a/QuickActions/Tweak.x +++ b/QuickActions/Tweak.x @@ -110,14 +110,32 @@ void openApplication(NSString *bundleID) } } - // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateDND:) name:@"SBQuietModeStatusChangedNotification" object:nil]; - // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateDND:) name:@"QuickActionsUpdateDND" object:nil]; self.stateService = (DNDStateService *)[objc_getClass("DNDStateService") serviceForClientIdentifier:@"com.apple.donotdisturb.control-center.module"]; [self.stateService addStateUpdateListener:self withCompletionHandler:nil]; return o; } +-(void)refreshFlashlightAvailability +{ + %orig; + + if (self.leftOpen) { + self.leftOpen = !self.leftOpen; + for (CSQuickActionsButton *button in [self leftButtons]) { + button.frame = [self leftFrameForButton:button]; + [button setHidden:!self.leftOpen]; + } + } + if (self.rightOpen) { + self.rightOpen = !self.rightOpen; + for (CSQuickActionsButton *button in [self rightButtons]) { + button.frame = [self rightFrameForButton:button]; + [button setHidden:!self.rightOpen]; + } + } +} + %new -(CGRect)rightFrameForButton:(CSQuickActionsButton*)button { @@ -161,6 +179,11 @@ void openApplication(NSString *bundleID) if (SBFEffectiveHomeButtonType() != 2) { CGRect bounds = [[UIScreen mainScreen] _referenceBounds]; + // Detect if we are on an iPhone SE and adjust the insets + // accordingly to not overlap with the text + if ([[UIScreen mainScreen] nativeBounds].size.height == 1136) + insets.bottom += 10; + CGFloat buttonWidth = 50 + insets.right + insets.left; CGFloat buttonHeight = 50 + insets.top + insets.bottom; @@ -203,7 +226,7 @@ void openApplication(NSString *bundleID) for (CSQuickActionsButton *button in [self leftButtons]) { [button setEdgeInsets:insets]; button.frame = [self leftFrameForButton:button]; - [button setHidden:!self.rightOpen]; + [button setHidden:!self.leftOpen]; } for (CSQuickActionsButton *button in [self rightButtons]) { [button setEdgeInsets:insets]; @@ -410,14 +433,4 @@ void openApplication(NSString *bundleID) %end -// %hook DNDNotificationsService - -// -(void)stateService:(id)arg1 didReceiveDoNotDisturbStateUpdate:(id)arg2{ -// %orig; - -// [[NSNotificationCenter defaultCenter] postNotificationName:@"QuickActionsUpdateDND" object:nil]; -// } - -// %end - // vim: filetype=logos |