├── .gitignore ├── .travis.yml ├── Makefile ├── README.md ├── SugarCane.plist ├── Tweak.xm └── control /.gitignore: -------------------------------------------------------------------------------- 1 | *.7z 2 | *.dmg 3 | *.gz 4 | *.iso 5 | *.jar 6 | *.rar 7 | *.tar 8 | *.zip 9 | *.deb 10 | *.txt 11 | 12 | *.com 13 | *.class 14 | *.dll 15 | *.exe 16 | *.o 17 | *.so 18 | 19 | .DS_Store 20 | .DS_Store? 21 | ._* 22 | .Spotlight-V100 23 | .Trashes 24 | ehthumbs.db 25 | Thumbs.db 26 | obj/ 27 | _/ 28 | .theos/ 29 | .theos/last_package 30 | .theos/fakeroot 31 | .theos/last_package 32 | theos/ 33 | Distribution/ 34 | packages/ 35 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | os: osx 2 | language: objective-c 3 | sudo: false 4 | 5 | env: 6 | global: 7 | # $THEOS is absolutely needed for theos to even be found 8 | - THEOS=~/theos 9 | 10 | before_install: 11 | # update homebrew and install dependencies 12 | - brew update 13 | - brew install dpkg ldid 14 | 15 | # install theos 16 | - git clone --recursive git://github.com/theos/theos.git ~/theos 17 | 18 | script: 19 | # build! 20 | - make 21 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | include $(THEOS)/makefiles/common.mk 2 | 3 | TWEAK_NAME = SugarCane 4 | SugarCane_FILES = Tweak.xm 5 | 6 | include $(THEOS_MAKE_PATH)/tweak.mk 7 | 8 | after-install:: 9 | install.exec "killall -9 SpringBoard" 10 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Build Status](https://travis-ci.org/ioscreatix/SugarCane.svg?branch=master)](https://travis-ci.org/ioscreatix/SugarCane) 2 | ## SugarCane 3 | 4 | SugarCane adds percentage labels to the Control Center sliders on iOS 11. 5 | 6 | 7 | #### Support our Work 8 | Consider supporting us on patreon if you found Rooster useful as a user so we can continue to develop awesome projects like this: [Patreon Link](https://www.patreon.com/ioscreatix) 9 | -------------------------------------------------------------------------------- /SugarCane.plist: -------------------------------------------------------------------------------- 1 | { Filter = { Bundles = ( "com.apple.springboard" ); }; } 2 | -------------------------------------------------------------------------------- /Tweak.xm: -------------------------------------------------------------------------------- 1 | extern NSString* const kCAFilterDestOut; 2 | 3 | @interface CCUIModuleSliderView : UIView 4 | @property (nonatomic, retain) UILabel *percentLabel; 5 | - (float)value; 6 | @end 7 | 8 | @interface CALayer (Private) 9 | @property (nonatomic, retain) NSString *compositingFilter; 10 | @property (nonatomic, assign) BOOL allowsGroupOpacity; 11 | @property (nonatomic, assign) BOOL allowsGroupBlending; 12 | @end 13 | 14 | 15 | %hook CCUIModuleSliderView 16 | %property (nonatomic, retain) UILabel *percentLabel; 17 | 18 | - (id)initWithFrame:(CGRect)frame { 19 | CCUIModuleSliderView *orig = %orig; 20 | orig.percentLabel = [[UILabel alloc] init]; 21 | orig.percentLabel.textColor = [UIColor whiteColor]; 22 | orig.percentLabel.text = @"0%"; 23 | orig.percentLabel.center = CGPointMake(self.bounds.size.width*0.5, self.bounds.size.height*0.85); 24 | [orig addSubview:orig.percentLabel]; 25 | orig.percentLabel.layer.allowsGroupBlending = NO; 26 | orig.percentLabel.layer.allowsGroupOpacity = YES; 27 | orig.percentLabel.layer.compositingFilter = kCAFilterDestOut; 28 | orig.percentLabel.font = [orig.percentLabel.font fontWithSize:10]; 29 | return orig; 30 | } 31 | 32 | - (void)layoutSubviews { 33 | %orig; 34 | if ([self valueForKey:@"_glyphPackageView"]) { 35 | UIView *glyphView = (UIView *)[self valueForKey:@"_glyphPackageView"]; 36 | glyphView.center = CGPointMake(self.bounds.size.width*0.5,self.bounds.size.height*0.5); 37 | if (self.percentLabel) { 38 | if ([self.percentLabel superview] != glyphView) { 39 | if ([self.percentLabel superview]) [self.percentLabel removeFromSuperview]; 40 | [glyphView addSubview:self.percentLabel]; 41 | } 42 | 43 | if ([self.percentLabel superview] == glyphView) { 44 | self.percentLabel.layer.allowsGroupBlending = NO; 45 | self.percentLabel.layer.allowsGroupOpacity = YES; 46 | self.percentLabel.layer.compositingFilter = kCAFilterDestOut; 47 | self.percentLabel.text = [[NSString stringWithFormat:@"%.f", [self value]*100] stringByAppendingString:@"%"]; 48 | [self.percentLabel sizeToFit]; 49 | self.percentLabel.center = [self convertPoint:CGPointMake(self.bounds.size.width*0.5, self.bounds.size.height*0.85) toView:glyphView]; 50 | } 51 | } 52 | 53 | if ([self valueForKey:@"_compensatingGlyphPackageView"]) { 54 | UIView *compensatingGlyphView = [self valueForKey:@"_compensatingGlyphPackageView"]; 55 | compensatingGlyphView.center = glyphView.center; 56 | 57 | } 58 | } 59 | } 60 | 61 | -(void)_updateValueForTouchLocation:(CGPoint)location withAbsoluteReference:(BOOL)absolute forContinuedGesture:(BOOL)continued { 62 | %orig; 63 | if (self.percentLabel) { 64 | self.percentLabel.text = [[NSString stringWithFormat:@"%.f", [self value]*100] stringByAppendingString:@"%"]; 65 | [self.percentLabel sizeToFit]; 66 | if ([self valueForKey:@"_glyphPackageView"]) { 67 | UIView *glyphView = (UIView *)[self valueForKey:@"_glyphPackageView"]; 68 | self.percentLabel.center = [self convertPoint:CGPointMake(self.bounds.size.width*0.5, self.bounds.size.height*0.85) toView:glyphView]; 69 | } 70 | 71 | } 72 | } 73 | %end -------------------------------------------------------------------------------- /control: -------------------------------------------------------------------------------- 1 | Package: com.ioscreatix.sugarcane 2 | Name: SugarCane 3 | Depends: mobilesubstrate 4 | Version: 1.0.0 5 | Architecture: iphoneos-arm 6 | Description: Get percentages for the sliders in the Control Center on iOS 11 7 | Maintainer: iOS Creatix 8 | Author: iOS Creatix 9 | Section: Tweaks 10 | --------------------------------------------------------------------------------