Commit 38cfdbfb authored by Alex Moore's avatar Alex Moore
Browse files

Updated workspace, project is now in folder WAMI

parent f608973e
//
// DummyData.m
// PLUCdraft
//
// Created by Alexander W. Moore on 2/3/15.
// Copyright (c) 2015 Alexander W. Moore. All rights reserved.
//
#import "DummyData.h"
@implementation DummyData
@end
{
"images" : [
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "3x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "76x76",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "76x76",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>SD1.$(PRODUCT_NAME:rfc1034identifier)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>
//
// LogInViewController.h
// PLUCdraft
//
// Created by Alexander W. Moore on 2/3/15.
// Copyright (c) 2015 Alexander W. Moore. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface LogInViewController : UIViewController
@property (weak, nonatomic, readonly) UIButton *btnLogIn;
@property (weak, nonatomic, readonly) UITextField *txtUsername;
@property (weak, nonatomic, readonly) UITextField *txtPassword;
@end
//
// LogInViewController.m
// PLUCdraft
//
// Created by Alexander W. Moore on 2/3/15.
// Copyright (c) 2015 Alexander W. Moore. All rights reserved.
//
#import "LogInViewController.h"
@interface LogInViewController ()
@property (weak, nonatomic, readwrite) IBOutlet UITextField *txtUsername;
@property (weak, nonatomic, readwrite) IBOutlet UITextField *txtPassword;
- (IBAction)btnLogInTouch:(id)sender;
@end
@implementation LogInViewController
@synthesize txtUsername;
@synthesize txtPassword;
static NSString *USERNAME = @"alex";
static NSString *PASSWORD = @"what";
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
[self.view addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self.view action:@selector(endEditing:)]];
self.navigationItem.hidesBackButton = YES;
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
/*
#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.
}
*/
- (IBAction)btnLogInTouch:(id)sender {
if([txtUsername.text isEqualToString: USERNAME] && [txtPassword.text isEqualToString:PASSWORD]) {//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];
}
}
@end
//
// ScanBookViewController.h
// PLUCdraft
//
// Created by Alexander W. Moore on 2/3/15.
// Copyright (c) 2015 Alexander W. Moore. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "Session.h"
@interface ScanBookViewController : UIViewController
@property Session *session;
@end
//
// ScanBookViewController.m
// PLUCdraft
//
// Created by Alexander W. Moore on 2/3/15.
// Copyright (c) 2015 Alexander W. Moore. All rights reserved.
//
#import "ScanBookViewController.h"
static int BOOK_ID_LENGTH = 13;
@interface ScanBookViewController ()
@property (weak, nonatomic) IBOutlet UITextField *txtBookID;
@property (weak, nonatomic) IBOutlet UIImageView *imgCheck;
@property (weak, nonatomic) IBOutlet UIImageView *imgX;
@property (weak, nonatomic) IBOutlet UILabel *lblSection;
- (IBAction)txtChange:(id)sender;
@end
@implementation ScanBookViewController
@synthesize session;
@synthesize lblSection;
@synthesize txtBookID;
@synthesize imgCheck;
@synthesize imgX;
- (void)viewDidLoad {
[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:)]];
// SEND SESSION TO RTI
//self.navigationItem.hidesBackButton = YES;
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#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.
// TELL OCI TO END SESSION aka exit out of page
}
-(void) changeCheckImage {
imgCheck.image = [UIImage imageNamed:@"greencheck.png"];
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{
sleep(1);
//do other stuff
dispatch_async(dispatch_get_main_queue(), ^{
imgCheck.image = [UIImage imageNamed:@"greycheck2.png"];
txtBookID.text = @"";
});
});
}
-(void) changeXImage {
imgX.image = [UIImage imageNamed:@"redx.png"];
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{
sleep(1);
//do other stuff
dispatch_async(dispatch_get_main_queue(), ^{
imgX.image = [UIImage imageNamed:@"greyx2.png"];
txtBookID.text = @"";
});
});
}
- (IBAction)txtChange:(id)sender {
NSCharacterSet* notDigits = [[NSCharacterSet decimalDigitCharacterSet] invertedSet];
if(txtBookID.text.length == BOOK_ID_LENGTH) { //string is proper length
if([txtBookID.text rangeOfCharacterFromSet:notDigits].location == NSNotFound) { //string is numeric
// SEND BOOK ID TO RTI
//randomly generate errors
int random = arc4random() % 10;
if(random < 5) {
//green check
[self changeCheckImage];
} else {
//red x
[self changeXImage];
}
} else {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Invalid Book ID" message:@"Book ID must be numeric" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
[alert show];
}
} else {
//if not 13 digits
}
}
@end
//
// SectionTableViewController.h
// PLUCdraft
//
// Created by Alexander W. Moore on 2/3/15.
// Copyright (c) 2015 Alexander W. Moore. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "Session.h"
#import "ScanBookViewController.h"
@interface SectionTableViewController : UITableViewController
@end
//
// SectionTableViewController.m
// PLUCdraft
//
// Created by Alexander W. Moore on 2/3/15.
// Copyright (c) 2015 Alexander W. Moore. All rights reserved.
//
#import "SectionTableViewController.h"
@interface SectionTableViewController ()
@property NSMutableArray *sections;
@end
@implementation SectionTableViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Uncomment the following line to preserve selection between presentations.
// self.clearsSelectionOnViewWillAppear = NO;
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem;
self.sections = [[NSMutableArray alloc] init];
[self loadInitialData];
}
-(void)loadInitialData {
[self.sections addObject:@"Adult Non-Fiction"];
[self.sections addObject:@"Adult Fiction"];
[self.sections addObject:@"Adult Semi-Fiction"];
[self.sections addObject:@"Children Non-Fiction"];
[self.sections addObject:@"Children Fiction"];
[self.sections addObject:@"CD"];
[self.sections addObject:@"DVD"];
[self.sections addObject:@"Blu-Ray"];
[self.sections addObject:@"VHS"];
[self.sections addObject:@"Game of Thrones"];
[self.sections addObject:@"Poetry"];
[self.sections addObject:@"Encyclopedias"];
[self.sections addObject:@"Stuff"];
[self.sections addObject:@"Other"];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark - Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
// Return the number of sections.
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
// Return the number of rows in the section.
return [self.sections count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"ListPrototypeCell" forIndexPath:indexPath];
// Configure the cell...
NSString *section = [self.sections objectAtIndex:indexPath.row];
cell.textLabel.text = section;
return cell;
}
/*
// Override to support conditional editing of the table view.
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
// Return NO if you do not want the specified item to be editable.
return YES;
}
*/
/*
// Override to support editing the table view.
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
if (editingStyle == UITableViewCellEditingStyleDelete) {
// Delete the row from the data source
[tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
} else if (editingStyle == UITableViewCellEditingStyleInsert) {
// Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
}
}
*/
/*
// Override to support rearranging the table view.
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
}
*/
/*
// Override to support conditional rearranging of the table view.
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
// Return NO if you do not want the item to be re-orderable.
return YES;
}
*/
#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.
NSIndexPath *path = [self.tableView indexPathForSelectedRow];
Session *session = [[Session alloc] init];
session.section = [self.sections objectAtIndex:path.row];
ScanBookViewController *destViewController = [segue destinationViewController];
destViewController.session = session;
}
@end
//
// Session.h
// PLUCdraft
//
// Created by Alexander W. Moore on 2/5/15.
// Copyright (c) 2015 Alexander W. Moore. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface Session : NSObject
@property NSString* section;
@property int numScanned;
-(void) incrementNumScanned;
@end
//
// Session.m
// PLUCdraft
//
// Created by Alexander W. Moore on 2/5/15.
// Copyright (c) 2015 Alexander W. Moore. All rights reserved.
//
#import "Session.h"
@implementation Session
-(void) incrementNumScanned {
self.numScanned ++;
}
@end
//
// SettingsViewController.h
// PLUCdraft
//
// Created by PLUC SeniorDesign on 2/17/15.
// Copyright (c) 2015 Alexander W. Moore. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface SettingsViewController : UIViewController
@end
//
// SettingsViewController.m
// PLUCdraft
//
// Created by PLUC SeniorDesign on 2/17/15.
// Copyright (c) 2015 Alexander W. Moore. All rights reserved.
//
#import "SettingsViewController.h"
@interface SettingsViewController ()
@end
@implementation SettingsViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
/*
#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 {