From 27645b2ae5560b503ef9d956b89e52887fe29b16 Mon Sep 17 00:00:00 2001 From: Eddie Ehlin Date: Sun, 3 Feb 2013 14:45:35 +0100 Subject: Added "Extraction complete" dialog and also bug fix for the extraction view for iBean, which caused the app to crash upon rotating in that view. --- iBean/iBean.xcodeproj/project.pbxproj | 4 ++ .../UserInterfaceState.xcuserstate | Bin 43024 -> 41820 bytes .../xcdebugger/Breakpoints.xcbkptlist | 14 +++--- iBean/iBean/BeanCollectionExtractionScrollView.m | 2 + .../iBean/BeanCollectionExtractionViewController.h | 2 +- .../iBean/BeanCollectionExtractionViewController.m | 17 ++++++- iBean/iBean/InstantExtractionViewController.h | 2 +- iBean/iBean/InstantExtractionViewController.m | 20 +++++++- iBean/iBean/SettingsViewController.h | 2 +- iBean/iBean/SettingsViewController.m | 51 +++++++++++++-------- iBean/iBean/iPhoneStoryboard.storyboard | 6 +-- 11 files changed, 85 insertions(+), 35 deletions(-) diff --git a/iBean/iBean.xcodeproj/project.pbxproj b/iBean/iBean.xcodeproj/project.pbxproj index 1bbb776..e2c40a3 100644 --- a/iBean/iBean.xcodeproj/project.pbxproj +++ b/iBean/iBean.xcodeproj/project.pbxproj @@ -31,6 +31,7 @@ 020C568F16A1CE0E00D8224C /* EditBeanViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 020C568E16A1CE0E00D8224C /* EditBeanViewController.m */; }; 020C569316A1E55600D8224C /* ExtractionViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 020C569216A1E55600D8224C /* ExtractionViewController.m */; }; 020C569C16A49C8300D8224C /* Configuration+Interface.m in Sources */ = {isa = PBXBuildFile; fileRef = 020C569B16A49C8300D8224C /* Configuration+Interface.m */; }; + 022A9C6B16BE9CA300DB3A4A /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 022A9C6A16BE9CA300DB3A4A /* AudioToolbox.framework */; }; 024F676D16A4A61D004A1201 /* InstantExtractionViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 024F676C16A4A61D004A1201 /* InstantExtractionViewController.m */; }; 0276253916B58D6000EE2F4E /* SettingsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0276253816B58D6000EE2F4E /* SettingsViewController.m */; }; 0276253C16B59E4C00EE2F4E /* Configuration.m in Sources */ = {isa = PBXBuildFile; fileRef = 0276253B16B59E4C00EE2F4E /* Configuration.m */; }; @@ -84,6 +85,7 @@ 020C569216A1E55600D8224C /* ExtractionViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ExtractionViewController.m; sourceTree = ""; }; 020C569A16A49C8300D8224C /* Configuration+Interface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Configuration+Interface.h"; sourceTree = ""; }; 020C569B16A49C8300D8224C /* Configuration+Interface.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "Configuration+Interface.m"; sourceTree = ""; }; + 022A9C6A16BE9CA300DB3A4A /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; }; 024F676B16A4A61D004A1201 /* InstantExtractionViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InstantExtractionViewController.h; sourceTree = ""; }; 024F676C16A4A61D004A1201 /* InstantExtractionViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = InstantExtractionViewController.m; sourceTree = ""; }; 0276253716B58D6000EE2F4E /* SettingsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SettingsViewController.h; sourceTree = ""; }; @@ -111,6 +113,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 022A9C6B16BE9CA300DB3A4A /* AudioToolbox.framework in Frameworks */, 020C55981691014E00D8224C /* UIKit.framework in Frameworks */, 020C559A1691014E00D8224C /* Foundation.framework in Frameworks */, 020C559C1691014E00D8224C /* CoreGraphics.framework in Frameworks */, @@ -141,6 +144,7 @@ 020C55961691014E00D8224C /* Frameworks */ = { isa = PBXGroup; children = ( + 022A9C6A16BE9CA300DB3A4A /* AudioToolbox.framework */, 020C55971691014E00D8224C /* UIKit.framework */, 020C55991691014E00D8224C /* Foundation.framework */, 020C559B1691014E00D8224C /* CoreGraphics.framework */, diff --git a/iBean/iBean.xcodeproj/project.xcworkspace/xcuserdata/eddiex.xcuserdatad/UserInterfaceState.xcuserstate b/iBean/iBean.xcodeproj/project.xcworkspace/xcuserdata/eddiex.xcuserdatad/UserInterfaceState.xcuserstate index c87b20a..57a6226 100644 Binary files a/iBean/iBean.xcodeproj/project.xcworkspace/xcuserdata/eddiex.xcuserdatad/UserInterfaceState.xcuserstate and b/iBean/iBean.xcodeproj/project.xcworkspace/xcuserdata/eddiex.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/iBean/iBean.xcodeproj/xcuserdata/eddiex.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist b/iBean/iBean.xcodeproj/xcuserdata/eddiex.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist index e4eeaa6..d3ee32a 100644 --- a/iBean/iBean.xcodeproj/xcuserdata/eddiex.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist +++ b/iBean/iBean.xcodeproj/xcuserdata/eddiex.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist @@ -8,11 +8,11 @@ ignoreCount = "0" continueAfterRunningActions = "No" filePath = "iBean/InstantExtractionViewController.m" - timestampString = "380990419.117278" + timestampString = "381591502.753324" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "80" - endingLineNumber = "80" + startingLineNumber = "87" + endingLineNumber = "87" landmarkName = "-haltExtractionTimer" landmarkType = "5"> @@ -21,11 +21,11 @@ ignoreCount = "0" continueAfterRunningActions = "No" filePath = "iBean/InstantExtractionViewController.m" - timestampString = "380990419.117278" + timestampString = "381591502.753324" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "88" - endingLineNumber = "88" + startingLineNumber = "95" + endingLineNumber = "95" landmarkName = "-timerInterrupted" landmarkType = "5"> @@ -43,7 +43,7 @@ landmarkType = "5"> @class BeanCollection; -@interface BeanCollectionExtractionViewController : UIViewController +@interface BeanCollectionExtractionViewController : UIViewController @property (nonatomic, strong) BeanCollection *beanCollection; @property (nonatomic, assign) double extractionProgress; diff --git a/iBean/iBean/BeanCollectionExtractionViewController.m b/iBean/iBean/BeanCollectionExtractionViewController.m index dea550d..b1be270 100644 --- a/iBean/iBean/BeanCollectionExtractionViewController.m +++ b/iBean/iBean/BeanCollectionExtractionViewController.m @@ -6,6 +6,7 @@ // Copyright (c) 2013 Eddie Ehlin. All rights reserved. // +#import #import "BeanCollectionExtractionViewController.h" #import "BeanCollectionInfoViewController.h" #import "BeanCollection+Interface.h" @@ -99,7 +100,14 @@ { NSLog(@"Timer reached its limit!"); [self haltExtractionTimer]; - NSLog(@"Extraction count = %@", [(AppDelegate*) [[UIApplication sharedApplication] delegate] incrementExtractionCount]); + + UIAlertView *extractionCompleteAlert = [[UIAlertView alloc] + initWithTitle:@"Coffee time!" + message:@"Extraction completed." + delegate:self + cancelButtonTitle:@"OK" otherButtonTitles: nil]; + AudioServicesPlaySystemSound(kSystemSoundID_Vibrate); + [extractionCompleteAlert show]; } } @@ -173,4 +181,11 @@ return cell; } +#pragma mark - UIAlertView delegate +- (void) alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex +{ + //This will process thresholds etc. + NSLog(@"Extraction count = %@", [(AppDelegate*) [[UIApplication sharedApplication] delegate] incrementExtractionCount]); +} + @end diff --git a/iBean/iBean/InstantExtractionViewController.h b/iBean/iBean/InstantExtractionViewController.h index f988197..10b387a 100644 --- a/iBean/iBean/InstantExtractionViewController.h +++ b/iBean/iBean/InstantExtractionViewController.h @@ -8,7 +8,7 @@ #import -@interface InstantExtractionViewController : UIViewController +@interface InstantExtractionViewController : UIViewController @property (nonatomic, assign) double extractionProgress; @property (nonatomic, assign) BOOL extractionInProgress; diff --git a/iBean/iBean/InstantExtractionViewController.m b/iBean/iBean/InstantExtractionViewController.m index 4c02b62..b2e1372 100644 --- a/iBean/iBean/InstantExtractionViewController.m +++ b/iBean/iBean/InstantExtractionViewController.m @@ -5,7 +5,7 @@ // Created by Eddie Ehlin on 2012-12-31. // Copyright (c) 2012 Eddie Ehlin. All rights reserved. // - +#import #import "InstantExtractionViewController.h" #import "AppDelegate+Storage.h" @@ -66,7 +66,14 @@ { NSLog(@"Timer reached its limit!"); [self haltExtractionTimer]; - NSLog(@"Extraction count = %@", [(AppDelegate*) [[UIApplication sharedApplication] delegate] incrementExtractionCount]); + + UIAlertView *extractionCompleteAlert = [[UIAlertView alloc] + initWithTitle:@"Coffee time!" + message:@"Extraction completed." + delegate:self + cancelButtonTitle:@"OK" otherButtonTitles: nil]; + AudioServicesPlaySystemSound(kSystemSoundID_Vibrate); + [extractionCompleteAlert show]; } } @@ -120,4 +127,13 @@ if (error == nil) [self updateExtractionSettingLabel]; } + +/***************************************************** + Delegates + *****************************************************/ +#pragma mark - UIAlertView delegate +- (void) alertView:(UIAlertView *)alertView willDismissWithButtonIndex:(NSInteger)buttonIndex +{ + NSLog(@"Extraction count = %@", [(AppDelegate*) [[UIApplication sharedApplication] delegate] incrementExtractionCount]); +} @end diff --git a/iBean/iBean/SettingsViewController.h b/iBean/iBean/SettingsViewController.h index bfee4f8..efddfb2 100644 --- a/iBean/iBean/SettingsViewController.h +++ b/iBean/iBean/SettingsViewController.h @@ -9,7 +9,7 @@ #import @class Configuration; -@interface SettingsViewController : UITableViewController +@interface SettingsViewController : UITableViewController @property (nonatomic, strong) Configuration *configuration; diff --git a/iBean/iBean/SettingsViewController.m b/iBean/iBean/SettingsViewController.m index 7290f6d..b3dfb46 100644 --- a/iBean/iBean/SettingsViewController.m +++ b/iBean/iBean/SettingsViewController.m @@ -147,30 +147,43 @@ - (void) resetExtractionCount:(id)sender { - if (self.configuration != nil) + UIAlertView *resetConfirmAlert = [[UIAlertView alloc] + initWithTitle:@"Reset extraction count?" + message:@"Are you sure about resetting extraction count?" + delegate:self + cancelButtonTitle:@"Yes" + otherButtonTitles:@"No", nil]; + [resetConfirmAlert show]; +} + +/***************************************************** + Delegates + *****************************************************/ +#pragma mark - UIAlertView delegate +- (void) alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex +{ + if (buttonIndex == 0) { - NSError *error = [(AppDelegate*) [[UIApplication sharedApplication] delegate] setExtractionCount:[NSNumber numberWithInt:0]]; - self.extractionCountLabel.text = [self.configuration.extractionCount stringValue]; - self.extractionCountStepper.value = [self.configuration.extractionCount doubleValue]; - if (error != nil) - { - UIAlertView *setExtractionCountAlert = [[UIAlertView alloc] - initWithTitle:@"Configuration error!" - message:@"iBean was not able to save configuration attribute for \"Extraction count\"." - delegate:nil - cancelButtonTitle:@"OK" otherButtonTitles: nil]; - [setExtractionCountAlert show]; - } - else + if (self.configuration != nil) { + NSError *error = [(AppDelegate*) [[UIApplication sharedApplication] delegate] setExtractionCount:[NSNumber numberWithInt:0]]; self.extractionCountLabel.text = [self.configuration.extractionCount stringValue]; self.extractionCountStepper.value = [self.configuration.extractionCount doubleValue]; + if (error != nil) + { + UIAlertView *setExtractionCountAlert = [[UIAlertView alloc] + initWithTitle:@"Configuration error!" + message:@"iBean was not able to save configuration attribute for \"Extraction count\"." + delegate:nil + cancelButtonTitle:@"OK" otherButtonTitles: nil]; + [setExtractionCountAlert show]; + } + else + { + self.extractionCountLabel.text = [self.configuration.extractionCount stringValue]; + self.extractionCountStepper.value = [self.configuration.extractionCount doubleValue]; + } } } } - -/***************************************************** - Delegates - *****************************************************/ - @end diff --git a/iBean/iBean/iPhoneStoryboard.storyboard b/iBean/iBean/iPhoneStoryboard.storyboard index 0244142..22975ba 100644 --- a/iBean/iBean/iPhoneStoryboard.storyboard +++ b/iBean/iBean/iPhoneStoryboard.storyboard @@ -471,7 +471,7 @@ -