diff options
author | Sam Bingner <sam@bingner.com> | 2018-09-30 15:05:38 -1000 |
---|---|---|
committer | Sam Bingner <sam@bingner.com> | 2019-05-27 14:16:11 -1000 |
commit | 6f6bdfbcbb3b5dc0a67e28cfe36523e0433ecbeb (patch) | |
tree | 6838775f341277db5d1e752138dec45efe6cbfa9 | |
parent | 3916b31c1a7f80bad761770af4cf3002aa474d5e (diff) |
Try making uicache trigger
-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 ba6afa0..2fc28ec 100644 --- a/MobileCydia.mm +++ b/MobileCydia.mm @@ -589,6 +589,7 @@ static int PulseInterval_ = 500000; static const NSString *UI_; static int Finish_; +static bool UICache_ = false; static bool RestartSubstrate_; static NSArray *Finishes_; @@ -3378,6 +3379,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]); @@ -3391,6 +3393,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]; @@ -8565,7 +8569,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 { @@ -342,7 +342,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 1b24c6d..6115c7b 100644 --- a/postinst.mm +++ b/postinst.mm @@ -43,6 +43,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; } @@ -197,9 +209,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]); @@ -240,12 +258,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 |