Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
*.o
.theos/*
debs/*
*.deb
*.dylib
**/.theos/*
*/.theos/*
*.sublime-workspace
_/*
*/obj/*
obj/*
*.zip
11 changes: 9 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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::
Expand Down
104 changes: 67 additions & 37 deletions Tweak.xm
Original file line number Diff line number Diff line change
@@ -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;
}
Expand Down
Binary file removed com.yourcompany.realcc_0.0.4-1_iphoneos-arm.deb
Binary file not shown.
4 changes: 2 additions & 2 deletions control
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: com.jakeashacks.realcc
Name: RealCC
Depends: mobilesubstrate
Version: 0.0.4
Depends: firmware (>= 11.0), mobilesubstrate
Version: 0.0.5
Architecture: iphoneos-arm
Description: Actually disable WiFI and Bluetooth from CC in iOS 11.
Maintainer: Jake James
Expand Down