From 9c6e67ec0a91871ee4da03775070fef5126d68ee Mon Sep 17 00:00:00 2001 From: ichitaso Date: Mon, 13 Aug 2018 06:55:04 +0900 Subject: [PATCH 1/2] Each button was long pressed to open each setting screen. --- .gitignore | 12 ++ Makefile | 11 +- Tweak.xm | 104 +++++++++++------- ...ourcompany.realcc_0.0.4-1_iphoneos-arm.deb | Bin 2672 -> 0 bytes control | 2 +- 5 files changed, 89 insertions(+), 40 deletions(-) create mode 100644 .gitignore delete mode 100644 com.yourcompany.realcc_0.0.4-1_iphoneos-arm.deb diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7ec94e2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,12 @@ +*.o +.theos/* +debs/* +*.deb +*.dylib +**/.theos/* +*/.theos/* +*.sublime-workspace +_/* +*/obj/* +obj/* +*.zip diff --git a/Makefile b/Makefile index d914962..98463e8 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,15 @@ -include $(THEOS)/makefiles/common.mk -export ARCHS = arm64 +DEBUG = 0 +#GO_EASY_ON_ME := 1 +PACKAGE_VERSION = $(THEOS_PACKAGE_BASE_VERSION) +ARCHS = arm64 + +#THEOS_DEVICE_IP = 192.168.0.17 + TWEAK_NAME = RealCC RealCC_FILES = Tweak.xm RealCC_FRAMEWORKS = UIKit + +include $(THEOS)/makefiles/common.mk include $(THEOS_MAKE_PATH)/tweak.mk after-install:: diff --git a/Tweak.xm b/Tweak.xm index 07e47db..bbeb760 100644 --- a/Tweak.xm +++ b/Tweak.xm @@ -1,69 +1,99 @@ -@interface CCUILabeledRoundButton +@interface CCUIRoundButton : UIControl +@end + +@interface CCUILabeledRoundButton : UIView @property (nonatomic, copy, readwrite) NSString *title; +@property (nonatomic,retain) CCUIRoundButton *buttonView; @end @interface SBWiFiManager --(id)sharedInstance; --(void)setWiFiEnabled:(BOOL)enabled; --(bool)wiFiEnabled; +- (id)sharedInstance; +- (void)setWiFiEnabled:(BOOL)enabled; +- (bool)wiFiEnabled; @end @interface BluetoothManager --(id)sharedInstance; --(void)setEnabled:(BOOL)enabled; --(bool)enabled; - --(void)setPowered:(BOOL)powered; --(bool)powered; - +- (id)sharedInstance; +- (void)setEnabled:(BOOL)enabled; +- (bool)enabled; +- (void)setPowered:(BOOL)powered; +- (bool)powered; @end static BOOL BTenabbled; - %hook CCUILabeledRoundButton --(void)buttonTapped:(id)arg1 { - -%orig; - -if ([self.title isEqualToString:[[NSBundle bundleWithPath:@"/System/Library/ControlCenter/Bundles/ConnectivityModule.bundle"] localizedStringForKey:@"CONTROL_CENTER_STATUS_WIFI_NAME" value:@"CONTROL_CENTER_STATUS_WIFI_NAME" table:@"Localizable"]] || [self.title isEqualToString:[[NSBundle bundleWithPath:@"/System/Library/ControlCenter/Bundles/ConnectivityModule.bundle"] localizedStringForKey:@"CONTROL_CENTER_STATUS_WLAN_NAME" value:@"CONTROL_CENTER_STATUS_WLAN_NAME" table:@"Localizable"]]) { -SBWiFiManager *wiFiManager = (SBWiFiManager *)[%c(SBWiFiManager) sharedInstance]; - BOOL enabled = [wiFiManager wiFiEnabled]; - - if(enabled) { - [wiFiManager setWiFiEnabled:NO]; +- (void)buttonTapped:(id)arg1 +{ + %orig; + + if ([self.title isEqualToString:[[NSBundle bundleWithPath:@"/System/Library/ControlCenter/Bundles/ConnectivityModule.bundle"] localizedStringForKey:@"CONTROL_CENTER_STATUS_WIFI_NAME" value:@"CONTROL_CENTER_STATUS_WIFI_NAME" table:@"Localizable"]] || [self.title isEqualToString:[[NSBundle bundleWithPath:@"/System/Library/ControlCenter/Bundles/ConnectivityModule.bundle"] localizedStringForKey:@"CONTROL_CENTER_STATUS_WLAN_NAME" value:@"CONTROL_CENTER_STATUS_WLAN_NAME" table:@"Localizable"]]) { + + SBWiFiManager *wiFiManager = (SBWiFiManager *)[%c(SBWiFiManager) sharedInstance]; + BOOL enabled = [wiFiManager wiFiEnabled]; + + if (enabled) { + [wiFiManager setWiFiEnabled:NO]; + } + + UILongPressGestureRecognizer *longPressGesture = [[UILongPressGestureRecognizer alloc] + initWithTarget:self + action:@selector(wifiLongPressGesture:)]; + + longPressGesture.minimumPressDuration = 0.5f; + + [self.buttonView addGestureRecognizer:longPressGesture]; + } + + if ([self.title isEqualToString:[[NSBundle bundleWithPath:@"/System/Library/ControlCenter/Bundles/ConnectivityModule.bundle"] localizedStringForKey:@"CONTROL_CENTER_STATUS_BLUETOOTH_NAME" value:@"CONTROL_CENTER_STATUS_BLUETOOTH_NAME" table:@"Localizable"]]) { + + BluetoothManager *btoothManager = (BluetoothManager *)[%c(BluetoothManager) sharedInstance]; + BOOL enabled = [btoothManager enabled]; + + if (enabled) { + [btoothManager setEnabled:NO]; + [btoothManager setPowered:NO]; + + BTenabbled = !enabled ; + } + + UILongPressGestureRecognizer *longPressGesture = [[UILongPressGestureRecognizer alloc] + initWithTarget:self + action:@selector(btLongPressGesture:)]; + + longPressGesture.minimumPressDuration = 0.5f; + + [self.buttonView addGestureRecognizer:longPressGesture]; + + if(!enabled) BTenabbled = YES; } } -if ([self.title isEqualToString:[[NSBundle bundleWithPath:@"/System/Library/ControlCenter/Bundles/ConnectivityModule.bundle"] localizedStringForKey:@"CONTROL_CENTER_STATUS_BLUETOOTH_NAME" value:@"CONTROL_CENTER_STATUS_BLUETOOTH_NAME" table:@"Localizable"]]) { - BluetoothManager *btoothManager = (BluetoothManager *)[%c(BluetoothManager) sharedInstance]; - BOOL enabled = [btoothManager enabled]; - - if(enabled) { - [btoothManager setEnabled:NO]; - [btoothManager setPowered:NO]; - - BTenabbled = !enabled ; - } +%new +- (void)wifiLongPressGesture:(UILongPressGestureRecognizer *)sender +{ + [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=WIFI"]]; +} - if(!enabled) BTenabbled = YES; - } +%new +- (void)btLongPressGesture:(UILongPressGestureRecognizer *)sender +{ + [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=Bluetooth"]]; } %end %hook BluetoothManager - - (BOOL)setEnabled:(BOOL)arg1 { - return %orig(BTenabbled); + return %orig(BTenabbled); } - (BOOL)setPowered:(BOOL)arg1{ return %orig(BTenabbled); } --(BOOL)enabled { +- (BOOL)enabled { BTenabbled = !%orig; return %orig; } diff --git a/com.yourcompany.realcc_0.0.4-1_iphoneos-arm.deb b/com.yourcompany.realcc_0.0.4-1_iphoneos-arm.deb deleted file mode 100644 index c074e365b5a00c838c73bba78f4f82256b93836e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2672 zcmah`X*3iH10B5gLJA3K$P9`ZW1GpEWsqH{WNd>O>sZ2AvW>BClO;qM%D!b1Wss#1 zO|~qfhisD~OEkulHDBjDec#`A&pr2?d(XLl?geXN@UC9k+-~kz9Okwh7Izzi4+nuj zO3F&AiU?(OrOP0Y;xGR{RZ>(`x%?~p#out@hRZ8*yZYY_#{2uq2V?N^o)Q1vM<}ZN zzb{VW1f+p|?b$iL-P85%QRFjd`T(JGyb+V7a?Cvp9yc(pG5e7Qr%UAZ8Nl} zE8|c|?tbhp58^z5i3lYCTyEt_Q!Ka}UCg7{V9xzt&PZ8@4_`fP0C^}w>;eMyt+nm8 zt}@4FO7zzih;Sx_n6Pe>LwdBow&X0>yLWgpOJ^&8kNZK4`tcK1^|n(7R_^lDx^bDM zhRmHo%~~g)pT)l3+7;N2r8{cH9~13urwcChw454!lG4t6iQo?rB^0RW8=Z#0a+_By zM&@`%vz{0%CTO^TNLU2LO9zz_hHQGp0J=MxpCHIhyQX*`M@W7h}k`+>abqBK1`F6Hc+5g?DDP9GEK(G|TPh7SDh5)z$05?o9=D$<> zM)+ZV?f7qR!Ie~hALhc11^{9J$G-s(1|Y1?l@D&nYl@R@gfvs=9`o)XOiS7fv)PbV zXl`-c`Wqc^N&=1lIEm1k;loYKW#tMaD8&D4{)4N?@#L#+N6OFdiPu@tN#fT-P1WUX zqn?dcelsZOqm=M-j=X)kKvbc|PYK$faQzfjh< zh#n#a)SucYbursWu0}p7f)^PahDIF>4iG{Ybw&-G(Qql-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gI^BKmQbtjr{lhP;-F@8!bqO&y>b+{v~-Z!r^DWx%6S_Ki>$l9sH zlLEm}laSnQs%hV)o>LVaQh7w#dvNon7bjn3y%2`Pa^eDJ%A@JU2Uy3UhX(< z`@PYXJ5PM1W%Bv&b91K2*;8Z_`T5%G- ze2AGrjWXWM`-!Yd4;iN!f;Y^vF8#^>SdO6gDl!eU(FN_o1*S@$ z+sOOqTbPyMb8d#hXtwiP;F3O|DBBTf;g|;Fm)xdEqCV%4FWlacW=cQZwp*Dr`$VNq zYgm`yo6g!02S3Hh!o*acmMzZ diff --git a/control b/control index f7e4963..f7e31b3 100644 --- a/control +++ b/control @@ -1,7 +1,7 @@ Package: com.jakeashacks.realcc Name: RealCC Depends: mobilesubstrate -Version: 0.0.4 +Version: 0.0.5 Architecture: iphoneos-arm Description: Actually disable WiFI and Bluetooth from CC in iOS 11. Maintainer: Jake James From a9703013b3eee10c30b0dc101f8377992aa9bddb Mon Sep 17 00:00:00 2001 From: ichitaso Date: Mon, 13 Aug 2018 06:58:01 +0900 Subject: [PATCH 2/2] Added depends: firmware (>= 11.0) --- control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/control b/control index f7e31b3..05820be 100644 --- a/control +++ b/control @@ -1,6 +1,6 @@ Package: com.jakeashacks.realcc Name: RealCC -Depends: mobilesubstrate +Depends: firmware (>= 11.0), mobilesubstrate Version: 0.0.5 Architecture: iphoneos-arm Description: Actually disable WiFI and Bluetooth from CC in iOS 11.