only consent

main
Juan David 6 months ago
parent d46e10f8e4
commit e1cf6346fd

@ -19,6 +19,7 @@
F56255B32C1A1EF900BF163B /* ResearchKitActiveTask.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = F56255AE2C1A1E7E00BF163B /* ResearchKitActiveTask.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
F56255B42C1A1EF900BF163B /* ResearchKitUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F56255AC2C1A1E7E00BF163B /* ResearchKitUI.framework */; };
F56255B52C1A1EF900BF163B /* ResearchKitUI.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = F56255AC2C1A1E7E00BF163B /* ResearchKitUI.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
F59F9B402C1A303B0083C2E9 /* ConsentManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = F59F9B3F2C1A303B0083C2E9 /* ConsentManager.swift */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@ -78,6 +79,7 @@
F56255982C1A1DF200BF163B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
F562559A2C1A1DF200BF163B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
F56255A02C1A1E7E00BF163B /* ResearchKit.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = ResearchKit.xcodeproj; path = "../../../../Downloads/ResearchKit-main/ResearchKit.xcodeproj"; sourceTree = "<group>"; };
F59F9B3F2C1A303B0083C2E9 /* ConsentManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConsentManager.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@ -116,6 +118,7 @@
isa = PBXGroup;
children = (
F562558C2C1A1DF000BF163B /* AppDelegate.swift */,
F59F9B3F2C1A303B0083C2E9 /* ConsentManager.swift */,
F562558E2C1A1DF000BF163B /* SceneDelegate.swift */,
F56255902C1A1DF000BF163B /* ViewController.swift */,
F56255922C1A1DF000BF163B /* Main.storyboard */,
@ -253,6 +256,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
F59F9B402C1A303B0083C2E9 /* ConsentManager.swift in Sources */,
F56255912C1A1DF000BF163B /* ViewController.swift in Sources */,
F562558D2C1A1DF000BF163B /* AppDelegate.swift in Sources */,
F562558F2C1A1DF000BF163B /* SceneDelegate.swift in Sources */,

@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "pcie-logo.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 645 KiB

@ -1,24 +1,68 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="32700.99.1234" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<device id="retina6_12" orientation="portrait" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22685"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="ViewController" customModuleProvider="target" sceneMemberID="viewController">
<viewController id="BYZ-38-t0r" customClass="ViewController" customModule="surveys_example" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" xcode11CocoaTouchSystemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="udU-YT-Wn2">
<rect key="frame" x="128" y="533" width="137" height="52"/>
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
<state key="normal" title="Start Survey"/>
<buttonConfiguration key="configuration" style="plain" title="Start Survey" titleAlignment="center">
<fontDescription key="titleFontDescription" style="UICTFontTextStyleTitle3"/>
</buttonConfiguration>
<connections>
<action selector="startSurveyTapped:" destination="BYZ-38-t0r" eventType="touchUpInside" id="0G5-au-7td"/>
</connections>
</button>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" fixedFrame="YES" text="Biomarker analysis study on Apple devices to detect the level of sedentary lifestyle." textAlignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="O9Y-Kh-XQC">
<rect key="frame" x="72" y="146" width="248" height="311"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<color key="textColor" systemColor="labelColor"/>
<fontDescription key="fontDescription" name="GillSans" family="Gill Sans" pointSize="36"/>
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
</textView>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" image="pcie-logo" translatesAutoresizingMaskIntoConstraints="NO" id="jV5-Zs-y7v">
<rect key="frame" x="97" y="690" width="198" height="111"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
</imageView>
</subviews>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstItem="udU-YT-Wn2" firstAttribute="top" secondItem="6Tk-OE-BBY" secondAttribute="top" constant="474" id="4Lv-uj-sfs"/>
<constraint firstItem="6Tk-OE-BBY" firstAttribute="trailing" secondItem="udU-YT-Wn2" secondAttribute="trailing" constant="128" id="KxA-OY-V2k"/>
<constraint firstItem="6Tk-OE-BBY" firstAttribute="bottom" secondItem="udU-YT-Wn2" secondAttribute="bottom" constant="233" id="q22-wR-4RZ"/>
<constraint firstItem="udU-YT-Wn2" firstAttribute="leading" secondItem="6Tk-OE-BBY" secondAttribute="leading" constant="128" id="sa7-Jh-KZz"/>
</constraints>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="55.725190839694655" y="3.5211267605633805"/>
</scene>
</scenes>
<resources>
<image name="pcie-logo" width="3766" height="1429"/>
<systemColor name="labelColor">
<color white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
<systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
</resources>
</document>

@ -0,0 +1,79 @@
//
// ConsentManager.swift
// surveys-example
//
// Created by Juan David López Regalado on 12/06/24.
//
import Foundation
import UIKit
import ResearchKit
class ConsentManager{
static let shared = ConsentManager()
func createConsentTask() -> ORKTask{
// Pagina de Welcome
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." // explain the consent
let sign = ORKInstructionStep(identifier: "signAccept")
sign.title = "Please Sign if you Accept"
// Pagina del before you join
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 /*other steps*/])
return task
}
}

@ -7,8 +7,9 @@
import UIKit
import ResearchKit
import ResearchKitUI
class ViewController: UIViewController {
class ViewController: UIViewController, ORKTaskViewControllerDelegate {
override func viewDidLoad() {
super.viewDidLoad()
@ -16,5 +17,19 @@ class ViewController: UIViewController {
}
@IBAction func startSurveyTapped(_ sender: Any) {
let consentTask = ConsentManager.shared.createConsentTask()
let taskViewController = ORKTaskViewController(task: consentTask, taskRun: nil)
taskViewController.delegate = self
present(taskViewController,animated: true, completion: nil)
}
func taskViewController(_ taskViewController: ORKTaskViewController, didFinishWith reason: ORKTaskFinishReason, error: (any Error)?) {
taskViewController.dismiss(animated: true, completion: nil)
}
}

Loading…
Cancel
Save