source: orbit/iOS/Orbit/Orbit/controllers/SupportViewController.m @ 99d222a

ServoTab_Interfacepyramid
Last change on this file since 99d222a was 99d222a, checked in by Steve Castellotti <sc@…>, 6 years ago

Support:

  • all results open in Safari
  • Property mode set to 100644
File size: 2.5 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
31#define BASEURL [NSURL fileURLWithPath:[[NSBundle mainBundle] bundlePath]]
32- (void) loadSupportSite
33{
34   //    [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString: @"http://puzzlebox.info/forums/forumdisplay.php?fid=4"]]];
35   //    [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString: @"http://orbit.puzzlebox.info/contact"]]];
36   
37   
38   NSString *urlAddress = [[NSBundle mainBundle] pathForResource:@"support" ofType:@"html"];
39   
40   NSURL *url = [NSURL fileURLWithPath:urlAddress];
41   NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
42   [webView loadRequest:requestObj];
43   
44   
45}
46
47
48-(BOOL) webView:(UIWebView *)inWeb shouldStartLoadWithRequest:(NSURLRequest *)inRequest navigationType:(UIWebViewNavigationType)inType {
49   
50   // Launch clicked links in Safari
51   if ( inType == UIWebViewNavigationTypeLinkClicked ) {
52      [[UIApplication sharedApplication] openURL:[inRequest URL]];
53      return NO;
54   }
55   
56   // Launch form results in Safari
57   if ( inType == UIWebViewNavigationTypeFormSubmitted ) {
58      [[UIApplication sharedApplication] openURL:[inRequest URL]];
59      return NO;
60   }
61   
62   return YES;
63   
64}
65
66
67
68#pragma mark UIWebViewDelegate methods
69
70- (void)webViewDidFinishLoad:(UIWebView *)webView
71{
72   retryButton.hidden = YES;
73   status.hidden = YES;
74}
75
76- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error
77{
78   UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Not Connected" message:@"Unable to view support since you have no internet connection" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
79   [alert show];
80   retryButton.hidden = NO;
81   status.hidden = NO;
82   status.text = @"Unable to load support site";
83}
84
85#pragma mark button press methods
86
87- (IBAction) retryButtonPressed:(id) sender {
88   retryButton.hidden = YES;
89   status.text = @"Loading support website...";
90   [self loadSupportSite];
91}
92
93@end
Note: See TracBrowser for help on using the repository browser.