static NSString *Cache_;
-static bool AprilFools_;
-
static void (*$SBSSetInterceptsMenuButtonForever)(bool);
static CFStringRef (*$MGCopyAnswer)(CFStringRef);
/* Changes Controller {{{ */
@interface ChangesController : CyteViewController <
- CyteWebViewDelegate,
UITableViewDataSource,
UITableViewDelegate
> {
_H<NSMutableArray> packages_;
_H<NSMutableArray> sections_;
_H<UITableView, 2> list_;
- _H<CyteWebView, 1> dickbar_;
unsigned upgrades_;
- _H<IndirectDelegate, 1> indirect_;
- _H<CydiaObject> cydia_;
}
- (id) initWithDatabase:(Database *)database;
[(UITableView *) list_ setDataSource:self];
[list_ setDelegate:self];
[view addSubview:list_];
-
- if (AprilFools_ && kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber_iPhoneOS_3_0) {
- CGRect dickframe([view bounds]);
- dickframe.size.height = 44;
-
- dickbar_ = [[[CyteWebView alloc] initWithFrame:dickframe] autorelease];
- [dickbar_ setDelegate:self];
- [view addSubview:dickbar_];
-
- [dickbar_ setBackgroundColor:[UIColor clearColor]];
- [dickbar_ setScalesPageToFit:YES];
-
- UIWebDocumentView *document([dickbar_ _documentView]);
- [document setBackgroundColor:[UIColor clearColor]];
- [document setDrawsBackground:NO];
-
- WebView *webview([document webView]);
- [webview setShouldUpdateWhileOffscreen:NO];
-
- UIScrollView *scroller([dickbar_ scrollView]);
- [scroller setScrollingEnabled:NO];
- [scroller setFixedBackgroundPattern:YES];
- [scroller setBackgroundColor:[UIColor clearColor]];
-
- WebPreferences *preferences([webview preferences]);
- [preferences setCacheModel:WebCacheModelDocumentBrowser];
- [preferences setJavaScriptCanOpenWindowsAutomatically:YES];
- [preferences setOfflineWebApplicationCacheEnabled:YES];
-
- [dickbar_ loadRequest:[NSURLRequest
- requestWithURL:[Diversion divertURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@/#!/dickbar/", UI_]]]
- cachePolicy:NSURLRequestUseProtocolCachePolicy
- timeoutInterval:120
- ]];
-
- UIEdgeInsets inset = {44, 0, 0, 0};
- [list_ setContentInset:inset];
-
- [dickbar_ setAutoresizingMask:UIViewAutoresizingFlexibleWidth];
- }
-}
-
-- (void) webView:(WebView *)view decidePolicyForNewWindowAction:(NSDictionary *)action request:(NSURLRequest *)request newFrameName:(NSString *)frame decisionListener:(id<WebPolicyDecisionListener>)listener {
- NSURL *url([request URL]);
- if (url == nil)
- return;
-
- if ([frame isEqualToString:@"_open"])
- [delegate_ openURL:url];
- else {
- WebFrame *frame(nil);
- if (NSDictionary *WebActionElement = [action objectForKey:@"WebActionElementKey"])
- frame = [WebActionElement objectForKey:@"WebElementFrame"];
- if (frame == nil)
- frame = [view mainFrame];
-
- WebDataSource *source([frame provisionalDataSource] ?: [frame dataSource]);
-
- CyteViewController *controller([delegate_ pageForURL:url forExternal:NO withReferrer:([request valueForHTTPHeaderField:@"Referer"] ?: [[[source request] URL] absoluteString])] ?: [[[CydiaWebViewController alloc] initWithRequest:request] autorelease]);
- [controller setDelegate:delegate_];
- [[self navigationController] pushViewController:controller animated:YES];
- }
-
- [listener ignore];
-}
-
-- (NSURLRequest *) webView:(WebView *)view resource:(id)resource willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)response fromDataSource:(WebDataSource *)source {
- return [CydiaWebViewController requestWithHeaders:request];
-}
-
-- (void) webView:(WebView *)view didClearWindowObject:(WebScriptObject *)window forFrame:(WebFrame *)frame {
- [CydiaWebViewController didClearWindowObject:window forFrame:frame withCydia:cydia_];
-}
-
-- (void) setDelegate:(id)delegate {
- [super setDelegate:delegate];
- [cydia_ setDelegate:delegate];
}
- (void) viewDidLoad {
packages_ = nil;
sections_ = nil;
- dickbar_ = nil;
[super releaseSubviews];
}
- (id) initWithDatabase:(Database *)database {
if ((self = [super init]) != nil) {
- indirect_ = [[[IndirectDelegate alloc] initWithDelegate:self] autorelease];
- cydia_ = [[[CydiaObject alloc] initWithDelegate:indirect_] autorelease];
database_ = database;
} return self;
}
Error_ = UCLocalize("ERROR");
Warning_ = UCLocalize("WARNING");
- AprilFools_ = false;
-
_trace();
int value(UIApplicationMain(argc, argv, @"Cydia", @"Cydia"));