bool IsWildcat_;
static CGFloat ScreenScale_;
static NSString *Idiom_;
+
+static NSMutableSet *CydiaHosts_;
/* }}} */
/* Display Helpers {{{ */
- (CYViewController *) pageForPackage:(NSString *)name;
- (void) showActionSheet:(UIActionSheet *)sheet fromItem:(UIBarButtonItem *)item;
- (void) reloadDataWithInvocation:(NSInvocation *)invocation;
+- (void) addCydiaHost:(NSString *)host;
@end
/* }}} */
@"purposes",
@"relations",
@"section",
+ @"selection",
@"shortDescription",
@"shortSection",
@"simpleSection",
@"size",
@"source",
@"sponsor",
+ @"state",
@"support",
+ @"tags",
@"warnings",
nil];
}
return files;
}
+- (NSString *) state {
+@synchronized (database_) {
+ if ([database_ era] != era_ || file_.end())
+ return nil;
+
+ switch (iterator_->CurrentState) {
+ case pkgCache::State::NotInstalled:
+ return @"NotInstalled";
+ case pkgCache::State::UnPacked:
+ return @"UnPacked";
+ case pkgCache::State::HalfConfigured:
+ return @"HalfConfigured";
+ case pkgCache::State::HalfInstalled:
+ return @"HalfInstalled";
+ case pkgCache::State::ConfigFiles:
+ return @"ConfigFiles";
+ case pkgCache::State::Installed:
+ return @"Installed";
+ case pkgCache::State::TriggersAwaited:
+ return @"TriggersAwaited";
+ case pkgCache::State::TriggersPending:
+ return @"TriggersPending";
+ }
+
+ return (NSString *) [NSNull null];
+} }
+
+- (NSString *) selection {
+@synchronized (database_) {
+ if ([database_ era] != era_ || file_.end())
+ return nil;
+
+ switch (iterator_->SelectedState) {
+ case pkgCache::State::Unknown:
+ return @"Unknown";
+ case pkgCache::State::Install:
+ return @"Install";
+ case pkgCache::State::Hold:
+ return @"Hold";
+ case pkgCache::State::DeInstall:
+ return @"DeInstall";
+ case pkgCache::State::Purge:
+ return @"Purge";
+ }
+
+ return (NSString *) [NSNull null];
+} }
+
- (NSArray *) warnings {
NSMutableArray *warnings([NSMutableArray arrayWithCapacity:4]);
const char *name(iterator_.Name());
_assert(false);
}
+- (NSArray *) tags {
+ return tags_;
+}
+
- (BOOL) hasTag:(NSString *)tag {
return tags_ == nil ? NO : [tags_ containsObject:tag];
}
+ (NSString *) webScriptNameForSelector:(SEL)selector {
if (false);
+ else if (selector == @selector(addCydiaHost:))
+ return @"addCydiaHost";
else if (selector == @selector(addTrivialSource:))
return @"addTrivialSource";
else if (selector == @selector(close))
return [NSString stringWithCString:value];
}
+- (void) addCydiaHost:(NSString *)host {
+ [delegate_ performSelectorOnMainThread:@selector(addCydiaHost:) withObject:host waitUntilDone:NO];
+}
+
- (void) addTrivialSource:(NSString *)href {
[delegate_ performSelectorOnMainThread:@selector(addTrivialSource:) withObject:href waitUntilDone:NO];
}
NSURLResponse *response([source response]);
NSURL *url([response URL]);
- NSString *scheme([url scheme]);
+ //NSString *scheme([url scheme]);
NSString *host([url host]);
if ([response isKindOfClass:[NSHTTPURLResponse class]]) {
[self setHeaders:headers forHost:host];
}
- if (
- [host isEqualToString:@"cydia.saurik.com"] ||
- [host hasSuffix:@".cydia.saurik.com"] ||
- [scheme isEqualToString:@"file"]
- )
+ if ([CydiaHosts_ containsObject:host])
[window setValue:cydia_ forKey:@"cydia"];
}
- (void) repairWithInvocation:(NSInvocation *)invocation {
_trace();
- [self invokeNewProgress:invocation forController:nil withTitle:UCLocalize("REPAIRING")];
+ [self invokeNewProgress:invocation forController:nil withTitle:@"REPAIRING"];
_trace();
}
fclose(file);
- [self detachNewProgressSelector:@selector(update_) toTarget:self forController:nil title:UCLocalize("UPDATING_SOURCES")];
+ [self detachNewProgressSelector:@selector(update_) toTarget:self forController:nil title:@"UPDATING_SOURCES"];
[self complete];
}
- (void) confirmWithNavigationController:(UINavigationController *)navigation {
Queuing_ = false;
++locked_;
- [self detachNewProgressSelector:@selector(perform) toTarget:database_ forController:navigation title:UCLocalize("RUNNING")];
+ [self detachNewProgressSelector:@selector(perform) toTarget:database_ forController:navigation title:@"RUNNING"];
--locked_;
[self complete];
}
[tabbar_ setUpdateDelegate:self];
}
+- (void) addCydiaHost:(NSString *)host {
+ [CydiaHosts_ addObject:host];
+}
+
- (void) applicationDidFinishLaunching:(id)unused {
_trace();
if ([self respondsToSelector:@selector(setApplicationSupportsShakeToEdit:)])
[self setApplicationSupportsShakeToEdit:NO];
+ [self addCydiaHost:[[NSURL URLWithString:CydiaURL(@"")] host]];
+
[NSURLCache setSharedURLCache:[[[SDURLCache alloc]
initWithMemoryCapacity:524288
diskCapacity:10485760
NSLog(@"unknown UIUserInterfaceIdiom!");
}
+ CydiaHosts_ = [NSMutableSet setWithCapacity:2];
+
UI_ = CydiaURL([NSString stringWithFormat:@"ui/ios~%@", Idiom_]);
PackageName = reinterpret_cast<CYString &(*)(Package *, SEL)>(method_getImplementation(class_getInstanceMethod([Package class], @selector(cyname))));
if (access("/tmp/.cydia.fw", F_OK) == 0) {
unlink("/tmp/.cydia.fw");
goto firmware;
- } else if (access("/User", F_OK) != 0 || version < 2) {
+ } else if (access("/User", F_OK) != 0 || version < 4) {
firmware:
_trace();
system("/usr/libexec/cydia/firmware.sh");