Commit a5e1b530 authored by Alex Moore's avatar Alex Moore

merged interface changes

parent 8dd8b580
No preview for this file type
......@@ -485,6 +485,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
"GCC_PREPROCESSOR_DEFINITIONS_NOT_USED_IN_PRECOMPS[arch=*]" = "TESTING=1";
INFOPLIST_FILE = WAMI/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LIBRARY_SEARCH_PATHS = (
......@@ -562,6 +563,7 @@
EFDA4EF21ABFC128002B9CEC /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
EFDA4EF31ABFC128002B9CEC /* Build configuration list for PBXNativeTarget "WAMITests" */ = {
isa = XCConfigurationList;
......@@ -570,6 +572,7 @@
EFDA4EF51ABFC128002B9CEC /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
......
......@@ -19,5 +19,6 @@
@property(nonatomic, retain) UIWebView *web;
@property(nonatomic, assign) bool isInitialized;
+(GlobalWebController*) getInstance;
+(GlobalWebController*) resetInstance;
@end
......@@ -25,6 +25,15 @@ static GlobalWebController *instance = nil;
}
return instance;
}
+(GlobalWebController*) resetInstance
{
@synchronized(self)
{
instance = [GlobalWebController new];
instance.isInitialized = false;
}
return instance;
}
@end
......@@ -28,6 +28,8 @@
// Do any additional setup after loading the view.
[self.view addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self.view action:@selector(endEditing:)]];
self.navigationItem.hidesBackButton = YES;
[self resetRTI];
}
- (void)didReceiveMemoryWarning {
......@@ -52,6 +54,30 @@
-(IBAction)unwind:(UIStoryboardSegue *)sender {
//reset UIWebView here
[self resetRTI];
}
-(void) resetRTI {
GlobalWebController *globalWeb = [GlobalWebController resetInstance];
self.webview = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 0, 0)];
globalWeb.web = self.webview;
globalWeb.isInitialized = true;
#ifndef TESTING
NSURLRequest *rti = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://192.168.1.131/rti/"]];
[[NSURLCache sharedURLCache] removeCachedResponseForRequest:rti];
//Clean the cookie jar
NSHTTPCookieStorage *storage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
for (NSHTTPCookie *cookie in [storage cookies]) {
[storage deleteCookie:cookie];
}
[[NSUserDefaults standardUserDefaults] synchronize];
[self.webview loadRequest:rti];
#else
// Test collection page on mac mini desktop
[self.webview loadRequest:[NSURLRequest requestWithURL: [NSURL URLWithString:@"file:///Users/plucseniordesign/Desktop/response.html"]]];//RTISetup.html"]]];
#endif
[self.webview setDelegate:self];
}
......@@ -126,12 +152,16 @@
// [loginAlert show];
//For testing
// if([self.txtUsername.text isEqualToString:@"circ_admin"] && [self.txtPassword.text isEqualToString:@"silver"]) {//check username and password
#ifdef TESTING
if([self.txtUsername.text isEqualToString:@"circ_admin"] && [self.txtPassword.text isEqualToString:@"silver"]) {//check username and password
[self performSegueWithIdentifier:@"segueLogIn" sender:nil];
// } else {
// UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Incorrect login" message:@"Username or password incorrect" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
// [alert show];
// }
} else {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Incorrect login" message:@"Username or password incorrect" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
[alert show];
}
#else
[self performSegueWithIdentifier:@"segueLogIn" sender:nil];
#endif
}
@end
This diff is collapsed.
......@@ -41,7 +41,7 @@ static int BOOK_ID_LENGTH = 14;
[super viewDidLoad];
// Do any additional setup after loading the view.
lblSection.text = session.section;
//[self.view addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self.view action:@selector(endEditing:)]];
[self.view addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self.view action:@selector(endEditing:)]];
// SEND SESSION TO RTI
......@@ -57,8 +57,9 @@ static int BOOK_ID_LENGTH = 14;
//For testing
//[self.webview loadRequest:[NSURLRequest requestWithURL: [NSURL
// URLWithString:@"file:///Users/plucseniordesign/Desktop/RTIScan2/RTIScan2.html"]]];
#ifdef TESTING
[self.webview loadRequest:[NSURLRequest requestWithURL: [NSURL URLWithString:@"file:///Users/plucseniordesign/Desktop/RTIScan2/RTIScan2.html"]]];
#endif
}
-(void) viewDidAppear:(BOOL)animated {
......@@ -75,11 +76,21 @@ static int BOOK_ID_LENGTH = 14;
- (void)webViewDidFinishLoad:(UIWebView *)webView {
[super webViewDidFinishLoad:webView];
#ifdef TESTING
// Get scanned codes - Testing GetScanned
NSString *getScanPath =
[[NSBundle mainBundle] pathForResource:@"GetScanned" ofType:@"js"];
NSString *getScan = [NSString stringWithContentsOfFile:getScanPath
encoding:NSUTF8StringEncoding
error:nil];
NSString *scanned =
[self.webview stringByEvaluatingJavaScriptFromString:getScan];
[self extractInformation:scanned];
#endif
NSURLRequest *currentRequest = [webView request];
NSURL *currentURL = [currentRequest URL];
NSLog(@"2: Current URL is %@", currentURL.absoluteString);
}
- (void)extractInformation:(NSString *)scannedBooks {
......@@ -96,7 +107,7 @@ static int BOOK_ID_LENGTH = 14;
NSString *idNum;
for(NSTextCheckingResult *range in rangeList) {
idNum = [scannedBooks substringWithRange:[range rangeAtIndex:1]];
NSLog(idNum);
NSLog(@"%@",idNum);
[self.idList addObject:idNum];
}
//Extract book call number
......@@ -105,7 +116,7 @@ static int BOOK_ID_LENGTH = 14;
NSString *callNum;
for(NSTextCheckingResult *range in rangeList) {
callNum = [scannedBooks substringWithRange:[range rangeAtIndex:1]];
NSLog(callNum);
NSLog(@"%@",callNum);
[self.callNumList addObject:callNum];
}
//Extract book title
......@@ -114,7 +125,7 @@ static int BOOK_ID_LENGTH = 14;
NSString *title;
for(NSTextCheckingResult *range in rangeList) {
title = [scannedBooks substringWithRange:[range rangeAtIndex:1]];
NSLog(title);
NSLog(@"%@",title);
[self.titleList addObject:[scannedBooks substringWithRange:[range rangeAtIndex:1]]];
}
......@@ -308,34 +319,6 @@ static int BOOK_ID_LENGTH = 14;
[self barcodeTextChanged];
}
- (IBAction)clickedFinish:(id)sender {
NSString *path =
[[NSBundle mainBundle] pathForResource:@"WhatPage" ofType:@"js"];
NSString *content = [NSString stringWithContentsOfFile:path
encoding:NSUTF8StringEncoding
error:nil];
NSString *page =
[self.webview stringByEvaluatingJavaScriptFromString:content];
NSLog(@"PAGE NUMBER IS: %@\n", page);
// Test FinishScan
if ([page isEqual:@"2"]) { // Scan Page
NSString *finishPath =
[[NSBundle mainBundle] pathForResource:@"FinishScan" ofType:@"js"];
NSString *finish = [NSString stringWithContentsOfFile:finishPath
encoding:NSUTF8StringEncoding
error:nil];
NSString *isFinished =
[self.webview stringByEvaluatingJavaScriptFromString:finish];
if ([isFinished isEqual:@"-1"]) {
} else {
NSLog(@"FINISHED NOT FAILED\n");
}
}
}
//- (void)decoderDataReceived:(NSString *)data {
// [super decoderDataReceived:data];
// [self textChange];
......
......@@ -34,7 +34,9 @@
[self.tableView reloadData];
//For testing
//[self.webview loadRequest:[NSURLRequest requestWithURL: [NSURL URLWithString:@"file:///Users/plucseniordesign/Desktop/RTISetup.html"]]];
#ifdef TESTING
[self.webview loadRequest:[NSURLRequest requestWithURL: [NSURL URLWithString:@"file:///Users/plucseniordesign/Desktop/RTISetup.html"]]];
#endif
}
- (void)viewDidAppear:(BOOL)animated {
......
......@@ -7,6 +7,7 @@
//
#import <UIKit/UIKit.h>
#import "GlobalWebController.h"
@interface WebViewController : UIViewController<UIWebViewDelegate>
......
......@@ -7,7 +7,6 @@
//
#import "WebViewController.h"
#import "GlobalWebController.h"
@interface WebViewController ()
@property NSString *page;
......@@ -23,34 +22,19 @@
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
GlobalWebController *globalWeb = [GlobalWebController getInstance];
if (!globalWeb.isInitialized) {
self.webview = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 0, 0)];
globalWeb.web = self.webview;
globalWeb.isInitialized = true;
NSURLRequest *rti = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://192.168.1.131/rti/"]];
[[NSURLCache sharedURLCache] removeCachedResponseForRequest:rti];
//Clean the cookie jar
NSHTTPCookieStorage *storage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
for (NSHTTPCookie *cookie in [storage cookies]) {
[storage deleteCookie:cookie];
}
[[NSUserDefaults standardUserDefaults] synchronize];
[self.webview loadRequest:rti];
// Test collection page on mac mini desktop
//[self.webview loadRequest:[NSURLRequest requestWithURL: [NSURL
// URLWithString:@"file:///Users/plucseniordesign/Desktop/response.html"]]];//RTISetup.html"]]];
[self.webview setDelegate:self];
}
else {
self.webview = [GlobalWebController getInstance].web;
[self.view addSubview:self.webview];
[self.webview setDelegate:self];
}
// GlobalWebController *globalWeb = [GlobalWebController getInstance];
// else {
// self.webview = [GlobalWebController getInstance].web;
// //[self.view addSubview:self.webview];
// [self.webview setDelegate:self];
// }
self.webview = [GlobalWebController getInstance].web;
[self.webview setDelegate:self];
[self.view addSubview:self.webview];
}
-(void) viewWillAppear:(BOOL)animated {
[self.view addSubview:self.webview];
-(void) viewDidAppear:(BOOL)animated {
// [self.view addSubview:self.webview];
}
- (void)didReceiveMemoryWarning {
......@@ -114,86 +98,6 @@
}
}
- (IBAction)clickedSetup:(id)sender {
NSString *path =
[[NSBundle mainBundle] pathForResource:@"WhatPage" ofType:@"js"];
NSString *content = [NSString stringWithContentsOfFile:path
encoding:NSUTF8StringEncoding
error:nil];
NSString *page =
[self.webview stringByEvaluatingJavaScriptFromString:content];
NSLog(@"PAGE NUMBER IS: %@\n", page);
if ([page isEqual:@"1"]) {
// Get selected collections
NSString *selectedPath =
[[NSBundle mainBundle] pathForResource:@"GetSelectedCollections"
ofType:@"js"];
NSString *selectedFunc =
[NSString stringWithContentsOfFile:selectedPath
encoding:NSUTF8StringEncoding
error:nil];
NSString *selected =
[self.webview stringByEvaluatingJavaScriptFromString:selectedFunc];
UIAlertView *selectedAlert =
[[UIAlertView alloc] initWithTitle:@"Collections Selected"
message:selected
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[selectedAlert show];
// Testing AddCollection
// NSString *addSelectedPath =
// [[NSBundle mainBundle] pathForResource:@"AddCollection"
// ofType:@"js"];
// NSString *addSelected =
// [NSString stringWithContentsOfFile:addSelectedPath
// encoding:NSUTF8StringEncoding
// error:nil];
//
// [self.webview
// stringByEvaluatingJavaScriptFromString:@"var selectedAdd = 49;"];
// NSString *add =
// [self.webview
// stringByEvaluatingJavaScriptFromString:addSelected];
//
// if ([add isEqual:nil]) {
// NSLog(@"nil failed");
// } else {
// NSLog(@"NOT NILL UNFAILED");
// }
// Testing RemoveCollection
// NSString *removeSelectedPath =
// [[NSBundle mainBundle] pathForResource:@"RemoveCollection"
// ofType:@"js"];
// NSString *removeSelected =
// [NSString stringWithContentsOfFile:removeSelectedPath
// encoding:NSUTF8StringEncoding
// error:nil];
//
// [self.webview
// stringByEvaluatingJavaScriptFromString:@"var selectedRemove =
// 0;"];
// NSString *remove =
// [self.webview
// stringByEvaluatingJavaScriptFromString:removeSelected];
// // Testing Save SetUp
// NSString *saveSetupPath =
// [[NSBundle mainBundle] pathForResource:@"SaveSetup" ofType:@"js"];
// NSString *saveSetup =
// [NSString stringWithContentsOfFile:saveSetupPath
// encoding:NSUTF8StringEncoding
// error:nil];
//
// [self.webview stringByEvaluatingJavaScriptFromString:saveSetup];
}
}
/*
#pragma mark - Navigation
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment