Database *database_;
int tag_;
- int huds_;
+ int hudcount_;
NSURL *starturl_;
SectionsController *sections_;
}
- (BOOL) hudIsShowing {
- return (huds_ > 0);
+ return (hudcount_ > 0);
}
- (void) applicationSuspend:(__GSEvent *)event {
while ([target modalViewController] != nil) target = [target modalViewController];
[[target view] addSubview:hud];
- huds_++;
+ hudcount_++;
return hud;
}
[hud show:NO];
[hud removeFromSuperview];
[window_ setUserInteractionEnabled:YES];
- huds_--;
+ hudcount_--;
}
- (CYViewController *) pageForPackage:(NSString *)name {
return nil;
}
+- (BOOL) openCydiaURL:(NSURL *)url {
+ CYViewController *page = nil;
+ int tag = 0;
+
+ if ((page = [self pageForURL:starturl_ hasTag:&tag])) {
+ [starturl_ release];
+ [self setPage:page];
+ tag_ = tag;
+ [tabbar_ setSelectedViewController:(tag_ == -1 ? nil : [[tabbar_ viewControllers] objectAtIndex:tag_])];
+ }
+
+ return !!page;
+}
+
- (void) applicationOpenURL:(NSURL *)url {
[super applicationOpenURL:url];
- starturl_ = [url retain];
+ if (!loaded_) starturl_ = [url retain];
+ else [self openCydiaURL:url];
}
- (void) applicationWillResignActive:(UIApplication *)application {
PrintTimes();
// Show the initial page
- CYViewController *page = nil;
- int tag = 0;
- if (starturl_ != nil && (page = [self pageForURL:starturl_ hasTag:&tag])) {
- [starturl_ release];
- [self setPage:page];
- tag_ = tag;
- [tabbar_ setSelectedViewController:(tag_ == -1 ? nil : [[tabbar_ viewControllers] objectAtIndex:tag_])];
- } else {
+ if (starturl_ == nil || ![self openCydiaURL:starturl_]) {
[tabbar_ setSelectedIndex:0];
_setHomePage(self);
}