VLCAboutViewController.m 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. - (void)viewDidLoad
  14. {
  15. [super viewDidLoad];
  16. self.navigationItem.title = NSLocalizedString(@"ABOUT_APP", @"");
  17. NSMutableString *htmlContent = [NSMutableString stringWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"About Contents" ofType:@"html"] encoding:NSUTF8StringEncoding error:nil];
  18. [htmlContent replaceOccurrencesOfString:@"ASPENVERSION" withString:[[NSString stringWithFormat:NSLocalizedString(@"VERSION_FORMAT",@""), [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"]] stringByAppendingFormat:@" %@", kVLCVersionCodename] options:NSLiteralSearch range:NSMakeRange(0, 1000)];
  19. [htmlContent replaceOccurrencesOfString:@"MOBILEVLCKITVERSION" withString:[NSString stringWithFormat:NSLocalizedString(@"BASED_ON_FORMAT",@""),[[VLCLibrary sharedLibrary] version]] options:NSLiteralSearch range:NSMakeRange(0, 1000)];
  20. [self.webView loadHTMLString:[NSString stringWithString:htmlContent] baseURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] bundlePath]]];
  21. htmlContent = nil;
  22. self.webView.delegate = self;
  23. }
  24. - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
  25. {
  26. NSURL *requestURL = request.URL;
  27. if (![requestURL.scheme isEqualToString:@""])
  28. return ![[UIApplication sharedApplication] openURL:requestURL];
  29. else
  30. return YES;
  31. }
  32. - (void)webViewDidFinishLoad:(UIWebView *)webView
  33. {
  34. webView.alpha = 0.;
  35. CGFloat alpha = 1.;
  36. void (^animationBlock)() = ^() {
  37. webView.alpha = alpha;
  38. };
  39. void (^completionBlock)(BOOL finished) = ^(BOOL finished) {
  40. webView.hidden = NO;
  41. };
  42. [UIView animateWithDuration:.3 animations:animationBlock completion:completionBlock];
  43. }
  44. @end