Browse Source

Solo falta recover PDF.

Hector Carrion 4 years ago
parent
commit
f7308dbcca

+ 4
- 4
EncuestaMarle/ConsentDocument.swift View File

@@ -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 ResearchKit
@@ -13,13 +13,13 @@ class ConsentDocument: ORKConsentDocument {
13 13
     override init() {
14 14
         super.init()
15 15
         
16
-        title = NSLocalizedString("MARLE Consent Form", comment: "")
16
+        title = NSLocalizedString("TANIA Consent Form", comment: "")
17 17
         
18 18
         sections = []
19 19
         
20 20
         let section1 = ORKConsentSection(type: .overview)
21
-        section1.summary = "You have been invited to participate in this study whose objectives are (1) to develop and demonstrate the utility of a mobile application (MARLE) to collect perception data of students participating in research experiences and (2) to use MARLE to determine the sources of self-efficacy that lead to career exploration and decision-making in undergraduate students."
22
-        section1.content = "You have been invited to participate in this study whose objectives are (1) to develop and demonstrate the utility of a mobile application (MARLE) to collect perception data of students participating in research experiences and (2) to use MARLE to determine the sources of self-efficacy that lead to career exploration and decision-making in undergraduate students. This study is been carried out under the supervision of Dr. Juan S. Ramírez Lugo, Department of Biology and Dr. Carlos Corrada Bravo, Department of Computer Sciences at the University of Puerto Rico, Rio Piedras Campus. You were selected to participate in this study because you are enrolled in a course that offers a research experience or you voluntarily participate in research with a professor affiliated to the Río Piedras Campus."
21
+        section1.summary = "You have been invited to participate in this study whose objectives are (1) to develop and demonstrate the utility of a mobile application (TANIA) to collect perception data of students participating in research experiences and (2) to use TANIA to determine the sources of self-efficacy that lead to career exploration and decision-making in undergraduate students."
22
+        section1.content = "You have been invited to participate in this study whose objectives are (1) to develop and demonstrate the utility of a mobile application (TANIA) to collect perception data of students participating in research experiences and (2) to use TANIA to determine the sources of self-efficacy that lead to career exploration and decision-making in undergraduate students. This study is been carried out under the supervision of Dr. Juan S. Ramírez Lugo, Department of Biology and Dr. Carlos Corrada Bravo, Department of Computer Sciences at the University of Puerto Rico, Rio Piedras Campus. You were selected to participate in this study because you are enrolled in a course that offers a research experience or you voluntarily participate in research with a professor affiliated to the Río Piedras Campus."
23 23
         if sections == nil {
24 24
             sections = [section1]
25 25
         } else {

+ 1
- 1
EncuestaMarle/EncuestaMarle.swift View File

@@ -12,7 +12,7 @@ public var EncuestaMarle: ORKOrderedTask {
12 12
     var steps = [ORKStep]()
13 13
     
14 14
     let instruccion = ORKInstructionStep(identifier: "Instrucción")
15
-    instruccion.title = "Proyecto MARLE"
15
+    instruccion.title = "Proyecto TANIA"
16 16
     instruccion.text = descripcion
17 17
     steps += [instruccion]
18 18
         

+ 2
- 2
EncuestaMarle/EncuestaViewController.swift View File

@@ -184,10 +184,10 @@ func sendJson(){
184 184
             return
185 185
         }
186 186
         
187
-        print("response = \(String(describing: response))")
187
+        print("response Answer Parse ✅ = \(String(describing: response))")
188 188
         
189 189
         let responseString = NSString(data: data!, encoding: String.Encoding.utf8.rawValue)
190
-        print("responseString = \(String(describing: responseString))")
190
+        print("responseString Answer Parse ✅  = \(String(describing: responseString))")
191 191
     }
192 192
     task.resume()
193 193
 }

+ 4
- 4
EncuestaMarle/ORKESerialization.m View File

@@ -938,9 +938,9 @@ static NSMutableDictionary *ORKESerializationEncodingTable() {
938 938
                     PROPERTY(samplingInterval, NSNumber, NSObject, YES, nil, nil),
939 939
                     PROPERTY(requiredContiguousSamples, NSNumber, NSObject, YES, nil, nil),
940 940
                     })),
941
-           ENTRY(ORKEnvironmentSPLMeterResult,
941
+           ENTRY(ORKEnvironmentSPLMeterStep,
942 942
                  ^id(NSDictionary *dict, ORKESerializationPropertyGetter getter) {
943
-                     return [[ORKEnvironmentSPLMeterResult alloc] initWithIdentifier:GETPROP(dict, identifier)];
943
+               return [[ORKEnvironmentSPLMeterStep alloc] initWithIdentifier:GETPROP(dict, identifier)];
944 944
                  },
945 945
                  (@{
946 946
                     PROPERTY(sensitivityOffset, NSNumber, NSObject, YES, nil, nil),
@@ -1074,9 +1074,9 @@ static NSMutableDictionary *ORKESerializationEncodingTable() {
1074 1074
                  (@{
1075 1075
                     PROPERTY(frequency, NSNumber, NSObject, NO, nil, nil),
1076 1076
                     })),
1077
-           ENTRY(ORKdBHLToneAudiometryOnboardingStep,
1077
+           ENTRY(ORKdBHLToneAudiometryStep,
1078 1078
                  ^id(NSDictionary *dict, ORKESerializationPropertyGetter getter) {
1079
-                     return [[ORKdBHLToneAudiometryOnboardingStep alloc] initWithIdentifier:GETPROP(dict, identifier)];
1079
+               return [[ORKdBHLToneAudiometryStep alloc] initWithIdentifier:GETPROP(dict, identifier)];
1080 1080
                  },
1081 1081
                  (@{
1082 1082
                     PROPERTY(useCardView, NSNumber, NSObject, YES, nil, nil),

+ 24
- 7
EncuestaMarle/OnboardingViewController.swift View File

@@ -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
             }

+ 4
- 4
Tania.xcodeproj/project.pbxproj View File

@@ -630,7 +630,7 @@
630 630
 				CLANG_ENABLE_MODULES = YES;
631 631
 				CODE_SIGN_ENTITLEMENTS = EncuestaMarle/EncuestaMarle.entitlements;
632 632
 				CODE_SIGN_STYLE = Automatic;
633
-				DEVELOPMENT_TEAM = 4P4738NUTG;
633
+				DEVELOPMENT_TEAM = 44GX6RVC5R;
634 634
 				FRAMEWORK_SEARCH_PATHS = (
635 635
 					"$(inherited)",
636 636
 					"$(PROJECT_DIR)/EncuestaMarle",
@@ -641,7 +641,7 @@
641 641
 					"$(inherited)",
642 642
 					"@executable_path/Frameworks",
643 643
 				);
644
-				PRODUCT_BUNDLE_IDENTIFIER = "MARLEApp.EncuestaMarle-h";
644
+				PRODUCT_BUNDLE_IDENTIFIER = MARLEApp.EncuestaMarle;
645 645
 				PRODUCT_NAME = "$(TARGET_NAME)";
646 646
 				SWIFT_OBJC_BRIDGING_HEADER = "EncuestaMarle/EncuestaMarle-Bridging-Header.h";
647 647
 				SWIFT_OBJC_INTERFACE_HEADER_NAME = "Users/tatianacastro/Documents/Documents/EncuestaMarle/EncuestaMarle/EncuestaMarle-Bridging-Header.h";
@@ -660,7 +660,7 @@
660 660
 				CLANG_ENABLE_MODULES = YES;
661 661
 				CODE_SIGN_ENTITLEMENTS = EncuestaMarle/EncuestaMarle.entitlements;
662 662
 				CODE_SIGN_STYLE = Automatic;
663
-				DEVELOPMENT_TEAM = 4P4738NUTG;
663
+				DEVELOPMENT_TEAM = 44GX6RVC5R;
664 664
 				FRAMEWORK_SEARCH_PATHS = (
665 665
 					"$(inherited)",
666 666
 					"$(PROJECT_DIR)/EncuestaMarle",
@@ -671,7 +671,7 @@
671 671
 					"$(inherited)",
672 672
 					"@executable_path/Frameworks",
673 673
 				);
674
-				PRODUCT_BUNDLE_IDENTIFIER = "MARLEApp.EncuestaMarle-h";
674
+				PRODUCT_BUNDLE_IDENTIFIER = MARLEApp.EncuestaMarle;
675 675
 				PRODUCT_NAME = "$(TARGET_NAME)";
676 676
 				SWIFT_OBJC_BRIDGING_HEADER = "EncuestaMarle/EncuestaMarle-Bridging-Header.h";
677 677
 				SWIFT_OBJC_INTERFACE_HEADER_NAME = "Users/tatianacastro/Documents/Documents/EncuestaMarle/EncuestaMarle/EncuestaMarle-Bridging-Header.h";