/* }}} */
/* Cydia Navigation Controller Interface {{{ */
-@interface CYNavigationController : UINavigationController {
-}
+@interface UINavigationController (Cydia)
- (NSArray *) navigationURLCollection;
-- (void) unloadData:(BOOL)selected;
+- (void) unloadData;
@end
/* }}} */
}
- (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 {
/* }}} */
/* Cydia Navigation Controller Implementation {{{ */
-@implementation CYNavigationController
+@implementation UINavigationController (Cydia)
- (NSArray *) navigationURLCollection {
NSMutableArray *stack([NSMutableArray array]);
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
}
// Navigation controller for the queuing badge.
-- (CYNavigationController *) queueNavigationController {
+- (UINavigationController *) queueNavigationController {
NSArray *controllers = [tabbar_ viewControllers];
return [controllers objectAtIndex:3];
}
[tabbar_ unloadData];
- CYNavigationController *navigation = [self queueNavigationController];
+ UINavigationController *navigation = [self queueNavigationController];
id queuedelegate = nil;
if ([[navigation viewControllers] count] > 0)
}
- (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];
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];
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];
}
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];
}
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++) {