Brak opisu

AccountCreation.swift 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. //
  2. // AccountCreation.swift
  3. // EncuestaMarle
  4. //
  5. // Created by Tatiana Castro on 5/21/19.
  6. // Copyright © 2019 Marle. All rights reserved.
  7. //
  8. import ResearchKit
  9. class AccountCreation: ORKRegistrationStep {
  10. override init(identifier: String) {
  11. super.init(identifier: identifier)
  12. let registrationTitle = NSLocalizedString("Registration", comment: "")
  13. let passcodeValidationRegularExpressionPattern = "^(?=.*\\d).{4,8}$"
  14. let passcodeValidationRegularExpression = try! NSRegularExpression(pattern: passcodeValidationRegularExpressionPattern)
  15. let passcodeInvalidMessage = NSLocalizedString("A valid password must be 4 to 8 characters long and include at least one numeric character.", comment: "")
  16. let registrationOptions: ORKRegistrationStepOption = [.includeGivenName, .includeFamilyName, .includeGender, .includeDOB]
  17. let registrationStep = ORKRegistrationStep(identifier: "registration", title: registrationTitle, text: "Register for MARLE Study", passcodeValidationRegularExpression: passcodeValidationRegularExpression, passcodeInvalidMessage: passcodeInvalidMessage, options: registrationOptions)
  18. /*
  19. A wait step allows you to upload the data from the user registration onto your server before presenting the verification step.
  20. */
  21. let waitTitle = NSLocalizedString("Creating account", comment: "")
  22. let waitText = NSLocalizedString("Please wait while we upload your data", comment: "")
  23. let waitStep = ORKWaitStep(identifier: "wait_step")
  24. waitStep.title = waitTitle
  25. waitStep.text = waitText
  26. // return ORKOrderedTask(identifier: String(describing:Identifier.accountCreationTask), steps: [
  27. // registrationStep,
  28. // waitStep
  29. // ])
  30. }
  31. required init(coder aDecoder: NSCoder) {
  32. fatalError("init(coder:) has not been implemented")
  33. }
  34. }