11 #import "AboutController.h"
13 #import "BlockAlertView.h"
19 - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
21 if ((
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]))
25 [
self setTitle:NSLocalizedString(@"About", @"About Controller title")];
26 UIImage *tabBarIcon = [UIImage
27 imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"tabbar_icon_about"
29 [
self setTabBarItem:[[[UITabBarItem alloc]
30 initWithTitle:NSLocalizedString(@"About", @"Tabbar item about")
34 last_link_clicked = nil;
42 [last_link_clicked release];
48 webView = [[[UIWebView alloc] initWithFrame:CGRectZero] autorelease];
50 setAutoresizingMask:(UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight)];
51 [webView setAutoresizesSubviews:YES];
52 [webView setDelegate:self];
53 [webView setDataDetectorTypes:UIDataDetectorTypeNone];
54 [
self setView:webView];
62 NSString *filename = (IsPhone() ?
@"about_phone" :
@"about");
63 NSString *htmlString = [[[NSString alloc]
64 initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:filename
66 inDirectory:@"about_page"]
67 encoding:NSUTF8StringEncoding
68 error:nil] autorelease];
71 loadHTMLString:[NSString stringWithFormat:htmlString, TSXAppFullVersion(),
72 [[UIDevice currentDevice] systemName],
73 [[UIDevice currentDevice] systemVersion],
74 [[UIDevice currentDevice] model]]
75 baseURL:[NSURL fileURLWithPath:[[[NSBundle mainBundle] bundlePath]
76 stringByAppendingPathComponent:@"about_page"]]];
80 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
86 #pragma mark UIWebView callbacks
87 - (BOOL)webView:(UIWebView *)webView
88 shouldStartLoadWithRequest:(NSURLRequest *)request
89 navigationType:(UIWebViewNavigationType)navigationType
91 if ([[request URL] isFileURL])
94 if (navigationType == UIWebViewNavigationTypeLinkClicked)
96 [last_link_clicked release];
97 last_link_clicked = [[[request URL] absoluteString] retain];
99 alertWithTitle:NSLocalizedString(@"External Link", @"External Link Alert Title")
100 message:[NSString stringWithFormat:
102 @"Open [%@] in Browser?",
103 @"Open link in browser (with link as parameter)"),
106 [alert setCancelButtonWithTitle:NSLocalizedString(@"No", @"No Button") block:nil];
107 [alert addButtonWithTitle:NSLocalizedString(@"OK", @"OK Button")
109 [[UIApplication sharedApplication]
110 openURL:[NSURL URLWithString:last_link_clicked]];