|
@@ -3,7 +3,7 @@
|
3
|
3
|
// EncuestaMarle
|
4
|
4
|
//
|
5
|
5
|
// Created by Tatiana Castro on 5/21/19.
|
6
|
|
-// Copyright © 2019 Marle. All rights reserved.
|
|
6
|
+// Copyright © 2019 TANIA. All rights reserved.
|
7
|
7
|
//
|
8
|
8
|
|
9
|
9
|
import UIKit
|
|
@@ -60,8 +60,8 @@ func limpiarJson_reg(){
|
60
|
60
|
|
61
|
61
|
// Removed due to Apple screwing up the keyboard constraints
|
62
|
62
|
|
63
|
|
- n_jsonDict_reg["job"]=resultado_pregunta[4]["choiceAnswers"]
|
64
|
|
- let date = resultado_pregunta[5]["dateAnswer"] as! String
|
|
63
|
+ //n_jsonDict_reg["job"]=resultado_pregunta[4]["choiceAnswers"]
|
|
64
|
+ let date = resultado_pregunta[4]["dateAnswer"] as! String
|
65
|
65
|
n_jsonDict_reg["yearBirth"]=date.prefix(4)
|
66
|
66
|
}
|
67
|
67
|
}
|
|
@@ -251,14 +251,15 @@ class OnboardingViewController: UIViewController {
|
251
|
251
|
let passcodeValidationRegularExpressionPattern = "^(?=.*\\d).{4,8}$"
|
252
|
252
|
let passcodeValidationRegularExpression = try! NSRegularExpression(pattern: passcodeValidationRegularExpressionPattern)
|
253
|
253
|
let passcodeInvalidMessage = NSLocalizedString("A valid password must be 4 to 8 characters long and include at least one numeric character.", comment: "")
|
254
|
|
- let registrationOptions: ORKRegistrationStepOption = [.includeGender, .includeJob, .includeDOB]
|
255
|
|
- let registrationStep = ORKRegistrationStep(identifier: "registration", title: registrationTitle, text: "Register for MARLE Study", passcodeValidationRegularExpression: passcodeValidationRegularExpression, passcodeInvalidMessage: passcodeInvalidMessage, options: registrationOptions)
|
|
254
|
+ // Apple removed .includeJob so I removed from the middle possition here
|
|
255
|
+ let registrationOptions: ORKRegistrationStepOption = [.includeGender, .includeDOB]
|
|
256
|
+ let registrationStep = ORKRegistrationStep(identifier: "registration", title: registrationTitle, text: "Register for TANIA Study", passcodeValidationRegularExpression: passcodeValidationRegularExpression, passcodeInvalidMessage: passcodeInvalidMessage, options: registrationOptions)
|
256
|
257
|
|
257
|
258
|
let signature = consentDocument.signatures!.first!
|
258
|
259
|
let reviewConsentStep = ORKConsentReviewStep(identifier: "ConsentReviewStep", signature: signature, in: consentDocument)
|
259
|
260
|
|
260
|
261
|
reviewConsentStep.text = "Review the consent form."
|
261
|
|
- reviewConsentStep.reasonForConsent = "Consent to join the MARLE Study."
|
|
262
|
+ reviewConsentStep.reasonForConsent = "Consent to join the TANIA Study."
|
262
|
263
|
|
263
|
264
|
let passcodeStep = ORKPasscodeStep(identifier: "Passcode")
|
264
|
265
|
passcodeStep.text = "Now you will create a passcode to identify yourself to the app and protect access to information you've entered."
|
|
@@ -408,7 +409,7 @@ extension OnboardingViewController : ORKTaskViewControllerDelegate {
|
408
|
409
|
|
409
|
410
|
// implement if (resetPassword == true) workflow
|
410
|
411
|
|
411
|
|
- if (response_r == "Error:hash" || response_r == "Error:password") {
|
|
412
|
+ if (response_r == "Error:hash" || response_r == "Error:password" || response_r == "Error:Email") {
|
412
|
413
|
|
413
|
414
|
let alertTitle = NSLocalizedString("Email and Password do not match", comment: "")
|
414
|
415
|
let alertMessage = NSLocalizedString("Try again or tap forgot password.", comment: "")
|
|
@@ -432,6 +433,22 @@ extension OnboardingViewController : ORKTaskViewControllerDelegate {
|
432
|
433
|
|
433
|
434
|
// MARK: Restore PDF here
|
434
|
435
|
|
|
436
|
+ let decodedString = Data(base64Encoded: response_r)
|
|
437
|
+ var docURL = (FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)).last as NSURL?
|
|
438
|
+ docURL = docURL?.appendingPathComponent("ConsentDocument.pdf") as NSURL?
|
|
439
|
+
|
|
440
|
+ do {
|
|
441
|
+ try decodedString?.write(to:docURL! as URL)
|
|
442
|
+ print("PDF written to disk from recovery ✅")
|
|
443
|
+ print(docURL! as URL)
|
|
444
|
+
|
|
445
|
+ } catch let error {
|
|
446
|
+ print("❌")
|
|
447
|
+ print(error.localizedDescription)
|
|
448
|
+
|
|
449
|
+ }
|
|
450
|
+
|
|
451
|
+
|
435
|
452
|
performSegue(withIdentifier: "unwindToStudy", sender: nil)
|
436
|
453
|
}
|
437
|
454
|
}
|