static int Finish_;
static bool RestartSubstrate_;
+static bool UpgradeCydia_;
static NSArray *Finishes_;
#define SpringBoard_ "/System/Library/LaunchDaemons/com.apple.SpringBoard.plist"
static time_t now_;
bool IsWildcat_;
-static CGFloat ScreenScale_;
+CGFloat ScreenScale_;
static NSString *Idiom_;
static _H<NSString> Firmware_;
static NSString *Major_;
} }
- (NSArray *) warnings {
+@synchronized (database_) {
+ if ([database_ era] != era_ || file_.end())
+ return nil;
+
NSMutableArray *warnings([NSMutableArray arrayWithCapacity:4]);
const char *name(iterator_.Name());
bool user = false;
bool _private = false;
bool stash = false;
+ bool dbstash = false;
bool dsstore = false;
bool repository = [[self section] isEqualToString:@"Repositories"];
_private = true;
else if (!stash && [file isEqualToString:@"/var/stash"])
stash = true;
+ else if (!dbstash && [file isEqualToString:@"/var/db/stash"])
+ dbstash = true;
else if (!dsstore && [file hasSuffix:@"/.DS_Store"])
dsstore = true;
[warnings addObject:[NSString stringWithFormat:UCLocalize("FILES_INSTALLED_TO"), @"/private"]];
if (stash)
[warnings addObject:[NSString stringWithFormat:UCLocalize("FILES_INSTALLED_TO"), @"/var/stash"]];
+ if (dbstash)
+ [warnings addObject:[NSString stringWithFormat:UCLocalize("FILES_INSTALLED_TO"), @"/var/db/stash"]];
if (dsstore)
[warnings addObject:[NSString stringWithFormat:UCLocalize("FILES_INSTALLED_TO"), @".DS_Store"]];
}
return [warnings count] == 0 ? nil : warnings;
-}
+} }
- (NSArray *) applications {
NSString *me([[NSBundle mainBundle] bundleIdentifier]);
return [CydiaWebViewController requestWithHeaders:[super webView:view resource:resource willSendRequest:request redirectResponse:response fromDataSource:source]];
}
+- (NSURLRequest *) webThreadWebView:(WebView *)view resource:(id)resource willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)response fromDataSource:(WebDataSource *)source {
+ return [CydiaWebViewController requestWithHeaders:[super webThreadWebView:view resource:resource willSendRequest:request redirectResponse:response fromDataSource:source]];
+}
+
+ (NSURLRequest *) requestWithHeaders:(NSURLRequest *)request {
NSMutableURLRequest *copy([[request mutableCopy] autorelease]);
issues_ = [NSMutableArray arrayWithCapacity:4];
+ UpgradeCydia_ = false;
+
for (Package *package in packages) {
pkgCache::PkgIterator iterator([package iterator]);
NSString *name([package id]);
[removes addObject:name];
}
+ if ([name isEqualToString:@"cydia"])
+ UpgradeCydia_ = true;
+
substrate_ |= DepSubstrate(policy->GetCandidateVer(iterator));
substrate_ |= DepSubstrate(iterator.CurrentVer());
}
if ([context isEqualToString:@"modify"]) {
if (button != [sheet cancelButtonIndex]) {
- [self performSelector:@selector(_clickButtonWithName:) withObject:buttons_[button].first afterDelay:0];
+ if (IsWildcat_)
+ [self performSelector:@selector(_clickButtonWithName:) withObject:buttons_[button].first afterDelay:0];
+ else
+ [self _clickButtonWithName:buttons_[button].first];
}
- [sheet dismissWithClickedButtonIndex:-1 animated:YES];
+ [sheet dismissWithClickedButtonIndex:button animated:YES];
}
}
// on the iPad, this view controller is ALSO visible. :(
if (IsWildcat_)
- if (UIViewController *top = [self topViewController])
- if (top != visible)
- [top reloadData];
+ if (UIViewController *modal = [self modalViewController])
+ if ([modal modalPresentationStyle] == UIModalPresentationFormSheet)
+ if (UIViewController *top = [self topViewController])
+ if (top != visible)
+ [top reloadData];
}
- (void) unloadData {
case 1: {
NSString *href = [[alert textField] text];
- static Pcre href_r("^http(s?)://[^# ]*$");
+ static Pcre href_r("^(http(s?)://|file:///)[^# ]*$");
if (!href_r(href)) {
UIAlertView *alert = [[[UIAlertView alloc]
initWithTitle:[NSString stringWithFormat:Colon_, Error_, UCLocalize("INVALID_URL")]
- (void) presentModalViewController:(UIViewController *)controller force:(BOOL)force {
UINavigationController *navigation([[[UINavigationController alloc] initWithRootViewController:controller] autorelease]);
- if (IsWildcat_)
- [navigation setModalPresentationStyle:UIModalPresentationFormSheet];
UIViewController *parent;
if (emulated_ == nil)
parent = tabbar_;
}
+ if (IsWildcat_)
+ [navigation setModalPresentationStyle:UIModalPresentationFormSheet];
[parent presentModalViewController:navigation animated:YES];
}
- (void) _uicache {
_trace();
- system("/usr/bin/uicache");
+
+ if (UpgradeCydia_ && Finish_ > 0) {
+ setreugid(0, 0);
+ system("su -c /usr/bin/uicache mobile");
+ } else {
+ system("/usr/bin/uicache");
+ }
+
_trace();
}
}
- (void) applicationDidEnterBackground:(UIApplication *)application {
+ if (kCFCoreFoundationVersionNumber < 1000 && [self isSafeToSuspend])
+ return [self terminateWithSuccess];
[self saveState];
}
NSTimeInterval interval([closed timeIntervalSinceNow]);
- if (interval <= -(30)) {
+ if (interval <= -(30*60)) {
[tabbar_ setSelectedIndex:0];
[[[tabbar_ viewControllers] objectAtIndex:0] popToRootViewControllerAnimated:NO];
}
- if (interval <= -(15)) {
+ if (interval <= -(15*60)) {
if (IsReachable("cydia.saurik.com")) {
[tabbar_ beginUpdate];
[appcache_ reloadURLWithCache:YES];
Stash_("/Library/Wallpaper");
//Stash_("/usr/bin");
Stash_("/usr/include");
- Stash_("/usr/lib/pam");
Stash_("/usr/share");
//Stash_("/var/lib");
_root(CydiaWriteSources());
_trace();
- _root(MetaFile_.Open("/var/lib/cydia/metadata.cb0"));
+ mkdir("/var/mobile/Library/Cydia", 0755);
+ MetaFile_.Open("/var/mobile/Library/Cydia/metadata.cb0");
_trace();
if (Packages_ != nil) {
/*if (substrate && access("/Library/MobileSubstrate/MobileSubstrate.dylib", F_OK) == 0)
dlopen("/Library/MobileSubstrate/MobileSubstrate.dylib", RTLD_LAZY | RTLD_GLOBAL);*/
+ if (kCFCoreFoundationVersionNumber > 1000)
+ _root(system([[NSString stringWithFormat:@"/usr/libexec/cydia/setnsfpn /var/lib"] UTF8String]));
+
int version([[NSString stringWithContentsOfFile:@"/var/lib/cydia/firmware.ver"] intValue]);
if (access("/User", F_OK) != 0 || version != 6) {