Skip to content

Commit 4af80b5

Browse files
committed
fix: seem to work on ios 16
Signed-off-by: 82Flex <[email protected]>
1 parent edc0357 commit 4af80b5

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

XcodeAnyTroll.xm

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
static NSString *gPackageIdentifier = nil;
1616
static NSString *gPackagePath = nil;
17+
static LSRecordPromise *gRecordPromise = nil;
1718

1819
static SandyXpcMessagingCenter *GetXpcMessagingCenter(void) {
1920
static SandyXpcMessagingCenter *messagingCenter = nil;
@@ -58,6 +59,12 @@ static const char *BlockSig(id blockObj)
5859
return (const char *)descriptor->rest[index];
5960
}
6061

62+
@interface MIInstaller : NSObject
63+
64+
@property (readonly, nonatomic) LSRecordPromise *recordPromise;
65+
66+
@end
67+
6168
@interface MIInstallOptions : NSObject
6269

6370
@property (getter=isDeveloperInstall, nonatomic) bool developerInstall;
@@ -161,6 +168,18 @@ static const char *BlockSig(id blockObj)
161168

162169
%end
163170

171+
%hook MIInstaller
172+
173+
- (BOOL)performInstallationWithError:(NSError **)errorPtr {
174+
BOOL result = %orig;
175+
if (self.recordPromise) {
176+
gRecordPromise = self.recordPromise;
177+
}
178+
return result;
179+
}
180+
181+
%end
182+
164183
%hook MIClientConnection
165184

166185
/* iOS 16.2 */
@@ -198,9 +217,9 @@ static const char *BlockSig(id blockObj)
198217
LSApplicationProxy *appProxy = [LSApplicationProxy applicationProxyForIdentifier:gPackageIdentifier];
199218
LSRecordPromise *recordPromise = [[LSRecordPromise alloc] initWithRecord:appProxy.correspondingApplicationRecord error:nil];
200219

201-
/* LSRecordPromise is not properly constructed, still need some work here. */
220+
/* LSRecordPromise is not properly constructed in some cases, still need some work here. */
202221

203-
completion(YES, retVal[@"InstalledAppInfoArray"], recordPromise, nil);
222+
completion(YES, retVal[@"InstalledAppInfoArray"], gRecordPromise ?: recordPromise, nil);
204223
return;
205224
}
206225

0 commit comments

Comments
 (0)