summaryrefslogtreecommitdiff
path: root/Cydia.mm
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2008-02-03 12:47:52 +0000
committerJay Freeman (saurik) <saurik@saurik.com>2008-02-03 12:47:52 +0000
commit23672b395e60e5a76f7ba01ba0b7ac7cf7957525 (patch)
treebd3c7e27071a87afdc72cd4193edc2c412051414 /Cydia.mm
parentf62038bb546ec54e73e629187eebe209d3b0fb2f (diff)
Renaming folder structure, added settings icon, and fixed crash bug for everyone but me.
Diffstat (limited to 'Cydia.mm')
-rw-r--r--Cydia.mm50
1 files changed, 28 insertions, 22 deletions
diff --git a/Cydia.mm b/Cydia.mm
index 9796f46..7ecd9a5 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 {