NSString *name_;
NSString *tagline_;
NSString *icon_;
- NSString *homepage_;
NSString *depiction_;
+ NSString *homepage_;
Address *sponsor_;
Address *author_;
NSArray *tags_;
[tagline_ release];
if (icon_ != nil)
[icon_ release];
- if (homepage_ != nil)
- [homepage_ release];
if (depiction_ != nil)
[depiction_ release];
+ if (homepage_ != nil)
+ [homepage_ release];
if (sponsor_ != nil)
[sponsor_ release];
if (author_ != nil)
icon_ = Scour("Icon", begin, end);
if (icon_ != nil)
icon_ = [icon_ retain];
+ depiction_ = Scour("Depiction", begin, end);
+ if (depiction_ != nil)
+ depiction_ = [depiction_ retain];
homepage_ = Scour("Homepage", begin, end);
if (homepage_ == nil)
homepage_ = Scour("Website", begin, end);
+ if ([homepage_ isEqualToString:depiction_])
+ homepage_ = nil;
if (homepage_ != nil)
homepage_ = [homepage_ retain];
- depiction_ = Scour("Depiction", begin, end);
- if (depiction_ != nil)
- depiction_ = [depiction_ retain];
NSString *sponsor = Scour("Sponsor", begin, end);
if (sponsor != nil)
sponsor_ = [[Address addressWithString:sponsor] retain];
[text setTextColor:[UIColor colorWithCGColor:blue]];
}
+bool DepSubstrate(const pkgCache::VerIterator &iterator) {
+ if (!iterator.end())
+ for (pkgCache::DepIterator dep(iterator.DependsList()); !dep.end(); ++dep) {
+ if (dep->Type != pkgCache::Dep::Depends && dep->Type != pkgCache::Dep::PreDepends)
+ continue;
+ pkgCache::PkgIterator package(dep.TargetPkg());
+ if (package.end())
+ continue;
+ if (strcmp(package.Name(), "mobilesubstrate") == 0)
+ return true;
+ }
+
+ return false;
+}
+
@protocol ConfirmationViewDelegate
- (void) cancel;
- (void) confirm;
UIPreferencesTable *table_;
NSMutableDictionary *fields_;
UIActionSheet *essential_;
+ BOOL substrate_;
}
- (void) cancel;
case 0:
if (essential_ != nil)
[essential_ popupAlertAnimated:YES];
- else
+ else {
+ if (substrate_)
+ Finish_ = 2;
[delegate_ confirm];
+ }
break;
case 1:
[self cancel];
break;
case 2:
+ if (substrate_)
+ Finish_ = 2;
[delegate_ confirm];
break;
default:
bool remove(false);
+ pkgDepCache::Policy *policy([database_ policy]);
+
pkgCacheFile &cache([database_ cache]);
NSArray *packages = [database_ packages];
for (size_t i(0), e = [packages count]; i != e; ++i) {
if ([package essential])
remove = true;
[removing addObject:name];
- }
+ } else continue;
+
+ substrate_ |= DepSubstrate(policy->GetCandidateVer(iterator));
+ substrate_ |= DepSubstrate(iterator.CurrentVer());
}
if (!remove)
switch (Finish_) {
case 0:
[delegate_ progressViewIsComplete:self];
- [self resetView];
+ [self resetView];
break;
case 1:
break;
case 2:
- system("killall SpringBoard");
+ system("launchctl stop com.apple.SpringBoard");
break;
case 3:
[book_ pushPage:page];
}
-- (void) getSpecial:(NSString *)href {
+- (RVPage *) _pageForPackage:(NSString *)name {
+ if (Package *package = [database_ packageWithName:name]) {
+ PackageView *view = [[[PackageView alloc] initWithBook:book_ database:database_] autorelease];
+ [view setPackage:package];
+ return view;
+ } else {
+ UIActionSheet *sheet = [[[UIActionSheet alloc]
+ initWithTitle:@"Cannot Locate Package"
+ buttons:[NSArray arrayWithObjects:@"Close", nil]
+ defaultButtonIndex:0
+ delegate:self
+ context:@"missing"
+ ] autorelease];
+
+ [sheet setBodyText:[NSString stringWithFormat:
+ @"The package %@ cannot be found in your current sources. I might recommend installing more sources."
+ , name]];
+
+ [sheet popupAlertAnimated:YES];
+ return nil;
+ }
+}
+
+- (BOOL) getSpecial:(NSString *)href {
RVPage *page = nil;
- if ([href hasPrefix:@"mailto:"])
+ if (
+ [href hasPrefix:@"http://phobos.apple.com/"] ||
+ [href hasPrefix:@"mailto:"]
+ )
[delegate_ openURL:[NSURL URLWithString:href]];
else if ([href isEqualToString:@"cydia://add-source"])
page = [[[AddSourceView alloc] initWithBook:book_ database:database_] autorelease];
[files setPackage:package];
page = files;
}
- } else if ([href hasPrefix:@"apptapp://package/"]) {
- NSString *name = [href substringFromIndex:18];
-
- if (Package *package = [database_ packageWithName:name]) {
- PackageView *view = [[[PackageView alloc] initWithBook:book_ database:database_] autorelease];
- [view setPackage:package];
- page = view;
- } else {
- UIActionSheet *sheet = [[[UIActionSheet alloc]
- initWithTitle:@"Cannot Locate Package"
- buttons:[NSArray arrayWithObjects:@"Close", nil]
- defaultButtonIndex:0
- delegate:self
- context:@"missing"
- ] autorelease];
-
- [sheet setBodyText:[NSString stringWithFormat:
- @"The package %@ cannot be found in your current sources. I might recommend installing more sources."
- , name]];
-
- [sheet popupAlertAnimated:YES];
- }
- }
+ } else if ([href hasPrefix:@"apptapp://package/"])
+ page = [self _pageForPackage:[href substringFromIndex:18]];
+ else if ([href hasPrefix:@"cydia://package/"])
+ page = [self _pageForPackage:[href substringFromIndex:16]];
+ else if (![href hasPrefix:@"apptapp:"] && ![href hasPrefix:@"cydia:"])
+ return false;
if (page != nil)
[self pushPage:page];
+ return true;
}
- (void) webView:(WebView *)sender willClickElement:(id)element {
[self getSpecial:href];
}
-- (BOOL) isSpecialScheme:(NSString *)scheme {
- return
- [scheme isEqualToString:@"apptapp"] ||
- [scheme isEqualToString:@"cydia"] ||
- [scheme isEqualToString:@"mailto"];
-}
-
- (NSURLRequest *) webView:(WebView *)sender resource:(id)identifier willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)redirectResponse fromDataSource:(WebDataSource *)dataSource {
NSURL *url = [request URL];
- if ([self isSpecialScheme:[url scheme]]) {
- [self getSpecial:[url absoluteString]];
+ NSLog(@"Cydia:%@", url);
+ if ([self getSpecial:[url absoluteString]])
return nil;
- }
if (!pushed_) {
pushed_ = true;
return [self _addHeadersToRequest:request];
}
+- (BOOL) isSpecialScheme:(NSString *)scheme {
+ return
+ [scheme isEqualToString:@"apptapp"] ||
+ [scheme isEqualToString:@"cydia"] ||
+ [scheme isEqualToString:@"mailto"];
+}
+
- (WebView *) webView:(WebView *)sender createWebViewWithRequest:(NSURLRequest *)request {
if (request != nil) {
- NSString *scheme = [[request URL] scheme];
- if ([self isSpecialScheme:scheme])
+ NSURL *url = [request URL];
+ NSString *scheme = [url scheme];
+ if ([self isSpecialScheme:scheme] || [[url absoluteString] hasPrefix:@"http://phobos.apple.com/"])
return nil;
}
NSString *href = [webview mainFrameURL];
[urls_ addObject:[NSURL URLWithString:href]];
+ [scroller_ scrollPointVisibleAtTopLeft:CGPointZero];
+
CGRect webrect = [scroller_ bounds];
webrect.size.height = 0;
[webview_ setFrame:webrect];