diff options
author | Jay Freeman (saurik) <saurik@saurik.com> | 2017-01-31 21:33:32 -0800 |
---|---|---|
committer | Jay Freeman (saurik) <saurik@saurik.com> | 2017-01-31 21:33:32 -0800 |
commit | f9c8848fc9d0b954980f2dbad9d338ded4ad2a1b (patch) | |
tree | cfbfdbd122a7204d432ef4e531c25f9bc587745a /MobileCydia.mm | |
parent | a07675e1d9fe1344f04b9d436c8de174d086c480 (diff) |
For progress JS on iOS 10 to solve race and flash.
Diffstat (limited to 'MobileCydia.mm')
-rw-r--r-- | MobileCydia.mm | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/MobileCydia.mm b/MobileCydia.mm index dbe4f80..addc941 100644 --- a/MobileCydia.mm +++ b/MobileCydia.mm @@ -1135,6 +1135,7 @@ typedef std::map< unsigned long, _H<Source> > SourceMap; + (Database *) sharedInstance; - (unsigned) era; +- (bool) hasPackages; - (void) _readCydia:(NSNumber *)fd; - (void) _readStatus:(NSNumber *)fd; @@ -3523,6 +3524,10 @@ class CydiaLogCleaner : CFArrayRemoveAllValues(packages_); } +- (bool) hasPackages { + return CFArrayGetCount(packages_) != 0; +} + - (void) dealloc { // XXX: actually implement this thing _assert(false); @@ -4857,10 +4862,16 @@ static _H<NSMutableSet> Diversions_; } - (NSString *) substitutePackageNames:(NSString *)message { + auto database([Database sharedInstance]); + + // XXX: this check is less racy than you'd expect, but this entire concept is a little awkward + if ([database hasPackages]) + return message; + NSMutableArray *words([[[message componentsSeparatedByString:@" "] mutableCopy] autorelease]); for (size_t i(0), e([words count]); i != e; ++i) { NSString *word([words objectAtIndex:i]); - if (Package *package = [[Database sharedInstance] packageWithName:word]) + if (Package *package = [database packageWithName:word]) [words replaceObjectAtIndex:i withObject:[package name]]; } |