]> git.cameronkatri.com Git - tweaks.git/commitdiff
Fixes requested by Chariz
authorCameron Katri <me@cameronkatri.com>
Thu, 30 Dec 2021 19:14:31 +0000 (14:14 -0500)
committerCameron Katri <me@cameronkatri.com>
Thu, 30 Dec 2021 19:14:31 +0000 (14:14 -0500)
QuickActions/QuickActionsPrefs/QASAppSelectorController.h
QuickActions/QuickActionsPrefs/QASAppSelectorController.m
QuickActions/QuickActionsPrefs/Resources/Root.plist
QuickActions/Tweak.x

index f439fcb86f261107ebeac5ffefe6dcefb45d0023..0a3937efdfbe0c3cba91c046b51bc852feb656d7 100644 (file)
@@ -17,6 +17,7 @@ typedef enum {
 UISearchResultsUpdating, UISearchBarDelegate> {
     UISearchController *_searchController;
     NSString *_searchKey;
+    UISelectionFeedbackGenerator *_feedback;
 }
 @property (nonatomic) UITableView *tableView;
 @property (nonatomic) NSMutableArray<NSString *> *enabled;
index cadca5c18779c7af4a7c74210e6c23d14994278e..fb3aba4ef8b4d0aa0d78d5535b5756fd3f767207 100644 (file)
@@ -1,6 +1,7 @@
 #import <Foundation/Foundation.h>
 #import <UIKit/UIKit.h>
 #import <Preferences/PSSpecifier.h>
+#import <AudioToolbox/AudioToolbox.h>
 
 #import "QASAppSelectorController.h"
 #import "LSApplicationProxy+AltList.h"
@@ -40,7 +41,8 @@
                                                                                                                                                ascending:YES
                                                                                                                                                 selector:@selector(localizedCaseInsensitiveCompare:)]]];
 
-       _searchController = [[UISearchController alloc] initWithSearchResultsController:nil];
+       if (_searchController == nil)
+               _searchController = [[UISearchController alloc] initWithSearchResultsController:nil];
        _searchController.searchResultsUpdater = self;
        _searchController.obscuresBackgroundDuringPresentation = NO;
        _searchController.searchBar.delegate = self;
        self.navigationItem.hidesSearchBarWhenScrolling = NO;
 
        self.definesPresentationContext = YES;
+
+
+       if (_feedback == nil)
+               _feedback = [[UISelectionFeedbackGenerator alloc] init];
+       [_feedback prepare];
 }
 
 -(void)updateSearchResultsForSearchController:(UISearchController *)searchController {
        } else if (editingStyle == UITableViewCellEditingStyleInsert) {
                [self.enabled insertObject:item atIndex:self.enabled.count];
                [tableView insertRowsAtIndexPaths:[NSArray arrayWithObject:[NSIndexPath indexPathForRow:([self.enabled count] - 1) inSection:0]] withRowAnimation:UITableViewRowAnimationFade];
+
+               switch ([(NSNumber *)[[UIDevice currentDevice] valueForKey:@"_feedbackSupportLevel"] intValue]) {
+                       case 2:
+                               [_feedback selectionChanged];
+                               break;
+                       case 1:
+                               AudioServicesPlayAlertSound(kSystemSoundID_Vibrate);
+                               break;
+                       default:
+                               break;
+               }
        }
 
        [tableView endUpdates];
index 1eb885362a6211f2f98a30531a6f3b95ac225cd3..60f36c2788d1c75267baca723f4921a304988963 100644 (file)
@@ -31,8 +31,8 @@
                        <string>LeftOffsetX</string>
                        <key>defaults</key>
                        <string>com.cameronkatri.quickactions</string>
-                       <key>isDecimalPad</key>
-                       <true/>
+                       <key>keyboard</key>
+                       <string>numbers</string>
                        <key>placeholder</key>
                        <string>0</string>
                </dict>
@@ -45,8 +45,8 @@
                        <string>LeftOffsetY</string>
                        <key>defaults</key>
                        <string>com.cameronkatri.quickactions</string>
-                       <key>isDecimalPad</key>
-                       <true/>
+                       <key>keyboard</key>
+                       <string>numbers</string>
                        <key>placeholder</key>
                        <string>0</string>
                </dict>
@@ -77,8 +77,8 @@
                        <string>RightOffsetX</string>
                        <key>defaults</key>
                        <string>com.cameronkatri.quickactions</string>
-                       <key>isDecimalPad</key>
-                       <true/>
+                       <key>keyboard</key>
+                       <string>numbers</string>
                        <key>placeholder</key>
                        <string>0</string>
                </dict>
@@ -91,8 +91,8 @@
                        <string>RightOffsetY</string>
                        <key>defaults</key>
                        <string>com.cameronkatri.quickactions</string>
-                       <key>isDecimalPad</key>
-                       <true/>
+                       <key>keyboard</key>
+                       <string>numbers</string>
                        <key>placeholder</key>
                        <string>0</string>
                </dict>
index 02871ee9b606699cbb71bf456c7bee4f2552abbd..79a31952727cef464c884d1b316da6a955c0c436 100644 (file)
@@ -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