#include "SDURLCache/SDURLCache.h"
#include "substrate.h"
+
+#include "Version.h"
/* }}} */
/* Profiler {{{ */
[delegate_ repairWithSelector:@selector(configure)];
else if (error == "The package lists or status file could not be parsed or opened.")
[delegate_ repairWithSelector:@selector(update)];
- // else if (error == "Could not open lock file /var/lib/dpkg/lock - open (13 Permission denied)")
// else if (error == "Could not get lock /var/lib/dpkg/lock - open (35 Resource temporarily unavailable)")
+ // else if (error == "Could not open lock file /var/lib/dpkg/lock - open (13 Permission denied)")
+ // else if (error == "Malformed Status line")
// else if (error == "The list of sources could not be read.")
else {
[delegate_ addProgressEventOnMainThread:[CydiaProgressEvent eventWithMessage:[NSString stringWithUTF8String:error.c_str()] ofType:(warning ? @"WARNING" : @"ERROR")] forTask:title];
@"role",
@"serial",
@"token",
+ @"version",
nil];
}
return ![[self _attributeKeys] containsObject:[NSString stringWithUTF8String:name]] && [super isKeyExcludedFromWebScript:name];
}
+- (NSString *) version {
+ return @ Cydia_;
+}
+
- (NSString *) device {
return [[UIDevice currentDevice] uniqueIdentifier];
}
} }
- (Package *) getPackageById:(NSString *)id {
- Package *package([[Database sharedInstance] packageWithName:id]);
- [package parse];
- return package;
+ if (Package *package = [[Database sharedInstance] packageWithName:id]) {
+ [package parse];
+ return package;
+ } else
+ return (Package *) [NSNull null];
}
- (NSArray *) statfs:(NSString *)path {
WebView *webview([[webview_ _documentView] webView]);
- Package *package([[Database sharedInstance] packageWithName:@"cydia"]);
-
- NSString *application = package == nil ? @"Cydia" : [NSString
- stringWithFormat:@"Cydia/%@",
- [package installed]
- ];
+ NSString *application([NSString stringWithFormat:@"Cydia/%@", @ Cydia_]);
if (Safari_ != nil)
application = [NSString stringWithFormat:@"Safari/%@ %@", Safari_, application];
}
}
-- (void) presentModalViewController:(UIViewController *)controller {
+- (void) disemulate {
+ if (emulated_ == nil)
+ return;
+
+ [window_ addSubview:[tabbar_ view]];
+ [[emulated_ view] removeFromSuperview];
+ [emulated_ release];
+ emulated_ = nil;
+ [window_ setUserInteractionEnabled:YES];
+}
+
+- (void) presentModalViewController:(UIViewController *)controller force:(BOOL)force {
UINavigationController *navigation([[[CYNavigationController alloc] initWithRootViewController:controller] autorelease]);
if (IsWildcat_)
[navigation setModalPresentationStyle:UIModalPresentationFormSheet];
- [((UIViewController *) emulated_ ?: tabbar_) presentModalViewController:navigation animated:YES];
+
+ UIViewController *parent;
+ if (emulated_ == nil)
+ parent = tabbar_;
+ else if (!force)
+ parent = emulated_;
+ else {
+ [self disemulate];
+ parent = tabbar_;
+ }
+
+ [parent presentModalViewController:navigation animated:YES];
}
- (ProgressController *) invokeNewProgress:(NSInvocation *)invocation forController:(UINavigationController *)navigation withTitle:(NSString *)title {
if (navigation != nil)
[navigation pushViewController:progress animated:YES];
else
- [self presentModalViewController:progress];
+ [self presentModalViewController:progress force:YES];
[progress invoke:invocation withTitle:title];
return progress;
_trace();
if (Role_ == nil) {
[window_ setUserInteractionEnabled:YES];
- [self presentModalViewController:[[[SettingsController alloc] initWithDatabase:database_ delegate:self] autorelease]];
+ [self presentModalViewController:[[[SettingsController alloc] initWithDatabase:database_ delegate:self] autorelease] force:NO];
return;
} else {
if ([emulated_ modalViewController] != nil)
[self reloadData];
PrintTimes();
- [window_ addSubview:[tabbar_ view]];
-
- [[emulated_ view] removeFromSuperview];
- [emulated_ release];
- emulated_ = nil;
-
- [window_ setUserInteractionEnabled:YES];
+ [self disemulate];
int selectedIndex = 0;
NSMutableArray *items = nil;