#include <CoreFoundation/CFPriv.h>
#include <CoreFoundation/CFUniChar.h>
+#include <SystemConfiguration/SystemConfiguration.h>
+
#include <UIKit/UIKit.h>
#include "iPhonePrivate.h"
#include <ext/hash_map>
#include "UICaboodle/BrowserView.h"
-#include "UICaboodle/ResetView.h"
#include "substrate.h"
-
-// Apple's sample Reachability code, ASPL licensed.
-#include "Reachability.h"
/* }}} */
/* Profiler {{{ */
} return self;
}
-- (void)_updateFrameForDisplay {
+- (void) _updateFrameForDisplay {
[super _updateFrameForDisplay];
if ([self cancelButtonIndex] == -1) {
NSArray *buttons = [self buttons];
#define lprintf(args...) fprintf(stderr, args)
-#define ForRelease 0
+#define ForRelease 1
#define TraceLogging (1 && !ForRelease)
#define HistogramInsertionSort (0 && !ForRelease)
#define ProfileTimes (0 && !ForRelease)
@end
/* }}} */
-NSUInteger WebScriptObject$countByEnumeratingWithState$objects$count$(WebScriptObject *self, SEL sel, NSFastEnumerationState *state, id *objects, NSUInteger count) {
+@implementation WebScriptObject (NSFastEnumeration)
+
+- (NSUInteger) countByEnumeratingWithState:(NSFastEnumerationState *)state objects:(id *)objects count:(NSUInteger)count {
size_t length([self count] - state->state);
if (length <= 0)
return 0;
return length;
}
+@end
+
NSUInteger DOMNodeList$countByEnumeratingWithState$objects$count$(DOMNodeList *self, SEL sel, NSFastEnumerationState *state, id *objects, NSUInteger count) {
size_t length([self length] - state->state);
if (length <= 0)
@end
/* }}} */
/* CoreGraphics Primitives {{{ */
-class CGColor {
+class CYColor {
private:
CGColorRef color_;
public:
- CGColor() :
+ CYColor() :
color_(NULL)
{
}
- CGColor(CGColorSpaceRef space, float red, float green, float blue, float alpha) :
+ CYColor(CGColorSpaceRef space, float red, float green, float blue, float alpha) :
color_(NULL)
{
Set(space, red, green, blue, alpha);
CGColorRelease(color_);
}
- ~CGColor() {
+ ~CYColor() {
Clear();
}
void Set(CGColorSpaceRef space, float red, float green, float blue, float alpha) {
Clear();
float color[] = {red, green, blue, alpha};
- color_ = CGColorCreate(space, color);
+ color_ = CGColorCreate(space, (CGFloat *) color);
}
operator CGColorRef() {
static bool Queuing_;
-static CGColor Blue_;
-static CGColor Blueish_;
-static CGColor Black_;
-static CGColor Off_;
-static CGColor White_;
-static CGColor Gray_;
-static CGColor Green_;
-static CGColor Purple_;
-static CGColor Purplish_;
+static CYColor Blue_;
+static CYColor Blueish_;
+static CYColor Black_;
+static CYColor Off_;
+static CYColor White_;
+static CYColor Gray_;
+static CYColor Green_;
+static CYColor Purple_;
+static CYColor Purplish_;
static UIColor *InstallingColor_;
static UIColor *RemovingColor_;
static UIFont *Font22Bold_;
static const char *Machine_ = NULL;
-static const NSString *System_ = NULL;
-static const NSString *SerialNumber_ = nil;
-static const NSString *ChipID_ = nil;
-static const NSString *Token_ = nil;
-static const NSString *UniqueID_ = nil;
-static const NSString *Build_ = nil;
-static const NSString *Product_ = nil;
-static const NSString *Safari_ = nil;
+static NSString *System_ = nil;
+static NSString *SerialNumber_ = nil;
+static NSString *ChipID_ = nil;
+static NSString *Token_ = nil;
+static NSString *UniqueID_ = nil;
+static NSString *Build_ = nil;
+static NSString *Product_ = nil;
+static NSString *Safari_ = nil;
static CFLocaleRef Locale_;
static NSArray *Languages_;
- (void) beginUpdate;
- (BOOL) updating;
- (void) distUpgrade;
+- (void) loadData;
- (void) updateData;
- (void) syncData;
- (void) showSettings;
- (UIProgressHUD *) addProgressHUD;
- (void) removeProgressHUD:(UIProgressHUD *)hud;
-- (UCViewController *) pageForPackage:(NSString *)name;
+- (CYViewController *) pageForPackage:(NSString *)name;
- (PackageController *) packageController;
- (void) showActionSheet:(UIActionSheet *)sheet fromItem:(UIBarButtonItem *)item;
@end
- (void) setProgressError:(NSString *)error forPackage:(NSString *)id {
Package *package = id == nil ? nil : [[Database sharedInstance] packageWithName:id];
- // XXX: holy typecast batman!
- [(id<ProgressDelegate>)self setProgressError:error withTitle:(package == nil ? id : [package name])];
+
+ [self performSelector:@selector(setProgressError:withTitle:)
+ withObject:error
+ withObject:(package == nil ? id : [package name])
+ ];
}
@end
UIImage *icon(nil);
if (!icon_.empty())
if ([icon_ hasPrefix:@"file:///"])
+ // XXX: correct escaping
icon = [UIImage imageAtPath:[icon_ substringFromIndex:7]];
if (icon == nil) if (section != nil)
icon = [UIImage imageAtPath:[NSString stringWithFormat:@"%@/Sections/%@.png", App_, section]];
if (icon == nil) if (source_ != nil) if (NSString *dicon = [source_ defaultIcon])
if ([dicon hasPrefix:@"file:///"])
+ // XXX: correct escaping
icon = [UIImage imageAtPath:[dicon substringFromIndex:7]];
if (icon == nil)
icon = [UIImage applicationImageNamed:@"unknown.png"];
return iterator.end() ? nil : [Package packageWithIterator:iterator withZone:NULL inPool:pool_ database:self];
} }
-- (Database *) init {
+- (id) init {
if ((self = [super init]) != nil) {
policy_ = NULL;
records_ = NULL;
return;
if ([self popErrorWithTitle:title forOperation:ListUpdate(status, list, PulseInterval_)])
- /* XXX: ignore this because users suck and don't understand why refreshing is important: return */;
+ /* XXX: ignore this because users suck and don't understand why refreshing is important: return */
+ /* XXX: why the hell is an empty if statement a clang error? */ (void) 0;
[Metadata_ setObject:[NSDate date] forKey:@"LastUpdate"];
Changed_ = true;
id values[count];
for (unsigned i(0); i != count; ++i)
values[i] = [arguments objectAtIndex:i];
- return [[[NSString alloc] initWithFormat:format arguments:reinterpret_cast<va_list>(values)] autorelease];
+ return [[[NSString alloc] initWithFormat:format arguments:*(reinterpret_cast<va_list *>(&values))] autorelease];
}
- (NSString *) localizedStringForKey:(NSString *)key value:(NSString *)value table:(NSString *)table {
@end
/* }}} */
-/* Cydia View Controller {{{ */
-@interface CYViewController : UCViewController { }
-@end
-
-@implementation CYViewController
-@end
-/* }}} */
-
+/* Cydia Browser Controller {{{ */
@interface CYBrowserController : BrowserController {
CydiaObject *cydia_;
}
}
@end
+/* }}} */
+/* Confirmation {{{ */
@protocol ConfirmationControllerDelegate
- (void) cancelAndClear:(bool)clear;
- (void) confirmWithNavigationController:(UINavigationController *)navigation;
[super dealloc];
}
-- (int) tableView:(UITableView *)tableView numberOfRowsInSection:(int)section {
+- (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return files_ == nil ? 0 : [files_ count];
}
}
}
+// We don't want to allow non-commercial packages to do custom things to the install button,
+// so it must call customButtonClicked with a custom commercial_ == 1 fallthrough.
- (void) customButtonClicked {
- // Wait until it's done loading.
- if (![self isLoading])
+ if (commercial_)
+ [super customButtonClicked];
+ else
[self _customButtonClicked];
}
- (void) applyLoadingTitle {
// Don't show "Loading" as the title. Ever.
}
+
+- (UIBarButtonItem *) rightButton {
+ int count = [buttons_ count];
+ return [[[UIBarButtonItem alloc]
+ initWithTitle:count == 0 ? nil : count != 1 ? UCLocalize("MODIFY") : [buttons_ objectAtIndex:0]
+ style:UIBarButtonItemStylePlain
+ target:self
+ action:@selector(customButtonClicked)
+ ] autorelease];
+}
#endif
- (id) initWithDatabase:(Database *)database {
}
}
-- (void) applyRightButton {
- int count = [buttons_ count];
- UIBarButtonItem *actionItem = [[UIBarButtonItem alloc]
- initWithTitle:count == 0 ? nil : count != 1 ? UCLocalize("MODIFY") : [buttons_ objectAtIndex:0]
- style:UIBarButtonItemStylePlain
- target:self
- action:@selector(customButtonClicked)
- ];
- if (![self isLoading]) [[self navigationItem] setRightBarButtonItem:actionItem];
- else [super applyRightButton];
- [actionItem release];
-}
-
- (bool) isLoading {
return commercial_ ? [super isLoading] : false;
}
[[self navigationController] pushViewController:view animated:YES];
}
-- (id) title { return title_; }
+- (NSString *) title { return title_; }
- (id) initWithDatabase:(Database *)database title:(NSString *)title filter:(SEL)filter with:(id)object {
if ((self = [super init]) != nil) {
[list_ deselectRowAtIndexPath:[list_ indexPathForSelectedRow] animated:animated];
}
-- (int) numberOfSectionsInTableView:(UITableView *)tableView {
+- (NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
return offset_ == 0 ? 1 : 2;
}
-- (NSString *) tableView:(UITableView *)tableView titleForHeaderInSection:(int)section {
+- (NSString *) tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
switch (section + (offset_ == 0 ? 1 : 0)) {
case 0: return UCLocalize("ENTERED_BY_USER");
case 1: return UCLocalize("INSTALLED_BY_PACKAGE");
}
}
-- (int) tableView:(UITableView *)tableView numberOfRowsInSection:(int)section {
+- (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
int count = [sources_ count];
switch (section) {
case 0: return (offset_ == 0 ? count : offset_);
[self _endConnection:connection];
}
-- (id)title { return UCLocalize("SOURCES"); }
+- (NSString *) title { return UCLocalize("SOURCES"); }
- (NSURLConnection *) _requestHRef:(NSString *)href method:(NSString *)method {
NSMutableURLRequest *request = [NSMutableURLRequest
[super dealloc];
}
-- (id) title { return UCLocalize("INSTALLED"); }
+- (NSString *) title { return UCLocalize("INSTALLED"); }
- (id) initWithDatabase:(Database *)database {
if ((self = [super initWithDatabase:database title:UCLocalize("INSTALLED") filter:@selector(isInstalledAndVisible:) with:[NSNumber numberWithBool:YES]]) != nil) {
}
}
-- (id) initWithDatabase: (Database *)database {
+- (id) initWithDatabase:(Database *)database {
if ((self = [super init]) != nil) {
database_ = database;
} return self;
/* Cydia Navigation Controller {{{ */
@interface CYNavigationController : UINavigationController {
_transient Database *database_;
- id delegate_;
+ id<UINavigationControllerDelegate> delegate_;
}
- (id) initWithDatabase:(Database *)database;
}
}
-- (void) setDelegate:(id)delegate {
+- (void) setDelegate:(id<UINavigationControllerDelegate>)delegate {
delegate_ = delegate;
}
return section;
}
-- (int) tableView:(UITableView *)tableView numberOfRowsInSection:(int)section {
+- (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return editing_ ? [sections_ count] : [filtered_ count] + 1;
}
[[self navigationController] pushViewController:table animated:YES];
}
-- (id) title { return UCLocalize("SECTIONS"); }
+- (NSString *) title { return UCLocalize("SECTIONS"); }
- (id) initWithDatabase:(Database *)database {
if ((self = [super init]) != nil) {
[delegate_ distUpgrade];
}
-- (id) title { return UCLocalize("CHANGES"); }
+- (NSString *) title { return UCLocalize("CHANGES"); }
- (id) initWithDatabase:(Database *)database delegate:(id)delegate {
if ((self = [super init]) != nil) {
[super dealloc];
}
-- (void) searchBarSearchButtonClicked:(id)searchBar {
+- (void) searchBarSearchButtonClicked:(UISearchBar *)searchBar {
[packages_ setObject:[search_ text] forFilter:@selector(isUnfilteredAndSearchedForBy:)];
[search_ resignFirstResponder];
[self reloadData];
}
-- (void) searchBar:(id)searchBar textDidChange:(NSString *)text {
+- (void) searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)text {
[packages_ setObject:text forFilter:@selector(isUnfilteredAndSelectedForBy:)];
[self reloadData];
}
-- (id) title { return nil; }
+- (NSString *) title { return nil; }
- (id) initWithDatabase:(Database *)database {
return [super initWithDatabase:database title:UCLocalize("SEARCH") filter:@selector(isUnfilteredAndSearchedForBy:) with:nil];
return nil;
}
-- (id) title { return UCLocalize("SETTINGS"); }
+- (NSString *) title { return UCLocalize("SETTINGS"); }
- (id) initWithDatabase:(Database *)database package:(NSString *)package {
if ((self = [super init])) {
}
- (void) save {
- NSString *role = nil;
+ NSString *role(nil);
switch ([segment_ selectedSegmentIndex]) {
case 0: role = @"User"; break;
}
if (![role isEqualToString:Role_]) {
+ bool rolling(Role_ == nil);
Role_ = role;
Settings_ = [NSMutableDictionary dictionaryWithObjectsAndKeys:
Changed_ = true;
- [roledelegate_ updateData];
+ if (rolling)
+ [roledelegate_ loadData];
+ else
+ [roledelegate_ updateData];
}
}
}
- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orientation {
- return YES; /* XXX: return YES; */
+ return IsWildcat_;
}
- (void) setTabBarController:(UITabBarController *)controller {
if (animated) [UIView beginAnimations:nil context:NULL];
CGRect barframe = [refreshbar_ frame];
CGRect viewframe = [[root_ view] frame];
- viewframe.origin.y += barframe.size.height + 20.0f;
- viewframe.size.height -= barframe.size.height + 20.0f;
+ viewframe.origin.y += barframe.size.height;
+ viewframe.size.height -= barframe.size.height;
[[root_ view] setFrame:viewframe];
if (animated) [UIView commitAnimations];
if (animated) [UIView beginAnimations:nil context:NULL];
CGRect barframe = [refreshbar_ frame];
CGRect viewframe = [[root_ view] frame];
- viewframe.origin.y -= barframe.size.height + 20.0f;
- viewframe.size.height += barframe.size.height + 20.0f;
+ viewframe.origin.y -= barframe.size.height;
+ viewframe.size.height += barframe.size.height;
[[root_ view] setFrame:viewframe];
if (animated) [UIView commitAnimations];
[super dealloc];
}
-- (id) initWithDatabase: (Database *)database {
+- (id) initWithDatabase:(Database *)database {
if ((self = [super init]) != nil) {
database_ = database;
@interface Cydia : UIApplication <
ConfirmationControllerDelegate,
ProgressControllerDelegate,
- CydiaDelegate
+ CydiaDelegate,
+ UINavigationControllerDelegate
> {
UIWindow *window_;
CYContainer *container_;
bool loaded_;
}
-- (UCViewController *) _pageForURL:(NSURL *)url withClass:(Class)_class;
-- (void) setPage:(UCViewController *)page;
+- (CYViewController *) _pageForURL:(NSURL *)url withClass:(Class)_class;
+- (void) setPage:(CYViewController *)page;
+- (void) loadData;
@end
- (void) _refreshIfPossible {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
- Reachability* reachability = [Reachability reachabilityWithHostName:@"cydia.saurik.com"];
- NetworkStatus remoteHostStatus = [reachability currentReachabilityStatus];
+ SCNetworkReachabilityFlags flags; {
+ SCNetworkReachabilityRef reachability(SCNetworkReachabilityCreateWithName(NULL, "cydia.saurik.com"));
+ SCNetworkReachabilityGetFlags(reachability, &flags);
+ CFRelease(reachability);
+ }
+
+ // XXX: this elaborate mess is what Apple is using to determine this? :(
+ // XXX: do we care if the user has to intervene? maybe that's ok?
+ bool reachable(
+ (flags & kSCNetworkReachabilityFlagsReachable) != 0 && (
+ (flags & kSCNetworkReachabilityFlagsConnectionRequired) == 0 || (
+ (flags & kSCNetworkReachabilityFlagsConnectionOnDemand) != 0 ||
+ (flags & kSCNetworkReachabilityFlagsConnectionOnTraffic) != 0
+ ) && (flags & kSCNetworkReachabilityFlagsInterventionRequired) == 0 ||
+ (flags & kSCNetworkReachabilityFlagsIsWWAN) != 0
+ )
+ );
- if (loaded_ || ManualRefresh || remoteHostStatus == NotReachable) loaded:
+ if (loaded_ || ManualRefresh || !reachable) loaded:
[self performSelectorOnMainThread:@selector(_loaded) withObject:nil waitUntilDone:NO];
else {
loaded_ = true;
}
- (void) _reloadData {
- UIView *block();
-
UIProgressHUD *hud([self addProgressHUD]);
[hud setText:(loaded_ ? UCLocalize("RELOADING_DATA") : UCLocalize("LOADING_DATA"))];
[self _saveConfig];
ProgressController *progress = [[[ProgressController alloc] initWithDatabase:database_ delegate:self] autorelease];
- UINavigationController *navigation = [[[CYNavigationController alloc] initWithRootViewController:progress] autorelease];
+ CYNavigationController *navigation = [[[CYNavigationController alloc] initWithRootViewController:progress] autorelease];
if (IsWildcat_) [navigation setModalPresentationStyle:UIModalPresentationFormSheet];
[container_ presentModalViewController:navigation animated:YES];
ConfirmationController *page([[[ConfirmationController alloc] initWithDatabase:database_] autorelease]);
[page setDelegate:self];
- id confirm_ = [[CYNavigationController alloc] initWithRootViewController:page];
+ CYNavigationController *confirm_ = [[CYNavigationController alloc] initWithRootViewController:page];
[confirm_ setDelegate:self];
if (IsWildcat_) [confirm_ setModalPresentationStyle:UIModalPresentationFormSheet];
[self complete];
}
-- (void) setPage:(UCViewController *)page {
+- (void) setPage:(CYViewController *)page {
[page setDelegate:self];
CYNavigationController *navController = (CYNavigationController *) [tabbar_ selectedViewController];
}
}
-- (UCViewController *) _pageForURL:(NSURL *)url withClass:(Class)_class {
+- (CYViewController *) _pageForURL:(NSURL *)url withClass:(Class)_class {
CYBrowserController *browser = [[[_class alloc] init] autorelease];
[browser loadURL:url];
return browser;
- (void) cancelAndClear:(bool)clear {
@synchronized (self) {
if (clear) {
- /* XXX: clear marks instead of reloading data */
- /*pkgCacheFile &cache([database_ cache]);
+ // Clear all marks.
+ pkgCacheFile &cache([database_ cache]);
for (pkgCache::PkgIterator iterator = cache->PkgBegin(); !iterator.end(); ++iterator) {
- if (!cache[iterator].Keep()) cache->MarkKeep(iterator, false, false);
+ // Unmark method taken from Synaptic Package Manager.
+ // Thanks for being sane, unlike Aptitude.
+ if (!cache[iterator].Keep()) {
+ cache->MarkKeep(iterator, false);
+ cache->SetReInstall(iterator, false);
+ }
}
- [self updateData];
-
+ // Stop queuing, and let the appropriate controller know it.
Queuing_ = false;
[[[[tabbar_ viewControllers] objectAtIndex:[self indexOfTabWithTag:kManageTag] != -1 ? [self indexOfTabWithTag:kManageTag] : [self indexOfTabWithTag:kInstalledTag]] tabBarItem] setBadgeValue:nil];
- [queueDelegate_ queueStatusDidChange];*/
- [self reloadData];
+ [queueDelegate_ queueStatusDidChange];
} else {
+ // Start queuing, and let the controllers know.
Queuing_ = true;
[[[[tabbar_ viewControllers] objectAtIndex:[self indexOfTabWithTag:kManageTag] != -1 ? [self indexOfTabWithTag:kManageTag] : [self indexOfTabWithTag:kInstalledTag]] tabBarItem] setBadgeValue:UCLocalize("Q_D")];
[window_ setUserInteractionEnabled:YES];
}
-- (UCViewController *) pageForPackage:(NSString *)name {
+- (CYViewController *) pageForPackage:(NSString *)name {
if (Package *package = [database_ packageWithName:name]) {
PackageController *view([self packageController]);
[view setPackage:package];
}
}
-- (UCViewController *) pageForURL:(NSURL *)url hasTag:(int *)tag {
+- (CYViewController *) pageForURL:(NSURL *)url hasTag:(int *)tag {
if (tag != NULL)
*tag = -1;
- (void) applicationOpenURL:(NSURL *)url {
[super applicationOpenURL:url];
int tag;
- if (UCViewController *page = [self pageForURL:url hasTag:&tag]) {
+ if (CYViewController *page = [self pageForURL:url hasTag:&tag]) {
[self setPage:page];
tag_ = tag;
[tabbar_ setSelectedViewController:(tag_ == -1 ? nil : [[tabbar_ viewControllers] objectAtIndex:tag_])];
return;
}
- if (Role_ == nil)
- [self showSettings];
-
_trace();
- NSMutableArray *controllers = [NSMutableArray array];
- [controllers addObject:[[CYNavigationController alloc] initWithDatabase:database_]];
- [controllers addObject:[[CYNavigationController alloc] initWithDatabase:database_]];
- [controllers addObject:[[CYNavigationController alloc] initWithDatabase:database_]];
- if (IsWildcat_) [controllers addObject:[[CYNavigationController alloc] initWithDatabase:database_]];
- [controllers addObject:[[CYNavigationController alloc] initWithDatabase:database_]];
- [controllers addObject:[[CYNavigationController alloc] initWithDatabase:database_]];
-
- NSMutableArray *items = [NSMutableArray arrayWithObjects:
+ NSMutableArray *items([NSMutableArray arrayWithObjects:
[[[UITabBarItem alloc] initWithTitle:@"Cydia" image:[UIImage applicationImageNamed:@"home.png"] tag:kCydiaTag] autorelease],
[[[UITabBarItem alloc] initWithTitle:UCLocalize("SECTIONS") image:[UIImage applicationImageNamed:@"install.png"] tag:kSectionsTag] autorelease],
[[[UITabBarItem alloc] initWithTitle:UCLocalize("CHANGES") image:[UIImage applicationImageNamed:@"changes.png"] tag:kChangesTag] autorelease],
[[[UITabBarItem alloc] initWithTitle:UCLocalize("SEARCH") image:[UIImage applicationImageNamed:@"search.png"] tag:kSearchTag] autorelease],
- nil
- ];
+ nil]);
if (IsWildcat_) {
[items insertObject:[[[UITabBarItem alloc] initWithTitle:UCLocalize("SOURCES") image:[UIImage applicationImageNamed:@"source.png"] tag:kSourcesTag] autorelease] atIndex:3];
[items insertObject:[[[UITabBarItem alloc] initWithTitle:UCLocalize("MANAGE") image:[UIImage applicationImageNamed:@"manage.png"] tag:kManageTag] autorelease] atIndex:3];
}
- for (size_t i(0); i != [items count]; i++)
- [[controllers objectAtIndex:i] setTabBarItem:[items objectAtIndex:i]];
+ NSMutableArray *controllers([NSMutableArray array]);
+
+ for (UITabBarItem *item in items) {
+ CYNavigationController *controller([[[CYNavigationController alloc] initWithDatabase:database_] autorelease]);
+ [controller setTabBarItem:item];
+ [controllers addObject:controller];
+ }
tabbar_ = [[CYTabBarController alloc] initWithDatabase:database_];
[tabbar_ setViewControllers:controllers];
[container_ setUpdateDelegate:self];
[container_ setTabBarController:tabbar_];
[window_ addSubview:[container_ view]];
- [[tabbar_ view] setFrame:CGRectMake(0, -20.0f, [window_ bounds].size.width, [window_ bounds].size.height)];
+
+ [self performSelector:@selector(loadData) withObject:nil afterDelay:0];
+}
+
+- (void) loadData {
+ if (Role_ == nil) {
+ [self showSettings];
+ return;
+ }
[UIKeyboard initImplementationNow];
Class $UIHardware;
-MSHook(void, UIHardware$_playSystemSound$, Class self, SEL _cmd, int soundIndex) {
- switch (soundIndex) {
+MSHook(void, UIHardware$_playSystemSound$, Class self, SEL _cmd, int sound) {
+ switch (sound) {
case 1104: // Keyboard Button Clicked
case 1105: // Keyboard Delete Repeated
- if (!shouldPlayKeyboardSounds) {
- NSDictionary *dict = [[NSDictionary alloc] initWithContentsOfFile:@"/var/mobile/Library/Preferences/com.apple.preferences.sounds.plist"];
- shouldPlayKeyboardSounds = [[dict objectForKey:@"keyboard"] ?: (id)kCFBooleanTrue retain];
- [dict release];
+ if (shouldPlayKeyboardSounds == nil) {
+ NSDictionary *dict([[[NSDictionary alloc] initWithContentsOfFile:@"/var/mobile/Library/Preferences/com.apple.preferences.sounds.plist"] autorelease]);
+ shouldPlayKeyboardSounds = [([dict objectForKey:@"keyboard"] ?: (id) kCFBooleanTrue) retain];
}
+
if (![shouldPlayKeyboardSounds boolValue])
break;
+
default:
- _UIHardware$_playSystemSound$(self, _cmd, soundIndex);
+ _UIHardware$_playSystemSound$(self, _cmd, sound);
}
}
PackageName = reinterpret_cast<CYString &(*)(Package *, SEL)>(method_getImplementation(class_getInstanceMethod([Package class], @selector(cyname))));
/* Library Hacks {{{ */
- class_addMethod(objc_getClass("WebScriptObject"), @selector(countByEnumeratingWithState:objects:count:), (IMP) &WebScriptObject$countByEnumeratingWithState$objects$count$, "I20@0:4^{NSFastEnumerationState}8^@12I16");
class_addMethod(objc_getClass("DOMNodeList"), @selector(countByEnumeratingWithState:objects:count:), (IMP) &DOMNodeList$countByEnumeratingWithState$objects$count$, "I20@0:4^{NSFastEnumerationState}8^@12I16");
$WebDefaultUIKitDelegate = objc_getClass("WebDefaultUIKitDelegate");
Warning_ = UCLocalize("WARNING");
_trace();
- int value = UIApplicationMain(argc, argv, @"Cydia", @"Cydia");
+ int value(UIApplicationMain(argc, argv, @"Cydia", @"Cydia"));
CGColorSpaceRelease(space_);
CFRelease(Locale_);