Browse Source

tap on folder background to close it feature

tags/v1.1.3
Viggo Lekdorf 4 years ago
parent
commit
ceb0288569
2 changed files with 29 additions and 30 deletions
  1. +15
    -30
      Tweak.x
  2. +14
    -0
      kageprefs/Resources/Root.plist

+ 15
- 30
Tweak.x View File

//static BOOL hideStatusBarLS; //static BOOL hideStatusBarLS;
static BOOL hideCCGrabber; static BOOL hideCCGrabber;
static BOOL noBetaAlert; static BOOL noBetaAlert;
static BOOL tapFolderClose;


static void notificationCallback(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo) { static void notificationCallback(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo) {
NSNumber *eEnabled = (NSNumber *)[[NSUserDefaults standardUserDefaults] objectForKey:@"enabled" inDomain:nsDomainString]; NSNumber *eEnabled = (NSNumber *)[[NSUserDefaults standardUserDefaults] objectForKey:@"enabled" inDomain:nsDomainString];
//NSNumber *eHideStatusBarLS = (NSNumber *)[[NSUserDefaults standardUserDefaults] objectForKey:@"hideStatusBarLS" inDomain:nsDomainString]; //NSNumber *eHideStatusBarLS = (NSNumber *)[[NSUserDefaults standardUserDefaults] objectForKey:@"hideStatusBarLS" inDomain:nsDomainString];
NSNumber *eHideCCGrabber = (NSNumber *)[[NSUserDefaults standardUserDefaults] objectForKey:@"hideCCGrabber" inDomain:nsDomainString]; NSNumber *eHideCCGrabber = (NSNumber *)[[NSUserDefaults standardUserDefaults] objectForKey:@"hideCCGrabber" inDomain:nsDomainString];
NSNumber *eNoBetaAlert = (NSNumber *)[[NSUserDefaults standardUserDefaults] objectForKey:@"noBetaAlert" inDomain:nsDomainString]; NSNumber *eNoBetaAlert = (NSNumber *)[[NSUserDefaults standardUserDefaults] objectForKey:@"noBetaAlert" inDomain:nsDomainString];
NSNumber *eTapFolderClose = (NSNumber *)[[NSUserDefaults standardUserDefaults] objectForKey:@"tapFolderClose" inDomain:nsDomainString];


enabled = (eEnabled) ? [eEnabled boolValue]:NO; enabled = (eEnabled) ? [eEnabled boolValue]:NO;
hideQuickActionsBG = (eHideQuickActionsBG) ? [eHideQuickActionsBG boolValue]:NO; hideQuickActionsBG = (eHideQuickActionsBG) ? [eHideQuickActionsBG boolValue]:NO;
//hideStatusBarLS = (eHideStatusBarLS) ? [eHideStatusBarLS boolValue]:NO; //hideStatusBarLS = (eHideStatusBarLS) ? [eHideStatusBarLS boolValue]:NO;
hideCCGrabber = (eHideCCGrabber) ? [eHideCCGrabber boolValue]:NO; hideCCGrabber = (eHideCCGrabber) ? [eHideCCGrabber boolValue]:NO;
noBetaAlert = (eNoBetaAlert) ? [eNoBetaAlert boolValue]:NO; noBetaAlert = (eNoBetaAlert) ? [eNoBetaAlert boolValue]:NO;
tapFolderClose = (eTapFolderClose) ? [eTapFolderClose boolValue]:NO;
} }


// Headers // Headers
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>


/*@interface SBFolderView : UIView
@end*/
@interface SBFloatyFolderView : UIView
@end


@interface SBIconView : UIView @interface SBIconView : UIView
-(void)setLabelHidden:(BOOL)hidden; -(void)setLabelHidden:(BOOL)hidden;
%end %end


// Close folder when tapped inside // Close folder when tapped inside
/*%hook SBFloatyFolderScrollView
-(SBFloatyFolderScrollView *)initWithFrame:(CGRect)frame {
if (enabled && hideFolderBG) {
SBFloatyFolderScrollView *yeet = %orig;

UITapGestureRecognizer *closeGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(closeFolder)];

[yeet addGestureRecognizer:closeGesture];

return yeet;
}
else {
return %orig;
}
}

%new
-(void)closeFolder:(id)sender {
UIViewController *parentController = [self _viewControllerForAncestor];

if ([parentController isKindOfClass:[objc_getClass("SBFolderController") class]]) {
SBFolderController *sbfc = (SBFolderController *)parentController;

if (sbfc && [sbfc.containerView isKindOfClass:[objc_getClass("SBFloatyFolderView") class]]) {
[(SBFloatyFolderView *)sbfc.containerView _handleOutsideTap:nil];
}
}
%hook SBFloatyFolderView
-(void)_tapToCloseGestureRecognizer:(id)arg1 shouldReceiveTouch:(id)arg2 {
%orig;
if (enabled && tapFolderClose) {
return YES;
}
else {
return %orig;
}
} }
%end*/
%end


// Hide folder dots // Hide folder dots
%hook SBIconListPageControl %hook SBIconListPageControl

+ 14
- 0
kageprefs/Resources/Root.plist View File

<key>PostNotification</key> <key>PostNotification</key>
<string>com.yaypixxo.kage/preferences.changed</string> <string>com.yaypixxo.kage/preferences.changed</string>
</dict> </dict>
<dict>
<key>cell</key>
<string>PSSwitchCell</string>
<key>default</key>
<false/>
<key>defaults</key>
<string>com.yaypixxo.kage</string>
<key>key</key>
<string>tapFolderClose</string>
<key>label</key>
<string>Tap Folder BG To Close</string>
<key>PostNotification</key>
<string>com.yaypixxo.kage/preferences.changed</string>
</dict>
<dict> <dict>
<key>cell</key> <key>cell</key>
<string>PSGroupCell</string> <string>PSGroupCell</string>

Loading…
Cancel
Save