From 2289b01f7c2f3900a45d5596ff9d787cda2ef260 Mon Sep 17 00:00:00 2001 From: Shannon Young Date: Tue, 5 Jul 2016 10:26:55 -0700 Subject: [PATCH] Modified method signature for bilateral tapping task and updated ORKTest and ORKCatalog --- ResearchKit/Common/ORKOrderedTask.h | 4 ++-- ResearchKit/Common/ORKOrderedTask.m | 11 +++++----- ResearchKitTests/ORKTaskTests.m | 20 +++++++++---------- Testing/ORKTest/ORKTest/MainViewController.m | 1 + .../ORKCatalog/Tasks/TaskListRow.swift | 2 +- 5 files changed, 20 insertions(+), 18 deletions(-) diff --git a/ResearchKit/Common/ORKOrderedTask.h b/ResearchKit/Common/ORKOrderedTask.h index 53a25ae5..f486c019 100644 --- a/ResearchKit/Common/ORKOrderedTask.h +++ b/ResearchKit/Common/ORKOrderedTask.h @@ -363,8 +363,8 @@ typedef NS_OPTIONS(NSUInteger, ORKPredefinedTaskHandOption) { + (ORKOrderedTask *)twoFingerTappingIntervalTaskWithIdentifier:(NSString *)identifier intendedUseDescription:(nullable NSString *)intendedUseDescription duration:(NSTimeInterval)duration - options:(ORKPredefinedTaskOption)options - handOptions:(ORKPredefinedTaskHandOption)handOptions; + handOptions:(ORKPredefinedTaskHandOption)handOptions + options:(ORKPredefinedTaskOption)options; /** @Deprecated */ diff --git a/ResearchKit/Common/ORKOrderedTask.m b/ResearchKit/Common/ORKOrderedTask.m index b8d3b65c..b95394a4 100644 --- a/ResearchKit/Common/ORKOrderedTask.m +++ b/ResearchKit/Common/ORKOrderedTask.m @@ -2,6 +2,8 @@ Copyright (c) 2015, Apple Inc. All rights reserved. Copyright (c) 2016, Sage Bionetworks - Added walk back and forth module + Copyright (c) 2016, Sage Bionetworks - Modified two finger tapping to track tapping speed for both hands + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -339,17 +341,16 @@ void ORKStepArrayAddStep(NSMutableArray *array, ORKStep *step) { return [self twoFingerTappingIntervalTaskWithIdentifier:identifier intendedUseDescription:intendedUseDescription duration:duration - options:options - handOptions:ORKPredefinedTaskHandOptionUndefined]; + handOptions:ORKPredefinedTaskHandOptionUndefined + options:options]; } -/// Copyright (c) 2016, Sage Bionetworks - Modified to track tapping speed for both hands + (ORKOrderedTask *)twoFingerTappingIntervalTaskWithIdentifier:(NSString *)identifier intendedUseDescription:(NSString *)intendedUseDescription duration:(NSTimeInterval)duration - options:(ORKPredefinedTaskOption)options handOptions:(ORKPredefinedTaskHandOption)handOptions -{ + options:(ORKPredefinedTaskOption)options { + NSString *durationString = [ORKDurationStringFormatter() stringFromTimeInterval:duration]; NSMutableArray *steps = [NSMutableArray array]; diff --git a/ResearchKitTests/ORKTaskTests.m b/ResearchKitTests/ORKTaskTests.m index f511b802..08774675 100644 --- a/ResearchKitTests/ORKTaskTests.m +++ b/ResearchKitTests/ORKTaskTests.m @@ -1353,7 +1353,7 @@ static ORKStepResult *(^getStepResult)(NSString *, Class, ORKQuestionType, id) = - (void)testStepViewControllerWillDisappear { TestTaskViewControllerDelegate *delegate = [[TestTaskViewControllerDelegate alloc] init]; - ORKOrderedTask *task = [ORKOrderedTask twoFingerTappingIntervalTaskWithIdentifier:@"test" intendedUseDescription:nil duration:30 options:0 handOptions:0]; + ORKOrderedTask *task = [ORKOrderedTask twoFingerTappingIntervalTaskWithIdentifier:@"test" intendedUseDescription:nil duration:30 handOptions:0 options:0]; ORKTaskViewController *taskViewController = [[MockTaskViewController alloc] initWithTask:task taskRunUUID:nil]; taskViewController.delegate = delegate; ORKInstructionStepViewController *stepViewController = [[ORKInstructionStepViewController alloc] initWithStep:task.steps.firstObject]; @@ -1370,7 +1370,7 @@ static ORKStepResult *(^getStepResult)(NSString *, Class, ORKQuestionType, id) = } - (void)testIndexOfStep { - ORKOrderedTask *task = [ORKOrderedTask twoFingerTappingIntervalTaskWithIdentifier:@"tapping" intendedUseDescription:nil duration:30 options:0 handOptions:0]; + ORKOrderedTask *task = [ORKOrderedTask twoFingerTappingIntervalTaskWithIdentifier:@"tapping" intendedUseDescription:nil duration:30 handOptions:0 options:0]; // get the first step ORKStep *step0 = [task.steps firstObject]; @@ -1479,8 +1479,8 @@ static ORKStepResult *(^getStepResult)(NSString *, Class, ORKQuestionType, id) = ORKOrderedTask *task = [ORKOrderedTask twoFingerTappingIntervalTaskWithIdentifier:@"test" intendedUseDescription:nil duration:10 - options:0 - handOptions:0]; + handOptions:0 + options:0]; NSArray *expectedStepIdentifiers = @[ORKInstruction0StepIdentifier, ORKInstruction1StepIdentifier, ORKTappingStepIdentifier, @@ -1499,8 +1499,8 @@ static ORKStepResult *(^getStepResult)(NSString *, Class, ORKQuestionType, id) = ORKOrderedTask *task = [ORKOrderedTask twoFingerTappingIntervalTaskWithIdentifier:@"test" intendedUseDescription:nil duration:10 - options:0 - handOptions:ORKPredefinedTaskHandOptionLeft]; + handOptions:ORKPredefinedTaskHandOptionLeft + options:0]; // Check assumption around how many steps XCTAssertEqual(task.steps.count, 4); @@ -1538,8 +1538,8 @@ static ORKStepResult *(^getStepResult)(NSString *, Class, ORKQuestionType, id) = ORKOrderedTask *task = [ORKOrderedTask twoFingerTappingIntervalTaskWithIdentifier:@"test" intendedUseDescription:nil duration:10 - options:0 - handOptions:ORKPredefinedTaskHandOptionRight]; + handOptions:ORKPredefinedTaskHandOptionRight + options:0]; // Check assumption around how many steps XCTAssertEqual(task.steps.count, 4); @@ -1586,8 +1586,8 @@ static ORKStepResult *(^getStepResult)(NSString *, Class, ORKQuestionType, id) = ORKOrderedTask *task = [ORKOrderedTask twoFingerTappingIntervalTaskWithIdentifier:@"test" intendedUseDescription:nil duration:10 - options:0 - handOptions:ORKPredefinedTaskHandOptionBoth]; + handOptions:ORKPredefinedTaskHandOptionBoth + options:0]; ORKStep * (^filteredSteps)(NSString*, NSString*) = ^(NSString *part1, NSString *part2) { NSString *keyValue = [NSString stringWithFormat:@"%@.%@", part1, part2]; NSPredicate *predicate = [NSPredicate predicateWithFormat:@"%K == %@", NSStringFromSelector(@selector(identifier)), keyValue]; diff --git a/Testing/ORKTest/ORKTest/MainViewController.m b/Testing/ORKTest/ORKTest/MainViewController.m index 42e8f751..c43416ba 100644 --- a/Testing/ORKTest/ORKTest/MainViewController.m +++ b/Testing/ORKTest/ORKTest/MainViewController.m @@ -522,6 +522,7 @@ static const CGFloat HeaderSideLayoutMargin = 16.0; return [ORKOrderedTask twoFingerTappingIntervalTaskWithIdentifier:TwoFingerTapTaskIdentifier intendedUseDescription:nil duration:20.0 + handOptions:ORKPredefinedTaskHandOptionBoth options:(ORKPredefinedTaskOption)0]; } else if ([identifier isEqualToString:ReactionTimeTaskIdentifier]) { return [ORKOrderedTask reactionTimeTaskWithIdentifier:ReactionTimeTaskIdentifier diff --git a/samples/ORKCatalog/ORKCatalog/Tasks/TaskListRow.swift b/samples/ORKCatalog/ORKCatalog/Tasks/TaskListRow.swift index 5410889c..ad9d73a2 100644 --- a/samples/ORKCatalog/ORKCatalog/Tasks/TaskListRow.swift +++ b/samples/ORKCatalog/ORKCatalog/Tasks/TaskListRow.swift @@ -1181,7 +1181,7 @@ enum TaskListRow: Int, CustomStringConvertible { /// This task presents the Two Finger Tapping pre-defined active task. private var twoFingerTappingIntervalTask: ORKTask { - return ORKOrderedTask.twoFingerTappingIntervalTaskWithIdentifier(String(Identifier.TwoFingerTappingIntervalTask), intendedUseDescription: exampleDescription, duration: 10, options: [], handOptions: [.Both]) + return ORKOrderedTask.twoFingerTappingIntervalTaskWithIdentifier(String(Identifier.TwoFingerTappingIntervalTask), intendedUseDescription: exampleDescription, duration: 10, handOptions: [.Both], options: []) } /// This task presents a walk back-and-forth task