Преглед изворни кода

Fixing conflicts with the Sync Branch.

Iñigo Valentin пре 9 година
родитељ
комит
98c60c1e6f
2 измењених фајлова са 81 додато и 0 уклоњено
  1. 55 0
      app/Base.lproj/Main.storyboard
  2. 26 0
      app/ViewController.swift

+ 55 - 0
app/Base.lproj/Main.storyboard

@@ -188,6 +188,7 @@
                         <segue destination="UkS-wI-Yhx" kind="show" identifier="SeguePost" id="gs2-jd-cPW"/>
                         <segue destination="k0M-Sk-DZM" kind="show" identifier="SegueAlbum" id="Puc-tv-vaD"/>
                         <segue destination="zJF-Mh-CNb" kind="show" identifier="SegueSchedule" id="A70-jo-yAP"/>
+                        <segue destination="3o1-ab-AT4" kind="show" identifier="SegueSync" id="E96-mK-gE9"/>
                     </connections>
                 </viewController>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
@@ -953,6 +954,60 @@
             </objects>
             <point key="canvasLocation" x="-2839" y="1801"/>
         </scene>
+        <!--Sync-->
+        <scene sceneID="cqg-BI-2xm">
+            <objects>
+                <viewController title="Sync" id="3o1-ab-AT4" sceneMemberID="viewController">
+                    <layoutGuides>
+                        <viewControllerLayoutGuide type="top" id="RYy-ax-Nya"/>
+                        <viewControllerLayoutGuide type="bottom" id="rXD-89-8EQ"/>
+                    </layoutGuides>
+                    <view key="view" contentMode="scaleToFill" id="aKm-vb-AZR">
+                        <rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
+                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                        <subviews>
+                            <imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="Logo" translatesAutoresizingMaskIntoConstraints="NO" id="dxh-Z0-luU">
+                                <rect key="frame" x="48" y="242.5" width="224" height="83"/>
+                            </imageView>
+                            <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Sincronizando..." textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="up0-1V-tTd">
+                                <rect key="frame" x="0.0" y="335.5" width="320" height="30"/>
+                                <constraints>
+                                    <constraint firstAttribute="height" constant="30" id="mIj-oN-tq7"/>
+                                </constraints>
+                                <fontDescription key="fontDescription" type="system" pointSize="17"/>
+                                <nil key="textColor"/>
+                                <nil key="highlightedColor"/>
+                            </label>
+                            <progressView opaque="NO" contentMode="scaleToFill" verticalHuggingPriority="750" progress="0.5" translatesAutoresizingMaskIntoConstraints="NO" id="VkR-DT-y3S">
+                                <rect key="frame" x="48" y="375.5" width="224" height="2"/>
+                            </progressView>
+                            <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Message" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="pgU-dx-MvQ">
+                                <rect key="frame" x="48" y="385.5" width="224" height="18"/>
+                                <fontDescription key="fontDescription" type="italicSystem" pointSize="15"/>
+                                <color key="textColor" red="0.31238102791878175" green="0.31238102791878175" blue="0.31238102791878175" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                <nil key="highlightedColor"/>
+                            </label>
+                        </subviews>
+                        <color key="backgroundColor" red="0.70980392160000005" green="0.82745098039999998" blue="0.8980392157" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                        <constraints>
+                            <constraint firstItem="VkR-DT-y3S" firstAttribute="top" secondItem="up0-1V-tTd" secondAttribute="bottom" constant="10" id="2jT-Qj-SnX"/>
+                            <constraint firstItem="VkR-DT-y3S" firstAttribute="width" secondItem="dxh-Z0-luU" secondAttribute="width" id="5pk-5G-ix0"/>
+                            <constraint firstItem="up0-1V-tTd" firstAttribute="centerX" secondItem="dxh-Z0-luU" secondAttribute="centerX" id="C1h-cG-8Sx"/>
+                            <constraint firstItem="pgU-dx-MvQ" firstAttribute="centerX" secondItem="VkR-DT-y3S" secondAttribute="centerX" id="QB4-zO-roz"/>
+                            <constraint firstItem="dxh-Z0-luU" firstAttribute="width" secondItem="aKm-vb-AZR" secondAttribute="width" multiplier="0.7" id="UXD-fj-qLn"/>
+                            <constraint firstItem="dxh-Z0-luU" firstAttribute="centerY" secondItem="aKm-vb-AZR" secondAttribute="centerY" id="aC5-zC-5I4"/>
+                            <constraint firstItem="up0-1V-tTd" firstAttribute="width" secondItem="aKm-vb-AZR" secondAttribute="width" id="c7R-MO-YhC"/>
+                            <constraint firstItem="pgU-dx-MvQ" firstAttribute="width" secondItem="VkR-DT-y3S" secondAttribute="width" id="dUS-Vx-M16"/>
+                            <constraint firstItem="VkR-DT-y3S" firstAttribute="centerX" secondItem="dxh-Z0-luU" secondAttribute="centerX" id="dfj-BN-WnD"/>
+                            <constraint firstItem="dxh-Z0-luU" firstAttribute="centerX" secondItem="aKm-vb-AZR" secondAttribute="centerX" id="uFb-fC-wRh"/>
+                            <constraint firstItem="up0-1V-tTd" firstAttribute="top" secondItem="dxh-Z0-luU" secondAttribute="bottom" constant="10" id="wY9-12-hcE"/>
+                            <constraint firstItem="pgU-dx-MvQ" firstAttribute="top" secondItem="VkR-DT-y3S" secondAttribute="bottom" constant="8" id="wts-Yk-LsB"/>
+                        </constraints>
+                    </view>
+                </viewController>
+                <placeholder placeholderIdentifier="IBFirstResponder" id="fRm-1Y-Xmm" userLabel="First Responder" sceneMemberID="firstResponder"/>
+            </objects>
+        </scene>
     </scenes>
     <resources>
         <image name="Logo" width="83" height="83"/>

+ 26 - 0
app/ViewController.swift

@@ -93,6 +93,29 @@ class ViewController: UIViewController, UICollectionViewDataSource, UICollection
 		performSegue(withIdentifier: "SegueSchedule", sender: nil)
 	}
 	
+	/**
+	 Handles the initial sync process.
+	 It can start it, showing the sync screen, or finish it, hidding the screen.
+	 :param: showScreen True to start the sync, false to end it.
+	*/
+	func initialSync(showScreen: Bool){
+		if showScreen == true{
+			NSLog(":CONTROLLER:DEBUG: Showing initial sync screen.")
+			performSegue(withIdentifier: "SegueSync", sender: nil)
+			Sync(synchronous: true)
+		}
+		else{
+			NSLog(":CONTROLLER:DEBUG: Hidding initial sync screen.")
+			syncSegue?.destination.dismiss(animated: true, completion: nil)
+		}
+	}
+	
+	/**
+	 Run before performing a segue.
+	 Assigns id if neccessary.
+	 :param: segue The segue to perform.
+	 :sender: The calling view.
+	*/
 	override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
 		NSLog(":CONTROLLER:DEBUG: preparing for segue '\(segue.identifier)' with id \(self.passId)")
 		if segue.identifier == "SeguePost"{
@@ -109,6 +132,9 @@ class ViewController: UIViewController, UICollectionViewDataSource, UICollection
 				(segue.destination as! ScheduleViewController).margolari = false
 			}
 		}
+		if segue.identifier == "SegueSync"{
+			self.syncSegue = segue
+		}
 	}
 	
 	/**