From 06aa974d197d4fa545111221cb274aa5ba7a9e38 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Fri, 8 Feb 2008 22:33:14 +0000 Subject: [PATCH 1/1] Fixed various graphical artifacts. --- Cydia.app/configure.png | Bin 0 -> 832 bytes Cydia.mm | 104 ++++++++++++++++++++++++++++++---------- 2 files changed, 78 insertions(+), 26 deletions(-) create mode 100644 Cydia.app/configure.png diff --git a/Cydia.app/configure.png b/Cydia.app/configure.png new file mode 100644 index 0000000000000000000000000000000000000000..c27618d4922ae96d5a5c18bf356870cc21366495 GIT binary patch literal 832 zcmV-G1Hb%004R=004l4008tQ004y1003=Y008K0 z002CT000|UgXaf$00009a7bBm000XU000XU0RWnu7ytkQrb$FWRGpMPh|^#g$N#A~ z=#a&O8lxB$lPjV~JWeD-1y2yd?FJ>|s5deZ9 zST_vAsn_c@080db8Br9k=JRFK@gDL9kw_RC=aqUMCoa zNtQ~bOIwxDY&PGvTCI2KboxLhlQ|eJtynDHB(mA;4OLZ7<3Fudt34&E)#`(IJid1t zFdPowG#ZT-fbWtdw?PnB4?F>8n{l25?`Ul_lZ;wW!m0T`&OOm9M zVb1fsA4I?3e?G0Dx~>l;Nn(=82xGXGIF^bKaJ^jyDy1sHmj(rs)U`R z(dcU;kvI!rPrKc2`o6zP(=<(znU zH2+LRmStH{6lGFqI2?XkTU+}zKR-Vcnn++6hEcEA>zhu2D2ie#mAb%j+@XK`;uXuX z?wh7*Zgo$ 1) { + [navbar_ disableAnimation]; + while ([views_ count] != (clear ? 1 : 2)) + [navbar_ popNavigationItem]; + [navbar_ enableAnimation]; + if (!clear) + [navbar_ popNavigationItem]; + } + resetting_ = false; - [transition_ transition:0 toView:[views_ lastObject]]; + [self _resetView]; + [transition_ transition:(clear ? 0 : 2) toView:[views_ lastObject]]; } - (void) _resetView { @@ -659,6 +682,7 @@ void AddTextView(NSMutableDictionary *fields, NSMutableArray *packages, NSString @end @implementation ConfirmationView +#include "internals.h" - (void) dealloc { [transition_ release]; @@ -1276,7 +1300,7 @@ NSString *Scour(const char *field, const char *begin, const char *end) { - (int) preferencesTable:(UIPreferencesTable *)table numberOfRowsInGroup:(int)group { switch (group) { - case 0: return 2; + case 0: return [package_ website] == nil ? 2 : 3; case 1: return 5; case 2: return 0; @@ -1299,6 +1323,12 @@ NSString *Scour(const char *field, const char *begin, const char *end) { [cell addSubview:description_]; break; + case 2: + [cell setTitle:@"More Information"]; + [cell setShowDisclosure:YES]; + [cell setShowSelection:YES]; + break; + default: _assert(false); } break; @@ -1348,7 +1378,6 @@ NSString *Scour(const char *field, const char *begin, const char *end) { } - (void) tableRowSelected:(NSNotification *)notification { - printf("%d\n", [table_ selectedRow]); switch ([table_ selectedRow]) { case 8: [delegate_ openURL:[NSURL URLWithString:[NSString stringWithFormat:@"mailto:%@?subject=%@", @@ -2711,14 +2740,14 @@ NSString *Scour(const char *field, const char *begin, const char *end) { [view_ setPackage:npackage]; else if (package_ != nil) [self popViews:1]; - if ([views_ count] == 1) - [self _resetView]; + [self _resetView]; [self setPrompt]; } - (void) _resetView { - [navbar_ showButtonsWithLeftTitle:(count_ == 0 ? nil : @"Upgrade All") rightTitle:nil]; + if ([views_ count] == 1) + [navbar_ showButtonsWithLeftTitle:(count_ == 0 ? nil : @"Upgrade All") rightTitle:nil]; } - (size_t) count { @@ -2990,7 +3019,11 @@ NSString *Scour(const char *field, const char *begin, const char *end) { /* XXX: for the love of god just fix this */ [navbar_ removeFromSuperview]; + [reload_ removeFromSuperview]; + [configure_ removeFromSuperview]; [self addSubview:navbar_]; + [self addSubview:reload_]; + [self addSubview:configure_]; } return self; } @@ -3075,6 +3108,7 @@ NSString *Scour(const char *field, const char *begin, const char *end) { SearchView *search_; bool restart_; + unsigned tag_; UIKeyboard *keyboard_; } @@ -3099,11 +3133,14 @@ NSString *Scour(const char *field, const char *begin, const char *end) { - (void) view:(UIView *)sender didSetFrame:(CGRect)frame oldFrame:(CGRect)old; +- (void) webView:(WebView *)sender didReceiveTitle:(NSString *)title forFrame:(WebFrame *)frame; + - (void) applicationWillSuspend; - (void) applicationDidFinishLaunching:(id)unused; @end @implementation Cydia +#include "internals.h" - (void) loadNews { NSMutableURLRequest *request = [NSMutableURLRequest @@ -3116,7 +3153,6 @@ NSString *Scour(const char *field, const char *begin, const char *end) { [request addValue:[NSString stringWithCString:SerialNumber_] forHTTPHeaderField:@"X-Serial-Number"]; [webview_ loadRequest:request]; - [indicator_ startAnimation]; } - (void) reloadData:(BOOL)reset { @@ -3140,7 +3176,6 @@ NSString *Scour(const char *field, const char *begin, const char *end) { [changes_ setPackages:packages]; [manage_ setPackages:packages]; [search_ setPackages:packages]; - //[self setPrompt]; if (size_t count = [changes_ count]) { NSString *badge([[NSNumber numberWithInt:count] stringValue]); @@ -3280,8 +3315,9 @@ NSString *Scour(const char *field, const char *begin, const char *end) { - (void) buttonBarItemTapped:(id)sender { UIView *view; + unsigned tag = [sender tag]; - switch ([sender tag]) { + switch (tag) { case 1: view = featured_; break; case 2: view = install_; break; case 3: view = changes_; break; @@ -3292,19 +3328,30 @@ NSString *Scour(const char *field, const char *begin, const char *end) { _assert(false); } - if ([view respondsToSelector:@selector(resetView)]) - [(id) view resetView]; + if ([view respondsToSelector:@selector(resetView:)]) + [(id) view resetView:(tag == tag_ ? NO : YES)]; + tag_ = tag; [transition_ transition:0 toView:view]; } -- (void) view:(UIView *)view didSetFrame:(CGRect)frame oldFrame:(CGRect)old { +- (void) view:(UIView *)sender didSetFrame:(CGRect)frame oldFrame:(CGRect)old { [scroller_ setContentSize:frame.size]; [indicator_ stopAnimation]; } +- (void) webView:(WebView *)sender didReceiveTitle:(NSString *)title forFrame:(WebFrame *)frame { + [navbar_ setPrompt:title]; +} + +- (void) webView:(WebView *)sender didStartProvisionalLoadForFrame:(WebFrame *)frame { + [navbar_ setPrompt:@"Loading..."]; + [indicator_ startAnimation]; +} + - (void) applicationWillSuspend { if (restart_) system("launchctl stop com.apple.SpringBoard"); + [super applicationWillSuspend]; } - (void) applicationDidFinishLaunching:(id)unused { @@ -3313,6 +3360,7 @@ NSString *Scour(const char *field, const char *begin, const char *end) { confirm_ = nil; restart_ = false; + tag_ = 1; CGRect screenrect = [UIHardware fullScreenApplicationContentRect]; window_ = [[UIWindow alloc] initWithContentRect:screenrect]; @@ -3348,7 +3396,6 @@ NSString *Scour(const char *field, const char *begin, const char *end) { [navbar_ setBarStyle:1]; [navbar_ setDelegate:self]; - [navbar_ setPrompt:@"Welcome to Cydia Packager"]; [navbar_ showButtonsWithLeftTitle:@"About" rightTitle:@"Reload"]; @@ -3373,7 +3420,10 @@ NSString *Scour(const char *field, const char *begin, const char *end) { [scroller_ setScrollDecelerationFactor:0.99]; [scroller_ setDelegate:self]; - webview_ = [[UIWebView alloc] initWithFrame:[scroller_ bounds]]; + CGRect webrect = [scroller_ bounds]; + webrect.size.height = 0; + + webview_ = [[UIWebView alloc] initWithFrame:webrect]; [scroller_ addSubview:webview_]; [webview_ setTilingEnabled:YES]; @@ -3494,8 +3544,10 @@ NSString *Scour(const char *field, const char *begin, const char *end) { Package *package([database_ packageWithName:@"cydia"]); NSString *application = package == nil ? @"Cydia" : [NSString stringWithFormat:@"Cydia/%@", [package installed]]; + WebView *webview = [webview_ webView]; [webview setApplicationNameForUserAgent:application]; + [webview setFrameLoadDelegate:self]; url_ = [NSURL URLWithString:@"http://cydia.saurik.com/"]; [self loadNews]; -- 2.45.2