Commit b4870d5f authored by Alex Moore's avatar Alex Moore

changed all UIAlertViews to UIAlertControllers to work upside down

parent 51bfee04
......@@ -40,28 +40,52 @@
{
ProtocolConnectionStatus status = [[Captuvo sharedCaptuvoDevice] startDecoderHardware];
if (status == ProtocolConnectionStatusUnableToConnect) {
/*
UIAlertView *sledAlert = [[UIAlertView alloc] initWithTitle:@"Connection Error"
message:@"Unable to communicate with sled - unknown communication error."
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[sledAlert show];
*/
UIAlertController *sledAlert = [UIAlertController alertControllerWithTitle:@"Connection Error" message:@"Unable to communicate with sled - unknown communication error." preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *ok = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
[sledAlert dismissViewControllerAnimated:YES completion:nil];
}];
[sledAlert addAction: ok];
[self presentViewController:sledAlert animated:YES completion:nil];
}
else if (status == ProtocolConnectionStatusUnableToConnectIncompatiableSledFirmware) {
/*
UIAlertView *sledAlert = [[UIAlertView alloc] initWithTitle:@"Connection Error"
message:@"Unable to communicate with sled - incompatible sled firmware."
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[sledAlert show];
*/
UIAlertController *sledAlert = [UIAlertController alertControllerWithTitle:@"Connection Error" message:@"Unable to communicate with sled - incompatible sled firmware." preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *ok = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
[sledAlert dismissViewControllerAnimated:YES completion:nil];
}];
[sledAlert addAction: ok];
[self presentViewController:sledAlert animated:YES completion:nil];
}
else if (status == ProtocolConnectionStatusBatteryDepleted) {
/*
UIAlertView *sledAlert = [[UIAlertView alloc] initWithTitle:@"Connection Error"
message:@"Unable to communicate with sled - battery depleted."
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[sledAlert show];
*/
UIAlertController *sledAlert = [UIAlertController alertControllerWithTitle:@"Connection Error" message:@"Unable to communicate with sled - battery depleted." preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *ok = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
[sledAlert dismissViewControllerAnimated:YES completion:nil];
}];
[sledAlert addAction: ok];
[self presentViewController:sledAlert animated:YES completion:nil];
}
//[[Captuvo sharedCaptuvoDevice] requestBatteryVoltage] ;
//[[Captuvo sharedCaptuvoDevice] requestChargeStatus] ;
......
......@@ -43,8 +43,16 @@
//Page handles username/password errors; now handle deeper errors
else {
NSLog(@"3: %@", url);
/*
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"FATAL PAGE ERROR" message:@"Page not recognized, cannot proceed. App will no longer work as expected." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
[alert show];
*/
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"FATAL PAGE ERROR" message:@"Page not recognized, cannot proceed. App will no longer work as expected." preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *ok = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
[alert dismissViewControllerAnimated:YES completion:nil];
}];
[alert addAction: ok];
[self presentViewController:alert animated:YES completion:nil];
}
}
......
......@@ -104,21 +104,36 @@ static int BOOK_ID_LENGTH = 14;
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];
[errorAlert show];
*/
UIAlertController *errorAlert = [UIAlertController alertControllerWithTitle:@"Error Encountered" message:error preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *ok = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
[errorAlert dismissViewControllerAnimated:YES completion:nil];
}];
[errorAlert addAction: ok];
[self presentViewController:errorAlert animated:YES completion:nil];
}
//Handle deeper errors
else {
NSLog(@"3: %@", url);
/*
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"FATAL PAGE ERROR" message:@"Page not recognized, cannot proceed. App will no longer work as expected." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
[alert show];
*/
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"FATAL PAGE ERROR" message:@"Page not recognized, cannot proceed. App will no longer work as expected." preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *ok = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
[alert dismissViewControllerAnimated:YES completion:nil];
}];
[alert addAction: ok];
[self presentViewController:alert animated:YES completion:nil];
}
}
......@@ -255,12 +270,19 @@ static int BOOK_ID_LENGTH = 14;
else {
message = [NSString stringWithFormat:@"Book ID: %@\nCall Number: %@\nTitle: %@\n", bookID, callNum, title];
}
/*
UIAlertView *messageAlert = [[UIAlertView alloc]
initWithTitle:@"Book details" message:message delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
// Display Alert Message
[messageAlert show];
*/
UIAlertController *messageAlert = [UIAlertController alertControllerWithTitle:@"Book Details" message:message preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *ok = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
[messageAlert dismissViewControllerAnimated:YES completion:nil];
}];
[messageAlert addAction: ok];
[self presentViewController:messageAlert animated:YES completion:nil];
[tableView deselectRowAtIndexPath:[tableView indexPathForSelectedRow] animated:NO];
}
......@@ -349,8 +371,16 @@ static int BOOK_ID_LENGTH = 14;
[self resetScanHistory];
} else {
/*
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Invalid Book ID" message:@"Book ID must be numeric" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
[alert show];
*/
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"Invalid Book ID" message:@"Book ID must be numeric." preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *ok = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
[alert dismissViewControllerAnimated:YES completion:nil];
}];
[alert addAction: ok];
[self presentViewController:alert animated:YES completion:nil];
}
} else {
//if not 14 digits
......
......@@ -123,6 +123,7 @@
[self.webview stringByEvaluatingJavaScriptFromString:saveSetup];
}
else {
/*
UIAlertView *alert =
[[UIAlertView alloc] initWithTitle:@"No collection selected!"
message:@"You must select a collection to continue."
......@@ -130,6 +131,13 @@
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
*/
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) {
[alert dismissViewControllerAnimated:YES completion:nil];
}];
[alert addAction: ok];
[self presentViewController:alert animated:YES completion:nil];
}
}
......@@ -151,8 +159,16 @@
}
else {
NSLog(@"3: %@", url);
/*
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"FATAL PAGE ERROR" message:@"Page not recognized, cannot proceed. App will no longer work as expected." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
[alert show];
*/
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"FATAL PAGE ERROR" message:@"Page not recognized, cannot proceed. App will no longer work as expected." preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *ok = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
[alert dismissViewControllerAnimated:YES completion:nil];
}];
[alert addAction: ok];
[self presentViewController:alert animated:YES completion:nil];
}
}
......
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