Browse Source

About View: open external links in default browser

Felix Paul Kühne 12 years ago
parent
commit
efa21f521c
2 changed files with 7 additions and 1 deletions
  1. 1 1
      AspenProject/VLCAboutViewController.h
  2. 6 0
      AspenProject/VLCAboutViewController.m

+ 1 - 1
AspenProject/VLCAboutViewController.h

@@ -8,7 +8,7 @@
 
 #import <UIKit/UIKit.h>
 
-@interface VLCAboutViewController : UIViewController
+@interface VLCAboutViewController : UIViewController <UIWebViewDelegate>
 
 @property (nonatomic, strong) IBOutlet UIWebView *webView;
 @property (nonatomic, strong) IBOutlet UILabel *aspenVersion;

+ 6 - 0
AspenProject/VLCAboutViewController.m

@@ -28,6 +28,7 @@
     [super viewDidLoad];
 
     [self.webView loadHTMLString:[NSString stringWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"About Contents" ofType:@"html"] encoding:NSUTF8StringEncoding error:nil] baseURL:nil];
+    self.webView.delegate = self;
     self.aspenVersion.text = [[NSString stringWithFormat:NSLocalizedString(@"VERSION_FORMAT",@""), [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"]] stringByAppendingFormat:@" %@", kVLCVersionCodename];
     self.vlckitVersion.text = [NSString stringWithFormat:NSLocalizedString(@"BASED_ON_FORMAT",@""),[[VLCLibrary sharedLibrary] version]];
 
@@ -39,6 +40,11 @@
     self.navigationItem.rightBarButtonItem = _dismissButton;
 }
 
+- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
+{
+    return ![[UIApplication sharedApplication] openURL:request.URL];
+}
+
 - (void)dismiss
 {
     [self dismissModalViewControllerAnimated:YES];