VLCAboutViewController.m 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. //
  2. // VLCAboutViewController.m
  3. // AspenProject
  4. //
  5. // Created by Felix Paul Kühne on 07.04.13.
  6. // Copyright (c) 2013 VideoLAN. All rights reserved.
  7. //
  8. // Refer to the COPYING file of the official project for license.
  9. //
  10. #import "VLCAboutViewController.h"
  11. #import "UIBarButtonItem+Theme.h"
  12. @implementation VLCAboutViewController
  13. - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
  14. {
  15. self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
  16. return self;
  17. }
  18. - (void)viewDidLoad
  19. {
  20. [super viewDidLoad];
  21. self.navigationItem.title = NSLocalizedString(@"ABOUT_APP", @"");
  22. [self.webView loadHTMLString:[NSString stringWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"About Contents" ofType:@"html"] encoding:NSUTF8StringEncoding error:nil] baseURL:nil];
  23. self.webView.delegate = self;
  24. self.aspenVersion.text = [[NSString stringWithFormat:NSLocalizedString(@"VERSION_FORMAT",@""), [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"]] stringByAppendingFormat:@" %@", kVLCVersionCodename];
  25. self.vlckitVersion.text = [NSString stringWithFormat:NSLocalizedString(@"BASED_ON_FORMAT",@""),[[VLCLibrary sharedLibrary] version]];
  26. }
  27. - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
  28. {
  29. NSURL *requestURL = request.URL;
  30. if (![requestURL.scheme isEqualToString:@""])
  31. return ![[UIApplication sharedApplication] openURL:requestURL];
  32. else
  33. return YES;
  34. }
  35. - (void)webViewDidFinishLoad:(UIWebView *)webView
  36. {
  37. webView.alpha = 0.;
  38. CGFloat alpha = 1.;
  39. void (^animationBlock)() = ^() {
  40. webView.alpha = alpha;
  41. };
  42. void (^completionBlock)(BOOL finished) = ^(BOOL finished) {
  43. webView.hidden = NO;
  44. };
  45. [UIView animateWithDuration:1. animations:animationBlock completion:completionBlock];
  46. }
  47. @end