@@ -181,7 +181,7 @@ - (void)preprocessBundleBeforeSiging:(NSURL *)bundleURL completion:(dispatch_blo
181
181
}
182
182
183
183
// return "SignNeeded" if sign is needed, other wise return an error
184
- - (void )patchExecAndSignIfNeedWithCompletionHandler : (void (^)(NSString * errorInfo))completetionHandler progressHandler : (void (^)(NSProgress * errorInfo ))progressHandler forceSign : (BOOL )forceSign {
184
+ - (void )patchExecAndSignIfNeedWithCompletionHandler : (void (^)(NSString * errorInfo))completetionHandler progressHandler : (void (^)(NSProgress * progress ))progressHandler forceSign : (BOOL )forceSign {
185
185
NSString *appPath = self.bundlePath ;
186
186
NSString *infoPath = [NSString stringWithFormat: @" %@ /Info.plist" , appPath];
187
187
NSMutableDictionary *info = _info;
@@ -243,9 +243,8 @@ - (void)patchExecAndSignIfNeedWithCompletionHandler:(void(^)(NSString* errorInfo
243
243
info[@" CFBundleIdentifier" ] = info[@" LCBundleIdentifier" ];
244
244
[info removeObjectForKey: @" LCBundleExecutable" ];
245
245
[info removeObjectForKey: @" LCBundleIdentifier" ];
246
-
247
- __block NSProgress *progress = [LCUtils signAppBundle: appPathURL
248
- completionHandler: ^(BOOL success, NSError *_Nullable error) {
246
+
247
+ void (^signCompletionHandler)(BOOL success, NSError *error) = ^(BOOL success, NSError *_Nullable error) {
249
248
dispatch_async (dispatch_get_main_queue (), ^{
250
249
if (!error) {
251
250
info[@" LCJITLessSignID" ] = @(signID);
@@ -267,7 +266,25 @@ - (void)patchExecAndSignIfNeedWithCompletionHandler:(void(^)(NSString* errorInfo
267
266
}
268
267
269
268
});
270
- }];
269
+ };
270
+
271
+ __block NSProgress *progress;
272
+
273
+ switch ([self signer ]) {
274
+ case ZSign:
275
+ NSLog (@" [LC] using ZSign" );
276
+ progress = [LCUtils signAppBundleWithZSign: appPathURL execName: info[@" CFBundleExecutable" ] completionHandler: signCompletionHandler];
277
+ break ;
278
+ case AltSigner:
279
+ NSLog (@" [LC] using AltSigner" );
280
+ progress = [LCUtils signAppBundle: appPathURL completionHandler: signCompletionHandler];
281
+ break ;
282
+
283
+ default :
284
+ completetionHandler (@" Signer Not Found" );
285
+ break ;
286
+ }
287
+
271
288
if (progress) {
272
289
progressHandler (progress);
273
290
}
@@ -345,6 +362,17 @@ - (void)setBypassAssertBarrierOnQueue:(bool)enabled {
345
362
346
363
}
347
364
365
+ - (Signer)signer {
366
+ return (Signer) [((NSNumber *) _info[@" signer" ]) intValue ];
367
+
368
+ }
369
+ - (void )setSigner : (Signer)newSigner {
370
+ _info[@" signer" ] = [NSNumber numberWithInt: (int ) newSigner];
371
+ NSLog (@" [LC] new signer = %d " , (int ) newSigner);
372
+ [self save ];
373
+
374
+ }
375
+
348
376
- (UIColor*)cachedColor {
349
377
if (_info[@" cachedColor" ] != nil ) {
350
378
NSData *colorData = _info[@" cachedColor" ];
0 commit comments