Browse Source

Solo falta recover PDF.

Hector Carrion 4 years ago
parent
commit
f7308dbcca

+ 4
- 4
EncuestaMarle/ConsentDocument.swift View File

3
 //  EncuestaMarle
3
 //  EncuestaMarle
4
 //
4
 //
5
 //  Created by Tatiana Castro on 5/21/19.
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
 import ResearchKit
9
 import ResearchKit
13
     override init() {
13
     override init() {
14
         super.init()
14
         super.init()
15
         
15
         
16
-        title = NSLocalizedString("MARLE Consent Form", comment: "")
16
+        title = NSLocalizedString("TANIA Consent Form", comment: "")
17
         
17
         
18
         sections = []
18
         sections = []
19
         
19
         
20
         let section1 = ORKConsentSection(type: .overview)
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
         if sections == nil {
23
         if sections == nil {
24
             sections = [section1]
24
             sections = [section1]
25
         } else {
25
         } else {

+ 1
- 1
EncuestaMarle/EncuestaMarle.swift View File

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

+ 2
- 2
EncuestaMarle/EncuestaViewController.swift View File

184
             return
184
             return
185
         }
185
         }
186
         
186
         
187
-        print("response = \(String(describing: response))")
187
+        print("response Answer Parse ✅ = \(String(describing: response))")
188
         
188
         
189
         let responseString = NSString(data: data!, encoding: String.Encoding.utf8.rawValue)
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
     task.resume()
192
     task.resume()
193
 }
193
 }

+ 4
- 4
EncuestaMarle/ORKESerialization.m View File

938
                     PROPERTY(samplingInterval, NSNumber, NSObject, YES, nil, nil),
938
                     PROPERTY(samplingInterval, NSNumber, NSObject, YES, nil, nil),
939
                     PROPERTY(requiredContiguousSamples, NSNumber, NSObject, YES, nil, nil),
939
                     PROPERTY(requiredContiguousSamples, NSNumber, NSObject, YES, nil, nil),
940
                     })),
940
                     })),
941
-           ENTRY(ORKEnvironmentSPLMeterResult,
941
+           ENTRY(ORKEnvironmentSPLMeterStep,
942
                  ^id(NSDictionary *dict, ORKESerializationPropertyGetter getter) {
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
                     PROPERTY(sensitivityOffset, NSNumber, NSObject, YES, nil, nil),
946
                     PROPERTY(sensitivityOffset, NSNumber, NSObject, YES, nil, nil),
1074
                  (@{
1074
                  (@{
1075
                     PROPERTY(frequency, NSNumber, NSObject, NO, nil, nil),
1075
                     PROPERTY(frequency, NSNumber, NSObject, NO, nil, nil),
1076
                     })),
1076
                     })),
1077
-           ENTRY(ORKdBHLToneAudiometryOnboardingStep,
1077
+           ENTRY(ORKdBHLToneAudiometryStep,
1078
                  ^id(NSDictionary *dict, ORKESerializationPropertyGetter getter) {
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
                     PROPERTY(useCardView, NSNumber, NSObject, YES, nil, nil),
1082
                     PROPERTY(useCardView, NSNumber, NSObject, YES, nil, nil),

+ 24
- 7
EncuestaMarle/OnboardingViewController.swift View File

3
 //  EncuestaMarle
3
 //  EncuestaMarle
4
 //
4
 //
5
 //  Created by Tatiana Castro on 5/21/19.
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
 import UIKit
9
 import UIKit
60
         
60
         
61
         // Removed due to Apple screwing up the keyboard constraints
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
         n_jsonDict_reg["yearBirth"]=date.prefix(4)
65
         n_jsonDict_reg["yearBirth"]=date.prefix(4)
66
     }
66
     }
67
 }
67
 }
251
         let passcodeValidationRegularExpressionPattern = "^(?=.*\\d).{4,8}$"
251
         let passcodeValidationRegularExpressionPattern = "^(?=.*\\d).{4,8}$"
252
         let passcodeValidationRegularExpression = try! NSRegularExpression(pattern: passcodeValidationRegularExpressionPattern)
252
         let passcodeValidationRegularExpression = try! NSRegularExpression(pattern: passcodeValidationRegularExpressionPattern)
253
         let passcodeInvalidMessage = NSLocalizedString("A valid password must be 4 to 8 characters long and include at least one numeric character.", comment: "")
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
         let signature = consentDocument.signatures!.first!
258
         let signature = consentDocument.signatures!.first!
258
         let reviewConsentStep = ORKConsentReviewStep(identifier: "ConsentReviewStep", signature: signature, in: consentDocument)
259
         let reviewConsentStep = ORKConsentReviewStep(identifier: "ConsentReviewStep", signature: signature, in: consentDocument)
259
         
260
         
260
         reviewConsentStep.text = "Review the consent form."
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
         let passcodeStep = ORKPasscodeStep(identifier: "Passcode")
264
         let passcodeStep = ORKPasscodeStep(identifier: "Passcode")
264
         passcodeStep.text = "Now you will create a passcode to identify yourself to the app and protect access to information you've entered."
265
         passcodeStep.text = "Now you will create a passcode to identify yourself to the app and protect access to information you've entered."
408
                 
409
                 
409
                 // implement if (resetPassword == true) workflow
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
                     let alertTitle = NSLocalizedString("Email and Password do not match", comment: "")
414
                     let alertTitle = NSLocalizedString("Email and Password do not match", comment: "")
414
                     let alertMessage = NSLocalizedString("Try again or tap forgot password.", comment: "")
415
                     let alertMessage = NSLocalizedString("Try again or tap forgot password.", comment: "")
432
                     
433
                     
433
                     // MARK: Restore PDF here
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
                     performSegue(withIdentifier: "unwindToStudy", sender: nil)
452
                     performSegue(withIdentifier: "unwindToStudy", sender: nil)
436
                 }
453
                 }
437
             }
454
             }

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

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