-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathTweak.xm
80 lines (71 loc) · 3.55 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#import <UIKit/UIKit.h>
#import <Cephei/HBPreferences.h>
HBPreferences *preferences;
@interface WFSharingSettings : NSObject
+(BOOL)isPrivateSharingEnabled;
+(BOOL)sharingEnabled;
+(BOOL)shortcutFileSharingEnabled;
+(id)privateSharingDisabledAlertWithShortcutName:(id)arg0 ;
+(id)privateSharingDisabledErrorWithShortcutName:(id)arg0 ;
+(id)sharingDisabledAlertWithShortcutName:(id)arg0 ;
+(id)sharingDisabledAlertWithWorkflowName:(id)arg0 ;
+(id)shortcutFileSharingDisabledAlert;
+(id)shortcutFileSharingDisabledError;
@end
@interface SFAppleIDClient : NSObject
- (id)myAccountWithError:(id )arg1;
@end
@interface SFAppleIDValidationRecord : NSObject
@property(retain, nonatomic) NSArray *validatedPhoneHashes; // @synthesize validatedPhoneHashes=_validatedPhoneHashes;
@property(retain, nonatomic) NSArray *validatedEmailHashes; // @synthesize validatedEmailHashes=_validatedEmailHashes;
@property(retain, nonatomic) NSString *altDSID; // @synthesize altDSID=_altDSID;
@end
@interface SFAppleIDAccount : NSObject
@property(retain, nonatomic) SFAppleIDValidationRecord *validationRecord; // @synthesize validationRecord=_validationRecord;
@property(retain, nonatomic) NSString *altDSID; // @synthesize altDSID=_altDSID;
@end
@interface WFShortcutSigningContext : NSObject
@property (readonly, copy, nonatomic) NSArray *appleIDCertificateChain; // ivar: _appleIDCertificateChain
@property (readonly, nonatomic) SFAppleIDValidationRecord *appleIDValidationRecord; // ivar: _appleIDValidationRecord
@property (readonly, nonatomic) NSDate *expirationDate; // ivar: _expirationDate
@property (readonly, copy, nonatomic) NSArray *signingCertificateChain; // ivar: _signingCertificateChain
@property (retain, nonatomic) NSData *signingPublicKeySignature; // ivar: _signingPublicKeySignature
@end
%group unsigncuts
%hook WFShortcutExtractor
-(bool)allowsOldFormatFile { //the main thing that allows this
return YES;
}
%end
%hook WFSharingSettings //note: this value is only accepted for importing now on internal builds of voiceshortcuts (at least when talking about importing)
//however for exporting, it still adds the export shortcut as file option to sharing options so this does still have a use
+(bool)shortcutFileSharingEnabled {
return YES;
}
%end
%end
%group unsigncutsAllowAnyContact
%hook WFShortcutSigningContext
-(void)validateAppleIDValidationRecordWithCompletion:(void (^)(int, int, int, id))completion {
//the following is a rebuild / reverse engineered of the actual method WorkflowKit has for this
//but no longer check if sha256 phone/email hashes match in contact shared importing, just auto run completion block
//while still respecting isPrivateSharingEnabled, as well as self importing
SFAppleIDAccount* account = [[[%c(SFAppleIDClient) alloc]init]myAccountWithError:nil];
if ([[account altDSID]isEqualToString:[[self appleIDValidationRecord]altDSID]]) {
//the alt dsid matches with users - assume this is user's shortcut, no need for private sharing enabled
completion(0x1,0x3,0x0,0x0);
} else if ([%c(WFSharingSettings) isPrivateSharingEnabled]) { //respect privatesharingenabled pref
completion(0x1, 0x2, 0x0, 0x0);
} else {
//Skipping AppleID Validation Record due to Private Sharing Disabled
//(AKA: Error)
completion(0x0, 0x2, 0x0, [%c(WFSharingSettings) privateSharingDisabledErrorWithShortcutName:nil]);
}
}
%end
%end
%ctor {
preferences = [[HBPreferences alloc] initWithIdentifier:@"cum.0xilis.unsigncutsprefs"];
if ([preferences boolForKey:@"isUnsigncutsEnabled"]) %init(unsigncuts);
if ([preferences boolForKey:@"isAllowAnyContactEnabled"]) %init(unsigncutsAllowAnyContact);
}