} return self;
}
+- (void)_updateFrameForDisplay {
+ [super _updateFrameForDisplay];
+ if ([self cancelButtonIndex] == -1) {
+ NSArray *buttons = [self buttons];
+ if ([buttons count]) {
+ UIImage *background = [[buttons objectAtIndex:0] backgroundForState:0];
+ for (UIThreePartButton *button in buttons)
+ [button setBackground:background forState:0];
+ }
+ }
+}
+
- (void) alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
button_ = buttonIndex + 1;
}
}
- (int) yieldToPopupAlertAnimated:(BOOL)animated {
+ [self setRunsModal:YES];
button_ = 0;
[self show];
- NSRunLoop *loop([NSRunLoop currentRunLoop]);
- NSDate *future([NSDate distantFuture]);
- while (button_ == 0 && [loop runMode:NSDefaultRunLoopMode beforeDate:future]);
return button_;
}
- (void) setConfigurationData:(NSString *)data;
@end
-@class PackageView;
+@class PackageController;
@protocol CydiaDelegate
-- (void) setPackageView:(PackageView *)view;
+- (void) setPackageController:(PackageController *)view;
- (void) clearPackage:(Package *)package;
- (void) installPackage:(Package *)package;
- (void) installPackages:(NSArray *)packages;
- (UIProgressHUD *) addProgressHUD;
- (void) removeProgressHUD:(UIProgressHUD *)hud;
- (UIViewController *) pageForPackage:(NSString *)name;
-- (PackageView *) packageView;
+- (PackageController *) packageController;
@end
/* }}} */
@end
/* }}} */
-/* Confirmation View {{{ */
+/* Confirmation Controller {{{ */
bool DepSubstrate(const pkgCache::VerIterator &iterator) {
if (!iterator.end())
for (pkgCache::DepIterator dep(iterator.DependsList()); !dep.end(); ++dep) {
@end
/* }}} */
-@interface CYBrowserController : BrowserView {
+@interface CYBrowserController : BrowserController {
CydiaObject *cydia_;
}
@end
-@protocol ConfirmationViewDelegate
+@protocol ConfirmationControllerDelegate
- (void) cancelAndClear:(bool)clear;
- (void) confirmWithNavigationController:(UINavigationController *)navigation;
- (void) queue;
@end
-@interface ConfirmationView : CYBrowserController {
+@interface ConfirmationController : CYBrowserController {
_transient Database *database_;
UIAlertView *essential_;
NSArray *changes_;
@end
-@implementation ConfirmationView
+@implementation ConfirmationController
- (void) dealloc {
[changes_ release];
} return self;
}
-- (void) didFinishLoading {
+- (void) applyRightButton {
UIBarButtonItem *rightItem = [[UIBarButtonItem alloc]
initWithTitle:UCLocalize("CONFIRM")
style:UIBarButtonItemStylePlain
action:@selector(confirmButtonClicked)
];
#if !AlwaysReload && !IgnoreInstall
- if (issues_ == nil) [[self navigationItem] setRightBarButtonItem:rightItem];
- else [[self navigationItem] setRightBarButtonItem:nil];
+ if (issues_ == nil && ![self isLoading]) [[self navigationItem] setRightBarButtonItem:rightItem];
+ else [super applyRightButton];
+#else
+ [[self navigationItem] setRightBarButtonItem:nil];
#endif
[rightItem release];
}
@end
/* }}} */
-/* Progress View {{{ */
-@interface ProgressView : CYViewController <
+/* Progress Controller {{{ */
+@interface ProgressController : CYViewController <
ConfigurationDelegate,
ProgressDelegate
> {
@end
-@protocol ProgressViewDelegate
-- (void) progressViewIsComplete:(ProgressView *)sender;
+@protocol ProgressControllerDelegate
+- (void) progressControllerIsComplete:(ProgressController *)sender;
@end
-@implementation ProgressView
+@implementation ProgressController
- (void) dealloc {
[database_ setDelegate:nil];
[status_ removeFromSuperview];
[database_ popErrorWithTitle:title_];
- [delegate_ progressViewIsComplete:self];
+ [delegate_ progressControllerIsComplete:self];
if (Finish_ < 4) {
FileFd file;
@end
/* }}} */
-/* Package View {{{ */
-@interface PackageView : CYBrowserController {
+/* Package Controller {{{ */
+@interface PackageController : CYBrowserController {
_transient Database *database_;
Package *package_;
NSString *name_;
@end
-@implementation PackageView
+@implementation PackageController
- (void) dealloc {
if (package_ != nil)
- (void) release {
if ([self retainCount] == 1)
- [delegate_ setPackageView:self];
+ [delegate_ setPackageController:self];
[super release];
}
}
- (void) actionButtonClicked {
- if (commercial_ && [self isLoading])
- [super _rightButtonClicked];
- else
+ // Wait until it's done loading.
+ if (![self isLoading])
[self _actionButtonClicked];
}
+
+- (void) reloadButtonClicked {
+ // Don't reload a package view by clicking the button.
+}
+
+- (void) applyLoadingTitle {
+ // Don't show "Loading" as the title. Ever.
+}
#endif
- (id) initWithDatabase:(Database *)database {
}
}
-- (void) didFinishLoading {
+- (void) applyRightButton {
int count = [buttons_ count];
UIBarButtonItem *actionItem = [[UIBarButtonItem alloc]
initWithTitle:count == 0 ? nil : count != 1 ? UCLocalize("MODIFY") : [buttons_ objectAtIndex:0]
target:self
action:@selector(actionButtonClicked)
];
- [[self navigationItem] setRightBarButtonItem:actionItem];
+ if (![self isLoading]) [[self navigationItem] setRightBarButtonItem:actionItem];
+ else [super applyRightButton];
[actionItem release];
}
@end
/* }}} */
-/* Filtered Package View {{{ */
-@interface FilteredPackageView : CYViewController {
+/* Filtered Package Controller {{{ */
+@interface FilteredPackageController : CYViewController {
_transient Database *database_;
FilteredPackageTable *packages_;
NSString *title_;
@end
-@implementation FilteredPackageView
+@implementation FilteredPackageController
- (void) dealloc {
[packages_ release];
}
- (void) didSelectPackage:(Package *)package {
- PackageView *view([delegate_ packageView]);
+ PackageController *view([delegate_ packageController]);
[view setPackage:package];
[view setDelegate:delegate_];
[[self navigationController] pushViewController:view animated:YES];
/* }}} */
-/* Add Source View {{{ */
-@interface AddSourceView : CYViewController {
+/* Add Source Controller {{{ */
+@interface AddSourceController : CYViewController {
_transient Database *database_;
}
@end
-@implementation AddSourceView
+@implementation AddSourceController
- (id) initWithDatabase:(Database *)database {
if ((self = [super init]) != nil) {
- (void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
Source *source = [self sourceAtIndexPath:indexPath];
- FilteredPackageView *packages = [[[FilteredPackageView alloc]
+ FilteredPackageController *packages = [[[FilteredPackageController alloc]
initWithDatabase:database_
title:[source label]
filter:@selector(isVisibleInSource:)
}
- (void) addButtonClicked {
- /*[book_ pushPage:[[[AddSourceView alloc]
+ /*[book_ pushPage:[[[AddSourceController alloc]
initWithBook:book_
database:database_
] autorelease]];*/
@end
/* }}} */
-/* Installed View {{{ */
-@interface InstalledView : FilteredPackageView {
+/* Installed Controller {{{ */
+@interface InstalledController : FilteredPackageController {
BOOL expert_;
}
@end
-@implementation InstalledView
+@implementation InstalledController
- (void) dealloc {
[super dealloc];
@end
/* }}} */
-/* Home View {{{ */
-@interface HomeView : CYBrowserController {
+/* Home Controller {{{ */
+@interface HomeController : CYBrowserController {
}
@end
-@implementation HomeView
+@implementation HomeController
- (void) _setMoreHeaders:(NSMutableURLRequest *)request {
[super _setMoreHeaders:request];
@end
/* }}} */
-/* Manage View {{{ */
-@interface ManageView : CYBrowserController {
+/* Manage Controller {{{ */
+@interface ManageController : CYBrowserController {
}
@end
-@implementation ManageView
+@implementation ManageController
- (id) init {
if ((self = [super init]) != nil) {
@implementation RefreshBar
+- (void) positionViews {
+ CGRect frame = [cancel_ frame];
+ frame.origin.x = [self frame].size.width - frame.size.width - 5;
+ frame.origin.y = ([self frame].size.height - frame.size.height) / 2;
+ [cancel_ setFrame:frame];
+
+ CGSize prgsize = {75, 100};
+ CGRect prgrect = {{
+ [self frame].size.width - prgsize.width - 10,
+ ([self frame].size.height - prgsize.height) / 2
+ } , prgsize};
+ [progress_ setFrame:prgrect];
+
+ CGSize indsize([UIProgressIndicator defaultSizeForStyle:[indicator_ activityIndicatorViewStyle]]);
+ unsigned indoffset = ([self frame].size.height - indsize.height) / 2;
+ CGRect indrect = {{indoffset, indoffset}, indsize};
+ [indicator_ setFrame:indrect];
+
+ CGSize prmsize = {215, indsize.height + 4};
+ CGRect prmrect = {{
+ indoffset * 2 + indsize.width,
+ unsigned([self frame].size.height - prmsize.height) / 2 - 1
+ }, prmsize};
+ [prompt_ setFrame:prmrect];
+}
+
+- (void)setFrame:(CGRect)frame {
+ [super setFrame:frame];
+
+ [self positionViews];
+}
+
- (id) initWithFrame:(CGRect)frame delegate:(id)delegate {
if ((self = [super initWithFrame:frame])) {
[self setAutoresizingMask:UIViewAutoresizingFlexibleWidth];
UIProgressIndicatorStyleMediumBrown :
UIProgressIndicatorStyleMediumWhite;
- CGSize indsize([UIProgressIndicator defaultSizeForStyle:style]);
- unsigned indoffset = ([self frame].size.height - indsize.height) / 2;
- CGRect indrect = {{indoffset, indoffset}, indsize};
-
- indicator_ = [[UIProgressIndicator alloc] initWithFrame:indrect];
+ indicator_ = [[UIProgressIndicator alloc] initWithFrame:CGRectZero];
[indicator_ setStyle:style];
+ [indicator_ startAnimation];
[self addSubview:indicator_];
- CGSize prmsize = {215, indsize.height + 4};
-
- CGRect prmrect = {{
- indoffset * 2 + indsize.width,
- unsigned([self frame].size.height - prmsize.height) / 2 - 1
- }, prmsize};
-
- UIFont *font([UIFont systemFontOfSize:15]);
-
- prompt_ = [[UITextLabel alloc] initWithFrame:prmrect];
-
+ prompt_ = [[UITextLabel alloc] initWithFrame:CGRectZero];
[prompt_ setColor:[UIColor colorWithCGColor:(ugly ? Blueish_ : Off_)]];
[prompt_ setBackgroundColor:[UIColor clearColor]];
- [prompt_ setFont:font];
-
+ [prompt_ setFont:[UIFont systemFontOfSize:15]];
[self addSubview:prompt_];
- CGSize prgsize = {75, 100};
-
- CGRect prgrect = {{
- [self frame].size.width - prgsize.width - 10,
- ([self frame].size.height - prgsize.height) / 2
- } , prgsize};
-
- progress_ = [[UIProgressBar alloc] initWithFrame:prgrect];
- [progress_ setAutoresizingMask:UIViewAutoresizingFlexibleWidth];
- [self addSubview:progress_];
-
+ progress_ = [[UIProgressBar alloc] initWithFrame:CGRectZero];
+ [progress_ setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleLeftMargin];
[progress_ setStyle:0];
-
+ [self addSubview:progress_];
+
cancel_ = [[UINavigationButton alloc] initWithTitle:UCLocalize("CANCEL") style:UINavigationButtonStyleHighlighted];
- [progress_ setAutoresizingMask:UIViewAutoresizingFlexibleLeftMargin];
[cancel_ setAutoresizingMask:UIViewAutoresizingFlexibleLeftMargin];
[cancel_ addTarget:delegate action:@selector(cancelPressed) forControlEvents:UIControlEventTouchUpInside];
-
- CGRect frame = [cancel_ frame];
- frame.origin.x = [self frame].size.width - frame.size.width - 5;
- frame.origin.y = ([self frame].size.height - frame.size.height) / 2;
- [cancel_ setFrame:frame];
-
- [cancel_ setBarStyle:barstyle];
-
- [indicator_ startAnimation];
+ [cancel_ setBarStyle:barstyle];
+
+ [self positionViews];
} return self;
}
@end
/* }}} */
-/* Sections View {{{ */
-@interface SectionsView : CYViewController {
+/* Sections Controller {{{ */
+@interface SectionsController : CYViewController {
_transient Database *database_;
NSMutableArray *sections_;
NSMutableArray *filtered_;
@end
-@implementation SectionsView
+@implementation SectionsController
- (void) dealloc {
[list_ setDataSource:nil];
}
}
- FilteredPackageView *table = [[[FilteredPackageView alloc]
+ FilteredPackageController *table = [[[FilteredPackageController alloc]
initWithDatabase:database_
title:title
filter:@selector(isVisibleInSection:)
target:self
action:@selector(editButtonClicked)
];
- [[self navigationItem] setRightBarButtonItem:rightItem];
+ [[self navigationItem] setRightBarButtonItem:rightItem animated:[[self navigationItem] rightBarButtonItem] != nil];
[rightItem release];
[list_ reloadData];
@end
/* }}} */
-/* Changes View {{{ */
-@interface ChangesView : CYViewController {
+/* Changes Controller {{{ */
+@interface ChangesController : CYViewController {
_transient Database *database_;
NSMutableArray *packages_;
NSMutableArray *sections_;
UITableView *list_;
unsigned upgrades_;
+ BOOL hasSentFirstLoad_;
}
- (id) initWithDatabase:(Database *)database delegate:(id)delegate;
@end
-@implementation ChangesView
+@implementation ChangesController
- (void) dealloc {
[list_ setDelegate:nil];
- (void) viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
- [list_ deselectRowAtIndexPath:[list_ indexPathForSelectedRow] animated:animated];
+ if (!hasSentFirstLoad_) {
+ hasSentFirstLoad_ = YES;
+ [self performSelector:@selector(reloadData) withObject:nil afterDelay:0.0];
+ } else {
+ [list_ deselectRowAtIndexPath:[list_ indexPathForSelectedRow] animated:animated];
+ }
}
- (NSInteger) numberOfSectionsInTableView:(UITableView *)list {
- (NSIndexPath *) tableView:(UITableView *)table willSelectRowAtIndexPath:(NSIndexPath *)path {
Package *package([self packageAtIndexPath:path]);
- PackageView *view([delegate_ packageView]);
+ PackageController *view([delegate_ packageController]);
[view setDelegate:delegate_];
[view setPackage:package];
[[self navigationController] pushViewController:view animated:YES];
[list_ setDelegate:self];
delegate_ = delegate;
- [self reloadData];
} return self;
}
unseens = true;
NSDate *seen;
- _profile(ChangesView$reloadData$Remember)
+ _profile(ChangesController$reloadData$Remember)
seen = [package seen];
_end
[name autorelease];
}
- _profile(ChangesView$reloadData$Allocate)
+ _profile(ChangesController$reloadData$Allocate)
name = [NSString stringWithFormat:UCLocalize("NEW_AT"), name];
section = [[[Section alloc] initWithName:name row:offset localize:NO] autorelease];
[sections_ addObject:section];
@end
/* }}} */
-/* Search View {{{ */
-@interface SearchView : FilteredPackageView {
+/* Search Controller {{{ */
+@interface SearchController : FilteredPackageController {
id search_;
}
@end
-@implementation SearchView
+@implementation SearchController
- (void) dealloc {
[search_ release];
- (id) title { return nil; }
- (id) initWithDatabase:(Database *)database {
- if ((self = [super initWithDatabase:database title:UCLocalize("SEARCH") filter:@selector(isUnfilteredAndSearchedForBy:) with:nil]) != nil) {
- search_ = [[objc_getClass("UISearchBar") alloc] initWithFrame:CGRectMake(0, 0, [[self view] frame].size.width, 44.0f)];
+ return [super initWithDatabase:database title:UCLocalize("SEARCH") filter:@selector(isUnfilteredAndSearchedForBy:) with:nil];
+}
+
+- (void)viewDidAppear:(BOOL)animated {
+ [super viewDidAppear:animated];
+ if (!search_) {
+ search_ = [[objc_getClass("UISearchBar") alloc] initWithFrame:CGRectMake(0, 0, [[self view] bounds].size.width, 44.0f)];
+ [search_ layoutSubviews];
[search_ setPlaceholder:UCLocalize("SEARCH_EX")];
- [search_ setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight];
+ UITextField *textField = [search_ searchField];
+ [textField setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin];
[search_ setDelegate:self];
- [[search_ searchField] setEnablesReturnKeyAutomatically:NO];
- [[self navigationItem] setTitleView:search_];
- } return self;
+ [textField setEnablesReturnKeyAutomatically:NO];
+ [[self navigationItem] setTitleView:textField];
+ }
}
- (void) _reloadData {
}
- (void) reloadData {
- _profile(SearchView$reloadData)
+ _profile(SearchController$reloadData)
[packages_ reloadData];
_end
PrintTimes();
[packages_ resetCursor];
}
+- (void) didSelectPackage:(Package *)package {
+ [search_ resignFirstResponder];
+ [super didSelectPackage:package];
+}
+
@end
/* }}} */
-/* Settings View {{{ */
-@interface SettingsView : CYViewController {
+/* Settings Controller {{{ */
+@interface SettingsController : CYViewController {
_transient Database *database_;
NSString *name_;
Package *package_;
@end
-@implementation SettingsView
+@implementation SettingsController
- (void) dealloc {
[table_ setDataSource:nil];
@end
/* }}} */
-/* Signature View {{{ */
-@interface SignatureView : CYBrowserController {
+/* Signature Controller {{{ */
+@interface SignatureController : CYBrowserController {
_transient Database *database_;
NSString *package_;
}
@end
-@implementation SignatureView
+@implementation SignatureController
- (void) dealloc {
[package_ release];
if (animated) [UIView beginAnimations:nil context:NULL];
CGRect barframe = [refreshbar_ frame];
CGRect viewframe = [[root_ view] frame];
- viewframe.origin.y += barframe.size.height;
- viewframe.size.height -= barframe.size.height;
+ viewframe.origin.y += barframe.size.height + 20.0f;
+ viewframe.size.height -= barframe.size.height + 20.0f;
[[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;
- viewframe.size.height += barframe.size.height;
+ viewframe.origin.y -= barframe.size.height + 20.0f;
+ viewframe.size.height += barframe.size.height + 20.0f;
[[root_ view] setFrame:viewframe];
if (animated) [UIView commitAnimations];
[[root_ selectedViewController] _updateLayoutForStatusBarAndInterfaceOrientation];
}
+- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation duration:(NSTimeInterval)duration
+{
+ // XXX: fix Apple's layout bug
+ [[root_ selectedViewController] _updateLayoutForStatusBarAndInterfaceOrientation];
+}
+
- (void) didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
if (dropped_) {
[self raiseBar:NO];
// XXX: fix Apple's layout bug
[[root_ selectedViewController] _updateLayoutForStatusBarAndInterfaceOrientation];
-
- // Resize refresh bar to fit the new size
- CGRect barframe = [refreshbar_ frame];
- barframe.size.width = [[self view] frame].size.width;
- [refreshbar_ setFrame:barframe];
}
- (void) dealloc {
} CYTabTag;
@interface Cydia : UIApplication <
- ConfirmationViewDelegate,
- ProgressViewDelegate,
+ ConfirmationControllerDelegate,
+ ProgressControllerDelegate,
CydiaDelegate
> {
UIWindow *window_;
UIKeyboard *keyboard_;
UIProgressHUD *hud_;
- SectionsView *sections_;
- ChangesView *changes_;
- ManageView *manage_;
- SearchView *search_;
+ SectionsController *sections_;
+ ChangesController *changes_;
+ ManageController *manage_;
+ SearchController *search_;
SourceTable *sources_;
- InstalledView *installed_;
+ InstalledController *installed_;
id queueDelegate_;
#if RecyclePackageViews
@end
static _finline void _setHomePage(Cydia *self) {
- [self setPage:[self _pageForURL:[NSURL URLWithString:CydiaURL(@"")] withClass:[HomeView class]]];
+ [self setPage:[self _pageForURL:[NSURL URLWithString:CydiaURL(@"")] withClass:[HomeController class]]];
}
@implementation Cydia
[self _saveConfig];
- ProgressView *progress = [[[ProgressView alloc] initWithDatabase:database_ delegate:self] autorelease];
+ ProgressController *progress = [[[ProgressController alloc] initWithDatabase:database_ delegate:self] autorelease];
UINavigationController *navigation = [[[CYNavigationController alloc] initWithRootViewController:progress] autorelease];
if (IsWildcat_) [navigation setModalPresentationStyle:UIModalPresentationFormSheet];
[container_ presentModalViewController:navigation animated:YES];
if (![database_ prepare])
return false;
- ConfirmationView *page([[[ConfirmationView alloc] initWithDatabase:database_] autorelease]);
+ ConfirmationController *page([[[ConfirmationController alloc] initWithDatabase:database_] autorelease]);
[page setDelegate:self];
id confirm_ = [[CYNavigationController alloc] initWithRootViewController:page];
[confirm_ setDelegate:self];
}
- (void) confirmWithNavigationController:(UINavigationController *)navigation {
- ProgressView *progress = [[[ProgressView alloc] initWithDatabase:database_ delegate:self] autorelease];
+ ProgressController *progress = [[[ProgressController alloc] initWithDatabase:database_ delegate:self] autorelease];
if (navigation != nil) {
[navigation pushViewController:progress animated:YES];
];
}
-- (void) progressViewIsComplete:(ProgressView *)progress {
+- (void) progressControllerIsComplete:(ProgressController *)progress {
[self complete];
}
return browser;
}
-- (SectionsView *) sectionsView {
+- (SectionsController *) sectionsController {
if (sections_ == nil)
- sections_ = [[SectionsView alloc] initWithDatabase:database_];
+ sections_ = [[SectionsController alloc] initWithDatabase:database_];
return sections_;
}
-- (ChangesView *) changesView {
+- (ChangesController *) changesController {
if (changes_ == nil)
- changes_ = [[ChangesView alloc] initWithDatabase:database_ delegate:self];
+ changes_ = [[ChangesController alloc] initWithDatabase:database_ delegate:self];
return changes_;
}
-- (ManageView *) manageView {
+- (ManageController *) manageController {
if (manage_ == nil) {
- manage_ = (ManageView *) [[self
+ manage_ = (ManageController *) [[self
_pageForURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"manage" ofType:@"html"]]
- withClass:[ManageView class]
+ withClass:[ManageController class]
] retain];
if (!IsWildcat_) queueDelegate_ = manage_;
}
return manage_;
}
-- (SearchView *) searchView {
+- (SearchController *) searchController {
if (search_ == nil)
- search_ = [[SearchView alloc] initWithDatabase:database_];
+ search_ = [[SearchController alloc] initWithDatabase:database_];
return search_;
}
-- (SourceTable *) sourcesView {
+- (SourceTable *) sourcesController {
if (sources_ == nil)
sources_ = [[SourceTable alloc] initWithDatabase:database_];
return sources_;
}
-- (InstalledView *) installedView {
+- (InstalledController *) installedController {
if (installed_ == nil) {
- installed_ = [[InstalledView alloc] initWithDatabase:database_];
+ installed_ = [[InstalledController alloc] initWithDatabase:database_];
if (IsWildcat_) queueDelegate_ = installed_;
}
return installed_;
[[tabbar_ selectedViewController] popToRootViewControllerAnimated:YES];
return;
} else if (tag_ == 1) {
- [[self sectionsView] resetView];
+ [[self sectionsController] resetView];
}
switch (tag) {
case kCydiaTag: _setHomePage(self); break;
- case kSectionsTag: [self setPage:[self sectionsView]]; break;
- case kChangesTag: [self setPage:[self changesView]]; break;
- case kManageTag: [self setPage:[self manageView]]; break;
- case kInstalledTag: [self setPage:[self installedView]]; break;
- case kSourcesTag: [self setPage:[self sourcesView]]; break;
- case kSearchTag: [self setPage:[self searchView]]; break;
+ case kSectionsTag: [self setPage:[self sectionsController]]; break;
+ case kChangesTag: [self setPage:[self changesController]]; break;
+ case kManageTag: [self setPage:[self manageController]]; break;
+ case kInstalledTag: [self setPage:[self installedController]]; break;
+ case kSourcesTag: [self setPage:[self sourcesController]]; break;
+ case kSearchTag: [self setPage:[self searchController]]; break;
_nodefault
}
[role dismiss];
}
-- (void) setPackageView:(PackageView *)view {
+- (void) setPackageController:(PackageController *)view {
WebThreadLock();
[view setPackage:nil];
#if RecyclePackageViews
WebThreadUnlock();
}
-- (PackageView *) _packageView {
- return [[[PackageView alloc] initWithDatabase:database_] autorelease];
+- (PackageController *) _packageController {
+ return [[[PackageController alloc] initWithDatabase:database_] autorelease];
}
-- (PackageView *) packageView {
+- (PackageController *) packageController {
#if RecyclePackageViews
- PackageView *view;
+ PackageController *view;
size_t count([details_ count]);
if (count == 0) {
- view = [self _packageView];
+ view = [self _packageController];
renew:
- [details_ addObject:[self _packageView]];
+ [details_ addObject:[self _packageController]];
} else {
view = [[[details_ lastObject] retain] autorelease];
[details_ removeLastObject];
return view;
#else
- return [self _packageView];
+ return [self _packageController];
#endif
}
}
- (void) applicationSuspend:(__GSEvent *)event {
+ // FIXME: This needs to be fixed, but we no longer have a progress_.
+ // What's the best solution?
if (hud_ == nil)// && ![progress_ isRunning])
[super applicationSuspend:event];
}
[window_ setUserInteractionEnabled:NO];
[hud show:YES];
- [window_ addSubview:hud];
+ [[container_ view] addSubview:hud];
return hud;
}
- (UIViewController *) pageForPackage:(NSString *)name {
if (Package *package = [database_ packageWithName:name]) {
- PackageView *view([self packageView]);
+ PackageController *view([self packageController]);
[view setPackage:package];
return view;
} else {
path = [@"/" stringByAppendingString:path];
if ([path isEqualToString:@"/add-source"])
- return [[[AddSourceView alloc] initWithDatabase:database_] autorelease];
+ return [[[AddSourceController alloc] initWithDatabase:database_] autorelease];
else if ([path isEqualToString:@"/storage"])
return [self _pageForURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"storage" ofType:@"html"]] withClass:[CYBrowserController class]];
else if ([path isEqualToString:@"/sources"])
return [[[SourceTable alloc] initWithDatabase:database_] autorelease];
else if ([path isEqualToString:@"/packages"])
- return [[[InstalledView alloc] initWithDatabase:database_] autorelease];
+ return [[[InstalledController alloc] initWithDatabase:database_] autorelease];
else if ([path hasPrefix:@"/url/"])
return [self _pageForURL:[NSURL URLWithString:[path substringFromIndex:5]] withClass:[CYBrowserController class]];
else if ([path hasPrefix:@"/launch/"])
[self launchApplicationWithIdentifier:[path substringFromIndex:8] suspended:NO];
else if ([path hasPrefix:@"/package-settings/"])
- return [[[SettingsView alloc] initWithDatabase:database_ package:[path substringFromIndex:18]] autorelease];
+ return [[[SettingsController alloc] initWithDatabase:database_ package:[path substringFromIndex:18]] autorelease];
else if ([path hasPrefix:@"/package-signature/"])
- return [[[SignatureView alloc] initWithDatabase:database_ package:[path substringFromIndex:19]] autorelease];
+ return [[[SignatureController alloc] initWithDatabase:database_ package:[path substringFromIndex:19]] autorelease];
else if ([path hasPrefix:@"/package/"])
return [self pageForPackage:[path substringFromIndex:9]];
else if ([path hasPrefix:@"/files/"]) {
[tabbar_ setSelectedIndex:0];
container_ = [[CYContainer alloc] initWithDatabase:database_];
- [[container_ view] setFrame:[window_ bounds]];
[container_ setUpdateDelegate:self];
[container_ setRootController:tabbar_];
[window_ addSubview:[container_ view]];
+ [[tabbar_ view] setFrame:CGRectMake(0, -20.0f, [window_ bounds].size.width, [window_ bounds].size.height)];
[UIKeyboard initImplementationNow];
#if RecyclePackageViews
details_ = [[NSMutableArray alloc] initWithCapacity:4];
- [details_ addObject:[self _packageView]];
- [details_ addObject:[self _packageView]];
+ [details_ addObject:[self _packageController]];
+ [details_ addObject:[self _packageController]];
#endif
PrintTimes();
return _UIWebDocumentView$_setUIKitDelegate$(self, _cmd, delegate);
}
+static NSNumber *shouldPlayKeyboardSounds;
+
+Class $UIHardware;
+
+MSHook(void, UIHardware$_playSystemSound$, Class self, SEL _cmd, int soundIndex) {
+ switch (soundIndex) {
+ 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 boolValue])
+ break;
+ default:
+ _UIHardware$_playSystemSound$(self, _cmd, soundIndex);
+ }
+}
+
int main(int argc, char *argv[]) { _pooled
_trace();
_UIWebDocumentView$_setUIKitDelegate$ = reinterpret_cast<void (*)(UIWebDocumentView *, SEL, id)>(method_getImplementation(UIWebDocumentView$_setUIKitDelegate$));
method_setImplementation(UIWebDocumentView$_setUIKitDelegate$, reinterpret_cast<IMP>(&$UIWebDocumentView$_setUIKitDelegate$));
}
+
+ $UIHardware = objc_getClass("UIHardware");
+ Method UIHardware$_playSystemSound$(class_getClassMethod($UIHardware, @selector(_playSystemSound:)));
+ if (UIHardware$_playSystemSound$ != NULL) {
+ _UIHardware$_playSystemSound$ = reinterpret_cast<void (*)(Class, SEL, int)>(method_getImplementation(UIHardware$_playSystemSound$));
+ method_setImplementation(UIHardware$_playSystemSound$, reinterpret_cast<IMP>(&$UIHardware$_playSystemSound$));
+ }
/* }}} */
/* Set Locale {{{ */
Locale_ = CFLocaleCopyCurrent();