]> git.saurik.com Git - cydia.git/commitdiff
Fixed some bugs for deployment and added Sponsor.
authorJay Freeman (saurik) <saurik@saurik.com>
Sun, 22 Jun 2008 08:16:20 +0000 (08:16 +0000)
committerJay Freeman (saurik) <saurik@saurik.com>
Thu, 30 Sep 2010 07:08:06 +0000 (07:08 +0000)
Cydia.mm
makefile

index 4ebced7688f8382ca905dfad365a48000bff54a1..a773da849f5eb0f7a3df127a2eb7d0e6f9eaead6 100644 (file)
--- a/Cydia.mm
+++ b/Cydia.mm
@@ -135,6 +135,20 @@ extern "C" {
 #endif
 /* }}} */
 
+#ifdef __OBJC2__
+typedef enum {
+    kUIProgressIndicatorStyleMediumWhite = 1,
+    kUIProgressIndicatorStyleSmallWhite = 0,
+    kUIProgressIndicatorStyleSmallBlack = 4
+} UIProgressIndicatorStyle;
+#else
+typedef enum {
+    kUIProgressIndicatorStyleMediumWhite = 0,
+    kUIProgressIndicatorStyleSmallWhite = 2,
+    kUIProgressIndicatorStyleSmallBlack = 3
+} UIProgressIndicatorStyle;
+#endif
+
 typedef enum {
     kUIControlEventMouseDown = 1 << 0,
     kUIControlEventMouseMovedInside = 1 << 2, // mouse moved inside control target
@@ -908,6 +922,7 @@ NSString *Scour(const char *field, const char *begin, const char *end) {
     NSString *tagline_;
     NSString *icon_;
     NSString *website_;
+    Address *sponsor_;
     Address *author_;
 
     NSArray *relationships_;
@@ -985,6 +1000,8 @@ NSString *Scour(const char *field, const char *begin, const char *end) {
         [icon_ release];
     if (website_ != nil)
         [website_ release];
+    if (sponsor_ != nil)
+        [sponsor_ release];
     if (author_ != nil)
         [author_ release];
 
@@ -1032,9 +1049,12 @@ NSString *Scour(const char *field, const char *begin, const char *end) {
                 website_ = Scour("Website", begin, end);
             if (website_ != nil)
                 website_ = [website_ retain];
+            NSString *sponsor = Scour("Sponsor", begin, end);
+            if (sponsor != nil)
+                sponsor_ = [[Address addressWithString:sponsor] retain];
             NSString *author = Scour("Author", begin, end);
             if (author != nil)
-                author_ = [Address addressWithString:author];
+                author_ = [[Address addressWithString:author] retain];
         }
 
         NSMutableDictionary *metadata = [Packages_ objectForKey:id_];
@@ -1210,6 +1230,10 @@ NSString *Scour(const char *field, const char *begin, const char *end) {
     return website_;
 }
 
+- (Address *) sponsor {
+    return sponsor_;
+}
+
 - (Address *) author {
     return author_;
 }
@@ -2246,6 +2270,7 @@ Pcre conffile_r("^'(.*)' '(.*)' ([01]) ([01])$");
 
         [output_ setMarginTop:0];
         [output_ setAllowsRubberBanding:YES];
+        [output_ setEditable:NO];
 
         [overlay_ addSubview:output_];
 
@@ -2253,7 +2278,7 @@ Pcre conffile_r("^'(.*)' '(.*)' ([01]) ([01])$");
             10,
             bounds.size.height - prgsize.height - 50,
             bounds.size.width - 20,
-            26 + prgsize.height
+            32 + prgsize.height
         )];
 
         [close_ setAutosizesToFit:NO];
@@ -2308,6 +2333,9 @@ Pcre conffile_r("^'(.*)' '(.*)' ([01]) ([01])$");
 }
 
 - (void) _retachThread {
+    UINavigationItem *item = [navbar_ topItem];
+    [item setTitle:@"Complete"];
+
     [overlay_ addSubview:close_];
     [progress_ removeFromSuperview];
     [status_ removeFromSuperview];
@@ -2972,6 +3000,8 @@ Pcre conffile_r("^'(.*)' '(.*)' ([01]) ([01])$");
             ++number;
         if ([package_ maintainer] != nil)
             ++number;
+        if ([package_ sponsor] != nil)
+            ++number;
         if ([package_ relationships] != nil)
             ++number;
         if ([[package_ source] trusted])
@@ -3038,6 +3068,11 @@ Pcre conffile_r("^'(.*)' '(.*)' ([01]) ([01])$");
             [cell setValue:[[package_ maintainer] name]];
             [cell setShowDisclosure:YES];
             [cell setShowSelection:YES];
+        } else if ([package_ sponsor] != nil && row-- == 0) {
+            [cell setTitle:@"Sponsor"];
+            [cell setValue:[[package_ sponsor] name]];
+            [cell setShowDisclosure:YES];
+            [cell setShowSelection:YES];
         } else if ([package_ relationships] != nil && row-- == 0) {
             [cell setTitle:@"Package Relationships"];
             [cell setShowDisclosure:YES];
@@ -3116,6 +3151,12 @@ Pcre conffile_r("^'(.*)' '(.*)' ([01]) ([01])$");
                     [package_ name]
                 ] stringByAddingPercentEscapes]
             ]]];
+        } else if ([package_ sponsor] != nil && row-- == 0) {
+            NSURL *url = [NSURL URLWithString:[[package_ sponsor] email]];
+            BrowserView *browser = [[[BrowserView alloc] initWithBook:book_ database:database_] autorelease];
+            [browser setDelegate:delegate_];
+            [book_ pushPage:browser];
+            [browser loadURL:url];
         } else if ([package_ relationships] != nil && row-- == 0) {
         } else if ([[package_ source] trusted] && row-- == 0) {
     } _else if ([package_ source] != nil) {
@@ -3127,6 +3168,8 @@ Pcre conffile_r("^'(.*)' '(.*)' ([01]) ([01])$");
         } else if (description != nil && ![description isEqualToString:[source label]] && row-- == 0) {
         } else if ([source origin] != nil && row-- == 0) {
     } _else _assert(false);
+
+    #undef _else
 }
 
 - (void) _clickButtonWithName:(NSString *)name {
@@ -3627,9 +3670,9 @@ Pcre conffile_r("^'(.*)' '(.*)' ([01]) ([01])$");
         [webview_ setDelegate:self];
         //[webview_ setEnabledGestures:2];
 
-        CGSize indsize = [UIProgressIndicator defaultSizeForStyle:0];
+        CGSize indsize = [UIProgressIndicator defaultSizeForStyle:kUIProgressIndicatorStyleMediumWhite];
         indicator_ = [[UIProgressIndicator alloc] initWithFrame:CGRectMake(281, 42, indsize.width, indsize.height)];
-        [indicator_ setStyle:0];
+        [indicator_ setStyle:kUIProgressIndicatorStyleMediumWhite];
 
         Package *package([database_ packageWithName:@"cydia"]);
         NSString *application = package == nil ? @"Cydia" : [NSString
@@ -4293,13 +4336,13 @@ Pcre conffile_r("^'(.*)' '(.*)' ([01]) ([01])$");
         [traits setAutoCorrectionType:1];
 #endif
 
+        accessory_ = [[UIView alloc] initWithFrame:CGRectMake(0, 6, 6 + cnfrect.size.width + 6 + area.size.width + 6, area.size.height + 30)];
+        [accessory_ addSubview:field_];
+
         UIPushButton *configure = [[[UIPushButton alloc] initWithFrame:cnfrect] autorelease];
         [configure setShowPressFeedback:YES];
         [configure setImage:[UIImage applicationImageNamed:@"advanced.png"]];
         [configure addTarget:self action:@selector(configurePushed) forEvents:1];
-
-        accessory_ = [[UIView alloc] initWithFrame:CGRectMake(0, 6, cnfrect.size.width + area.size.width + 6 * 3, area.size.height + 30)];
-        [accessory_ addSubview:field_];
         [accessory_ addSubview:configure];
     } return self;
 }
@@ -4411,16 +4454,24 @@ Pcre conffile_r("^'(.*)' '(.*)' ([01]) ([01])$");
             [navbar_ setBarStyle:1];
 
         CGRect ovrrect = [navbar_ bounds];
-        ovrrect.size.height = [UINavigationBar defaultSizeWithPrompt].height - [UINavigationBar defaultSize].height;
+        ovrrect.size.height = ([UINavigationBar defaultSizeWithPrompt].height - [UINavigationBar defaultSize].height)
+#ifdef __OBJC2__
+            - 4
+#endif
+        ;
 
         overlay_ = [[UIView alloc] initWithFrame:ovrrect];
 
-        CGSize indsize = [UIProgressIndicator defaultSizeForStyle:2];
+        UIProgressIndicatorStyle style = Advanced_ ?
+            kUIProgressIndicatorStyleSmallWhite :
+            kUIProgressIndicatorStyleSmallBlack;
+
+        CGSize indsize = [UIProgressIndicator defaultSizeForStyle:style];
         unsigned indoffset = (ovrrect.size.height - indsize.height) / 2;
         CGRect indrect = {{indoffset, indoffset}, indsize};
 
         indicator_ = [[UIProgressIndicator alloc] initWithFrame:indrect];
-        [indicator_ setStyle:(Advanced_ ? 2 : 3)];
+        [indicator_ setStyle:style];
         [overlay_ addSubview:indicator_];
 
         CGSize prmsize = {200, indsize.width};
index 01003c4e459e9cefe5df64e81817a2a9dd720942..3491be4bddf89b345667fb11ff7b3ee03b1a6e5f 100644 (file)
--- a/makefile
+++ b/makefile
@@ -20,5 +20,6 @@ exec: exec.mm makefile
 
 Cydia: Cydia.mm ../uicaboodle.m/*.mm *.h makefile
        $(target)g++ -I../uicaboodle.m -fobjc-call-cxx-cdtors -g0 -O2 -Wall -Werror -o $@ $(filter %.mm,$^) -framework UIKit -framework IOKit -framework CoreFoundation -framework Foundation -framework CoreGraphics -framework GraphicsServices $(frameworks) -lobjc -lapt-pkg -lpcre -fobjc-exceptions -I/apl/i20 -F"$${PKG_ROOT}"/System/Library/PrivateFrameworks
+       #CODESIGN_ALLOCATE=$$(which "$(target)codesign_allocate") /apl/tel/util/ldid -S Cydia
 
 .PHONY: all clean