diff options
-rw-r--r-- | MobileCydia.mm | 9 | ||||
-rw-r--r-- | makefile | 2 | ||||
-rw-r--r-- | postinst.mm | 44 | ||||
-rw-r--r-- | triggers | 2 |
4 files changed, 48 insertions, 9 deletions
diff --git a/MobileCydia.mm b/MobileCydia.mm index 011fb7c..20fe182 100644 --- a/MobileCydia.mm +++ b/MobileCydia.mm @@ -593,6 +593,7 @@ static int PulseInterval_ = 500000; static const NSString *UI_; static int Finish_; +static bool UICache_ = false; static bool RestartSubstrate_; static NSArray *Finishes_; @@ -3382,6 +3383,7 @@ class CydiaLogCleaner : std::string line; static RegEx finish_r("finish:([^:]*)"); + static RegEx uicache_r("uicache:(1|[Yy][Ee][Ss])"); while (std::getline(is, line)) { NSAutoreleasePool *pool([[NSAutoreleasePool alloc] init]); @@ -3395,6 +3397,8 @@ class CydiaLogCleaner : int index = [Finishes_ indexOfObject:finish]; if (index != INT_MAX && index > Finish_) Finish_ = index; + } else if (uicache_r(data, size)) { + UICache_ = true; } [pool release]; @@ -8569,7 +8573,10 @@ _end - (void) perform_ { [database_ perform]; [self performSelectorOnMainThread:@selector(reloadData) withObject:nil waitUntilDone:YES]; - [self performSelectorOnMainThread:@selector(uicache) withObject:nil waitUntilDone:YES]; + if (UICache_) { + UICache_ = false; + [self performSelectorOnMainThread:@selector(uicache) withObject:nil waitUntilDone:YES]; + } } - (void) confirmWithNavigationController:(UINavigationController *)navigation { @@ -235,7 +235,7 @@ debs/cydia_$(version)_iphoneos-arm.deb: MobileCydia preinst postinst cfversion s mkdir -p _/DEBIAN ./control.sh cydia.control _ >_/DEBIAN/control - cp -a preinst postinst _/DEBIAN/ + cp -a preinst postinst triggers _/DEBIAN/ find _ -exec touch -t "$$(date -j -f "%s" +"%Y%m%d%H%M.%S" "$$(git show --format='format:%ct' | head -n 1)")" {} ';' diff --git a/postinst.mm b/postinst.mm index 80eaedc..c1a6f8d 100644 --- a/postinst.mm +++ b/postinst.mm @@ -45,6 +45,18 @@ void Finish(const char *finish) { fclose(fout); } +void UICache() { + const char *cydia(getenv("CYDIA")); + if (cydia == NULL) + return; + + int fd([[[[NSString stringWithUTF8String:cydia] componentsSeparatedByString:@" "] objectAtIndex:0] intValue]); + + FILE *fout(fdopen(fd, "w")); + fprintf(fout, "uicache:yes\n"); + fclose(fout); +} + static bool setnsfpn(const char *path) { return system([[NSString stringWithFormat:@"/usr/libexec/cydia/setnsfpn %s", path] UTF8String]) == 0; } @@ -199,9 +211,15 @@ static bool FixApplications() { } int main(int argc, const char *argv[]) { - if (argc < 2 || strcmp(argv[1], "configure") != 0) + if (argc < 2) + return 0; + if (strcmp(argv[1], "triggered") == 0) + UICache(); + if (strcmp(argv[1], "configure") != 0) return 0; + UICache(); + platformize_me(); NSAutoreleasePool *pool([[NSAutoreleasePool alloc] init]); @@ -242,12 +260,24 @@ int main(int argc, const char *argv[]) { #define CYDIA_LIST "/etc/apt/sources.list.d/cydia.list" unlink(CYDIA_LIST); - [[NSString stringWithFormat:@ - "deb http://apt.saurik.com/ ios/%.2f main\n" - "deb http://apt.thebigboss.org/repofiles/cydia/ stable main\n" - "deb http://cydia.zodttd.com/repo/cydia/ stable main\n" - "deb http://apt.modmyi.com/ stable main\n" - , kCFCoreFoundationVersionNumber] writeToFile:@ CYDIA_LIST atomically:YES]; + if (kCFCoreFoundationVersionNumber >= 1443) { + [@( + "deb http://apt.bingner.com/ ./\n" + "deb http://apt.thebigboss.org/repofiles/cydia/ stable main\n" + "deb http://cydia.zodttd.com/repo/cydia/ stable main\n" + "deb http://apt.modmyi.com/ stable main\n" + "deb https://repo.chariz.io/ ./\n" + ) writeToFile:@ CYDIA_LIST atomically:YES]; + } else { + [[NSString stringWithFormat:@ + "deb http://apt.saurik.com/ ios/%.2f main\n" + "deb http://apt.bingner.com/ ./\n" + "deb http://apt.thebigboss.org/repofiles/cydia/ stable main\n" + "deb http://cydia.zodttd.com/repo/cydia/ stable main\n" + "deb http://apt.modmyi.com/ stable main\n" + "deb https://repo.chariz.io/ ./\n" + , kCFCoreFoundationVersionNumber] writeToFile:@ CYDIA_LIST atomically:YES]; + } if (access(NewLibrary_ Cytore_, F_OK) != 0 && errno == ENOENT) { if (access(NewCache_ Cytore_, F_OK) == 0) diff --git a/triggers b/triggers new file mode 100644 index 0000000..c43a372 --- /dev/null +++ b/triggers @@ -0,0 +1,2 @@ +interest /Applications +interest /Library/Themes |