source: orbit/iOS/Orbit/Orbit/controllers/SupportViewController.m @ 5d87396

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

Support:

  • Email contact passed to CGI-BIN script
  • Property mode set to 100644
File size: 2.9 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   // UIWebViewNavigationType
51//   UIWebViewNavigationTypeLinkClicked,
52//   UIWebViewNavigationTypeFormSubmitted,
53//   UIWebViewNavigationTypeBackForward,
54//   UIWebViewNavigationTypeReload,
55//   UIWebViewNavigationTypeFormResubmitted,
56//   UIWebViewNavigationTypeOther
57   
58   // Launch clicked links in Safari
59   if ( inType == UIWebViewNavigationTypeLinkClicked ) {
60      [[UIApplication sharedApplication] openURL:[inRequest URL]];
61      return NO;
62   }
63   
64   // Launch form results in Safari
65//   if ( inType == UIWebViewNavigationTypeFormSubmitted ) {
66//      [[UIApplication sharedApplication] openURL:[inRequest URL]];
67//      return NO;
68//   }
69   
70   // Launch reloaded results in Safari
71//      if ( inType == UIWebViewNavigationTypeReload ) {
72//         [[UIApplication sharedApplication] openURL:[inRequest URL]];
73//         return NO;
74//      }
75   
76   return YES;
77   
78}
79
80
81
82#pragma mark UIWebViewDelegate methods
83
84- (void)webViewDidFinishLoad:(UIWebView *)webView
85{
86   retryButton.hidden = YES;
87   status.hidden = YES;
88}
89
90- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error
91{
92   UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Not Connected" message:@"Unable to view support since you have no internet connection" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
93   [alert show];
94   retryButton.hidden = NO;
95   status.hidden = NO;
96   status.text = @"Unable to load support site";
97}
98
99#pragma mark button press methods
100
101- (IBAction) retryButtonPressed:(id) sender {
102   retryButton.hidden = YES;
103   status.text = @"Loading support website...";
104   [self loadSupportSite];
105}
106
107@end
Note: See TracBrowser for help on using the repository browser.