-
Notifications
You must be signed in to change notification settings - Fork 1
/
Tweak.xm
57 lines (45 loc) · 1.13 KB
/
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
// Settings toggles
BOOL kEnabled;
BOOL kUnrestict;
// plist where user settings are stored.
#define PLIST_PATH @"/var/mobile/Library/Preferences/com.codeymoore.satellatvos.plist"
%hook SKPaymentTransaction
- (long long) transactionState {
if (kEnabled) { // this sets transactionState to SKPaymentTransactionStatePurchased
return TRUE;
} else {
%orig;
}
}
- (void) _setTransactionState: (long long) arg1 {
if (kEnabled) {
arg1 = TRUE;
} else {
%orig;
}
}
%end
%hook SKPaymentQueue
+ (bool) canMakePayments {
if (kUnrestict) { // allow restricted users to fake purchase
return TRUE;
} else {
%orig;
}
}
%end
%hook SKReceiptRefreshRequest
- (bool) _wantsRevoked {
return false; // make the receipt not revoked
}
- (bool) _wantsExpired {
return false; // make the receipt not expired
}
%end
static void loadPrefs() {
NSMutableDictionary *prefs = [[NSMutableDictionary alloc] initWithContentsOfFile:PLIST_PATH];
//our preference values that write to a plist file when a user selects somethings
kEnabled = [([prefs objectForKey:@"kEnabled"] ?: @(YES)) boolValue];
}