Skip to content

Commit

Permalink
Merge pull request ResearchKit#42 from EricSiegNW/master
Browse files Browse the repository at this point in the history
Expose APCThankYouViewController, Add ability to hide sharing step
  • Loading branch information
Erin-Mounts committed Nov 19, 2015
2 parents 3d8cb1a + 524b2dc commit 4c4318d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
4 changes: 2 additions & 2 deletions APCAppCore/APCAppCore.xcodeproj/project.pbxproj
Expand Up @@ -54,7 +54,7 @@
0871A3941A8F4244002EA80D /* APCDashboardFoodInsightTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 0871A3921A8F4244002EA80D /* APCDashboardFoodInsightTableViewCell.m */; };
087255C01ABA390500586492 /* APCJSONSerializer.h in Headers */ = {isa = PBXBuildFile; fileRef = 087255BE1ABA390500586492 /* APCJSONSerializer.h */; settings = {ATTRIBUTES = (Public, ); }; };
087255C11ABA390500586492 /* APCJSONSerializer.m in Sources */ = {isa = PBXBuildFile; fileRef = 087255BF1ABA390500586492 /* APCJSONSerializer.m */; };
087468061AA691A400BE2572 /* APCThankYouViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 087468041AA691A400BE2572 /* APCThankYouViewController.h */; };
087468061AA691A400BE2572 /* APCThankYouViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 087468041AA691A400BE2572 /* APCThankYouViewController.h */; settings = {ATTRIBUTES = (Public, ); }; };
087468071AA691A400BE2572 /* APCThankYouViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 087468051AA691A400BE2572 /* APCThankYouViewController.m */; };
0875C3D81A797A7B00CE50FB /* APCButton.h in Headers */ = {isa = PBXBuildFile; fileRef = 0875C3D61A797A7B00CE50FB /* APCButton.h */; settings = {ATTRIBUTES = (Public, ); }; };
0875C3D91A797A7B00CE50FB /* APCButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 0875C3D71A797A7B00CE50FB /* APCButton.m */; };
Expand Down Expand Up @@ -3191,7 +3191,6 @@
F5B947C71A73272C0034C522 /* NSObject+Helper.h in Headers */,
747307101A96E1DE0071D863 /* APCCMS.h in Headers */,
7423AB5B1AA3FFD8004A325A /* APCConsentRedirector.h in Headers */,
087468061AA691A400BE2572 /* APCThankYouViewController.h in Headers */,
081A477A1A93EC4700E13148 /* APCBadgeLabel.h in Headers */,
F5F12A891A2F78490015982C /* APCTableViewItem.h in Headers */,
F5F12AC31A2F78490015982C /* APCLearnMasterViewController.h in Headers */,
Expand Down Expand Up @@ -3293,6 +3292,7 @@
F5F12AAE1A2F78490015982C /* APCSignUpInfoViewController.h in Headers */,
36257FBD1AA714B60060B95A /* CMMotionActivity+Helper.h in Headers */,
F5C363601A40E21000113129 /* APCSmartSurveyTask.h in Headers */,
087468061AA691A400BE2572 /* APCThankYouViewController.h in Headers */,
6C7346081A7ECD3B00DA9CD8 /* APCConsentTaskViewController.h in Headers */,
F5B9462A1A7309A20034C522 /* ZZChannelOutput.h in Headers */,
F5F12AB41A2F78490015982C /* APCSignUpPermissionsViewController.h in Headers */,
Expand Down
1 change: 1 addition & 0 deletions APCAppCore/APCAppCore/APCAppCore.h
Expand Up @@ -130,6 +130,7 @@ FOUNDATION_EXPORT const unsigned char APCAppCoreVersionString[];
#import <APCAppCore/APCPasscodeViewController.h>
#import <APCAppCore/APCConsentTaskViewController.h>
#import <APCAppCore/APCWebViewController.h>
#import <APCAppCore/APCThankYouViewController.h>

/*--------------------------
Dashboard ViewControllers
Expand Down
20 changes: 15 additions & 5 deletions APCAppCore/APCAppCore/Consent/APCConsentTask.m
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 4c4318d

Please sign in to comment.