summaryrefslogtreecommitdiffstats
path: root/QuickActions
diff options
context:
space:
mode:
authorCameron Katri <me@cameronkatri.com>2021-12-30 14:14:31 -0500
committerCameron Katri <me@cameronkatri.com>2021-12-30 14:14:31 -0500
commit0a51fcb19809e59c108883462fda6739164db4c9 (patch)
tree13c14da5dba0e7949686892f645c730469a4c5d7 /QuickActions
parentdbb81e49619702f4dc8aea826439cff80cbcdfd4 (diff)
downloadtweaks-0a51fcb19809e59c108883462fda6739164db4c9.tar.gz
tweaks-0a51fcb19809e59c108883462fda6739164db4c9.tar.zst
tweaks-0a51fcb19809e59c108883462fda6739164db4c9.zip
Fixes requested by Chariz
Diffstat (limited to 'QuickActions')
-rw-r--r--QuickActions/QuickActionsPrefs/QASAppSelectorController.h1
-rw-r--r--QuickActions/QuickActionsPrefs/QASAppSelectorController.m20
-rw-r--r--QuickActions/QuickActionsPrefs/Resources/Root.plist16
-rw-r--r--QuickActions/Tweak.x39
4 files changed, 54 insertions, 22 deletions
diff --git a/QuickActions/QuickActionsPrefs/QASAppSelectorController.h b/QuickActions/QuickActionsPrefs/QASAppSelectorController.h
index f439fcb..0a3937e 100644
--- a/QuickActions/QuickActionsPrefs/QASAppSelectorController.h
+++ b/QuickActions/QuickActionsPrefs/QASAppSelectorController.h
@@ -17,6 +17,7 @@ typedef enum {
UISearchResultsUpdating, UISearchBarDelegate> {
UISearchController *_searchController;
NSString *_searchKey;
+ UISelectionFeedbackGenerator *_feedback;
}
@property (nonatomic) UITableView *tableView;
@property (nonatomic) NSMutableArray<NSString *> *enabled;
diff --git a/QuickActions/QuickActionsPrefs/QASAppSelectorController.m b/QuickActions/QuickActionsPrefs/QASAppSelectorController.m
index cadca5c..fb3aba4 100644
--- a/QuickActions/QuickActionsPrefs/QASAppSelectorController.m
+++ b/QuickActions/QuickActionsPrefs/QASAppSelectorController.m
@@ -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;
@@ -49,6 +51,11 @@
self.navigationItem.hidesSearchBarWhenScrolling = NO;
self.definesPresentationContext = YES;
+
+
+ if (_feedback == nil)
+ _feedback = [[UISelectionFeedbackGenerator alloc] init];
+ [_feedback prepare];
}
-(void)updateSearchResultsForSearchController:(UISearchController *)searchController {
@@ -233,6 +240,17 @@
} 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];
diff --git a/QuickActions/QuickActionsPrefs/Resources/Root.plist b/QuickActions/QuickActionsPrefs/Resources/Root.plist
index 1eb8853..60f36c2 100644
--- a/QuickActions/QuickActionsPrefs/Resources/Root.plist
+++ b/QuickActions/QuickActionsPrefs/Resources/Root.plist
@@ -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>
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