VLCAboutViewController.m 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
  27. self.navigationItem.rightBarButtonItem = [UIBarButtonItem themedDoneButtonWithTarget:self andSelector:@selector(dismiss)];
  28. }
  29. - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
  30. {
  31. NSURL *requestURL = request.URL;
  32. if (![requestURL.scheme isEqualToString:@""])
  33. return ![[UIApplication sharedApplication] openURL:requestURL];
  34. else
  35. return YES;
  36. }
  37. - (void)webViewDidFinishLoad:(UIWebView *)webView
  38. {
  39. webView.alpha = 0.;
  40. CGFloat alpha = 1.;
  41. void (^animationBlock)() = ^() {
  42. webView.alpha = alpha;
  43. };
  44. void (^completionBlock)(BOOL finished) = ^(BOOL finished) {
  45. webView.hidden = NO;
  46. };
  47. [UIView animateWithDuration:1. animations:animationBlock completion:completionBlock];
  48. }
  49. - (void)dismiss
  50. {
  51. [self dismissModalViewControllerAnimated:YES];
  52. }
  53. @end