From 3a83ebf72770222d02197f75e2dcccc3192396f5 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Sun, 3 Feb 2008 12:47:52 +0000 Subject: [PATCH] Renaming folder structure, added settings icon, and fixed crash bug for everyone but me. --- {data => Cydia.app}/Default.png | Bin {data => Cydia.app}/Info.plist | 0 {data => Cydia.app}/Test | 0 {data => Cydia.app}/changes-dn.png | Bin {data => Cydia.app}/changes-up.png | Bin {data => Cydia.app}/featured-dn.png | Bin {data => Cydia.app}/featured-up.png | Bin {data => Cydia.app}/folder.png | Bin {data => Cydia.app}/icon.png | Bin {data => Cydia.app}/install-dn.png | Bin {data => Cydia.app}/install-up.png | Bin {data => Cydia.app}/manage-dn.png | Bin {data => Cydia.app}/manage-up.png | Bin {data => Cydia.app}/pinstripe.png | Bin {data => Cydia.app}/reload.png | Bin {data => Cydia.app}/search-dn.png | Bin {data => Cydia.app}/search-up.png | Bin Cydia.mm | 50 ++++++++++++++++------------ 18 files changed, 28 insertions(+), 22 deletions(-) rename {data => Cydia.app}/Default.png (100%) rename {data => Cydia.app}/Info.plist (100%) rename {data => Cydia.app}/Test (100%) rename {data => Cydia.app}/changes-dn.png (100%) rename {data => Cydia.app}/changes-up.png (100%) rename {data => Cydia.app}/featured-dn.png (100%) rename {data => Cydia.app}/featured-up.png (100%) rename {data => Cydia.app}/folder.png (100%) rename {data => Cydia.app}/icon.png (100%) rename {data => Cydia.app}/install-dn.png (100%) rename {data => Cydia.app}/install-up.png (100%) rename {data => Cydia.app}/manage-dn.png (100%) rename {data => Cydia.app}/manage-up.png (100%) rename {data => Cydia.app}/pinstripe.png (100%) rename {data => Cydia.app}/reload.png (100%) rename {data => Cydia.app}/search-dn.png (100%) rename {data => Cydia.app}/search-up.png (100%) diff --git a/data/Default.png b/Cydia.app/Default.png similarity index 100% rename from data/Default.png rename to Cydia.app/Default.png diff --git a/data/Info.plist b/Cydia.app/Info.plist similarity index 100% rename from data/Info.plist rename to Cydia.app/Info.plist diff --git a/data/Test b/Cydia.app/Test similarity index 100% rename from data/Test rename to Cydia.app/Test diff --git a/data/changes-dn.png b/Cydia.app/changes-dn.png similarity index 100% rename from data/changes-dn.png rename to Cydia.app/changes-dn.png diff --git a/data/changes-up.png b/Cydia.app/changes-up.png similarity index 100% rename from data/changes-up.png rename to Cydia.app/changes-up.png diff --git a/data/featured-dn.png b/Cydia.app/featured-dn.png similarity index 100% rename from data/featured-dn.png rename to Cydia.app/featured-dn.png diff --git a/data/featured-up.png b/Cydia.app/featured-up.png similarity index 100% rename from data/featured-up.png rename to Cydia.app/featured-up.png diff --git a/data/folder.png b/Cydia.app/folder.png similarity index 100% rename from data/folder.png rename to Cydia.app/folder.png diff --git a/data/icon.png b/Cydia.app/icon.png similarity index 100% rename from data/icon.png rename to Cydia.app/icon.png diff --git a/data/install-dn.png b/Cydia.app/install-dn.png similarity index 100% rename from data/install-dn.png rename to Cydia.app/install-dn.png diff --git a/data/install-up.png b/Cydia.app/install-up.png similarity index 100% rename from data/install-up.png rename to Cydia.app/install-up.png diff --git a/data/manage-dn.png b/Cydia.app/manage-dn.png similarity index 100% rename from data/manage-dn.png rename to Cydia.app/manage-dn.png diff --git a/data/manage-up.png b/Cydia.app/manage-up.png similarity index 100% rename from data/manage-up.png rename to Cydia.app/manage-up.png diff --git a/data/pinstripe.png b/Cydia.app/pinstripe.png similarity index 100% rename from data/pinstripe.png rename to Cydia.app/pinstripe.png diff --git a/data/reload.png b/Cydia.app/reload.png similarity index 100% rename from data/reload.png rename to Cydia.app/reload.png diff --git a/data/search-dn.png b/Cydia.app/search-dn.png similarity index 100% rename from data/search-dn.png rename to Cydia.app/search-dn.png diff --git a/data/search-up.png b/Cydia.app/search-up.png similarity index 100% rename from data/search-up.png rename to Cydia.app/search-up.png diff --git a/Cydia.mm b/Cydia.mm index 9796f468..7ecd9a58 100644 --- a/Cydia.mm +++ b/Cydia.mm @@ -178,6 +178,23 @@ static NSMutableDictionary *Metadata_; static NSMutableDictionary *Packages_; static NSDate *now_; +NSString *GetLastUpdate() { + NSDate *update = [Metadata_ objectForKey:@"LastUpdate"]; + + if (update == nil) + return @"Never or Unknown"; + + CFLocaleRef locale = CFLocaleCopyCurrent(); + CFDateFormatterRef formatter = CFDateFormatterCreate(NULL, locale, kCFDateFormatterMediumStyle, kCFDateFormatterMediumStyle); + CFStringRef formatted = CFDateFormatterCreateStringWithDate(NULL, formatter, (CFDateRef) update); + + CFRelease(formatter); + CFRelease(formatted); + CFRelease(locale); + + return [(NSString *) formatted autorelease]; +} + @protocol ProgressDelegate - (void) setError:(NSString *)error; - (void) setTitle:(NSString *)title; @@ -590,17 +607,7 @@ inline float interpolate(float begin, float end, float fraction) { } - (void) setPrompt { - NSDate *update = [Metadata_ objectForKey:@"LastUpdate"]; - - CFLocaleRef locale = CFLocaleCopyCurrent(); - CFDateFormatterRef formatter = CFDateFormatterCreate(NULL, locale, kCFDateFormatterMediumStyle, kCFDateFormatterMediumStyle); - CFStringRef formatted = CFDateFormatterCreateStringWithDate(NULL, formatter, (CFDateRef) update); - - [navbar_ setPrompt:[NSString stringWithFormat:@"Last Updated: %@", (NSString *) formatted]]; - - CFRelease(formatter); - CFRelease(formatted); - CFRelease(locale); + [navbar_ setPrompt:[NSString stringWithFormat:@"Last Updated: %@", GetLastUpdate()]]; } @end @@ -898,6 +905,7 @@ NSString *Scour(const char *field, const char *begin, const char *end) { NSString *tagline_; NSString *icon_; NSString *bundle_; + NSString *website_; } - (void) dealloc; @@ -922,6 +930,7 @@ NSString *Scour(const char *field, const char *begin, const char *end) { - (NSString *) tagline; - (NSString *) icon; - (NSString *) bundle; +- (NSString *) website; - (BOOL) matches:(NSString *)text; @@ -978,6 +987,9 @@ NSString *Scour(const char *field, const char *begin, const char *end) { bundle_ = Scour("Bundle", begin, end); if (bundle_ != nil) bundle_ = [bundle_ retain]; + website_ = Scour("Website", begin, end); + if (website_ != nil) + website_ = [website_ retain]; NSMutableDictionary *metadata = [Packages_ objectForKey:id_]; if (metadata == nil) { @@ -1074,6 +1086,10 @@ NSString *Scour(const char *field, const char *begin, const char *end) { return bundle_; } +- (NSString *) website { + return website_; +} + - (BOOL) matches:(NSString *)text { if (text == nil) return NO; @@ -3142,17 +3158,7 @@ NSString *Scour(const char *field, const char *begin, const char *end) { } - (void) setPrompt { - NSDate *update = [Metadata_ objectForKey:@"LastUpdate"]; - - CFLocaleRef locale = CFLocaleCopyCurrent(); - CFDateFormatterRef formatter = CFDateFormatterCreate(NULL, locale, kCFDateFormatterMediumStyle, kCFDateFormatterMediumStyle); - CFStringRef formatted = CFDateFormatterCreateStringWithDate(NULL, formatter, (CFDateRef) update); - - [navbar_ setPrompt:[NSString stringWithFormat:@"Last Updated: %@", (NSString *) formatted]]; - - CFRelease(formatter); - CFRelease(formatted); - CFRelease(locale); + [navbar_ setPrompt:[NSString stringWithFormat:@"Last Updated: %@", GetLastUpdate()]]; } - (void) resolve { -- 2.45.2