diff options
-rw-r--r-- | CyteKit/WebViewController.mm | 7 | ||||
-rw-r--r-- | MobileCydia.mm | 26 |
2 files changed, 20 insertions, 13 deletions
diff --git a/CyteKit/WebViewController.mm b/CyteKit/WebViewController.mm index 964e523..76379fb 100644 --- a/CyteKit/WebViewController.mm +++ b/CyteKit/WebViewController.mm @@ -775,6 +775,10 @@ float CYScrollViewDecelerationRateNormal; } return self; } +- (NSString *) applicationNameForUserAgent { + return nil; +} + - (void) loadView { CGRect bounds([[UIScreen mainScreen] applicationFrame]); @@ -812,6 +816,9 @@ float CYScrollViewDecelerationRateNormal; [preferences setJavaScriptCanOpenWindowsAutomatically:YES]; [preferences setOfflineWebApplicationCacheEnabled:YES]; + if (NSString *agent = [self applicationNameForUserAgent]) + [webview setApplicationNameForUserAgent:agent]; + if ([webview respondsToSelector:@selector(setShouldUpdateWhileOffscreen:)]) [webview setShouldUpdateWhileOffscreen:NO]; diff --git a/MobileCydia.mm b/MobileCydia.mm index 11127ac..3d92930 100644 --- a/MobileCydia.mm +++ b/MobileCydia.mm @@ -4279,22 +4279,22 @@ static _H<NSMutableSet> Diversions_; [cydia_ setDelegate:delegate]; } -- (id) init { - if ((self = [super initWithWidth:0 ofClass:[CydiaWebViewController class]]) != nil) { - cydia_ = [[[CydiaObject alloc] initWithDelegate:indirect_] autorelease]; - - WebView *webview([[webview_ _documentView] webView]); +- (NSString *) applicationNameForUserAgent { + NSString *application([NSString stringWithFormat:@"Cydia/%@", @ Cydia_]); - NSString *application([NSString stringWithFormat:@"Cydia/%@", @ Cydia_]); + if (Safari_ != nil) + application = [NSString stringWithFormat:@"Safari/%@ %@", Safari_, application]; + if (Build_ != nil) + application = [NSString stringWithFormat:@"Mobile/%@ %@", Build_, application]; + if (Product_ != nil) + application = [NSString stringWithFormat:@"Version/%@ %@", Product_, application]; - if (Safari_ != nil) - application = [NSString stringWithFormat:@"Safari/%@ %@", Safari_, application]; - if (Build_ != nil) - application = [NSString stringWithFormat:@"Mobile/%@ %@", Build_, application]; - if (Product_ != nil) - application = [NSString stringWithFormat:@"Version/%@ %@", Product_, application]; + return application; +} - [webview setApplicationNameForUserAgent:application]; +- (id) init { + if ((self = [super initWithWidth:0 ofClass:[CydiaWebViewController class]]) != nil) { + cydia_ = [[[CydiaObject alloc] initWithDelegate:indirect_] autorelease]; } return self; } |