//
// C o n s e n t M a n a g e r . s w i f t
// s u r v e y s - e x a m p l e
//
// C r e a t e d b y J u a n D a v i d L ó p e z R e g a l a d o o n 1 2 / 0 6 / 2 4 .
//
import Foundation
import UIKit
import ResearchKit
class ConsentManager {
static let shared = ConsentManager ( )
func createConsentTask ( ) -> ORKTask {
// P a g i n a d e W e l c o m e
let welcomeStep = ORKInstructionStep ( identifier : " consentWelcomeInstructionStep " )
welcomeStep . title = " Welcome! "
welcomeStep . iconImage = UIImage ( systemName : " hand.wave " )
welcomeStep . detailText = " Thank you for being part of the biomarker project aimed at determining the level of sedentary lifestyle. However, before accepting, please read the next part. " // e x p l a i n t h e c o n s e n t
let sign = ORKInstructionStep ( identifier : " signAccept " )
sign . title = " Please Sign if you Accept "
// P a g i n a d e l b e f o r e y o u j o i n
let beforeYouJoin = ORKInstructionStep ( identifier : " informedConsentInstructionStep " )
beforeYouJoin . iconImage = UIImage ( systemName : " doc.text.magnifyinglass " )
beforeYouJoin . title = " Before You Join "
let sharingHealthDataBodyItem = ORKBodyItem ( text : " The study will ask you to share some of your Health data. " ,
detailText : nil ,
image : UIImage ( systemName : " heart.fill " ) ,
learnMoreItem : nil ,
bodyItemStyle : . image )
let completingTasksBodyItem = ORKBodyItem ( text : " You will be asked to complete various tasks over the duration of the study. " ,
detailText : nil ,
image : UIImage ( systemName : " checkmark.circle.fill " ) ,
learnMoreItem : nil ,
bodyItemStyle : . image )
let signatureBodyItem = ORKBodyItem ( text : " Before joining, we will ask you to sign an informed consent document. " ,
detailText : nil ,
image : UIImage ( systemName : " signature " ) ,
learnMoreItem : nil ,
bodyItemStyle : . image )
let secureDataBodyItem = ORKBodyItem ( text : " Your data is kept private and secure. " ,
detailText : nil ,
image : UIImage ( systemName : " lock.fill " ) ,
learnMoreItem : nil ,
bodyItemStyle : . image )
beforeYouJoin . bodyItems = [
sharingHealthDataBodyItem ,
completingTasksBodyItem ,
signatureBodyItem ,
secureDataBodyItem
]
let instructionSteps = [ sign ]
let webViewStep = ORKWebViewStep ( identifier : " WebViewStepIdentifier " , instructionSteps : instructionSteps )
webViewStep . showSignatureAfterContent = true
let task = ORKOrderedTask ( identifier : " ConsentTask " , steps : [ welcomeStep , beforeYouJoin , webViewStep , /* o t h e r s t e p s */ ] )
return task
}
}