Просмотр исходного кода

Changes to the datamodel. Prepared to reload sections after sync.

Iñigo Valentin 9 лет назад
Родитель
Сommit
67fd661734
3 измененных файлов с 15 добавлено и 4 удалено
  1. 1 1
      app/Sync.swift
  2. 4 2
      app/ViewController.swift
  3. 10 1
      app/app.xcdatamodeld/app.xcdatamodel/contents

+ 1 - 1
app/Sync.swift

@@ -1763,7 +1763,7 @@ class Sync{
 			// Get day
 			// Special item, not in the sync content
 			dateFormatter.dateFormat = "yyyy-MM-dd"
-			var day = dateFormatter.date(from: str.subStr(start : str.indexOf(target : "\"start\":")! + 9, end : str.indexOf(target : ",\"")! - 2))!
+			var day = dateFormatter.date(from: str.subStr(start : str.indexOf(target : "\"start\":")! + 9, end : str.indexOf(target : ",\"")! - 11))!
 			// If on the first hours of the next day...
 			let calendar = Calendar.current
 			let hours = calendar.component(.hour, from: day as! Date)

+ 4 - 2
app/ViewController.swift

@@ -105,7 +105,9 @@ class ViewController: UIViewController, UICollectionViewDataSource, UICollection
 			Sync(synchronous: true)
 		}
 		else{
-			NSLog(":CONTROLLER:DEBUG: Hidding initial sync screen.")
+			NSLog(":CONTROLLER:DEBUG: Re-populating views and hidding initial sync screen.")
+			NSLog(":CONTROLLER:DEBUG: Re-populating disabled: Throws error.")
+			//populate()
 			syncSegue?.destination.dismiss(animated: true, completion: nil)
 		}
 	}
@@ -163,7 +165,7 @@ class ViewController: UIViewController, UICollectionViewDataSource, UICollection
 	}
 
 	func populate(){
-		self.containerViewHome.populate()
+		//self.containerViewHome.populate()
 		//self.containerLocation.populate()
 		//self.containerLablanca.populate()
 		self.containerViewActivities.populate()

+ 10 - 1
app/app.xcdatamodeld/app.xcdatamodel/contents

@@ -84,6 +84,7 @@
         <attribute name="price" optional="YES" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="YES" syncable="YES"/>
     </entity>
     <entity name="Festival_event" representedClassName=".Festival_event" syncable="YES" codeGenerationType="class">
+        <attribute name="day" optional="YES" attributeType="Date" usesScalarValueType="NO" syncable="YES"/>
         <attribute name="description_en" optional="YES" attributeType="String" syncable="YES"/>
         <attribute name="description_es" optional="YES" attributeType="String" syncable="YES"/>
         <attribute name="description_eu" optional="YES" attributeType="String" syncable="YES"/>
@@ -134,6 +135,13 @@
         <attribute name="title_es" optional="YES" attributeType="String" syncable="YES"/>
         <attribute name="title_eu" optional="YES" attributeType="String" syncable="YES"/>
     </entity>
+    <entity name="People" representedClassName="People" syncable="YES" codeGenerationType="class">
+        <attribute name="id" optional="YES" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="YES" syncable="YES"/>
+        <attribute name="link" optional="YES" attributeType="String" syncable="YES"/>
+        <attribute name="name_en" optional="YES" attributeType="String" syncable="YES"/>
+        <attribute name="name_es" optional="YES" attributeType="String" syncable="YES"/>
+        <attribute name="name_eu" optional="YES" attributeType="String" syncable="YES"/>
+    </entity>
     <entity name="Photo" representedClassName=".Photo" syncable="YES" codeGenerationType="class">
         <attribute name="description_en" optional="YES" attributeType="String" syncable="YES"/>
         <attribute name="description_es" optional="YES" attributeType="String" syncable="YES"/>
@@ -228,7 +236,7 @@
         <element name="Album" positionX="18" positionY="-3861" width="128" height="195"/>
         <element name="Festival" positionX="36" positionY="-3852" width="128" height="180"/>
         <element name="Festival_day" positionX="-9" positionY="-3906" width="128" height="135"/>
-        <element name="Festival_event" positionX="0" positionY="-3897" width="128" height="225"/>
+        <element name="Festival_event" positionX="0" positionY="-3897" width="128" height="240"/>
         <element name="Festival_event_image" positionX="9" positionY="-3888" width="128" height="105"/>
         <element name="Festival_offer" positionX="18" positionY="-3879" width="128" height="195"/>
         <element name="Location" positionX="27" positionY="-3870" width="128" height="90"/>
@@ -242,5 +250,6 @@
         <element name="Post_tag" positionX="45" positionY="-3852" width="128" height="75"/>
         <element name="Sponsor" positionX="-9" positionY="-3906" width="128" height="255"/>
         <element name="Version" positionX="-9" positionY="-3906" width="128" height="75"/>
+        <element name="People" positionX="-9" positionY="-3906" width="128" height="120"/>
     </elements>
 </model>