VLCAboutViewController.m 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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.webView loadHTMLString:[NSString stringWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"About Contents" ofType:@"html"] encoding:NSUTF8StringEncoding error:nil] baseURL:nil];
  22. self.webView.delegate = self;
  23. self.aspenVersion.text = [[NSString stringWithFormat:NSLocalizedString(@"VERSION_FORMAT",@""), [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"]] stringByAppendingFormat:@" %@", kVLCVersionCodename];
  24. self.vlckitVersion.text = [NSString stringWithFormat:NSLocalizedString(@"BASED_ON_FORMAT",@""),[[VLCLibrary sharedLibrary] version]];
  25. if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
  26. self.navigationItem.rightBarButtonItem = [UIBarButtonItem themedDoneButtonWithTarget:self andSelector:@selector(dismiss)];
  27. }
  28. - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
  29. {
  30. NSURL *requestURL = request.URL;
  31. if (![requestURL.scheme isEqualToString:@""])
  32. return ![[UIApplication sharedApplication] openURL:requestURL];
  33. else
  34. return YES;
  35. }
  36. - (void)webViewDidFinishLoad:(UIWebView *)webView
  37. {
  38. webView.alpha = 0.;
  39. CGFloat alpha = 1.;
  40. void (^animationBlock)() = ^() {
  41. webView.alpha = alpha;
  42. };
  43. void (^completionBlock)(BOOL finished) = ^(BOOL finished) {
  44. webView.hidden = NO;
  45. };
  46. [UIView animateWithDuration:1. animations:animationBlock completion:completionBlock];
  47. }
  48. - (void)dismiss
  49. {
  50. [self dismissModalViewControllerAnimated:YES];
  51. }
  52. @end