Commit 99c7d060 authored by Alex Moore's avatar Alex Moore

finished up some quick UI changes, fixed login page bugs, handled timeout...

finished up some quick UI changes, fixed login page bugs, handled timeout while app is inactive, or while on settings page.
parent 4b18b9f3
......@@ -10,7 +10,6 @@
@interface CaptuvoOptionsController : CaptuvoViewController
@property (weak, nonatomic) IBOutlet UIStepper *sledSoundStepper;
@property (weak, nonatomic) IBOutlet UILabel *sledSoundLabel;
@property (weak, nonatomic) IBOutlet UIImageView *batteryView;
@property (strong, nonatomic) IBOutlet UISlider *volumeSlider;
......
......@@ -14,8 +14,6 @@
@implementation CaptuvoOptionsController
int sled_volume;
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
......@@ -33,79 +31,87 @@ int sled_volume;
*/
- (void)decoderGoodReadBeeperVolumeStatus:(BeeperVolume)volume
{
float sled_volume;
switch (volume) {
case BeeperVolumeHigh:
sled_volume = 3;
self.sledSoundLabel.text = @"High";
sled_volume = 3.0;
self.sledSoundLabel.text = @"Sled Volume: High";
break;
case BeeperVolumeMedium:
sled_volume = 2;
self.sledSoundLabel.text = @"Medium";
sled_volume = 2.0;
self.sledSoundLabel.text = @"Sled Volume: Medium";
break;
case BeeperVolumeLow:
sled_volume = 1;
self.sledSoundLabel.text = @"Low";
sled_volume = 1.0;
self.sledSoundLabel.text = @"Sled Volume: Low";
break;
case BeeperVolumeOff:
sled_volume = 0;
self.sledSoundLabel.text = @"Silent";
sled_volume = 0.0;
self.sledSoundLabel.text = @"Sled Volume: Silent";
break;
default:
sled_volume = 0.0;
self.sledSoundLabel.text = @"Sled Volume: Unknown";
break;
}
self.sledSoundStepper.value = (double)sled_volume;
//self.sledSoundStepper.value = (double)sled_volume;
self.volumeSlider.value = sled_volume;
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
#pragma mark - UI Buttons
/**
@brief This method changes the sled volume between high, medium, low, and silent.
@param (id)sender - tied to button
@return IBAction - tied to button
*/
- (IBAction)changeSledVolume:(id)sender {
sled_volume = (int)self.sledSoundStepper.value;
switch (sled_volume) {
- (IBAction)changeSledVolumeSlider:(id)sender {
float sled_volume = lroundf(self.volumeSlider.value);
[self.volumeSlider setValue:sled_volume animated:NO];
switch ((int)sled_volume) {
case 0:
[[Captuvo sharedCaptuvoDevice] setDecoderGoodReadBeeperVolume:BeeperVolumeOff persistSetting:YES];
self.sledSoundLabel.text = @"Silent";
self.sledSoundLabel.text = @"Sled Volume: Silent";
break;
case 1:
[[Captuvo sharedCaptuvoDevice] setDecoderGoodReadBeeperVolume:BeeperVolumeLow persistSetting:YES];
self.sledSoundLabel.text = @"Low";
self.sledSoundLabel.text = @"Sled Volume: Low";
break;
case 2:
[[Captuvo sharedCaptuvoDevice] setDecoderGoodReadBeeperVolume:BeeperVolumeMedium persistSetting:YES];
self.sledSoundLabel.text = @"Medium";
self.sledSoundLabel.text = @"Sled Volume: Medium";
break;
case 3:
[[Captuvo sharedCaptuvoDevice] setDecoderGoodReadBeeperVolume:BeeperVolumeHigh persistSetting:YES];
self.sledSoundLabel.text = @"High";
self.sledSoundLabel.text = @"Sled Volume: High";
break;
default:
break;
}
}
- (IBAction)changeSledVolumeSlider:(id)sender {
sled_volume = (int)lroundf(self.volumeSlider.value);
[self.volumeSlider setValue:sled_volume animated:YES];
switch (sled_volume) {
- (IBAction)changeSledVolume:(id)sender {
float sled_volume = lroundf(self.volumeSlider.value);
switch ((int)sled_volume) {
case 0:
[[Captuvo sharedCaptuvoDevice] setDecoderGoodReadBeeperVolume:BeeperVolumeOff persistSetting:YES];
self.sledSoundLabel.text = @"Silent";
break;
case 1:
[[Captuvo sharedCaptuvoDevice] setDecoderGoodReadBeeperVolume:BeeperVolumeLow persistSetting:YES];
self.sledSoundLabel.text = @"Low";
break;
case 2:
[[Captuvo sharedCaptuvoDevice] setDecoderGoodReadBeeperVolume:BeeperVolumeMedium persistSetting:YES];
self.sledSoundLabel.text = @"Medium";
break;
case 3:
[[Captuvo sharedCaptuvoDevice] setDecoderGoodReadBeeperVolume:BeeperVolumeHigh persistSetting:YES];
self.sledSoundLabel.text = @"High";
break;
default:
break;
......@@ -113,14 +119,5 @@ int sled_volume;
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end
......@@ -10,9 +10,10 @@
#import "WebViewController.h"
@interface LogInViewController : WebViewController
@property (weak, nonatomic, readonly) UIButton *btnLogIn;
@property (weak, nonatomic, readwrite) UITextField *txtUsername;
@property (weak, nonatomic, readwrite) UITextField *txtPassword;
@property (strong, nonatomic) IBOutlet UIButton *btnLogIn;
@property (strong, nonatomic) IBOutlet UITextField *txtUsername;
@property (strong, nonatomic) IBOutlet UITextField *txtPassword;
@property (weak, nonatomic) IBOutlet UISwitch *rememberUsernameSwitch;
@property (weak, nonatomic) IBOutlet UISwitch *rememberPasswordSwitch;
......
......@@ -26,12 +26,21 @@
// Dispose of any resources that can be recreated.
}
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[self checkAndSatisfyUserLoginPreferences];
}
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
//Disable login button
[self.btnLogIn setEnabled:NO];
[self resetRTI];
[self checkAndSatisfyUserLoginPreferences];
}
- (void)webViewDidFinishLoad:(UIWebView *)webView {
[self evaluateNextRTIAction:webView];
}
......@@ -63,10 +72,15 @@
if ([prefs boolForKey:@"rememberUsername"]) {
[self.rememberUsernameSwitch setOn:YES];
self.txtUsername.text = [[NSUserDefaults standardUserDefaults] stringForKey:@"usernameString"];
//Password only remembered if remembering username
if ([prefs boolForKey:@"rememberPassword"]) {
[self.rememberPasswordSwitch setOn:YES];
self.txtPassword.text = [[NSUserDefaults standardUserDefaults] stringForKey:@"passwordString"];
}
}
if ([prefs boolForKey:@"rememberPassword"]) {
[self.rememberPasswordSwitch setOn:YES];
self.txtPassword.text = [[NSUserDefaults standardUserDefaults] stringForKey:@"passwordString"];
else {
[self.rememberUsernameSwitch setOn:NO];
[self.rememberPasswordSwitch setOn:NO];
}
}
......@@ -122,6 +136,8 @@
}
else if ([url isEqualToString:[base_dest_url stringByAppendingString:@"/rti/RTILogin.aspx"]]) {
NSLog(@"1: %@", url);
//Enable login button
[self.btnLogIn setEnabled:YES];
}
else if ([url isEqualToString:[base_dest_url stringByAppendingString:@"/rti/RTISetup.aspx?location=1"]]) {
NSLog(@"2: %@", url);
......@@ -130,17 +146,17 @@
NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
if ([prefs boolForKey:@"rememberUsername"]) {
[prefs setValue:self.txtUsername.text forKey:@"usernameString"];
//Only remember password if remembering username
if ([prefs boolForKey:@"rememberPassword"]) {
[prefs setValue:self.txtPassword.text forKey:@"passwordString"];
}
else {
[prefs setValue:@"" forKey:@"passwordString"];
}
}
else {
[prefs setValue:@"" forKey:@"usernameString"];
}
[prefs synchronize];
if ([prefs boolForKey:@"rememberPassword"]) {
[prefs setValue:self.txtPassword.text forKey:@"passwordString"];
}
else {
[prefs setValue:@"" forKey:@"passwordString"];
[prefs setValue:nil forKey:@"usernameString"];
[prefs setValue:nil forKey:@"passwordString"];
}
[prefs synchronize];
......@@ -154,7 +170,7 @@
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];
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"FATAL PAGE ERROR" message:@"Page not recognized, cannot proceed. Please try again in a moment; if problem persists, app may be broken." preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *ok = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
[alert dismissViewControllerAnimated:YES completion:nil];
}];
......@@ -193,11 +209,20 @@
- (IBAction)rememberUsernameBtnChanged:(id)sender {
[[NSUserDefaults standardUserDefaults] setBool:self.rememberUsernameSwitch.isOn forKey:@"rememberUsername"];
if (!self.rememberUsernameSwitch.isOn) {
[self.rememberPasswordSwitch setOn:NO animated:YES];
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"rememberPassword"];
}
[[NSUserDefaults standardUserDefaults] synchronize];
}
- (IBAction)rememberPasswordBtnChanged:(id)sender {
[[NSUserDefaults standardUserDefaults] setBool:self.rememberPasswordSwitch.isOn forKey:@"rememberPassword"];
[[NSUserDefaults standardUserDefaults] synchronize];
if (self.rememberUsernameSwitch.isOn) {
[[NSUserDefaults standardUserDefaults] setBool:self.rememberPasswordSwitch.isOn forKey:@"rememberPassword"];
[[NSUserDefaults standardUserDefaults] synchronize];
}
else {
[self.rememberPasswordSwitch setOn:NO animated:YES];
}
}
@end
This diff is collapsed.
......@@ -21,7 +21,6 @@
@property (weak, nonatomic) IBOutlet UILabel *lblSection;
@property NSArray *scannedBookList;
@property NSString *lastErrorReceived;
- (IBAction)txtChange:(id)sender;
@end
This diff is collapsed.
......@@ -187,7 +187,7 @@
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];
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"FATAL PAGE ERROR" message:@"Page not recognized, cannot proceed. Please try again in a moment; if problem persists, app may be broken." preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *ok = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
[alert dismissViewControllerAnimated: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