]> git.saurik.com Git - cydia.git/commitdiff
Loading changes, visibility switches, gsc.wildcat issues, remote package catalog...
authorJay Freeman (saurik) <saurik@saurk.com>
Wed, 12 May 2010 10:03:01 +0000 (10:03 +0000)
committerJay Freeman (saurik) <saurik@saurik.com>
Thu, 30 Sep 2010 07:14:00 +0000 (07:14 +0000)
Cydia.app/package.js
Cydia.mm
Library/firmware.sh
Library/startup
UICaboodle/BrowserView.mm
control

index 104bd8c6826273a52b57ccdf33142ec648152d3a..8cca069f0d664e6563bd8356419bf5f51e6bf1e6 100644 (file)
@@ -34,7 +34,7 @@ function space(selector, html, max) {
 }
 
 function cache(url) {
-    return url.replace('://', '://ne.edgecastcdn.net/8003A4/');
+    return url.replace('://', '://wpc.03A4.edgecastcdn.net/8003A4/');
 }
 
 var swap_, swap = function (on, off, time) {
index 6bb8ee2267de3615f289b3db1c9de505c6f7bb5f..c967c5c0e7d118d134fb8d765fbbc0df89532220 100644 (file)
--- a/Cydia.mm
+++ b/Cydia.mm
@@ -1,5 +1,5 @@
 /* Cydia - iPhone UIKit Front-End for Debian APT
- * Copyright (C) 2008-2009  Jay Freeman (saurik)
+ * Copyright (C) 2008-2010  Jay Freeman (saurik)
 */
 
 /* Modified BSD License {{{ */
@@ -625,6 +625,19 @@ void CFArrayInsertionSortValues(CFMutableArrayRef array, CFRange range, CFCompar
 @end
 /* }}} */
 
+NSUInteger WebScriptObject$countByEnumeratingWithState$objects$count$(WebScriptObject *self, SEL sel, NSFastEnumerationState *state, id *objects, NSUInteger count) {
+    size_t length([self count] - state->state);
+    if (length <= 0)
+        return 0;
+    else if (length > count)
+        length = count;
+    for (size_t i(0); i != length; ++i)
+        objects[i] = [self objectAtIndex:state->state++];
+    state->itemsPtr = objects;
+    state->mutationsPtr = (unsigned long *) self;
+    return length;
+}
+
 NSUInteger DOMNodeList$countByEnumeratingWithState$objects$count$(DOMNodeList *self, SEL sel, NSFastEnumerationState *state, id *objects, NSUInteger count) {
     size_t length([self length] - state->state);
     if (length <= 0)
@@ -701,7 +714,7 @@ NSUInteger DOMNodeList$countByEnumeratingWithState$objects$count$(DOMNodeList *s
 - (NSString *) stringByCachingURLWithCurrentCDN {
     return [self
         stringByReplacingOccurrencesOfString:@"://"
-        withString:@"://ne.edgecastcdn.net/8003A4/"
+        withString:@"://wpc.03A4.edgecastcdn.net/8003A4/"
         options:0
         /* XXX: this is somewhat inaccurate */
         range:NSMakeRange(0, 10)
@@ -1203,6 +1216,7 @@ bool isSectionVisible(NSString *section) {
 - (void) setPackageView:(PackageView *)view;
 - (void) clearPackage:(Package *)package;
 - (void) installPackage:(Package *)package;
+- (void) installPackages:(NSArray *)packages;
 - (void) removePackage:(Package *)package;
 - (void) slideUp:(UIActionSheet *)alert;
 - (void) distUpgrade;
@@ -3611,6 +3625,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
 /* Web Scripting {{{ */
 @interface CydiaObject : NSObject {
     id indirect_;
+    id delegate_;
 }
 
 - (id) initWithDelegate:(IndirectDelegate *)indirect;
@@ -3629,6 +3644,10 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
     } return self;
 }
 
+- (void) setDelegate:(id)delegate {
+    delegate_ = delegate;
+}
+
 + (NSArray *) _attributeKeys {
     return [NSArray arrayWithObjects:@"device", @"firewire", @"imei", @"mac", @"serial", nil];
 }
@@ -3674,6 +3693,8 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
         return @"getInstalledPackages";
     else if (selector == @selector(getPackageById:))
         return @"getPackageById";
+    else if (selector == @selector(installPackages:))
+        return @"installPackages";
     else if (selector == @selector(setAutoPopup:))
         return @"setAutoPopup";
     else if (selector == @selector(setButtonImage:withStyle:toFunction:))
@@ -3715,7 +3736,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
 - (NSArray *) getInstalledPackages {
     NSArray *packages([[Database sharedInstance] packages]);
     NSMutableArray *installed([NSMutableArray arrayWithCapacity:[packages count]]);
-    for (Package *package in installed)
+    for (Package *package in packages)
         if ([package installed] != nil)
             [installed addObject:package];
     return installed;
@@ -3788,6 +3809,10 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
     [indirect_ close];
 }
 
+- (void) installPackages:(NSArray *)packages {
+    [delegate_ performSelectorOnMainThread:@selector(installPackages:) withObject:packages waitUntilDone:NO];
+}
+
 - (void) setAutoPopup:(BOOL)popup {
     [indirect_ setAutoPopup:popup];
 }
@@ -3879,7 +3904,11 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
     NSString *host([url host]);
     [self setHeaders:headers forHost:host];
 
-    if ([host isEqualToString:@"cydia.saurik.com"] || [scheme isEqualToString:@"file"])
+    if (
+        [host isEqualToString:@"cydia.saurik.com"] ||
+        [host hasSuffix:@".cydia.saurik.com"] ||
+        [scheme isEqualToString:@"file"]
+    )
         [window setValue:cydia_ forKey:@"cydia"];
 }
 
@@ -3900,6 +3929,11 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
     return copy;
 }
 
+- (void) setDelegate:(id)delegate {
+    [super setDelegate:delegate];
+    [cydia_ setDelegate:delegate];
+}
+
 - (id) initWithBook:(RVBook *)book forWidth:(float)width {
     if ((self = [super initWithBook:book forWidth:width ofClass:[CydiaBrowserView class]]) != nil) {
         cydia_ = [[CydiaObject alloc] initWithDelegate:indirect_];
@@ -4917,7 +4951,6 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
     if ((self = [super init]) != nil) {
         icon_ = [[UIImage applicationImageNamed:@"folder.png"] retain];
         switch_ = [[_UISwitchSlider alloc] initWithFrame:CGRectMake(218, 9, 60, 25)];
-        [switch_ setAutoresizingMask:UIViewAutoresizingFlexibleLeftMargin];
         [switch_ addTarget:self action:@selector(onSwitch:) forEvents:UIControlEventTouchUpInside];
     } return self;
 }
@@ -4964,6 +4997,12 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
     }
 }
 
+- (void) setFrame:(CGRect)frame {
+    [super setFrame:frame];
+    CGRect rect([switch_ frame]);
+    [switch_ setFrame:CGRectMake(frame.size.width - 102, 9, rect.size.width, rect.size.height)];
+}
+
 - (void) drawContentInRect:(CGRect)rect selected:(BOOL)selected {
     [icon_ drawInRect:CGRectMake(8, 7, 32, 32)];
 
@@ -4975,7 +5014,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
 
     float width(rect.size.width + 23);
     if (editing_)
-        width -= 86;
+        width -= 110;
 
     [name_ drawAtPoint:CGPointMake(48, 9) forWidth:(width - 70) withFont:Font22Bold_ ellipsis:2];
 
@@ -5933,15 +5972,15 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
     NSMutableURLRequest *request = [NSMutableURLRequest
         requestWithURL:[NSURL URLWithString:href]
         cachePolicy:NSURLRequestUseProtocolCachePolicy
-        timeoutInterval:20.0
+        timeoutInterval:120.0
     ];
 
     [request setHTTPMethod:method];
 
     if (Machine_ != NULL)
         [request setValue:[NSString stringWithUTF8String:Machine_] forHTTPHeaderField:@"X-Machine"];
-    if (Token_ != nil)
-        [request setValue:Token_ forHTTPHeaderField:@"X-Cydia-Token"];
+    if (UniqueID_ != nil)
+        [request setValue:UniqueID_ forHTTPHeaderField:@"X-Unique-ID"];
     if (Role_ != nil)
         [request setValue:Role_ forHTTPHeaderField:@"X-Role"];
 
@@ -6228,7 +6267,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
     [sheet setAutoresizingMask:(UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight)];
 
     [sheet setBodyText:
-        @"Copyright (C) 2008-2009\n"
+        @"Copyright (C) 2008-2010\n"
         "Jay Freeman (saurik)\n"
         "saurik@saurik.com\n"
         "http://www.saurik.com/\n"
@@ -6942,7 +6981,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
     unsigned upgrades_;
 }
 
-- (id) initWithBook:(RVBook *)book database:(Database *)database;
+- (id) initWithBook:(RVBook *)book database:(Database *)database delegate:(id)delegate;
 - (void) reloadData;
 
 @end
@@ -7013,7 +7052,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
     [delegate_ distUpgrade];
 }
 
-- (id) initWithBook:(RVBook *)book database:(Database *)database {
+- (id) initWithBook:(RVBook *)book database:(Database *)database delegate:(id)delegate {
     if ((self = [super initWithBook:book]) != nil) {
         database_ = database;
 
@@ -7029,18 +7068,14 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
         [list_ setDelegate:self];
         //[list_ setSectionListStyle:1];
 
+        delegate_ = delegate;
         [self reloadData];
 
         [self setAutoresizingMask:UIViewAutoresizingFlexibleBoth];
     } return self;
 }
 
-- (void) reloadData {
-    NSArray *packages = [database_ packages];
-
-    [packages_ removeAllObjects];
-    [sections_ removeAllObjects];
-
+- (void) _reloadPackages:(NSArray *)packages {
     _trace();
     for (Package *package in packages)
         if (
@@ -7052,6 +7087,20 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
     _trace();
     [packages_ radixSortUsingFunction:reinterpret_cast<SKRadixFunction>(&PackageChangesRadix) withContext:NULL];
     _trace();
+}
+
+- (void) reloadData {
+    NSArray *packages = [database_ packages];
+
+    [packages_ removeAllObjects];
+    [sections_ removeAllObjects];
+
+    UIProgressHUD *hud([delegate_ addProgressHUD]);
+    // XXX: localize
+    [hud setText:@"Loading Changes"];
+    NSLog(@"HUD:%@::%@", delegate_, hud);
+    [self yieldToSelector:@selector(_reloadPackages:) withObject:packages];
+    [delegate_ removeProgressHUD:hud];
 
     Section *upgradable = [[[Section alloc] initWithName:UCLocalize("AVAILABLE_UPGRADES") localize:NO] autorelease];
     Section *ignored = [[[Section alloc] initWithName:UCLocalize("IGNORED_UPGRADES") localize:NO] autorelease];
@@ -7858,6 +7907,15 @@ static _finline void _setHomePage(Cydia *self) {
     }
 }
 
+- (void) installPackages:(NSArray *)packages {
+    @synchronized (self) {
+        for (Package *package in packages)
+            [package install];
+        [self resolve];
+        [self perform];
+    }
+}
+
 - (void) installPackage:(Package *)package {
     @synchronized (self) {
         [package install];
@@ -7944,7 +8002,7 @@ static _finline void _setHomePage(Cydia *self) {
 
 - (ChangesView *) changesView {
     if (changes_ == nil)
-        changes_ = [[ChangesView alloc] initWithBook:book_ database:database_];
+        changes_ = [[ChangesView alloc] initWithBook:book_ database:database_ delegate:self];
     return changes_;
 }
 
@@ -8522,6 +8580,7 @@ int main(int argc, char *argv[]) { _pooled
     PackageName = reinterpret_cast<CYString &(*)(Package *, SEL)>(method_getImplementation(class_getInstanceMethod([Package class], @selector(cyname))));
 
     /* Library Hacks {{{ */
+    class_addMethod(objc_getClass("WebScriptObject"), @selector(countByEnumeratingWithState:objects:count:), (IMP) &WebScriptObject$countByEnumeratingWithState$objects$count$, "I20@0:4^{NSFastEnumerationState}8^@12I16");
     class_addMethod(objc_getClass("DOMNodeList"), @selector(countByEnumeratingWithState:objects:count:), (IMP) &DOMNodeList$countByEnumeratingWithState$objects$count$, "I20@0:4^{NSFastEnumerationState}8^@12I16");
 
     $WebDefaultUIKitDelegate = objc_getClass("WebDefaultUIKitDelegate");
@@ -8706,7 +8765,7 @@ int main(int argc, char *argv[]) { _pooled
     if (access("/tmp/.cydia.fw", F_OK) == 0) {
         unlink("/tmp/.cydia.fw");
         goto firmware;
-    } else if (access("/User", F_OK) != 0 || version < 1) {
+    } else if (access("/User", F_OK) != 0 || version < 2) {
       firmware:
         _trace();
         system("/usr/libexec/cydia/firmware.sh");
index bb5c228b4f779131c5f614fdb50f811f258833eb..d2c048898d29c9392e7736ed292d5141cebe4921 100755 (executable)
@@ -96,4 +96,4 @@ if [[ ! -h /User && -d /User ]]; then
     cp -afT /User /var/"${user}"
 fi && rm -rf /User && ln -s "/var/${user}" /User
 
-echo 1 >/var/lib/cydia/firmware.ver
+echo 2 >/var/lib/cydia/firmware.ver
index 171b8edfb928bfda30349c62537ac37842d00fed..7f8b616f349ab65bbc7861553a84043eef9b625e 100755 (executable)
@@ -1,6 +1,5 @@
 #!/bin/bash
 export PATH=$PATH:/usr/sbin:/usr/bin:/sbin:/bin
-/usr/libexec/cydia/firmware.sh
 debs=(/var/root/Media/Cydia/AutoInstall/*.deb)
 if [[ ${#debs[@]} -ne 0 && -f ${debs[0]} ]]; then
     dpkg -i "${debs[@]}"
index 134b25742919daee4c6d36fe61bc873b2d6a7e6a..13e6b08c4503489ec6fe7d77854483a1501c1a1f 100644 (file)
@@ -262,7 +262,7 @@ static Class $UIWebBrowserView;
     [self loadRequest:[NSURLRequest
         requestWithURL:url
         cachePolicy:policy
-        timeoutInterval:30.0
+        timeoutInterval:120.0
     ]];
 }
 
@@ -967,9 +967,11 @@ static Class $UIWebBrowserView;
 
         [book_ reloadTitleForPage:self];
 
-        CGRect webrect = [scroller_ bounds];
-        webrect.size.height = 1;
-        [webview_ setFrame:webrect];
+        if (Wildcat_) {
+            CGRect webrect = [scroller_ bounds];
+            webrect.size.height = 1;
+            [webview_ setFrame:webrect];
+        }
 
         if ([scroller_ respondsToSelector:@selector(scrollPointVisibleAtTopLeft:)])
             [scroller_ scrollPointVisibleAtTopLeft:CGPointZero];
@@ -982,6 +984,12 @@ static Class $UIWebBrowserView;
             [scroller_ _setZoomScale:1 duration:0];
         /*else if ([scroller_ respondsToSelector:@selector(setZoomScale:animated:)])
             [scroller_ setZoomScale:1 animated:NO];*/
+
+        if (!Wildcat_) {
+            CGRect webrect = [scroller_ bounds];
+            webrect.size.height = 0;
+            [webview_ setFrame:webrect];
+        }
     }
 
     [self reloadButtons];
diff --git a/control b/control
index 78f648ff47d3629c876eb7c4f42927db07a8acf6..3f0fefa1f686d3fe52bb45c48b12ad60c0a528fd 100644 (file)
--- a/control
+++ b/control
@@ -3,7 +3,7 @@ Priority: required
 Section: Packaging
 Maintainer: Jay Freeman (saurik) <saurik@saurik.com>
 Architecture: iphoneos-arm
-Version: 1.0.3171-1
+Version: 1.0.3188-1
 Replaces: com.sosiphone.addcydia
 Depends: apr-lib, apt7-lib, apt7-key, darwintools, pcre, sed, shell-cmds, system-cmds, uikittools
 Pre-Depends: dpkg (>= 1.14.25-8)