|
@@ -92,11 +92,11 @@
|
|
|
/**
|
|
/**
|
|
|
|
|
|
|
|
On tvOS 10+ we need to manually remove the applications from PBAppDepot after moving / removing
|
|
On tvOS 10+ we need to manually remove the applications from PBAppDepot after moving / removing
|
|
|
- them from the /var/mobile/Applications folder. This method cycles filters allInstalledApplications
|
|
|
|
|
|
|
+ them from the /var/mobile/Applications folder. This method cycles filters allInstalledApplications
|
|
|
in the application workspace to only applications with the bundleURL string containing
|
|
in the application workspace to only applications with the bundleURL string containing
|
|
|
/var/mobile/Applications/
|
|
/var/mobile/Applications/
|
|
|
|
|
|
|
|
- loop through them and see which ones actually exist, if they dont, add the bundle ID to the
|
|
|
|
|
|
|
+ loop through them and see which ones actually exist, if they dont, add the bundle ID to the
|
|
|
deleted array that is returned.
|
|
deleted array that is returned.
|
|
|
|
|
|
|
|
*/
|
|
*/
|
|
@@ -114,7 +114,7 @@
|
|
|
__block BOOL containsApplication = NO;
|
|
__block BOOL containsApplication = NO;
|
|
|
NSArray *installedApplications = [workspace allInstalledApplications];
|
|
NSArray *installedApplications = [workspace allInstalledApplications];
|
|
|
|
|
|
|
|
- NSPredicate *pred = [NSPredicate predicateWithFormat:@"self.bundleURL.absoluteString contains[cd] %@ or self.applicationIdentifier contains[cd] %@ ", @"/var/mobile/Applications/", @"com.nito.nitoTV4"];
|
|
|
|
|
|
|
+ NSPredicate *pred = [NSPredicate predicateWithFormat:@"self.bundleURL.absoluteString contains[cd] %@ or self.applicationIdentifier contains[cd] %@ ", @"/Applications/", @"com.nito.nitoTV4"];
|
|
|
NSArray <LSApplicationProxy *> *mobileApplications = [installedApplications filteredArrayUsingPredicate:pred];
|
|
NSArray <LSApplicationProxy *> *mobileApplications = [installedApplications filteredArrayUsingPredicate:pred];
|
|
|
//NSLog(@"new array: %@", newArray);
|
|
//NSLog(@"new array: %@", newArray);
|
|
|
|
|
|
|
@@ -161,7 +161,7 @@
|
|
|
__block NSMutableArray *deletedArray = [NSMutableArray new];
|
|
__block NSMutableArray *deletedArray = [NSMutableArray new];
|
|
|
NSArray *installedApplications = [workspace allInstalledApplications];
|
|
NSArray *installedApplications = [workspace allInstalledApplications];
|
|
|
|
|
|
|
|
- NSPredicate *pred = [NSPredicate predicateWithFormat:@"self.bundleURL.absoluteString contains[cd] %@ or self.applicationIdentifier contains[cd] %@ ", @"/var/mobile/Applications/", @"com.nito.nitoTV4"];
|
|
|
|
|
|
|
+ NSPredicate *pred = [NSPredicate predicateWithFormat:@"self.bundleURL.absoluteString contains[cd] %@ or self.applicationIdentifier contains[cd] %@ ", @"/Applications/", @"com.nito.nitoTV4"];
|
|
|
NSArray <LSApplicationProxy *> *mobileApplications = [installedApplications filteredArrayUsingPredicate:pred];
|
|
NSArray <LSApplicationProxy *> *mobileApplications = [installedApplications filteredArrayUsingPredicate:pred];
|
|
|
//NSLog(@"new array: %@", newArray);
|
|
//NSLog(@"new array: %@", newArray);
|
|
|
|
|
|
|
@@ -184,8 +184,251 @@
|
|
|
return deletedArray;
|
|
return deletedArray;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
++ (void)newReloadApplications {
|
|
|
|
|
+
|
|
|
|
|
+ NSFileManager *manager = [NSFileManager defaultManager];
|
|
|
|
|
+ NSString *whichKill = @"/tmp/usr/bin/killall";
|
|
|
|
|
+ if (![manager fileExistsAtPath:whichKill])
|
|
|
|
|
+ {
|
|
|
|
|
+ whichKill = @"/usr/bin/killall";
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ id appDepot = [objc_getClass("PBAppDepot") sharedInstance];
|
|
|
|
|
+ HBLogInfo(@"appDepot: %@", appDepot);
|
|
|
|
|
+ NSMutableDictionary *installedAppStates = [appDepot internalAppState];
|
|
|
|
|
+ NSLog(@"installedAppStates: %@", installedAppStates);
|
|
|
|
|
+ id nitoTV = [installedAppStates objectForKey:@"com.nito.nitoTV4"];
|
|
|
|
|
+ NSError *error = nil;
|
|
|
|
|
+ NSString *whitelistFile = @"/var/mobile/Library/Preferences/com.nito.whitelist.plist";
|
|
|
|
|
+ NSString *recentlyDeleted = @"/var/mobile/Library/Preferences/com.nito.deleted.plist";
|
|
|
|
|
+ NSArray *whiteList = [NSArray arrayWithContentsOfFile:whitelistFile];
|
|
|
|
|
+ if (!whiteList) {
|
|
|
|
|
+
|
|
|
|
|
+ whiteList = @[@"com.nito.nitoTV4"];
|
|
|
|
|
+ }
|
|
|
|
|
+ NSMutableArray *recentDeletions = [NSMutableArray new];
|
|
|
|
|
+ NSMutableArray *mutableWhiteList = [whiteList mutableCopy];
|
|
|
|
|
+ BOOL addNito = [manager fileExistsAtPath:@"/Applications/nitoTV.app/nitoTV"];
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ NSMutableArray *appArray = [NSMutableArray new];
|
|
|
|
|
+ NSMutableArray *identifierArray = [NSMutableArray new];
|
|
|
|
|
+ BOOL addedApps = FALSE;
|
|
|
|
|
+ NSArray *apps = [manager contentsOfDirectoryAtPath:@"/Applications" error:&error];
|
|
|
|
|
+
|
|
|
|
|
+ for (NSString *app in apps)
|
|
|
|
|
+ if ([app hasSuffix:@".app"]) {
|
|
|
|
|
+
|
|
|
|
|
+ NSString *path = [@"/Applications" stringByAppendingPathComponent:app];
|
|
|
|
|
+ NSString *newPl = [path stringByAppendingPathComponent:@"Info.plist"];
|
|
|
|
|
+ NSMutableDictionary *info = [NSMutableDictionary dictionaryWithContentsOfFile:newPl];
|
|
|
|
|
+
|
|
|
|
|
+ NSString *identifier = [info objectForKey:@"CFBundleIdentifier"];
|
|
|
|
|
+
|
|
|
|
|
+ NSLog(@"identifier: %@", identifier);
|
|
|
|
|
+
|
|
|
|
|
+ id existingObject = (PBSMutableAppState*)[installedAppStates objectForKey:identifier];
|
|
|
|
|
+ if (existingObject != nil)
|
|
|
|
|
+ {
|
|
|
|
|
+ //[installedAppStates setObject:existingObject forKey:identifier];
|
|
|
|
|
+
|
|
|
|
|
+ if (![existingObject isEnabled]){
|
|
|
|
|
+
|
|
|
|
|
+ NSLog(@"its disabled: %@", existingObject);
|
|
|
|
|
+ if (![mutableWhiteList containsObject:identifier])
|
|
|
|
|
+ {
|
|
|
|
|
+ [mutableWhiteList addObject:identifier];
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ NSDictionary *appDict = @{@"ApplicationType": @"System", @"CFBundleIdentifier": identifier, @"CodeInfoIdentifier": identifier, @"Path": path};
|
|
|
|
|
+
|
|
|
|
|
+ [appArray addObject:appDict];
|
|
|
|
|
+ [identifierArray addObject:identifier];
|
|
|
|
|
+ addedApps = YES;
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ } else {
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ NSLog(@"didnt find object for key: %@", identifier);
|
|
|
|
|
+ if (![mutableWhiteList containsObject:identifier])
|
|
|
|
|
+ {
|
|
|
|
|
+ [mutableWhiteList addObject:identifier];
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ NSDictionary *appDict = @{@"ApplicationType": @"System", @"CFBundleIdentifier": identifier, @"CodeInfoIdentifier": identifier, @"Path": path};
|
|
|
|
|
+
|
|
|
|
|
+ [appArray addObject:appDict];
|
|
|
|
|
+ [identifierArray addObject:identifier];
|
|
|
|
|
+ addedApps = YES;
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /*
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ Class PBSMASC = objc_getClass("PBSMutableAppState");
|
|
|
|
|
+ id appState = [[PBSMASC alloc] initWithApplicationIdentifer:identifier];
|
|
|
|
|
+ [appState setEnabled:YES];
|
|
|
|
|
+ //[appState setCacheDeleting:YES];
|
|
|
|
|
+ [appState incrementCacheDeleting];
|
|
|
|
|
+ NSLog(@"app state: %@", appState);
|
|
|
|
|
+ [installedAppStates setObject:appState forKey:identifier];
|
|
|
|
|
+
|
|
|
|
|
+ [workspace registerApplicationDictionary:info];
|
|
|
|
|
+
|
|
|
|
|
+ */
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ NSString* pth = @"/var/mobile/Library/Preferences/kjc.appenabler.state.plist";
|
|
|
|
|
+ [appArray writeToFile:pth atomically:YES];
|
|
|
|
|
+
|
|
|
|
|
+ Class WSCLASS = objc_getClass("LSApplicationWorkspace");
|
|
|
|
|
+
|
|
|
|
|
+ id workspace = nil;
|
|
|
|
|
+ if (WSCLASS != nil)
|
|
|
|
|
+ {
|
|
|
|
|
+ workspace = [WSCLASS defaultWorkspace];
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ NSArray *deletedApps = [self deletedApplications];
|
|
|
|
|
+ BOOL removedApps = ([deletedApps count] > 0);
|
|
|
|
|
+
|
|
|
|
|
+ if ([workspace respondsToSelector:@selector(_LSPrivateSyncWithMobileInstallation)]){
|
|
|
|
|
+ if (addedApps || removedApps){
|
|
|
|
|
+
|
|
|
|
|
+ //rm /var/containers/Data/System/97D6E4BA-C0BF-408B-AF63-1836844381AE/Library/Caches/com.apple.LaunchServices-175-v2.csstore
|
|
|
|
|
+
|
|
|
|
|
+ //delete the csstore file, its run through bash so the wildcards are completed properly
|
|
|
|
|
+
|
|
|
|
|
+ //[NSTask launchedTaskWithLaunchPath:@"/bin/bash" arguments:@[@"/bin/rm", @"/var/containers/Data/System/*/Library/Caches/com.apple.LaunchServices*.csstore"]];
|
|
|
|
|
+
|
|
|
|
|
+ //FIXME: i dont like calling this chmod +x shell script
|
|
|
|
|
+ //its probably a security risk of some type, but the line above
|
|
|
|
|
+ //didnt work properly and i couldnt figure out why
|
|
|
|
|
+
|
|
|
|
|
+ [NSTask launchedTaskWithLaunchPath:@"/bin/bash" arguments:@[@"/usr/bin/rmcache"]];
|
|
|
|
|
+
|
|
|
|
|
+ if (removedApps)
|
|
|
|
|
+ {
|
|
|
|
|
+
|
|
|
|
|
+ NSLog(@"app ids were deleted: %@", deletedApps);
|
|
|
|
|
+ [deletedApps enumerateObjectsUsingBlock:^(NSString * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
|
|
|
|
+
|
|
|
|
|
+ [mutableWhiteList removeObject:obj];
|
|
|
|
|
+ [recentDeletions addObject:obj];
|
|
|
|
|
+ NSLog(@"removing app state with id: %@", obj);
|
|
|
|
|
+ [appDepot _removeAppStateForIdentifier:obj];
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ }];
|
|
|
|
|
+ } else {
|
|
|
|
|
+ //no removed apps, need to make sure they don't mess with our reload anymore
|
|
|
|
|
+ [[NSFileManager defaultManager] removeItemAtPath:recentlyDeleted error:nil];
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /*
|
|
|
|
|
+
|
|
|
|
|
+ _LSPrivateSyncWithMobileInstallation will actually display the application and allow you to launch it, but the AppDepot (or something related to the installed app database) is potentially harshed or out of sync after we do this, which is why we always call the killall at the very bottom of this method, also if apps are
|
|
|
|
|
+ deleted their state is not updated properly without a respring either
|
|
|
|
|
+
|
|
|
|
|
+ */
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ if((addedApps || removedApps)){
|
|
|
|
|
+
|
|
|
|
|
+ NSLog(@"we can haz new app");
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ [workspace _LSClearSchemaCaches]; //may or may not be necessary
|
|
|
|
|
+ [workspace _LSPrivateRebuildApplicationDatabasesForSystemApps:YES internal:YES user:YES];
|
|
|
|
|
+ [workspace _LSPrivateSyncWithMobileInstallation];
|
|
|
|
|
+ [workspace invalidateIconCache:nil];
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ [mutableWhiteList writeToFile:whitelistFile atomically:YES];
|
|
|
|
|
+
|
|
|
|
|
+ [recentDeletions writeToFile:recentlyDeleted atomically:YES];
|
|
|
|
|
+
|
|
|
|
|
+ if(addedApps){
|
|
|
|
|
+
|
|
|
|
|
+ NSLog(@"we can haz new app");
|
|
|
|
|
+
|
|
|
|
|
+ sleep(5);
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ for (NSDictionary* o in appArray)
|
|
|
|
|
+ {
|
|
|
|
|
+ char retry=0;
|
|
|
|
|
+ NSString* identifier = o[@"CFBundleIdentifier"];
|
|
|
|
|
+ retry_:
|
|
|
|
|
+ NSLog(@"identifier: %@", identifier);
|
|
|
|
|
+
|
|
|
|
|
+ id existingObject = [installedAppStates objectForKey:identifier];
|
|
|
|
|
+ if (existingObject != nil)
|
|
|
|
|
+ {
|
|
|
|
|
+ [existingObject setValue:[NSNumber numberWithBool:YES] forKey:@"_enabled"];
|
|
|
|
|
+ BOOL isEnabled = [existingObject isEnabled];
|
|
|
|
|
+
|
|
|
|
|
+ //[existingObject setEnabled:YES];
|
|
|
|
|
+ //[installedAppStates setObject: existingObject forKey: identifier];
|
|
|
|
|
+ } else {
|
|
|
|
|
+ //[appDepot _addAppStateForIdentifier:identifier];
|
|
|
|
|
+ NSLog(@"didnt find object for key: %@, error!!!!!!", identifier);
|
|
|
|
|
+ if(retry == 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ NSLog(@"retry");
|
|
|
|
|
+ //NSLog(@"try to manually kick start substrate!");
|
|
|
|
|
+ //[NSTask launchedTaskWithLaunchPath:@"/usr/bin/nitoHelper" arguments:@[@"substrate", @"1", @"2"]];
|
|
|
|
|
+ //is9 = false;
|
|
|
|
|
+
|
|
|
|
|
+ ///usr/bin/cynject 1 /Library/Frameworks/CydiaSubstrate.framework/Libraries/SubstrateLauncher.dylib
|
|
|
|
|
+ retry = 1;
|
|
|
|
|
+ goto retry_;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ //this notification is received by uicache binary so its knows that its safe to exit the runloop it creates so it can relay notifications back and forth during this convoluted process.
|
|
|
|
|
+
|
|
|
|
|
+ [[NSDistributedNotificationCenter defaultCenter] postNotificationName:@"kjc.AppEnabler.done" object:nil userInfo:nil];
|
|
|
|
|
+
|
|
|
|
|
+ //it beats killall -u mobile... right?
|
|
|
|
|
+ //we dont have system() call anymore and posix_spawn is a pain to configure.
|
|
|
|
|
+ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 5 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
|
|
|
|
|
+
|
|
|
|
|
+ //[@"science" writeToFile:@"/var/mobile/Library/Preferences/itshappening" atomically:YES encoding:NSUTF8StringEncoding error:nil];
|
|
|
|
|
+
|
|
|
|
|
+ [NSTask launchedTaskWithLaunchPath:whichKill arguments:@[@"-9", @"PineBoard", @"HeadBoard", @"lsd", @"installd"]];
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
+ (void)reloadApplications
|
|
+ (void)reloadApplications
|
|
|
{
|
|
{
|
|
|
|
|
+
|
|
|
|
|
+ [self newReloadApplications];
|
|
|
|
|
+ return;
|
|
|
//at the moment in tvOS 10 morpheus extracts the bintools to /tmp rather than root, so .. for now, it could be in /tmp
|
|
//at the moment in tvOS 10 morpheus extracts the bintools to /tmp rather than root, so .. for now, it could be in /tmp
|
|
|
NSFileManager *manager = [NSFileManager defaultManager];
|
|
NSFileManager *manager = [NSFileManager defaultManager];
|
|
|
NSString *whichKill = @"/tmp/usr/bin/killall";
|
|
NSString *whichKill = @"/tmp/usr/bin/killall";
|
|
@@ -219,6 +462,7 @@
|
|
|
|
|
|
|
|
*/
|
|
*/
|
|
|
id appDepot = [objc_getClass("PBAppDepot") sharedInstance];
|
|
id appDepot = [objc_getClass("PBAppDepot") sharedInstance];
|
|
|
|
|
+ HBLogInfo(@"appDepot: %@", appDepot);
|
|
|
NSMutableDictionary *installedAppStates = [appDepot internalAppState];
|
|
NSMutableDictionary *installedAppStates = [appDepot internalAppState];
|
|
|
NSLog(@"installedAppStates: %@", installedAppStates);
|
|
NSLog(@"installedAppStates: %@", installedAppStates);
|
|
|
id nitoTV = [installedAppStates objectForKey:@"com.nito.nitoTV4"];
|
|
id nitoTV = [installedAppStates objectForKey:@"com.nito.nitoTV4"];
|
|
@@ -312,9 +556,15 @@
|
|
|
if (pluginInfo != nil) {
|
|
if (pluginInfo != nil) {
|
|
|
NSString *pluginID = [pluginInfo objectForKey:@"CFBundleIdentifier"];
|
|
NSString *pluginID = [pluginInfo objectForKey:@"CFBundleIdentifier"];
|
|
|
|
|
|
|
|
|
|
+ NSLog(@"id: %@", identifier);
|
|
|
|
|
+ NSLog(@"pluginID: %@", pluginID);
|
|
|
|
|
+ NSLog(@"pluginPath: %@", pluginPath);
|
|
|
|
|
+
|
|
|
NSDictionary *pluginDict = @{@"ApplicationType": @"PluginKitPlugin", @"CFBundleIdentifier": pluginID, @"CodeInfoIdentifier": pluginID, @"Path": pluginPath, @"PluginOwnerBundleID": identifier};
|
|
NSDictionary *pluginDict = @{@"ApplicationType": @"PluginKitPlugin", @"CFBundleIdentifier": pluginID, @"CodeInfoIdentifier": pluginID, @"Path": pluginPath, @"PluginOwnerBundleID": identifier};
|
|
|
- [appArray addObject:pluginDict];
|
|
|
|
|
|
|
|
|
|
|
|
+ //NSLog(@"pluginDict: %@", pluginDict);
|
|
|
|
|
+
|
|
|
|
|
+ [appArray addObject:pluginDict];
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -384,15 +634,12 @@
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
//the file that we store the installed applications in
|
|
//the file that we store the installed applications in
|
|
|
NSString* pth = @"/var/mobile/Library/Preferences/kjc.appenabler.state.plist";
|
|
NSString* pth = @"/var/mobile/Library/Preferences/kjc.appenabler.state.plist";
|
|
|
[appArray writeToFile:pth atomically:YES];
|
|
[appArray writeToFile:pth atomically:YES];
|
|
|
|
|
|
|
|
-
|
|
|
|
|
Class WSCLASS = objc_getClass("LSApplicationWorkspace");
|
|
Class WSCLASS = objc_getClass("LSApplicationWorkspace");
|
|
|
|
|
|
|
|
id workspace = nil;
|
|
id workspace = nil;
|
|
@@ -401,12 +648,11 @@
|
|
|
workspace = [WSCLASS defaultWorkspace];
|
|
workspace = [WSCLASS defaultWorkspace];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
int is9 = 0;
|
|
int is9 = 0;
|
|
|
//tvOS 10+
|
|
//tvOS 10+
|
|
|
|
|
|
|
|
-
|
|
|
|
|
NSArray *deletedApps = [self deletedApplications];
|
|
NSArray *deletedApps = [self deletedApplications];
|
|
|
BOOL removedApps = ([deletedApps count] > 0);
|
|
BOOL removedApps = ([deletedApps count] > 0);
|
|
|
|
|
|
|
@@ -423,7 +669,7 @@
|
|
|
//its probably a security risk of some type, but the line above
|
|
//its probably a security risk of some type, but the line above
|
|
|
//didnt work properly and i couldnt figure out why
|
|
//didnt work properly and i couldnt figure out why
|
|
|
|
|
|
|
|
- [NSTask launchedTaskWithLaunchPath:@"/usr/bin/rmcache" arguments:@[]];
|
|
|
|
|
|
|
+ [NSTask launchedTaskWithLaunchPath:@"/bin/bash" arguments:@[@"/usr/bin/rmcache"]];
|
|
|
|
|
|
|
|
if (removedApps)
|
|
if (removedApps)
|
|
|
{
|
|
{
|
|
@@ -444,14 +690,17 @@
|
|
|
[[NSFileManager defaultManager] removeItemAtPath:recentlyDeleted error:nil];
|
|
[[NSFileManager defaultManager] removeItemAtPath:recentlyDeleted error:nil];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
/*
|
|
/*
|
|
|
|
|
|
|
|
- _LSPrivateSyncWithMobileInstallation will actually display the application and allow you to launch it, but the AppDepot (or something related to the installed app database) is potentially harshed or out of sync after we do this, which is why we always call the killall at the very bottom of this method, also if apps are
|
|
|
|
|
|
|
+ _LSPrivateSyncWithMobileInstallation will actually display the application and allow you to launch it, but the AppDepot (or something related to the installed app database) is potentially harshed or out of sync after we do this, which is why we always call the killall at the very bottom of this method, also if apps are
|
|
|
deleted their state is not updated properly without a respring either
|
|
deleted their state is not updated properly without a respring either
|
|
|
|
|
|
|
|
*/
|
|
*/
|
|
|
|
|
+
|
|
|
|
|
+ NSLog(@"before (addedApps || removedApps)");
|
|
|
|
|
+
|
|
|
if((addedApps || removedApps) && [self containsNewApplication:identifierArray]){
|
|
if((addedApps || removedApps) && [self containsNewApplication:identifierArray]){
|
|
|
|
|
|
|
|
NSLog(@"we can haz new app");
|
|
NSLog(@"we can haz new app");
|
|
@@ -468,7 +717,7 @@
|
|
|
/*
|
|
/*
|
|
|
|
|
|
|
|
lil bit of extra work for tvOS 9, we completely torch the lsd csstore file,
|
|
lil bit of extra work for tvOS 9, we completely torch the lsd csstore file,
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
from there we call a distributed notification that is relayed back to the uicache
|
|
from there we call a distributed notification that is relayed back to the uicache
|
|
|
binary
|
|
binary
|
|
|
|
|
|
|
@@ -494,7 +743,7 @@
|
|
|
|
|
|
|
|
[recentDeletions writeToFile:recentlyDeleted atomically:YES];
|
|
[recentDeletions writeToFile:recentlyDeleted atomically:YES];
|
|
|
|
|
|
|
|
- /*
|
|
|
|
|
|
|
+ /*
|
|
|
|
|
|
|
|
this is a kludgy hack, we need to wait some time while our code is triggered in
|
|
this is a kludgy hack, we need to wait some time while our code is triggered in
|
|
|
the AppEnabler tweak that injects into MobileInstallation.
|
|
the AppEnabler tweak that injects into MobileInstallation.
|
|
@@ -512,52 +761,49 @@
|
|
|
At that point in tvOS 10+ we still need to 'respring' to get everything loaded and working
|
|
At that point in tvOS 10+ we still need to 'respring' to get everything loaded and working
|
|
|
without any issues.
|
|
without any issues.
|
|
|
|
|
|
|
|
- in tvOS 9 we don't need to respring, things should appear / disappear without any
|
|
|
|
|
|
|
+ in tvOS 9 we don't need to respring, things should appear / disappear without any
|
|
|
extra work.
|
|
extra work.
|
|
|
|
|
|
|
|
*/
|
|
*/
|
|
|
-
|
|
|
|
|
if(addedApps && [self containsNewApplication:identifierArray]){
|
|
if(addedApps && [self containsNewApplication:identifierArray]){
|
|
|
|
|
|
|
|
NSLog(@"we can haz new app");
|
|
NSLog(@"we can haz new app");
|
|
|
-
|
|
|
|
|
- sleep(5);
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- for (NSDictionary* o in appArray)
|
|
|
|
|
- {
|
|
|
|
|
- char retry=0;
|
|
|
|
|
- NSString* identifier = o[@"CFBundleIdentifier"];
|
|
|
|
|
- retry_:
|
|
|
|
|
- NSLog(@"identifier: %@", identifier);
|
|
|
|
|
|
|
|
|
|
- id existingObject = [installedAppStates objectForKey:identifier];
|
|
|
|
|
- if (existingObject != nil)
|
|
|
|
|
|
|
+ sleep(5);
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ for (NSDictionary* o in appArray)
|
|
|
{
|
|
{
|
|
|
- [existingObject setValue:[NSNumber numberWithBool:YES] forKey:@"_enabled"];
|
|
|
|
|
-
|
|
|
|
|
- BOOL isEnabled = [existingObject isEnabled];
|
|
|
|
|
|
|
+ char retry=0;
|
|
|
|
|
+ NSString* identifier = o[@"CFBundleIdentifier"];
|
|
|
|
|
+ retry_:
|
|
|
|
|
+ NSLog(@"identifier: %@", identifier);
|
|
|
|
|
|
|
|
-
|
|
|
|
|
- //[existingObject setEnabled:YES];
|
|
|
|
|
- //[installedAppStates setObject: existingObject forKey: identifier];
|
|
|
|
|
- } else {
|
|
|
|
|
- //[appDepot _addAppStateForIdentifier:identifier];
|
|
|
|
|
- NSLog(@"didnt find object for key: %@, error!!!!!!", identifier);
|
|
|
|
|
- if(retry == 0)
|
|
|
|
|
|
|
+ id existingObject = [installedAppStates objectForKey:identifier];
|
|
|
|
|
+ if (existingObject != nil)
|
|
|
{
|
|
{
|
|
|
- NSLog(@"retry");
|
|
|
|
|
- //NSLog(@"try to manually kick start substrate!");
|
|
|
|
|
- //[NSTask launchedTaskWithLaunchPath:@"/usr/bin/nitoHelper" arguments:@[@"substrate", @"1", @"2"]];
|
|
|
|
|
- //is9 = false;
|
|
|
|
|
|
|
+ [existingObject setValue:[NSNumber numberWithBool:YES] forKey:@"_enabled"];
|
|
|
|
|
+ BOOL isEnabled = [existingObject isEnabled];
|
|
|
|
|
|
|
|
- ///usr/bin/cynject 1 /Library/Frameworks/CydiaSubstrate.framework/Libraries/SubstrateLauncher.dylib
|
|
|
|
|
- retry = 1;
|
|
|
|
|
- goto retry_;
|
|
|
|
|
|
|
+ //[existingObject setEnabled:YES];
|
|
|
|
|
+ //[installedAppStates setObject: existingObject forKey: identifier];
|
|
|
|
|
+ } else {
|
|
|
|
|
+ //[appDepot _addAppStateForIdentifier:identifier];
|
|
|
|
|
+ NSLog(@"didnt find object for key: %@, error!!!!!!", identifier);
|
|
|
|
|
+ if(retry == 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ NSLog(@"retry");
|
|
|
|
|
+ //NSLog(@"try to manually kick start substrate!");
|
|
|
|
|
+ //[NSTask launchedTaskWithLaunchPath:@"/usr/bin/nitoHelper" arguments:@[@"substrate", @"1", @"2"]];
|
|
|
|
|
+ //is9 = false;
|
|
|
|
|
+
|
|
|
|
|
+ ///usr/bin/cynject 1 /Library/Frameworks/CydiaSubstrate.framework/Libraries/SubstrateLauncher.dylib
|
|
|
|
|
+ retry = 1;
|
|
|
|
|
+ goto retry_;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
//this notification is received by uicache binary so its knows that its safe to exit the runloop it creates so it can relay notifications back and forth during this convoluted process.
|
|
//this notification is received by uicache binary so its knows that its safe to exit the runloop it creates so it can relay notifications back and forth during this convoluted process.
|
|
|
|
|
|
|
|
[[NSDistributedNotificationCenter defaultCenter] postNotificationName:@"kjc.AppEnabler.done" object:nil userInfo:nil];
|
|
[[NSDistributedNotificationCenter defaultCenter] postNotificationName:@"kjc.AppEnabler.done" object:nil userInfo:nil];
|
|
@@ -566,6 +812,9 @@
|
|
|
//we dont have system() call anymore and posix_spawn is a pain to configure.
|
|
//we dont have system() call anymore and posix_spawn is a pain to configure.
|
|
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 5 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
|
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 5 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
|
|
|
if (!is9){
|
|
if (!is9){
|
|
|
|
|
+
|
|
|
|
|
+ //[@"science" writeToFile:@"/var/mobile/Library/Preferences/itshappening" atomically:YES encoding:NSUTF8StringEncoding error:nil];
|
|
|
|
|
+
|
|
|
[NSTask launchedTaskWithLaunchPath:whichKill arguments:@[@"-9", @"PineBoard", @"HeadBoard", @"lsd"]];
|
|
[NSTask launchedTaskWithLaunchPath:whichKill arguments:@[@"-9", @"PineBoard", @"HeadBoard", @"lsd"]];
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|