diff options
Diffstat (limited to 'CyteKit/WebViewController.mm')
-rw-r--r-- | CyteKit/WebViewController.mm | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/CyteKit/WebViewController.mm b/CyteKit/WebViewController.mm index 7d91177..f1448e1 100644 --- a/CyteKit/WebViewController.mm +++ b/CyteKit/WebViewController.mm @@ -461,10 +461,29 @@ float CYScrollViewDecelerationRateNormal; NSLog(@"decidePolicyForNavigationAction:%@ request:%@ %@ frame:%@", action, request, [request allHTTPHeaderFields], frame); #endif + NSURL *url(request == nil ? nil : [request URL]); + if ([[url scheme] isEqualToString:@"itms-appss"] || [[url absoluteString] hasPrefix:@"https://itunes.apple.com/app/"]) { + appstore_ = url; + + UIAlertView *alert = [[[UIAlertView alloc] + initWithTitle:UCLocalize("APP_STORE_REDIRECT") + message:nil + delegate:self + cancelButtonTitle:UCLocalize("CANCEL") + otherButtonTitles: + UCLocalize("ALLOW"), + nil + ] autorelease]; + + [alert setContext:@"itmsappss"]; + [alert show]; + + [listener ignore]; + return; + } + if ([frame parentFrame] == nil) { if (!error_) { - NSURL *url(request == nil ? nil : [request URL]); - if (request_ != nil && ![[request_ URL] isEqual:url] && ![self allowsNavigationAction]) { if (url != nil) [self pushRequest:request forAction:action asPop:NO]; @@ -735,6 +754,13 @@ float CYScrollViewDecelerationRateNormal; challenge_ = nil; [alert dismissWithClickedButtonIndex:-1 animated:YES]; + } else if ([context isEqualToString:@"itmsappss"]) { + if (button == [alert cancelButtonIndex]) { + } else if (button == [alert firstOtherButtonIndex]) { + [delegate_ openURL:appstore_]; + } + + [alert dismissWithClickedButtonIndex:-1 animated:YES]; } else if ([context isEqualToString:@"submit"]) { if (button == [alert cancelButtonIndex]) { } else if (button == [alert firstOtherButtonIndex]) { |