|
14 | 14 |
|
15 | 15 | static NSString *gPackageIdentifier = nil; |
16 | 16 | static NSString *gPackagePath = nil; |
| 17 | +static LSRecordPromise *gRecordPromise = nil; |
17 | 18 |
|
18 | 19 | static SandyXpcMessagingCenter *GetXpcMessagingCenter(void) { |
19 | 20 | static SandyXpcMessagingCenter *messagingCenter = nil; |
@@ -58,6 +59,12 @@ static const char *BlockSig(id blockObj) |
58 | 59 | return (const char *)descriptor->rest[index]; |
59 | 60 | } |
60 | 61 |
|
| 62 | +@interface MIInstaller : NSObject |
| 63 | + |
| 64 | +@property (readonly, nonatomic) LSRecordPromise *recordPromise; |
| 65 | + |
| 66 | +@end |
| 67 | + |
61 | 68 | @interface MIInstallOptions : NSObject |
62 | 69 |
|
63 | 70 | @property (getter=isDeveloperInstall, nonatomic) bool developerInstall; |
@@ -161,6 +168,18 @@ static const char *BlockSig(id blockObj) |
161 | 168 |
|
162 | 169 | %end |
163 | 170 |
|
| 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 | + |
164 | 183 | %hook MIClientConnection |
165 | 184 |
|
166 | 185 | /* iOS 16.2 */ |
@@ -198,9 +217,9 @@ static const char *BlockSig(id blockObj) |
198 | 217 | LSApplicationProxy *appProxy = [LSApplicationProxy applicationProxyForIdentifier:gPackageIdentifier]; |
199 | 218 | LSRecordPromise *recordPromise = [[LSRecordPromise alloc] initWithRecord:appProxy.correspondingApplicationRecord error:nil]; |
200 | 219 |
|
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. */ |
202 | 221 |
|
203 | | - completion(YES, retVal[@"InstalledAppInfoArray"], recordPromise, nil); |
| 222 | + completion(YES, retVal[@"InstalledAppInfoArray"], gRecordPromise ?: recordPromise, nil); |
204 | 223 | return; |
205 | 224 | } |
206 | 225 |
|
|
0 commit comments