};
// }}}
+static NSString *Colon_;
+NSString *Elision_;
+static NSString *Error_;
+static NSString *Warning_;
+
static const NSUInteger UIViewAutoresizingFlexibleBoth(UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
static _finline NSString *CydiaURL(NSString *path) {
FILE *file(fopen("/etc/apt/sources.list.d/cydia.list", "w"));
_assert(file != NULL);
- fprintf(file, "deb http://%s/ tangelo main\n",
+ fprintf(file, "deb http://%s/ tangelo-3.7 main\n",
[CydiaSource_ UTF8String]
);
@class CYPackageController;
@protocol CydiaDelegate
+- (void) returnToCydia;
- (void) saveState;
- (void) retainNetworkActivityIndicator;
- (void) releaseNetworkActivityIndicator;
}
virtual void IMSHit(pkgAcquire::ItemDesc &item) {
+ Done(item);
}
virtual void Fetch(pkgAcquire::ItemDesc &item) {
}
virtual void Done(pkgAcquire::ItemDesc &item) {
+ NSString *name([NSString stringWithUTF8String:item.ShortDesc.c_str()]);
+ CydiaProgressEvent *event([CydiaProgressEvent eventWithMessage:[NSString stringWithFormat:Colon_, UCLocalize("DONE"), name] ofType:kCydiaProgressEventTypeStatus forItem:item]);
+ [delegate_ performSelectorOnMainThread:@selector(addProgressEvent:) withObject:event waitUntilDone:YES];
}
virtual void Fail(pkgAcquire::ItemDesc &item) {
if (!parser.ShortDesc(start, end))
return nil;
- if (end - start > 100)
- end = start + 100;
+ if (end - start > 200)
+ end = start + 200;
/*
if (const char *stop = reinterpret_cast<const char *>(memchr(start, '\n', end - start)))
string = [self shortDescription];
length = [string length];
- NSUInteger stop(std::min<NSUInteger>(length, 100));
+ NSUInteger stop(std::min<NSUInteger>(length, 200));
for (NSString *term in query) {
range = [string rangeOfString:term options:MatchCompareOptions_ range:NSMakeRange(0, stop)];
@end
/* }}} */
-static NSString *Colon_;
-NSString *Elision_;
-static NSString *Error_;
-static NSString *Warning_;
-
class CydiaLogCleaner :
public pkgArchiveCleaner
{
} return self;
}
+@end
+
+@interface AppCacheController : CydiaWebViewController {
+}
+
+@end
+
+@implementation AppCacheController
+
+- (void) didReceiveMemoryWarning {
+}
+
@end
/* }}} */
switch (Finish_) {
case 0:
+ [delegate_ returnToCydia];
break;
case 1:
badge_ = nil;
placard_ = nil;
- [package parse];
+ if (package == nil)
+ [content_ setBackgroundColor:[UIColor whiteColor]];
+ else {
+ [package parse];
- Source *source = [package source];
+ Source *source = [package source];
- icon_ = [package icon];
+ icon_ = [package icon];
- if (NSString *name = [package name])
- name_ = [NSString stringWithString:name];
+ if (NSString *name = [package name])
+ name_ = [NSString stringWithString:name];
- NSString *description(nil);
+ NSString *description(nil);
- if (description == nil && IsWildcat_)
- description = [package longDescription];
- if (description == nil)
- description = [package shortDescription];
+ if (description == nil && IsWildcat_)
+ description = [package longDescription];
+ if (description == nil)
+ description = [package shortDescription];
- if (description != nil)
- description_ = [NSString stringWithString:description];
+ if (description != nil)
+ description_ = [NSString stringWithString:description];
- commercial_ = [package isCommercial];
+ commercial_ = [package isCommercial];
- NSString *label = nil;
- bool trusted = false;
+ NSString *label = nil;
+ bool trusted = false;
- if (source != nil) {
- label = [source label];
- trusted = [source trusted];
- } else if ([[package id] isEqualToString:@"firmware"])
- label = UCLocalize("APPLE");
- else
- label = [NSString stringWithFormat:UCLocalize("SLASH_DELIMITED"), UCLocalize("UNKNOWN"), UCLocalize("LOCAL")];
+ if (source != nil) {
+ label = [source label];
+ trusted = [source trusted];
+ } else if ([[package id] isEqualToString:@"firmware"])
+ label = UCLocalize("APPLE");
+ else
+ label = [NSString stringWithFormat:UCLocalize("SLASH_DELIMITED"), UCLocalize("UNKNOWN"), UCLocalize("LOCAL")];
- NSString *from(label);
+ NSString *from(label);
- NSString *section = [package simpleSection];
- if (section != nil && ![section isEqualToString:label]) {
- section = [[NSBundle mainBundle] localizedStringForKey:section value:nil table:@"Sections"];
- from = [NSString stringWithFormat:UCLocalize("PARENTHETICAL"), from, section];
- }
+ NSString *section = [package simpleSection];
+ if (section != nil && ![section isEqualToString:label]) {
+ section = [[NSBundle mainBundle] localizedStringForKey:section value:nil table:@"Sections"];
+ from = [NSString stringWithFormat:UCLocalize("PARENTHETICAL"), from, section];
+ }
- source_ = [NSString stringWithFormat:UCLocalize("FROM"), from];
+ source_ = [NSString stringWithFormat:UCLocalize("FROM"), from];
- if (NSString *purpose = [package primaryPurpose])
- badge_ = [UIImage imageAtPath:[NSString stringWithFormat:@"%@/Purposes/%@.png", App_, purpose]];
+ if (NSString *purpose = [package primaryPurpose])
+ badge_ = [UIImage imageAtPath:[NSString stringWithFormat:@"%@/Purposes/%@.png", App_, purpose]];
- UIColor *color;
- NSString *placard;
+ UIColor *color;
+ NSString *placard;
- if (NSString *mode = [package mode]) {
- if ([mode isEqualToString:@"REMOVE"] || [mode isEqualToString:@"PURGE"]) {
- color = RemovingColor_;
- //placard = @"removing";
+ if (NSString *mode = [package mode]) {
+ if ([mode isEqualToString:@"REMOVE"] || [mode isEqualToString:@"PURGE"]) {
+ color = RemovingColor_;
+ //placard = @"removing";
+ } else {
+ color = InstallingColor_;
+ //placard = @"installing";
+ }
+
+ // XXX: the removing/installing placards are not @2x
+ placard = nil;
} else {
- color = InstallingColor_;
- //placard = @"installing";
+ color = [UIColor whiteColor];
+
+ if ([package installed] != nil)
+ placard = @"installed";
+ else
+ placard = nil;
}
- // XXX: the removing/installing placards are not @2x
- placard = nil;
- } else {
- color = [UIColor whiteColor];
+ [content_ setBackgroundColor:color];
- if ([package installed] != nil)
- placard = @"installed";
- else
- placard = nil;
+ if (placard != nil)
+ placard_ = [UIImage imageAtPath:[NSString stringWithFormat:@"%@/%@.png", App_, placard]];
}
- [content_ setBackgroundColor:color];
-
- if (placard != nil)
- placard_ = [UIImage imageAtPath:[NSString stringWithFormat:@"%@/%@.png", App_, placard]];
-
[self setNeedsDisplay];
[content_ setNeedsDisplay];
}
- (void) releaseSubviews {
list_ = nil;
+ package_ = nil;
+ files_ = nil;
+
[super releaseSubviews];
}
- (id) initWithDatabase:(Database *)database {
if ((self = [super init]) != nil) {
database_ = database;
-
- files_ = [NSMutableArray arrayWithCapacity:32];
} return self;
}
package_ = nil;
name_ = nil;
- [files_ removeAllObjects];
+ files_ = [NSMutableArray arrayWithCapacity:32];
if (package != nil) {
package_ = package;
if ((self = [super init]) != nil) {
database_ = database;
buttons_ = [NSMutableArray arrayWithCapacity:4];
- name_ = [NSString stringWithString:name];
+ name_ = name == nil ? @"" : [NSString stringWithString:name];
[self setURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@/#!/package/%@", UI_, (id) name_]]];
} return self;
}
database_ = database;
title_ = [title copy];
[[self navigationItem] setTitle:title_];
-
-#if TryIndexedCollation
- if ([[self class] hasIndexedCollation])
- index_ = [[objc_getClass("UILocalizedIndexedCollation") currentCollation] sectionIndexTitles];
- else
-#endif
- index_ = [NSMutableArray arrayWithCapacity:32];
-
- indices_ = [NSMutableDictionary dictionaryWithCapacity:32];
-
- packages_ = [NSArray array];
- sections_ = [NSMutableArray arrayWithCapacity:16];
} return self;
}
- (void) releaseSubviews {
list_ = nil;
+ packages_ = nil;
+ sections_ = nil;
+ index_ = nil;
+ indices_ = nil;
+
[super releaseSubviews];
}
packages_ = packages;
- [indices_ removeAllObjects];
- [sections_ removeAllObjects];
+ indices_ = [NSMutableDictionary dictionaryWithCapacity:32];
+ sections_ = [NSMutableArray arrayWithCapacity:16];
Section *section = nil;
#if TryIndexedCollation
if ([[self class] hasIndexedCollation]) {
+ index_ = [[objc_getClass("UILocalizedIndexedCollation") currentCollation] sectionIndexTitles];
+
id collation = [objc_getClass("UILocalizedIndexedCollation") currentCollation];
NSArray *titles = [collation sectionIndexTitles];
int secidx = -1;
} else
#endif
{
- [index_ removeAllObjects];
+ index_ = [NSMutableArray arrayWithCapacity:32];
bool sectioned([self showsSections]);
if (!sectioned) {
- (void) reloadData {
[super reloadData];
- [self performSelector:@selector(_reloadData) withObject:nil afterDelay:0];
+
+ if ([self shouldYield])
+ [self performSelector:@selector(_reloadData) withObject:nil afterDelay:0];
+ else
+ [self _reloadData];
}
- (void) resetCursor {
return [NSURL URLWithString:@"cydia://home"];
}
+- (void) didReceiveMemoryWarning {
+}
+
- (void) aboutButtonClicked {
UIAlertView *alert([[[UIAlertView alloc] init] autorelease]);
if (path == nil)
goto fail;
path = [path stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
- NSString *section(Simplify(path));
- UIImage *icon([UIImage imageAtPath:[NSString stringWithFormat:@"%@/Sections/%@.png", App_, [section stringByReplacingOccurrencesOfString:@" " withString:@"_"]]]);
+ UIImage *icon([UIImage imageAtPath:[NSString stringWithFormat:@"%@/Sections/%@.png", App_, [path stringByReplacingOccurrencesOfString:@" " withString:@"_"]]]);
if (icon == nil)
icon = [UIImage applicationImageNamed:@"unknown.png"];
[self _returnPNGWithImage:icon forRequest:request];
- (void) releaseSubviews {
list_ = nil;
+ sections_ = nil;
+ filtered_ = nil;
+
[super releaseSubviews];
}
- (id) initWithDatabase:(Database *)database {
if ((self = [super init]) != nil) {
database_ = database;
-
- sections_ = [NSMutableArray arrayWithCapacity:16];
- filtered_ = [NSMutableArray arrayWithCapacity:16];
} return self;
}
NSArray *packages = [database_ packages];
- [sections_ removeAllObjects];
- [filtered_ removeAllObjects];
+ sections_ = [NSMutableArray arrayWithCapacity:16];
+ filtered_ = [NSMutableArray arrayWithCapacity:16];
NSMutableDictionary *sections([NSMutableDictionary dictionaryWithCapacity:32]);
- (void) releaseSubviews {
list_ = nil;
+ packages_ = nil;
+ sections_ = nil;
+
[super releaseSubviews];
}
- (id) initWithDatabase:(Database *)database {
if ((self = [super init]) != nil) {
database_ = database;
-
- packages_ = [NSArray array];
- sections_ = [NSMutableArray arrayWithCapacity:16];
} return self;
}
goto reload;
packages_ = packages;
- [sections_ removeAllObjects];
+ sections_ = [NSMutableArray arrayWithCapacity:16];
Section *upgradable = [[[Section alloc] initWithName:UCLocalize("AVAILABLE_UPGRADES") localize:NO] autorelease];
Section *ignored = nil;
@implementation PackageSettingsController
- (NSURL *) navigationURL {
- return [NSURL URLWithString:[NSString stringWithFormat:@"cydia://package/%@/settings", [package_ id]]];
+ return [NSURL URLWithString:[NSString stringWithFormat:@"cydia://package/%@/settings", (id) name_]];
}
- (NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
@implementation SourceController
- (NSURL *) navigationURL {
- return [NSURL URLWithString:[NSString stringWithFormat:@"cydia://sources/%@", [source_ name]]];
+ return [NSURL URLWithString:[NSString stringWithFormat:@"cydia://sources/%@", [key_ stringByAddingPercentEscapesIncludingReserved]]];
}
- (id) initWithDatabase:(Database *)database source:(Source *)source {
- (void) releaseSubviews {
list_ = nil;
+ sources_ = nil;
+
[super releaseSubviews];
}
- (id) initWithDatabase:(Database *)database {
if ((self = [super init]) != nil) {
database_ = database;
- sources_ = [NSMutableArray arrayWithCapacity:16];
} return self;
}
if ([database_ popErrorWithTitle:UCLocalize("SOURCES") forOperation:list.ReadMainList()])
return;
- [sources_ removeAllObjects];
+ sources_ = [NSMutableArray arrayWithCapacity:16];
[sources_ addObjectsFromArray:[database_ sources]];
_trace();
[sources_ sortUsingSelector:@selector(compareByNameAndType:)];
}
}
+- (void) returnToCydia {
+ [self _loaded];
+}
+
- (void) _saveConfig {
_trace();
MetaFile_.Sync();
}
[self _updateData];
-
- [self refreshIfPossible];
} }
- (void) updateData {
- (void) reloadData {
[self reloadDataWithInvocation:nil];
+ if ([database_ progressDelegate] == nil)
+ [self _loaded];
}
- (void) syncData {
++locked_;
[self detachNewProgressSelector:@selector(perform_) toTarget:self forController:navigation title:@"RUNNING"];
--locked_;
+ [self refreshIfPossible];
}
- (void) showSettings {
}
- (UIProgressHUD *) addProgressHUD {
- UIProgressHUD *hud([[[UIProgressHUD alloc] initWithWindow:window_] autorelease]);
+ UIProgressHUD *hud([[[UIProgressHUD alloc] init] autorelease]);
[hud setAutoresizingMask:UIViewAutoresizingFlexibleBoth];
[window_ setUserInteractionEnabled:NO];
UIView *view([target view]);
[view addSubview:hud];
- [hud show:YES];
+ [hud showInView:[tabbar_ view]];
++locked_;
return hud;
- (void) removeProgressHUD:(UIProgressHUD *)hud {
--locked_;
- [hud show:NO];
+ [hud hide];
[hud removeFromSuperview];
[window_ setUserInteractionEnabled:YES];
}
controller = [[[SourcesController alloc] initWithDatabase:database_] autorelease];
[(SourcesController *)controller showAddSourcePrompt];
} else {
- Source *source = [database_ sourceWithKey:argument];
+ Source *source = [database_ sourceWithKey:[argument stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
controller = [[[SourceController alloc] initWithDatabase:database_ source:source] autorelease];
}
}
[tabbar_ setUpdateDelegate:self];
}
+- (void) _sendMemoryWarningNotification {
+ [[NSNotificationCenter defaultCenter] postNotificationName:@"UIApplicationDidReceiveMemoryWarningNotification" object:[UIApplication sharedApplication]];
+}
+
+- (void) _sendMemoryWarningNotifications {
+ while (true) {
+ [self performSelectorOnMainThread:@selector(_sendMemoryWarningNotification) withObject:nil waitUntilDone:NO];
+ usleep(250000);
+ }
+}
+
- (void) applicationDidFinishLaunching:(id)unused {
+ //[NSThread detachNewThreadSelector:@selector(_sendMemoryWarningNotifications) toTarget:self withObject:nil];
+
_trace();
if ([self respondsToSelector:@selector(setApplicationSupportsShakeToEdit:)])
[self setApplicationSupportsShakeToEdit:NO];
broken_ = [NSMutableArray arrayWithCapacity:4];
// XXX: I really need this thing... like, seriously... I'm sorry
- [[[CydiaWebViewController alloc] initWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@/appcache/", UI_]]] reloadData];
+ [[[AppCacheController alloc] initWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@/appcache/", UI_]]] reloadData];
window_ = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
[window_ orderFront:self];
[window_ setUserInteractionEnabled:NO];
}
- [self reloadData];
+ [self reloadDataWithInvocation:nil];
+ [self refreshIfPossible];
PrintTimes();
[self disemulate];
Version_ = [NSNumber numberWithUnsignedInt:1];
[Metadata_ setObject:Version_ forKey:@"Version"];
+ [Metadata_ removeObjectForKey:@"LastUpdate"];
+
Changed_ = true;
}
/* }}} */