Skip to content

Commit

Permalink
Make selecting a sharing option optional, can be skipped/hidden if ma…
Browse files Browse the repository at this point in the history
…rked appropriately in the consent json
  • Loading branch information
EricSiegNW committed Nov 18, 2015
1 parent e98d54c commit 524b2dc
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions APCAppCore/APCAppCore/Consent/APCConsentTask.m
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
static NSString* kDocumentHtmlTag = @"htmlDocument";
static NSString* kInvestigatorShortDescriptionTag = @"investigatorShortDescription";
static NSString* kInvestigatorLongDescriptionTag = @"investigatorLongDescription";
static NSString* kHideSharingStepTag = @"hideSharingStep";
static NSString* kHtmlContentTag = @"htmlContent";
static NSString* kIdentifierTag = @"identifier";
static NSString* kPromptTag = @"prompt";
Expand Down Expand Up @@ -100,6 +101,7 @@ @interface APCConsentTask ()
@property (nonatomic, strong) NSArray* documentSections;

// Sharing
@property (nonatomic, assign) BOOL hideSharingStep;
@property (nonatomic, copy) NSString* investigatorShortDescription;
@property (nonatomic, copy) NSString* investigatorLongDescription;
@property (nonatomic, copy) NSString* sharingHtmlLearnMoreContent;
Expand Down Expand Up @@ -185,10 +187,7 @@ - (NSArray*)commonInitWithPropertiesFileName:(NSString*)fileName customSteps:(NS

_visualStep = [[ORKVisualConsentStep alloc] initWithIdentifier:@"visual"
document:_consentDocument];
_sharingStep = [[ORKConsentSharingStep alloc] initWithIdentifier:kSharingTag
investigatorShortDescription:self.investigatorShortDescription
investigatorLongDescription:self.investigatorLongDescription
localizedLearnMoreHTMLContent:self.sharingHtmlLearnMoreContent];


APCAppDelegate* delegate = (APCAppDelegate*) [UIApplication sharedApplication].delegate;
BOOL disableSignatureInConsent = delegate.disableSignatureInConsent;
Expand All @@ -205,7 +204,14 @@ - (NSArray*)commonInitWithPropertiesFileName:(NSString*)fileName customSteps:(NS

NSMutableArray* consentSteps = [[NSMutableArray alloc] init];
[consentSteps addObject:_visualStep];
[consentSteps addObject:_sharingStep];

if (!self.hideSharingStep) {
_sharingStep = [[ORKConsentSharingStep alloc] initWithIdentifier:kSharingTag
investigatorShortDescription:self.investigatorShortDescription
investigatorLongDescription:self.investigatorLongDescription
localizedLearnMoreHTMLContent:self.sharingHtmlLearnMoreContent];
[consentSteps addObject:_sharingStep];
}

_indexOfFirstCustomStep = consentSteps.count;
[consentSteps addObjectsFromArray:customSteps];
Expand Down Expand Up @@ -512,6 +518,10 @@ - (void)loadDocumentProperties:(NSDictionary*)properties

self.investigatorLongDescription = [properties objectForKey:kInvestigatorLongDescriptionTag];
NSAssert(self.investigatorLongDescription != nil && [self.investigatorLongDescription isKindOfClass:[NSString class]], @"Improper type for Investigator Long Description");

if ([properties valueForKey:kHideSharingStepTag] != nil) {
self.hideSharingStep = [properties valueForKey:kHideSharingStepTag];
}

NSString* htmlContent = [properties objectForKey:kHtmlContentTag];
if (htmlContent != nil)
Expand Down

0 comments on commit 524b2dc

Please sign in to comment.