summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2011-02-07 17:01:00 -0800
committerJay Freeman (saurik) <saurik@saurik.com>2011-02-07 17:01:00 -0800
commitbea22a677eadd2f5c34fda37b5fa9656dd2dfa36 (patch)
tree2ba82530a521601fd491f6f7ec199b22f3e42ae0
parentecb4a6eeb6305276f0762e036a7eee1fa82c7eef (diff)
parent0923b87ee43c7afe083cb513c887b58515ff3413 (diff)
Merge branch 'restructure'
-rw-r--r--MobileCydia.app/Modes/DOWNGRADE.pngbin1176 -> 0 bytes
-rw-r--r--MobileCydia.app/Modes/INSTALL.pngbin2135 -> 0 bytes
l---------MobileCydia.app/Modes/NEW_INSTALL.png1
-rw-r--r--MobileCydia.app/Modes/PURGE.pngbin2443 -> 0 bytes
-rw-r--r--MobileCydia.app/Modes/REINSTALL.pngbin2013 -> 0 bytes
-rw-r--r--MobileCydia.app/Modes/REMOVE.pngbin2552 -> 0 bytes
-rw-r--r--MobileCydia.app/Modes/UPGRADE.pngbin1635 -> 0 bytes
-rw-r--r--MobileCydia.app/Sections.plist5
-rwxr-xr-xMobileCydia.app/Test9
-rw-r--r--MobileCydia.app/commercial.pngbin7550 -> 0 bytes
-rw-r--r--MobileCydia.app/console.pngbin2812 -> 0 bytes
-rw-r--r--MobileCydia.app/email.pngbin22892 -> 0 bytes
-rw-r--r--MobileCydia.app/expanded.pngbin6180 -> 0 bytes
-rw-r--r--MobileCydia.app/filesystem.pngbin7852 -> 0 bytes
-rw-r--r--MobileCydia.app/id.pngbin3706 -> 0 bytes
-rw-r--r--MobileCydia.app/loading.html15
-rw-r--r--MobileCydia.app/manage.html100
-rw-r--r--MobileCydia.app/menes/indicator-c7ced5-4d4d70.gifbin1849 -> 0 bytes
-rw-r--r--MobileCydia.app/package.html384
-rw-r--r--MobileCydia.app/package.js288
-rw-r--r--MobileCydia.app/packages.pngbin8884 -> 0 bytes
-rw-r--r--MobileCydia.app/settings.pngbin5848 -> 0 bytes
-rw-r--r--MobileCydia.app/signature.html16
-rw-r--r--MobileCydia.app/sources.pngbin22251 -> 0 bytes
-rw-r--r--MobileCydia.app/star.pngbin1757 -> 0 bytes
-rw-r--r--MobileCydia.app/storage.html237
-rw-r--r--MobileCydia.app/storage.js88
-rw-r--r--MobileCydia.app/storage.pngbin14343 -> 0 bytes
-rw-r--r--MobileCydia.app/trusted.pngbin22915 -> 0 bytes
-rw-r--r--MobileCydia.app/version.pngbin891 -> 0 bytes
-rw-r--r--MobileCydia.app/warning.pngbin5000 -> 0 bytes
-rw-r--r--MobileCydia.app/web.pngbin8234 -> 0 bytes
-rw-r--r--MobileCydia.mm2041
-rw-r--r--UICaboodle/BrowserView.h2
-rw-r--r--UICaboodle/BrowserView.mm6
-rw-r--r--UICaboodle/RVPage.mm12
-rw-r--r--iPhonePrivate.h8
37 files changed, 1052 insertions, 2160 deletions
diff --git a/MobileCydia.app/Modes/DOWNGRADE.png b/MobileCydia.app/Modes/DOWNGRADE.png
deleted file mode 100644
index 41c0d70..0000000
--- a/MobileCydia.app/Modes/DOWNGRADE.png
+++ /dev/null
Binary files differ
diff --git a/MobileCydia.app/Modes/INSTALL.png b/MobileCydia.app/Modes/INSTALL.png
deleted file mode 100644
index a83f354..0000000
--- a/MobileCydia.app/Modes/INSTALL.png
+++ /dev/null
Binary files differ
diff --git a/MobileCydia.app/Modes/NEW_INSTALL.png b/MobileCydia.app/Modes/NEW_INSTALL.png
deleted file mode 120000
index 475bda6..0000000
--- a/MobileCydia.app/Modes/NEW_INSTALL.png
+++ /dev/null
@@ -1 +0,0 @@
-INSTALL.png \ No newline at end of file
diff --git a/MobileCydia.app/Modes/PURGE.png b/MobileCydia.app/Modes/PURGE.png
deleted file mode 100644
index 795fa19..0000000
--- a/MobileCydia.app/Modes/PURGE.png
+++ /dev/null
Binary files differ
diff --git a/MobileCydia.app/Modes/REINSTALL.png b/MobileCydia.app/Modes/REINSTALL.png
deleted file mode 100644
index 0b7754c..0000000
--- a/MobileCydia.app/Modes/REINSTALL.png
+++ /dev/null
Binary files differ
diff --git a/MobileCydia.app/Modes/REMOVE.png b/MobileCydia.app/Modes/REMOVE.png
deleted file mode 100644
index 1b2e691..0000000
--- a/MobileCydia.app/Modes/REMOVE.png
+++ /dev/null
Binary files differ
diff --git a/MobileCydia.app/Modes/UPGRADE.png b/MobileCydia.app/Modes/UPGRADE.png
deleted file mode 100644
index 631b7ef..0000000
--- a/MobileCydia.app/Modes/UPGRADE.png
+++ /dev/null
Binary files differ
diff --git a/MobileCydia.app/Sections.plist b/MobileCydia.app/Sections.plist
index fb8f880..74a7864 100644
--- a/MobileCydia.app/Sections.plist
+++ b/MobileCydia.app/Sections.plist
@@ -40,7 +40,7 @@
<string>Themes (LockScreen)</string>
<key>Themes (Video)</key>
- <string>Themes (Videos)</string>
+ <string>Themes (Apps)</string>
<key>Utilites</key>
<string>Utilities</string>
@@ -146,6 +146,9 @@
<key>Cydgets (Lock)</key>
<string>Addons (Cydget)</string>
+
+ <key>Themes (App Addons)</key>
+ <string>Themes (Addons)</string>
</dict>
</plist>
diff --git a/MobileCydia.app/Test b/MobileCydia.app/Test
deleted file mode 100755
index 123c7eb..0000000
--- a/MobileCydia.app/Test
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/bash
-killall Cydia_
-set -e
-rsync -SPaz --copy-links saurik@carrier.saurik.com:menes/cydia/cydia_iphoneos-arm.deb .
-dpkg -i cydia_iphoneos-arm.deb
-touch /tmp/cydia.log
-chown mobile.mobile /tmp/cydia.log
-uiopen "${1-cydia://}"
-exec tail /var/log/syslog /tmp/cydia.log -fn0
diff --git a/MobileCydia.app/commercial.png b/MobileCydia.app/commercial.png
deleted file mode 100644
index 8599f48..0000000
--- a/MobileCydia.app/commercial.png
+++ /dev/null
Binary files differ
diff --git a/MobileCydia.app/console.png b/MobileCydia.app/console.png
deleted file mode 100644
index dba3788..0000000
--- a/MobileCydia.app/console.png
+++ /dev/null
Binary files differ
diff --git a/MobileCydia.app/email.png b/MobileCydia.app/email.png
deleted file mode 100644
index 1aa20b3..0000000
--- a/MobileCydia.app/email.png
+++ /dev/null
Binary files differ
diff --git a/MobileCydia.app/expanded.png b/MobileCydia.app/expanded.png
deleted file mode 100644
index 9efce56..0000000
--- a/MobileCydia.app/expanded.png
+++ /dev/null
Binary files differ
diff --git a/MobileCydia.app/filesystem.png b/MobileCydia.app/filesystem.png
deleted file mode 100644
index 1bb23fe..0000000
--- a/MobileCydia.app/filesystem.png
+++ /dev/null
Binary files differ
diff --git a/MobileCydia.app/id.png b/MobileCydia.app/id.png
deleted file mode 100644
index f168812..0000000
--- a/MobileCydia.app/id.png
+++ /dev/null
Binary files differ
diff --git a/MobileCydia.app/loading.html b/MobileCydia.app/loading.html
deleted file mode 100644
index 33b2637..0000000
--- a/MobileCydia.app/loading.html
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="UTF-16"?>
-<html><head>
- <title>Loading</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"/>
- <base target="_blank"/>
-</head><body>
- <div style="padding: 5px 7px">
- <span style="color: #4d4d70; font-weight: normal; font-size: 16px">
- <div style="display: inline-block; background-image: url(menes/indicator-c7ced5-4d4d70.gif); width: 16px; height: 16px; margin: 2px 0 -2px 0"></div>
- <span style="margin: 0 4px">Loading...</span>
- </span>
- </div>
-</body></html>
diff --git a/MobileCydia.app/manage.html b/MobileCydia.app/manage.html
deleted file mode 100644
index bba3762..0000000
--- a/MobileCydia.app/manage.html
+++ /dev/null
@@ -1,100 +0,0 @@
-<?xml version="1.0" encoding="UTF-16"?>
-<html><head>
- <title localize="MANAGE"></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"/>
- <script type="text/javascript" src="menes/menes.js"></script>
- <script type="text/javascript" src="localize.js"></script>
- <base target="_blank"/>
-
- <style>
- body {
- background: #c7ced5 url(cydia://uikit-image/UIPinstripe.png);
- background-size: 7px 1px;
- display: table;
- font-family: Helvetica;
- height: 337px;
- margin: 0;
- padding: 0;
- -webkit-text-size-adjust: none;
- -webkit-user-select: none;
- }
-
- div.page {
- display: table-cell;
- text-align: center;
- margin: 0 auto;
- vertical-align: middle;
- width: 320px;
- }
-
- a.giant-button {
- background-color: rgba(0, 0, 0, .15);
- -webkit-border-radius: 10px;
- color: #193250;
- display: block;
- margin: 10px;
- text-decoration: none;
- }
-
- a.giant-button > img {
- display: inline-block;
- float: left;
- height: 80px;
- margin: 10px -10px 0 10px;
- width: 80px;
- vertical-align: middle;
- }
-
- a.giant-button > div.contents {
- display: inline-block;
- width: 190px;
- margin: 5px 10px 17px 10px;
- }
-
- a.giant-button > div.contents > label {
- display: block;
- font-size: 28px;
- margin: 8px 0 8px 0;
- text-align: center;
- text-shadow: rgba(200, 200, 200, 0.75) 1px 1px 0;
- }
-
- a.giant-button > div.contents > div {
- display: block;
- font-size: 14px;
- margin-left: 4px;
- text-align: center;
- }
- </style>
-</head><body><div class="page">
-<div class="dialog">
- <div class="panel">
-
-<a href="cydia://packages" class="giant-button">
- <img src="packages.png"/>
- <div class="contents">
- <label localize="PACKAGES"></label>
- <div localize="PACKAGES_EX"></div>
- </div>
-</a>
-
-<a href="cydia://sources" class="giant-button">
- <img src="sources.png"/>
- <div class="contents">
- <label localize="SOURCES"></label>
- <div localize="SOURCES_EX"></div>
- </div>
-</a>
-
-<a href="cydia://storage" class="giant-button">
- <img src="storage.png"/>
- <div class="contents">
- <label localize="STORAGE"></label>
- <div localize="STORAGE_EX"></div>
- </div>
-</a>
-
- </div>
-</div>
-</div></body></html>
diff --git a/MobileCydia.app/menes/indicator-c7ced5-4d4d70.gif b/MobileCydia.app/menes/indicator-c7ced5-4d4d70.gif
deleted file mode 100644
index e41bb96..0000000
--- a/MobileCydia.app/menes/indicator-c7ced5-4d4d70.gif
+++ /dev/null
Binary files differ
diff --git a/MobileCydia.app/package.html b/MobileCydia.app/package.html
deleted file mode 100644
index c91b52c..0000000
--- a/MobileCydia.app/package.html
+++ /dev/null
@@ -1,384 +0,0 @@
-<?xml version="1.0" encoding="UTF-16"?>
-<html><head>
- <title localize="DETAILS"></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="package.js"></script>
- <script type="text/javascript" src="localize.js"></script>
- <base target="_blank"/>
-
- <!--script type="text/javascript">
- var count = -1;
- var loaded = function() {
- if (count++ != 0)
- return;
- $("#depiction-load").remove();
- $("#depiction-src").css("display", "block");
- }
-
- var remove = function() {
- $(".description").css("display", "block");
- $(".depiction").remove();
- }
- </script-->
-
- <style>
- .flip-180 {
- -webkit-backface-visibility: hidden;
- -webkit-transform: rotateY(180deg);
- }
-
- #icon.flip-180 {
- -webkit-transition-duration: 2s;
- -webkit-transition-property: transform;
- }
-
- .flip-360 {
- -webkit-backface-visibility: hidden;
- -webkit-transform: rotateY(360deg);
- -webkit-transition-duration: 2s;
- -webkit-transition-property: transform;
- }
-
- .fade-out {
- opacity: 0;
- -webkit-transition-property: opacity;
- -webkit-transition-duration: 2s;
- }
-
- .fade-in {
- opacity: 1;
- -webkit-transition-property: opacity;
- -webkit-transition-duration: 2s;
- }
-
- #remove {
- margin-top: 7px;
- text-align: center;
- }
-
- #indicator {
- left: 20px;
- position: relative;
- top: -5px;
- }
-
- #remove > a {
- color: #335588;
- text-decoration: none;
- }
-
- #upper-bar {
- margin-bottom: 0;
- margin-top: 10px;
- }
-
- #lower-bar {
- margin-bottom: 10px;
- margin-top: 0;
- }
-
- #warnings {
- background-color: #ffdddd;
- }
-
- #warnings > div > label {
- color: red;
- }
-
- #boundary {
- float: left;
- height: 64;
- width: 64px;
- }
-
- #thumb,
- #icon {
- background-position: center center;
- background-repeat: no-repeat;
- height: 64px;
- position: absolute;
- width: 64px;
- }
-
- #thumb {
- -webkit-border-radius: 9px;
- }
-
- /* XXX: this style is out of date */
- #reflection {
- height: 59px;
- max-width: 60px;
- opacity: 0.4;
- position: absolute;
- -webkit-transform: matrix(1, 0, 0, -1, 0, 0);
- width: auto;
- }
-
- #id, #author, #maintainer, #sponsor {
- white-space: nowrap;
- }
-
- #header {
- background: transparent;
- border: none;
- position: relative;
- }
-
- #header > div {
- padding: 0;
- }
-
- #content {
- padding: 5px;
- position: absolute;
- left: 77px;
- width: 232px;
- }
-
- #lower {
- margin: 0px 5px;
- }
-
- #name {
- margin-bottom: 13px;
- font-weight: bold;
- font-size: 17px;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
-
- #latest {
- color: #335588;
- float: left;
- }
-
- a[href].rating {
- background: 107px 7px no-repeat url(menes/chevron.png);
- }
-
- .rating {
- /*border: 1px solid #999999;*/
- -webkit-border-radius: 6px;
- padding: 7px 7px;
- margin: -7px 0px;
- float: right;
- width: 126px;
- }
-
- .rating .back,
- .rating .fore,
- .rating .star {
- background: url(star.png);
- }
-
- .rating .text {
- display: inline-block;
- color: #4d4d70;
- margin: 0 6px;
- vertical-align: top;
- }
-
- #rating-done {
- padding-left: 12px;
- }
-
- #rating-none,
- #rating-done {
- display: none;
- }
-
- #depiction-src,
- #notice-src {
- height: 1px;
- width: 320px;
- }
- </style>
-</head><body class="pinstripe">
-<panel>
-
-<fieldset id="header">
- <div>
- <div id="boundary">
- <div class="flip-0" id="icon"></div>
- <div class="flip-180" id="thumb"></div>
- <!--img id="reflection"/-->
- </div>
-
- <div id="content">
- <div id="name"></div>
- <div id="latest"></div>
-
- <a class="rating" id="rating-href">
- <div id="rating-none">
- <div class="star"></div><div class="text" localize="NOT_RATED"></div>
- </div><div id="rating-done">
- <div class="fore" id="rating-value"></div>
- <div class="back"></div>
- </div>
- </a>
- </div>
- </div>
-</fieldset>
-
-<fieldset class="mode">
- <a>
- <img class="icon" id="mode-src"/><div>
- <label localize="PACKAGE_QUEUE"></label>
- <label id="mode"></label>
- </div></a>
-</fieldset>
-
-<fieldset id="actions">
- <a id="settings">
- <img class="icon" src="settings.png"/><div>
- <label localize="CHANGE_PACKAGE_SETTINGS"></label>
- </div></a>
-
- <a id="author-href" class="author" target="_popup">
- <img id="author-icon" class="icon" src="email.png"/><div>
- <label localize="AUTHOR"></label>
- <label id="author"></label>
- </div></a>
-
- <!--div class="commercial">
- <img class="icon" src="commercial.png"/><div>
- <label>This is a commercial package!</label>
- </div></div-->
-
- <a class="console" href="http://cydia.saurik.com/purpose/console/">
- <img class="icon" src="console.png"/><div>
- <label localize="CONSOLE_PACKAGE"></label>
- </div></a>
-
- <a id="application">
- <img class="icon"/><div>
- <label class="application"></label>
- </div></a>
-</fieldset>
-
-<fieldset class="warnings" id="warnings">
- <div id="warning">
- <img class="icon" src="warning.png"/><div>
- <label class="warning"></label>
- </div></div>
-</fieldset>
-
-<iframe
- class="notice"
- id="notice-src"
- frameborder="0"
- width="320"
- height="0"
- target="_top"
-></iframe>
-
-<!--iframe
- class="activation"
- id="activation-src"
- frameborder="0"
- width="320"
- height="0"
- target="_top"
-></iframe-->
-
-<!--div id="remove" class="depiction">
- <a href="javascript:remove()">Remove Custom Depiction</a>
-</div>
-
-<hr id="upper-bar" class="depiction"/-->
-
-<iframe
- class="depiction"
- id="depiction-src"
- frameborder="0"
- width="320"
- height="0"
- target="_top"
- onload_="loaded()"
-></iframe>
-
-<!--hr id="lower-bar" class="depiction"/-->
-
-<block class="description"><p id="description"></p></block>
-
-<fieldset class="description homepage">
- <a class="homepage" id="homepage-href">
- <img class="icon" src="web.png"/><div>
- <label localize="MORE_INFORMATION"></label>
- </div></a>
-</fieldset>
-
-<label class="installed" localize="INSTALLED_DETAILS"></label>
-<fieldset class="installed">
- <div>
- <img class="icon" src="version.png"/><div>
- <label localize="VERSION"></label>
- <label id="installed"></label>
- </div></div>
-
- <a id="files-href">
- <img class="icon" src="filesystem.png"/><div>
- <label localize="FILESYSTEM_CONTENT"></label>
- </div></a>
-</fieldset>
-
-<label localize="PACKAGE_DETAILS"></label>
-<fieldset>
- <div>
- <img class="icon" src="id.png"/><div>
- <label localize="ID"></label>
- <label id="id"></label>
- </div></div>
-
- <div class="section">
- <img id="section-src" class="icon"/><div>
- <label localize="SECTION"></label>
- <label id="section"></label>
- </div></div>
-
- <div class="size">
- <img class="icon" src="expanded.png"/><div>
- <label localize="EXPANDED_SIZE"></label>
- <label id="size"></label>
- </div></div>
-
- <a id="maintainer-href" class="maintainer" target="_popup">
- <img id="maintainer-icon" class="icon" src="email.png"/><div>
- <label localize="MAINTAINER"></label>
- <label id="maintainer"></label>
- </div></a>
-
- <a id="sponsor-href" class="sponsor">
- <img class="icon" src="web.png"/><div>
- <label localize="SPONSOR"></label>
- <label id="sponsor"></label>
- </div></a>
-
- <!--a class="trusted" id="trusted">
- <img class="icon" src="trusted.png"><div>
- <label localize="REPOSITORY_SIGNATURE"></label>
- </div></a-->
-
- <div class="trusted">
- <img class="icon" src="trusted.png"><div>
- <label>&nbsp;</label>
- <label localize="SIGNED_PACKAGE"></label>
- </div></div>
-</fieldset>
-
-<label class="source" localize="SOURCE_DETAILS"></label>
-<fieldset class="source">
- <div>
- <img class="icon" id="source-src"/><div>
- <label id="source-name"></label>
- </div></div>
-
- <div class="source-description" id="source-description"></div>
-</fieldset>
-
-</panel>
-</body></html>
diff --git a/MobileCydia.app/package.js b/MobileCydia.app/package.js
deleted file mode 100644
index 07f9588..0000000
--- a/MobileCydia.app/package.js
+++ /dev/null
@@ -1,288 +0,0 @@
-/*var package = {
- "name": "MobileTerminal",
- "latest": "286u-5",
- "author": {
- "name": "Allen Porter",
- "address": "allen.porter@gmail.com"
- },
- //"depiction": "http://planet-iphones.com/repository/info/chromium1.3.php",
- "depiction": "http://cydia.saurik.com/terminal.html",
- "longDescription": "this is a sample description",
- "homepage": "http://cydia.saurik.com/terminal.html",
- "installed": "286u-4",
- "id": "mobileterminal",
- "section": "Terminal Support",
- "size": 552*1024,
- "maintainer": {
- "name": "Jay Freeman",
- "address": "saurik@saurik.com"
- },
- "source": {
- "name": "Telesphoreo Tangelo",
- "description": "Distribution of Unix Software for the iPhone"
- }
-};*/
-
-function space(selector, html, max) {
- var node = $(selector);
- node.html(html);
- var width = node.width();
- if (width > max) {
- var spacing = (max - node.width()) / (html.length - 1) + "px";
- node.css("letter-spacing", spacing);
- }
-}
-
-var swap_, swap = function (on, off, time) {
- setTimeout(swap_(on, off, time), time);
-};
-
-swap_ = function (on, off, time) {
- return function () {
- on.className = 'fade-out';
- off.className = 'fade-in';
- swap(off, on, time);
- };
-};
-
-$(function () {
- if (package == null)
- return;
-
- var id = package.id;
- var idc = encodeURIComponent(id);
- var name = package.name;
- var icon = 'cydia://package-icon/' + idc;
-
- var api = 'http://cydia.saurik.com/api/';
- var capi = 'http://cache.cydia.saurik.com/api/';
-
- var support = package.support;
-
- var regarding = function (type) {
- return encodeURIComponent("Cydia/APT(" + type + "): " + name);
- };
-
- $("#icon").css("background-image", 'url("' + icon + '")');
- //$("#reflection").src("cydia://package-icon/" + idc);
-
- $("#name").html($.xml(name));
- space("#latest", $.xml(package.latest), 96);
-
- $.xhr(capi + 'package/' + idc, 'GET', {}, null, {
- success: function (value) {
- value = eval(value);
-
- if (typeof value.notice == "undefined")
- $(".notice").addClass("deleted");
- else
- $("#notice-src").src(value.notice);
-
- if (typeof value.rating == "undefined")
- $(".rating").addClass("deleted");
- else {
- $("#rating-load").addClass("deleted");
- $("#rating-href").href(value.reviews);
-
- var none = $("#rating-none");
- var done = $("#rating-done");
-
- if (value.rating == null) {
- none.css("display", "block");
- } else {
- done.css("display", "block");
-
- $("#rating-value").css('width', 16 * value.rating);
- }
- }
-
- if (typeof value.icon != "undefined" && value.icon != null) {
- var icon = $("#icon");
- var thumb = $("#thumb");
-
- icon[0].className = 'flip-180';
- thumb[0].className = 'flip-360';
-
- thumb.css("background-image", 'url("' + value.icon + '")');
-
- setTimeout(function () {
- icon.addClass("deleted");
- thumb[0].className = 'flip-0';
- }, 2000);
- }
- },
-
- failure: function (status) {
- $(".rating").addClass("deleted");
- }
- });
-
- $("#settings").href("cydia://package-settings/" + idc);
-
- var mode = package.mode;
- if (mode == null)
- $(".mode").addClass("deleted");
- else {
- $("#mode").html(cydia.localize(mode));
- $("#mode-src").src("Modes/" + mode + ".png");
- }
-
- var warnings = package.warnings;
- var length = warnings == null ? 0 : warnings.length;
- if (length == 0)
- $(".warnings").addClass("deleted");
- else {
- var parent = $("#warnings");
- var child = $("#warning");
-
- for (var i = 0; i != length; ++i) {
- var clone = child.clone(true);
- clone.addClass("inserted");
- parent.append(clone);
- clone.xpath("./div/label").html($.xml(warnings[i]));
- }
-
- child.addClass("deleted");
- }
-
- var applications = package.applications;
- var length = applications == null ? 0 : applications.length;
-
- var child = $("#application");
-
- /*if (length != 0) {
- var parent = $("#actions");
-
- for (var i = 0; i != length; ++i) {
- var application = applications[i];
- var clone = child.clone(true);
- parent.append(clone);
- clone.href("cydia://launch/" + application[0]);
- clone.xpath("label").html("Run " + $.xml(application[1]));
- clone.xpath("img").src(application[2]);
- }
- }*/
-
- child.addClass("deleted");
-
- var commercial = package.hasTag('cydia::commercial');
- if (!commercial)
- $(".commercial").addClass("deleted");
-
- var _console = package.hasTag('purpose::console');
- if (!_console)
- $(".console").addClass("deleted");
-
- var author = package.author;
- if (author == null)
- $(".author").addClass("deleted");
- else {
- space("#author", $.xml(author.name), 160);
- if (author.address == null)
- $("#author-icon").addClass("deleted");
- else if (support == null)
- $("#author-href").href("mailto:" + author.address + "?subject=" + regarding("A"));
- else
- $("#author-href").href(support);
- }
-
- /*var store = commercial;
- if (!store)
- $(".activation").addClass("deleted");
- else {
- var activation = api + 'activation/' + idc;
- $("#activation-src").src(activation);
- }*/
-
- var depiction = package.depiction;
- if (depiction != null) {
- $(".description").addClass("deleted");
- $("#depiction-src").src(depiction);
- } else {
- $(".depiction").addClass("deleted");
-
- var description = package.longDescription;
- if (description == null)
- description = package.shortDescription;
-
- if (description == null)
- $(".description").addClass("deleted");
- else {
- description = $.xml(description).replace(/\n/g, "<br/>");
- $("#description").html(description);
- }
- }
-
- var homepage = package.homepage;
- if (homepage == null)
- $(".homepage").addClass("deleted");
- else
- $("#homepage-href").href(homepage);
-
- var installed = package.installed;
- if (installed == null)
- $(".installed").addClass("deleted");
- else {
- $("#installed").html($.xml(installed));
- $("#files-href").href("cydia://files/" + idc);
- }
-
- space("#id", $.xml(id), 220);
-
- var section = package.longSection;
- if (section == null)
- $(".section").addClass("deleted");
- else {
- $("#section-src").src("cydia://section-icon/" + encodeURIComponent(section));
- $("#section").html($.xml(section));
- }
-
- var size = package.size;
- if (size == 0)
- $(".size").addClass("deleted");
- else
- $("#size").html(size / 1024 + " kB");
-
- var maintainer = package.maintainer;
- if (maintainer == null)
- $(".maintainer").addClass("deleted");
- else {
- space("#maintainer", $.xml(maintainer.name), 153);
- if (maintainer.address == null)
- $("#maintainer-icon").addClass("deleted");
- else if (support == null)
- $("#maintainer-href").href("mailto:" + maintainer.address + "?subject=" + regarding("M"));
- else
- $("#maintainer-href").href(support);
- }
-
- var sponsor = package.sponsor;
- if (sponsor == null)
- $(".sponsor").addClass("deleted");
- else {
- space("#sponsor", $.xml(sponsor.name), 152);
- $("#sponsor-href").href(sponsor.address);
- }
-
- var source = package.source;
- if (source == null) {
- $(".source").addClass("deleted");
- $(".trusted").addClass("deleted");
- } else {
- var host = source.host;
-
- $("#source-src").src("cydia://source-icon/" + encodeURIComponent(host));
- $("#source-name").html($.xml(source.name));
-
- if (source.trusted)
- $("#trusted").href("cydia://package-signature/" + idc);
- else
- $(".trusted").addClass("deleted");
-
- var description = source.description;
- if (description == null)
- $(".source-description").addClass("deleted");
- else
- $("#source-description").html($.xml(description));
- }
-});
diff --git a/MobileCydia.app/packages.png b/MobileCydia.app/packages.png
deleted file mode 100644
index 404fe0c..0000000
--- a/MobileCydia.app/packages.png
+++ /dev/null
Binary files differ
diff --git a/MobileCydia.app/settings.png b/MobileCydia.app/settings.png
deleted file mode 100644
index 86f4e78..0000000
--- a/MobileCydia.app/settings.png
+++ /dev/null
Binary files differ
diff --git a/MobileCydia.app/signature.html b/MobileCydia.app/signature.html
deleted file mode 100644
index aa113b8..0000000
--- a/MobileCydia.app/signature.html
+++ /dev/null
@@ -1,16 +0,0 @@
-<?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>
- <base target="_blank"/>
-</head><body><div class="page">
-<div class="dialog">
- <div class="panel">
-
- </div>
-</div>
-</div></body></html>
diff --git a/MobileCydia.app/sources.png b/MobileCydia.app/sources.png
deleted file mode 100644
index e8422e4..0000000
--- a/MobileCydia.app/sources.png
+++ /dev/null
Binary files differ
diff --git a/MobileCydia.app/star.png b/MobileCydia.app/star.png
deleted file mode 100644
index f762a24..0000000
--- a/MobileCydia.app/star.png
+++ /dev/null
Binary files differ
diff --git a/MobileCydia.app/storage.html b/MobileCydia.app/storage.html
deleted file mode 100644
index 55ac5ab..0000000
--- a/MobileCydia.app/storage.html
+++ /dev/null
@@ -1,237 +0,0 @@
-<?xml version="1.0" encoding="UTF-16"?>
-<html><head>
- <title localize="STORAGE"></title>
- <meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0"/>
- <link rel="stylesheet" type="text/css" href="menes/style.css"/>
- <script type="text/javascript" src="menes/menes.js"></script>
- <script type="text/javascript" src="storage.js"></script>
- <script type="text/javascript" src="localize.js"></script>
- <base target="_blank"/>
-
- <style>
- body {
- display: table;
- font-family: Helvetica;
- height: 337px;
- margin: 0;
- padding: 0;
- -webkit-text-size-adjust: none;
- -webkit-user-select: none;
- }
-
- div.page {
- display: table-cell;
- text-align: center;
- margin: 0 auto;
- vertical-align: middle;
- width: 320px;
- }
-
- a.giant-button {
- background-color: rgba(0, 0, 0, 0.15);
- -webkit-border-radius: 10px;
- color: #193250;
- display: block;
- margin: 8px 10px;
- position: relative;
- text-decoration: none;
- width: 300px;
- }
-
- a.giant-button > piechart {
- float: left;
- margin: 10px;
- vertical-align: middle;
- }
-
- a.giant-button > label {
- display: block;
- float: left;
- font-size: 25px;
- margin: 10px 0 4px 4px;
- text-align: center;
- text-shadow: rgba(200, 200, 200, 0.75) 1px 1px 0;
- width: 155px;
- }
-
- a.giant-button > div.text {
- display: block;
- float: left;
- font-size: 14px;
- margin-left: 4px;
- text-align: center;
- width: 155px;
- }
-
- div.key {
- display: inline-block;
- width: 50%;
- }
-
- a.giant-button > div.legend {
- float: left;
- font-size: 14px;
- left: 15px;
- position: absolute;
- top: 120px;
- width: 290px;
- }
-
- div.key {
- margin-bottom: 4px;
- }
-
- piechart {
- /*-webkit-transform: rotate(-5deg);*/
- /*-webkit-transform: rotateY(15deg) rotateX(-45deg);*/
- }
-
- piechart > div {
- -webkit-border-radius: 50px;
- height: 100px;
- overflow: hidden;
- position: relative;
- width: 100px;
- }
-
- piechart > div > div:first-child {
- height: 100px;
- overflow: hidden;
- position: absolute;
- z-index: 102;
- width: 51px;
- }
-
- piechart > div > div:last-child {
- height: 100px;
- overflow: hidden;
- position: absolute;
- width: 100px;
- z-index: 0;
- }
-
- piechart > div div.lslice,
- piechart > div div.rslice,
- piechart > div div.tslice,
- piechart > div div.bslice {
- background-color: #4d4d70;
- }
-
- piechart > div div.lslice,
- piechart > div div.rslice,
- piechart > div div.tslice,
- piechart > div div.bslice,
- piechart > div div.xslice {
- /* XXX: technically, these aren't needed */
- -webkit-border-bottom-left-radius: 50px;
- -webkit-border-top-left-radius: 50px;
- height: 100px;
- position: absolute;
- -webkit-transform-origin: 100% 50%;
- width: 50px;
- }
-
- piechart > div div.lslice {
- z-index: 100;
- }
-
- piechart > div div.rslice,
- piechart > div div.tslice,
- piechart > div div.bslice {
- z-index: 0;
- }
-
- piechart > div div.rslice {
- -webkit-transform: rotate(180deg);
- }
-
- piechart > div div.tslice {
- -webkit-transform: rotate(90deg);
- }
-
- piechart > div div.bslice {
- -webkit-transform: rotate(270deg);
- }
-
- piechart > div > div.nslice {
- position: absolute;
- text-align: center;
- top: 42px;
- width: 100px;
- z-index: 103;
- }
-
- piechart > div > div.nslice > div {
- background-color: rgba(255, 255, 255, 0.7);
- -webkit-border-radius: 7px;
- display: inline;
- color: black;
- font-size: 15px;
- font-weight: bold;
- margin: 0 auto;
- padding: 2px 4px;
- text-align: center;
- }
-
- div.color {
- background-color: black;
- border: 1px solid #4d4d70;
- display: inline-block;
- vertical-align: middle;
- }
-
- div.color > div {
- border: 1px solid white;
- display: inline-block;
- height: 12px;
- width: 12px;
- }
-
- div.name {
- display: inline-block;
- font-size: 14px;
- margin-left: 5px;
- vertical-align: middle;
- }
- </style>
-</head><body class="pinstripe">
-<panel>
-
-<a class="giant-button" style="height: 149px">
- <piechart><div>
- <div id="system-left"></div>
- <div id="system-right">
- <div class="lslice"></div>
- <div class="rslice"></div>
- <div class="tslice"></div>
- <div class="bslice"></div>
- </div>
- <div class="nslice"><div id="system-size"></div></div>
- </div></piechart>
-
- <label>System</label>
- <div class="text">A small partition used to store iPhone OS. Cydia adds a few important programs and libraries.</div>
-
- <div class="legend" id="system-legend"></div>
-</a>
-
-<a class="giant-button" style="height: 189px">
- <piechart><div>
- <div id="private-left"></div>
- <div id="private-right">
- <div class="lslice"></div>
- <div class="rslice"></div>
- <div class="tslice"></div>
- <div class="bslice"></div>
- </div>
- <div class="nslice"><div id="private-size"></div></div>
- </div></piechart>
-
- <label>Private</label>
- <div class="text">Most content is stored on this partition: from applications (Cydia and Apple) to multimedia.</div>
-
- <div class="legend" id="private-legend"></div>
-</a>
-
-</panel>
-</body></html>
diff --git a/MobileCydia.app/storage.js b/MobileCydia.app/storage.js
deleted file mode 100644
index ae8cb85..0000000
--- a/MobileCydia.app/storage.js
+++ /dev/null
@@ -1,88 +0,0 @@
-var colors = ["#9090e0", "#4d4d70", "#7d7da0", "#7da0e0", "#d0d0f0", "#7070e0"];
-
-var list = function (legend, color, name, value) {
- legend.append('<div class="key">' +
- '<div class="color" style="background-color: ' + color + '"><div></div></div>' +
- '<div class="name">' + name + ' (' + Math.round(value * 1000) / 10 + '%)</div>' +
- '</div>');
-};
-
-console.log(cydia.statfs("/"));
-
-var cut = function (parent, color, fraction, z) {
- var deg = Math.round(360 * fraction);
- if (deg < 2)
- deg = 2;
- parent.append('<div class="xslice" style="' +
- 'background-color: ' + color + ';' +
- '-webkit-transform: rotate(' + deg + 'deg);' +
- 'z-index: ' + z + ';' +
- '"></div>');
-};
-
-var chart = function (right, left, slices) {
- var total = 0;
- for (var i = 0; i != slices.length; ++i) {
- var slice = slices[i];
- var z = slices.length - i;
- if (slice[1] > 0.5)
- cut(right, slice[0], total + 0.5, z);
- total += slice[1];
- cut(total > 0.5 ? left : right, slice[0], total, z);
- }
-};
-
-var setup = function (name, root, folders) {
- var size = $("#" + name + "-size");
- var statfs = cydia.statfs(root);
- var kb = statfs[0] * statfs[1] / 1024;
- var total = kb / 1024;
-
- var unit;
- if (total < 1000)
- unit = 'M';
- else {
- total = total / 1024;
- unit = 'G'
- }
-
- size.html(Math.round(total * 10) / 10 + " " + unit);
-
- var legend = $("#" + name + "-legend");
- var used = 0;
-
- var slices = [];
-
- if (folders != null)
- for (var i = 0; i != folders.length; ++i) {
- var folder = folders[i];
- var usage = cydia.du(folder[1]);
- if (usage == null)
- usage = 0;
- var color = colors[i + 2];
- var percent = usage / kb;
- list(legend, color, folder[0], percent);
- slices.push([color, percent]);
- used += usage;
- }
-
- var free = statfs[0] * statfs[2] / 1024;
- var other = (kb - free - used) / kb;
-
- slices.push([colors[0], other]);
- chart($("#" + name + "-right"), $("#" + name + "-left"), slices);
-
- list(legend, colors[0], folders == null ? "Used" : "Other", other);
- list(legend, colors[1], "Free", statfs[2] / statfs[1]);
-};
-
-$(function () {
- setup("system", "/", null);
-
- setup("private", "/private/var", [
- ["Themes", "/Library/Themes/"],
- ["iTunes", "/var/mobile/Media/iTunes_Control/"],
- ["App Store", "/var/mobile/Applications/"],
- ["Camera", "/var/mobile/Media/DCIM/"]
- ]);
-});
diff --git a/MobileCydia.app/storage.png b/MobileCydia.app/storage.png
deleted file mode 100644
index 3cefef0..0000000
--- a/MobileCydia.app/storage.png
+++ /dev/null
Binary files differ
diff --git a/MobileCydia.app/trusted.png b/MobileCydia.app/trusted.png
deleted file mode 100644
index de249eb..0000000
--- a/MobileCydia.app/trusted.png
+++ /dev/null
Binary files differ
diff --git a/MobileCydia.app/version.png b/MobileCydia.app/version.png
deleted file mode 100644
index fd1eec1..0000000
--- a/MobileCydia.app/version.png
+++ /dev/null
Binary files differ
diff --git a/MobileCydia.app/warning.png b/MobileCydia.app/warning.png
deleted file mode 100644
index 8d3e5df..0000000
--- a/MobileCydia.app/warning.png
+++ /dev/null
Binary files differ
diff --git a/MobileCydia.app/web.png b/MobileCydia.app/web.png
deleted file mode 100644
index a4f04e3..0000000
--- a/MobileCydia.app/web.png
+++ /dev/null
Binary files differ
diff --git a/MobileCydia.mm b/MobileCydia.mm
index 6cbb164..4277e57 100644
--- a/MobileCydia.mm
+++ b/MobileCydia.mm
@@ -402,6 +402,7 @@ static const CFStringCompareFlags LaxCompareFlags_ = kCFCompareCaseInsensitive |
#define ShowInternals (0 && !ForRelease)
#define IgnoreInstall (0 && !ForRelease)
#define AlwaysReload (0 && !ForRelease)
+#define TryIndexedCollation (0 && !ForRelease)
#if !TraceLogging
#undef _trace
@@ -1071,7 +1072,7 @@ static _transient NSMutableDictionary *Sources_;
static bool Changed_;
static time_t now_;
-static bool IsWildcat_;
+bool IsWildcat_;
/* }}} */
/* Display Helpers {{{ */
@@ -1179,12 +1180,11 @@ bool isSectionVisible(NSString *section) {
- (void) setConfigurationData:(NSString *)data;
@end
-@class PackageController;
+@class CYPackageController;
@protocol CydiaDelegate
- (void) retainNetworkActivityIndicator;
- (void) releaseNetworkActivityIndicator;
-- (void) setPackageController:(PackageController *)view;
- (void) clearPackage:(Package *)package;
- (void) installPackage:(Package *)package;
- (void) installPackages:(NSArray *)packages;
@@ -1199,7 +1199,6 @@ bool isSectionVisible(NSString *section) {
- (UIProgressHUD *) addProgressHUD;
- (void) removeProgressHUD:(UIProgressHUD *)hud;
- (CYViewController *) pageForPackage:(NSString *)name;
-- (PackageController *) packageController;
- (void) showActionSheet:(UIActionSheet *)sheet fromItem:(UIBarButtonItem *)item;
@end
@@ -2736,6 +2735,8 @@ struct PackageNameOrdering :
if (range.location != NSNotFound)
return YES;
+ [self parse];
+
range = [[self shortDescription] rangeOfString:text options:MatchCompareOptions_];
if (range.location != NSNotFound)
return YES;
@@ -3730,23 +3731,6 @@ static NSString *Warning_;
@end
/* }}} */
-/* Confirmation Controller {{{ */
-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;
-}
-/* }}} */
-
/* Web Scripting {{{ */
@interface CydiaObject : NSObject {
id indirect_;
@@ -4047,6 +4031,41 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
@end
/* }}} */
+/* Emulated Loading Controller {{{ */
+@interface CYEmulatedLoadingController : CYViewController {
+ CYLoadingIndicator *indicator_;
+ UITabBar *tabbar_;
+ UINavigationBar *navbar_;
+}
+@end
+
+@implementation CYEmulatedLoadingController
+
+- (CYEmulatedLoadingController *) init {
+ if ((self = [super init])) {
+ [[self view] setBackgroundColor:[UIColor pinStripeColor]];
+
+ indicator_ = [[CYLoadingIndicator alloc] initWithFrame:[[self view] bounds]];
+ [indicator_ setAutoresizingMask:UIViewAutoresizingFlexibleBoth];
+ [[self view] addSubview:indicator_];
+ [indicator_ release];
+
+ tabbar_ = [[UITabBar alloc] initWithFrame:CGRectMake(0, 0, 0, 49.0f)];
+ [tabbar_ setFrame:CGRectMake(0.0f, [[self view] bounds].size.height - [tabbar_ bounds].size.height, [[self view] bounds].size.width, [tabbar_ bounds].size.height)];
+ [tabbar_ setAutoresizingMask:UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleWidth];
+ [[self view] addSubview:tabbar_];
+ [tabbar_ release];
+
+ navbar_ = [[UINavigationBar alloc] initWithFrame:CGRectMake(0, 0, 0, 44.0f)];
+ [navbar_ setFrame:CGRectMake(0.0f, 0.0f, [[self view] bounds].size.width, [navbar_ bounds].size.height)];
+ [navbar_ setAutoresizingMask:UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleWidth];
+ [[self view] addSubview:navbar_];
+ [navbar_ release];
+ } return self;
+}
+
+@end
+/* }}} */
/* Cydia Browser Controller {{{ */
@interface CYBrowserController : BrowserController {
@@ -4070,18 +4089,16 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
WebDataSource *source([frame dataSource]);
NSURLResponse *response([source response]);
+
NSURL *url([response URL]);
NSString *scheme([url scheme]);
-
- NSHTTPURLResponse *http;
- if (scheme != nil && ([scheme isEqualToString:@"http"] || [scheme isEqualToString:@"https"]))
- http = (NSHTTPURLResponse *) response;
- else
- http = nil;
-
- NSDictionary *headers([http allHeaderFields]);
NSString *host([url host]);
- [self setHeaders:headers forHost:host];
+
+ if ([response isKindOfClass:[NSHTTPURLResponse class]]) {
+ NSHTTPURLResponse *http((NSHTTPURLResponse *) response);
+ NSDictionary *headers([http allHeaderFields]);
+ [self setHeaders:headers forHost:host];
+ }
if (
[host isEqualToString:@"cydia.saurik.com"] ||
@@ -4140,7 +4157,22 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
@end
/* }}} */
-/* Confirmation {{{ */
+/* Confirmation Controller {{{ */
+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 ConfirmationControllerDelegate
- (void) cancelAndClear:(bool)clear;
- (void) confirmWithNavigationController:(UINavigationController *)navigation;
@@ -4449,7 +4481,6 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
//[status_ setFont:font];
output_ = [[UITextView alloc] init];
-
[output_ setAutoresizingMask:UIViewAutoresizingFlexibleBoth];
//[output_ setTextFont:@"Courier New"];
[output_ setFont:[[output_ font] fontWithSize:12]];
@@ -4495,7 +4526,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
10,
20,
bounds.size.width - 20,
- bounds.size.height - 62
+ bounds.size.height - 96
)];
[close_ setFrame:CGRectMake(
(bounds.size.width - closewidth) / 2,
@@ -4870,6 +4901,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
@end
/* }}} */
+
/* Package Cell {{{ */
@interface PackageCell : CYTableViewCell <
ContentDelegate
@@ -4960,6 +4992,10 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
[self setNeedsDisplay];
}
+- (NSString *) accessibilityLabel {
+ return [NSString stringWithFormat:UCLocalize("COLON_DELIMITED"), name_, description_];
+}
+
- (void) setPackage:(Package *)package {
[self clearPackage];
[package parse];
@@ -5188,6 +5224,10 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
[switch_ setFrame:CGRectMake(frame.size.width - 102, 9, rect.size.width, rect.size.height)];
}
+- (NSString *) accessibilityLabel {
+ return name_;
+}
+
- (void) drawContentRect:(CGRect)rect {
bool highlighted(highlighted_ && !editing_);
@@ -5335,7 +5375,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
@end
/* }}} */
/* Package Controller {{{ */
-@interface PackageController : CYBrowserController <
+@interface CYPackageController : CYBrowserController <
UIActionSheetDelegate
> {
_transient Database *database_;
@@ -5351,7 +5391,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
@end
-@implementation PackageController
+@implementation CYPackageController
- (void) dealloc {
if (package_ != nil)
@@ -5368,8 +5408,6 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
}
- (void) release {
- if ([self retainCount] == 1)
- [delegate_ setPackageController:self];
[super release];
}
@@ -5470,7 +5508,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
if ((self = [super init]) != nil) {
database_ = database;
buttons_ = [[NSMutableArray alloc] initWithCapacity:4];
- [self loadURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"package" ofType:@"html"]]];
+ [self loadURL:[NSURL URLWithString:CydiaURL(@"ui/package/")]];
} return self;
}
@@ -5537,6 +5575,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
@end
/* }}} */
+
/* Package Table {{{ */
@interface PackageTable : UIView <
UITableViewDataSource,
@@ -5583,9 +5622,11 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
[super dealloc];
}
+#if TryIndexedCollation
+ (BOOL) hasIndexedCollation {
return NO; // XXX: objc_getClass("UILocalizedIndexedCollation") != nil;
}
+#endif
- (NSInteger) numberOfSectionsInTableView:(UITableView *)list {
NSInteger count([sections_ count]);
@@ -5640,9 +5681,11 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
}
- (NSInteger) tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index {
+#if TryIndexedCollation
if ([[self class] hasIndexedCollation]) {
return [[objc_getClass("UILocalizedIndexedCollation") currentCollation] sectionForSectionIndexTitleAtIndex:index];
}
+#endif
return index;
}
@@ -5654,9 +5697,13 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
target_ = target;
action_ = action;
- index_ = [[self class] hasIndexedCollation]
- ? [[[objc_getClass("UILocalizedIndexedCollation") currentCollation] sectionIndexTitles] retain]
- : [[NSMutableArray alloc] initWithCapacity:32];
+#if TryIndexedCollation
+ if ([[self class] hasIndexedCollation])
+ index_ = [[[objc_getClass("UILocalizedIndexedCollation") currentCollation] sectionIndexTitles] retain]
+ else
+#endif
+ index_ = [[NSMutableArray alloc] initWithCapacity:32];
+
indices_ = [[NSMutableDictionary alloc] initWithCapacity:32];
packages_ = [[NSMutableArray arrayWithCapacity:16] retain];
@@ -5697,6 +5744,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
Section *section = nil;
+#if TryIndexedCollation
if ([[self class] hasIndexedCollation]) {
id collation = [objc_getClass("UILocalizedIndexedCollation") currentCollation];
NSArray *titles = [collation sectionIndexTitles];
@@ -5727,7 +5775,9 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
[section addToCount];
}
_end
- } else {
+ } else
+#endif
+ {
[index_ removeAllObjects];
_profile(PackageTable$reloadData$Section)
@@ -5839,7 +5889,6 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
@end
/* }}} */
-
/* Filtered Package Controller {{{ */
@interface FilteredPackageController : CYViewController {
_transient Database *database_;
@@ -5866,7 +5915,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
}
- (void) didSelectPackage:(Package *)package {
- PackageController *view([delegate_ packageController]);
+ CYPackageController *view([[[CYPackageController alloc] initWithDatabase:database_] autorelease]);
[view setPackage:package];
[view setDelegate:delegate_];
[[self navigationController] pushViewController:view animated:YES];
@@ -5907,625 +5956,9 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
/* }}} */
-/* Source Cell {{{ */
-@interface SourceCell : CYTableViewCell <
- ContentDelegate
-> {
- UIImage *icon_;
- NSString *origin_;
- NSString *label_;
-}
-
-- (void) setSource:(Source *)source;
-
-@end
-
-@implementation SourceCell
-
-- (void) clearSource {
- [icon_ release];
- [origin_ release];
- [label_ release];
-
- icon_ = nil;
- origin_ = nil;
- label_ = nil;
-}
-
-- (void) setSource:(Source *)source {
- [self clearSource];
-
- if (icon_ == nil)
- icon_ = [UIImage applicationImageNamed:[NSString stringWithFormat:@"Sources/%@.png", [source host]]];
- if (icon_ == nil)
- icon_ = [UIImage applicationImageNamed:@"unknown.png"];
- icon_ = [icon_ retain];
-
- origin_ = [[source name] retain];
- label_ = [[source uri] retain];
-
- [content_ setNeedsDisplay];
-}
-
-- (void) dealloc {
- [self clearSource];
- [super dealloc];
-}
-
-- (SourceCell *) initWithFrame:(CGRect)frame reuseIdentifier:(NSString *)reuseIdentifier {
- if ((self = [super initWithFrame:frame reuseIdentifier:reuseIdentifier]) != nil) {
- UIView *content([self contentView]);
- CGRect bounds([content bounds]);
-
- content_ = [[ContentView alloc] initWithFrame:bounds];
- [content_ setAutoresizingMask:UIViewAutoresizingFlexibleBoth];
- [content_ setBackgroundColor:[UIColor whiteColor]];
- [content addSubview:content_];
-
- [content_ setDelegate:self];
- [content_ setOpaque:YES];
- } return self;
-}
-
-- (void) drawContentRect:(CGRect)rect {
- bool highlighted(highlighted_);
- float width(rect.size.width);
-
- if (icon_ != nil)
- [icon_ drawInRect:CGRectMake(10, 10, 30, 30)];
-
- if (highlighted)
- UISetColor(White_);
-
- if (!highlighted)
- UISetColor(Black_);
- [origin_ drawAtPoint:CGPointMake(48, 8) forWidth:(width - 80) withFont:Font18Bold_ lineBreakMode:UILineBreakModeTailTruncation];
-
- if (!highlighted)
- UISetColor(Blue_);
- [label_ drawAtPoint:CGPointMake(58, 29) forWidth:(width - 95) withFont:Font12_ lineBreakMode:UILineBreakModeTailTruncation];
-}
-
-@end
-/* }}} */
-/* Source Table {{{ */
-@interface SourceController : CYViewController <
- UITableViewDataSource,
- UITableViewDelegate
-> {
- _transient Database *database_;
- UITableView *list_;
- NSMutableArray *sources_;
- int offset_;
-
- NSString *href_;
- UIProgressHUD *hud_;
- NSError *error_;
-
- //NSURLConnection *installer_;
- NSURLConnection *trivial_;
- NSURLConnection *trivial_bz2_;
- NSURLConnection *trivial_gz_;
- //NSURLConnection *automatic_;
-
- BOOL cydia_;
-}
-
-- (id) initWithDatabase:(Database *)database;
-
-- (void) updateButtonsForEditingStatus:(BOOL)editing animated:(BOOL)animated;
-
-@end
-
-@implementation SourceController
-
-- (void) _releaseConnection:(NSURLConnection *)connection {
- if (connection != nil) {
- [connection cancel];
- //[connection setDelegate:nil];
- [connection release];
- }
-}
-
-- (void) dealloc {
- if (href_ != nil)
- [href_ release];
- if (hud_ != nil)
- [hud_ release];
- if (error_ != nil)
- [error_ release];
-
- //[self _releaseConnection:installer_];
- [self _releaseConnection:trivial_];
- [self _releaseConnection:trivial_gz_];
- [self _releaseConnection:trivial_bz2_];
- //[self _releaseConnection:automatic_];
-
- [sources_ release];
- [list_ release];
- [super dealloc];
-}
-
-- (void) viewDidAppear:(BOOL)animated {
- [super viewDidAppear:animated];
- [list_ deselectRowAtIndexPath:[list_ indexPathForSelectedRow] animated:animated];
-}
-
-- (NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
- return offset_ == 0 ? 1 : 2;
-}
-
-- (NSString *) tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
- switch (section + (offset_ == 0 ? 1 : 0)) {
- case 0: return UCLocalize("ENTERED_BY_USER");
- case 1: return UCLocalize("INSTALLED_BY_PACKAGE");
-
- _nodefault
- }
-}
-
-- (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
- int count = [sources_ count];
- switch (section) {
- case 0: return (offset_ == 0 ? count : offset_);
- case 1: return count - offset_;
-
- _nodefault
- }
-}
-
-- (Source *) sourceAtIndexPath:(NSIndexPath *)indexPath {
- unsigned idx = 0;
- switch (indexPath.section) {
- case 0: idx = indexPath.row; break;
- case 1: idx = indexPath.row + offset_; break;
-
- _nodefault
- }
- return [sources_ objectAtIndex:idx];
-}
-
-- (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
- static NSString *cellIdentifier = @"SourceCell";
-
- SourceCell *cell = (SourceCell *) [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
- if(cell == nil) cell = [[[SourceCell alloc] initWithFrame:CGRectZero reuseIdentifier:cellIdentifier] autorelease];
- [cell setSource:[self sourceAtIndexPath:indexPath]];
-
- return cell;
-}
-
-- (UITableViewCellAccessoryType) tableView:(UITableView *)tableView accessoryTypeForRowWithIndexPath:(NSIndexPath *)indexPath {
- return UITableViewCellAccessoryDisclosureIndicator;
-}
-
-- (void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
- Source *source = [self sourceAtIndexPath:indexPath];
-
- FilteredPackageController *packages = [[[FilteredPackageController alloc]
- initWithDatabase:database_
- title:[source label]
- filter:@selector(isVisibleInSource:)
- with:source
- ] autorelease];
-
- [packages setDelegate:delegate_];
-
- [[self navigationController] pushViewController:packages animated:YES];
-}
-
-- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
- Source *source = [self sourceAtIndexPath:indexPath];
- return [source record] != nil;
-}
-
-- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
- Source *source = [self sourceAtIndexPath:indexPath];
- [Sources_ removeObjectForKey:[source key]];
- [delegate_ syncData];
-}
-
-- (void) complete {
- [Sources_ setObject:[NSDictionary dictionaryWithObjectsAndKeys:
- @"deb", @"Type",
- href_, @"URI",
- @"./", @"Distribution",
- nil] forKey:[NSString stringWithFormat:@"deb:%@:./", href_]];
-
- [delegate_ syncData];
-}
-
-- (NSString *) getWarning {
- NSString *href(href_);
- NSRange colon([href rangeOfString:@"://"]);
- if (colon.location != NSNotFound)
- href = [href substringFromIndex:(colon.location + 3)];
- href = [href stringByAddingPercentEscapes];
- href = [CydiaURL(@"api/repotag/") stringByAppendingString:href];
- href = [href stringByCachingURLWithCurrentCDN];
-
- NSURL *url([NSURL URLWithString:href]);
-
- NSStringEncoding encoding;
- NSError *error(nil);
-
- if (NSString *warning = [NSString stringWithContentsOfURL:url usedEncoding:&encoding error:&error])
- return [warning length] == 0 ? nil : warning;
- return nil;
-}
-
-- (void) _endConnection:(NSURLConnection *)connection {
- // XXX: the memory management in this method is horribly awkward
-
- NSURLConnection **field = NULL;
- if (connection == trivial_)
- field = &trivial_;
- else if (connection == trivial_bz2_)
- field = &trivial_bz2_;
- else if (connection == trivial_gz_)
- field = &trivial_gz_;
- _assert(field != NULL);
- [connection release];
- *field = nil;
-
- if (
- trivial_ == nil &&
- trivial_bz2_ == nil &&
- trivial_gz_ == nil
- ) {
- bool defer(false);
-
- if (cydia_) {
- if (NSString *warning = [self yieldToSelector:@selector(getWarning)]) {
- defer = true;
-
- UIAlertView *alert = [[[UIAlertView alloc]
- initWithTitle:UCLocalize("SOURCE_WARNING")
- message:warning
- delegate:self
- cancelButtonTitle:UCLocalize("CANCEL")
- otherButtonTitles:UCLocalize("ADD_ANYWAY"), nil
- ] autorelease];
-
- [alert setContext:@"warning"];
- [alert setNumberOfRows:1];
- [alert show];
- } else
- [self complete];
- } else if (error_ != nil) {
- UIAlertView *alert = [[[UIAlertView alloc]
- initWithTitle:UCLocalize("VERIFICATION_ERROR")
- message:[error_ localizedDescription]
- delegate:self
- cancelButtonTitle:UCLocalize("OK")
- otherButtonTitles:nil
- ] autorelease];
-
- [alert setContext:@"urlerror"];
- [alert show];
- } else {
- UIAlertView *alert = [[[UIAlertView alloc]
- initWithTitle:UCLocalize("NOT_REPOSITORY")
- message:UCLocalize("NOT_REPOSITORY_EX")
- delegate:self
- cancelButtonTitle:UCLocalize("OK")
- otherButtonTitles:nil
- ] autorelease];
-
- [alert setContext:@"trivial"];
- [alert show];
- }
-
- [delegate_ setStatusBarShowsProgress:NO];
- [delegate_ removeProgressHUD:hud_];
-
- [hud_ autorelease];
- hud_ = nil;
-
- if (!defer) {
- [href_ release];
- href_ = nil;
- }
-
- if (error_ != nil) {
- [error_ release];
- error_ = nil;
- }
- }
-}
-
-- (void) connection:(NSURLConnection *)connection didReceiveResponse:(NSHTTPURLResponse *)response {
- switch ([response statusCode]) {
- case 200:
- cydia_ = YES;
- }
-}
-
-- (void) connection:(NSURLConnection *)connection didFailWithError:(NSError *)error {
- lprintf("connection:\"%s\" didFailWithError:\"%s\"", [href_ UTF8String], [[error localizedDescription] UTF8String]);
- if (error_ != nil)
- error_ = [error retain];
- [self _endConnection:connection];
-}
-
-- (void) connectionDidFinishLoading:(NSURLConnection *)connection {
- [self _endConnection:connection];
-}
-
-- (NSString *) title { return UCLocalize("SOURCES"); }
-
-- (NSURLConnection *) _requestHRef:(NSString *)href method:(NSString *)method {
- NSMutableURLRequest *request = [NSMutableURLRequest
- requestWithURL:[NSURL URLWithString:href]
- cachePolicy:NSURLRequestUseProtocolCachePolicy
- timeoutInterval:120.0
- ];
-
- [request setHTTPMethod:method];
-
- if (Machine_ != NULL)
- [request setValue:[NSString stringWithUTF8String:Machine_] forHTTPHeaderField:@"X-Machine"];
- if (UniqueID_ != nil)
- [request setValue:UniqueID_ forHTTPHeaderField:@"X-Unique-ID"];
- if (Role_ != nil)
- [request setValue:Role_ forHTTPHeaderField:@"X-Role"];
-
- return [[[NSURLConnection alloc] initWithRequest:request delegate:self] autorelease];
-}
-
-- (void)alertView:(UIAlertView *)alert clickedButtonAtIndex:(NSInteger)button {
- NSString *context([alert context]);
-
- if ([context isEqualToString:@"source"]) {
- switch (button) {
- case 1: {
- NSString *href = [[alert textField] text];
-
- //installer_ = [[self _requestHRef:href method:@"GET"] retain];
-
- if (![href hasSuffix:@"/"])
- href_ = [href stringByAppendingString:@"/"];
- else
- href_ = href;
- href_ = [href_ retain];
-
- trivial_ = [[self _requestHRef:[href_ stringByAppendingString:@"Packages"] method:@"HEAD"] retain];
- trivial_bz2_ = [[self _requestHRef:[href_ stringByAppendingString:@"Packages.bz2"] method:@"HEAD"] retain];
- trivial_gz_ = [[self _requestHRef:[href_ stringByAppendingString:@"Packages.gz"] method:@"HEAD"] retain];
- //trivial_bz2_ = [[self _requestHRef:[href stringByAppendingString:@"dists/Release"] method:@"HEAD"] retain];
-
- cydia_ = false;
-
- // XXX: this is stupid
- hud_ = [[delegate_ addProgressHUD] retain];
- [hud_ setText:UCLocalize("VERIFYING_URL")];
- } break;
-
- case 0:
- break;
-
- _nodefault
- }
-
- [alert dismissWithClickedButtonIndex:-1 animated:YES];
- } else if ([context isEqualToString:@"trivial"])
- [alert dismissWithClickedButtonIndex:-1 animated:YES];
- else if ([context isEqualToString:@"urlerror"])
- [alert dismissWithClickedButtonIndex:-1 animated:YES];
- else if ([context isEqualToString:@"warning"]) {
- switch (button) {
- case 1:
- [self complete];
- break;
-
- case 0:
- break;
-
- _nodefault
- }
-
- [href_ release];
- href_ = nil;
-
- [alert dismissWithClickedButtonIndex:-1 animated:YES];
- }
-}
-
-- (id) initWithDatabase:(Database *)database {
- if ((self = [super init]) != nil) {
- [[self navigationItem] setTitle:UCLocalize("SOURCES")];
- [self updateButtonsForEditingStatus:NO animated:NO];
-
- database_ = database;
- sources_ = [[NSMutableArray arrayWithCapacity:16] retain];
-
- list_ = [[UITableView alloc] initWithFrame:[[self view] bounds] style:UITableViewStylePlain];
- [list_ setAutoresizingMask:UIViewAutoresizingFlexibleBoth];
- [list_ setRowHeight:56];
- [[self view] addSubview:list_];
-
- [list_ setDataSource:self];
- [list_ setDelegate:self];
-
- [self reloadData];
- } return self;
-}
-
-- (void) reloadData {
- pkgSourceList list;
- if (!list.ReadMainList())
- return;
-
- [sources_ removeAllObjects];
- [sources_ addObjectsFromArray:[database_ sources]];
- _trace();
- [sources_ sortUsingSelector:@selector(compareByNameAndType:)];
- _trace();
-
- int count([sources_ count]);
- offset_ = 0;
- for (int i = 0; i != count; i++) {
- if ([[sources_ objectAtIndex:i] record] == nil)
- break;
- offset_++;
- }
-
- [list_ setEditing:NO];
- [self updateButtonsForEditingStatus:NO animated:NO];
- [list_ reloadData];
-}
-
-- (void) addButtonClicked {
- /*[book_ pushPage:[[[AddSourceController alloc]
- initWithBook:book_
- database:database_
- ] autorelease]];*/
-
- UIAlertView *alert = [[[UIAlertView alloc]
- initWithTitle:UCLocalize("ENTER_APT_URL")
- message:nil
- delegate:self
- cancelButtonTitle:UCLocalize("CANCEL")
- otherButtonTitles:UCLocalize("ADD_SOURCE"), nil
- ] autorelease];
-
- [alert setContext:@"source"];
- [alert setTransform:CGAffineTransformTranslate([alert transform], 0.0, 100.0)];
-
- [alert setNumberOfRows:1];
- [alert addTextFieldWithValue:@"http://" label:@""];
-
- UITextInputTraits *traits = [[alert textField] textInputTraits];
- [traits setAutocapitalizationType:UITextAutocapitalizationTypeNone];
- [traits setAutocorrectionType:UITextAutocorrectionTypeNo];
- [traits setKeyboardType:UIKeyboardTypeURL];
- // XXX: UIReturnKeyDone
- [traits setReturnKeyType:UIReturnKeyNext];
-
- [alert show];
-}
-
-- (void) updateButtonsForEditingStatus:(BOOL)editing animated:(BOOL)animated {
- [[self navigationItem] setLeftBarButtonItem:(editing ? [[[UIBarButtonItem alloc]
- initWithTitle:UCLocalize("ADD")
- style:UIBarButtonItemStylePlain
- target:self
- action:@selector(addButtonClicked)
- ] autorelease] : [[self navigationItem] backBarButtonItem]) animated:animated];
-
- [[self navigationItem] setRightBarButtonItem:[[[UIBarButtonItem alloc]
- initWithTitle:(editing ? UCLocalize("DONE") : UCLocalize("EDIT"))
- style:(editing ? UIBarButtonItemStyleDone : UIBarButtonItemStylePlain)
- target:self
- action:@selector(editButtonClicked)
- ] autorelease] animated:animated];
-
- if (IsWildcat_ && !editing)
- [[self navigationItem] setLeftBarButtonItem:[[[UIBarButtonItem alloc]
- initWithTitle:UCLocalize("SETTINGS")
- style:UIBarButtonItemStylePlain
- target:self
- action:@selector(settingsButtonClicked)
- ] autorelease]];
-}
-
-- (void) settingsButtonClicked {
- [delegate_ showSettings];
-}
-
-- (void) editButtonClicked {
- [list_ setEditing:![list_ isEditing] animated:YES];
-
- [self updateButtonsForEditingStatus:[list_ isEditing] animated:YES];
-}
-
-@end
-/* }}} */
-
-/* Installed Controller {{{ */
-@interface InstalledController : FilteredPackageController {
- BOOL expert_;
-}
-
-- (id) initWithDatabase:(Database *)database;
-
-- (void) updateRoleButton;
-- (void) queueStatusDidChange;
-
-@end
-
-@implementation InstalledController
-
-- (void) dealloc {
- [super dealloc];
-}
-
-- (NSString *) title { return UCLocalize("INSTALLED"); }
-
-- (id) initWithDatabase:(Database *)database {
- if ((self = [super initWithDatabase:database title:UCLocalize("INSTALLED") filter:@selector(isInstalledAndUnfiltered:) with:[NSNumber numberWithBool:YES]]) != nil) {
- [self updateRoleButton];
- [self queueStatusDidChange];
- } return self;
-}
-
-#if !AlwaysReload
-- (void) queueButtonClicked {
- [delegate_ queue];
-}
-#endif
-
-- (void) queueStatusDidChange {
-#if !AlwaysReload
- if (IsWildcat_) {
- if (Queuing_) {
- [[self navigationItem] setLeftBarButtonItem:[[[UIBarButtonItem alloc]
- initWithTitle:UCLocalize("QUEUE")
- style:UIBarButtonItemStyleDone
- target:self
- action:@selector(queueButtonClicked)
- ] autorelease]];
- } else {
- [[self navigationItem] setLeftBarButtonItem:nil];
- }
- }
-#endif
-}
-
-- (void) reloadData {
- [packages_ reloadData];
-}
-
-- (void) updateRoleButton {
- if (Role_ != nil && ![Role_ isEqualToString:@"Developer"])
- [[self navigationItem] setRightBarButtonItem:[[[UIBarButtonItem alloc]
- initWithTitle:(expert_ ? UCLocalize("EXPERT") : UCLocalize("SIMPLE"))
- style:(expert_ ? UIBarButtonItemStyleDone : UIBarButtonItemStylePlain)
- target:self
- action:@selector(roleButtonClicked)
- ] autorelease]];
-}
-
-- (void) roleButtonClicked {
- [packages_ setObject:[NSNumber numberWithBool:expert_]];
- [packages_ reloadData];
- expert_ = !expert_;
-
- [self updateRoleButton];
-}
-
-- (void) setDelegate:(id)delegate {
- [super setDelegate:delegate];
- [packages_ setDelegate:delegate];
-}
-
-@end
-/* }}} */
-
/* Home Controller {{{ */
@interface HomeController : CYBrowserController {
}
-
@end
@implementation HomeController
@@ -6578,6 +6011,8 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
- (id) init {
if ((self = [super init]) != nil) {
+ [self loadURL:[NSURL URLWithString:CydiaURL(@"ui/home/")]];
+
[[self navigationItem] setLeftBarButtonItem:[[[UIBarButtonItem alloc]
initWithTitle:UCLocalize("ABOUT")
style:UIBarButtonItemStylePlain
@@ -6602,6 +6037,8 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
if ((self = [super init]) != nil) {
[[self navigationItem] setTitle:UCLocalize("MANAGE")];
+ [self loadURL:[NSURL URLWithString:CydiaURL(@"ui/manage/")]];
+
[[self navigationItem] setLeftBarButtonItem:[[[UIBarButtonItem alloc]
initWithTitle:UCLocalize("SETTINGS")
style:UIBarButtonItemStylePlain
@@ -6795,15 +6232,14 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
@implementation CYTabBarController
-/* XXX: some logic should probably go here related to
-freeing the view controllers on tab change */
-
- (void) reloadData {
size_t count([[self viewControllers] count]);
for (size_t i(0); i != count; ++i) {
CYNavigationController *page([[self viewControllers] objectAtIndex:(count - i - 1)]);
[page reloadData];
}
+
+ [(CYNavigationController *)[self transientViewController] reloadData];
}
- (id) initWithDatabase:(Database *)database {
@@ -6817,10 +6253,6 @@ freeing the view controllers on tab change */
} return self;
}
-- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orientation {
- return IsWildcat_ || orientation == UIInterfaceOrientationPortrait;
-}
-
- (void) setUpdate:(NSDate *)date {
[self beginUpdate];
}
@@ -6954,7 +6386,7 @@ freeing the view controllers on tab change */
CGRect barframe([refreshbar_ frame]);
- if (false) // XXX: _UIApplicationLinkedOnOrAfter(4)
+ if (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber_iPhoneOS_3_0) // XXX: _UIApplicationLinkedOnOrAfter(4)
barframe.origin.y = [self statusBarHeight];
else
barframe.origin.y = 0;
@@ -7042,7 +6474,6 @@ freeing the view controllers on tab change */
@end
/* }}} */
-
/* Cydia Navigation Controller {{{ */
@interface CYNavigationController : UINavigationController {
_transient Database *database_;
@@ -7057,17 +6488,6 @@ freeing the view controllers on tab change */
@implementation CYNavigationController
-- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orientation {
- // Inherit autorotation settings for modal parents.
- if ([self parentViewController] && [[self parentViewController] modalViewController] == self) {
- return [[self parentViewController] shouldAutorotateToInterfaceOrientation:orientation];
- } else if ([self parentViewController]) {
- return [[self parentViewController] shouldAutorotateToInterfaceOrientation:orientation];
- } else {
- return [super shouldAutorotateToInterfaceOrientation:orientation];
- }
-}
-
- (void) dealloc {
[super dealloc];
}
@@ -7092,6 +6512,7 @@ freeing the view controllers on tab change */
@end
/* }}} */
+
/* Cydia:// Protocol {{{ */
@interface CydiaURLProtocol : NSURLProtocol {
}
@@ -7193,8 +6614,35 @@ freeing the view controllers on tab change */
@end
/* }}} */
+/* Section Controller {{{ */
+@interface SectionController : FilteredPackageController {
+}
+
+- (id) initWithDatabase:(Database *)database section:(NSString *)section;
+
+@end
+
+@implementation SectionController
+
+- (id) initWithDatabase:(Database *)database section:(NSString *)name {
+ NSString *title;
+
+ if (name == nil) {
+ title = UCLocalize("ALL_PACKAGES");
+ } else if (![name isEqual:@""]) {
+ title = [[NSBundle mainBundle] localizedStringForKey:Simplify(name) value:nil table:@"Sections"];
+ } else {
+ title = UCLocalize("NO_SECTION");
+ }
+
+ if ((self = [super initWithDatabase:database title:title filter:@selector(isVisibleInSection:) with:name]) != nil) {
+ } return self;
+}
+
+@end
+/* }}} */
/* Sections Controller {{{ */
-@interface CYSectionsController : CYViewController <
+@interface SectionsController : CYViewController <
UITableViewDataSource,
UITableViewDelegate
> {
@@ -7202,7 +6650,6 @@ freeing the view controllers on tab change */
NSMutableArray *sections_;
NSMutableArray *filtered_;
UITableView *list_;
- UIView *accessory_;
BOOL editing_;
}
@@ -7214,7 +6661,7 @@ freeing the view controllers on tab change */
@end
-@implementation CYSectionsController
+@implementation SectionsController
- (void) dealloc {
[list_ setDataSource:nil];
@@ -7223,19 +6670,29 @@ freeing the view controllers on tab change */
[sections_ release];
[filtered_ release];
[list_ release];
- [accessory_ release];
[super dealloc];
}
+- (void) updateNavigationItem {
+ [[self navigationItem] setTitle:editing_ ? UCLocalize("SECTION_VISIBILITY") : UCLocalize("SECTIONS")];
+ if ([sections_ count] == 0) {
+ [[self navigationItem] setRightBarButtonItem:nil];
+ } else {
+ [[self navigationItem] setRightBarButtonItem:[[UIBarButtonItem alloc]
+ initWithBarButtonSystemItem:(editing_ ? UIBarButtonSystemItemDone : UIBarButtonSystemItemEdit)
+ target:self
+ action:@selector(editButtonClicked)
+ ] animated:([[self navigationItem] rightBarButtonItem] != nil)];
+ }
+}
+
- (void) setEditing:(BOOL)editing {
if ((editing_ = editing))
[list_ reloadData];
else
[delegate_ updateData];
- [[self navigationItem] setTitle:editing_ ? UCLocalize("SECTION_VISIBILITY") : UCLocalize("SECTIONS")];
- [[[self navigationItem] rightBarButtonItem] setTitle:[sections_ count] == 0 ? nil : editing_ ? UCLocalize("DONE") : UCLocalize("EDIT")];
- [[[self navigationItem] rightBarButtonItem] setStyle:editing_ ? UIBarButtonItemStyleDone : UIBarButtonItemStylePlain];
+ [self updateNavigationItem];
}
- (void) viewDidAppear:(BOOL)animated {
@@ -7278,37 +6735,16 @@ freeing the view controllers on tab change */
return;
Section *section = [self sectionAtIndexPath:indexPath];
- NSString *name = [section name];
- NSString *title;
- if ([indexPath row] == 0) {
- section = nil;
- name = nil;
- title = UCLocalize("ALL_PACKAGES");
- } else {
- if (name != nil) {
- name = [NSString stringWithString:name];
- title = [[NSBundle mainBundle] localizedStringForKey:Simplify(name) value:nil table:@"Sections"];
- } else {
- name = @"";
- title = UCLocalize("NO_SECTION");
- }
- }
-
- FilteredPackageController *table = [[[FilteredPackageController alloc]
+ SectionController *controller = [[[SectionController alloc]
initWithDatabase:database_
- title:title
- filter:@selector(isVisibleInSection:)
- with:name
+ section:[section name]
] autorelease];
+ [controller setDelegate:delegate_];
- [table setDelegate:delegate_];
-
- [[self navigationController] pushViewController:table animated:YES];
+ [[self navigationController] pushViewController:controller animated:YES];
}
-- (NSString *) title { return UCLocalize("SECTIONS"); }
-
- (id) initWithDatabase:(Database *)database {
if ((self = [super init]) != nil) {
database_ = database;
@@ -7380,13 +6816,7 @@ freeing the view controllers on tab change */
[filtered_ addObject:section];
}
- [[self navigationItem] setRightBarButtonItem:[[[UIBarButtonItem alloc]
- initWithTitle:([sections_ count] == 0 ? nil : UCLocalize("EDIT"))
- style:UIBarButtonItemStylePlain
- target:self
- action:@selector(editButtonClicked)
- ] autorelease] animated:([[self navigationItem] rightBarButtonItem] != nil)];
-
+ [self updateNavigationItem];
[list_ reloadData];
_trace();
}
@@ -7400,12 +6830,9 @@ freeing the view controllers on tab change */
[self setEditing:!editing_];
}
-- (UIView *) accessoryView {
- return accessory_;
-}
-
@end
/* }}} */
+
/* Changes Controller {{{ */
@interface ChangesController : CYViewController <
UITableViewDataSource,
@@ -7420,8 +6847,7 @@ freeing the view controllers on tab change */
BOOL hasSentFirstLoad_;
}
-- (id) initWithDatabase:(Database *)database delegate:(id)delegate;
-- (void) reloadData;
+- (id) initWithDatabase:(Database *)database;
@end
@@ -7492,7 +6918,7 @@ freeing the view controllers on tab change */
- (NSIndexPath *) tableView:(UITableView *)table willSelectRowAtIndexPath:(NSIndexPath *)path {
Package *package([self packageAtIndexPath:path]);
- PackageController *view([delegate_ packageController]);
+ CYPackageController *view([[[CYPackageController alloc] initWithDatabase:database_] autorelease]);
[view setDelegate:delegate_];
[view setPackage:package];
[[self navigationController] pushViewController:view animated:YES];
@@ -7510,13 +6936,12 @@ freeing the view controllers on tab change */
- (NSString *) title { return UCLocalize("CHANGES"); }
-- (id) initWithDatabase:(Database *)database delegate:(id)delegate {
+- (id) initWithDatabase:(Database *)database {
if ((self = [super init]) != nil) {
database_ = database;
[[self navigationItem] setTitle:UCLocalize("CHANGES")];
packages_ = CFArrayCreateMutable(kCFAllocatorDefault, 0, NULL);
-
sections_ = [[NSMutableArray arrayWithCapacity:16] retain];
list_ = [[UITableView alloc] initWithFrame:[[self view] bounds] style:UITableViewStylePlain];
@@ -7526,8 +6951,6 @@ freeing the view controllers on tab change */
[list_ setDataSource:self];
[list_ setDelegate:self];
-
- delegate_ = delegate;
} return self;
}
@@ -7656,6 +7079,7 @@ freeing the view controllers on tab change */
}
- (id) initWithDatabase:(Database *)database;
+- (void) setSearchTerm:(NSString *)term;
- (void) reloadData;
@end
@@ -7667,6 +7091,10 @@ freeing the view controllers on tab change */
[super dealloc];
}
+- (void) setSearchTerm:(NSString *)searchTerm {
+ [search_ setText:searchTerm];
+}
+
- (void) searchBarSearchButtonClicked:(UISearchBar *)searchBar {
[packages_ setObject:[search_ text] forFilter:@selector(isUnfilteredAndSearchedForBy:)];
[search_ resignFirstResponder];
@@ -7678,8 +7106,6 @@ freeing the view controllers on tab change */
[self reloadData];
}
-- (NSString *) title { return nil; }
-
- (id) initWithDatabase:(Database *)database {
return [super initWithDatabase:database title:UCLocalize("SEARCH") filter:@selector(isUnfilteredAndSearchedForBy:) with:nil];
}
@@ -7722,8 +7148,8 @@ freeing the view controllers on tab change */
@end
/* }}} */
-/* Settings Controller {{{ */
-@interface CYPackageSettingsController : CYViewController <
+/* Package Settings Controller {{{ */
+@interface PackageSettingsController : CYViewController <
UITableViewDataSource,
UITableViewDelegate
> {
@@ -7741,7 +7167,7 @@ freeing the view controllers on tab change */
@end
-@implementation CYPackageSettingsController
+@implementation PackageSettingsController
- (void) dealloc {
[name_ release];
@@ -7770,6 +7196,10 @@ freeing the view controllers on tab change */
return 2;
}
+- (NSString *) tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
+ return UCLocalize("CHANGE_PACKAGE_SETTINGS");
+}
+
- (NSString *) tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section {
return UCLocalize("SHOW_ALL_CHANGES_EX");
}
@@ -7820,6 +7250,8 @@ freeing the view controllers on tab change */
ignoredSwitch_ = [[UISwitch alloc] initWithFrame:CGRectMake(0, 0, 50, 20)];
[ignoredSwitch_ setAutoresizingMask:UIViewAutoresizingFlexibleLeftMargin];
[ignoredSwitch_ addTarget:self action:@selector(onIgnored:) forEvents:UIControlEventValueChanged];
+ // Disable this switch, since it only reflects (not modifies) the ignored state.
+ [ignoredSwitch_ setUserInteractionEnabled:NO];
subscribedCell_ = [[UITableViewCell alloc] init];
[subscribedCell_ setText:UCLocalize("SHOW_ALL_CHANGES")];
@@ -7891,8 +7323,638 @@ freeing the view controllers on tab change */
@end
/* }}} */
-/* Role Controller {{{ */
-@interface CYSettingsController : CYViewController <
+/* Installed Controller {{{ */
+@interface InstalledController : FilteredPackageController {
+ BOOL expert_;
+}
+
+- (id) initWithDatabase:(Database *)database;
+
+- (void) updateRoleButton;
+- (void) queueStatusDidChange;
+
+@end
+
+@implementation InstalledController
+
+- (void) dealloc {
+ [super dealloc];
+}
+
+- (NSString *) title { return UCLocalize("INSTALLED"); }
+
+- (id) initWithDatabase:(Database *)database {
+ if ((self = [super initWithDatabase:database title:UCLocalize("INSTALLED") filter:@selector(isInstalledAndUnfiltered:) with:[NSNumber numberWithBool:YES]]) != nil) {
+ [self updateRoleButton];
+ [self queueStatusDidChange];
+ } return self;
+}
+
+#if !AlwaysReload
+- (void) queueButtonClicked {
+ [delegate_ queue];
+}
+#endif
+
+- (void) queueStatusDidChange {
+#if !AlwaysReload
+ if (IsWildcat_) {
+ if (Queuing_) {
+ [[self navigationItem] setLeftBarButtonItem:[[[UIBarButtonItem alloc]
+ initWithTitle:UCLocalize("QUEUE")
+ style:UIBarButtonItemStyleDone
+ target:self
+ action:@selector(queueButtonClicked)
+ ] autorelease]];
+ } else {
+ [[self navigationItem] setLeftBarButtonItem:nil];
+ }
+ }
+#endif
+}
+
+- (void) reloadData {
+ [packages_ reloadData];
+}
+
+- (void) updateRoleButton {
+ if (Role_ != nil && ![Role_ isEqualToString:@"Developer"])
+ [[self navigationItem] setRightBarButtonItem:[[[UIBarButtonItem alloc]
+ initWithTitle:(expert_ ? UCLocalize("EXPERT") : UCLocalize("SIMPLE"))
+ style:(expert_ ? UIBarButtonItemStyleDone : UIBarButtonItemStylePlain)
+ target:self
+ action:@selector(roleButtonClicked)
+ ] autorelease]];
+}
+
+- (void) roleButtonClicked {
+ [packages_ setObject:[NSNumber numberWithBool:expert_]];
+ [packages_ reloadData];
+ expert_ = !expert_;
+
+ [self updateRoleButton];
+}
+
+- (void) setDelegate:(id)delegate {
+ [super setDelegate:delegate];
+ [packages_ setDelegate:delegate];
+}
+
+@end
+/* }}} */
+
+/* Source Cell {{{ */
+@interface SourceCell : CYTableViewCell <
+ ContentDelegate
+> {
+ UIImage *icon_;
+ NSString *origin_;
+ NSString *label_;
+}
+
+- (void) setSource:(Source *)source;
+
+@end
+
+@implementation SourceCell
+
+- (void) clearSource {
+ [icon_ release];
+ [origin_ release];
+ [label_ release];
+
+ icon_ = nil;
+ origin_ = nil;
+ label_ = nil;
+}
+
+- (void) setSource:(Source *)source {
+ [self clearSource];
+
+ if (icon_ == nil)
+ icon_ = [UIImage applicationImageNamed:[NSString stringWithFormat:@"Sources/%@.png", [source host]]];
+ if (icon_ == nil)
+ icon_ = [UIImage applicationImageNamed:@"unknown.png"];
+ icon_ = [icon_ retain];
+
+ origin_ = [[source name] retain];
+ label_ = [[source uri] retain];
+
+ [content_ setNeedsDisplay];
+}
+
+- (void) dealloc {
+ [self clearSource];
+ [super dealloc];
+}
+
+- (SourceCell *) initWithFrame:(CGRect)frame reuseIdentifier:(NSString *)reuseIdentifier {
+ if ((self = [super initWithFrame:frame reuseIdentifier:reuseIdentifier]) != nil) {
+ UIView *content([self contentView]);
+ CGRect bounds([content bounds]);
+
+ content_ = [[ContentView alloc] initWithFrame:bounds];
+ [content_ setAutoresizingMask:UIViewAutoresizingFlexibleBoth];
+ [content_ setBackgroundColor:[UIColor whiteColor]];
+ [content addSubview:content_];
+
+ [content_ setDelegate:self];
+ [content_ setOpaque:YES];
+ } return self;
+}
+
+- (NSString *) accessibilityLabel {
+ return label_;
+}
+
+- (void) drawContentRect:(CGRect)rect {
+ bool highlighted(highlighted_);
+ float width(rect.size.width);
+
+ if (icon_ != nil)
+ [icon_ drawInRect:CGRectMake(10, 10, 30, 30)];
+
+ if (highlighted)
+ UISetColor(White_);
+
+ if (!highlighted)
+ UISetColor(Black_);
+ [origin_ drawAtPoint:CGPointMake(48, 8) forWidth:(width - 80) withFont:Font18Bold_ lineBreakMode:UILineBreakModeTailTruncation];
+
+ if (!highlighted)
+ UISetColor(Blue_);
+ [label_ drawAtPoint:CGPointMake(58, 29) forWidth:(width - 95) withFont:Font12_ lineBreakMode:UILineBreakModeTailTruncation];
+}
+
+@end
+/* }}} */
+/* Source Controller {{{ */
+@interface SourceController : FilteredPackageController {
+}
+
+- (id) initWithDatabase:(Database *)database source:(Source *)source;
+
+@end
+
+@implementation SourceController
+
+- (id) initWithDatabase:(Database *)database source:(Source *)source {
+ if ((self = [super initWithDatabase:database title:[source label] filter:@selector(isVisibleInSource:) with:source]) != nil) {
+ } return self;
+}
+
+@end
+/* }}} */
+/* Sources Controller {{{ */
+@interface SourcesController : CYViewController <
+ UITableViewDataSource,
+ UITableViewDelegate
+> {
+ _transient Database *database_;
+ UITableView *list_;
+ NSMutableArray *sources_;
+ int offset_;
+
+ NSString *href_;
+ UIProgressHUD *hud_;
+ NSError *error_;
+
+ //NSURLConnection *installer_;
+ NSURLConnection *trivial_;
+ NSURLConnection *trivial_bz2_;
+ NSURLConnection *trivial_gz_;
+ //NSURLConnection *automatic_;
+
+ BOOL cydia_;
+}
+
+- (id) initWithDatabase:(Database *)database;
+
+- (void) updateButtonsForEditingStatus:(BOOL)editing animated:(BOOL)animated;
+
+@end
+
+@implementation SourcesController
+
+- (void) _releaseConnection:(NSURLConnection *)connection {
+ if (connection != nil) {
+ [connection cancel];
+ //[connection setDelegate:nil];
+ [connection release];
+ }
+}
+
+- (void) dealloc {
+ if (href_ != nil)
+ [href_ release];
+ if (hud_ != nil)
+ [hud_ release];
+ if (error_ != nil)
+ [error_ release];
+
+ //[self _releaseConnection:installer_];
+ [self _releaseConnection:trivial_];
+ [self _releaseConnection:trivial_gz_];
+ [self _releaseConnection:trivial_bz2_];
+ //[self _releaseConnection:automatic_];
+
+ [sources_ release];
+ [list_ release];
+ [super dealloc];
+}
+
+- (void) viewDidAppear:(BOOL)animated {
+ [super viewDidAppear:animated];
+ [list_ deselectRowAtIndexPath:[list_ indexPathForSelectedRow] animated:animated];
+}
+
+- (NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
+ return offset_ == 0 ? 1 : 2;
+}
+
+- (NSString *) tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
+ switch (section + (offset_ == 0 ? 1 : 0)) {
+ case 0: return UCLocalize("ENTERED_BY_USER");
+ case 1: return UCLocalize("INSTALLED_BY_PACKAGE");
+
+ _nodefault
+ }
+}
+
+- (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
+ int count = [sources_ count];
+ switch (section) {
+ case 0: return (offset_ == 0 ? count : offset_);
+ case 1: return count - offset_;
+
+ _nodefault
+ }
+}
+
+- (Source *) sourceAtIndexPath:(NSIndexPath *)indexPath {
+ unsigned idx = 0;
+ switch (indexPath.section) {
+ case 0: idx = indexPath.row; break;
+ case 1: idx = indexPath.row + offset_; break;
+
+ _nodefault
+ }
+ return [sources_ objectAtIndex:idx];
+}
+
+- (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
+ static NSString *cellIdentifier = @"SourceCell";
+
+ SourceCell *cell = (SourceCell *) [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
+ if(cell == nil) cell = [[[SourceCell alloc] initWithFrame:CGRectZero reuseIdentifier:cellIdentifier] autorelease];
+ [cell setSource:[self sourceAtIndexPath:indexPath]];
+ [cell setAccessoryType:UITableViewCellAccessoryDisclosureIndicator];
+
+ return cell;
+}
+
+- (void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
+ Source *source = [self sourceAtIndexPath:indexPath];
+
+ SourceController *controller = [[[SourceController alloc]
+ initWithDatabase:database_
+ source:source
+ ] autorelease];
+
+ [controller setDelegate:delegate_];
+
+ [[self navigationController] pushViewController:controller animated:YES];
+}
+
+- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
+ Source *source = [self sourceAtIndexPath:indexPath];
+ return [source record] != nil;
+}
+
+- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
+ Source *source = [self sourceAtIndexPath:indexPath];
+ [Sources_ removeObjectForKey:[source key]];
+ [delegate_ syncData];
+}
+
+- (void) complete {
+ [Sources_ setObject:[NSDictionary dictionaryWithObjectsAndKeys:
+ @"deb", @"Type",
+ href_, @"URI",
+ @"./", @"Distribution",
+ nil] forKey:[NSString stringWithFormat:@"deb:%@:./", href_]];
+
+ [delegate_ syncData];
+}
+
+- (NSString *) getWarning {
+ NSString *href(href_);
+ NSRange colon([href rangeOfString:@"://"]);
+ if (colon.location != NSNotFound)
+ href = [href substringFromIndex:(colon.location + 3)];
+ href = [href stringByAddingPercentEscapes];
+ href = [CydiaURL(@"api/repotag/") stringByAppendingString:href];
+ href = [href stringByCachingURLWithCurrentCDN];
+
+ NSURL *url([NSURL URLWithString:href]);
+
+ NSStringEncoding encoding;
+ NSError *error(nil);
+
+ if (NSString *warning = [NSString stringWithContentsOfURL:url usedEncoding:&encoding error:&error])
+ return [warning length] == 0 ? nil : warning;
+ return nil;
+}
+
+- (void) _endConnection:(NSURLConnection *)connection {
+ // XXX: the memory management in this method is horribly awkward
+
+ NSURLConnection **field = NULL;
+ if (connection == trivial_)
+ field = &trivial_;
+ else if (connection == trivial_bz2_)
+ field = &trivial_bz2_;
+ else if (connection == trivial_gz_)
+ field = &trivial_gz_;
+ _assert(field != NULL);
+ [connection release];
+ *field = nil;
+
+ if (
+ trivial_ == nil &&
+ trivial_bz2_ == nil &&
+ trivial_gz_ == nil
+ ) {
+ bool defer(false);
+
+ if (cydia_) {
+ if (NSString *warning = [self yieldToSelector:@selector(getWarning)]) {
+ defer = true;
+
+ UIAlertView *alert = [[[UIAlertView alloc]
+ initWithTitle:UCLocalize("SOURCE_WARNING")
+ message:warning
+ delegate:self
+ cancelButtonTitle:UCLocalize("CANCEL")
+ otherButtonTitles:UCLocalize("ADD_ANYWAY"), nil
+ ] autorelease];
+
+ [alert setContext:@"warning"];
+ [alert setNumberOfRows:1];
+ [alert show];
+ } else
+ [self complete];
+ } else if (error_ != nil) {
+ UIAlertView *alert = [[[UIAlertView alloc]
+ initWithTitle:UCLocalize("VERIFICATION_ERROR")
+ message:[error_ localizedDescription]
+ delegate:self
+ cancelButtonTitle:UCLocalize("OK")
+ otherButtonTitles:nil
+ ] autorelease];
+
+ [alert setContext:@"urlerror"];
+ [alert show];
+ } else {
+ UIAlertView *alert = [[[UIAlertView alloc]
+ initWithTitle:UCLocalize("NOT_REPOSITORY")
+ message:UCLocalize("NOT_REPOSITORY_EX")
+ delegate:self
+ cancelButtonTitle:UCLocalize("OK")
+ otherButtonTitles:nil
+ ] autorelease];
+
+ [alert setContext:@"trivial"];
+ [alert show];
+ }
+
+ [delegate_ setStatusBarShowsProgress:NO];
+ [delegate_ removeProgressHUD:hud_];
+
+ [hud_ autorelease];
+ hud_ = nil;
+
+ if (!defer) {
+ [href_ release];
+ href_ = nil;
+ }
+
+ if (error_ != nil) {
+ [error_ release];
+ error_ = nil;
+ }
+ }
+}
+
+- (void) connection:(NSURLConnection *)connection didReceiveResponse:(NSHTTPURLResponse *)response {
+ switch ([response statusCode]) {
+ case 200:
+ cydia_ = YES;
+ }
+}
+
+- (void) connection:(NSURLConnection *)connection didFailWithError:(NSError *)error {
+ lprintf("connection:\"%s\" didFailWithError:\"%s\"", [href_ UTF8String], [[error localizedDescription] UTF8String]);
+ if (error_ != nil)
+ error_ = [error retain];
+ [self _endConnection:connection];
+}
+
+- (void) connectionDidFinishLoading:(NSURLConnection *)connection {
+ [self _endConnection:connection];
+}
+
+- (NSString *) title { return UCLocalize("SOURCES"); }
+
+- (NSURLConnection *) _requestHRef:(NSString *)href method:(NSString *)method {
+ NSMutableURLRequest *request = [NSMutableURLRequest
+ requestWithURL:[NSURL URLWithString:href]
+ cachePolicy:NSURLRequestUseProtocolCachePolicy
+ timeoutInterval:120.0
+ ];
+
+ [request setHTTPMethod:method];
+
+ if (Machine_ != NULL)
+ [request setValue:[NSString stringWithUTF8String:Machine_] forHTTPHeaderField:@"X-Machine"];
+ if (UniqueID_ != nil)
+ [request setValue:UniqueID_ forHTTPHeaderField:@"X-Unique-ID"];
+ if (Role_ != nil)
+ [request setValue:Role_ forHTTPHeaderField:@"X-Role"];
+
+ return [[[NSURLConnection alloc] initWithRequest:request delegate:self] autorelease];
+}
+
+- (void)alertView:(UIAlertView *)alert clickedButtonAtIndex:(NSInteger)button {
+ NSString *context([alert context]);
+
+ if ([context isEqualToString:@"source"]) {
+ switch (button) {
+ case 1: {
+ NSString *href = [[alert textField] text];
+
+ //installer_ = [[self _requestHRef:href method:@"GET"] retain];
+
+ if (![href hasSuffix:@"/"])
+ href_ = [href stringByAppendingString:@"/"];
+ else
+ href_ = href;
+ href_ = [href_ retain];
+
+ trivial_ = [[self _requestHRef:[href_ stringByAppendingString:@"Packages"] method:@"HEAD"] retain];
+ trivial_bz2_ = [[self _requestHRef:[href_ stringByAppendingString:@"Packages.bz2"] method:@"HEAD"] retain];
+ trivial_gz_ = [[self _requestHRef:[href_ stringByAppendingString:@"Packages.gz"] method:@"HEAD"] retain];
+ //trivial_bz2_ = [[self _requestHRef:[href stringByAppendingString:@"dists/Release"] method:@"HEAD"] retain];
+
+ cydia_ = false;
+
+ // XXX: this is stupid
+ hud_ = [[delegate_ addProgressHUD] retain];
+ [hud_ setText:UCLocalize("VERIFYING_URL")];
+ } break;
+
+ case 0:
+ break;
+
+ _nodefault
+ }
+
+ [alert dismissWithClickedButtonIndex:-1 animated:YES];
+ } else if ([context isEqualToString:@"trivial"])
+ [alert dismissWithClickedButtonIndex:-1 animated:YES];
+ else if ([context isEqualToString:@"urlerror"])
+ [alert dismissWithClickedButtonIndex:-1 animated:YES];
+ else if ([context isEqualToString:@"warning"]) {
+ switch (button) {
+ case 1:
+ [self complete];
+ break;
+
+ case 0:
+ break;
+
+ _nodefault
+ }
+
+ [href_ release];
+ href_ = nil;
+
+ [alert dismissWithClickedButtonIndex:-1 animated:YES];
+ }
+}
+
+- (id) initWithDatabase:(Database *)database {
+ if ((self = [super init]) != nil) {
+ [[self navigationItem] setTitle:UCLocalize("SOURCES")];
+ [self updateButtonsForEditingStatus:NO animated:NO];
+
+ database_ = database;
+ sources_ = [[NSMutableArray arrayWithCapacity:16] retain];
+
+ list_ = [[UITableView alloc] initWithFrame:[[self view] bounds] style:UITableViewStylePlain];
+ [list_ setAutoresizingMask:UIViewAutoresizingFlexibleBoth];
+ [list_ setRowHeight:56];
+ [[self view] addSubview:list_];
+
+ [list_ setDataSource:self];
+ [list_ setDelegate:self];
+
+ [self reloadData];
+ } return self;
+}
+
+- (void) reloadData {
+ pkgSourceList list;
+ if (!list.ReadMainList())
+ return;
+
+ [sources_ removeAllObjects];
+ [sources_ addObjectsFromArray:[database_ sources]];
+ _trace();
+ [sources_ sortUsingSelector:@selector(compareByNameAndType:)];
+ _trace();
+
+ int count([sources_ count]);
+ offset_ = 0;
+ for (int i = 0; i != count; i++) {
+ if ([[sources_ objectAtIndex:i] record] == nil)
+ break;
+ offset_++;
+ }
+
+ [list_ setEditing:NO];
+ [self updateButtonsForEditingStatus:NO animated:NO];
+ [list_ reloadData];
+}
+
+- (void) showAddSourcePrompt {
+ UIAlertView *alert = [[[UIAlertView alloc]
+ initWithTitle:UCLocalize("ENTER_APT_URL")
+ message:nil
+ delegate:self
+ cancelButtonTitle:UCLocalize("CANCEL")
+ otherButtonTitles:UCLocalize("ADD_SOURCE"), nil
+ ] autorelease];
+
+ [alert setContext:@"source"];
+ [alert setTransform:CGAffineTransformTranslate([alert transform], 0.0, 100.0)];
+
+ [alert setNumberOfRows:1];
+ [alert addTextFieldWithValue:@"http://" label:@""];
+
+ UITextInputTraits *traits = [[alert textField] textInputTraits];
+ [traits setAutocapitalizationType:UITextAutocapitalizationTypeNone];
+ [traits setAutocorrectionType:UITextAutocorrectionTypeNo];
+ [traits setKeyboardType:UIKeyboardTypeURL];
+ // XXX: UIReturnKeyDone
+ [traits setReturnKeyType:UIReturnKeyNext];
+
+ [alert show];
+}
+
+- (void) addButtonClicked {
+ [self showAddSourcePrompt];
+}
+
+- (void) updateButtonsForEditingStatus:(BOOL)editing animated:(BOOL)animated {
+ [[self navigationItem] setLeftBarButtonItem:(editing ? [[[UIBarButtonItem alloc]
+ initWithTitle:UCLocalize("ADD")
+ style:UIBarButtonItemStylePlain
+ target:self
+ action:@selector(addButtonClicked)
+ ] autorelease] : [[self navigationItem] backBarButtonItem]) animated:animated];
+
+ [[self navigationItem] setRightBarButtonItem:[[[UIBarButtonItem alloc]
+ initWithTitle:(editing ? UCLocalize("DONE") : UCLocalize("EDIT"))
+ style:(editing ? UIBarButtonItemStyleDone : UIBarButtonItemStylePlain)
+ target:self
+ action:@selector(editButtonClicked)
+ ] autorelease] animated:animated];
+
+ if (IsWildcat_ && !editing)
+ [[self navigationItem] setLeftBarButtonItem:[[[UIBarButtonItem alloc]
+ initWithTitle:UCLocalize("SETTINGS")
+ style:UIBarButtonItemStylePlain
+ target:self
+ action:@selector(settingsButtonClicked)
+ ] autorelease]];
+}
+
+- (void) settingsButtonClicked {
+ [delegate_ showSettings];
+}
+
+- (void) editButtonClicked {
+ [list_ setEditing:![list_ isEditing] animated:YES];
+
+ [self updateButtonsForEditingStatus:[list_ isEditing] animated:YES];
+}
+
+@end
+/* }}} */
+
+/* Settings Controller {{{ */
+@interface SettingsController : CYViewController <
UITableViewDataSource,
UITableViewDelegate
> {
@@ -7909,7 +7971,7 @@ freeing the view controllers on tab change */
@end
-@implementation CYSettingsController
+@implementation SettingsController
- (void) dealloc {
[table_ release];
[segment_ release];
@@ -8069,7 +8131,7 @@ freeing the view controllers on tab change */
@end
/* }}} */
/* Stash Controller {{{ */
-@interface CYStashController : CYViewController {
+@interface StashController : CYViewController {
// XXX: just delete these things
_transient UIActivityIndicatorView *spinner_;
_transient UILabel *status_;
@@ -8077,7 +8139,7 @@ freeing the view controllers on tab change */
}
@end
-@implementation CYStashController
+@implementation StashController
- (id) init {
if ((self = [super init])) {
[[self view] setBackgroundColor:[UIColor viewFlipsideBackgroundColor]];
@@ -8123,22 +8185,9 @@ freeing the view controllers on tab change */
} return self;
}
-- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orientation {
- return IsWildcat_ || orientation == UIInterfaceOrientationPortrait;
-}
@end
/* }}} */
-typedef enum {
- kCydiaTag = 0,
- kSectionsTag = 1,
- kChangesTag = 2,
- kManageTag = 3,
- kInstalledTag = 4,
- kSourcesTag = 5,
- kSearchTag = 6
-} CYTabTag;
-
@interface Cydia : UIApplication <
ConfirmationControllerDelegate,
ProgressControllerDelegate,
@@ -8157,37 +8206,19 @@ typedef enum {
Database *database_;
NSURL *starturl_;
- int tag_;
unsigned locked_;
unsigned activity_;
- CYSectionsController *sections_;
- ChangesController *changes_;
- ManageController *manage_;
- SearchController *search_;
- SourceController *sources_;
- InstalledController *installed_;
- id queueDelegate_;
-
- CYStashController *stash_;
+ StashController *stash_;
bool loaded_;
}
-- (CYViewController *) _pageForURL:(NSURL *)url withClass:(Class)_class;
-- (void) setPage:(CYViewController *)page;
- (void) loadData;
-// XXX: I hate prototypes
-- (id) queueBadgeController;
-
@end
-static _finline void _setHomePage(Cydia *self) {
- [self setPage:[self _pageForURL:[NSURL URLWithString:CydiaURL(@"")] withClass:[HomeController class]]];
-}
-
@implementation Cydia
- (void) beginUpdate {
@@ -8250,42 +8281,25 @@ static _finline void _setHomePage(Cydia *self) {
}
}
+// Navigation controller for the queuing badge.
+- (CYNavigationController *) queueNavigationController {
+ NSArray *controllers = [tabbar_ viewControllers];
+ return [controllers objectAtIndex:3];
+}
+
- (void) _updateData {
[self _saveConfig];
- NSMutableSet *tabs([[[NSMutableSet alloc] initWithCapacity:10] autorelease]);
-
- [tabs addObject:[tabbar_ selectedViewController]];
-
- if (sections_ != nil)
- [tabs addObject:sections_];
- if (changes_ != nil)
- [tabs addObject:changes_];
- if (manage_ != nil)
- [tabs addObject:manage_];
- if (search_ != nil)
- [tabs addObject:search_];
- if (sources_ != nil)
- [tabs addObject:sources_];
- if (installed_ != nil)
- [tabs addObject:installed_];
+ [tabbar_ reloadData];
- for (CYNavigationController *tab in tabs)
- [tab reloadData];
+ CYNavigationController *navigation = [self queueNavigationController];
- [queueDelegate_ queueStatusDidChange];
- [[[self queueBadgeController] tabBarItem] setBadgeValue:(Queuing_ ? UCLocalize("Q_D") : nil)];
-}
-
-- (int)indexOfTabWithTag:(int)tag {
- int i = 0;
- for (UINavigationController *controller in [tabbar_ viewControllers]) {
- if ([[controller tabBarItem] tag] == tag)
- return i;
- i += 1;
- }
+ id queuedelegate = nil;
+ if ([[navigation viewControllers] count] > 0)
+ queuedelegate = [[navigation viewControllers] objectAtIndex:0];
- return -1;
+ [queuedelegate queueStatusDidChange];
+ [[navigation tabBarItem] setBadgeValue:(Queuing_ ? UCLocalize("Q_D") : nil)];
}
- (void) _refreshIfPossible {
@@ -8371,7 +8385,7 @@ static _finline void _setHomePage(Cydia *self) {
NSLog(@"changes:#%u", changes);
- UITabBarItem *changesItem = [[[tabbar_ viewControllers] objectAtIndex:[self indexOfTabWithTag:kChangesTag]] tabBarItem];
+ UITabBarItem *changesItem = [[[tabbar_ viewControllers] objectAtIndex:2] tabBarItem];
if (changes != 0) {
_trace();
NSString *badge([[NSNumber numberWithInt:changes] stringValue]);
@@ -8542,94 +8556,43 @@ static _finline void _setHomePage(Cydia *self) {
[self complete];
}
-- (void) setPage:(CYViewController *)page {
- [page setDelegate:self];
-
- CYNavigationController *navController = (CYNavigationController *) [tabbar_ selectedViewController];
- [navController setViewControllers:[NSArray arrayWithObject:page]];
- for (CYNavigationController *page in [tabbar_ viewControllers])
- if (page != navController)
- [page setViewControllers:nil];
-}
-
-- (CYViewController *) _pageForURL:(NSURL *)url withClass:(Class)_class {
- CYBrowserController *browser = [[[_class alloc] init] autorelease];
- [browser loadURL:url];
- return browser;
-}
-
-- (CYSectionsController *) sectionsController {
- if (sections_ == nil)
- sections_ = [[CYSectionsController alloc] initWithDatabase:database_];
- return sections_;
-}
-
-- (ChangesController *) changesController {
- if (changes_ == nil)
- changes_ = [[ChangesController alloc] initWithDatabase:database_ delegate:self];
- return changes_;
-}
-
-- (ManageController *) manageController {
- if (manage_ == nil) {
- manage_ = (ManageController *) [[self
- _pageForURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"manage" ofType:@"html"]]
- withClass:[ManageController class]
- ] retain];
- if (!IsWildcat_)
- queueDelegate_ = manage_;
- }
- return manage_;
-}
-
-- (SearchController *) searchController {
- if (search_ == nil)
- search_ = [[SearchController alloc] initWithDatabase:database_];
- return search_;
-}
-
-- (SourceController *) sourcesController {
- if (sources_ == nil)
- sources_ = [[SourceController alloc] initWithDatabase:database_];
- return sources_;
-}
-
-- (InstalledController *) installedController {
- if (installed_ == nil) {
- installed_ = [[InstalledController alloc] initWithDatabase:database_];
- if (IsWildcat_)
- queueDelegate_ = installed_;
- }
- return installed_;
-}
-
- (void) tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController {
- int tag = [[viewController tabBarItem] tag];
- if (tag == tag_) {
- [(CYNavigationController *)[tabbar_ selectedViewController] popToRootViewControllerAnimated:YES];
- return;
- } else if (tag_ == 1) {
- [[self sectionsController] resetView];
- }
-
- switch (tag) {
- case kCydiaTag: _setHomePage(self); break;
+ CYNavigationController *controller = (CYNavigationController *) viewController;
+
+ if ([[controller viewControllers] count] == 0) {
+ int index = [[tabbar_ viewControllers] indexOfObjectIdenticalTo:controller];
+ CYViewController *root = nil;
+
+ if (index == 0)
+ root = [[[HomeController alloc] init] autorelease];
+ else if (index == 1)
+ root = [[[SectionsController alloc] initWithDatabase:database_] autorelease];
+ else if (index == 2)
+ root = [[[ChangesController alloc] initWithDatabase:database_] autorelease];
+
+ if (IsWildcat_) {
+ if (index == 3)
+ root = [[[InstalledController alloc] initWithDatabase:database_] autorelease];
+ else if (index == 4)
+ root = [[[SourcesController alloc] initWithDatabase:database_] autorelease];
+ else if (index == 5)
+ root = [[[SearchController alloc] initWithDatabase:database_] autorelease];
+ } else {
+ if (index == 3)
+ root = [[[ManageController alloc] init] autorelease];
+ else if (index == 4)
+ root = [[[SearchController alloc] initWithDatabase:database_] autorelease];
+ }
- case kSectionsTag: [self setPage:[self sectionsController]]; break;
- case kChangesTag: [self setPage:[self changesController]]; break;
- case kManageTag: [self setPage:[self manageController]]; break;
- case kInstalledTag: [self setPage:[self installedController]]; break;
- case kSourcesTag: [self setPage:[self sourcesController]]; break;
- case kSearchTag: [self setPage:[self searchController]]; break;
+ [root setDelegate:self];
- _nodefault
+ if (root != nil)
+ [controller setViewControllers:[NSArray arrayWithObject:root]];
}
-
- tag_ = tag;
}
- (void) showSettings {
- CYSettingsController *role = [[[CYSettingsController alloc] initWithDatabase:database_ delegate:self] autorelease];
+ SettingsController *role = [[[SettingsController alloc] initWithDatabase:database_ delegate:self] autorelease];
CYNavigationController *nav = [[[CYNavigationController alloc] initWithRootViewController:role] autorelease];
if (IsWildcat_)
[nav setModalPresentationStyle:UIModalPresentationFormSheet];
@@ -8646,29 +8609,6 @@ static _finline void _setHomePage(Cydia *self) {
[self setNetworkActivityIndicatorVisible:NO];
}
-- (void) setPackageController:(PackageController *)view {
- WebThreadLock();
- [view setPackage:nil];
- WebThreadUnlock();
-}
-
-- (PackageController *) _packageController {
- return [[[PackageController alloc] initWithDatabase:database_] autorelease];
-}
-
-- (PackageController *) packageController {
- return [self _packageController];
-}
-
-// Returns the navigation controller for the queuing badge.
-- (id) queueBadgeController {
- int index = [self indexOfTabWithTag:kManageTag];
- if (index == -1)
- index = [self indexOfTabWithTag:kInstalledTag];
-
- return [[tabbar_ viewControllers] objectAtIndex:index];
-}
-
- (void) cancelAndClear:(bool)clear {
@synchronized (self) {
if (clear) {
@@ -8790,76 +8730,133 @@ static _finline void _setHomePage(Cydia *self) {
- (CYViewController *) pageForPackage:(NSString *)name {
if (Package *package = [database_ packageWithName:name]) {
- PackageController *view([self packageController]);
+ CYPackageController *view = [[[CYPackageController alloc] initWithDatabase:database_] autorelease];
[view setPackage:package];
return view;
} else {
NSURL *url([NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"unknown" ofType:@"html"]]);
url = [NSURL URLWithString:[[url absoluteString] stringByAppendingString:[NSString stringWithFormat:@"?%@", name]]];
- return [self _pageForURL:url withClass:[CYBrowserController class]];
+ CYBrowserController *browser = [[[CYBrowserController alloc] init] autorelease];
+ [browser loadURL:url];
+ return browser;
}
}
-- (CYViewController *) pageForURL:(NSURL *)url hasTag:(int *)tag {
- if (tag != NULL)
- *tag = -1;
-
- NSString *href([url absoluteString]);
- if ([href hasPrefix:@"apptapp://package/"])
- return [self pageForPackage:[href substringFromIndex:18]];
-
+- (CYViewController *) pageForURL:(NSURL *)url {
NSString *scheme([[url scheme] lowercaseString]);
- if (![scheme isEqualToString:@"cydia"])
+ if ([[url absoluteString] length] <= [scheme length] + 3)
return nil;
- NSString *path([url absoluteString]);
- if ([path length] < 8)
+ NSString *path([[url absoluteString] substringFromIndex:[scheme length] + 3]);
+ NSArray *components([path pathComponents]);
+
+ if ([scheme isEqualToString:@"apptapp"] && [components count] > 0 && [[components objectAtIndex:0] isEqualToString:@"package"])
+ return [self pageForPackage:[components objectAtIndex:1]];
+
+ if ([components count] < 1 || ![scheme isEqualToString:@"cydia"])
return nil;
- path = [path substringFromIndex:8];
- if (![path hasPrefix:@"/"])
- path = [@"/" stringByAppendingString:path];
-
- if ([path isEqualToString:@"/storage"])
- return [self _pageForURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"storage" ofType:@"html"]] withClass:[CYBrowserController class]];
- /*else if ([path isEqualToString:@"/add-source"])
- return [[[AddSourceController alloc] initWithDatabase:database_] autorelease];*/
- else if ([path isEqualToString:@"/sources"])
- return [[[SourceController alloc] initWithDatabase:database_] autorelease];
- else if ([path isEqualToString:@"/packages"])
- return [[[InstalledController alloc] initWithDatabase:database_] autorelease];
- else if ([path hasPrefix:@"/url/"])
- return [self _pageForURL:[NSURL URLWithString:[path substringFromIndex:5]] withClass:[CYBrowserController class]];
- else if ([path hasPrefix:@"/launch/"])
- [self launchApplicationWithIdentifier:[path substringFromIndex:8] suspended:NO];
- else if ([path hasPrefix:@"/package-settings/"])
- return [[[CYPackageSettingsController alloc] initWithDatabase:database_ package:[path substringFromIndex:18]] autorelease];
- else if ([path hasPrefix:@"/package-signature/"])
- return [[[SignatureController alloc] initWithDatabase:database_ package:[path substringFromIndex:19]] autorelease];
- else if ([path hasPrefix:@"/package/"])
- return [self pageForPackage:[path substringFromIndex:9]];
- else if ([path hasPrefix:@"/files/"]) {
- NSString *name = [path substringFromIndex:7];
-
- if (Package *package = [database_ packageWithName:name]) {
- FileTable *files = [[[FileTable alloc] initWithDatabase:database_] autorelease];
- [files setPackage:package];
- return files;
+
+ NSString *base([components objectAtIndex:0]);
+
+ CYViewController *controller = nil;
+
+ if ([base isEqualToString:@"url"]) {
+ // This kind of URL can contain slashes in the argument, so we can't parse them below.
+ NSString *destination = [[url absoluteString] substringFromIndex:([scheme length] + [@"://" length] + [base length] + [@"/" length])];
+ controller = [[[CYBrowserController alloc] init] autorelease];
+ [(CYBrowserController *)controller loadURL:[NSURL URLWithString:destination]];
+ } else if ([components count] == 1) {
+ if ([base isEqualToString:@"sources"]) {
+ controller = [[[SourcesController alloc] initWithDatabase:database_] autorelease];
+ }
+
+ if ([base isEqualToString:@"home"]) {
+ controller = [[[HomeController alloc] init] autorelease];
+ }
+
+ if ([base isEqualToString:@"sections"]) {
+ controller = [[[SectionsController alloc] initWithDatabase:database_] autorelease];
+ }
+
+ if ([base isEqualToString:@"search"]) {
+ controller = [[[SearchController alloc] initWithDatabase:database_] autorelease];
+ }
+
+ if ([base isEqualToString:@"changes"]) {
+ controller = [[[ChangesController alloc] initWithDatabase:database_] autorelease];
+ }
+
+ if ([base isEqualToString:@"installed"]) {
+ controller = [[[InstalledController alloc] initWithDatabase:database_] autorelease];
+ }
+ } else if ([components count] == 2) {
+ NSString *argument = [components objectAtIndex:1];
+
+ if ([base isEqualToString:@"package"]) {
+ controller = [self pageForPackage:argument];
+ }
+
+ if ([base isEqualToString:@"search"]) {
+ controller = [[[SearchController alloc] initWithDatabase:database_] autorelease];
+ [(SearchController *)controller setSearchTerm:argument];
+ }
+
+ if ([base isEqualToString:@"sections"]) {
+ if ([argument isEqualToString:@"all"])
+ argument = nil;
+ controller = [[[SectionController alloc] initWithDatabase:database_ section:argument] autorelease];
+ }
+
+ if ([base isEqualToString:@"sources"]) {
+ if ([argument isEqualToString:@"add"]) {
+ controller = [[[SourcesController alloc] initWithDatabase:database_] autorelease];
+ [(SourcesController *)controller showAddSourcePrompt];
+ } else {
+ NSArray *sources = [database_ sources];
+ for (Source *source in sources) {
+ if ([[source name] caseInsensitiveCompare:argument] == NSOrderedSame) {
+ controller = [[[SourceController alloc] initWithDatabase:database_ source:source] autorelease];
+ break;
+ }
+ }
+ }
+ }
+
+ if ([base isEqualToString:@"launch"]) {
+ [self launchApplicationWithIdentifier:argument suspended:NO];
+ return nil;
+ }
+ } else if ([components count] == 3) {
+ NSString *arg1 = [components objectAtIndex:1];
+ NSString *arg2 = [components objectAtIndex:2];
+
+ if ([base isEqualToString:@"package"]) {
+ if ([arg2 isEqualToString:@"settings"]) {
+ controller = [[[PackageSettingsController alloc] initWithDatabase:database_ package:arg1] autorelease];
+ } else if ([arg2 isEqualToString:@"signature"]) {
+ controller = [[[SignatureController alloc] initWithDatabase:database_ package:arg1] autorelease];
+ } else if ([arg2 isEqualToString:@"files"]) {
+ if (Package *package = [database_ packageWithName:arg1]) {
+ controller = [[[FileTable alloc] initWithDatabase:database_] autorelease];
+ [(FileTable *)controller setPackage:package];
+ }
+ }
}
}
- return nil;
+ [controller setDelegate:self];
+ return controller;
}
- (BOOL) openCydiaURL:(NSURL *)url {
- CYViewController *page = nil;
- int tag = 0;
+ CYViewController *page([self pageForURL:url]);
- if ((page = [self pageForURL:url hasTag:&tag])) {
- [self setPage:page];
- tag_ = tag;
- [tabbar_ setSelectedViewController:(tag_ == -1 ? nil : [[tabbar_ viewControllers] objectAtIndex:tag_])];
+ if (page != nil) {
+ CYNavigationController *nav = [[[CYNavigationController alloc] init] autorelease];
+ [nav setViewControllers:[NSArray arrayWithObject:page]];
+ [tabbar_ setTransientViewController:nav];
}
- return !!page;
+ return page != nil;
}
- (void) applicationOpenURL:(NSURL *)url {
@@ -8880,7 +8877,7 @@ static _finline void _setHomePage(Cydia *self) {
- (void) addStashController {
++locked_;
- stash_ = [[CYStashController alloc] init];
+ stash_ = [[StashController alloc] init];
[window_ addSubview:[stash_ view]];
}
@@ -8910,47 +8907,44 @@ static _finline void _setHomePage(Cydia *self) {
}
}
-- (void) setupTabBarController {
+- (void) setupViewControllers {
tabbar_ = [[CYTabBarController alloc] initWithDatabase:database_];
[tabbar_ setDelegate:self];
NSMutableArray *items([NSMutableArray arrayWithObjects:
- [[[UITabBarItem alloc] initWithTitle:@"Cydia" image:[UIImage applicationImageNamed:@"home.png"] tag:kCydiaTag] autorelease],
- [[[UITabBarItem alloc] initWithTitle:UCLocalize("SECTIONS") image:[UIImage applicationImageNamed:@"install.png"] tag:kSectionsTag] autorelease],
- [[[UITabBarItem alloc] initWithTitle:UCLocalize("CHANGES") image:[UIImage applicationImageNamed:@"changes.png"] tag:kChangesTag] autorelease],
- [[[UITabBarItem alloc] initWithTitle:UCLocalize("SEARCH") image:[UIImage applicationImageNamed:@"search.png"] tag:kSearchTag] autorelease],
+ [[[UITabBarItem alloc] initWithTitle:@"Cydia" image:[UIImage applicationImageNamed:@"home.png"] tag:0] autorelease],
+ [[[UITabBarItem alloc] initWithTitle:UCLocalize("SECTIONS") image:[UIImage applicationImageNamed:@"install.png"] tag:0] autorelease],
+ [[[UITabBarItem alloc] initWithTitle:UCLocalize("CHANGES") image:[UIImage applicationImageNamed:@"changes.png"] tag:0] autorelease],
+ [[[UITabBarItem alloc] initWithTitle:UCLocalize("SEARCH") image:[UIImage applicationImageNamed:@"search.png"] tag:0] autorelease],
nil]);
if (IsWildcat_) {
- [items insertObject:[[[UITabBarItem alloc] initWithTitle:UCLocalize("SOURCES") image:[UIImage applicationImageNamed:@"source.png"] tag:kSourcesTag] autorelease] atIndex:3];
- [items insertObject:[[[UITabBarItem alloc] initWithTitle:UCLocalize("INSTALLED") image:[UIImage applicationImageNamed:@"manage.png"] tag:kInstalledTag] autorelease] atIndex:3];
+ [items insertObject:[[[UITabBarItem alloc] initWithTitle:UCLocalize("SOURCES") image:[UIImage applicationImageNamed:@"source.png"] tag:0] autorelease] atIndex:3];
+ [items insertObject:[[[UITabBarItem alloc] initWithTitle:UCLocalize("INSTALLED") image:[UIImage applicationImageNamed:@"manage.png"] tag:0] autorelease] atIndex:3];
} else {
- [items insertObject:[[[UITabBarItem alloc] initWithTitle:UCLocalize("MANAGE") image:[UIImage applicationImageNamed:@"manage.png"] tag:kManageTag] autorelease] atIndex:3];
+ [items insertObject:[[[UITabBarItem alloc] initWithTitle:UCLocalize("MANAGE") image:[UIImage applicationImageNamed:@"manage.png"] tag:0] autorelease] atIndex:3];
}
NSMutableArray *controllers([NSMutableArray array]);
-
for (UITabBarItem *item in items) {
CYNavigationController *controller([[[CYNavigationController alloc] initWithDatabase:database_] autorelease]);
[controller setTabBarItem:item];
[controllers addObject:controller];
}
-
[tabbar_ setViewControllers:controllers];
+
+ [tabbar_ setUpdateDelegate:self];
}
-- (void)showFakeTabBarInView:(UIView *)view {
- static UITabBar *fake = [[UITabBar alloc] initWithFrame:CGRectMake(0, 0, 0, 49.0f)];
+- (CYEmulatedLoadingController *)showEmulatedLoadingControllerInView:(UIView *)view {
+ static CYEmulatedLoadingController *fake = [[CYEmulatedLoadingController alloc] init];
if (view != nil) {
- CGRect frame = [fake frame];
- frame.origin.y = [view frame].size.height - frame.size.height;
- frame.size.width = [view frame].size.width;
- [fake setFrame:frame];
- [fake setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin];
- [view addSubview:fake];
+ [view addSubview:[fake view]];
} else {
- [fake removeFromSuperview];
+ [[fake view] removeFromSuperview];
}
+
+ return fake;
}
- (void) applicationDidFinishLaunching:(id)unused {
@@ -8976,8 +8970,6 @@ _trace();
Font18Bold_ = [[UIFont boldSystemFontOfSize:18] retain];
Font22Bold_ = [[UIFont boldSystemFontOfSize:22] retain];
- tag_ = 0;
-
essential_ = [[NSMutableArray alloc] initWithCapacity:4];
broken_ = [[NSMutableArray alloc] initWithCapacity:4];
@@ -9008,13 +9000,9 @@ _trace();
database_ = [Database sharedInstance];
- [self setupTabBarController];
- [tabbar_ setUpdateDelegate:self];
- [window_ addSubview:[tabbar_ view]];
-
- // Show pinstripes while loading data.
- [[tabbar_ view] setBackgroundColor:[UIColor pinStripeColor]];
- [self showFakeTabBarInView:[tabbar_ tabBar]];
+ [window_ setUserInteractionEnabled:NO];
+ [self setupViewControllers];
+ [self showEmulatedLoadingControllerInView:window_];
[self performSelector:@selector(loadData) withObject:nil afterDelay:0];
_trace();
@@ -9023,37 +9011,38 @@ _trace();
- (void) loadData {
_trace();
if (Role_ == nil) {
- [self showSettings];
+ [window_ setUserInteractionEnabled:YES];
+
+ SettingsController *role = [[[SettingsController alloc] initWithDatabase:database_ delegate:self] autorelease];
+ CYNavigationController *nav = [[[CYNavigationController alloc] initWithRootViewController:role] autorelease];
+ if (IsWildcat_)
+ [nav setModalPresentationStyle:UIModalPresentationFormSheet];
+ [[self showEmulatedLoadingControllerInView:window_] presentModalViewController:nav animated:YES];
+
return;
+ } else {
+ if ([[self showEmulatedLoadingControllerInView:window_] modalViewController] != nil)
+ [[self showEmulatedLoadingControllerInView:window_] dismissModalViewControllerAnimated:YES];
+ [window_ setUserInteractionEnabled:NO];
}
- CGRect fixframe = [[tabbar_ view] frame];
- if (UIInterfaceOrientationIsLandscape([[UIApplication sharedApplication] statusBarOrientation]))
- fixframe.size = CGSizeMake(fixframe.size.height, fixframe.size.width);
- CYLoadingIndicator *loading = [[[CYLoadingIndicator alloc] initWithFrame:fixframe] autorelease];
- [loading setAutoresizingMask:UIViewAutoresizingFlexibleBoth];
- [[tabbar_ view] addSubview:loading];
- [window_ setUserInteractionEnabled:NO];
-
[self reloadData];
PrintTimes();
- // Show the initial page
- if (starturl_ == nil || ![self openCydiaURL:starturl_]) {
- [tabbar_ setSelectedIndex:0];
- _setHomePage(self);
- }
-
- [self showFakeTabBarInView:nil];
-
- [starturl_ release];
- starturl_ = nil;
-
+ [window_ addSubview:[tabbar_ view]];
+ [self showEmulatedLoadingControllerInView:nil];
[window_ setUserInteractionEnabled:YES];
- // XXX: does this actually slow anything down?
- [[tabbar_ view] setBackgroundColor:[UIColor clearColor]];
- [loading removeFromSuperview];
+ // Show the home page.
+ CYNavigationController *navigation = [[tabbar_ viewControllers] objectAtIndex:0];
+ [navigation setViewControllers:[NSArray arrayWithObject:[self pageForURL:[NSURL URLWithString:@"cydia://home"]]]];
+
+ // (Try to) show the startup URL.
+ if (starturl_ != nil) {
+ [self openCydiaURL:starturl_];
+ [starturl_ release];
+ starturl_ = nil;
+ }
}
- (void) showActionSheet:(UIActionSheet *)sheet fromItem:(UIBarButtonItem *)item {
@@ -9109,6 +9098,33 @@ MSHook(void, UIHardware$_playSystemSound$, Class self, SEL _cmd, int sound) {
}
}
+Class $UIApplication;
+
+MSHook(void, UIApplication$_updateApplicationAccessibility, UIApplication *self, SEL _cmd) {
+ static BOOL initialized = NO;
+ static BOOL started = NO;
+
+ NSDictionary *dict([[[NSDictionary alloc] initWithContentsOfFile:@"/var/mobile/Library/Preferences/com.apple.Accessibility.plist"] autorelease]);
+ BOOL enabled = [[dict objectForKey:@"VoiceOverTouchEnabled"] boolValue] || [[dict objectForKey:@"VoiceOverTouchEnabledByiTunes"] boolValue];
+
+ if ([self respondsToSelector:@selector(_accessibilityBundlePrincipalClass)]) {
+ id bundle = [self performSelector:@selector(_accessibilityBundlePrincipalClass)];
+ if (![bundle respondsToSelector:@selector(_accessibilityStopServer)]) return;
+ if (![bundle respondsToSelector:@selector(_accessibilityStartServer)]) return;
+
+ if (initialized && !enabled) {
+ initialized = NO;
+ [bundle performSelector:@selector(_accessibilityStopServer)];
+ } else if (enabled) {
+ initialized = YES;
+ if (!started) {
+ started = YES;
+ [bundle performSelector:@selector(_accessibilityStartServer)];
+ }
+ }
+ }
+}
+
int main(int argc, char *argv[]) { _pooled
_trace();
@@ -9136,6 +9152,13 @@ int main(int argc, char *argv[]) { _pooled
_UIHardware$_playSystemSound$ = reinterpret_cast<void (*)(Class, SEL, int)>(method_getImplementation(UIHardware$_playSystemSound$));
method_setImplementation(UIHardware$_playSystemSound$, reinterpret_cast<IMP>(&$UIHardware$_playSystemSound$));
}
+
+ $UIApplication = objc_getClass("UIApplication");
+ Method UIApplication$_updateApplicationAccessibility(class_getInstanceMethod($UIApplication, @selector(_updateApplicationAccessibility)));
+ if (UIApplication$_updateApplicationAccessibility != NULL) {
+ _UIApplication$_updateApplicationAccessibility = reinterpret_cast<void (*)(UIApplication *, SEL)>(method_getImplementation(UIApplication$_updateApplicationAccessibility));
+ method_setImplementation(UIApplication$_updateApplicationAccessibility, reinterpret_cast<IMP>(&$UIApplication$_updateApplicationAccessibility));
+ }
/* }}} */
/* Set Locale {{{ */
Locale_ = CFLocaleCopyCurrent();
diff --git a/UICaboodle/BrowserView.h b/UICaboodle/BrowserView.h
index f224326..efc1e6c 100644
--- a/UICaboodle/BrowserView.h
+++ b/UICaboodle/BrowserView.h
@@ -52,7 +52,7 @@
@protocol BrowserControllerDelegate
- (void) retainNetworkActivityIndicator;
- (void) releaseNetworkActivityIndicator;
-- (CYViewController *) pageForURL:(NSURL *)url hasTag:(int *)tag;
+- (CYViewController *) pageForURL:(NSURL *)url;
@end
@interface BrowserController : CYViewController <
diff --git a/UICaboodle/BrowserView.mm b/UICaboodle/BrowserView.mm
index 1017496..2abc02e 100644
--- a/UICaboodle/BrowserView.mm
+++ b/UICaboodle/BrowserView.mm
@@ -638,7 +638,7 @@ static void $UIWebViewWebViewDelegate$webViewClose$(UIWebViewWebViewDelegate *se
if ([scheme isEqualToString:@"mailto"])
[self _openMailToURL:url];
- CYViewController *page([delegate_ pageForURL:url hasTag:NULL]);
+ CYViewController *page([delegate_ pageForURL:url]);
if (page == nil) {
BrowserController *browser([[[class_ alloc] init] autorelease]);
@@ -653,13 +653,11 @@ static void $UIWebViewWebViewDelegate$webViewClose$(UIWebViewWebViewDelegate *se
[[self navigationController] pushViewController:page animated:YES];
} else {
- UCNavigationController *navigation([[[UCNavigationController alloc] init] autorelease]);
+ UCNavigationController *navigation([[[UCNavigationController alloc] initWithRootViewController:page] autorelease]);
[navigation setHook:indirect_];
[navigation setDelegate:delegate_];
- [navigation setViewControllers:[NSArray arrayWithObject:page]];
-
[[page navigationItem] setLeftBarButtonItem:[[[UIBarButtonItem alloc]
initWithTitle:UCLocalize("CLOSE")
style:UIBarButtonItemStylePlain
diff --git a/UICaboodle/RVPage.mm b/UICaboodle/RVPage.mm
index 4a8ea5d..3e6e692 100644
--- a/UICaboodle/RVPage.mm
+++ b/UICaboodle/RVPage.mm
@@ -5,17 +5,15 @@
#import "RVBook.h"
+extern bool IsWildcat_;
+
@implementation CYViewController
-- (void)setDelegate:(id)delegate {
+- (void) setDelegate:(id)delegate {
delegate_ = delegate;
}
- (void) reloadData {
}
-- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orientation {
- if ([self parentViewController]) {
- return [[self parentViewController] shouldAutorotateToInterfaceOrientation:orientation];
- } else {
- return [super shouldAutorotateToInterfaceOrientation:orientation];
- }
+- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orientation {
+ return IsWildcat_ || orientation == UIInterfaceOrientationPortrait;
}
@end
diff --git a/iPhonePrivate.h b/iPhonePrivate.h
index 149fdc8..96679a5 100644
--- a/iPhonePrivate.h
+++ b/iPhonePrivate.h
@@ -237,6 +237,9 @@ typedef enum {
@interface UITabBarController (Apple)
- (UITransitionView *) _transitionView;
+- (UIViewController *) transientViewController;
+- (void) setTransientViewController:(UIViewController *)controller;
+- (void) setTransientViewController:(UIViewController *)controller animated:(BOOL)animated;
@end
@interface UITabBarItem (Apple)
@@ -331,6 +334,10 @@ typedef enum {
- (void) setModalPresentationStyle:(UIModalPresentationStyle)style;
@end
+@interface UIApplication (iOS_3_0)
+@property(nonatomic) BOOL applicationSupportsShakeToEdit;
+@end
+
@interface UIScrollView (iOS_3_0)
@property(assign, nonatomic) float decelerationRate;
@end
@@ -347,6 +354,7 @@ extern float const UIScrollViewDecelerationRateNormal;
#if __IPHONE_OS_VERSION_MIN_REQUIRED < 30000
#define kSCNetworkReachabilityFlagsConnectionOnDemand (1 << 5)
+#define kCFCoreFoundationVersionNumber_iPhoneOS_3_0 478.47
#endif
// }}}