summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2011-02-28 05:55:49 -0800
committerJay Freeman (saurik) <saurik@saurik.com>2011-03-07 02:41:27 -0800
commit15f0d6136bbba5eb090b2614f08516083484093b (patch)
tree5dcdacdb5422457b29e7b24febcd86f9f81a4163
parent86916d7b35e413f50d64df0943d31b7c810fc58f (diff)
Replace CYNavigationController with a category.
-rw-r--r--MobileCydia.mm55
-rw-r--r--UICaboodle/RVPage.h2
-rw-r--r--UICaboodle/RVPage.mm9
3 files changed, 40 insertions, 26 deletions
diff --git a/MobileCydia.mm b/MobileCydia.mm
index c4dc0a5..00e61af 100644
--- a/MobileCydia.mm
+++ b/MobileCydia.mm
@@ -6821,11 +6821,10 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
/* }}} */
/* Cydia Navigation Controller Interface {{{ */
-@interface CYNavigationController : UINavigationController {
-}
+@interface UINavigationController (Cydia)
- (NSArray *) navigationURLCollection;
-- (void) unloadData:(BOOL)selected;
+- (void) unloadData;
@end
/* }}} */
@@ -6904,12 +6903,16 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
}
- (void) unloadData {
- CYNavigationController *selected((CYNavigationController *) [self selectedViewController]);
- for (CYNavigationController *controller in [self viewControllers])
- [controller unloadData:(controller == selected)];
+ UIViewController *selected([self selectedViewController]);
+ for (UINavigationController *controller in [self viewControllers])
+ [controller unloadData];
+
+ [selected reloadData];
- if (CYNavigationController *unselected = (CYNavigationController *) [self unselectedViewController])
- [unselected unloadData:YES];
+ if (UIViewController *unselected = [self unselectedViewController])
+ [unselected reloadData];
+
+ [super unloadData];
}
- (void) dealloc {
@@ -7123,7 +7126,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
/* }}} */
/* Cydia Navigation Controller Implementation {{{ */
-@implementation CYNavigationController
+@implementation UINavigationController (Cydia)
- (NSArray *) navigationURLCollection {
NSMutableArray *stack([NSMutableArray array]);
@@ -7137,18 +7140,18 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
return stack;
}
-- (void) unloadData:(BOOL)selected {
- CYViewController *top((CYViewController *) [self topViewController]);
- bool loaded([top hasLoaded]);
+- (void) reloadData {
+ [super reloadData];
+
+ if (UIViewController *visible = [self visibleViewController])
+ [visible reloadData];
+}
- for (CYViewController *page in [self viewControllers]) {
- NSLog(@"%@ %@", page, top);
- if (!selected || page != top)
- [page unloadData];
- }
+- (void) unloadData {
+ for (CYViewController *page in [self viewControllers])
+ [page unloadData];
- if (selected && loaded)
- [top reloadData];
+ [super unloadData];
}
@end
@@ -9065,7 +9068,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
}
// Navigation controller for the queuing badge.
-- (CYNavigationController *) queueNavigationController {
+- (UINavigationController *) queueNavigationController {
NSArray *controllers = [tabbar_ viewControllers];
return [controllers objectAtIndex:3];
}
@@ -9075,7 +9078,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
[tabbar_ unloadData];
- CYNavigationController *navigation = [self queueNavigationController];
+ UINavigationController *navigation = [self queueNavigationController];
id queuedelegate = nil;
if ([[navigation viewControllers] count] > 0)
@@ -9211,7 +9214,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
}
- (void) presentModalViewController:(UIViewController *)controller force:(BOOL)force {
- UINavigationController *navigation([[[CYNavigationController alloc] initWithRootViewController:controller] autorelease]);
+ UINavigationController *navigation([[[UINavigationController alloc] initWithRootViewController:controller] autorelease]);
if (IsWildcat_)
[navigation setModalPresentationStyle:UIModalPresentationFormSheet];
@@ -9318,7 +9321,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
ConfirmationController *page([[[ConfirmationController alloc] initWithDatabase:database_] autorelease]);
[page setDelegate:self];
- CYNavigationController *confirm_([[[CYNavigationController alloc] initWithRootViewController:page] autorelease]);
+ UINavigationController *confirm_([[[UINavigationController alloc] initWithRootViewController:page] autorelease]);
if (IsWildcat_)
[confirm_ setModalPresentationStyle:UIModalPresentationFormSheet];
@@ -9659,7 +9662,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
CYViewController *page([self pageForURL:url forExternal:external]);
if (page != nil) {
- CYNavigationController *nav = [[[CYNavigationController alloc] init] autorelease];
+ UINavigationController *nav = [[[UINavigationController alloc] init] autorelease];
[nav setViewControllers:[NSArray arrayWithObject:page]];
[tabbar_ setUnselectedViewController:nav];
}
@@ -9766,7 +9769,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
NSMutableArray *controllers([NSMutableArray array]);
for (UITabBarItem *item in items) {
- CYNavigationController *controller([[[CYNavigationController alloc] init] autorelease]);
+ UINavigationController *controller([[[UINavigationController alloc] init] autorelease]);
[controller setTabBarItem:item];
[controllers addObject:controller];
}
@@ -9920,7 +9923,7 @@ _trace();
for (unsigned int tab = 0; tab < [[tabbar_ viewControllers] count]; tab++) {
NSArray *stack = [items objectAtIndex:tab];
- CYNavigationController *navigation = [[tabbar_ viewControllers] objectAtIndex:tab];
+ UINavigationController *navigation = [[tabbar_ viewControllers] objectAtIndex:tab];
NSMutableArray *current = [NSMutableArray array];
for (unsigned int nav = 0; nav < [stack count]; nav++) {
diff --git a/UICaboodle/RVPage.h b/UICaboodle/RVPage.h
index 5dbccfd..be2331d 100644
--- a/UICaboodle/RVPage.h
+++ b/UICaboodle/RVPage.h
@@ -4,6 +4,8 @@
@interface UIViewController (Cydia)
- (BOOL) hasLoaded;
+- (void) reloadData;
+- (void) unloadData;
@end
@interface CYViewController : UIViewController {
diff --git a/UICaboodle/RVPage.mm b/UICaboodle/RVPage.mm
index d4803f0..8d6ea82 100644
--- a/UICaboodle/RVPage.mm
+++ b/UICaboodle/RVPage.mm
@@ -13,6 +13,12 @@ extern bool IsWildcat_;
return YES;
}
+- (void) reloadData {
+}
+
+- (void) unloadData {
+}
+
@end
@implementation CYViewController
@@ -52,6 +58,8 @@ extern bool IsWildcat_;
}
- (void) reloadData {
+ [super reloadData];
+
// This is called automatically on the first appearance of a controller,
// or any other time it needs to reload the information shown. However (!),
// this is not called by any tab bar or navigation controller's -reloadData
@@ -61,6 +69,7 @@ extern bool IsWildcat_;
- (void) unloadData {
loaded_ = NO;
+ [super unloadData];
}
- (NSURL *) navigationURL {