mirror of https://github.com/opa334/TrollStore.git
1.4.5b2
This commit is contained in:
parent
d432d3812a
commit
030ab8fd58
|
@ -1163,6 +1163,7 @@ int MAIN_NAME(int argc, char *argv[], char *envp[])
|
||||||
{
|
{
|
||||||
cleanRestrictions();
|
cleanRestrictions();
|
||||||
refreshAppRegistrations(NO); // <- fix app permissions resetting
|
refreshAppRegistrations(NO); // <- fix app permissions resetting
|
||||||
|
sleep(5); // <- fix app permission fix causing apps to move on home screen (?)
|
||||||
[[LSApplicationWorkspace defaultWorkspace] _LSPrivateRebuildApplicationDatabasesForSystemApps:YES internal:YES user:YES];
|
[[LSApplicationWorkspace defaultWorkspace] _LSPrivateRebuildApplicationDatabasesForSystemApps:YES internal:YES user:YES];
|
||||||
refreshAppRegistrations(YES);
|
refreshAppRegistrations(YES);
|
||||||
killall(@"backboardd", YES);
|
killall(@"backboardd", YES);
|
||||||
|
|
|
@ -31,6 +31,14 @@ extern NSString *LSInstallTypeKey;
|
||||||
- (void)enumerateApplicationsOfType:(NSUInteger)type block:(void (^)(LSApplicationProxy*))block;
|
- (void)enumerateApplicationsOfType:(NSUInteger)type block:(void (^)(LSApplicationProxy*))block;
|
||||||
- (BOOL)installApplication:(NSURL*)appPackageURL withOptions:(NSDictionary*)options error:(NSError**)error;
|
- (BOOL)installApplication:(NSURL*)appPackageURL withOptions:(NSDictionary*)options error:(NSError**)error;
|
||||||
- (BOOL)uninstallApplication:(NSString*)appId withOptions:(NSDictionary*)options;
|
- (BOOL)uninstallApplication:(NSString*)appId withOptions:(NSDictionary*)options;
|
||||||
|
- (void)addObserver:(id)arg1;
|
||||||
|
- (void)removeObserver:(id)arg1;
|
||||||
|
@end
|
||||||
|
|
||||||
|
@protocol LSApplicationWorkspaceObserverProtocol <NSObject>
|
||||||
|
@optional
|
||||||
|
-(void)applicationsDidInstall:(id)arg1;
|
||||||
|
-(void)applicationsDidUninstall:(id)arg1;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface LSEnumerator : NSEnumerator
|
@interface LSEnumerator : NSEnumerator
|
||||||
|
|
|
@ -54,14 +54,21 @@ NSString* rootHelperPath(void)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
int fd_is_valid(int fd)
|
||||||
|
{
|
||||||
|
return fcntl(fd, F_GETFD) != -1 || errno != EBADF;
|
||||||
|
}
|
||||||
|
|
||||||
NSString* getNSStringFromFile(int fd)
|
NSString* getNSStringFromFile(int fd)
|
||||||
{
|
{
|
||||||
NSMutableString* ms = [NSMutableString new];
|
NSMutableString* ms = [NSMutableString new];
|
||||||
ssize_t num_read;
|
ssize_t num_read;
|
||||||
char c;
|
char c;
|
||||||
|
if(!fd_is_valid(fd)) return @"";
|
||||||
while((num_read = read(fd, &c, sizeof(c))))
|
while((num_read = read(fd, &c, sizeof(c))))
|
||||||
{
|
{
|
||||||
[ms appendString:[NSString stringWithFormat:@"%c", c]];
|
[ms appendString:[NSString stringWithFormat:@"%c", c]];
|
||||||
|
if(c == '\n') break;
|
||||||
}
|
}
|
||||||
return ms.copy;
|
return ms.copy;
|
||||||
}
|
}
|
||||||
|
@ -79,7 +86,7 @@ void printMultilineNSString(NSString* stringToPrint)
|
||||||
int spawnRoot(NSString* path, NSArray* args, NSString** stdOut, NSString** stdErr)
|
int spawnRoot(NSString* path, NSArray* args, NSString** stdOut, NSString** stdErr)
|
||||||
{
|
{
|
||||||
NSMutableArray* argsM = args.mutableCopy ?: [NSMutableArray new];
|
NSMutableArray* argsM = args.mutableCopy ?: [NSMutableArray new];
|
||||||
[argsM insertObject:path.lastPathComponent atIndex:0];
|
[argsM insertObject:path atIndex:0];
|
||||||
|
|
||||||
NSUInteger argCount = [argsM count];
|
NSUInteger argCount = [argsM count];
|
||||||
char **argsC = (char **)malloc((argCount + 1) * sizeof(char*));
|
char **argsC = (char **)malloc((argCount + 1) * sizeof(char*));
|
||||||
|
@ -132,6 +139,41 @@ int spawnRoot(NSString* path, NSArray* args, NSString** stdOut, NSString** stdEr
|
||||||
return spawnError;
|
return spawnError;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
__block volatile BOOL _isRunning = YES;
|
||||||
|
NSMutableString* outString = [NSMutableString new];
|
||||||
|
NSMutableString* errString = [NSMutableString new];
|
||||||
|
dispatch_semaphore_t sema = 0;
|
||||||
|
dispatch_queue_t logQueue;
|
||||||
|
if(stdOut || stdErr)
|
||||||
|
{
|
||||||
|
logQueue = dispatch_queue_create("com.opa334.TrollStore.LogCollector", NULL);
|
||||||
|
sema = dispatch_semaphore_create(0);
|
||||||
|
|
||||||
|
int outPipe = out[0];
|
||||||
|
int outErrPipe = outErr[0];
|
||||||
|
|
||||||
|
__block BOOL outEnabled = (BOOL)stdOut;
|
||||||
|
__block BOOL errEnabled = (BOOL)stdErr;
|
||||||
|
dispatch_async(logQueue, ^
|
||||||
|
{
|
||||||
|
while(_isRunning)
|
||||||
|
{
|
||||||
|
@autoreleasepool
|
||||||
|
{
|
||||||
|
if(outEnabled)
|
||||||
|
{
|
||||||
|
[outString appendString:getNSStringFromFile(outPipe)];
|
||||||
|
}
|
||||||
|
if(errEnabled)
|
||||||
|
{
|
||||||
|
[errString appendString:getNSStringFromFile(outErrPipe)];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dispatch_semaphore_signal(sema);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if (waitpid(task_pid, &status, 0) != -1) {
|
if (waitpid(task_pid, &status, 0) != -1) {
|
||||||
|
@ -139,24 +181,36 @@ int spawnRoot(NSString* path, NSArray* args, NSString** stdOut, NSString** stdEr
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
perror("waitpid");
|
perror("waitpid");
|
||||||
|
_isRunning = NO;
|
||||||
return -222;
|
return -222;
|
||||||
}
|
}
|
||||||
} while (!WIFEXITED(status) && !WIFSIGNALED(status));
|
} while (!WIFEXITED(status) && !WIFSIGNALED(status));
|
||||||
|
|
||||||
if(stdOut)
|
_isRunning = NO;
|
||||||
|
if(stdOut || stdErr)
|
||||||
{
|
{
|
||||||
close(out[1]);
|
if(stdOut)
|
||||||
NSString* output = getNSStringFromFile(out[0]);
|
{
|
||||||
*stdOut = output;
|
close(out[1]);
|
||||||
|
}
|
||||||
|
if(stdErr)
|
||||||
|
{
|
||||||
|
close(outErr[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// wait for logging queue to finish
|
||||||
|
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
|
||||||
|
|
||||||
|
if(stdOut)
|
||||||
|
{
|
||||||
|
*stdOut = outString.copy;
|
||||||
|
}
|
||||||
|
if(stdErr)
|
||||||
|
{
|
||||||
|
*stdErr = errString.copy;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(stdErr)
|
|
||||||
{
|
|
||||||
close(outErr[1]);
|
|
||||||
NSString* errorOutput = getNSStringFromFile(outErr[0]);
|
|
||||||
*stdErr = errorOutput;
|
|
||||||
}
|
|
||||||
|
|
||||||
return WEXITSTATUS(status);
|
return WEXITSTATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -362,7 +362,6 @@ extern UIImage* imageWithSize(UIImage* image, CGSize size);
|
||||||
{
|
{
|
||||||
[self closeArchive];
|
[self closeArchive];
|
||||||
}
|
}
|
||||||
NSLog(@"open");
|
|
||||||
_archive = archive_read_new();
|
_archive = archive_read_new();
|
||||||
archive_read_support_format_all(_archive);
|
archive_read_support_format_all(_archive);
|
||||||
archive_read_support_filter_all(_archive);
|
archive_read_support_filter_all(_archive);
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
#import <UIKit/UIKit.h>
|
#import <UIKit/UIKit.h>
|
||||||
#import "TSAppInfo.h"
|
#import "TSAppInfo.h"
|
||||||
|
#import <CoreServices.h>
|
||||||
|
|
||||||
@interface TSAppTableViewController : UITableViewController <UISearchResultsUpdating, UIDocumentPickerDelegate>
|
@interface TSAppTableViewController : UITableViewController <UISearchResultsUpdating, UIDocumentPickerDelegate, LSApplicationWorkspaceObserverProtocol>
|
||||||
{
|
{
|
||||||
UIImage* _placeholderIcon;
|
UIImage* _placeholderIcon;
|
||||||
NSArray<TSAppInfo*>* _cachedAppInfos;
|
NSArray<TSAppInfo*>* _cachedAppInfos;
|
||||||
|
|
|
@ -79,10 +79,16 @@ UIImage* imageWithSize(UIImage* image, CGSize size)
|
||||||
[self loadAppInfos];
|
[self loadAppInfos];
|
||||||
_placeholderIcon = [UIImage _applicationIconImageForBundleIdentifier:@"com.apple.WebSheet" format:iconFormatToUse() scale:[UIScreen mainScreen].scale];
|
_placeholderIcon = [UIImage _applicationIconImageForBundleIdentifier:@"com.apple.WebSheet" format:iconFormatToUse() scale:[UIScreen mainScreen].scale];
|
||||||
_cachedIcons = [NSMutableDictionary new];
|
_cachedIcons = [NSMutableDictionary new];
|
||||||
|
[[LSApplicationWorkspace defaultWorkspace] addObserver:self];
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)dealloc
|
||||||
|
{
|
||||||
|
[[LSApplicationWorkspace defaultWorkspace] removeObserver:self];
|
||||||
|
}
|
||||||
|
|
||||||
- (void)reloadTable
|
- (void)reloadTable
|
||||||
{
|
{
|
||||||
[self loadAppInfos];
|
[self loadAppInfos];
|
||||||
|
@ -467,4 +473,14 @@ UIImage* imageWithSize(UIImage* image, CGSize size)
|
||||||
[TSPresentationDelegate presentViewController:appSelectAlert animated:YES completion:nil];
|
[TSPresentationDelegate presentViewController:appSelectAlert animated:YES completion:nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)applicationsDidInstall:(id)arg1
|
||||||
|
{
|
||||||
|
[self reloadTable];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)applicationsDidUninstall:(id)arg1
|
||||||
|
{
|
||||||
|
[self reloadTable];
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
|
@ -17,8 +17,8 @@ extern NSUserDefaults* trollStoreUserDefaults(void);
|
||||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^
|
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^
|
||||||
{
|
{
|
||||||
// Install IPA
|
// Install IPA
|
||||||
//NSString* log;
|
NSString* log;
|
||||||
int ret = [[TSApplicationsManager sharedInstance] installIpa:pathToIPA force:force log:nil];
|
int ret = [[TSApplicationsManager sharedInstance] installIpa:pathToIPA force:force log:&log];
|
||||||
|
|
||||||
NSError* error;
|
NSError* error;
|
||||||
if(ret != 0)
|
if(ret != 0)
|
||||||
|
@ -54,12 +54,12 @@ extern NSUserDefaults* trollStoreUserDefaults(void);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/*UIAlertAction* copyLogAction = [UIAlertAction actionWithTitle:@"Copy Log" style:UIAlertActionStyleDefault handler:^(UIAlertAction* action)
|
UIAlertAction* copyLogAction = [UIAlertAction actionWithTitle:@"Copy Debug Log" style:UIAlertActionStyleDefault handler:^(UIAlertAction* action)
|
||||||
{
|
{
|
||||||
UIPasteboard* pasteboard = [UIPasteboard generalPasteboard];
|
UIPasteboard* pasteboard = [UIPasteboard generalPasteboard];
|
||||||
pasteboard.string = log;
|
pasteboard.string = log;
|
||||||
}];
|
}];
|
||||||
[errorAlert addAction:copyLogAction];*/
|
[errorAlert addAction:copyLogAction];
|
||||||
}
|
}
|
||||||
|
|
||||||
[TSPresentationDelegate presentViewController:errorAlert animated:YES completion:nil];
|
[TSPresentationDelegate presentViewController:errorAlert animated:YES completion:nil];
|
||||||
|
@ -187,6 +187,4 @@ extern NSUserDefaults* trollStoreUserDefaults(void);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//+ (void)showInstallAppAlertForFile:(NSString*)pathToIPA
|
|
||||||
|
|
||||||
@end
|
@end
|
Loading…
Reference in New Issue