Skip to content

Commit 065a02e

Browse files
committed
[ORKNavigableOrderedTask] Fix 'shouldReportProgress' being ignored by NSSecureCoding and NSCopying
Also, fix ORKTest's unit tests.
1 parent 62a31b0 commit 065a02e

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

ResearchKit/Common/ORKNavigableOrderedTask.m

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ - (instancetype)initWithCoder:(NSCoder *)aDecoder {
131131
self = [super initWithCoder:aDecoder];
132132
if (self) {
133133
ORK_DECODE_OBJ_MUTABLE_DICTIONARY(aDecoder, stepNavigationRules, NSString, ORKStepNavigationRule);
134+
ORK_DECODE_BOOL(aDecoder, shouldReportProgress);
134135
}
135136
return self;
136137
}
@@ -139,13 +140,15 @@ - (void)encodeWithCoder:(NSCoder *)aCoder {
139140
[super encodeWithCoder:aCoder];
140141

141142
ORK_ENCODE_OBJ(aCoder, stepNavigationRules);
143+
ORK_ENCODE_BOOL(aCoder, shouldReportProgress);
142144
}
143145

144146
#pragma mark NSCopying
145147

146148
- (instancetype)copyWithZone:(NSZone *)zone {
147149
typeof(self) task = [super copyWithZone:zone];
148150
task->_stepNavigationRules = ORKMutableDictionaryCopyObjects(_stepNavigationRules);
151+
task->_shouldReportProgress = _shouldReportProgress;
149152
return task;
150153
}
151154

@@ -154,11 +157,12 @@ - (BOOL)isEqual:(id)object {
154157

155158
__typeof(self) castObject = object;
156159
return isParentSame
157-
&& ORKEqualObjects(self->_stepNavigationRules, castObject->_stepNavigationRules);
160+
&& ORKEqualObjects(self->_stepNavigationRules, castObject->_stepNavigationRules)
161+
&& self->_shouldReportProgress == castObject.shouldReportProgress;
158162
}
159163

160164
- (NSUInteger)hash {
161-
return [super hash] ^ [_stepNavigationRules hash];
165+
return [super hash] ^ [_stepNavigationRules hash] ^ (_shouldReportProgress ? 0xf : 0x0);
162166
}
163167

164168
#pragma mark - Predefined

Testing/ORKTest/ORKTest/ORKESerialization.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,7 @@ @implementation ORKESerializer
366366
return task;
367367
},(@{
368368
PROPERTY(stepNavigationRules, ORKStepNavigationRule, NSMutableDictionary, YES, nil, nil),
369+
PROPERTY(shouldReportProgress, NSNumber, NSObject, YES, nil, nil),
369370
})),
370371
ENTRY(ORKStep,
371372
^id(NSDictionary *dict, ORKESerializationPropertyGetter getter) {

0 commit comments

Comments
 (0)