From 1f1ff5cad7d9448ad83dd8315ead27e30da58472 Mon Sep 17 00:00:00 2001 From: 7imbrook Date: Tue, 16 Jul 2013 08:52:15 -0400 Subject: [PATCH 01/19] Added RAC as submod to project --- .gitmodules | 3 + .../AccessBraille.xcodeproj/project.pbxproj | 131 ++++++++++++++++++ .../xcshareddata/AccessBraille.xccheckout | 12 ++ RAC | 1 + 4 files changed, 147 insertions(+) create mode 100644 .gitmodules create mode 160000 RAC diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..f0289be --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "RAC"] + path = RAC + url = https://github.com/ReactiveCocoa/ReactiveCocoa.git diff --git a/AccessBraille/AccessBraille.xcodeproj/project.pbxproj b/AccessBraille/AccessBraille.xcodeproj/project.pbxproj index 61937b9..7b3586d 100644 --- a/AccessBraille/AccessBraille.xcodeproj/project.pbxproj +++ b/AccessBraille/AccessBraille.xcodeproj/project.pbxproj @@ -171,6 +171,55 @@ remoteGlobalIDString = 4C05CE101778AFD200F80C70; remoteInfo = ABKeyboard; }; + 4C249CC01795778C000CCF72 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 4C249CB51795778B000CCF72 /* ReactiveCocoa.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 88037F8315056328001A5B19; + remoteInfo = ReactiveCocoa; + }; + 4C249CC21795778C000CCF72 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 4C249CB51795778B000CCF72 /* ReactiveCocoa.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 88F440AB153DAC820097B4C3; + remoteInfo = "ReactiveCocoa-iOS"; + }; + 4C249CC41795778C000CCF72 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 4C249CB51795778B000CCF72 /* ReactiveCocoa.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 88CDF7DC15000FCF00163A9F; + remoteInfo = ReactiveCocoaTests; + }; + 4C249CC61795778C000CCF72 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 4C249CB51795778B000CCF72 /* ReactiveCocoa.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 5FAF5223174D4C2000CAC810; + remoteInfo = "ReactiveCocoaTests-iOS"; + }; + 4C249CC81795778C000CCF72 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 4C249CB51795778B000CCF72 /* ReactiveCocoa.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 1860F412177C91B500C7B3C9; + remoteInfo = "ReactiveCocoa-iOS-UIKitTestHost"; + }; + 4C249CCA1795778C000CCF72 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 4C249CB51795778B000CCF72 /* ReactiveCocoa.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 1860F430177C91B500C7B3C9; + remoteInfo = "ReactiveCocoa-iOS-UIKitTestHostTests"; + }; + 4C249CD1179578A8000CCF72 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 4C249CB51795778B000CCF72 /* ReactiveCocoa.xcodeproj */; + proxyType = 1; + remoteGlobalIDString = 88F440AA153DAC820097B4C3; + remoteInfo = "ReactiveCocoa-iOS"; + }; 4CFEE0D9178B0C63003DEEF8 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = A9479C2D1670034D00CE9475 /* Project object */; @@ -261,6 +310,7 @@ 4C1B1E22175CF76D00A3DEDA /* UIView+quickRemove.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+quickRemove.m"; sourceTree = ""; }; 4C1B824E171316F60035797D /* ABBrailleReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ABBrailleReader.h; sourceTree = ""; }; 4C1B824F171316F60035797D /* ABBrailleReader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ABBrailleReader.m; sourceTree = ""; }; + 4C249CB51795778B000CCF72 /* ReactiveCocoa.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = ReactiveCocoa.xcodeproj; path = ../RAC/ReactiveCocoaFramework/ReactiveCocoa.xcodeproj; sourceTree = ""; }; 4C2B0B1416F37A2D00CC64F2 /* InstructionsMenu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InstructionsMenu.h; sourceTree = ""; }; 4C2B0B1516F37A2D00CC64F2 /* InstructionsMenu.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = InstructionsMenu.m; sourceTree = ""; }; 4C2F59E816F76EBC008F8185 /* menuDiscriptions.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = menuDiscriptions.plist; sourceTree = ""; }; @@ -412,6 +462,19 @@ name = Categories; sourceTree = ""; }; + 4C249CB61795778B000CCF72 /* Products */ = { + isa = PBXGroup; + children = ( + 4C249CC11795778C000CCF72 /* ReactiveCocoa.framework */, + 4C249CC31795778C000CCF72 /* libReactiveCocoa-iOS.a */, + 4C249CC51795778C000CCF72 /* ReactiveCocoaTests.octest */, + 4C249CC71795778C000CCF72 /* ReactiveCocoaTests-iOS.octest */, + 4C249CC91795778C000CCF72 /* ReactiveCocoa-iOS-UIKitTestHost.app */, + 4C249CCB1795778C000CCF72 /* ReactiveCocoa-iOS-UIKitTestHostTests.octest */, + ); + name = Products; + sourceTree = ""; + }; 4C48079016C01CAF001E3EF1 /* Models */ = { isa = PBXGroup; children = ( @@ -547,6 +610,7 @@ A9479C2C1670034D00CE9475 = { isa = PBXGroup; children = ( + 4C249CB51795778B000CCF72 /* ReactiveCocoa.xcodeproj */, 4C1B1E1B175CC92B00A3DEDA /* icon144.png */, 4C1B1E19175CC92000A3DEDA /* Default-Landscape@2x~ipad.png */, 4C1B1E17175CC91800A3DEDA /* Default-Landscape~ipad.png */, @@ -715,6 +779,7 @@ buildRules = ( ); dependencies = ( + 4C249CD2179578A8000CCF72 /* PBXTargetDependency */, ); name = ABKeyboard; productName = ABKeyboard; @@ -782,6 +847,12 @@ mainGroup = A9479C2C1670034D00CE9475; productRefGroup = A9479C361670034E00CE9475 /* Products */; projectDirPath = ""; + projectReferences = ( + { + ProductGroup = 4C249CB61795778B000CCF72 /* Products */; + ProjectRef = 4C249CB51795778B000CCF72 /* ReactiveCocoa.xcodeproj */; + }, + ); projectRoot = ""; targets = ( A9479C341670034E00CE9475 /* AccessBraille */, @@ -792,6 +863,51 @@ }; /* End PBXProject section */ +/* Begin PBXReferenceProxy section */ + 4C249CC11795778C000CCF72 /* ReactiveCocoa.framework */ = { + isa = PBXReferenceProxy; + fileType = wrapper.framework; + path = ReactiveCocoa.framework; + remoteRef = 4C249CC01795778C000CCF72 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 4C249CC31795778C000CCF72 /* libReactiveCocoa-iOS.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = "libReactiveCocoa-iOS.a"; + remoteRef = 4C249CC21795778C000CCF72 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 4C249CC51795778C000CCF72 /* ReactiveCocoaTests.octest */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = ReactiveCocoaTests.octest; + remoteRef = 4C249CC41795778C000CCF72 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 4C249CC71795778C000CCF72 /* ReactiveCocoaTests-iOS.octest */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = "ReactiveCocoaTests-iOS.octest"; + remoteRef = 4C249CC61795778C000CCF72 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 4C249CC91795778C000CCF72 /* ReactiveCocoa-iOS-UIKitTestHost.app */ = { + isa = PBXReferenceProxy; + fileType = wrapper.application; + path = "ReactiveCocoa-iOS-UIKitTestHost.app"; + remoteRef = 4C249CC81795778C000CCF72 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 4C249CCB1795778C000CCF72 /* ReactiveCocoa-iOS-UIKitTestHostTests.octest */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = "ReactiveCocoa-iOS-UIKitTestHostTests.octest"; + remoteRef = 4C249CCA1795778C000CCF72 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; +/* End PBXReferenceProxy section */ + /* Begin PBXResourcesBuildPhase section */ 4C05CE0F1778AFD200F80C70 /* Resources */ = { isa = PBXResourcesBuildPhase; @@ -989,6 +1105,11 @@ target = 4C05CE101778AFD200F80C70 /* ABKeyboard */; targetProxy = 4C05CE3E1778B24300F80C70 /* PBXContainerItemProxy */; }; + 4C249CD2179578A8000CCF72 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = "ReactiveCocoa-iOS"; + targetProxy = 4C249CD1179578A8000CCF72 /* PBXContainerItemProxy */; + }; 4CFEE0DA178B0C63003DEEF8 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 4C05CE101778AFD200F80C70 /* ABKeyboard */; @@ -1055,6 +1176,10 @@ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNUSED_FUNCTION = YES; + HEADER_SEARCH_PATHS = ( + "\"$(BUILD_ROOT)/../IntermediateBuildFilesPath/UninstalledProducts/include\"", + "$(inherited)", + ); INFOPLIST_FILE = "ABKeyboard/ABKeyboard-Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Bundles"; IPHONEOS_DEPLOYMENT_TARGET = 6.0; @@ -1062,6 +1187,7 @@ MACH_O_TYPE = mh_object; MACOSX_DEPLOYMENT_TARGET = 10.8; ONLY_ACTIVE_ARCH = NO; + OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = "$(TARGET_NAME)"; SCAN_ALL_SOURCE_FILES_FOR_INCLUDES = YES; SDKROOT = iphoneos; @@ -1093,6 +1219,10 @@ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNUSED_FUNCTION = YES; + HEADER_SEARCH_PATHS = ( + "\"$(BUILD_ROOT)/../IntermediateBuildFilesPath/UninstalledProducts/include\"", + "$(inherited)", + ); INFOPLIST_FILE = "ABKeyboard/ABKeyboard-Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Bundles"; IPHONEOS_DEPLOYMENT_TARGET = 6.0; @@ -1100,6 +1230,7 @@ MACH_O_TYPE = mh_object; MACOSX_DEPLOYMENT_TARGET = 10.8; ONLY_ACTIVE_ARCH = NO; + OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = "$(TARGET_NAME)"; SCAN_ALL_SOURCE_FILES_FOR_INCLUDES = YES; SDKROOT = iphoneos; diff --git a/AccessBraille/AccessBraille.xcodeproj/project.xcworkspace/xcshareddata/AccessBraille.xccheckout b/AccessBraille/AccessBraille.xcodeproj/project.xcworkspace/xcshareddata/AccessBraille.xccheckout index 80a3822..68441b5 100644 --- a/AccessBraille/AccessBraille.xcodeproj/project.xcworkspace/xcshareddata/AccessBraille.xccheckout +++ b/AccessBraille/AccessBraille.xcodeproj/project.xcworkspace/xcshareddata/AccessBraille.xccheckout @@ -8,6 +8,8 @@ AccessBraille IDESourceControlProjectOriginsDictionary + 9A69059F-226A-4219-ACE2-01826BCCED1E + https://github.com/ReactiveCocoa/ReactiveCocoa.git FD8919F2-CBFA-4934-9E9D-D32E592A9FF9 ssh://github.com/RITAccess/accessbraille.git @@ -15,6 +17,8 @@ AccessBraille/AccessBraille.xcodeproj/project.xcworkspace IDESourceControlProjectRelativeInstallPathDictionary + 9A69059F-226A-4219-ACE2-01826BCCED1E + ../../../RAC FD8919F2-CBFA-4934-9E9D-D32E592A9FF9 ../../.. @@ -34,6 +38,14 @@ IDESourceControlWCCName accessbraille + + IDESourceControlRepositoryExtensionIdentifierKey + public.vcs.git + IDESourceControlWCCIdentifierKey + 9A69059F-226A-4219-ACE2-01826BCCED1E + IDESourceControlWCCName + RAC + diff --git a/RAC b/RAC new file mode 160000 index 0000000..c6a07e7 --- /dev/null +++ b/RAC @@ -0,0 +1 @@ +Subproject commit c6a07e7451e3cc339f15e165a9666049f60f8691 From bf8207fffbfcebb787b068c7cefb73f4151ca191 Mon Sep 17 00:00:00 2001 From: 7imbrook Date: Tue, 16 Jul 2013 09:01:09 -0400 Subject: [PATCH 02/19] Moved none audio inits to init methods --- AccessBraille/AccessBraille/ABBrailleReader.m | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/AccessBraille/AccessBraille/ABBrailleReader.m b/AccessBraille/AccessBraille/ABBrailleReader.m index 7df22af..e843cc7 100644 --- a/AccessBraille/AccessBraille/ABBrailleReader.m +++ b/AccessBraille/AccessBraille/ABBrailleReader.m @@ -35,7 +35,8 @@ @implementation ABBrailleReader { } -- (id)initWithAudioTarget:(id)tar selector:(SEL)sel { +- (id)init +{ self = [super init]; if (self) { // init lookups @@ -58,12 +59,18 @@ - (id)initWithAudioTarget:(id)tar selector:(SEL)sel { // Setup parser prefix = @""; - + + } + return self; +} + +- (id)initWithAudioTarget:(id)tar selector:(SEL)sel { + self = [self init]; + if (self) { // Audio target = tar; selector = sel; speak = [[ABSpeak alloc] init]; - } return self; } From 7b8176c2ea73ff48802417532895bec1f98ff697 Mon Sep 17 00:00:00 2001 From: 7imbrook Date: Tue, 16 Jul 2013 09:01:56 -0400 Subject: [PATCH 03/19] Reworked tests --- AccessBraille/AccessBrailleTests/AccessBrailleTests.m | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/AccessBraille/AccessBrailleTests/AccessBrailleTests.m b/AccessBraille/AccessBrailleTests/AccessBrailleTests.m index 6a130cf..f22492f 100644 --- a/AccessBraille/AccessBrailleTests/AccessBrailleTests.m +++ b/AccessBraille/AccessBrailleTests/AccessBrailleTests.m @@ -60,7 +60,7 @@ - (void)testABParser { - (void)testABReaderGrade1 { - ABBrailleReader *reader = [[ABBrailleReader alloc] initWithAudioTarget:nil selector:nil]; + ABBrailleReader *reader = [ABBrailleReader new]; // Test Grade 1 [reader setGrade:ABGradeOne]; @@ -86,7 +86,7 @@ - (void)testABReaderGrade1 { - (void)testABBrailleReaderGrade2 { - ABBrailleReader *reader = [[ABBrailleReader alloc] initWithAudioTarget:nil selector:nil]; + ABBrailleReader *reader = [ABBrailleReader new]; // Test grade two [reader setGrade:ABGradeTwo]; @@ -154,7 +154,7 @@ - (void)testABBrailleReaderGrade2 { - (void)testABBrailleReaderGrade2_test2 { - ABBrailleReader *reader = [[ABBrailleReader alloc] initWithAudioTarget:nil selector:nil]; + ABBrailleReader *reader = [ABBrailleReader new]; // Prefix followed by non recongnized post [reader processString:@"000010"]; From 5bb20adbb205c120d31782e78ba5a5e9e67af83a Mon Sep 17 00:00:00 2001 From: 7imbrook Date: Tue, 16 Jul 2013 09:56:47 -0400 Subject: [PATCH 04/19] Removed the rest of RAC --- .../AccessBraille.xcodeproj/project.pbxproj | 121 ------------------ RAC | 1 - 2 files changed, 122 deletions(-) delete mode 160000 RAC diff --git a/AccessBraille/AccessBraille.xcodeproj/project.pbxproj b/AccessBraille/AccessBraille.xcodeproj/project.pbxproj index 7b3586d..2acb1c2 100644 --- a/AccessBraille/AccessBraille.xcodeproj/project.pbxproj +++ b/AccessBraille/AccessBraille.xcodeproj/project.pbxproj @@ -171,55 +171,6 @@ remoteGlobalIDString = 4C05CE101778AFD200F80C70; remoteInfo = ABKeyboard; }; - 4C249CC01795778C000CCF72 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 4C249CB51795778B000CCF72 /* ReactiveCocoa.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 88037F8315056328001A5B19; - remoteInfo = ReactiveCocoa; - }; - 4C249CC21795778C000CCF72 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 4C249CB51795778B000CCF72 /* ReactiveCocoa.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 88F440AB153DAC820097B4C3; - remoteInfo = "ReactiveCocoa-iOS"; - }; - 4C249CC41795778C000CCF72 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 4C249CB51795778B000CCF72 /* ReactiveCocoa.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 88CDF7DC15000FCF00163A9F; - remoteInfo = ReactiveCocoaTests; - }; - 4C249CC61795778C000CCF72 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 4C249CB51795778B000CCF72 /* ReactiveCocoa.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 5FAF5223174D4C2000CAC810; - remoteInfo = "ReactiveCocoaTests-iOS"; - }; - 4C249CC81795778C000CCF72 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 4C249CB51795778B000CCF72 /* ReactiveCocoa.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 1860F412177C91B500C7B3C9; - remoteInfo = "ReactiveCocoa-iOS-UIKitTestHost"; - }; - 4C249CCA1795778C000CCF72 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 4C249CB51795778B000CCF72 /* ReactiveCocoa.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 1860F430177C91B500C7B3C9; - remoteInfo = "ReactiveCocoa-iOS-UIKitTestHostTests"; - }; - 4C249CD1179578A8000CCF72 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 4C249CB51795778B000CCF72 /* ReactiveCocoa.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 88F440AA153DAC820097B4C3; - remoteInfo = "ReactiveCocoa-iOS"; - }; 4CFEE0D9178B0C63003DEEF8 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = A9479C2D1670034D00CE9475 /* Project object */; @@ -310,7 +261,6 @@ 4C1B1E22175CF76D00A3DEDA /* UIView+quickRemove.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+quickRemove.m"; sourceTree = ""; }; 4C1B824E171316F60035797D /* ABBrailleReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ABBrailleReader.h; sourceTree = ""; }; 4C1B824F171316F60035797D /* ABBrailleReader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ABBrailleReader.m; sourceTree = ""; }; - 4C249CB51795778B000CCF72 /* ReactiveCocoa.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = ReactiveCocoa.xcodeproj; path = ../RAC/ReactiveCocoaFramework/ReactiveCocoa.xcodeproj; sourceTree = ""; }; 4C2B0B1416F37A2D00CC64F2 /* InstructionsMenu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InstructionsMenu.h; sourceTree = ""; }; 4C2B0B1516F37A2D00CC64F2 /* InstructionsMenu.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = InstructionsMenu.m; sourceTree = ""; }; 4C2F59E816F76EBC008F8185 /* menuDiscriptions.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = menuDiscriptions.plist; sourceTree = ""; }; @@ -462,19 +412,6 @@ name = Categories; sourceTree = ""; }; - 4C249CB61795778B000CCF72 /* Products */ = { - isa = PBXGroup; - children = ( - 4C249CC11795778C000CCF72 /* ReactiveCocoa.framework */, - 4C249CC31795778C000CCF72 /* libReactiveCocoa-iOS.a */, - 4C249CC51795778C000CCF72 /* ReactiveCocoaTests.octest */, - 4C249CC71795778C000CCF72 /* ReactiveCocoaTests-iOS.octest */, - 4C249CC91795778C000CCF72 /* ReactiveCocoa-iOS-UIKitTestHost.app */, - 4C249CCB1795778C000CCF72 /* ReactiveCocoa-iOS-UIKitTestHostTests.octest */, - ); - name = Products; - sourceTree = ""; - }; 4C48079016C01CAF001E3EF1 /* Models */ = { isa = PBXGroup; children = ( @@ -610,7 +547,6 @@ A9479C2C1670034D00CE9475 = { isa = PBXGroup; children = ( - 4C249CB51795778B000CCF72 /* ReactiveCocoa.xcodeproj */, 4C1B1E1B175CC92B00A3DEDA /* icon144.png */, 4C1B1E19175CC92000A3DEDA /* Default-Landscape@2x~ipad.png */, 4C1B1E17175CC91800A3DEDA /* Default-Landscape~ipad.png */, @@ -779,7 +715,6 @@ buildRules = ( ); dependencies = ( - 4C249CD2179578A8000CCF72 /* PBXTargetDependency */, ); name = ABKeyboard; productName = ABKeyboard; @@ -847,12 +782,6 @@ mainGroup = A9479C2C1670034D00CE9475; productRefGroup = A9479C361670034E00CE9475 /* Products */; projectDirPath = ""; - projectReferences = ( - { - ProductGroup = 4C249CB61795778B000CCF72 /* Products */; - ProjectRef = 4C249CB51795778B000CCF72 /* ReactiveCocoa.xcodeproj */; - }, - ); projectRoot = ""; targets = ( A9479C341670034E00CE9475 /* AccessBraille */, @@ -863,51 +792,6 @@ }; /* End PBXProject section */ -/* Begin PBXReferenceProxy section */ - 4C249CC11795778C000CCF72 /* ReactiveCocoa.framework */ = { - isa = PBXReferenceProxy; - fileType = wrapper.framework; - path = ReactiveCocoa.framework; - remoteRef = 4C249CC01795778C000CCF72 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 4C249CC31795778C000CCF72 /* libReactiveCocoa-iOS.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libReactiveCocoa-iOS.a"; - remoteRef = 4C249CC21795778C000CCF72 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 4C249CC51795778C000CCF72 /* ReactiveCocoaTests.octest */ = { - isa = PBXReferenceProxy; - fileType = wrapper.cfbundle; - path = ReactiveCocoaTests.octest; - remoteRef = 4C249CC41795778C000CCF72 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 4C249CC71795778C000CCF72 /* ReactiveCocoaTests-iOS.octest */ = { - isa = PBXReferenceProxy; - fileType = wrapper.cfbundle; - path = "ReactiveCocoaTests-iOS.octest"; - remoteRef = 4C249CC61795778C000CCF72 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 4C249CC91795778C000CCF72 /* ReactiveCocoa-iOS-UIKitTestHost.app */ = { - isa = PBXReferenceProxy; - fileType = wrapper.application; - path = "ReactiveCocoa-iOS-UIKitTestHost.app"; - remoteRef = 4C249CC81795778C000CCF72 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 4C249CCB1795778C000CCF72 /* ReactiveCocoa-iOS-UIKitTestHostTests.octest */ = { - isa = PBXReferenceProxy; - fileType = wrapper.cfbundle; - path = "ReactiveCocoa-iOS-UIKitTestHostTests.octest"; - remoteRef = 4C249CCA1795778C000CCF72 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; -/* End PBXReferenceProxy section */ - /* Begin PBXResourcesBuildPhase section */ 4C05CE0F1778AFD200F80C70 /* Resources */ = { isa = PBXResourcesBuildPhase; @@ -1105,11 +989,6 @@ target = 4C05CE101778AFD200F80C70 /* ABKeyboard */; targetProxy = 4C05CE3E1778B24300F80C70 /* PBXContainerItemProxy */; }; - 4C249CD2179578A8000CCF72 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = "ReactiveCocoa-iOS"; - targetProxy = 4C249CD1179578A8000CCF72 /* PBXContainerItemProxy */; - }; 4CFEE0DA178B0C63003DEEF8 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 4C05CE101778AFD200F80C70 /* ABKeyboard */; diff --git a/RAC b/RAC deleted file mode 160000 index c6a07e7..0000000 --- a/RAC +++ /dev/null @@ -1 +0,0 @@ -Subproject commit c6a07e7451e3cc339f15e165a9666049f60f8691 From 39fed5134188f1d3d63341d7991e10c6d00fd5c5 Mon Sep 17 00:00:00 2001 From: 7imbrook Date: Tue, 16 Jul 2013 10:00:03 -0400 Subject: [PATCH 05/19] Fixed #151 with tests --- AccessBraille/AccessBraille/ABBrailleReader.m | 5 ++++- AccessBraille/AccessBrailleTests/AccessBrailleTests.m | 7 +++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/AccessBraille/AccessBraille/ABBrailleReader.m b/AccessBraille/AccessBraille/ABBrailleReader.m index e843cc7..7080d72 100644 --- a/AccessBraille/AccessBraille/ABBrailleReader.m +++ b/AccessBraille/AccessBraille/ABBrailleReader.m @@ -194,19 +194,22 @@ - (void)sendCharacter:(NSString *)string [_delegate characterTyped:@" " withInfo:@{ABGestureInfoStatus : @(YES), ABSpaceTyped : @(YES), ABBackspaceReceived : @(NO)}]; + } else if ([string isEqualToString:ABBackspace]) { [_fieldOutput deleteBackward]; [_delegate characterTyped:@"" withInfo:@{ABGestureInfoStatus : @(YES), ABSpaceTyped : @(NO), ABBackspaceReceived : @(YES)}]; [target performSelector:selector withObject:ABBackspaceSound]; + } else if ([string isEqualToString:@""]) { return; } else { + [speak speakString:string]; if(_layer.shift) { - string = [string uppercaseString]; + string = [NSString stringWithFormat:@"%@%@", [[string substringToIndex:1] uppercaseString], [string substringFromIndex:1]]; _layer.shift = NO; [_layer setNeedsDisplay]; } diff --git a/AccessBraille/AccessBrailleTests/AccessBrailleTests.m b/AccessBraille/AccessBrailleTests/AccessBrailleTests.m index f22492f..59988ff 100644 --- a/AccessBraille/AccessBrailleTests/AccessBrailleTests.m +++ b/AccessBraille/AccessBrailleTests/AccessBrailleTests.m @@ -168,4 +168,11 @@ - (void)testABBrailleReaderGrade2_test2 reader = nil; } +- (void)testCapsMethod +{ + NSString *string = @"test"; + string = [NSString stringWithFormat:@"%@%@", [[string substringToIndex:1] uppercaseString], [string substringFromIndex:1]]; + STAssertEqualObjects(string, @"Test", @"Did not caps"); +} + @end From 0e76fe9a3de1fe951b5bb136c2c20ec0308d1026 Mon Sep 17 00:00:00 2001 From: 7imbrook Date: Tue, 16 Jul 2013 10:30:53 -0400 Subject: [PATCH 06/19] Reworked ABKeyboard class --- .../AccessBraille.xcodeproj/project.pbxproj | 20 ++++----- AccessBraille/AccessBraille/ABKeyboard.m | 44 ++++++++++++------- 2 files changed, 37 insertions(+), 27 deletions(-) diff --git a/AccessBraille/AccessBraille.xcodeproj/project.pbxproj b/AccessBraille/AccessBraille.xcodeproj/project.pbxproj index 2acb1c2..0678f66 100644 --- a/AccessBraille/AccessBraille.xcodeproj/project.pbxproj +++ b/AccessBraille/AccessBraille.xcodeproj/project.pbxproj @@ -43,11 +43,11 @@ 4C05CE1F1778B10000F80C70 /* ABParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 2C10E23517302D8600A2864B /* ABParser.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4C05CE201778B11300F80C70 /* ABKeyboard.h in Headers */ = {isa = PBXBuildFile; fileRef = 4CEE19A216FCA05400E36128 /* ABKeyboard.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4C05CE211778B16700F80C70 /* ABSpeak.h in Headers */ = {isa = PBXBuildFile; fileRef = 2C10E23717302D8600A2864B /* ABSpeak.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 4C05CE221778B16D00F80C70 /* ABTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 4C433B8F1705DF4B003D2DE7 /* ABTypes.h */; }; - 4C05CE231778B17000F80C70 /* ABActivateKeyboardGestureRecognizer.h in Headers */ = {isa = PBXBuildFile; fileRef = 4CEE19A016FCA05400E36128 /* ABActivateKeyboardGestureRecognizer.h */; }; - 4C05CE241778B17400F80C70 /* ABBrailleReader.h in Headers */ = {isa = PBXBuildFile; fileRef = 4C1B824E171316F60035797D /* ABBrailleReader.h */; }; - 4C05CE251778B17800F80C70 /* ABTouchLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 4C50A416170DCA8F00D03D44 /* ABTouchLayer.h */; }; - 4C05CE261778B17A00F80C70 /* ABTouchView.h in Headers */ = {isa = PBXBuildFile; fileRef = 4C092A5E170F1AFA00650986 /* ABTouchView.h */; }; + 4C05CE221778B16D00F80C70 /* ABTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 4C433B8F1705DF4B003D2DE7 /* ABTypes.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 4C05CE231778B17000F80C70 /* ABActivateKeyboardGestureRecognizer.h in Headers */ = {isa = PBXBuildFile; fileRef = 4CEE19A016FCA05400E36128 /* ABActivateKeyboardGestureRecognizer.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 4C05CE241778B17400F80C70 /* ABBrailleReader.h in Headers */ = {isa = PBXBuildFile; fileRef = 4C1B824E171316F60035797D /* ABBrailleReader.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 4C05CE251778B17800F80C70 /* ABTouchLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 4C50A416170DCA8F00D03D44 /* ABTouchLayer.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 4C05CE261778B17A00F80C70 /* ABTouchView.h in Headers */ = {isa = PBXBuildFile; fileRef = 4C092A5E170F1AFA00650986 /* ABTouchView.h */; settings = {ATTRIBUTES = (Private, ); }; }; 4C05CE271778B18700F80C70 /* ABParser.m in Sources */ = {isa = PBXBuildFile; fileRef = 2C10E23617302D8600A2864B /* ABParser.m */; }; 4C05CE281778B18700F80C70 /* ABSpeak.m in Sources */ = {isa = PBXBuildFile; fileRef = 2C10E23817302D8600A2864B /* ABSpeak.m */; }; 4C05CE291778B18700F80C70 /* ABTypes.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CB222AD1706063E00BD3608 /* ABTypes.m */; }; @@ -118,9 +118,9 @@ 4CA74DA016F8C99F007036F3 /* MainMenuItemImage.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CA74D9F16F8C99F007036F3 /* MainMenuItemImage.m */; }; 4CB58A211778B6EA00D38D3C /* NSString+helpers.h in Headers */ = {isa = PBXBuildFile; fileRef = 4C1B1E1D175CF76D00A3DEDA /* NSString+helpers.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4CB58A221778B6EA00D38D3C /* NSString+helpers.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C1B1E1E175CF76D00A3DEDA /* NSString+helpers.m */; }; - 4CB58A231778B6EA00D38D3C /* UIView+quickRemove.h in Headers */ = {isa = PBXBuildFile; fileRef = 4C1B1E21175CF76D00A3DEDA /* UIView+quickRemove.h */; }; + 4CB58A231778B6EA00D38D3C /* UIView+quickRemove.h in Headers */ = {isa = PBXBuildFile; fileRef = 4C1B1E21175CF76D00A3DEDA /* UIView+quickRemove.h */; settings = {ATTRIBUTES = (Private, ); }; }; 4CB58A241778B6EA00D38D3C /* UIView+quickRemove.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C1B1E22175CF76D00A3DEDA /* UIView+quickRemove.m */; }; - 4CB58A271778B6EA00D38D3C /* UITextView+simpleadd.h in Headers */ = {isa = PBXBuildFile; fileRef = 4C61BEA417787D2700904C7D /* UITextView+simpleadd.h */; }; + 4CB58A271778B6EA00D38D3C /* UITextView+simpleadd.h in Headers */ = {isa = PBXBuildFile; fileRef = 4C61BEA417787D2700904C7D /* UITextView+simpleadd.h */; settings = {ATTRIBUTES = (Private, ); }; }; 4CB58A281778B6EA00D38D3C /* UITextView+simpleadd.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C61BEA517787D2700904C7D /* UITextView+simpleadd.m */; }; 4CB58A291778B73900D38D3C /* NSArray+ObjectSubsets.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CEFD38B16EE1F9100961754 /* NSArray+ObjectSubsets.m */; }; 4CB58A2B1778B89700D38D3C /* FlashCard.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C569AA517147A7B0073D8F8 /* FlashCard.m */; }; @@ -690,12 +690,12 @@ 4CB58A211778B6EA00D38D3C /* NSString+helpers.h in Headers */, 4C4CABAF1784647200563621 /* ABBrailleOutput.h in Headers */, 4CB58A271778B6EA00D38D3C /* UITextView+simpleadd.h in Headers */, - 4C05CE251778B17800F80C70 /* ABTouchLayer.h in Headers */, + 4C05CE221778B16D00F80C70 /* ABTypes.h in Headers */, + 4C05CE231778B17000F80C70 /* ABActivateKeyboardGestureRecognizer.h in Headers */, 4C05CE241778B17400F80C70 /* ABBrailleReader.h in Headers */, + 4C05CE251778B17800F80C70 /* ABTouchLayer.h in Headers */, 4C05CE261778B17A00F80C70 /* ABTouchView.h in Headers */, 4C05CE201778B11300F80C70 /* ABKeyboard.h in Headers */, - 4C05CE221778B16D00F80C70 /* ABTypes.h in Headers */, - 4C05CE231778B17000F80C70 /* ABActivateKeyboardGestureRecognizer.h in Headers */, 4CB58A231778B6EA00D38D3C /* UIView+quickRemove.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/AccessBraille/AccessBraille/ABKeyboard.m b/AccessBraille/AccessBraille/ABKeyboard.m index 175a561..9e208f9 100644 --- a/AccessBraille/AccessBraille/ABKeyboard.m +++ b/AccessBraille/AccessBraille/ABKeyboard.m @@ -15,10 +15,14 @@ #import "ABSpeak.h" #import +@interface ABKeyboard () + +@property (retain) ABBrailleReader *brailleReader; + +@end @implementation ABKeyboard { ABTouchLayer *interface; - ABBrailleReader *brailleReader; __strong ABActivateKeyboardGestureRecognizer *activate; // Audio SystemSoundID enabledSound; @@ -29,22 +33,17 @@ @implementation ABKeyboard { #pragma mark Setup -- (id)initWithDelegate:(id)delegate { +- (id)init +{ self = [super init]; if (self) { - // GR setup - _delegate = delegate; - activate = [[ABActivateKeyboardGestureRecognizer alloc] initWithTarget:self action:@selector(ABKeyboardRecognized:)]; - [activate setTouchDelegate:self]; - [((UIViewController *)_delegate).view addGestureRecognizer:activate]; - // Enable the keyboard _enabled = YES; // Set Up Braille Interp - brailleReader = [[ABBrailleReader alloc] initWithAudioTarget:self selector:@selector(playSound:)]; - [brailleReader setDelegate:_delegate]; - [brailleReader setKeyboardInterface:self]; + _brailleReader = [[ABBrailleReader alloc] initWithAudioTarget:self selector:@selector(playSound:)]; + [_brailleReader setDelegate:_delegate]; + [_brailleReader setKeyboardInterface:self]; // Audio _sound = YES; @@ -53,7 +52,18 @@ - (id)initWithDelegate:(id)delegate { backspaceSound = [self createSoundID:@"backspace.aiff"]; speak = [[ABSpeak alloc] init]; - + } + return self; +} + +- (id)initWithDelegate:(id)delegate { + self = [self init]; + if (self) { + // GR setup + _delegate = delegate; + activate = [[ABActivateKeyboardGestureRecognizer alloc] initWithTarget:self action:@selector(ABKeyboardRecognized:)]; + [activate setTouchDelegate:self]; + [((UIViewController *)_delegate).view addGestureRecognizer:activate]; } return self; } @@ -62,7 +72,7 @@ - (void)setOutput:(UITextView *)output { _output = output; [_output setInputView:[[UIView alloc] initWithFrame:CGRectMake(0, 0, 0, 0)]]; - [brailleReader setFieldOutput:_output]; + [_brailleReader setFieldOutput:_output]; } /** @@ -78,12 +88,12 @@ - (void)Log:(NSString *)str { - (ABGrade)grade { - return brailleReader.grade; + return _brailleReader.grade; } - (void)setGrade:(ABGrade)grade { - [brailleReader setGrade:grade]; + [_brailleReader setGrade:grade]; } #pragma mark Keyboard Implementation @@ -112,8 +122,8 @@ - (void)setUpViewWithTouchesFromABVectorArray:(ABVector[])vectors { [interface setBackgroundColor:[UIColor grayColor]]; [interface setAlpha:0.4]; [interface setClearsContextBeforeDrawing:YES]; - [interface setDelegate:brailleReader]; - [brailleReader setLayer:interface]; + [interface setDelegate:_brailleReader]; + [_brailleReader setLayer:interface]; for (int i = 0; i < 6; i++){ From df919016bcc3057b202f9d07d9eef517baf46c29 Mon Sep 17 00:00:00 2001 From: 7imbrook Date: Tue, 16 Jul 2013 10:31:21 -0400 Subject: [PATCH 07/19] Added check for space when clearing _textOutput --- AccessBraille/AccessBraille/ABBrailleReader.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AccessBraille/AccessBraille/ABBrailleReader.m b/AccessBraille/AccessBraille/ABBrailleReader.m index 7080d72..03f3813 100644 --- a/AccessBraille/AccessBraille/ABBrailleReader.m +++ b/AccessBraille/AccessBraille/ABBrailleReader.m @@ -228,7 +228,7 @@ - (void)sendWord:(NSString *)string { NSLog(@"Word Typed: %@", string); [speak speakString:string]; - if (![string isEqualToString:ABSpaceCharacter]) { + if (![string isEqualToString:ABSpaceCharacter] && ![_wordTyping isEqualToString:@""] && ![_wordTyping isEqualToString:@" "]) { [_fieldOutput replaceLastWordWithString:string]; } [_fieldOutput insertText:@" "]; From a53c2578a248cd1792b65e5b75fe6c581cfd68e1 Mon Sep 17 00:00:00 2001 From: 7imbrook Date: Tue, 16 Jul 2013 10:44:17 -0400 Subject: [PATCH 08/19] Added test for ABKeyboard output --- .../AccessBrailleTests/AccessBrailleTests.m | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/AccessBraille/AccessBrailleTests/AccessBrailleTests.m b/AccessBraille/AccessBrailleTests/AccessBrailleTests.m index 59988ff..98452dd 100644 --- a/AccessBraille/AccessBrailleTests/AccessBrailleTests.m +++ b/AccessBraille/AccessBrailleTests/AccessBrailleTests.m @@ -17,6 +17,12 @@ #import "MainMenuItemImage.h" #import "ABBrailleOutput.h" +@interface ABKeyboard () + +@property (retain) ABBrailleReader *brailleReader; + +@end + @implementation AccessBrailleTests - (void)setUp @@ -175,4 +181,23 @@ - (void)testCapsMethod STAssertEqualObjects(string, @"Test", @"Did not caps"); } +- (void)testABKeyboardTyping_test1 +{ + ABKeyboard *keyboard = [[ABKeyboard alloc] initWithDelegate:nil]; + ABBrailleReader *reader = keyboard.brailleReader; + UITextView *output = [UITextView new]; + [keyboard setOutput:output]; + + [reader processString:@"101100"]; + [reader processString:@"101111"]; + [reader processString:ABSpaceCharacter]; + [reader processString:@"111100"]; + [reader processString:@"110010"]; + [reader processString:@"000010"]; + [reader processString:@"101010"]; + [reader processString:ABSpaceCharacter]; + + STAssertEqualObjects(output.text, @"my phone", @"Did not type to output correctly"); +} + @end From 502ee94f7beaa83f1e7df0dc35a258c93f9728ea Mon Sep 17 00:00:00 2001 From: 7imbrook Date: Tue, 16 Jul 2013 11:25:48 -0400 Subject: [PATCH 09/19] Style cleanup --- AccessBraille/AccessBraille/ABBrailleReader.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/AccessBraille/AccessBraille/ABBrailleReader.m b/AccessBraille/AccessBraille/ABBrailleReader.m index 03f3813..f9b07c0 100644 --- a/AccessBraille/AccessBraille/ABBrailleReader.m +++ b/AccessBraille/AccessBraille/ABBrailleReader.m @@ -233,8 +233,8 @@ - (void)sendWord:(NSString *)string } [_fieldOutput insertText:@" "]; [_delegate characterTyped:@" " withInfo:@{ABGestureInfoStatus : @(YES), - ABSpaceTyped : @(YES), - ABBackspaceReceived : @(NO)}]; + ABSpaceTyped : @(YES), + ABBackspaceReceived : @(NO)}]; } @end From 6c88b99c57f84dd4848a730757cc676ab524eef5 Mon Sep 17 00:00:00 2001 From: 7imbrook Date: Tue, 16 Jul 2013 11:41:27 -0400 Subject: [PATCH 10/19] Added tests --- .xctool-args | 4 +++ .../AccessBraille.xcodeproj/project.pbxproj | 4 +-- .../AccessBrailleTests/AccessBrailleTests.m | 26 ++++++++++++++++++- 3 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 .xctool-args diff --git a/.xctool-args b/.xctool-args new file mode 100644 index 0000000..ed82971 --- /dev/null +++ b/.xctool-args @@ -0,0 +1,4 @@ +[ + "-project", "AccessBraille/AccessBraille.xcodeproj", + "-scheme", "AccessBraille" +] diff --git a/AccessBraille/AccessBraille.xcodeproj/project.pbxproj b/AccessBraille/AccessBraille.xcodeproj/project.pbxproj index 0678f66..13ac1c8 100644 --- a/AccessBraille/AccessBraille.xcodeproj/project.pbxproj +++ b/AccessBraille/AccessBraille.xcodeproj/project.pbxproj @@ -1061,7 +1061,7 @@ ); INFOPLIST_FILE = "ABKeyboard/ABKeyboard-Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Bundles"; - IPHONEOS_DEPLOYMENT_TARGET = 6.0; + IPHONEOS_DEPLOYMENT_TARGET = 6.1; LINK_WITH_STANDARD_LIBRARIES = NO; MACH_O_TYPE = mh_object; MACOSX_DEPLOYMENT_TARGET = 10.8; @@ -1104,7 +1104,7 @@ ); INFOPLIST_FILE = "ABKeyboard/ABKeyboard-Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Bundles"; - IPHONEOS_DEPLOYMENT_TARGET = 6.0; + IPHONEOS_DEPLOYMENT_TARGET = 6.1; LINK_WITH_STANDARD_LIBRARIES = NO; MACH_O_TYPE = mh_object; MACOSX_DEPLOYMENT_TARGET = 10.8; diff --git a/AccessBraille/AccessBrailleTests/AccessBrailleTests.m b/AccessBraille/AccessBrailleTests/AccessBrailleTests.m index 98452dd..8492a9e 100644 --- a/AccessBraille/AccessBrailleTests/AccessBrailleTests.m +++ b/AccessBraille/AccessBrailleTests/AccessBrailleTests.m @@ -197,7 +197,31 @@ - (void)testABKeyboardTyping_test1 [reader processString:@"101010"]; [reader processString:ABSpaceCharacter]; - STAssertEqualObjects(output.text, @"my phone", @"Did not type to output correctly"); + STAssertEqualObjects(output.text, @"my phone ", @"Did not type to output correctly"); +} + +- (void)testABKeyboardTyping_test2 +{ + ABKeyboard *keyboard = [[ABKeyboard alloc] initWithDelegate:nil]; + ABBrailleReader *reader = keyboard.brailleReader; + UITextView *output = [UITextView new]; + [keyboard setOutput:output]; + + [reader processString:@"101100"]; + [reader processString:@"101111"]; + [reader processString:ABSpaceCharacter]; + [reader processString:@"111100"]; + [reader processString:@"110010"]; + [reader processString:@"000010"]; + [reader processString:@"101010"]; + [reader processString:ABSpaceCharacter]; + [reader processString:ABBackspace]; + [reader processString:ABBackspace]; + [reader processString:ABBackspace]; + [reader processString:ABBackspace]; + + STAssertEqualObjects(output.text, @"my ph", @"Did not type to output correctly"); + } @end From f55f23d4391632d1b4dd10a7746314ff102dd222 Mon Sep 17 00:00:00 2001 From: 7imbrook Date: Tue, 16 Jul 2013 14:17:09 -0400 Subject: [PATCH 11/19] Moves methods to header --- AccessBraille/AccessBraille/UITextView+simpleadd.h | 1 + 1 file changed, 1 insertion(+) diff --git a/AccessBraille/AccessBraille/UITextView+simpleadd.h b/AccessBraille/AccessBraille/UITextView+simpleadd.h index a215aab..8102cea 100644 --- a/AccessBraille/AccessBraille/UITextView+simpleadd.h +++ b/AccessBraille/AccessBraille/UITextView+simpleadd.h @@ -11,5 +11,6 @@ @interface UITextView (simpleadd) - (void)replaceLastWordWithString:(NSString *)string; +- (NSArray *)arrayOfWordsFromSentence:(NSString *)sentence; @end From f68b558b8f12b16fb9ab016fd018ec68f9e6d304 Mon Sep 17 00:00:00 2001 From: 7imbrook Date: Tue, 16 Jul 2013 15:01:30 -0400 Subject: [PATCH 12/19] Updated ABReader to better handle parsing This does not full reimplement the typer --- AccessBraille/AccessBraille/ABBrailleReader.h | 4 +- AccessBraille/AccessBraille/ABBrailleReader.m | 134 ++++++++---------- 2 files changed, 58 insertions(+), 80 deletions(-) diff --git a/AccessBraille/AccessBraille/ABBrailleReader.h b/AccessBraille/AccessBraille/ABBrailleReader.h index aef77e0..014d726 100644 --- a/AccessBraille/AccessBraille/ABBrailleReader.h +++ b/AccessBraille/AccessBraille/ABBrailleReader.h @@ -22,10 +22,8 @@ static NSString *const ABPrefixLevelSeven = @"000110"; @interface ABBrailleReader : NSObject + (NSString *)brailleStringFromTouchIDs:(NSArray *)touchIDs; -- (void)characterReceived:(NSString *)brailleString; +- (NSString *)characterReceived:(NSString *)brailleString; - (id)initWithAudioTarget:(id)target selector:(SEL)selector; - -// Testing - (NSString *)processString:(NSString *)brailleString; @property (nonatomic) id delegate; diff --git a/AccessBraille/AccessBraille/ABBrailleReader.m b/AccessBraille/AccessBraille/ABBrailleReader.m index f9b07c0..0ba688f 100644 --- a/AccessBraille/AccessBraille/ABBrailleReader.m +++ b/AccessBraille/AccessBraille/ABBrailleReader.m @@ -97,11 +97,20 @@ + (NSString *)brailleStringFromTouchIDs:(NSArray *)touchIDs { /** * Receives character from touchLayer in form of braille string */ -- (void)characterReceived:(NSString *)brailleString +- (NSString *)characterReceived:(NSString *)brailleString { - [self sendCharacter:[self processString:brailleString]]; + NSString *returnChar = [self processString:brailleString]; + if ([returnChar isEqualToString:ABBackspace]) { + [self sendBackspace]; + } else if (![returnChar isEqualToString:nil]) { + [self sendCharacter:returnChar]; + } + return returnChar; } +/** + * Checks if a braille string is a prefix + */ + (BOOL)isValidPrefix:(NSString *)braille { return ([braille isEqualToString:ABPrefixLevelOne] || @@ -126,115 +135,86 @@ - (NSString *)processString:(NSString *)brailleString } // Intercept prefix operators - if ([ABBrailleReader isValidPrefix:prefix] && (_grade == ABGradeTwo) && ![brailleString isEqualToString:ABSpaceCharacter]) { + if ((_grade == ABGradeTwo) && [ABBrailleReader isValidPrefix:prefix] && ![brailleString isEqualToString:ABSpaceCharacter]) { // Handle prefix - NSString *postfix = @""; + NSString *postfixChar = @""; if ([prefix isEqualToString:ABPrefixNumber] && [[numberLookup allKeys] containsObject:brailleString]) { - postfix = numberLookup[brailleString]; + postfixChar = numberLookup[brailleString]; } else if ([prefix isEqualToString:ABPrefixLevelTwo] && [[prefixLevelTwo allKeys] containsObject:brailleString]) { - postfix = prefixLevelTwo[brailleString]; + postfixChar = prefixLevelTwo[brailleString]; } else if ([prefix isEqualToString:ABPrefixLevelThree] && [[prefixLevelThree allKeys] containsObject:brailleString]) { - postfix = prefixLevelThree[brailleString]; + postfixChar = prefixLevelThree[brailleString]; } else if ([prefix isEqualToString:ABPrefixLevelFour] && [[prefixLevelFour allKeys] containsObject:brailleString]) { - postfix = prefixLevelFour[brailleString]; + postfixChar = prefixLevelFour[brailleString]; } else if ([prefix isEqualToString:ABPrefixLevelFive] && [[prefixLevelFive allKeys] containsObject:brailleString]) { - postfix = prefixLevelFive[brailleString]; + postfixChar = prefixLevelFive[brailleString]; } else if ([prefix isEqualToString:ABPrefixLevelSix] && [[prefixLevelSix allKeys] containsObject:brailleString]) { - postfix = prefixLevelSix[brailleString]; + postfixChar = prefixLevelSix[brailleString]; } else if ([prefix isEqualToString:ABPrefixLevelSeven] && [[prefixLevelSeven allKeys] containsObject:brailleString]) { - postfix = prefixLevelSeven[brailleString]; + postfixChar = prefixLevelSeven[brailleString]; } - _wordTyping = [_wordTyping stringByAppendingString:postfix]; + _wordTyping = [_wordTyping stringByAppendingString:postfixChar]; if (![prefix isEqualToString:ABPrefixNumber]) { + // If prefix is not a number prefix, clear it prefix = @""; } - return postfix; + // return as a send char + return postfixChar; } else { prefix = brailleString; - if ([ABBrailleReader isValidPrefix:prefix] && (_grade == ABGradeTwo)) { - // return if a valid prefix is set - return @""; - } - // if space proccess last typed word if grade two + // return if a valid prefix is set because it's not a character. + if ([ABBrailleReader isValidPrefix:prefix]) + return nil; + + // if space proccess last typed word if grade two for shorthand lookup. if ([brailleString isEqualToString:ABSpaceCharacter]) { - switch (_grade) { - case ABGradeOne: - break; - case ABGradeTwo: - if ([[shortHandlookup allKeys] containsObject:_wordTyping]) { - _wordTyping = shortHandlookup[_wordTyping]; - } - break; + if (_grade == ABGradeTwo) { + if ([[shortHandlookup allKeys] containsObject:_wordTyping]) { + _wordTyping = shortHandlookup[_wordTyping]; + // Handle updating textview corrently + } } [self sendWord:_wordTyping]; prefix = @""; _wordTyping = @""; - return @""; + return nil; // return nil to not send character } // Is typed character - if (_grade == ABGradeOne && [grade2Lookup[brailleString] length] > 1) { - return @""; - } else { - if ([[grade2Lookup allKeys] containsObject:brailleString]) { - _wordTyping = [_wordTyping stringByAppendingString:grade2Lookup[brailleString]]; - return grade2Lookup[brailleString]; - } else { - return @""; + if ([[grade2Lookup allKeys] containsObject:brailleString]) { + NSString *lookup = grade2Lookup[brailleString]; + switch (_grade) { + case ABGradeOne: + if (lookup.length == 1) { // Grade one is only single char + _wordTyping = [_wordTyping stringByAppendingString:lookup]; + return lookup; + } + break; + case ABGradeTwo: + _wordTyping = [_wordTyping stringByAppendingString:lookup]; + return lookup; + break; } } } + return nil; } +#pragma mark Handle updating with infomation + - (void)sendCharacter:(NSString *)string { - if ([string isEqualToString:ABSpaceCharacter]) { - [_fieldOutput insertText:@" "]; - [_delegate characterTyped:@" " withInfo:@{ABGestureInfoStatus : @(YES), - ABSpaceTyped : @(YES), - ABBackspaceReceived : @(NO)}]; - - } else if ([string isEqualToString:ABBackspace]) { - [_fieldOutput deleteBackward]; - [_delegate characterTyped:@"" withInfo:@{ABGestureInfoStatus : @(YES), - ABSpaceTyped : @(NO), - ABBackspaceReceived : @(YES)}]; - [target performSelector:selector withObject:ABBackspaceSound]; - - } else if ([string isEqualToString:@""]) { - return; - } else { - - [speak speakString:string]; - - if(_layer.shift) { - string = [NSString stringWithFormat:@"%@%@", [[string substringToIndex:1] uppercaseString], [string substringFromIndex:1]]; - _layer.shift = NO; - [_layer setNeedsDisplay]; - } - if (_layer.caps) { - string = [string uppercaseString]; - } - - [_fieldOutput insertText:string]; - [_delegate characterTyped:string withInfo:@{ABGestureInfoStatus : @(YES), - ABSpaceTyped : @(NO), - ABBackspaceReceived : @(NO)}]; - } + } - (void)sendWord:(NSString *)string { - NSLog(@"Word Typed: %@", string); - [speak speakString:string]; - if (![string isEqualToString:ABSpaceCharacter] && ![_wordTyping isEqualToString:@""] && ![_wordTyping isEqualToString:@" "]) { - [_fieldOutput replaceLastWordWithString:string]; - } - [_fieldOutput insertText:@" "]; - [_delegate characterTyped:@" " withInfo:@{ABGestureInfoStatus : @(YES), - ABSpaceTyped : @(YES), - ABBackspaceReceived : @(NO)}]; + } +- (void)sendBackspace +{ + +} @end From bd0ec9353ee280722f6a230152b87a5e7ce03781 Mon Sep 17 00:00:00 2001 From: 7imbrook Date: Tue, 16 Jul 2013 15:02:23 -0400 Subject: [PATCH 13/19] Wrote test bro --- .../AccessBrailleTests/AccessBrailleTests.m | 203 +++++++++++------- 1 file changed, 123 insertions(+), 80 deletions(-) diff --git a/AccessBraille/AccessBrailleTests/AccessBrailleTests.m b/AccessBraille/AccessBrailleTests/AccessBrailleTests.m index 8492a9e..b55b3c4 100644 --- a/AccessBraille/AccessBrailleTests/AccessBrailleTests.m +++ b/AccessBraille/AccessBrailleTests/AccessBrailleTests.m @@ -71,26 +71,33 @@ - (void)testABReaderGrade1 { // Test Grade 1 [reader setGrade:ABGradeOne]; - STAssertEqualObjects(@"a", [reader processString:@"100000"], @"failed"); - STAssertEqualObjects(@"b", [reader processString:@"110000"], @"failed"); - STAssertEqualObjects(@"c", [reader processString:@"100100"], @"failed"); - STAssertEqualObjects(@"l", [reader processString:@"111000"], @"failed"); - STAssertEqualObjects(@"k", [reader processString:@"101000"], @"failed"); - STAssertEqualObjects(@"o", [reader processString:@"101010"], @"failed"); - STAssertEqualObjects(@"w", [reader processString:@"010111"], @"failed"); - STAssertEqualObjects(@"m", [reader processString:@"101100"], @"failed"); + STAssertEqualObjects(@"a", [reader characterReceived:@"100000"], @"failed"); + STAssertEqualObjects(@"b", [reader characterReceived:@"110000"], @"failed"); + STAssertEqualObjects(@"c", [reader characterReceived:@"100100"], @"failed"); + STAssertEqualObjects(@"l", [reader characterReceived:@"111000"], @"failed"); + STAssertEqualObjects(@"k", [reader characterReceived:@"101000"], @"failed"); + STAssertEqualObjects(@"o", [reader characterReceived:@"101010"], @"failed"); + STAssertEqualObjects(@"w", [reader characterReceived:@"010111"], @"failed"); + STAssertEqualObjects(@"m", [reader characterReceived:@"101100"], @"failed"); STAssertEqualObjects(@"abclkowm", reader.wordTyping, @"did not store word correctly"); - STAssertEqualObjects(@"", [reader processString:ABSpaceCharacter], @"Did not return space"); + STAssertEqualObjects(nil, [reader characterReceived:ABSpaceCharacter], @"Did not return space"); STAssertEqualObjects(@"", reader.wordTyping, @"did not store word correctly"); - + + reader = nil; +} + +- (void)testGradeTwoLookUpInGradeOne +{ + ABBrailleReader *reader = [ABBrailleReader new]; + [reader setGrade:ABGradeOne]; // Attempt grade two lookup - STAssertFalseNoThrow([@"and" isEqualToString:[reader processString:@"111101"]], @"and returned"); - STAssertFalseNoThrow([@"ch" isEqualToString:[reader processString:@"100001"]], @"and returned"); - + STAssertFalseNoThrow([@"and" isEqualToString:[reader characterReceived:@"111101"]], @"and returned"); + STAssertFalseNoThrow([@"ch" isEqualToString:[reader characterReceived:@"100001"]], @"and returned"); reader = nil; } -- (void)testABBrailleReaderGrade2 { +- (void)testABBrailleReaderGrade2_test1 +{ ABBrailleReader *reader = [ABBrailleReader new]; @@ -98,79 +105,99 @@ - (void)testABBrailleReaderGrade2 { [reader setGrade:ABGradeTwo]; // test none grade two lookups - STAssertEqualObjects(@"a", [reader processString:@"100000"], @"failed"); - STAssertEqualObjects(@"b", [reader processString:@"110000"], @"failed"); - STAssertEqualObjects(@"c", [reader processString:@"100100"], @"failed"); - STAssertEqualObjects(@"l", [reader processString:@"111000"], @"failed"); - STAssertEqualObjects(@"k", [reader processString:@"101000"], @"failed"); - STAssertEqualObjects(@"o", [reader processString:@"101010"], @"failed"); - STAssertEqualObjects(@"w", [reader processString:@"010111"], @"failed"); - STAssertEqualObjects(@"m", [reader processString:@"101100"], @"failed"); + STAssertEqualObjects(@"a", [reader characterReceived:@"100000"], @"failed"); + STAssertEqualObjects(@"b", [reader characterReceived:@"110000"], @"failed"); + STAssertEqualObjects(@"c", [reader characterReceived:@"100100"], @"failed"); + STAssertEqualObjects(@"l", [reader characterReceived:@"111000"], @"failed"); + STAssertEqualObjects(@"k", [reader characterReceived:@"101000"], @"failed"); + STAssertEqualObjects(@"o", [reader characterReceived:@"101010"], @"failed"); + STAssertEqualObjects(@"w", [reader characterReceived:@"010111"], @"failed"); + STAssertEqualObjects(@"m", [reader characterReceived:@"101100"], @"failed"); STAssertEqualObjects(@"abclkowm", reader.wordTyping, @"did not store word correctly"); - STAssertEqualObjects(@"", [reader processString:ABSpaceCharacter], @"Did not return space"); + STAssertEqualObjects(nil, [reader characterReceived:ABSpaceCharacter], @"Did not return space"); STAssertEqualObjects(@"", reader.wordTyping, @"did not store word correctly"); + reader = nil; +} + +- (void)testABBrailleReaderGrade2_test2 +{ + ABBrailleReader *reader = [ABBrailleReader new]; // Grade two lookups no options - STAssertEqualObjects(@"and", [reader processString:@"111101"], @"failed"); - STAssertEqualObjects(@"for", [reader processString:@"111111"], @"failed"); - STAssertEqualObjects(@"with", [reader processString:@"011111"], @"failed"); - [reader processString:ABSpaceCharacter]; + STAssertEqualObjects(@"and", [reader characterReceived:@"111101"], @"failed"); + STAssertEqualObjects(@"for", [reader characterReceived:@"111111"], @"failed"); + STAssertEqualObjects(@"with", [reader characterReceived:@"011111"], @"failed"); + [reader characterReceived:ABSpaceCharacter]; STAssertEqualObjects(@"", reader.wordTyping, @"work not cleared"); - + reader = nil; +} + +- (void)testABBrailleReaderGrade2_test3 +{ + ABBrailleReader *reader = [ABBrailleReader new]; // Grade two prefix tests // Test level two lookups // Type phone - [reader processString:@"111100"]; - [reader processString:@"110010"]; - [reader processString:@"000010"]; - [reader processString:@"101010"]; + [reader characterReceived:@"111100"]; + [reader characterReceived:@"110010"]; + [reader characterReceived:@"000010"]; + [reader characterReceived:@"101010"]; STAssertEqualObjects(reader.wordTyping, @"phone", @"failed to type phone"); - [reader processString:ABSpaceCharacter]; - + [reader characterReceived:ABSpaceCharacter]; + reader = nil; +} +- (void)testABBrailleReaderGrade2_test4 +{ + ABBrailleReader *reader = [ABBrailleReader new]; // Test numbers - [reader processString:@"001111"]; - [reader processString:@"100000"]; - [reader processString:@"010110"]; - [reader processString:@"100000"]; - [reader processString:@"100010"]; + [reader characterReceived:@"001111"]; + [reader characterReceived:@"100000"]; + [reader characterReceived:@"010110"]; + [reader characterReceived:@"100000"]; + [reader characterReceived:@"100010"]; STAssertEqualObjects(reader.wordTyping, @"1015", @"failed to handle numbers"); - [reader processString:ABSpaceCharacter]; - + [reader characterReceived:ABSpaceCharacter]; + reader = nil; +} +- (void)testABBrailleReaderGrade2_test5 +{ + ABBrailleReader *reader = [ABBrailleReader new]; // test level three lookup // type manyhadspirit - [reader processString:@"000111"]; - [reader processString:@"101100"]; - [reader processString:@"000111"]; - [reader processString:@"110010"]; - [reader processString:@"000111"]; - [reader processString:@"011100"]; + [reader characterReceived:@"000111"]; + [reader characterReceived:@"101100"]; + [reader characterReceived:@"000111"]; + [reader characterReceived:@"110010"]; + [reader characterReceived:@"000111"]; + [reader characterReceived:@"011100"]; STAssertEqualObjects(reader.wordTyping, @"manyhadspirit", @"failed to type manyhadspirt"); - [reader processString:ABSpaceCharacter]; - + [reader characterReceived:ABSpaceCharacter]; + reader = nil; +} +- (void)testABBrailleReaderGrade2_test6 +{ + ABBrailleReader *reader = [ABBrailleReader new]; // level four // count - [reader processString:@"100100"]; - [reader processString:@"000101"]; - [reader processString:@"011110"]; + [reader characterReceived:@"100100"]; + [reader characterReceived:@"000101"]; + [reader characterReceived:@"011110"]; STAssertEqualObjects(reader.wordTyping, @"count", @"failed to type count"); - [reader processString:ABSpaceCharacter]; - + [reader characterReceived:ABSpaceCharacter]; reader = nil; } -- (void)testABBrailleReaderGrade2_test2 +- (void)testABBrailleReaderGrade2_test7 { ABBrailleReader *reader = [ABBrailleReader new]; - // Prefix followed by non recongnized post - [reader processString:@"000010"]; - [reader processString:@"100000"]; + [reader characterReceived:@"000010"]; + [reader characterReceived:@"100000"]; // Check should have typed nothing STAssertEqualObjects(reader.wordTyping, @"", @"Char was typed that shouldn't have"); - [reader processString:@"100000"]; + [reader characterReceived:@"100000"]; // An A should have been typed STAssertEqualObjects(reader.wordTyping, @"a", @"An A should have been typed"); - reader = nil; } @@ -188,14 +215,14 @@ - (void)testABKeyboardTyping_test1 UITextView *output = [UITextView new]; [keyboard setOutput:output]; - [reader processString:@"101100"]; - [reader processString:@"101111"]; - [reader processString:ABSpaceCharacter]; - [reader processString:@"111100"]; - [reader processString:@"110010"]; - [reader processString:@"000010"]; - [reader processString:@"101010"]; - [reader processString:ABSpaceCharacter]; + [reader characterReceived:@"101100"]; + [reader characterReceived:@"101111"]; + [reader characterReceived:ABSpaceCharacter]; + [reader characterReceived:@"111100"]; + [reader characterReceived:@"110010"]; + [reader characterReceived:@"000010"]; + [reader characterReceived:@"101010"]; + [reader characterReceived:ABSpaceCharacter]; STAssertEqualObjects(output.text, @"my phone ", @"Did not type to output correctly"); } @@ -207,21 +234,37 @@ - (void)testABKeyboardTyping_test2 UITextView *output = [UITextView new]; [keyboard setOutput:output]; - [reader processString:@"101100"]; - [reader processString:@"101111"]; - [reader processString:ABSpaceCharacter]; - [reader processString:@"111100"]; - [reader processString:@"110010"]; - [reader processString:@"000010"]; - [reader processString:@"101010"]; - [reader processString:ABSpaceCharacter]; - [reader processString:ABBackspace]; - [reader processString:ABBackspace]; - [reader processString:ABBackspace]; - [reader processString:ABBackspace]; + [reader characterReceived:@"101100"]; + [reader characterReceived:@"101111"]; + [reader characterReceived:ABSpaceCharacter]; + [reader characterReceived:@"111100"]; + [reader characterReceived:@"110010"]; + [reader characterReceived:@"000010"]; + [reader characterReceived:@"101010"]; + [reader characterReceived:ABSpaceCharacter]; + [reader characterReceived:ABBackspace]; + [reader characterReceived:ABBackspace]; + [reader characterReceived:ABBackspace]; + [reader characterReceived:ABBackspace]; STAssertEqualObjects(output.text, @"my ph", @"Did not type to output correctly"); } +- (void)testABKeyboardTyping_test3 +{ + ABKeyboard *keyboard = [[ABKeyboard alloc] initWithDelegate:nil]; + ABBrailleReader *reader = keyboard.brailleReader; + UITextView *output = [UITextView new]; + [keyboard setOutput:output]; + + reader.layer.shift = YES; + [reader characterReceived:@"101100"]; + [reader characterReceived:@"101111"]; + [reader characterReceived:ABSpaceCharacter]; + + STAssertEqualObjects(output.text, @"My ", @"Did not type to output correctly"); + +} + @end From 2d28dbd340759d87ae8d72bb2db838ea518ce9f6 Mon Sep 17 00:00:00 2001 From: 7imbrook Date: Tue, 16 Jul 2013 16:30:01 -0400 Subject: [PATCH 14/19] Updates _fieldOutput --- AccessBraille/AccessBraille/ABBrailleReader.m | 60 +++++++++++++++++-- 1 file changed, 56 insertions(+), 4 deletions(-) diff --git a/AccessBraille/AccessBraille/ABBrailleReader.m b/AccessBraille/AccessBraille/ABBrailleReader.m index 0ba688f..dad103b 100644 --- a/AccessBraille/AccessBraille/ABBrailleReader.m +++ b/AccessBraille/AccessBraille/ABBrailleReader.m @@ -9,6 +9,7 @@ #import "ABBrailleReader.h" #import "ABKeyboard.h" #import "ABSpeak.h" +#import "ABParser.h" #import "UITextView+simpleadd.h" @implementation ABBrailleReader { @@ -98,11 +99,11 @@ + (NSString *)brailleStringFromTouchIDs:(NSArray *)touchIDs { * Receives character from touchLayer in form of braille string */ - (NSString *)characterReceived:(NSString *)brailleString -{ +{ NSString *returnChar = [self processString:brailleString]; if ([returnChar isEqualToString:ABBackspace]) { [self sendBackspace]; - } else if (![returnChar isEqualToString:nil]) { + } else if (returnChar) { [self sendCharacter:returnChar]; } return returnChar; @@ -205,16 +206,67 @@ - (NSString *)processString:(NSString *)brailleString - (void)sendCharacter:(NSString *)string { - + // Update _fieldOutput + + if (_fieldOutput) + _fieldOutput.text = [_fieldOutput.text stringByAppendingString:string]; + + // Return char to delegate + [self respondToDelegateWithInfo:@{ABGestureInfoStatus : @(YES), + ABSpaceTyped : @(NO), + ABBackspaceReceived : @(NO)} + wordTyped:NO + string:string]; } - (void)sendWord:(NSString *)string { - + // Update _fieldOutput + + if (_fieldOutput) { + NSArray *words = [ABParser arrayOfWordsFromSentence:_fieldOutput.text]; + NSString *newSent = @""; + for (int i = 0; i < words.count - 1; i++) { + newSent = [newSent stringByAppendingString:words[i]]; + newSent = [newSent stringByAppendingString:@" "]; + } + _fieldOutput.text = [newSent stringByAppendingString:string]; + [_fieldOutput insertText:@" "]; + } + // Return word to delegate + [self respondToDelegateWithInfo:@{ABGestureInfoStatus : @(YES), + ABSpaceTyped : @(YES), + ABBackspaceReceived : @(NO)} + wordTyped:NO + string:ABSpaceCharacter]; + [self respondToDelegateWithInfo:@{ABGestureInfoStatus : @(YES), + ABSpaceTyped : @(NO), + ABBackspaceReceived : @(NO)} + wordTyped:YES + string:string]; } - (void)sendBackspace { + // Update _fieldOutput + + if (_fieldOutput && _fieldOutput.text.length > 0) + _fieldOutput.text = [_fieldOutput.text substringWithRange:NSMakeRange(0, _fieldOutput.text.length - 1)]; + // Return backspace to delegate + [self respondToDelegateWithInfo:@{ABGestureInfoStatus : @(YES), + ABSpaceTyped : @(NO), + ABBackspaceReceived : @(YES)} + wordTyped:NO + string:ABBackspace]; +} + +- (void)respondToDelegateWithInfo:(NSDictionary *)info wordTyped:(BOOL)word string:(NSString *)string +{ + if (!word && [_delegate respondsToSelector:@selector(characterTyped:withInfo:)]) { + [_delegate characterTyped:string withInfo:info]; + } else if (word && [_delegate respondsToSelector:@selector(wordTyped:withInfo:)]) { + [_delegate wordTyped:string withInfo:info]; + } } @end From 9e32950bd32ef45227bb484bde6283a989b9bd34 Mon Sep 17 00:00:00 2001 From: 7imbrook Date: Tue, 16 Jul 2013 16:40:51 -0400 Subject: [PATCH 15/19] Fixed #151, Fixed #154 --- AccessBraille/AccessBraille/ABBrailleReader.m | 18 ++++++++++++++++++ .../AccessBrailleTests/AccessBrailleTests.m | 16 ---------------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/AccessBraille/AccessBraille/ABBrailleReader.m b/AccessBraille/AccessBraille/ABBrailleReader.m index dad103b..e624549 100644 --- a/AccessBraille/AccessBraille/ABBrailleReader.m +++ b/AccessBraille/AccessBraille/ABBrailleReader.m @@ -188,11 +188,29 @@ - (NSString *)processString:(NSString *)brailleString switch (_grade) { case ABGradeOne: if (lookup.length == 1) { // Grade one is only single char + // Check shift/caps + if(_layer.shift) { + lookup = [lookup uppercaseString]; + _layer.shift = NO; + [_layer setNeedsDisplay]; + } + if (_layer.caps) { + lookup = [lookup uppercaseString]; + } _wordTyping = [_wordTyping stringByAppendingString:lookup]; return lookup; } break; case ABGradeTwo: + // Check shift/caps + if(_layer.shift) { + lookup = [NSString stringWithFormat:@"%@%@", [[lookup substringToIndex:1] uppercaseString], [lookup substringFromIndex:1]];; + _layer.shift = NO; + [_layer setNeedsDisplay]; + } + if (_layer.caps) { + lookup = [lookup uppercaseString]; + } _wordTyping = [_wordTyping stringByAppendingString:lookup]; return lookup; break; diff --git a/AccessBraille/AccessBrailleTests/AccessBrailleTests.m b/AccessBraille/AccessBrailleTests/AccessBrailleTests.m index b55b3c4..227d0f8 100644 --- a/AccessBraille/AccessBrailleTests/AccessBrailleTests.m +++ b/AccessBraille/AccessBrailleTests/AccessBrailleTests.m @@ -251,20 +251,4 @@ - (void)testABKeyboardTyping_test2 } -- (void)testABKeyboardTyping_test3 -{ - ABKeyboard *keyboard = [[ABKeyboard alloc] initWithDelegate:nil]; - ABBrailleReader *reader = keyboard.brailleReader; - UITextView *output = [UITextView new]; - [keyboard setOutput:output]; - - reader.layer.shift = YES; - [reader characterReceived:@"101100"]; - [reader characterReceived:@"101111"]; - [reader characterReceived:ABSpaceCharacter]; - - STAssertEqualObjects(output.text, @"My ", @"Did not type to output correctly"); - -} - @end From 682406ff0b5d55697128f0dcc60be9bfbe76e572 Mon Sep 17 00:00:00 2001 From: 7imbrook Date: Tue, 16 Jul 2013 16:53:20 -0400 Subject: [PATCH 16/19] Removed submods --- .gitmodules | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 .gitmodules diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index f0289be..0000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "RAC"] - path = RAC - url = https://github.com/ReactiveCocoa/ReactiveCocoa.git From 57b31ef44844b1c2cf22e0430f8ec68180819804 Mon Sep 17 00:00:00 2001 From: 7imbrook Date: Wed, 17 Jul 2013 08:11:59 -0400 Subject: [PATCH 17/19] Using sharedInstance in ABKeyboard for ABSpeak --- AccessBraille/AccessBraille/ABKeyboard.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AccessBraille/AccessBraille/ABKeyboard.m b/AccessBraille/AccessBraille/ABKeyboard.m index 59e7c15..454c052 100644 --- a/AccessBraille/AccessBraille/ABKeyboard.m +++ b/AccessBraille/AccessBraille/ABKeyboard.m @@ -57,7 +57,7 @@ - (id)init disabledURL = [[NSBundle mainBundle] URLForResource:@"disableKeyboard" withExtension:@"aiff"]; backspaceURL = [[NSBundle mainBundle] URLForResource:@"backspace" withExtension:@"aiff"]; - speak = [ABSpeak new]; + speak = [ABSpeak sharedInstance]; } return self; } From 3d7ab6bf32ca3a03e16169504431fc55d1ff8a12 Mon Sep 17 00:00:00 2001 From: 7imbrook Date: Wed, 17 Jul 2013 08:15:54 -0400 Subject: [PATCH 18/19] Re added speaking, close #169 --- AccessBraille/AccessBraille/ABBrailleReader.m | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/AccessBraille/AccessBraille/ABBrailleReader.m b/AccessBraille/AccessBraille/ABBrailleReader.m index e624549..2b483b4 100644 --- a/AccessBraille/AccessBraille/ABBrailleReader.m +++ b/AccessBraille/AccessBraille/ABBrailleReader.m @@ -71,7 +71,7 @@ - (id)initWithAudioTarget:(id)tar selector:(SEL)sel { // Audio target = tar; selector = sel; - speak = [[ABSpeak alloc] init]; + speak = [ABSpeak sharedInstance]; } return self; } @@ -224,8 +224,10 @@ - (NSString *)processString:(NSString *)brailleString - (void)sendCharacter:(NSString *)string { - // Update _fieldOutput + // Speak + [speak speakString:string]; + // Update _fieldOutput if (_fieldOutput) _fieldOutput.text = [_fieldOutput.text stringByAppendingString:string]; @@ -239,8 +241,10 @@ - (void)sendCharacter:(NSString *)string - (void)sendWord:(NSString *)string { - // Update _fieldOutput + // Speak + [speak speakString:string]; + // Update _fieldOutput if (_fieldOutput) { NSArray *words = [ABParser arrayOfWordsFromSentence:_fieldOutput.text]; NSString *newSent = @""; From e97aeedbb03a759d9455a8dc33b531b745514c72 Mon Sep 17 00:00:00 2001 From: 7imbrook Date: Wed, 17 Jul 2013 08:16:29 -0400 Subject: [PATCH 19/19] Added backspace sound --- AccessBraille/AccessBraille/ABBrailleReader.m | 3 +++ 1 file changed, 3 insertions(+) diff --git a/AccessBraille/AccessBraille/ABBrailleReader.m b/AccessBraille/AccessBraille/ABBrailleReader.m index 2b483b4..103308b 100644 --- a/AccessBraille/AccessBraille/ABBrailleReader.m +++ b/AccessBraille/AccessBraille/ABBrailleReader.m @@ -281,6 +281,9 @@ - (void)sendBackspace ABBackspaceReceived : @(YES)} wordTyped:NO string:ABBackspace]; + + // Backspace sound + [target performSelector:selector withObject:ABBackspaceSound]; } - (void)respondToDelegateWithInfo:(NSDictionary *)info wordTyped:(BOOL)word string:(NSString *)string