source: orbit/iOS/Orbit/Orbit/controllers/SupportViewController.m

Last change on this file was 6db346c, checked in by Steve Castellotti <sc@…>, 6 years ago
  • Scoring fields added
  • Tilt Control widgets added
  • Property mode set to 100644
File size: 3.1 KB
Line 
1//
2//  SupportViewController.m
3//  orbit
4//
5//  Copyright (c) 2013 Puzzlebox Productions, LLC. All rights reserved.
6//  Originally created by Jonathon Horsman.
7//
8//  This code is released under the GNU Public License (GPL) version 2
9//  For more information please refer to http://www.gnu.org/copyleft/gpl.html
10//
11
12#import "SupportViewController.h"
13
14@implementation SupportViewController
15
16@synthesize webView, retryButton, status;
17
18- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
19{
20   self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
21   if (self) {
22      // Custom initialization
23   }
24   return self;
25}
26
27- (void)viewDidLoad
28{
29   [super viewDidLoad];
30   [self loadSupportSite];
31}
32
33
34#define BASEURL [NSURL fileURLWithPath:[[NSBundle mainBundle] bundlePath]]
35- (void) loadSupportSite
36{
37   //    [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString: @"http://puzzlebox.info/forums/forumdisplay.php?fid=4"]]];
38   //    [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString: @"http://orbit.puzzlebox.info/contact"]]];
39   
40   
41   NSString *urlAddress = [[NSBundle mainBundle] pathForResource:@"support" ofType:@"html"];
42   
43   NSURL *url = [NSURL fileURLWithPath:urlAddress];
44   NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
45   [webView loadRequest:requestObj];
46   
47   
48}
49
50
51-(BOOL) webView:(UIWebView *)inWeb shouldStartLoadWithRequest:(NSURLRequest *)inRequest navigationType:(UIWebViewNavigationType)inType {
52   
53   // UIWebViewNavigationType
54//   UIWebViewNavigationTypeLinkClicked,
55//   UIWebViewNavigationTypeFormSubmitted,
56//   UIWebViewNavigationTypeBackForward,
57//   UIWebViewNavigationTypeReload,
58//   UIWebViewNavigationTypeFormResubmitted,
59//   UIWebViewNavigationTypeOther
60   
61   // Launch clicked links in Safari
62   if ( inType == UIWebViewNavigationTypeLinkClicked ) {
63      [[UIApplication sharedApplication] openURL:[inRequest URL]];
64      return NO;
65   }
66   
67   // Launch form results in Safari
68//   if ( inType == UIWebViewNavigationTypeFormSubmitted ) {
69//      [[UIApplication sharedApplication] openURL:[inRequest URL]];
70//      return NO;
71//   }
72   
73   // Launch reloaded results in Safari
74//      if ( inType == UIWebViewNavigationTypeReload ) {
75//         [[UIApplication sharedApplication] openURL:[inRequest URL]];
76//         return NO;
77//      }
78   
79   return YES;
80   
81}
82
83
84
85#pragma mark UIWebViewDelegate methods
86
87- (void)webViewDidFinishLoad:(UIWebView *)webView
88{
89   retryButton.hidden = YES;
90   status.hidden = YES;
91}
92
93- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error
94{
95   UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Not Connected" message:@"Unable to view support since you have no internet connection" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
96   [alert show];
97   retryButton.hidden = NO;
98   status.hidden = NO;
99   status.text = @"Unable to load support site";
100}
101
102#pragma mark button press methods
103
104- (IBAction) retryButtonPressed:(id) sender {
105   retryButton.hidden = YES;
106   status.text = @"Loading support website...";
107   [self loadSupportSite];
108}
109
110@end
Note: See TracBrowser for help on using the repository browser.