Commit 1426059d authored by Alex Moore's avatar Alex Moore
Browse files

increased login button size, ran quick tests

parent 5e284abd
......@@ -17,7 +17,10 @@
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
//Recognize tap outside of username/password fields so that keyboard will disappear
[self.view addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self.view action:@selector(endEditing:)]];
//No need for back button - first page
self.navigationItem.hidesBackButton = YES;
}
......@@ -28,6 +31,7 @@
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
//Check if user has "remember username/password" enabled and enter if so
[self checkAndSatisfyUserLoginPreferences];
}
......@@ -37,11 +41,13 @@
//Disable login button
[self.btnLogIn setEnabled:NO];
//Always reset RTI session when reaching this page
[self resetRTI];
}
- (void)webViewDidFinishLoad:(UIWebView *)webView {
//Determine what to do next based on what page loads
[self evaluateNextRTIAction:webView];
}
......@@ -55,12 +61,14 @@
}
//Creates target for segue from section & scanning pages
- (IBAction)prepareForUnwindToLogin:(UIStoryboardSegue *)sender {
}
#pragma mark - Helper Functions
//Check if user has "remember username/password" enabled and enter if so
- (void)checkAndSatisfyUserLoginPreferences {
self.txtPassword.text = @"";
......@@ -84,6 +92,7 @@
}
}
//Reset RTI session by destroying + recreating UIWebView, eliminating cache + cookies
- (void)resetRTI {
//Remove delegate from webview
[self.webview setDelegate:nil];
......@@ -98,6 +107,7 @@
//Set current view as delegate of uiwebview
[self.webview setDelegate:self];
//Create URL request for RTI webpage
NSURLRequest *rti;
#ifdef TESTING
......@@ -122,23 +132,28 @@
[self.view addSubview:self.webview];
}
//Determine what to do next based on what page loads
- (void)evaluateNextRTIAction:(UIWebView *)webView {
//Get current URL
NSString *url = [[webView request] URL].absoluteString;
NSString *base_dest_url;
#ifdef TESTING
base_dest_url = @"http://162.223.19.75";
base_dest_url = @"http://162.223.19.75"; //External IP
#else
base_dest_url = @"http://192.168.1.131";
base_dest_url = @"http://192.168.1.131"; //Internal IP
#endif
//If initial load (before redirect)
if ([url isEqualToString:[base_dest_url stringByAppendingString:@"/rti/"]]) {
NSLog(@"0: %@", url);
}
//Else if login page
else if ([url isEqualToString:[base_dest_url stringByAppendingString:@"/rti/RTILogin.aspx"]]) {
NSLog(@"1: %@", url);
//Enable login button
[self.btnLogIn setEnabled:YES];
}
//Else if section page - means successful login
else if ([url isEqualToString:[base_dest_url stringByAppendingString:@"/rti/RTISetup.aspx?location=1"]]) {
NSLog(@"2: %@", url);
......@@ -182,31 +197,37 @@
#pragma mark - UI Buttons
//When "Log In" button is pressed
- (IBAction)btnLogInTouch:(id)sender {
//Load 1st half of Javascript to execute login
NSString *login1Path =
[[NSBundle mainBundle] pathForResource:@"Login1" ofType:@"js"];
NSString *login1 = [NSString stringWithContentsOfFile:login1Path
encoding:NSUTF8StringEncoding
error:nil];
//Create strings for entering username and password (via Javascript)
NSString *username = @"user.value = \"";
username = [username stringByAppendingString:[self.txtUsername.text stringByAppendingString:@"\";"]];
NSString *password = @"pword.value = \"";
password = [password stringByAppendingString:[self.txtPassword.text stringByAppendingString:@"\";"]];
//Load 2nd half of Javascript to execute login
NSString *login2Path =
[[NSBundle mainBundle] pathForResource:@"Login2" ofType:@"js"];
NSString *login2 = [NSString stringWithContentsOfFile:login2Path
encoding:NSUTF8StringEncoding
error:nil];
//Combine strings to form a single Javascript function
NSString *login = [login1 stringByAppendingString:[username stringByAppendingString:[password stringByAppendingString:login2]]];
//Execute Javascript function to login
[self.webview stringByEvaluatingJavaScriptFromString:login];
}
//When "Remember Username" button is changed
- (IBAction)rememberUsernameBtnChanged:(id)sender {
[[NSUserDefaults standardUserDefaults] setBool:self.rememberUsernameSwitch.isOn forKey:@"rememberUsername"];
if (!self.rememberUsernameSwitch.isOn) {
......@@ -216,6 +237,7 @@
[[NSUserDefaults standardUserDefaults] synchronize];
}
//When "Remember Password" button is changed
- (IBAction)rememberPasswordBtnChanged:(id)sender {
if (self.rememberUsernameSwitch.isOn) {
[[NSUserDefaults standardUserDefaults] setBool:self.rememberPasswordSwitch.isOn forKey:@"rememberPassword"];
......
......@@ -34,15 +34,6 @@
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
</textField>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="rr9-HZ-Pee">
<rect key="frame" x="541" y="250" width="43" height="30"/>
<state key="normal" title="Log In">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="btnLogInTouch:" destination="BYZ-38-t0r" eventType="touchDown" id="lMz-3L-Q1E"/>
</connections>
</button>
<navigationBar contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="TTD-gb-lM9">
<rect key="frame" x="0.0" y="28" width="600" height="44"/>
<items>
......@@ -50,25 +41,25 @@
</items>
</navigationBar>
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="IYZ-Af-OWK">
<rect key="frame" x="223" y="352" width="51" height="31"/>
<rect key="frame" x="223" y="407" width="51" height="31"/>
<connections>
<action selector="rememberPasswordBtnChanged:" destination="BYZ-38-t0r" eventType="valueChanged" id="EFe-ys-vsN"/>
</connections>
</switch>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Remember Username" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Wg4-Jj-Qu2">
<rect key="frame" x="16" y="318" width="168" height="21"/>
<rect key="frame" x="16" y="373" width="168" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Remember Password" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="uxO-hd-8cT">
<rect key="frame" x="16" y="357" width="165" height="21"/>
<rect key="frame" x="16" y="412" width="165" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="jIg-lr-y4q">
<rect key="frame" x="223" y="313" width="51" height="31"/>
<rect key="frame" x="223" y="368" width="51" height="31"/>
<connections>
<action selector="rememberUsernameBtnChanged:" destination="BYZ-38-t0r" eventType="valueChanged" id="zWq-ZI-h8E"/>
</connections>
......@@ -78,32 +69,46 @@
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits" secureTextEntry="YES"/>
</textField>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="rr9-HZ-Pee">
<rect key="frame" x="493" y="270" width="91" height="60"/>
<constraints>
<constraint firstAttribute="width" constant="91" id="DhZ-6W-dRO"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="30"/>
<state key="normal" title="Log In">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="btnLogInTouch:" destination="BYZ-38-t0r" eventType="touchDown" id="lMz-3L-Q1E"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="TTD-gb-lM9" secondAttribute="trailing" id="049-xX-0XW"/>
<constraint firstItem="IYZ-Af-OWK" firstAttribute="centerY" secondItem="uxO-hd-8cT" secondAttribute="centerY" id="0bD-a2-qJT"/>
<constraint firstItem="jIg-lr-y4q" firstAttribute="leading" secondItem="IYZ-Af-OWK" secondAttribute="leading" id="5zr-dI-Ewu"/>
<constraint firstItem="uxO-hd-8cT" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leadingMargin" id="COx-h7-8u2"/>
<constraint firstItem="1dA-Bp-AXg" firstAttribute="leading" secondItem="tJE-yf-FhY" secondAttribute="leading" id="JEQ-u5-BEY"/>
<constraint firstItem="rFc-Xp-Oik" firstAttribute="trailing" secondItem="u4E-6x-G9M" secondAttribute="trailing" id="KIK-Oa-0f0"/>
<constraint firstItem="tJE-yf-FhY" firstAttribute="bottom" secondItem="u4E-6x-G9M" secondAttribute="bottom" id="NMM-pH-vUE"/>
<constraint firstItem="rr9-HZ-Pee" firstAttribute="trailing" secondItem="8bC-Xf-vdC" secondAttribute="trailingMargin" id="RgD-7j-8mI"/>
<constraint firstItem="uxO-hd-8cT" firstAttribute="leading" secondItem="Wg4-Jj-Qu2" secondAttribute="leading" id="Sy5-Om-bET"/>
<constraint firstItem="rFc-Xp-Oik" firstAttribute="leading" secondItem="1dA-Bp-AXg" secondAttribute="trailing" constant="15" id="Ue9-Ck-FWp"/>
<constraint firstItem="IYZ-Af-OWK" firstAttribute="top" secondItem="jIg-lr-y4q" secondAttribute="bottom" constant="8" symbolic="YES" id="XIl-ax-EQM"/>
<constraint firstItem="jIg-lr-y4q" firstAttribute="centerY" secondItem="Wg4-Jj-Qu2" secondAttribute="centerY" id="XPH-o0-4aN"/>
<constraint firstItem="rFc-Xp-Oik" firstAttribute="leading" secondItem="u4E-6x-G9M" secondAttribute="leading" id="YoH-RH-fUP"/>
<constraint firstItem="TTD-gb-lM9" firstAttribute="top" secondItem="y3c-jy-aDJ" secondAttribute="bottom" constant="8" id="cGi-rR-wN8"/>
<constraint firstItem="rr9-HZ-Pee" firstAttribute="top" secondItem="u4E-6x-G9M" secondAttribute="bottom" constant="8" symbolic="YES" id="ccQ-8X-0GO"/>
<constraint firstItem="u4E-6x-G9M" firstAttribute="top" secondItem="rFc-Xp-Oik" secondAttribute="bottom" constant="26" id="dIt-I5-aWe"/>
<constraint firstItem="rFc-Xp-Oik" firstAttribute="top" secondItem="TTD-gb-lM9" secondAttribute="bottom" constant="84" id="kYA-aL-c8V"/>
<constraint firstItem="u4E-6x-G9M" firstAttribute="trailing" secondItem="rr9-HZ-Pee" secondAttribute="trailing" id="lln-g9-fHw"/>
<constraint firstItem="jIg-lr-y4q" firstAttribute="top" secondItem="u4E-6x-G9M" secondAttribute="bottom" constant="71" id="nJR-eU-yJD"/>
<constraint firstItem="jIg-lr-y4q" firstAttribute="leading" secondItem="Wg4-Jj-Qu2" secondAttribute="trailing" constant="39" id="pOU-jk-IQY"/>
<constraint firstItem="tJE-yf-FhY" firstAttribute="top" secondItem="1dA-Bp-AXg" secondAttribute="bottom" constant="40" id="pro-7G-uPM"/>
<constraint firstItem="tJE-yf-FhY" firstAttribute="leading" secondItem="Wg4-Jj-Qu2" secondAttribute="leading" id="sOf-C2-2a0"/>
<constraint firstItem="TTD-gb-lM9" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leading" id="zzz-0U-sOd"/>
<constraint firstItem="tJE-yf-FhY" firstAttribute="bottom" secondItem="u4E-6x-G9M" secondAttribute="bottom" id="1do-zR-mcT"/>
<constraint firstItem="wfy-db-euE" firstAttribute="top" secondItem="rr9-HZ-Pee" secondAttribute="bottom" constant="270" id="2Ib-ne-QJg"/>
<constraint firstItem="rr9-HZ-Pee" firstAttribute="top" secondItem="u4E-6x-G9M" secondAttribute="bottom" constant="28" id="4NF-Wy-JY1"/>
<constraint firstItem="TTD-gb-lM9" firstAttribute="top" secondItem="y3c-jy-aDJ" secondAttribute="bottom" constant="8" id="5kt-lF-7Hj"/>
<constraint firstItem="rFc-Xp-Oik" firstAttribute="leading" secondItem="u4E-6x-G9M" secondAttribute="leading" id="DcE-Pl-mdo"/>
<constraint firstItem="rr9-HZ-Pee" firstAttribute="centerY" secondItem="8bC-Xf-vdC" secondAttribute="centerY" id="Dyk-Zr-k5p"/>
<constraint firstItem="tJE-yf-FhY" firstAttribute="top" secondItem="1dA-Bp-AXg" secondAttribute="bottom" constant="40" id="Gcy-NL-EAr"/>
<constraint firstItem="TTD-gb-lM9" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leading" id="PX2-6S-gH1"/>
<constraint firstItem="rr9-HZ-Pee" firstAttribute="trailing" secondItem="8bC-Xf-vdC" secondAttribute="trailingMargin" id="QVt-Zg-8Lj"/>
<constraint firstItem="u4E-6x-G9M" firstAttribute="top" secondItem="rFc-Xp-Oik" secondAttribute="bottom" constant="26" id="Y59-lN-nGa"/>
<constraint firstItem="Wg4-Jj-Qu2" firstAttribute="leading" secondItem="tJE-yf-FhY" secondAttribute="leading" id="ZKd-oy-ChJ"/>
<constraint firstItem="Wg4-Jj-Qu2" firstAttribute="leading" secondItem="uxO-hd-8cT" secondAttribute="leading" id="buI-Hs-e0E"/>
<constraint firstItem="IYZ-Af-OWK" firstAttribute="centerY" secondItem="uxO-hd-8cT" secondAttribute="centerY" id="eKI-qT-cHI"/>
<constraint firstItem="jIg-lr-y4q" firstAttribute="leading" secondItem="Wg4-Jj-Qu2" secondAttribute="trailing" constant="39" id="fyU-nT-iDi"/>
<constraint firstItem="wfy-db-euE" firstAttribute="top" secondItem="IYZ-Af-OWK" secondAttribute="bottom" constant="162" id="hWk-5B-8g8"/>
<constraint firstItem="rFc-Xp-Oik" firstAttribute="leading" secondItem="1dA-Bp-AXg" secondAttribute="trailing" constant="15" id="iAM-ux-qXL"/>
<constraint firstItem="IYZ-Af-OWK" firstAttribute="top" secondItem="jIg-lr-y4q" secondAttribute="bottom" constant="8" symbolic="YES" id="iKK-fD-ikN"/>
<constraint firstItem="u4E-6x-G9M" firstAttribute="trailing" secondItem="rFc-Xp-Oik" secondAttribute="trailing" id="ib8-co-4ss"/>
<constraint firstItem="Wg4-Jj-Qu2" firstAttribute="centerY" secondItem="jIg-lr-y4q" secondAttribute="centerY" id="m48-Sb-sKx"/>
<constraint firstAttribute="trailing" secondItem="TTD-gb-lM9" secondAttribute="trailing" id="mkE-Dd-DbK"/>
<constraint firstItem="u4E-6x-G9M" firstAttribute="trailing" secondItem="rr9-HZ-Pee" secondAttribute="trailing" id="p6D-Tc-saJ"/>
<constraint firstItem="IYZ-Af-OWK" firstAttribute="leading" secondItem="jIg-lr-y4q" secondAttribute="leading" id="qwe-9d-YHz"/>
<constraint firstItem="tJE-yf-FhY" firstAttribute="leading" secondItem="1dA-Bp-AXg" secondAttribute="leading" id="uXn-sM-4dO"/>
<constraint firstItem="1dA-Bp-AXg" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leadingMargin" id="zXi-eY-XCh"/>
</constraints>
</view>
<navigationItem key="navigationItem" title="PLUC Inventory Log-In" id="MTF-s9-qJz"/>
......
......@@ -33,10 +33,14 @@
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
//Capture and load sections from page into UITableView
[self initializeSectionList];
}
//NOTE - for some reason running [super webViewDidFinishLoad(webView)] crashes everything.
// Never figured out exactly why...sorry to future developers (Bucknell ECE Senior Design 2015)
- (void)webViewDidFinishLoad:(UIWebView *)webView {
//Determine what to do next based on what page loads
[self evaluateNextRTIAction:webView];
}
......@@ -105,6 +109,8 @@
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
//When seguing to scanning, need to pass along which section was chosen (for displaying on scan page)
if ([segue.identifier isEqualToString:@"segueToScanning"]) {
NSIndexPath *path = [self.tableView indexPathForSelectedRow];
Session *session = [[Session alloc] init];
......@@ -116,13 +122,14 @@
#pragma mark - Helper Functions
//Pulls sections from webpage to display in UITableView
- (void)initializeSectionList {
self.sections = [[NSMutableArray alloc] init];
self.tableView.delegate = self;
self.tableView.dataSource = self;
[self.tableView reloadData];
// Get collections available - Testing GetAvailableCollections
//Load Javascript to get available collections from webpage
NSString *getAvailablePath =
[[NSBundle mainBundle] pathForResource:@"GetAvailableCollections"
ofType:@"js"];
......@@ -131,12 +138,16 @@
encoding:NSUTF8StringEncoding
error:nil];
//Execute Javascript to get available collections from webpage
// (returned as a string in JSON format for easy parsing)
NSString *availableSections =
[self.webview stringByEvaluatingJavaScriptFromString:getAvailable];
//Extracts sections from returned string
[self extractSectionInformation:availableSections];
}
- (void)extractSectionInformation:(NSString *)availableSections {
//Create error holder for JSON parsing
......@@ -150,11 +161,10 @@
//Check for errors (in JSON parsing)
if (error != nil) {
NSLog(@"ERROR: %@", error.localizedDescription);
NSLog(@"ERROR parsing JSON (sections): %@", error.localizedDescription);
}
//If no errors found, update section list
else {
NSLog(@"SUCCESS");
for (Section *section in sectionList) {
[self.sections addObject:section.text];
}
......@@ -162,7 +172,9 @@
}
}
//Determine what to do next based on what page loads
- (void)evaluateNextRTIAction:(UIWebView *)webView {
//Get current URL
NSString *url = [[webView request] URL].absoluteString;
NSString *base_dest_url;
#ifdef TESTING
......@@ -170,17 +182,24 @@
#else
base_dest_url = @"http://192.168.1.131";
#endif
//If return to initial page (so timed out)
// NOTE: Not sure this page ever times out, but just in case... - Bucknell ECE Senior Design 2015
if ([url isEqualToString:[base_dest_url stringByAppendingString:@"/rti/Default.aspx"]]) {
NSLog(@"Timed out!");
//In the event of timeout, return to login screen
[self performSegueWithIdentifier:@"segueSectionToLogin" sender:nil];
}
//Otherwise if current page loads...do nothing (should never really trigger)
else if ([url isEqualToString:[base_dest_url stringByAppendingString:@"/rti/RTISetup.aspx?location=1"]]) {
NSLog(@"1: %@", url);
}
//Otherwise if scan page loads - section was successfully chosen
else if ([url isEqualToString:[base_dest_url stringByAppendingString:@"/rti/RTIScan.aspx?location=1"]]) {
NSLog(@"2: %@", url);
//Segue to scan page in app
[self performSegueWithIdentifier:@"segueToScanning" sender:nil];
}
//Handle deeper errors (unrecognized URL)
else {
NSLog(@"3: %@", url);
/*
......@@ -196,9 +215,9 @@
}
}
//Once selection has been chosen in UITableView, add and move to scan page
- (void)setCollection:(NSIndexPath *)path {
//need to call AddCollection, then GetSelectedCollections
//AddCollection
//Load Javascript to add chosen section
NSString *addSelectedPath =
[[NSBundle mainBundle] pathForResource:@"AddCollection"
ofType:@"js"];
......@@ -209,52 +228,49 @@
[self.webview stringByEvaluatingJavaScriptFromString:[@"var selectedAdd = " stringByAppendingString:[NSString stringWithFormat:@"%d;", path.row]]];
//Add chosen section
NSString *add =
[self.webview
stringByEvaluatingJavaScriptFromString:addSelected];
[self.webview stringByEvaluatingJavaScriptFromString:addSelected];
//Check to make sure add worked
if ([add isEqual:nil]) {
NSLog(@"nil failed");
NSLog(@"ERROR - adding section failed!");
} else {
NSLog(@"NOT NILL UNFAILED");
//Load Javascript to get selected collections
NSString *selectedPath =
[[NSBundle mainBundle] pathForResource:@"GetSelectedCollections"
ofType:@"js"];
NSString *selectedFunc =
[NSString stringWithContentsOfFile:selectedPath
encoding:NSUTF8StringEncoding
error:nil];
//Add chosen section (equivalent to clicking >> button on RTI webpage)
[self.webview stringByEvaluatingJavaScriptFromString:selectedFunc];
//Load Javascript to save section and proceed to scan page
NSString *saveSetupPath =
[[NSBundle mainBundle] pathForResource:@"SaveSetup" ofType:@"js"];
NSString *saveSetup =
[NSString stringWithContentsOfFile:saveSetupPath
encoding:NSUTF8StringEncoding
error:nil];
//Save section and proceed to scan page
[self.webview stringByEvaluatingJavaScriptFromString:saveSetup];
}
//GetSelectedCollections
NSString *selectedPath =
[[NSBundle mainBundle] pathForResource:@"GetSelectedCollections"
ofType:@"js"];
NSString *selectedFunc =
[NSString stringWithContentsOfFile:selectedPath
encoding:NSUTF8StringEncoding
error:nil];
[self.webview stringByEvaluatingJavaScriptFromString:selectedFunc];
//UIAlertView *selectedAlert =
//[[UIAlertView alloc] initWithTitle:@"Collections Selected"
// message:selected
// delegate:self
// cancelButtonTitle:@"OK"
// otherButtonTitles:nil];
//[selectedAlert show];
NSString *saveSetupPath =
[[NSBundle mainBundle] pathForResource:@"SaveSetup" ofType:@"js"];
NSString *saveSetup =
[NSString stringWithContentsOfFile:saveSetupPath
encoding:NSUTF8StringEncoding
error:nil];
[self.webview stringByEvaluatingJavaScriptFromString:saveSetup];
}
#pragma mark - UI Buttons
//When "Select" button is pressed
- (IBAction)selectSelectionToScan:(id)sender {
NSIndexPath *path = [self.tableView indexPathForSelectedRow];
//If a section was selected
if (path) {
[self setCollection:path];
}
//If no section was selected
else {
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"No Collection Selected" message:@"Please select a collection to continue." preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *ok = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
......@@ -265,6 +281,7 @@
}
}
//When "Exit" button is pressed
- (IBAction)exitBtnPressed:(id)sender {
[self performSegueWithIdentifier:@"segueSectionToLogin" sender:nil];
}
......
......@@ -82,35 +82,6 @@
// NSLog(@"Scan");
// } else if ([page isEqual:@"3"]) { // Error/Action Page
// NSLog(@"Error");
// // Get the error - Testing GetError
// NSString *getErrorPath =
// [[NSBundle mainBundle] pathForResource:@"GetError" ofType:@"js"];
// NSString *getError = [NSString stringWithContentsOfFile:getErrorPath
// encoding:NSUTF8StringEncoding
// error:nil];
//
// NSString *error = [webView stringByEvaluatingJavaScriptFromString:getError];
//
// self.view.backgroundColor = [UIColor redColor];
// [UIView animateWithDuration:1.0 animations:^{
// self.view.backgroundColor = [UIColor whiteColor];
// }];
//
// // Continue - Testing GoToScan
// NSString *goToScanPath =
// [[NSBundle mainBundle] pathForResource:@"GoToScan" ofType:@"js"];
// NSString *goToScan = [NSString stringWithContentsOfFile:goToScanPath
// encoding:NSUTF8StringEncoding
// error:nil];
// [self.webview stringByEvaluatingJavaScriptFromString:goToScan];
//
// UIAlertView *errorAlert =
// [[UIAlertView alloc] initWithTitle:@"Error Encountered"
// message:error
// delegate:self
// cancelButtonTitle:@"OK"
// otherButtonTitles:nil];
// [errorAlert show];
// }
//}
......
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