summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cydia.app/commercial.pngbin0 -> 2379 bytes
-rw-r--r--Cydia.app/console.pngbin0 -> 1225 bytes
-rw-r--r--Cydia.app/expanded.pngbin0 -> 6180 bytes
-rw-r--r--Cydia.app/filesystem.pngbin0 -> 7852 bytes
-rw-r--r--Cydia.app/package.html105
-rw-r--r--Cydia.app/package.js44
-rw-r--r--Cydia.app/settings.pngbin0 -> 2259 bytes
-rw-r--r--Cydia.app/signature.html15
-rw-r--r--Cydia.app/web.pngbin0 -> 8234 bytes
-rw-r--r--Cydia.mm186
10 files changed, 301 insertions, 49 deletions
diff --git a/Cydia.app/commercial.png b/Cydia.app/commercial.png
new file mode 100644
index 0000000..9c411cc
--- /dev/null
+++ b/Cydia.app/commercial.png
Binary files differ
diff --git a/Cydia.app/console.png b/Cydia.app/console.png
new file mode 100644
index 0000000..08d1869
--- /dev/null
+++ b/Cydia.app/console.png
Binary files differ
diff --git a/Cydia.app/expanded.png b/Cydia.app/expanded.png
new file mode 100644
index 0000000..9efce56
--- /dev/null
+++ b/Cydia.app/expanded.png
Binary files differ
diff --git a/Cydia.app/filesystem.png b/Cydia.app/filesystem.png
new file mode 100644
index 0000000..1bb23fe
--- /dev/null
+++ b/Cydia.app/filesystem.png
Binary files differ
diff --git a/Cydia.app/package.html b/Cydia.app/package.html
index fbeb037..ee8597d 100644
--- a/Cydia.app/package.html
+++ b/Cydia.app/package.html
@@ -71,26 +71,98 @@
#warnings > div > label {
color: red;
}
+
+ #boundry {
+ float: left;
+ width: 60px;
+ }
+
+ #icon {
+ height: 59px;
+ max-width: 60px;
+ width: auto;
+ }
+
+ #reflection {
+ height: 59px;
+ max-width: 60px;
+ opacity: 0.4;
+ position: absolute;
+ -webkit-transform: matrix(1, 0, 0, -1, 0, 0);
+ width: auto;
+ }
+
+ #id {
+ white-space: nowrap;
+ }
+
+ #header {
+ background: transparent;
+ border: none;
+ }
+
+ #header > div {
+ padding: 0;
+ margin-left: 2px;
+ }
+
+ #content {
+ float: right;
+ margin: auto 0;
+ }
+
+ #content > div {
+ margin: 8px;
+ }
+
+ #name {
+ font-weight: bold;
+ }
+
+ #latest {
+ color: #335588;
+ }
</style>
</head><body><div class="page">
<div class="dialog">
<div class="panel">
-<fieldset>
- <div>
- <img id="icon" class="icon"/>
- <label id="name"></label>
- <div id="latest"></div>
+<fieldset id="header">
+ <div class="clearfix">
+ <div id="boundry">
+ <img id="icon"/>
+ <!--img id="reflection"/-->
+ </div>
+
+ <div id="content">
+ <div id="name"></div>
+ <div id="latest"></div>
+ </div>
</div>
</fieldset>
<fieldset id="actions">
+ <a id="settings">
+ <img class="icon" src="settings.png"/>
+ <label>Change Package Settings</label>
+ </a>
+
<a id="author-href" class="author">
<img id="author-icon" class="icon" src="email.png"/>
<label>Author</label>
<div id="author"></div>
</a>
+ <div class="commercial">
+ <img class="icon" src="commercial.png"/>
+ <label>This is a commercial package!</label>
+ </div>
+
+ <a class="console" href="console.html">
+ <img class="icon" src="console.png"/>
+ <label>This is a console application!</label>
+ </a>
+
<a id="application">
<img class="icon"/>
<label class="application"></label>
@@ -119,14 +191,14 @@
<hr id="upper-bar" class="depiction"/-->
-<div id="depiction" class="depiction"><!--iframe
+<div id="depiction" class="depiction"><iframe
id="depiction-src"
frameborder="0"
width="320"
height="0"
target="_top"
onLoad="loaded()"
-></iframe--></div>
+></iframe></div>
<!--hr id="lower-bar" class="depiction"/-->
@@ -145,7 +217,10 @@
<div id="installed"></div>
</div>
- <a id="files-href"><label>Filesystem Content</label></a>
+ <a id="files-href">
+ <img class="icon" src="filesystem.png"/>
+ <label>Filesystem Content</label>
+ </a>
</fieldset>
<label>Package Details</label>
@@ -161,6 +236,7 @@
</div>
<div class="size">
+ <img class="icon" src="expanded.png"/>
<label>Expanded Size</label>
<div id="size"></div>
</div>
@@ -172,14 +248,21 @@
</a>
<a id="sponsor-href" class="sponsor">
+ <img class="icon" src="web.png"/>
<label>Sponsor</label>
<div id="sponsor"></div>
</a>
- <a class="trusted" id="trusted">
+ <!--a class="trusted" id="trusted">
<img class="icon" src="trusted.png">
- <label>View Package Signature</label>
- </a>
+ <label>View Repository Signature</label>
+ </a-->
+
+ <div class="trusted">
+ <img class="icon" src="trusted.png">
+ <label></label>
+ <div>This package has been signed.</div>
+ </div>
</fieldset>
<label class="source">Source Information</label>
diff --git a/Cydia.app/package.js b/Cydia.app/package.js
index c44e7dd..e409aa9 100644
--- a/Cydia.app/package.js
+++ b/Cydia.app/package.js
@@ -30,9 +30,13 @@ $(function () {
var regarding = encodeURIComponent("Cydia/APT: " + name);
$("#icon").src("cydia://package-icon/" + idc);
+ $("#reflection").src("cydia://package-icon/" + idc);
+
$("#name").html(name);
$("#latest").html(package.latest);
+ $("#settings").href("cydia://package-settings/" + idc);
+
var warnings = package.warnings;
var length = warnings == null ? 0 : warnings.length;
if (length == 0)
@@ -51,12 +55,12 @@ $(function () {
var applications = package.applications;
var length = applications == null ? 0 : applications.length;
- if (length == 0)
- $(".applications").remove();
- else {
+
+ var child = $("#application");
+ child.remove();
+
+ /*if (length != 0) {
var parent = $("#actions");
- var child = $("#application");
- child.remove();
for (var i = 0; i != length; ++i) {
var application = applications[i];
@@ -65,9 +69,24 @@ $(function () {
clone.href("cydia://launch/" + application[0]);
clone.xpath("label").html("Run " + $.xml(application[1]));
clone.xpath("img").src(application[2]);
- console.log(0);
}
- }
+ }*/
+
+ var purposes = package.purposes;
+ var commercial = false;
+ var _console = false;
+ if (purposes != null)
+ for (var i = 0, e = purposes.length; i != e; ++i) {
+ var purpose = purposes[i];
+ if (purpose == "commercial")
+ commercial = true;
+ else if (purpose == "console")
+ _console = true;
+ }
+ if (!commercial)
+ $(".commercial").remove();
+ if (!_console)
+ $(".console").remove();
var author = package.author;
if (author == null)
@@ -111,7 +130,14 @@ $(function () {
$("#files-href").href("cydia://files/" + idc);
}
- $("#id").html(id);
+ var nid = $("#id");
+ nid.html(id);
+ var width = nid.width();
+
+ if (width > 240) {
+ var spacing = (240.0 - nid.width()) / (id.length - 1) + "px";
+ nid.css("letter-spacing", spacing);
+ }
var section = package.section;
if (section == null)
@@ -152,7 +178,7 @@ $(function () {
$("#source-name").html(source.name);
if (source.trusted)
- /*$("#trusted").href("cydia:///" + idc)*/;
+ $("#trusted").href("cydia://package-signature/" + idc);
else
$(".trusted").remove();
diff --git a/Cydia.app/settings.png b/Cydia.app/settings.png
new file mode 100644
index 0000000..56a5bd7
--- /dev/null
+++ b/Cydia.app/settings.png
Binary files differ
diff --git a/Cydia.app/signature.html b/Cydia.app/signature.html
new file mode 100644
index 0000000..0e3a811
--- /dev/null
+++ b/Cydia.app/signature.html
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-16"?>
+<html><head>
+ <title>Signature</title>
+ <meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0"/>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
+ <link rel="stylesheet" type="text/css" href="menes/style.css"/>
+ <script type="text/javascript" src="menes/menes.js"></script>
+ <script type="text/javascript" src="signature.js"></script>
+</head><body><div class="page">
+<div class="dialog">
+ <div class="panel">
+
+ </div>
+</div>
+</div></body></html>
diff --git a/Cydia.app/web.png b/Cydia.app/web.png
new file mode 100644
index 0000000..a4f04e3
--- /dev/null
+++ b/Cydia.app/web.png
Binary files differ
diff --git a/Cydia.mm b/Cydia.mm
index aa809a7..52b7fc9 100644
--- a/Cydia.mm
+++ b/Cydia.mm
@@ -758,6 +758,8 @@ class Progress :
FILE *input_;
}
++ (Database *) sharedInstance;
+
- (void) _readCydia:(NSNumber *)fd;
- (void) _readStatus:(NSNumber *)fd;
- (void) _readOutput:(NSNumber *)fd;
@@ -766,7 +768,6 @@ class Progress :
- (Package *) packageWithName:(NSString *)name;
-- (Database *) init;
- (pkgCacheFile &) cache;
- (pkgDepCache::Policy *) policy;
- (pkgRecords *) records;
@@ -1105,7 +1106,7 @@ NSString *Scour(const char *field, const char *begin, const char *end) {
- (NSString *) id;
- (NSString *) name;
- (NSString *) tagline;
-- (NSString *) icon;
+- (UIImage *) icon;
- (NSString *) homepage;
- (NSString *) depiction;
- (Address *) author;
@@ -1123,6 +1124,7 @@ NSString *Scour(const char *field, const char *begin, const char *end) {
- (bool) hasSupportingRole;
- (BOOL) hasTag:(NSString *)tag;
- (NSString *) primaryPurpose;
+- (NSArray *) purposes;
- (NSComparisonResult) compareByName:(Package *)package;
- (NSComparisonResult) compareBySection:(Package *)package;
@@ -1175,7 +1177,7 @@ NSString *Scour(const char *field, const char *begin, const char *end) {
}
+ (NSArray *) _attributeKeys {
- return [NSArray arrayWithObjects:@"applications", @"author", @"depiction", @"description", @"essential", @"homepage", @"icon", @"id", @"installed", @"latest", @"maintainer", @"name", @"section", @"size", @"source", @"sponsor", @"tagline", @"warnings", nil];
+ return [NSArray arrayWithObjects:@"applications", @"author", @"depiction", @"description", @"essential", @"homepage", @"icon", @"id", @"installed", @"latest", @"maintainer", @"name", @"purposes", @"section", @"size", @"source", @"sponsor", @"tagline", @"warnings", nil];
}
- (NSArray *) attributeKeys {
@@ -1433,8 +1435,21 @@ NSString *Scour(const char *field, const char *begin, const char *end) {
return tagline_;
}
-- (NSString *) icon {
- return icon_;
+- (UIImage *) icon {
+ NSString *section = [self section];
+ if (section != nil)
+ section = Simplify(section);
+
+ UIImage *icon(nil);
+ if (NSString *icon = icon_)
+ icon = [UIImage imageAtPath:[icon_ substringFromIndex:6]];
+ if (icon == nil) if (section != nil)
+ icon = [UIImage imageAtPath:[NSString stringWithFormat:@"%@/Sections/%@.png", App_, section]];
+ if (icon == nil) if (source_ != nil) if (NSString *icon = [source_ defaultIcon])
+ icon = [UIImage imageAtPath:[icon substringFromIndex:6]];
+ if (icon == nil)
+ icon = [UIImage applicationImageNamed:@"unknown.png"];
+ return icon;
}
- (NSString *) homepage {
@@ -1605,6 +1620,14 @@ NSString *Scour(const char *field, const char *begin, const char *end) {
return nil;
}
+- (NSArray *) purposes {
+ NSMutableArray *purposes([NSMutableArray arrayWithCapacity:2]);
+ for (NSString *tag in tags_)
+ if ([tag hasPrefix:@"purpose::"])
+ [purposes addObject:[tag substringFromIndex:9]];
+ return [purposes count] == 0 ? nil : purposes;
+}
+
- (NSComparisonResult) compareByName:(Package *)package {
NSString *lhs = [self name];
NSString *rhs = [package name];
@@ -1805,6 +1828,13 @@ static NSArray *Finishes_;
/* Database Implementation {{{ */
@implementation Database
++ (Database *) sharedInstance {
+ static Database *instance;
+ if (instance == nil)
+ instance = [[Database alloc] init];
+ return instance;
+}
+
- (void) dealloc {
_assert(false);
[super dealloc];
@@ -2352,8 +2382,6 @@ static NSArray *Finishes_;
[super dealloc];
}
-#include "internals.h"
-
- (void) mailComposeControllerWillAttemptToSend:(MailComposeController *)controller {
NSLog(@"will");
}
@@ -2425,6 +2453,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
@end
@interface ConfirmationView : BrowserView {
+ _transient Database *database_;
UIActionSheet *essential_;
NSArray *changes_;
NSArray *issues_;
@@ -2483,7 +2512,9 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
}
- (id) initWithBook:(RVBook *)book database:(Database *)database {
- if ((self = [super initWithBook:book database:database]) != nil) {
+ if ((self = [super initWithBook:book]) != nil) {
+ database_ = database;
+
NSMutableArray *installing = [NSMutableArray arrayWithCapacity:16];
NSMutableArray *reinstalling = [NSMutableArray arrayWithCapacity:16];
NSMutableArray *upgrading = [NSMutableArray arrayWithCapacity:16];
@@ -3196,17 +3227,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
if (section != nil)
section = Simplify(section);
- icon_ = nil;
- if (NSString *icon = [package icon])
- icon_ = [UIImage imageAtPath:[icon substringFromIndex:6]];
- if (icon_ == nil) if (section != nil)
- icon_ = [UIImage imageAtPath:[NSString stringWithFormat:@"%@/Sections/%@.png", App_, section]];
- if (icon_ == nil) if (NSString *icon = [source defaultIcon])
- icon_ = [UIImage imageAtPath:[icon substringFromIndex:6]];
- if (icon_ == nil)
- icon_ = [UIImage applicationImageNamed:@"unknown.png"];
-
- icon_ = [icon_ retain];
+ icon_ = [[package icon] retain];
name_ = [[package name] retain];
description_ = [[package tagline] retain];
@@ -3549,6 +3570,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
/* }}} */
/* Package View {{{ */
@interface PackageView : BrowserView {
+ _transient Database *database_;
Package *package_;
NSString *name_;
NSMutableArray *buttons_;
@@ -3639,7 +3661,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
}
- (id) initWithBook:(RVBook *)book database:(Database *)database {
- if ((self = [super initWithBook:book database:database]) != nil) {
+ if ((self = [super initWithBook:book]) != nil) {
database_ = database;
buttons_ = [[NSMutableArray alloc] initWithCapacity:4];
} return self;
@@ -4616,9 +4638,11 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
if ([href hasPrefix:@"apptapp://package/"])
page = [delegate_ pageForPackage:[href substringFromIndex:18]];
- else if ([scheme isEqualToString:@"cydia"])
+ else if ([scheme isEqualToString:@"cydia"]) {
page = [delegate_ pageForURL:url hasTag:NULL];
- else if (![scheme isEqualToString:@"apptapp"])
+ if (page == nil)
+ return false;
+ } else if (![scheme isEqualToString:@"apptapp"])
return false;
if (page != nil)
@@ -4720,7 +4744,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
- (WebView *) _createWebViewWithRequest:(NSURLRequest *)request pushed:(BOOL)pushed {
[self setBackButtonTitle:title_];
- BrowserView *browser = [[[BrowserView alloc] initWithBook:book_ database:database_] autorelease];
+ BrowserView *browser = [[[BrowserView alloc] initWithBook:book_] autorelease];
[browser setDelegate:delegate_];
if (pushed) {
@@ -4825,9 +4849,8 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
#endif
}
-- (id) initWithBook:(RVBook *)book database:(Database *)database {
+- (id) initWithBook:(RVBook *)book {
if ((self = [super initWithBook:book]) != nil) {
- database_ = database;
loading_ = false;
struct CGRect bounds = [self bounds];
@@ -4905,7 +4928,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
indicator_ = [[UIProgressIndicator alloc] initWithFrame:CGRectMake(281, 12, indsize.width, indsize.height)];
[indicator_ setStyle:UIProgressIndicatorStyleMediumWhite];
- Package *package([database_ packageWithName:@"cydia"]);
+ Package *package([[Database sharedInstance] packageWithName:@"cydia"]);
NSString *application = package == nil ? @"Cydia" : [NSString
stringWithFormat:@"Cydia/%@",
[package installed]
@@ -5899,6 +5922,108 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
@end
+@interface CydiaURLProtocol : NSURLProtocol {
+}
+
+@end
+
+@implementation CydiaURLProtocol
+
++ (BOOL) canInitWithRequest:(NSURLRequest *)request {
+ NSURL *url([request URL]);
+ if (url == nil)
+ return NO;
+ NSString *scheme([[url scheme] lowercaseString]);
+ if (scheme == nil || ![scheme isEqualToString:@"cydia"])
+ return NO;
+ return YES;
+}
+
++ (NSURLRequest *) canonicalRequestForRequest:(NSURLRequest *)request {
+ return request;
+}
+
+- (void) startLoading {
+ id<NSURLProtocolClient> client([self client]);
+ NSURLRequest *request([self request]);
+
+ NSURL *url([request URL]);
+ NSString *href([url absoluteString]);
+
+ NSString *path([href substringFromIndex:8]);
+ NSRange slash([path rangeOfString:@"/"]);
+
+ NSString *command;
+ if (slash.location == NSNotFound) {
+ command = path;
+ path = nil;
+ } else {
+ command = [path substringToIndex:slash.location];
+ path = [path substringFromIndex:(slash.location + 1)];
+ }
+
+ Database *database([Database sharedInstance]);
+
+ if ([command isEqualToString:@"package-icon"]) {
+ if (path == nil)
+ goto fail;
+ Package *package([database packageWithName:path]);
+ if (package == nil)
+ goto fail;
+
+ NSURLResponse *response([[[NSURLResponse alloc] initWithURL:[request URL] MIMEType:@"image/png" expectedContentLength:-1 textEncodingName:nil] autorelease]);
+
+ UIImage *icon([package icon]);
+ NSData *data(UIImagePNGRepresentation(icon));
+
+ [client URLProtocol:self didReceiveResponse:response cacheStoragePolicy:NSURLCacheStorageNotAllowed];
+ [client URLProtocol:self didLoadData:data];
+ [client URLProtocolDidFinishLoading:self];
+ } else fail: {
+ [client URLProtocol:self didFailWithError:[NSError errorWithDomain:NSURLErrorDomain code:NSURLErrorResourceUnavailable userInfo:nil]];
+ }
+}
+
+- (void) stopLoading {
+}
+
+@end
+
+@interface SignatureView : BrowserView {
+ _transient Database *database_;
+ NSString *package_;
+}
+
+- (id) initWithBook:(RVBook *)book database:(Database *)database package:(NSString *)package;
+
+@end
+
+@implementation SignatureView
+
+- (void) dealloc {
+ [package_ release];
+ [super dealloc];
+}
+
+- (void) webView:(WebView *)sender didClearWindowObject:(WebScriptObject *)window forFrame:(WebFrame *)frame {
+ // XXX: dude!
+ [super webView:sender didClearWindowObject:window forFrame:frame];
+}
+
+- (id) initWithBook:(RVBook *)book database:(Database *)database package:(NSString *)package {
+ if ((self = [super initWithBook:book]) != nil) {
+ database_ = database;
+ package_ = [package retain];
+ [self reloadData];
+ } return self;
+}
+
+- (void) reloadData {
+ [self loadURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"signature" ofType:@"html"]]];
+}
+
+@end
+
@interface Cydia : UIApplication <
ConfirmationViewDelegate,
ProgressViewDelegate,
@@ -6186,7 +6311,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
}
- (RVPage *) _pageForURL:(NSURL *)url withClass:(Class)_class {
- BrowserView *browser = [[[_class alloc] initWithBook:book_ database:database_] autorelease];
+ BrowserView *browser = [[[_class alloc] initWithBook:book_] autorelease];
[browser loadURL:url];
return browser;
}
@@ -6531,6 +6656,8 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
return [self _pageForURL:[NSURL URLWithString:[href substringFromIndex:12]] withClass:[BrowserView class]];
else if ([href hasPrefix:@"cydia://launch/"])
[self launchApplicationWithIdentifier:[href substringFromIndex:15] suspended:NO];
+ else if ([href hasPrefix:@"cydia://package-signature/"])
+ return [[[SignatureView alloc] initWithBook:book_ database:database_ package:[href substringFromIndex:26]] autorelease];
else if ([href hasPrefix:@"cydia://package/"])
return [self pageForPackage:[href substringFromIndex:16]];
else if ([href hasPrefix:@"cydia://files/"]) {
@@ -6571,6 +6698,8 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
essential_ = [[NSMutableArray alloc] initWithCapacity:4];
broken_ = [[NSMutableArray alloc] initWithCapacity:4];
+ [NSURLProtocol registerClass:[CydiaURLProtocol class]];
+
CGRect screenrect = [UIHardware fullScreenApplicationContentRect];
window_ = [[UIWindow alloc] initWithContentRect:screenrect];
@@ -6578,7 +6707,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
[window_ makeKey:self];
[window_ setHidden:NO];
- database_ = [[Database alloc] init];
+ database_ = [Database sharedInstance];
progress_ = [[ProgressView alloc] initWithFrame:[window_ bounds] database:database_ delegate:self];
[database_ setDelegate:progress_];
[window_ setContentView:progress_];
@@ -6621,7 +6750,6 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
}
+ (BOOL) isSelectorExcludedFromWebScript:(SEL)selector {
- NSLog(@"exc:%s", sel_getName(selector));
return selector != @selector(supports:);
}