static CGFloat ScreenScale_;
static NSString *Idiom_;
+static NSMutableDictionary *SessionData_;
+static NSObject *HostConfig_;
static NSMutableSet *BridgedHosts_;
static NSMutableSet *PipelinedHosts_;
return @"getInstalledPackages";
else if (selector == @selector(getPackageById:))
return @"getPackageById";
+ else if (selector == @selector(getSessionValue:))
+ return @"getSessionValue";
else if (selector == @selector(installPackages:))
return @"installPackages";
else if (selector == @selector(localizedStringForKey:value:table:))
return @"refreshSources";
else if (selector == @selector(removeButton))
return @"removeButton";
+ else if (selector == @selector(setSessionValue::))
+ return @"setSessionValue";
else if (selector == @selector(substitutePackageNames:))
return @"substitutePackageNames";
else if (selector == @selector(scrollToBottom:))
return [NSString stringWithCString:value];
}
+- (id) getSessionValue:(NSString *)key {
+@synchronized (SessionData_) {
+ return [SessionData_ objectForKey:key];
+} }
+
+- (void) setSessionValue:(NSString *)key :(NSString *)value {
+@synchronized (SessionData_) {
+ if (value == (id) [WebUndefined undefined])
+ [SessionData_ removeObjectForKey:key];
+ else
+ [SessionData_ setObject:value forKey:key];
+} }
+
- (void) addBridgedHost:(NSString *)host {
- [BridgedHosts_ performSelectorOnMainThread:@selector(addObject:) withObject:host waitUntilDone:NO];
-}
+@synchronized (HostConfig_) {
+ [BridgedHosts_ addObject:host];
+} }
- (void) addPipelinedHost:(NSString *)host scheme:(NSString *)scheme {
+@synchronized (HostConfig_) {
if (scheme != (id) [WebUndefined undefined])
host = [NSString stringWithFormat:@"%@:%@", [scheme lowercaseString], host];
- [PipelinedHosts_ performSelectorOnMainThread:@selector(addObject:) withObject:host waitUntilDone:NO];
-}
+ [PipelinedHosts_ addObject:host];
+} }
- (void) popViewController:(NSNumber *)value {
if (value == (id) [WebUndefined undefined])
NSURLResponse *response([source response]);
NSURL *url([response URL]);
- if ([[[url scheme] lowercaseString] isEqualToString:@"https"])
- if ([BridgedHosts_ containsObject:[url host]])
- [window setValue:cydia_ forKey:@"cydia"];
+ @synchronized (HostConfig_) {
+ if ([[[url scheme] lowercaseString] isEqualToString:@"https"])
+ if ([BridgedHosts_ containsObject:[url host]])
+ [window setValue:cydia_ forKey:@"cydia"];
+ }
}
- (NSURLRequest *) webView:(WebView *)view resource:(id)resource willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)response fromDataSource:(WebDataSource *)source {
}
- (void) viewWillAppear:(BOOL)animated {
- if (![self hasLoaded])
- [[[self navigationController] navigationBar] setBarStyle:UIBarStyleBlack];
-
+ [[[self navigationController] navigationBar] setBarStyle:UIBarStyleBlack];
[super viewWillAppear:animated];
}
}
- (void) reloadData {
+ [super reloadData];
+
package_ = [database_ packageWithName:name_];
[buttons_ removeAllObjects];
target:self
action:@selector(customButtonClicked)
] autorelease];
-
- [super reloadData];
}
- (bool) isLoading {
NSMutableArray *sections_;
UITableView *list_;
unsigned upgrades_;
- BOOL hasSentFirstLoad_;
}
- (id) initWithDatabase:(Database *)database;
return [NSURL URLWithString:@"cydia://changes"];
}
-- (void) viewWillAppear:(BOOL)animated {
- // Loads after it appears, so don't load beforehand.
- loaded_ = YES;
- [super viewWillAppear:animated];
-}
-
- (void) viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
-
- if (!hasSentFirstLoad_) {
- hasSentFirstLoad_ = YES;
- [self performSelector:@selector(reloadData) withObject:nil afterDelay:0.0];
- } else {
- [list_ deselectRowAtIndexPath:[list_ indexPathForSelectedRow] animated:animated];
- }
+ [list_ deselectRowAtIndexPath:[list_ indexPathForSelectedRow] animated:animated];
}
- (NSInteger) numberOfSectionsInTableView:(UITableView *)list {
_trace();
}
-- (void) reloadData {
+- (void) _reloadData {
@synchronized (database_) {
era_ = [database_ era];
NSArray *packages = [database_ packages];
PrintTimes();
} }
+- (void) reloadData {
+ [super reloadData];
+ [self performSelector:@selector(_reloadData) withObject:nil afterDelay:0];
+}
+
@end
/* }}} */
/* Search Controller {{{ */
- (void) reloadData {
[self setObject:[search_ text]];
- [super reloadData];
[self resetCursor];
+
+ [super reloadData];
}
- (void) didSelectPackage:(Package *)package {
[key_ release];
key_ = [[source_ key] retain];
[self setObject:source_];
+
[[self navigationItem] setTitle:[source_ label]];
[super reloadData];
- (void) reloadData {
[super reloadData];
+
[table_ reloadData];
}
if ([self respondsToSelector:@selector(setApplicationSupportsShakeToEdit:)])
[self setApplicationSupportsShakeToEdit:NO];
- [BridgedHosts_ addObject:[[NSURL URLWithString:CydiaURL(@"")] host]];
+ @synchronized (HostConfig_) {
+ [BridgedHosts_ addObject:[[NSURL URLWithString:CydiaURL(@"")] host]];
+ }
[NSURLCache setSharedURLCache:[[[SDURLCache alloc]
initWithMemoryCapacity:524288
NSString *compound([NSString stringWithFormat:@"%@:%@", scheme, host]);
- if ([copy respondsToSelector:@selector(setHTTPShouldUsePipelining:)])
- if ([PipelinedHosts_ containsObject:host] || [PipelinedHosts_ containsObject:compound])
- [copy setHTTPShouldUsePipelining:YES];
+ @synchronized (HostConfig_) {
+ if ([copy respondsToSelector:@selector(setHTTPShouldUsePipelining:)])
+ if ([PipelinedHosts_ containsObject:host] || [PipelinedHosts_ containsObject:compound])
+ [copy setHTTPShouldUsePipelining:YES];
+ }
if ((self = _NSURLConnection$init$(self, _cmd, copy, delegate, usesCache, maxContentLength, startImmediately, connectionProperties)) != nil) {
} return self;
NSLog(@"unknown UIUserInterfaceIdiom!");
}
- BridgedHosts_ = [NSMutableSet setWithCapacity:2];
- PipelinedHosts_ = [NSMutableSet setWithCapacity:2];
+ SessionData_ = [[NSMutableDictionary alloc] initWithCapacity:4];
+
+ HostConfig_ = [[NSObject alloc] init];
+ @synchronized (HostConfig_) {
+ BridgedHosts_ = [NSMutableSet setWithCapacity:4];
+ PipelinedHosts_ = [NSMutableSet setWithCapacity:4];
+ }
UI_ = CydiaURL([NSString stringWithFormat:@"ui/ios~%@", Idiom_]);