Archive packaging menu, auto refresh, trash favorite, test.zip/test.ipa
This commit is contained in:
1 parent
718bf032c8
commit
71e5d72561
11 files changed
+954
-83
No files matched your search
+49
-1
@@ -455,6 +455,16 @@ static NSArray<NSDictionary<NSString *, NSString *> *> *WQFavoriteEntries(void)
|
||||
return entries;
|
||||
}
|
||||
|
||||
NSString *WQTrashDirectory(void)
|
||||
{
|
||||
NSString *trash = [MCMFilzaVirtualRoot()
|
||||
stringByAppendingPathComponent:@".Trash"];
|
||||
[NSFileManager.defaultManager createDirectoryAtPath:trash
|
||||
withIntermediateDirectories:YES
|
||||
attributes:@{ NSFilePosixPermissions: @0700 } error:nil];
|
||||
return trash;
|
||||
}
|
||||
|
||||
static void WQInstallFavorites(void)
|
||||
{
|
||||
Class prefsClass = NSClassFromString(@"TGPreferences");
|
||||
@@ -471,6 +481,43 @@ static void WQInstallFavorites(void)
|
||||
? (NSMutableArray *)existing : nil;
|
||||
NSMutableIndexSet *stale = [NSMutableIndexSet indexSet];
|
||||
NSFileManager *fm = NSFileManager.defaultManager;
|
||||
|
||||
// Filza's built-in Trash favorite is /var/mobile/Library/Filza/.Trash,
|
||||
// which does not exist in a normally signed app. Repoint it at the
|
||||
// writable trash directory inside the app container.
|
||||
NSString *trash = WQTrashDirectory();
|
||||
NSMutableArray *links = mutableLinks;
|
||||
if (!links && [existing isKindOfClass:NSArray.class]) {
|
||||
SEL setter = NSSelectorFromString(@"setFavoritedLinks:");
|
||||
if ([prefs respondsToSelector:setter]) {
|
||||
links = [existing mutableCopy];
|
||||
((void(*)(id, SEL, id))objc_msgSend)(prefs, setter, links);
|
||||
}
|
||||
}
|
||||
BOOL trashChanged = NO;
|
||||
if (links) {
|
||||
for (NSUInteger index = 0; index < links.count; index++) {
|
||||
if (![links[index] isKindOfClass:NSDictionary.class]) continue;
|
||||
NSDictionary *item = links[index];
|
||||
NSString *name = item[@"name"];
|
||||
NSString *path = item[@"path"];
|
||||
BOOL isTrash = [name isEqualToString:@"Trash"] ||
|
||||
[path isEqualToString:@"/var/mobile/Library/Filza/.Trash"];
|
||||
if (!isTrash) continue;
|
||||
if ([path isEqualToString:trash] && [fm fileExistsAtPath:path])
|
||||
continue;
|
||||
NSMutableDictionary *updated = [item mutableCopy];
|
||||
updated[@"path"] = trash;
|
||||
links[index] = updated;
|
||||
trashChanged = YES;
|
||||
}
|
||||
if (trashChanged) {
|
||||
((void(*)(id, SEL))objc_msgSend)(prefs,
|
||||
NSSelectorFromString(@"saveFavoritedLinks"));
|
||||
NSLog(@"[WQ] Trash favorite -> %@", trash);
|
||||
}
|
||||
}
|
||||
|
||||
if (mutableLinks) {
|
||||
[mutableLinks enumerateObjectsUsingBlock:^(id item, NSUInteger idx, BOOL *stop) {
|
||||
if (![item isKindOfClass:NSDictionary.class]) return;
|
||||
@@ -533,7 +580,8 @@ static void WQInstallBundledTestFiles(void)
|
||||
NSString *folder = WQVirtualRootFolder();
|
||||
NSString *source = [NSBundle.mainBundle.bundlePath
|
||||
stringByAppendingPathComponent:@"WQTestFiles"];
|
||||
NSArray<NSString *> *names = @[@"test.deb", @"test"];
|
||||
NSArray<NSString *> *names = @[@"test.deb", @"test", @"test.zip",
|
||||
@"test.ipa"];
|
||||
for (NSString *name in names) {
|
||||
NSString *from = [source stringByAppendingPathComponent:name];
|
||||
NSString *to = [folder stringByAppendingPathComponent:name];
|
||||
|
||||
Reference in new issue
Block a user