//
//  ConsentViewController.swift
//  RK-Journals
//
//  Created by Juan David Lopez Regalado on 11/11/24.
//

import UIKit
import ResearchKitUI

class ConsentViewController: UIViewController, ORKTaskViewControllerDelegate {
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        // Do any additional setup after loading the view.
    }
    
    @IBAction func joinButtonTapped(_ sender: UIButton) {
        let taskViewController = ORKTaskViewController(task: ConsentTask, taskRun: nil)
        taskViewController.delegate = self
        taskViewController.modalPresentationStyle = .fullScreen
        present(taskViewController, animated: true, completion: nil)
    }
    
    func taskViewController(_ taskViewController: ORKTaskViewController, didFinishWith reason: ORKTaskFinishReason, error: Error?) {
        dismiss(animated: true, completion: nil) //Dismisses the view controller when we finish our consent task

    }

}


