diff --git a/ResearchKit/Common/ORKOrderedTask.h b/ResearchKit/Common/ORKOrderedTask.h index 859ac5e6..9daebc9c 100644 --- a/ResearchKit/Common/ORKOrderedTask.h +++ b/ResearchKit/Common/ORKOrderedTask.h @@ -451,13 +451,15 @@ typedef NS_OPTIONS(NSUInteger, ORKPredefinedTaskOption) { Data collected by the task is in the form of an `ORKTimedWalkResult` object. - @param identifier The task identifier to use for this task, appropriate to the study. - @param intendedUseDescription A localized string describing the intended use of the data - collected. If the value of this parameter is `nil`, the default - localized text is displayed. - @param distanceInMeters The timed walk distance in meters. - @param timeLimit The time limit to complete the trials. - @param options Options that affect the features of the predefined task. + @param identifier The task identifier to use for this task, appropriate to the study. + @param intendedUseDescription A localized string describing the intended use of the data + collected. If the value of this parameter is `nil`, the default + localized text is displayed. + @param distanceInMeters The timed walk distance in meters. + @param timeLimit The time limit to complete the trials. + @param includeAssistiveDeviceForm A Boolean value that indicates whether to inlude the form step + about the usage of an assistive device. + @param options Options that affect the features of the predefined task. @return An active timed walk task that can be presented with an `ORKTaskViewController` object. */ @@ -465,6 +467,7 @@ typedef NS_OPTIONS(NSUInteger, ORKPredefinedTaskOption) { intendedUseDescription:(nullable NSString *)intendedUseDescription distanceInMeters:(double)distanceInMeters timeLimit:(NSTimeInterval)timeLimit + includeAssistiveDeviceForm:(BOOL)includeAssistiveDeviceForm options:(ORKPredefinedTaskOption)options; /** diff --git a/ResearchKit/Common/ORKOrderedTask.m b/ResearchKit/Common/ORKOrderedTask.m index 8b78a2a0..40e9d9d1 100644 --- a/ResearchKit/Common/ORKOrderedTask.m +++ b/ResearchKit/Common/ORKOrderedTask.m @@ -992,6 +992,7 @@ void ORKStepArrayAddStep(NSMutableArray *array, ORKStep *step) { intendedUseDescription:(nullable NSString *)intendedUseDescription distanceInMeters:(double)distanceInMeters timeLimit:(NSTimeInterval)timeLimit + includeAssistiveDeviceForm:(BOOL)includeAssistiveDeviceForm options:(ORKPredefinedTaskOption)options { NSMutableArray *steps = [NSMutableArray array]; @@ -1013,7 +1014,7 @@ void ORKStepArrayAddStep(NSMutableArray *array, ORKStep *step) { } } - { + if (includeAssistiveDeviceForm) { ORKFormStep *step = [[ORKFormStep alloc] initWithIdentifier:ORKTimedWalkFormStepIdentifier title:ORKLocalizedString(@"TIMED_WALK_FORM_TITLE", nil) text:ORKLocalizedString(@"TIMED_WALK_FORM_TEXT", nil)]; @@ -1022,6 +1023,7 @@ void ORKStepArrayAddStep(NSMutableArray *array, ORKStep *step) { ORKFormItem *formItem1 = [[ORKFormItem alloc] initWithIdentifier:ORKTimedWalkFormAFOStepIdentifier text:ORKLocalizedString(@"TIMED_WALK_QUESTION_TEXT", nil) answerFormat:answerFormat1]; + formItem1.optional = NO; NSArray *textChoices = @[ORKLocalizedString(@"TIMED_WALK_QUESTION_2_CHOICE", nil), ORKLocalizedString(@"TIMED_WALK_QUESTION_2_CHOICE_2", nil), @@ -1034,6 +1036,8 @@ void ORKStepArrayAddStep(NSMutableArray *array, ORKStep *step) { text:ORKLocalizedString(@"TIMED_WALK_QUESTION_2_TITLE", nil) answerFormat:answerFormat2]; formItem2.placeholder = ORKLocalizedString(@"TIMED_WALK_QUESTION_2_TEXT", nil); + formItem2.optional = NO; + step.formItems = @[formItem1, formItem2]; step.optional = NO; diff --git a/Testing/ORKTest/ORKTest/MainViewController.m b/Testing/ORKTest/ORKTest/MainViewController.m index 575ba687..0925e817 100644 --- a/Testing/ORKTest/ORKTest/MainViewController.m +++ b/Testing/ORKTest/ORKTest/MainViewController.m @@ -540,6 +540,7 @@ static const CGFloat HeaderSideLayoutMargin = 16.0; intendedUseDescription:nil distanceInMeters:100 timeLimit:180 + includeAssistiveDeviceForm:YES options:ORKPredefinedTaskOptionNone]; } else if ([identifier isEqualToString:HolePegTestTaskIdentifier]) { return [ORKNavigableOrderedTask holePegTestTaskWithIdentifier:HolePegTestTaskIdentifier diff --git a/samples/ORKCatalog/ORKCatalog/TaskListRow.swift b/samples/ORKCatalog/ORKCatalog/TaskListRow.swift index e12a0072..a9b24c25 100644 --- a/samples/ORKCatalog/ORKCatalog/TaskListRow.swift +++ b/samples/ORKCatalog/ORKCatalog/TaskListRow.swift @@ -646,7 +646,7 @@ enum TaskListRow: Int, Printable { /// This task presents the Timed Walk pre-defined active task. private var timedWalkTask: ORKTask { - return ORKOrderedTask.timedWalkTaskWithIdentifier(String(Identifier.TimedWalkTask), intendedUseDescription: exampleDescription, distanceInMeters: 100.0, timeLimit: 180.0, options: []) + return ORKOrderedTask.timedWalkTaskWithIdentifier(String(Identifier.TimedWalkTask), intendedUseDescription: exampleDescription, distanceInMeters: 100.0, timeLimit: 180.0, includeAssistiveDeviceForm: true, options: []) } /// This task presents the Hole Peg Test pre-defined active task. diff --git a/samples/ORKCatalog/ORKCatalog/Tasks/TaskListRow.swift b/samples/ORKCatalog/ORKCatalog/Tasks/TaskListRow.swift index 4ca58b49..d929790c 100644 --- a/samples/ORKCatalog/ORKCatalog/Tasks/TaskListRow.swift +++ b/samples/ORKCatalog/ORKCatalog/Tasks/TaskListRow.swift @@ -1157,7 +1157,7 @@ enum TaskListRow: Int, CustomStringConvertible { /// This task presents the Timed Walk pre-defined active task. private var timedWalkTask: ORKTask { - return ORKOrderedTask.timedWalkTaskWithIdentifier(String(Identifier.TimedWalkTask), intendedUseDescription: exampleDescription, distanceInMeters: 100.0, timeLimit: 180.0, options: []) + return ORKOrderedTask.timedWalkTaskWithIdentifier(String(Identifier.TimedWalkTask), intendedUseDescription: exampleDescription, distanceInMeters: 100.0, timeLimit: 180.0, includeAssistiveDeviceForm: true, options: []) } /// This task presents the Tone Audiometry pre-defined active task.