source: orbit/iOS/Orbit/Orbit/controllers/SupportViewController.m @ 2e79fbc

ServoTab_Interfacepyramid
Last change on this file since 2e79fbc was 2e79fbc, checked in by Steve Castellotti <sc@…>, 7 years ago

Support:

  • Launch support and forum pages in Safari
  • Property mode set to 100644
File size: 2.8 KB
Line 
1//
2//  SupportViewController.m
3//  orbit
4//
5//  Created by Jonathon Horsman on 11/07/2013.
6//  Copyright (c) 2013 Puzzlebox Productions, LLC. All rights reserved.
7//
8
9#import "SupportViewController.h"
10
11@implementation SupportViewController
12
13@synthesize webView, retryButton, status;
14
15- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
16{
17    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
18    if (self) {
19        // Custom initialization
20    }
21    return self;
22}
23
24- (void)viewDidLoad
25{
26    [super viewDidLoad];
27    [self loadSupportSite];
28}
29
30//UIWebView *description;
31//@synthesize description;
32
33#define BASEURL [NSURL fileURLWithPath:[[NSBundle mainBundle] bundlePath]]
34- (void) loadSupportSite
35{
36//    [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString: @"http://puzzlebox.info/forums/forumdisplay.php?fid=4"]]];
37//    [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString: @"http://orbit.puzzlebox.info/contact"]]];
38
39//   [description loadHTMLString:string baseURL:nil];
40//   description.delegate = self;
41   
42   NSString *urlAddress = [[NSBundle mainBundle] pathForResource:@"support" ofType:@"html"];
43   
44   NSURL *url = [NSURL fileURLWithPath:urlAddress];
45   NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
46   [webView loadRequest:requestObj];
47   
48   
49}
50
51
52-(BOOL) webView:(UIWebView *)inWeb shouldStartLoadWithRequest:(NSURLRequest *)inRequest navigationType:(UIWebViewNavigationType)inType {
53   if ( inType == UIWebViewNavigationTypeLinkClicked ) {
54      [[UIApplication sharedApplication] openURL:[inRequest URL]];
55      return NO;
56   }
57   
58   return YES;
59}
60
61
62//-(BOOL) webView:(UIWebView *)inWeb shouldStartLoadWithRequest:(NSURLRequest *)inRequest navigationType:(UIWebViewNavigationType)inType {
63//   if ( inType == UIWebViewNavigationTypeLinkClicked ) {
64//      NSURL *url = [inRequest URL];
65//      if ([[url absoluteString] rangeOfString:@"tracker"].location == NSNotFound) {
66//         [[UIApplication sharedApplication] openURL:[inRequest URL]];
67//         return NO;
68//      }
69//   }
70//   return YES;
71//}
72
73
74#pragma mark UIWebViewDelegate methods
75
76- (void)webViewDidFinishLoad:(UIWebView *)webView
77{
78    retryButton.hidden = YES;
79    status.hidden = YES;
80}
81
82- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error
83{
84    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Not Connected" message:@"Unable to view support since you have no internet connection" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
85    [alert show];
86    retryButton.hidden = NO;
87    status.hidden = NO;
88    status.text = @"Unable to load support site";
89}
90
91#pragma mark button press methods
92
93- (IBAction) retryButtonPressed:(id) sender {
94    retryButton.hidden = YES;
95    status.text = @"Loading support website...";
96    [self loadSupportSite];
97}
98
99@end
Note: See TracBrowser for help on using the repository browser.