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

Commit 0cfcbca

Browse files
author
张国晔
committed
iOS 9 Support
fix for Wi-Fi Assist
1 parent 1667ae5 commit 0cfcbca

File tree

3 files changed

+19
-8
lines changed

3 files changed

+19
-8
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
ARCHS = armv7 armv7s arm64
2-
TARGET = iphone:clang:7.1:7.0
2+
TARGET = iphone:clang:9.1:7.0
33

44
include theos/makefiles/common.mk
55

Tweak.m

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,23 @@
33
%hook PSListController
44

55
NSArray *map;
6-
NSInteger count;
6+
NSInteger count, cellularSectionNumber;
77
BOOL enabled = YES;
88

9+
- (NSInteger)numberOfSectionsInTableView:(id)view {
10+
NSInteger result = %orig;
11+
if ([[self specifier].identifier isEqualToString:@"MOBILE_DATA_SETTINGS_ID"]) {
12+
if (![self tableView:view titleForHeaderInSection:result - 2])
13+
cellularSectionNumber = result - 3;
14+
else
15+
cellularSectionNumber = result - 2;
16+
}
17+
return result;
18+
}
19+
920
- (NSInteger)tableView:(id)view numberOfRowsInSection:(NSInteger)section {
10-
NSInteger result = %orig(view, section);
11-
if ([[self specifier].identifier isEqualToString:@"MOBILE_DATA_SETTINGS_ID"] && section == [self numberOfSectionsInTableView:view] - 2) {
21+
NSInteger result = %orig;
22+
if ([[self specifier].identifier isEqualToString:@"MOBILE_DATA_SETTINGS_ID"] && section == cellularSectionNumber) {
1223
count = 0;
1324
if (result > 1) {
1425
NSInteger num;
@@ -53,14 +64,14 @@ - (NSInteger)tableView:(id)view numberOfRowsInSection:(NSInteger)section {
5364
}
5465

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

6273
- (void)tableView:(id)view didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
63-
if ([[self specifier].identifier isEqualToString:@"MOBILE_DATA_SETTINGS_ID"] && indexPath.section == [self numberOfSectionsInTableView:view] - 3) {
74+
if ([[self specifier].identifier isEqualToString:@"MOBILE_DATA_SETTINGS_ID"] && indexPath.section == cellularSectionNumber - 1) {
6475
enabled = !enabled;
6576
[view reloadData];
6677
}

control

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: com.ccdog.cellularusageorder
22
Name: CellularUsageOrder
33
Depends: firmware (>= 7.0), mobilesubstrate
4-
Version: 1.1
4+
Version: 1.2
55
Architecture: iphoneos-arm
66
Description: Order Cellular Data Usage by Size.
77
Author: CC-Dog <[email protected]>

0 commit comments

Comments
 (0)