Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
iOS 9 Support
Browse files Browse the repository at this point in the history
fix for Wi-Fi Assist
  • Loading branch information
张国晔 committed Oct 25, 2015
1 parent 1667ae5 commit 0cfcbca
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARCHS = armv7 armv7s arm64
TARGET = iphone:clang:7.1:7.0
TARGET = iphone:clang:9.1:7.0

include theos/makefiles/common.mk

Expand Down
23 changes: 17 additions & 6 deletions Tweak.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,23 @@
%hook PSListController

NSArray *map;
NSInteger count;
NSInteger count, cellularSectionNumber;
BOOL enabled = YES;

- (NSInteger)numberOfSectionsInTableView:(id)view {
NSInteger result = %orig;
if ([[self specifier].identifier isEqualToString:@"MOBILE_DATA_SETTINGS_ID"]) {
if (![self tableView:view titleForHeaderInSection:result - 2])
cellularSectionNumber = result - 3;
else
cellularSectionNumber = result - 2;
}
return result;
}

- (NSInteger)tableView:(id)view numberOfRowsInSection:(NSInteger)section {
NSInteger result = %orig(view, section);
if ([[self specifier].identifier isEqualToString:@"MOBILE_DATA_SETTINGS_ID"] && section == [self numberOfSectionsInTableView:view] - 2) {
NSInteger result = %orig;
if ([[self specifier].identifier isEqualToString:@"MOBILE_DATA_SETTINGS_ID"] && section == cellularSectionNumber) {
count = 0;
if (result > 1) {
NSInteger num;
Expand Down Expand Up @@ -53,14 +64,14 @@ - (NSInteger)tableView:(id)view numberOfRowsInSection:(NSInteger)section {
}

- (id)tableView:(id)view cellForRowAtIndexPath:(NSIndexPath *)indexPath {
if (enabled && indexPath.row < count && [[self specifier].identifier isEqualToString:@"MOBILE_DATA_SETTINGS_ID"] && indexPath.section == [self numberOfSectionsInTableView:view] - 2)
if (enabled && indexPath.row < count && [[self specifier].identifier isEqualToString:@"MOBILE_DATA_SETTINGS_ID"] && indexPath.section == cellularSectionNumber)
return %orig(view, [NSIndexPath indexPathForRow:((Entry *)map[indexPath.row]).index inSection:indexPath.section]);
else
return %orig(view, indexPath);
return %orig;
}

- (void)tableView:(id)view didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
if ([[self specifier].identifier isEqualToString:@"MOBILE_DATA_SETTINGS_ID"] && indexPath.section == [self numberOfSectionsInTableView:view] - 3) {
if ([[self specifier].identifier isEqualToString:@"MOBILE_DATA_SETTINGS_ID"] && indexPath.section == cellularSectionNumber - 1) {
enabled = !enabled;
[view reloadData];
}
Expand Down
2 changes: 1 addition & 1 deletion control
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: com.ccdog.cellularusageorder
Name: CellularUsageOrder
Depends: firmware (>= 7.0), mobilesubstrate
Version: 1.1
Version: 1.2
Architecture: iphoneos-arm
Description: Order Cellular Data Usage by Size.
Author: CC-Dog <cc941201@gmail.com>
Expand Down

0 comments on commit 0cfcbca

Please sign in to comment.