summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCameron Katri <me@cameronkatri.com>2022-01-02 23:26:12 -0500
committerCameron Katri <me@cameronkatri.com>2022-01-02 23:26:12 -0500
commit46a1f2e586b3f0b44a4155acc520266fa21fdb55 (patch)
tree5e0391d7a9745c83c9702f6f2d4088b3efd40cef
parent67bd724e0960b7c5635bfb7d67e1953da116cac1 (diff)
downloadtweaks-46a1f2e586b3f0b44a4155acc520266fa21fdb55.tar.gz
tweaks-46a1f2e586b3f0b44a4155acc520266fa21fdb55.tar.zst
tweaks-46a1f2e586b3f0b44a4155acc520266fa21fdb55.zip
Fixup hiding
-rw-r--r--QuickActions/Tweak.h4
-rw-r--r--QuickActions/Tweak.x53
2 files changed, 30 insertions, 27 deletions
diff --git a/QuickActions/Tweak.h b/QuickActions/Tweak.h
index 41f64fd..1c74481 100644
--- a/QuickActions/Tweak.h
+++ b/QuickActions/Tweak.h
@@ -108,8 +108,8 @@
@property (nonatomic) BOOL rightOpen;
@property (nonatomic) BOOL collapseLeft;
@property (nonatomic) BOOL collapseRight;
--(CGRect)leftFrameForButton:(CSQuickActionsButton*)button;
--(CGRect)rightFrameForButton:(CSQuickActionsButton*)button;
+-(CGRect)leftFrameForButton:(CSQuickActionsButton*)button open:(BOOL)open;
+-(CGRect)rightFrameForButton:(CSQuickActionsButton*)button open:(BOOL)open;
-(void)setDoNotDisturb:(BOOL)state;
-(BOOL)isDNDActive;
-(void)updateDND:(NSNotification *)notif;
diff --git a/QuickActions/Tweak.x b/QuickActions/Tweak.x
index 79a3195..7e9a505 100644
--- a/QuickActions/Tweak.x
+++ b/QuickActions/Tweak.x
@@ -120,27 +120,30 @@ void openApplication(NSString *bundleID)
{
%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];
- }
- }
+ [UIView animateWithDuration:0.25
+ delay:0
+ options:UIViewAnimationOptionCurveEaseOut
+ animations:^(void){
+ for (CSQuickActionsButton *button in [self leftButtons])
+ button.frame = [self leftFrameForButton:button open:NO];
+ self.leftOpen = NO;
+ for (CSQuickActionsButton *button in [self rightButtons])
+ button.frame = [self rightFrameForButton:button open:NO];
+ self.rightOpen = NO;
+ }
+ completion:^(BOOL finished) {
+ for (CSQuickActionsButton *button in [self leftButtons])
+ [button setHidden:YES];
+ for (CSQuickActionsButton *button in [self rightButtons])
+ [button setHidden:YES];
+ }];
}
%new
--(CGRect)rightFrameForButton:(CSQuickActionsButton*)button
+-(CGRect)rightFrameForButton:(CSQuickActionsButton*)button open:(BOOL)open
{
CGRect cameraFrame = [[self cameraButton] frame];
- if (self.rightOpen) {
+ if (open) {
return CGRectMake(cameraFrame.origin.x,
cameraFrame.origin.y - ((cameraFrame.size.height * 3/4) * (button.type - 1)),
cameraFrame.size.width, cameraFrame.size.height);
@@ -150,10 +153,10 @@ void openApplication(NSString *bundleID)
}
%new
--(CGRect)leftFrameForButton:(CSQuickActionsButton*)button
+-(CGRect)leftFrameForButton:(CSQuickActionsButton*)button open:(BOOL)open
{
CGRect flashlightFrame = [[self flashlightButton] frame];
- if (self.leftOpen) {
+ if (open) {
return CGRectMake(flashlightFrame.origin.x,
flashlightFrame.origin.y - ((flashlightFrame.size.height * 3/4) * (button.type - 1)),
flashlightFrame.size.width, flashlightFrame.size.height);
@@ -225,13 +228,13 @@ void openApplication(NSString *bundleID)
for (CSQuickActionsButton *button in [self leftButtons]) {
[button setEdgeInsets:insets];
- button.frame = [self leftFrameForButton:button];
- [button setHidden:!self.leftOpen];
+ button.frame = [self leftFrameForButton:button open:NO];
+ [button setHidden:YES];
}
for (CSQuickActionsButton *button in [self rightButtons]) {
[button setEdgeInsets:insets];
- button.frame = [self rightFrameForButton:button];
- [button setHidden:!self.rightOpen];
+ button.frame = [self rightFrameForButton:button open:NO];
+ [button setHidden:YES];
}
[self updateDND:nil];
@@ -248,7 +251,7 @@ void openApplication(NSString *bundleID)
options:UIViewAnimationOptionCurveEaseOut
animations:^(void){
for (CSQuickActionsButton *button in [self rightButtons]) {
- button.frame = [self rightFrameForButton:button];
+ button.frame = [self rightFrameForButton:button open:self.rightOpen];
if (self.rightOpen)
[button setHidden:0];
}
@@ -264,7 +267,7 @@ void openApplication(NSString *bundleID)
options:UIViewAnimationOptionCurveEaseOut
animations:^(void) {
for (CSQuickActionsButton *button in [self leftButtons]) {
- button.frame = [self leftFrameForButton:button];
+ button.frame = [self leftFrameForButton:button open:self.leftOpen];
if (self.leftOpen)
[button setHidden:0];
}
@@ -286,7 +289,7 @@ void openApplication(NSString *bundleID)
return;
}
- /* This will make the CC module be correct */
+ /* This will make the flashlight module be correct */
[self.delegate _resetIdleTimer];
[self.delegate sendAction:[CSAction actionWithType:5]];