Przeglądaj źródła

Dark Mode support, faulty URLSheme protection, bug fixes.

Hector Carrion 4 lat temu
rodzic
commit
4fa8b4c66d

+ 58
- 12
EncuestaMarle/AppDelegate.swift Wyświetl plik

13
 import Firebase
13
 import Firebase
14
 import ResearchKit
14
 import ResearchKit
15
 
15
 
16
+
16
 @UIApplicationMain
17
 @UIApplicationMain
17
 class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterDelegate {
18
 class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterDelegate {
18
 
19
 
193
         let registered = checkIfRegistered()
194
         let registered = checkIfRegistered()
194
         
195
         
195
         if !registered {
196
         if !registered {
196
-            let alertTitle = NSLocalizedString("Please join study first", comment: "")
197
+            let alertTitle = NSLocalizedString("Please join Tania first", comment: "")
197
             let alertMessage = NSLocalizedString("Press the 'Join Study' buttton below to register, then open this link again", comment: "")
198
             let alertMessage = NSLocalizedString("Press the 'Join Study' buttton below to register, then open this link again", comment: "")
198
             let alert = UIAlertController(title: alertTitle, message: alertMessage, preferredStyle: UIAlertController.Style.alert)
199
             let alert = UIAlertController(title: alertTitle, message: alertMessage, preferredStyle: UIAlertController.Style.alert)
199
             alert.addAction(UIAlertAction(title: "OK", style: UIAlertAction.Style.default, handler: nil))
200
             alert.addAction(UIAlertAction(title: "OK", style: UIAlertAction.Style.default, handler: nil))
210
             guard let components = NSURLComponents(url: url, resolvingAgainstBaseURL: true),
211
             guard let components = NSURLComponents(url: url, resolvingAgainstBaseURL: true),
211
                 let params = components.queryItems else {
212
                 let params = components.queryItems else {
212
                     print("Invalid URL or host missing")
213
                     print("Invalid URL or host missing")
214
+                    
215
+                    let alertTitle = NSLocalizedString("Invalid link or resource", comment: "")
216
+                    let alertMessage = NSLocalizedString("Please contact your mentor for further assistance", comment: "")
217
+                    let alert = UIAlertController(title: alertTitle, message: alertMessage, preferredStyle: UIAlertController.Style.alert)
218
+                    alert.addAction(UIAlertAction(title: "OK", style: UIAlertAction.Style.default, handler: nil))
219
+                    self.window?.rootViewController?.present(alert, animated: true, completion: nil)
220
+                    
213
                     return false
221
                     return false
214
             }
222
             }
215
             
223
             
219
                 
227
                 
220
                 registerToExperience(id: id)
228
                 registerToExperience(id: id)
221
                 
229
                 
222
-                return true
230
+                while(newResponseID == false) {}
231
+                newResponseID = false
232
+                
233
+                if response_id == "Error:hash" {
234
+                    
235
+                    let alertTitle = NSLocalizedString("That experience does not exist", comment: "")
236
+                    let alertMessage = NSLocalizedString("Please contact your mentor for further assistance", comment: "")
237
+                    let alert = UIAlertController(title: alertTitle, message: alertMessage, preferredStyle: UIAlertController.Style.alert)
238
+                    alert.addAction(UIAlertAction(title: "OK", style: UIAlertAction.Style.default, handler: nil))
239
+                    self.window?.rootViewController?.present(alert, animated: true, completion: nil)
240
+                    
241
+                    return false
242
+                }
243
+                
244
+                else if response_id == "Success" {
245
+                    
246
+                    let alertTitle = NSLocalizedString("Sucessful registration to experience", comment: "")
247
+                    let alertMessage = NSLocalizedString("Surveys will become available to answer", comment: "")
248
+                    let alert = UIAlertController(title: alertTitle, message: alertMessage, preferredStyle: UIAlertController.Style.alert)
249
+                    alert.addAction(UIAlertAction(title: "OK", style: UIAlertAction.Style.default, handler: nil))
250
+                    self.window?.rootViewController?.present(alert, animated: true, completion: nil)
251
+                    
252
+                    return true
253
+                }
254
+                
255
+                return false
256
+                
223
             } else {
257
             } else {
224
                 print("Encuesta id missing")
258
                 print("Encuesta id missing")
259
+                
260
+                let alertTitle = NSLocalizedString("Invalid link or experience ID", comment: "")
261
+                let alertMessage = NSLocalizedString("Please contact your mentor for further assistance", comment: "")
262
+                let alert = UIAlertController(title: alertTitle, message: alertMessage, preferredStyle: UIAlertController.Style.alert)
263
+                alert.addAction(UIAlertAction(title: "OK", style: UIAlertAction.Style.default, handler: nil))
264
+                self.window?.rootViewController?.present(alert, animated: true, completion: nil)
265
+                
225
                 return false
266
                 return false
226
             }
267
             }
227
         }
268
         }
256
 }
297
 }
257
 
298
 
258
 
299
 
300
+extension UIApplication {
301
+  class func topViewController(controller: UIViewController? = UIApplication.shared.keyWindow?.rootViewController) -> UIViewController? {
302
+    if let tabController = controller as? UITabBarController {
303
+      return topViewController(controller: tabController.selectedViewController)
304
+    }
305
+    if let navController = controller as? UINavigationController {
306
+      return topViewController(controller: navController.visibleViewController)
307
+    }
308
+    if let presented = controller?.presentedViewController {
309
+      return topViewController(controller: presented)
310
+    }
311
+    return controller
312
+  }
313
+}
314
+
259
 
315
 
260
 func registerToExperience(id: String) {
316
 func registerToExperience(id: String) {
261
     
317
     
298
         print ("❌ JSON Failure")
354
         print ("❌ JSON Failure")
299
     }
355
     }
300
     
356
     
301
-    if response_id == "Error:id_experiencia" {
302
-        
303
-        experienceAlert()
304
-        
305
-    }
306
-    
307
-    else {
308
-        
309
     getJsonFromUrl()
357
     getJsonFromUrl()
310
-        
311
-    }
312
     
358
     
313
 }
359
 }

+ 38
- 0
EncuestaMarle/Assets.xcassets/white_black.colorset/Contents.json Wyświetl plik

1
+{
2
+  "info" : {
3
+    "version" : 1,
4
+    "author" : "xcode"
5
+  },
6
+  "colors" : [
7
+    {
8
+      "idiom" : "universal",
9
+      "color" : {
10
+        "color-space" : "srgb",
11
+        "components" : {
12
+          "red" : "1.000",
13
+          "alpha" : "1.000",
14
+          "blue" : "1.000",
15
+          "green" : "1.000"
16
+        }
17
+      }
18
+    },
19
+    {
20
+      "idiom" : "universal",
21
+      "appearances" : [
22
+        {
23
+          "appearance" : "luminosity",
24
+          "value" : "dark"
25
+        }
26
+      ],
27
+      "color" : {
28
+        "color-space" : "srgb",
29
+        "components" : {
30
+          "red" : "0x00",
31
+          "alpha" : "1.000",
32
+          "blue" : "0x00",
33
+          "green" : "0x00"
34
+        }
35
+      }
36
+    }
37
+  ]
38
+}

+ 38
- 0
EncuestaMarle/Assets.xcassets/white_gray.colorset/Contents.json Wyświetl plik

1
+{
2
+  "info" : {
3
+    "version" : 1,
4
+    "author" : "xcode"
5
+  },
6
+  "colors" : [
7
+    {
8
+      "idiom" : "universal",
9
+      "color" : {
10
+        "color-space" : "srgb",
11
+        "components" : {
12
+          "red" : "1.000",
13
+          "alpha" : "1.000",
14
+          "blue" : "1.000",
15
+          "green" : "1.000"
16
+        }
17
+      }
18
+    },
19
+    {
20
+      "idiom" : "universal",
21
+      "appearances" : [
22
+        {
23
+          "appearance" : "luminosity",
24
+          "value" : "dark"
25
+        }
26
+      ],
27
+      "color" : {
28
+        "color-space" : "srgb",
29
+        "components" : {
30
+          "red" : "0x38",
31
+          "alpha" : "1.000",
32
+          "blue" : "0x3B",
33
+          "green" : "0x38"
34
+        }
35
+      }
36
+    }
37
+  ]
38
+}

+ 22
- 15
EncuestaMarle/Base.lproj/Main.storyboard Wyświetl plik

4
     <dependencies>
4
     <dependencies>
5
         <deployment identifier="iOS"/>
5
         <deployment identifier="iOS"/>
6
         <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15510"/>
6
         <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15510"/>
7
+        <capability name="Named colors" minToolsVersion="9.0"/>
7
         <capability name="Safe area layout guides" minToolsVersion="9.0"/>
8
         <capability name="Safe area layout guides" minToolsVersion="9.0"/>
8
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
9
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
9
     </dependencies>
10
     </dependencies>
10
     <scenes>
11
     <scenes>
11
-        <!--Encuesta View Controller-->
12
+        <!--Survey-->
12
         <scene sceneID="tne-QT-ifu">
13
         <scene sceneID="tne-QT-ifu">
13
             <objects>
14
             <objects>
14
                 <viewController id="BYZ-38-t0r" customClass="EncuestaViewController" customModule="Tania" customModuleProvider="target" sceneMemberID="viewController">
15
                 <viewController id="BYZ-38-t0r" customClass="EncuestaViewController" customModule="Tania" customModuleProvider="target" sceneMemberID="viewController">
43
                                 </connections>
44
                                 </connections>
44
                             </button>
45
                             </button>
45
                         </subviews>
46
                         </subviews>
46
-                        <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
47
+                        <color key="backgroundColor" name="white_gray"/>
47
                         <constraints>
48
                         <constraints>
48
                             <constraint firstItem="X5i-Gf-gnI" firstAttribute="leading" secondItem="6Tk-OE-BBY" secondAttribute="leading" constant="35" identifier="Ans2" id="FUW-5x-JJm"/>
49
                             <constraint firstItem="X5i-Gf-gnI" firstAttribute="leading" secondItem="6Tk-OE-BBY" secondAttribute="leading" constant="35" identifier="Ans2" id="FUW-5x-JJm"/>
49
                             <constraint firstItem="X5i-Gf-gnI" firstAttribute="top" secondItem="6Tk-OE-BBY" secondAttribute="top" constant="241" identifier="Ans3" id="Isl-Wl-ceq"/>
50
                             <constraint firstItem="X5i-Gf-gnI" firstAttribute="top" secondItem="6Tk-OE-BBY" secondAttribute="top" constant="241" identifier="Ans3" id="Isl-Wl-ceq"/>
51
                         </constraints>
52
                         </constraints>
52
                         <viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
53
                         <viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
53
                     </view>
54
                     </view>
54
-                    <navigationItem key="navigationItem" id="a31-hX-hUP"/>
55
+                    <navigationItem key="navigationItem" title="Survey" id="a31-hX-hUP"/>
55
                 </viewController>
56
                 </viewController>
56
                 <placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
57
                 <placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
57
             </objects>
58
             </objects>
180
                                 <textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
181
                                 <textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
181
                             </textView>
182
                             </textView>
182
                         </subviews>
183
                         </subviews>
183
-                        <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
184
+                        <color key="backgroundColor" name="white_black"/>
184
                         <constraints>
185
                         <constraints>
185
                             <constraint firstItem="gGJ-33-J27" firstAttribute="top" secondItem="beN-qE-bp8" secondAttribute="bottom" constant="8" identifier="O3" id="4zi-tr-PYm"/>
186
                             <constraint firstItem="gGJ-33-J27" firstAttribute="top" secondItem="beN-qE-bp8" secondAttribute="bottom" constant="8" identifier="O3" id="4zi-tr-PYm"/>
186
                             <constraint firstItem="gGJ-33-J27" firstAttribute="leading" secondItem="BO1-Dh-wF9" secondAttribute="leading" constant="20" identifier="O4" id="CVA-X6-d88"/>
187
                             <constraint firstItem="gGJ-33-J27" firstAttribute="leading" secondItem="BO1-Dh-wF9" secondAttribute="leading" constant="20" identifier="O4" id="CVA-X6-d88"/>
240
                     </tabBar>
241
                     </tabBar>
241
                     <userDefinedRuntimeAttributes>
242
                     <userDefinedRuntimeAttributes>
242
                         <userDefinedRuntimeAttribute type="number" keyPath="selectedIndex">
243
                         <userDefinedRuntimeAttribute type="number" keyPath="selectedIndex">
243
-                            <integer key="value" value="1"/>
244
+                            <integer key="value" value="0"/>
244
                         </userDefinedRuntimeAttribute>
245
                         </userDefinedRuntimeAttribute>
245
                     </userDefinedRuntimeAttributes>
246
                     </userDefinedRuntimeAttributes>
246
                     <connections>
247
                     <connections>
256
         <scene sceneID="VzZ-Qy-O7s">
257
         <scene sceneID="VzZ-Qy-O7s">
257
             <objects>
258
             <objects>
258
                 <navigationController automaticallyAdjustsScrollViewInsets="NO" id="6cF-m5-fPN" sceneMemberID="viewController">
259
                 <navigationController automaticallyAdjustsScrollViewInsets="NO" id="6cF-m5-fPN" sceneMemberID="viewController">
259
-                    <tabBarItem key="tabBarItem" title="Survey" image="tab_activities" id="yyT-tP-N6f"/>
260
+                    <tabBarItem key="tabBarItem" title="Survey" image="pencil" catalog="system" id="yyT-tP-N6f"/>
260
                     <toolbarItems/>
261
                     <toolbarItems/>
261
                     <navigationBar key="navigationBar" contentMode="scaleToFill" id="Kt2-3G-lKB">
262
                     <navigationBar key="navigationBar" contentMode="scaleToFill" id="Kt2-3G-lKB">
262
                         <rect key="frame" x="0.0" y="0.0" width="414" height="44"/>
263
                         <rect key="frame" x="0.0" y="0.0" width="414" height="44"/>
311
                     <tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="49" sectionHeaderHeight="28" sectionFooterHeight="28" id="MXz-QS-IlS">
312
                     <tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="49" sectionHeaderHeight="28" sectionFooterHeight="28" id="MXz-QS-IlS">
312
                         <rect key="frame" x="0.0" y="0.0" width="414" height="736"/>
313
                         <rect key="frame" x="0.0" y="0.0" width="414" height="736"/>
313
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
314
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
314
-                        <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
315
+                        <color key="backgroundColor" name="white_gray"/>
315
                         <view key="tableHeaderView" contentMode="scaleToFill" id="UPL-u9-fkL" customClass="ProfileHeaderView" customModule="Tania" customModuleProvider="target">
316
                         <view key="tableHeaderView" contentMode="scaleToFill" id="UPL-u9-fkL" customClass="ProfileHeaderView" customModule="Tania" customModuleProvider="target">
316
                             <rect key="frame" x="0.0" y="0.0" width="414" height="621"/>
317
                             <rect key="frame" x="0.0" y="0.0" width="414" height="621"/>
317
                             <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
318
                             <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
318
                             <subviews>
319
                             <subviews>
319
-                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="Currently Participating In MARLE" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.80000001192092896" translatesAutoresizingMaskIntoConstraints="NO" id="nI8-Mq-6Bk">
320
-                                    <rect key="frame" x="8" y="16" width="398" height="20.666666666666671"/>
320
+                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="Currently Participating In Tania" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.80000001192092896" translatesAutoresizingMaskIntoConstraints="NO" id="nI8-Mq-6Bk">
321
+                                    <rect key="frame" x="8" y="16" width="398" height="21"/>
321
                                     <fontDescription key="fontDescription" type="system" pointSize="17"/>
322
                                     <fontDescription key="fontDescription" type="system" pointSize="17"/>
322
                                     <nil key="highlightedColor"/>
323
                                     <nil key="highlightedColor"/>
323
                                 </label>
324
                                 </label>
329
                                     <nil key="highlightedColor"/>
330
                                     <nil key="highlightedColor"/>
330
                                 </label>
331
                                 </label>
331
                                 <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="leading" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="We0-cd-h10">
332
                                 <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="leading" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="We0-cd-h10">
332
-                                    <rect key="frame" x="8" y="88.333333333333329" width="398" height="21"/>
333
+                                    <rect key="frame" x="8" y="88.666666666666671" width="398" height="21"/>
333
                                     <fontDescription key="fontDescription" type="system" weight="semibold" pointSize="17"/>
334
                                     <fontDescription key="fontDescription" type="system" weight="semibold" pointSize="17"/>
334
                                     <inset key="contentEdgeInsets" minX="7" minY="0.0" maxX="0.0" maxY="0.0"/>
335
                                     <inset key="contentEdgeInsets" minX="7" minY="0.0" maxX="0.0" maxY="0.0"/>
335
                                     <state key="normal" title="See your Consent Form">
336
                                     <state key="normal" title="See your Consent Form">
340
                                     </connections>
341
                                     </connections>
341
                                 </button>
342
                                 </button>
342
                                 <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="leading" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="wordWrap" translatesAutoresizingMaskIntoConstraints="NO" id="wkQ-h0-GIO">
343
                                 <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="leading" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="wordWrap" translatesAutoresizingMaskIntoConstraints="NO" id="wkQ-h0-GIO">
343
-                                    <rect key="frame" x="8" y="117.33333333333331" width="398" height="41"/>
344
+                                    <rect key="frame" x="8" y="117.66666666666669" width="398" height="41"/>
344
                                     <fontDescription key="fontDescription" type="system" weight="semibold" pointSize="17"/>
345
                                     <fontDescription key="fontDescription" type="system" weight="semibold" pointSize="17"/>
345
                                     <inset key="contentEdgeInsets" minX="10" minY="10" maxX="10" maxY="10"/>
346
                                     <inset key="contentEdgeInsets" minX="10" minY="10" maxX="10" maxY="10"/>
346
                                     <state key="normal" title="Leave Study">
347
                                     <state key="normal" title="Leave Study">
352
                                     </connections>
353
                                     </connections>
353
                                 </button>
354
                                 </button>
354
                             </subviews>
355
                             </subviews>
355
-                            <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
356
+                            <color key="backgroundColor" name="white_gray"/>
356
                             <constraints>
357
                             <constraints>
357
                                 <constraint firstItem="We0-cd-h10" firstAttribute="top" secondItem="nI8-Mq-6Bk" secondAttribute="bottom" constant="51.670000000000002" identifier="S4" id="E85-iU-xtF"/>
358
                                 <constraint firstItem="We0-cd-h10" firstAttribute="top" secondItem="nI8-Mq-6Bk" secondAttribute="bottom" constant="51.670000000000002" identifier="S4" id="E85-iU-xtF"/>
358
                                 <constraint firstAttribute="trailing" secondItem="We0-cd-h10" secondAttribute="trailing" constant="8" identifier="S5" id="KP5-kT-u4x"/>
359
                                 <constraint firstAttribute="trailing" secondItem="We0-cd-h10" secondAttribute="trailing" constant="8" identifier="S5" id="KP5-kT-u4x"/>
392
         <scene sceneID="Hxl-vA-dRR">
393
         <scene sceneID="Hxl-vA-dRR">
393
             <objects>
394
             <objects>
394
                 <navigationController automaticallyAdjustsScrollViewInsets="NO" id="IbW-FC-OA0" sceneMemberID="viewController">
395
                 <navigationController automaticallyAdjustsScrollViewInsets="NO" id="IbW-FC-OA0" sceneMemberID="viewController">
395
-                    <tabBarItem key="tabBarItem" title="Settings" image="tab_profile" id="04I-wD-Xhf"/>
396
+                    <tabBarItem key="tabBarItem" title="Settings" image="gear" catalog="system" id="04I-wD-Xhf"/>
396
                     <toolbarItems/>
397
                     <toolbarItems/>
397
                     <navigationBar key="navigationBar" contentMode="scaleToFill" id="0S4-Xx-Xnh">
398
                     <navigationBar key="navigationBar" contentMode="scaleToFill" id="0S4-Xx-Xnh">
398
                         <rect key="frame" x="0.0" y="0.0" width="414" height="44"/>
399
                         <rect key="frame" x="0.0" y="0.0" width="414" height="44"/>
409
         </scene>
410
         </scene>
410
     </scenes>
411
     </scenes>
411
     <resources>
412
     <resources>
412
-        <image name="tab_activities" width="16" height="16"/>
413
-        <image name="tab_profile" width="16" height="16"/>
413
+        <image name="gear" catalog="system" width="64" height="58"/>
414
+        <image name="pencil" catalog="system" width="64" height="56"/>
415
+        <namedColor name="white_black">
416
+            <color red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
417
+        </namedColor>
418
+        <namedColor name="white_gray">
419
+            <color red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
420
+        </namedColor>
414
     </resources>
421
     </resources>
415
 </document>
422
 </document>

+ 11
- 1
EncuestaMarle/EncuestaViewController.swift Wyświetl plik

26
 var n_jsonDict = [String: Any]()
26
 var n_jsonDict = [String: Any]()
27
 var response_survey = String()
27
 var response_survey = String()
28
 
28
 
29
+var newResponseID: Bool = false
30
+
31
+var response_id: String = "" {
32
+    didSet {
33
+        newResponseID = true
34
+    }
35
+}
36
+
37
+
29
 func getJsonFromUrl(){
38
 func getJsonFromUrl(){
30
     print("entre a getJsonFromUrl ⚠️")
39
     print("entre a getJsonFromUrl ⚠️")
31
     let request = NSMutableURLRequest(url: NSURL(string: "http://tania.uprrp.edu/getSubQ2.php?tk="+token)! as URL, cachePolicy: .reloadIgnoringLocalAndRemoteCacheData, timeoutInterval: 60)
40
     let request = NSMutableURLRequest(url: NSURL(string: "http://tania.uprrp.edu/getSubQ2.php?tk="+token)! as URL, cachePolicy: .reloadIgnoringLocalAndRemoteCacheData, timeoutInterval: 60)
221
         //semaphore.wait()
230
         //semaphore.wait()
222
         if response_survey == "Error:NoHay"{
231
         if response_survey == "Error:NoHay"{
223
             let alertTitle = NSLocalizedString("No Survey", comment: "")
232
             let alertTitle = NSLocalizedString("No Survey", comment: "")
224
-            let alertMessage = NSLocalizedString("There is no survey available right now. Please check later.", comment: "")
233
+            let alertMessage = NSLocalizedString("There is no survey available right now. Please register to an experience or check back later.", comment: "")
225
             let alert = UIAlertController(title: alertTitle, message: alertMessage, preferredStyle: UIAlertController.Style.alert)
234
             let alert = UIAlertController(title: alertTitle, message: alertMessage, preferredStyle: UIAlertController.Style.alert)
226
             alert.addAction(UIAlertAction(title: "OK", style: UIAlertAction.Style.default, handler: nil))
235
             alert.addAction(UIAlertAction(title: "OK", style: UIAlertAction.Style.default, handler: nil))
227
             self.present(alert, animated: true, completion: nil)
236
             self.present(alert, animated: true, completion: nil)
243
 
252
 
244
     }
253
     }
245
     
254
     
255
+    
246
     //override func didwake
256
     //override func didwake
247
 }
257
 }
248
 
258
 

+ 15
- 3
EncuestaMarle/OnboardingViewController.swift Wyświetl plik

43
 var n_jsonDict_reset = [String: Any]()
43
 var n_jsonDict_reset = [String: Any]()
44
 var response_reset = String()
44
 var response_reset = String()
45
 
45
 
46
-var response_id = String()
47
-
48
 func getConsent_task(task: ORKTaskViewController) -> ORKTaskViewController{
46
 func getConsent_task(task: ORKTaskViewController) -> ORKTaskViewController{
49
     return task
47
     return task
50
 }
48
 }
431
                 else {
429
                 else {
432
                     UserDefaults.standard.set(true, forKey: "registered")
430
                     UserDefaults.standard.set(true, forKey: "registered")
433
                     UserDefaults.standard.synchronize()
431
                     UserDefaults.standard.synchronize()
432
+                    
433
+                    // MARK: Restore PDF here
434
+                    
434
                     performSegue(withIdentifier: "unwindToStudy", sender: nil)
435
                     performSegue(withIdentifier: "unwindToStudy", sender: nil)
435
                 }
436
                 }
436
             }
437
             }
454
                         
455
                         
455
                         do {
456
                         do {
456
                             try data?.write(to:docURL! as URL)
457
                             try data?.write(to:docURL! as URL)
457
-                            print("PDF generated ✅")
458
+                            print("PDF written to disk ✅")
458
                             print(docURL! as URL)
459
                             print(docURL! as URL)
459
                             if let pdfBase64 = data?.base64EncodedString() {
460
                             if let pdfBase64 = data?.base64EncodedString() {
460
                                 sendPDF(pdfBase64, signatureDate)
461
                                 sendPDF(pdfBase64, signatureDate)
575
 //        return "id: \(id), constant: \(constant)" //you may print whatever you want here
576
 //        return "id: \(id), constant: \(constant)" //you may print whatever you want here
576
 //    }
577
 //    }
577
 //}
578
 //}
579
+
580
+extension ORKTaskViewController {
581
+    
582
+    override open func viewDidLoad() {
583
+        super.viewDidLoad()
584
+        if #available(iOS 13, *) {
585
+            overrideUserInterfaceStyle = .light
586
+        }
587
+    }
588
+    
589
+}

+ 3
- 0
EncuestaMarle/ResearchContainerViewController.swift Wyświetl plik

119
                 print("❌ User is withdrawing with string: ")
119
                 print("❌ User is withdrawing with string: ")
120
                 print(jsonString_withdraw)
120
                 print(jsonString_withdraw)
121
                 sendJson_withdraw()
121
                 sendJson_withdraw()
122
+                
123
+                UserDefaults.standard.set(false, forKey: "registered")
124
+                UserDefaults.standard.synchronize()
122
             }
125
             }
123
             dismiss(animated: true, completion: nil)
126
             dismiss(animated: true, completion: nil)
124
         }
127
         }