-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTweak.xm
29 lines (21 loc) · 828 Bytes
/
Tweak.xm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#define settingPath @"var/mobile/Library/Preferences/com.cc.runningman.plist"
%hook WCDeviceStepObject
-(unsigned int)m7StepCount {
NSMutableDictionary *prefs = [[NSMutableDictionary alloc] initWithContentsOfFile:settingPath];
BOOL isEnabled = [[prefs objectForKey:@"enabled"] boolValue];
BOOL addRandom = [[prefs objectForKey:@"random"] boolValue];
int targetStepCount = [[prefs objectForKey:@"targetStepCount"] intValue];
int origStepCount = %orig;
NSLog(@"Update step count: target=%d, orig=%d.", targetStepCount, origStepCount);
if (isEnabled && (targetStepCount > origStepCount))
{
int newStepCount = targetStepCount;
if (addRandom)
{
newStepCount += arc4random()%2000;
}
return newStepCount;
}
return origStepCount;
}
%end