Эх сурвалжийг харах

Merge branch 'BaseProject' into LaBlanca

Iñigo Valentin 9 жил өмнө
parent
commit
d7bfba944c
51 өөрчлөгдсөн 1747 нэмэгдсэн , 602 устгасан
  1. 8 8
      README.es-ES.md
  2. 7 8
      README.es-EU.md
  3. 7 8
      README.md
  4. 16 0
      app.xcodeproj/project.pbxproj
  5. 0 1
      app/ActivitiesView.swift
  6. 51 11
      app/AlbumViewController.swift
  7. 14 0
      app/AppDelegate.swift
  8. 173 136
      app/Base.lproj/Main.storyboard
  9. 3 3
      app/BlogView.swift
  10. 0 1
      app/FetchLocation.swift
  11. 309 0
      app/FutureActivityViewController.swift
  12. 1 3
      app/GalleryView.swift
  13. 3 3
      app/GalleryView.xib
  14. 18 5
      app/HomeView.swift
  15. 2 2
      app/Info.plist
  16. 0 6
      app/LablancaView.swift
  17. 1 6
      app/LocationView.swift
  18. 3 3
      app/LocationView.xib
  19. 223 0
      app/Notifications.swift
  20. 2 5
      app/PastActivityViewController.swift
  21. 156 39
      app/PhotoViewController.swift
  22. 2 5
      app/PostViewController.swift
  23. 3 8
      app/RowAlbum.swift
  24. 1 2
      app/RowBlog.swift
  25. 1 1
      app/RowBlog.xib
  26. 2 3
      app/RowFutureActivity.swift
  27. 19 18
      app/RowFutureActivity.xib
  28. 1 3
      app/RowGallery.swift
  29. 0 1
      app/RowHomeBlog.swift
  30. 109 109
      app/RowHomeBlog.xib
  31. 0 1
      app/RowHomeFutureActivities.swift
  32. 109 109
      app/RowHomeFutureActivities.xib
  33. 70 1
      app/RowHomeGallery.swift
  34. 2 2
      app/RowHomeGallery.xib
  35. 1 2
      app/RowHomePastActivities.swift
  36. 10 5
      app/RowHomePastActivities.xib
  37. 1 1
      app/RowHomeSocial.swift
  38. 168 0
      app/RowItinerary.swift
  39. 139 0
      app/RowItinerary.xib
  40. 1 1
      app/RowLabel.swift
  41. 1 1
      app/RowLablancaDay.swift
  42. 1 2
      app/RowLablancaOffer.swift
  43. 0 1
      app/RowPastActivity.swift
  44. 3 3
      app/RowPastActivity.xib
  45. 2 8
      app/RowSchedule.swift
  46. 2 3
      app/ScheduleViewController.swift
  47. 17 7
      app/Sync.swift
  48. 72 5
      app/SyncController.swift
  49. 2 6
      app/UIImageView.swift
  50. 0 1
      app/UIView.swift
  51. 11 45
      app/ViewController.swift

+ 8 - 8
README.es-ES.md

@@ -11,17 +11,16 @@ Una aplicacion para iOS para miembros de [Gasteizko Margolariak](https://margola
 
 
 Hay funciones diseñadas especificamente para las Fiestas de La Blanca, y solo estarán disponibles en esas fechas.
 Hay funciones diseñadas especificamente para las Fiestas de La Blanca, y solo estarán disponibles en esas fechas.
 
 
-* [NO IMPLEMENTADO] Consulta en tu teléfono el Programa de Fiestas, encuentra actos alrededor tuyo ydescubre como llegar hasta ellos.
+* Consulta en tu teléfono el Programa de Fiestas, encuentra actos alrededor tuyo ydescubre como llegar hasta ellos.
 * Consulta el Programa de Fiestas de Gasteizko Margolariak, detallado y con la ubicación de cada actividad...
 * Consulta el Programa de Fiestas de Gasteizko Margolariak, detallado y con la ubicación de cada actividad...
 * ... pero, como no somos famosos por nuestra puntualidad, comprueba nuestra ubicación en tiempo real.
 * ... pero, como no somos famosos por nuestra puntualidad, comprueba nuestra ubicación en tiempo real.
-* [NO IMPLEMENTADO] Descubre eventos a tu alrededor.
 
 
 
 
 ### Durante el resto del año ###
 ### Durante el resto del año ###
 
 
-* [PARCIALMENTE IMPLEMENTADO] Mantente informado de las actividades que organizamos durante el resto del año.
-* [PARCIALMENTE IMPLEMENTADO] Recibe las ultimas noticias sobre la Cuadrilla en nuestro Blog
-* [PARCIALMENTE IMPLEMENTADO] Galería de fotos de todas nuestras actividades.
+* Mantente informado de las actividades que organizamos durante el resto del año.
+* Recibe las ultimas noticias sobre la Cuadrilla en nuestro Blog
+* Galería de fotos de todas nuestras actividades.
 
 
 
 
 ### Compatibilidad ###
 ### Compatibilidad ###
@@ -31,9 +30,9 @@ iOS 9.1 o superior.
 
 
 ### Idiomas ###
 ### Idiomas ###
 
 
-* [IMPLEMENTADO] Castellano
-* [NO IMPLEMENTADO] Inglés
-* [NO IMPLEMENTADO] Euskera 
+* Castellano
+* [PARCIALMENTE] Inglés
+* [PARCIALMENTE] Euskera 
 
 
 
 
 ### Otros dispositivos ###
 ### Otros dispositivos ###
@@ -41,3 +40,4 @@ iOS 9.1 o superior.
 * ¿Android? [Lo tenemos!](https://github.com/GasteizkoMargolariak/GasteizkoMargolariakApp) 
 * ¿Android? [Lo tenemos!](https://github.com/GasteizkoMargolariak/GasteizkoMargolariakApp) 
 * ¿Prefieres el sitio web? [No problem!](https://github.com/GasteizkoMargolariak/GasteizkoMargolariakWeb)
 * ¿Prefieres el sitio web? [No problem!](https://github.com/GasteizkoMargolariak/GasteizkoMargolariakWeb)
 
 
+

+ 7 - 8
README.es-EU.md

@@ -11,17 +11,16 @@ Una aplicacion para iOS para miembros de [Gasteizko Margolariak](https://margola
 
 
 Hay funciones diseñadas especificamente para las Fiestas de La Blanca, y solo estarán disponibles en esas fechas.
 Hay funciones diseñadas especificamente para las Fiestas de La Blanca, y solo estarán disponibles en esas fechas.
 
 
-* [NO IMPLEMENTADO] Consulta en tu teléfono el Programa de Fiestas, encuentra actos alrededor tuyo ydescubre como llegar hasta ellos.
+* Consulta en tu teléfono el Programa de Fiestas, encuentra actos alrededor tuyo ydescubre como llegar hasta ellos.
 * Consulta el Programa de Fiestas de Gasteizko Margolariak, detallado y con la ubicación de cada actividad...
 * Consulta el Programa de Fiestas de Gasteizko Margolariak, detallado y con la ubicación de cada actividad...
 * ... pero, como no somos famosos por nuestra puntualidad, comprueba nuestra ubicación en tiempo real.
 * ... pero, como no somos famosos por nuestra puntualidad, comprueba nuestra ubicación en tiempo real.
-* Descubre eventos a tu alrededor.
 
 
 
 
 ### Durante el resto del año ###
 ### Durante el resto del año ###
 
 
-* [PARCIALMENTE IMPLEMENTADO] Mantente informado de las actividades que organizamos durante el resto del año.
-* [PARCIALMENTE IMPLEMENTADO] Recibe las ultimas noticias sobre la Cuadrilla en nuestro Blog
-* [PARCIALMENTE IMPLEMENTADO] Galería de fotos de todas nuestras actividades.
+* Mantente informado de las actividades que organizamos durante el resto del año.
+* Recibe las ultimas noticias sobre la Cuadrilla en nuestro Blog
+* Galería de fotos de todas nuestras actividades.
 
 
 
 
 ### Compatibilidad ###
 ### Compatibilidad ###
@@ -31,9 +30,9 @@ iOS 9.1 o superior.
 
 
 ### Idiomas ###
 ### Idiomas ###
 
 
-* [IMPLEMENTADO] Castellano
-* [NO IMPLEMENTADO] Inglés
-* [NO IMPLEMENTADO] Euskera 
+* Castellano
+* [PARCIALMENTE] Inglés
+* [PARCIALMENTE] Euskera 
 
 
 
 
 ### Otros dispositivos ###
 ### Otros dispositivos ###

+ 7 - 8
README.md

@@ -11,17 +11,16 @@ An iOS app intended for members of [Gasteizko Margolariak](https://margolariak.c
 
 
 This features will be only available during the city festivals.
 This features will be only available during the city festivals.
 
 
-* [TODO] Check out the festival schedule, discover events all around the city, and get their location.
+* Check out the festival schedule, discover events all around the city, and get their location.
 * Check out the schedule for the members of Gasteizko Margolariak, indicating the location of every event and activity...
 * Check out the schedule for the members of Gasteizko Margolariak, indicating the location of every event and activity...
 * ... but, since we are not known for our puntuality, check out the location of Gasteizko Margolariak in real time.
 * ... but, since we are not known for our puntuality, check out the location of Gasteizko Margolariak in real time.
-* [TODO] Approximate distance to important event around the city.
 
 
 
 
 ### Features for the rest of the year ###
 ### Features for the rest of the year ###
 
 
-* [PARTIALLY IMPLEMENTED] Check out and be notified of all activities organized by Gasteizko Margolariak.
-* [MOSTLY IMPLEMENTED] Stay updated witho our blog.
-* [MOSTLY IMPLEMENTED] Check out our photo gallery.
+* Check out and be notified of all activities organized by Gasteizko Margolariak.
+* Stay updated witho our blog.
+* Check out our photo gallery.
 
 
 
 
 ### Compatibility ###
 ### Compatibility ###
@@ -31,9 +30,9 @@ iOS 9.1 or higher.
 
 
 ### Languages ###
 ### Languages ###
 
 
-* [AVAILABLE] Spanish
-* [TODO] English
-* [TODO] Basque
+* Spanish
+* [PARTIALLY] English
+* [PARTIALLY] Basque
 
 
 
 
 ### On other devices ###
 ### On other devices ###

+ 16 - 0
app.xcodeproj/project.pbxproj

@@ -68,6 +68,10 @@
 		93BAD2F61E586310009DF853 /* RowHomeSocial.xib in Resources */ = {isa = PBXBuildFile; fileRef = 93BAD2F51E586310009DF853 /* RowHomeSocial.xib */; };
 		93BAD2F61E586310009DF853 /* RowHomeSocial.xib in Resources */ = {isa = PBXBuildFile; fileRef = 93BAD2F51E586310009DF853 /* RowHomeSocial.xib */; };
 		93BAD2F81E586741009DF853 /* RowHomeSocial.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93BAD2F71E586741009DF853 /* RowHomeSocial.swift */; };
 		93BAD2F81E586741009DF853 /* RowHomeSocial.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93BAD2F71E586741009DF853 /* RowHomeSocial.swift */; };
 		93BEB6D21E7E878300C68DE5 /* PostViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93BEB6D11E7E878300C68DE5 /* PostViewController.swift */; };
 		93BEB6D21E7E878300C68DE5 /* PostViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93BEB6D11E7E878300C68DE5 /* PostViewController.swift */; };
+		93D8B0941EF1A64C008BD946 /* Notifications.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93D8B0931EF1A64C008BD946 /* Notifications.swift */; };
+		93D8B0961EF1B98E008BD946 /* FutureActivityViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93D8B0951EF1B98E008BD946 /* FutureActivityViewController.swift */; };
+		93D8B0981EF1B99A008BD946 /* RowItinerary.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93D8B0971EF1B99A008BD946 /* RowItinerary.swift */; };
+		93D8B09A1EF1BA03008BD946 /* RowItinerary.xib in Resources */ = {isa = PBXBuildFile; fileRef = 93D8B0991EF1BA03008BD946 /* RowItinerary.xib */; };
 		93D9EA601DE271E700089002 /* Section.xib in Resources */ = {isa = PBXBuildFile; fileRef = 93D9EA5F1DE271E700089002 /* Section.xib */; };
 		93D9EA601DE271E700089002 /* Section.xib in Resources */ = {isa = PBXBuildFile; fileRef = 93D9EA5F1DE271E700089002 /* Section.xib */; };
 		93D9EA641DE273FD00089002 /* Section.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93D9EA631DE273FD00089002 /* Section.swift */; };
 		93D9EA641DE273FD00089002 /* Section.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93D9EA631DE273FD00089002 /* Section.swift */; };
 		93D9EA681DE342AC00089002 /* UIView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93D9EA671DE342AC00089002 /* UIView.swift */; };
 		93D9EA681DE342AC00089002 /* UIView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93D9EA671DE342AC00089002 /* UIView.swift */; };
@@ -155,6 +159,10 @@
 		93BAD2F51E586310009DF853 /* RowHomeSocial.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = RowHomeSocial.xib; sourceTree = "<group>"; };
 		93BAD2F51E586310009DF853 /* RowHomeSocial.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = RowHomeSocial.xib; sourceTree = "<group>"; };
 		93BAD2F71E586741009DF853 /* RowHomeSocial.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RowHomeSocial.swift; sourceTree = "<group>"; };
 		93BAD2F71E586741009DF853 /* RowHomeSocial.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RowHomeSocial.swift; sourceTree = "<group>"; };
 		93BEB6D11E7E878300C68DE5 /* PostViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PostViewController.swift; sourceTree = "<group>"; };
 		93BEB6D11E7E878300C68DE5 /* PostViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PostViewController.swift; sourceTree = "<group>"; };
+		93D8B0931EF1A64C008BD946 /* Notifications.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Notifications.swift; sourceTree = "<group>"; };
+		93D8B0951EF1B98E008BD946 /* FutureActivityViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FutureActivityViewController.swift; sourceTree = "<group>"; };
+		93D8B0971EF1B99A008BD946 /* RowItinerary.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RowItinerary.swift; sourceTree = "<group>"; };
+		93D8B0991EF1BA03008BD946 /* RowItinerary.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = RowItinerary.xib; sourceTree = "<group>"; };
 		93D9EA5F1DE271E700089002 /* Section.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = Section.xib; path = ../Section.xib; sourceTree = "<group>"; };
 		93D9EA5F1DE271E700089002 /* Section.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = Section.xib; path = ../Section.xib; sourceTree = "<group>"; };
 		93D9EA631DE273FD00089002 /* Section.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Section.swift; sourceTree = "<group>"; };
 		93D9EA631DE273FD00089002 /* Section.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Section.swift; sourceTree = "<group>"; };
 		93D9EA671DE342AC00089002 /* UIView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIView.swift; sourceTree = "<group>"; };
 		93D9EA671DE342AC00089002 /* UIView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIView.swift; sourceTree = "<group>"; };
@@ -225,6 +233,7 @@
 		93B84B981D9C31AB006C0F67 /* app */ = {
 		93B84B981D9C31AB006C0F67 /* app */ = {
 			isa = PBXGroup;
 			isa = PBXGroup;
 			children = (
 			children = (
+				93D8B0931EF1A64C008BD946 /* Notifications.swift */,
 				93B84BA81D9C31AB006C0F67 /* Info.plist */,
 				93B84BA81D9C31AB006C0F67 /* Info.plist */,
 				93B84BA31D9C31AB006C0F67 /* Assets.xcassets */,
 				93B84BA31D9C31AB006C0F67 /* Assets.xcassets */,
 				93B84BA01D9C31AB006C0F67 /* app.xcdatamodeld */,
 				93B84BA01D9C31AB006C0F67 /* app.xcdatamodeld */,
@@ -289,6 +298,9 @@
 				93B9113E1ED7582B0061BA71 /* LocationView.swift */,
 				93B9113E1ED7582B0061BA71 /* LocationView.swift */,
 				93B9115E1ED765510061BA71 /* app-Bridging-Header.h */,
 				93B9115E1ED765510061BA71 /* app-Bridging-Header.h */,
 				93EE9ECA1EE9B87100288F6E /* PastActivityViewController.swift */,
 				93EE9ECA1EE9B87100288F6E /* PastActivityViewController.swift */,
+				93D8B0971EF1B99A008BD946 /* RowItinerary.swift */,
+				93D8B0991EF1BA03008BD946 /* RowItinerary.xib */,
+				93D8B0951EF1B98E008BD946 /* FutureActivityViewController.swift */,
 				93E5058E1EEB0DCC00560B4A /* PhotoViewController.swift */,
 				93E5058E1EEB0DCC00560B4A /* PhotoViewController.swift */,
 			);
 			);
 			path = app;
 			path = app;
@@ -387,6 +399,7 @@
 			files = (
 			files = (
 				93E0C5E21EB7E7F000905811 /* ActivitiesView.xib in Resources */,
 				93E0C5E21EB7E7F000905811 /* ActivitiesView.xib in Resources */,
 				931AA5AE1E218D0E003A2290 /* Entry.xib in Resources */,
 				931AA5AE1E218D0E003A2290 /* Entry.xib in Resources */,
+				93D8B09A1EF1BA03008BD946 /* RowItinerary.xib in Resources */,
 				93E0C5E81EBDF0E700905811 /* RowFutureActivity.xib in Resources */,
 				93E0C5E81EBDF0E700905811 /* RowFutureActivity.xib in Resources */,
 				938D211D1EA2275300C47EC3 /* LablancaView.xib in Resources */,
 				938D211D1EA2275300C47EC3 /* LablancaView.xib in Resources */,
 				93075C721E59D06900396389 /* RowBlog.xib in Resources */,
 				93075C721E59D06900396389 /* RowBlog.xib in Resources */,
@@ -435,15 +448,18 @@
 				93294FFA1E337D0D00FDAF50 /* RowHomePastActivities.swift in Sources */,
 				93294FFA1E337D0D00FDAF50 /* RowHomePastActivities.swift in Sources */,
 				93B5C01A1E872B4B0069BFF8 /* RowHomeGallery.swift in Sources */,
 				93B5C01A1E872B4B0069BFF8 /* RowHomeGallery.swift in Sources */,
 				935892D01E493C2300E1CD5F /* UIImageView.swift in Sources */,
 				935892D01E493C2300E1CD5F /* UIImageView.swift in Sources */,
+				93D8B0981EF1B99A008BD946 /* RowItinerary.swift in Sources */,
 				93D9EA761DE3ACBB00089002 /* Sync.swift in Sources */,
 				93D9EA761DE3ACBB00089002 /* Sync.swift in Sources */,
 				93E0C5EA1EBDFFB400905811 /* RowPastActivity.swift in Sources */,
 				93E0C5EA1EBDFFB400905811 /* RowPastActivity.swift in Sources */,
 				93BAD2F41E585EE6009DF853 /* RowHomeFutureActivities.swift in Sources */,
 				93BAD2F41E585EE6009DF853 /* RowHomeFutureActivities.swift in Sources */,
 				93E5058F1EEB0DCC00560B4A /* PhotoViewController.swift in Sources */,
 				93E5058F1EEB0DCC00560B4A /* PhotoViewController.swift in Sources */,
+				93D8B0941EF1A64C008BD946 /* Notifications.swift in Sources */,
 				931AA5891E1AFF8C003A2290 /* String.swift in Sources */,
 				931AA5891E1AFF8C003A2290 /* String.swift in Sources */,
 				935AE18A1EC6138D0055E71F /* SyncController.swift in Sources */,
 				935AE18A1EC6138D0055E71F /* SyncController.swift in Sources */,
 				93B84B9C1D9C31AB006C0F67 /* ViewController.swift in Sources */,
 				93B84B9C1D9C31AB006C0F67 /* ViewController.swift in Sources */,
 				93075C6C1E59CB6B00396389 /* BlogView.swift in Sources */,
 				93075C6C1E59CB6B00396389 /* BlogView.swift in Sources */,
 				93B84B9A1D9C31AB006C0F67 /* AppDelegate.swift in Sources */,
 				93B84B9A1D9C31AB006C0F67 /* AppDelegate.swift in Sources */,
+				93D8B0961EF1B98E008BD946 /* FutureActivityViewController.swift in Sources */,
 				93B84BA21D9C31AB006C0F67 /* app.xcdatamodeld in Sources */,
 				93B84BA21D9C31AB006C0F67 /* app.xcdatamodeld in Sources */,
 				935D6E331E867C7E00CED3A1 /* RowGallery.swift in Sources */,
 				935D6E331E867C7E00CED3A1 /* RowGallery.swift in Sources */,
 				93EB2F0C1EBF5AEB00F64186 /* RowSchedule.swift in Sources */,
 				93EB2F0C1EBF5AEB00F64186 /* RowSchedule.swift in Sources */,

+ 0 - 1
app/ActivitiesView.swift

@@ -89,7 +89,6 @@ class ActivitiesView: UIView {
 		do {
 		do {
 			let searchResults = try self.context?.fetch(fetchRequest)
 			let searchResults = try self.context?.fetch(fetchRequest)
 			if searchResults?.count == 0{
 			if searchResults?.count == 0{
-				NSLog(":ACTIVITIES:DEBUG: No future activities: \(String(describing: searchResults?.count))")
 				let row: RowLabel = RowLabel.init(s: "rowFutureActivity0", i: 0)
 				let row: RowLabel = RowLabel.init(s: "rowFutureActivity0", i: 0)
 				row.setText(text: "No hay actividades planeadas proximamente. Pronto organizaremos algo!")
 				row.setText(text: "No hay actividades planeadas proximamente. Pronto organizaremos algo!")
 				self.futureList?.addArrangedSubview(row)
 				self.futureList?.addArrangedSubview(row)

+ 51 - 11
app/AlbumViewController.swift

@@ -40,6 +40,7 @@ class AlbumViewController: UIViewController, UIGestureRecognizerDelegate {
 	
 	
 	// Id received from segue.
 	// Id received from segue.
 	var passId: Int = -1
 	var passId: Int = -1
+	var passAlbum: Int = -1
 	
 	
 	
 	
 	/**
 	/**
@@ -61,6 +62,27 @@ class AlbumViewController: UIViewController, UIGestureRecognizerDelegate {
 		
 		
 		// Set button action
 		// Set button action
 		barButton.addTarget(self, action: #selector(self.back), for: .touchUpInside)
 		barButton.addTarget(self, action: #selector(self.back), for: .touchUpInside)
+		
+		// Set this controller in the delegate
+		self.delegate = UIApplication.shared.delegate as? AppDelegate
+		self.delegate?.albumController = self
+		
+		// Get album title
+		let context = NSManagedObjectContext(concurrencyType: .privateQueueConcurrencyType)
+		let appDelegate = UIApplication.shared.delegate as! AppDelegate
+		let lang : String = getLanguage()
+		context.persistentStoreCoordinator = appDelegate.persistentStoreCoordinator
+		let fetchRequest: NSFetchRequest<Album> = Album.fetchRequest()
+		fetchRequest.predicate = NSPredicate(format: "id = %i", id)
+		do {
+			let results = try context.fetch(fetchRequest)
+			let r = results[0]
+			let title: String = r.value(forKey: "title_\(lang)")! as! String
+			self.albumTitle.text = " \(title.decode().stripHtml())"
+		}
+		catch {
+			NSLog(":GALLERYCONTROLLER:ERROR: Error getting album info: \(error)")
+		}
 	}
 	}
 	
 	
 	
 	
@@ -102,8 +124,6 @@ class AlbumViewController: UIViewController, UIGestureRecognizerDelegate {
 			let searchResults = try context.fetch(fetchRequest)
 			let searchResults = try context.fetch(fetchRequest)
 			var image: String
 			var image: String
 			
 			
-			NSLog(":GALLERYCONTROLLER:DEBUG: Total photos: \(searchResults.count)")
-			
 			for i in (0..<searchResults.count) where i % 2 == 0 {
 			for i in (0..<searchResults.count) where i % 2 == 0 {
 				
 				
 				var r = searchResults[i]
 				var r = searchResults[i]
@@ -126,7 +146,6 @@ class AlbumViewController: UIViewController, UIGestureRecognizerDelegate {
 					var imgR = imgSearchResults[0]
 					var imgR = imgSearchResults[0]
 					image = imgR.value(forKey: "file")! as! String
 					image = imgR.value(forKey: "file")! as! String
 					leftId = imgR.value(forKey: "id")! as! Int
 					leftId = imgR.value(forKey: "id")! as! Int
-					NSLog(":GALLERYCONTROLLER:LOG: Image Row \(i) left: \(image)")
 					row.setImage(idx: 0, filename: image)
 					row.setImage(idx: 0, filename: image)
 					if i + 1 < searchResults.count {
 					if i + 1 < searchResults.count {
 						r = searchResults[i + 1]
 						r = searchResults[i + 1]
@@ -139,15 +158,10 @@ class AlbumViewController: UIViewController, UIGestureRecognizerDelegate {
 						imgR = imgSearchResults[0]
 						imgR = imgSearchResults[0]
 						image = imgR.value(forKey: "file")! as! String
 						image = imgR.value(forKey: "file")! as! String
 						rightId = imgR.value(forKey: "id")! as! Int
 						rightId = imgR.value(forKey: "id")! as! Int
-						NSLog(":GALLERYCONTROLLER:LOG: Image Row \(i) right: \(image)")
 						row.setImage(idx: 1, filename: image)
 						row.setImage(idx: 1, filename: image)
 					}
 					}
-					else{
-						NSLog(":GALLERYCONTROLLER:LOG: Image Row \(i) right: none")
-					}
-					//TODO create row, add images (L+R), add row to container.
-					//row.setImage(filename: image)
-				} catch {
+				}
+				catch {
 					NSLog(":GALLERYCONTROLLER:ERROR: Error getting image for post \(id): \(error)")
 					NSLog(":GALLERYCONTROLLER:ERROR: Error getting image for post \(id): \(error)")
 				}
 				}
 				
 				
@@ -156,12 +170,27 @@ class AlbumViewController: UIViewController, UIGestureRecognizerDelegate {
 				
 				
 				rowcount = rowcount + 1
 				rowcount = rowcount + 1
 			}
 			}
-		} catch {
+		}
+		catch {
 			NSLog(":GALLERYCONTROLLER:ERROR: Error with request: \(error)")
 			NSLog(":GALLERYCONTROLLER:ERROR: Error with request: \(error)")
 		}
 		}
 	}
 	}
 	
 	
 	
 	
+	/**
+	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?) {
+		if segue.identifier == "SeguePhotoAlbum"{
+			(segue.destination as! PhotoViewController).albumId = passAlbum
+			(segue.destination as! PhotoViewController).photoId = passId
+		}
+	}
+	
+	
 	/**
 	/**
 	Gets the device language. The only recognized languages are Spanish, English and Basque.
 	Gets the device language. The only recognized languages are Spanish, English and Basque.
 	If the device has another language, Spanish will be selected by default.
 	If the device has another language, Spanish will be selected by default.
@@ -177,5 +206,16 @@ class AlbumViewController: UIViewController, UIGestureRecognizerDelegate {
 		}
 		}
 	}
 	}
 	
 	
+	
+	/**
+	Shows a photo.
+	:param: id The album id.
+	*/
+	func showPhoto(album: Int, photo: Int){
+		self.passAlbum = album
+		self.passId = photo
+		performSegue(withIdentifier: "SeguePhotoAlbum", sender: nil)
+	}
+	
 }
 }
 
 

+ 14 - 0
app/AppDelegate.swift

@@ -21,12 +21,15 @@
 import UIKit
 import UIKit
 import CoreData
 import CoreData
 import GoogleMaps
 import GoogleMaps
+import UserNotifications
 
 
 @UIApplicationMain
 @UIApplicationMain
 class AppDelegate: UIResponder, UIApplicationDelegate {
 class AppDelegate: UIResponder, UIApplicationDelegate {
 
 
 	var window: UIWindow?
 	var window: UIWindow?
 	var controller: ViewController?
 	var controller: ViewController?
+	var albumController: AlbumViewController?
+	var syncController: SyncController?
 
 
 	
 	
 	func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
 	func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
@@ -38,12 +41,23 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
 		// Background mode.
 		// Background mode.
 		UIApplication.shared.setMinimumBackgroundFetchInterval(UIApplicationBackgroundFetchIntervalMinimum)
 		UIApplication.shared.setMinimumBackgroundFetchInterval(UIApplicationBackgroundFetchIntervalMinimum)
 		
 		
+		if #available(iOS 10.0, *) {
+			let center = UNUserNotificationCenter.current()
+			center.requestAuthorization(options: [.alert, .sound]) { (granted, error) in
+				// Enable or disable features based on authorization.
+			}
+		} else {
+			// Fallback on earlier versions
+		}
+		
+		
 		return true
 		return true
 	}
 	}
 	
 	
 
 
 	func application(_ application: UIApplication, performFetchWithCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
 	func application(_ application: UIApplication, performFetchWithCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
 		NSLog(":BACKGROUND:LOG: Start bg sync...")
 		NSLog(":BACKGROUND:LOG: Start bg sync...")
+		Notifications()
 		Sync()
 		Sync()
 		
 		
 		let when = DispatchTime.now() + 120 // 2 minutes to perform the sync.
 		let when = DispatchTime.now() + 120 // 2 minutes to perform the sync.

+ 173 - 136
app/Base.lproj/Main.storyboard

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12120" systemVersion="16E195" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12120" systemVersion="16E195" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="3o1-ab-AT4">
     <device id="retina4_7" orientation="portrait">
     <device id="retina4_7" orientation="portrait">
         <adaptation id="fullscreen"/>
         <adaptation id="fullscreen"/>
     </device>
     </device>
@@ -198,9 +198,8 @@
                         <segue destination="UkS-wI-Yhx" kind="show" identifier="SeguePost" id="gs2-jd-cPW"/>
                         <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="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="zJF-Mh-CNb" kind="show" identifier="SegueSchedule" id="A70-jo-yAP"/>
-                        <segue destination="3o1-ab-AT4" kind="show" identifier="SegueSync" id="E96-mK-gE9"/>
                         <segue destination="jfx-Q2-RtY" kind="show" identifier="SeguePastActivity" id="MmG-k2-wHn"/>
                         <segue destination="jfx-Q2-RtY" kind="show" identifier="SeguePastActivity" id="MmG-k2-wHn"/>
-                        <segue destination="hRA-2q-Tv9" kind="show" identifier="SeguePhoto" id="XIb-zK-EYd"/>
+                        <segue destination="DDO-dI-c0J" kind="show" identifier="SegueFutureActivity" id="ec7-aO-4Ac"/>
                     </connections>
                     </connections>
                 </viewController>
                 </viewController>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
@@ -1029,6 +1028,7 @@
                     <connections>
                     <connections>
                         <outlet property="lb" destination="pgU-dx-MvQ" id="ATL-SS-rxd"/>
                         <outlet property="lb" destination="pgU-dx-MvQ" id="ATL-SS-rxd"/>
                         <outlet property="pb" destination="VkR-DT-y3S" id="NMd-7R-Rlc"/>
                         <outlet property="pb" destination="VkR-DT-y3S" id="NMd-7R-Rlc"/>
+                        <segue destination="BYZ-38-t0r" kind="showDetail" identifier="SegueInit" action="showViewController:sender:" id="kSh-cP-och"/>
                     </connections>
                     </connections>
                 </viewController>
                 </viewController>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="fRm-1Y-Xmm" userLabel="First Responder" sceneMemberID="firstResponder"/>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="fRm-1Y-Xmm" userLabel="First Responder" sceneMemberID="firstResponder"/>
@@ -1240,29 +1240,29 @@
                 <placeholder placeholderIdentifier="IBFirstResponder" id="YKC-ZH-aSz" userLabel="First Responder" sceneMemberID="firstResponder"/>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="YKC-ZH-aSz" userLabel="First Responder" sceneMemberID="firstResponder"/>
             </objects>
             </objects>
         </scene>
         </scene>
-        <!--Photo-->
-        <scene sceneID="Qxt-8f-I5l">
+        <!--Future Activity View Controller-->
+        <scene sceneID="thm-MM-5qk">
             <objects>
             <objects>
-                <viewController title="Photo" id="hRA-2q-Tv9" customClass="PhotoViewController" customModule="app" customModuleProvider="target" sceneMemberID="viewController">
+                <viewController id="DDO-dI-c0J" customClass="FutureActivityViewController" customModule="app" customModuleProvider="target" sceneMemberID="viewController">
                     <layoutGuides>
                     <layoutGuides>
-                        <viewControllerLayoutGuide type="top" id="iD5-7d-BcL"/>
-                        <viewControllerLayoutGuide type="bottom" id="UVa-jE-Gqw"/>
+                        <viewControllerLayoutGuide type="top" id="yac-Xq-lM3"/>
+                        <viewControllerLayoutGuide type="bottom" id="94e-TO-KhL"/>
                     </layoutGuides>
                     </layoutGuides>
-                    <view key="view" contentMode="scaleToFill" id="zXb-Ja-8dX" userLabel="Container">
+                    <view key="view" contentMode="scaleToFill" id="Tll-v9-w0T">
                         <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
                         <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                         <subviews>
                         <subviews>
-                            <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="XUY-te-9PN" userLabel="Toolbar">
+                            <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Wso-as-8H4" userLabel="Toolbar">
                                 <rect key="frame" x="0.0" y="20" width="375" height="30"/>
                                 <rect key="frame" x="0.0" y="20" width="375" height="30"/>
                                 <subviews>
                                 <subviews>
-                                    <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="4tx-eL-rur">
+                                    <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="FiC-sd-IGL">
                                         <rect key="frame" x="0.0" y="0.0" width="56.5" height="30"/>
                                         <rect key="frame" x="0.0" y="0.0" width="56.5" height="30"/>
                                         <fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
                                         <fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
                                         <state key="normal" title="&lt;">
                                         <state key="normal" title="&lt;">
                                             <color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
                                             <color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
                                         </state>
                                         </state>
                                     </button>
                                     </button>
-                                    <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Gasteizko Margolariak" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ifO-mU-TPV">
+                                    <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Gasteizko Margolariak" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="v7W-BZ-qle">
                                         <rect key="frame" x="56.5" y="0.0" width="262.5" height="30"/>
                                         <rect key="frame" x="56.5" y="0.0" width="262.5" height="30"/>
                                         <fontDescription key="fontDescription" type="boldSystem" pointSize="17"/>
                                         <fontDescription key="fontDescription" type="boldSystem" pointSize="17"/>
                                         <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
                                         <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
@@ -1271,158 +1271,191 @@
                                 </subviews>
                                 </subviews>
                                 <color key="backgroundColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                 <color key="backgroundColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                 <constraints>
                                 <constraints>
-                                    <constraint firstItem="4tx-eL-rur" firstAttribute="centerY" secondItem="XUY-te-9PN" secondAttribute="centerY" id="AgA-QN-AMl"/>
-                                    <constraint firstItem="4tx-eL-rur" firstAttribute="width" secondItem="XUY-te-9PN" secondAttribute="width" multiplier="0.15" id="C5z-S4-EpK"/>
-                                    <constraint firstItem="ifO-mU-TPV" firstAttribute="centerY" secondItem="XUY-te-9PN" secondAttribute="centerY" id="DDx-b3-3ds"/>
-                                    <constraint firstItem="4tx-eL-rur" firstAttribute="leading" secondItem="XUY-te-9PN" secondAttribute="leading" id="W4J-mY-EF9"/>
-                                    <constraint firstItem="ifO-mU-TPV" firstAttribute="height" secondItem="XUY-te-9PN" secondAttribute="height" id="aKD-k3-Rn6"/>
-                                    <constraint firstItem="4tx-eL-rur" firstAttribute="height" secondItem="XUY-te-9PN" secondAttribute="height" id="msK-d2-NhX"/>
-                                    <constraint firstItem="ifO-mU-TPV" firstAttribute="centerX" secondItem="XUY-te-9PN" secondAttribute="centerX" id="r98-kb-UcD"/>
-                                    <constraint firstItem="ifO-mU-TPV" firstAttribute="width" secondItem="XUY-te-9PN" secondAttribute="width" multiplier="0.7" id="stn-gW-qHw"/>
+                                    <constraint firstItem="FiC-sd-IGL" firstAttribute="centerY" secondItem="Wso-as-8H4" secondAttribute="centerY" id="Bwe-wN-Ciz"/>
+                                    <constraint firstItem="v7W-BZ-qle" firstAttribute="height" secondItem="Wso-as-8H4" secondAttribute="height" id="De6-CZ-soc"/>
+                                    <constraint firstItem="v7W-BZ-qle" firstAttribute="width" secondItem="Wso-as-8H4" secondAttribute="width" multiplier="0.7" id="HFz-HT-150"/>
+                                    <constraint firstItem="v7W-BZ-qle" firstAttribute="centerX" secondItem="Wso-as-8H4" secondAttribute="centerX" id="SH6-iN-gma"/>
+                                    <constraint firstItem="FiC-sd-IGL" firstAttribute="height" secondItem="Wso-as-8H4" secondAttribute="height" id="aAa-nP-JRw"/>
+                                    <constraint firstItem="FiC-sd-IGL" firstAttribute="width" secondItem="Wso-as-8H4" secondAttribute="width" multiplier="0.15" id="fvu-CA-aIr"/>
+                                    <constraint firstItem="FiC-sd-IGL" firstAttribute="leading" secondItem="Wso-as-8H4" secondAttribute="leading" id="pXi-AQ-w7N"/>
+                                    <constraint firstItem="v7W-BZ-qle" firstAttribute="centerY" secondItem="Wso-as-8H4" secondAttribute="centerY" id="rhp-eA-2va"/>
                                 </constraints>
                                 </constraints>
                             </view>
                             </view>
-                            <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="dh0-OE-3US">
+                            <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Sqd-hf-hGI" userLabel="Cont">
                                 <rect key="frame" x="0.0" y="50" width="375" height="617"/>
                                 <rect key="frame" x="0.0" y="50" width="375" height="617"/>
                                 <subviews>
                                 <subviews>
-                                    <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="bqh-wV-GNf" userLabel="Section">
-                                        <rect key="frame" x="10" y="10" width="355" height="597"/>
+                                    <scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" ambiguous="YES" bounces="NO" alwaysBounceVertical="YES" showsHorizontalScrollIndicator="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Gqf-Sj-1VO">
+                                        <rect key="frame" x="0.0" y="0.0" width="375" height="617"/>
                                         <subviews>
                                         <subviews>
-                                            <label opaque="NO" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" restorationIdentifier="Title" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="esM-2C-p2i" userLabel="Title">
-                                                <rect key="frame" x="0.0" y="0.0" width="355" height="30"/>
-                                                <color key="backgroundColor" red="0.0" green="0.47058823529999999" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
-                                                <constraints>
-                                                    <constraint firstAttribute="height" constant="30" id="RzN-hZ-tOL"/>
-                                                </constraints>
-                                                <fontDescription key="fontDescription" type="boldSystem" pointSize="14"/>
-                                                <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
-                                                <nil key="highlightedColor"/>
-                                            </label>
-                                            <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="10" translatesAutoresizingMaskIntoConstraints="NO" id="78P-mw-WXM" userLabel="Content">
-                                                <rect key="frame" x="0.0" y="30" width="355" height="557"/>
+                                            <view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="kyg-VN-Jc1" userLabel="Section">
+                                                <rect key="frame" x="10" y="10" width="355" height="1954"/>
                                                 <subviews>
                                                 <subviews>
-                                                    <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="jIN-Yy-3GU" userLabel="Photo">
-                                                        <rect key="frame" x="8" y="8" width="339" height="541"/>
+                                                    <label opaque="NO" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" restorationIdentifier="Title" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="pz6-97-sPy" userLabel="Title">
+                                                        <rect key="frame" x="0.0" y="0.0" width="355" height="30"/>
+                                                        <color key="backgroundColor" red="0.0" green="0.47058823529999999" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                                        <constraints>
+                                                            <constraint firstAttribute="height" constant="30" id="den-z0-VST"/>
+                                                        </constraints>
+                                                        <fontDescription key="fontDescription" type="boldSystem" pointSize="14"/>
+                                                        <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                                                        <nil key="highlightedColor"/>
+                                                    </label>
+                                                    <stackView opaque="NO" contentMode="scaleToFill" ambiguous="YES" axis="vertical" spacing="10" translatesAutoresizingMaskIntoConstraints="NO" id="2yK-fO-giD" userLabel="Content">
+                                                        <rect key="frame" x="0.0" y="30" width="355" height="1175"/>
                                                         <subviews>
                                                         <subviews>
-                                                            <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="PhotoPlaceholder" translatesAutoresizingMaskIntoConstraints="NO" id="2wg-l8-Thi" userLabel="Image">
-                                                                <rect key="frame" x="10" y="10" width="319" height="406"/>
-                                                            </imageView>
-                                                            <label opaque="NO" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="254" text="Date" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Vhb-gI-4I7" userLabel="Date">
-                                                                <rect key="frame" x="10.5" y="451" width="319" height="20"/>
-                                                                <constraints>
-                                                                    <constraint firstAttribute="height" constant="20" id="fXM-sB-Ii7"/>
-                                                                </constraints>
-                                                                <fontDescription key="fontDescription" type="italicSystem" pointSize="16"/>
-                                                                <color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
-                                                                <nil key="highlightedColor"/>
-                                                            </label>
-                                                            <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Jcy-kv-ggg">
-                                                                <rect key="frame" x="10" y="491" width="149.5" height="40"/>
-                                                                <color key="backgroundColor" red="0.070588235289999995" green="0.27058823529999998" blue="0.4039215686" alpha="1" colorSpace="calibratedRGB"/>
+                                                            <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Qj9-S3-bY4" userLabel="Activity">
+                                                                <rect key="frame" x="8" y="8" width="339" height="200"/>
+                                                                <subviews>
+                                                                    <label opaque="NO" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="254" text="Date" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="6gj-f6-Ggb" userLabel="Date">
+                                                                        <rect key="frame" x="10" y="10" width="319" height="20"/>
+                                                                        <constraints>
+                                                                            <constraint firstAttribute="height" constant="20" id="9ED-Vw-Zue"/>
+                                                                        </constraints>
+                                                                        <fontDescription key="fontDescription" type="boldSystem" pointSize="17"/>
+                                                                        <color key="textColor" red="0.1529411765" green="0.33333333329999998" blue="0.45098039220000002" alpha="1" colorSpace="calibratedRGB"/>
+                                                                        <nil key="highlightedColor"/>
+                                                                    </label>
+                                                                    <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="PhotoPlaceholder" translatesAutoresizingMaskIntoConstraints="NO" id="Ztx-jl-MsD" userLabel="Image">
+                                                                        <rect key="frame" x="0.0" y="40" width="339" height="71"/>
+                                                                        <constraints>
+                                                                            <constraint firstAttribute="height" constant="71" id="s96-BJ-tG9"/>
+                                                                        </constraints>
+                                                                    </imageView>
+                                                                    <label opaque="NO" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Text" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="s4H-vW-9W1" userLabel="Text">
+                                                                        <rect key="frame" x="17" y="121" width="305.5" height="39"/>
+                                                                        <fontDescription key="fontDescription" type="system" pointSize="17"/>
+                                                                        <nil key="textColor"/>
+                                                                        <nil key="highlightedColor"/>
+                                                                    </label>
+                                                                    <label opaque="NO" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="254" text="Precio: 0E" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="2JU-8j-g42" userLabel="Price">
+                                                                        <rect key="frame" x="10" y="170" width="319" height="20"/>
+                                                                        <constraints>
+                                                                            <constraint firstAttribute="height" constant="20" id="RZA-yo-WR6"/>
+                                                                        </constraints>
+                                                                        <fontDescription key="fontDescription" type="boldSystem" pointSize="17"/>
+                                                                        <color key="textColor" red="0.1529411765" green="0.33333333329999998" blue="0.45098039220000002" alpha="1" colorSpace="calibratedRGB"/>
+                                                                        <nil key="highlightedColor"/>
+                                                                    </label>
+                                                                </subviews>
+                                                                <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
                                                                 <constraints>
                                                                 <constraints>
-                                                                    <constraint firstAttribute="height" constant="40" id="voU-YV-2ln"/>
+                                                                    <constraint firstItem="s4H-vW-9W1" firstAttribute="width" secondItem="Qj9-S3-bY4" secondAttribute="width" multiplier="0.9" id="4WU-oP-oyH"/>
+                                                                    <constraint firstItem="Ztx-jl-MsD" firstAttribute="centerX" secondItem="Qj9-S3-bY4" secondAttribute="centerX" id="GVu-8M-yPh"/>
+                                                                    <constraint firstItem="6gj-f6-Ggb" firstAttribute="top" secondItem="Qj9-S3-bY4" secondAttribute="top" constant="10" id="Icg-y4-cOc"/>
+                                                                    <constraint firstItem="2JU-8j-g42" firstAttribute="top" secondItem="s4H-vW-9W1" secondAttribute="bottom" constant="10" id="SjA-hc-Hei"/>
+                                                                    <constraint firstAttribute="bottom" secondItem="2JU-8j-g42" secondAttribute="bottom" constant="10" id="Vlo-eb-rs8"/>
+                                                                    <constraint firstItem="s4H-vW-9W1" firstAttribute="centerX" secondItem="Qj9-S3-bY4" secondAttribute="centerX" id="Vqv-6j-le8"/>
+                                                                    <constraint firstItem="2JU-8j-g42" firstAttribute="width" secondItem="Qj9-S3-bY4" secondAttribute="width" constant="-20" id="ZOe-dR-B4s"/>
+                                                                    <constraint firstItem="s4H-vW-9W1" firstAttribute="top" secondItem="Ztx-jl-MsD" secondAttribute="bottom" constant="10" id="be6-mK-3Ki"/>
+                                                                    <constraint firstItem="2JU-8j-g42" firstAttribute="centerX" secondItem="Qj9-S3-bY4" secondAttribute="centerX" id="gdn-GS-gAm"/>
+                                                                    <constraint firstItem="Ztx-jl-MsD" firstAttribute="top" secondItem="6gj-f6-Ggb" secondAttribute="bottom" constant="10" id="ihO-Xt-zic"/>
+                                                                    <constraint firstItem="6gj-f6-Ggb" firstAttribute="width" secondItem="Qj9-S3-bY4" secondAttribute="width" constant="-20" id="jmb-0t-Hfc"/>
+                                                                    <constraint firstItem="6gj-f6-Ggb" firstAttribute="centerX" secondItem="Qj9-S3-bY4" secondAttribute="centerX" id="me4-rt-RAG"/>
+                                                                    <constraint firstItem="Ztx-jl-MsD" firstAttribute="width" secondItem="Qj9-S3-bY4" secondAttribute="width" id="tZQ-7w-fhB"/>
                                                                 </constraints>
                                                                 </constraints>
-                                                                <fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
-                                                                <state key="normal" title="&lt;">
-                                                                    <color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
-                                                                </state>
+                                                                <edgeInsets key="layoutMargins" top="8" left="8" bottom="8" right="8"/>
                                                                 <userDefinedRuntimeAttributes>
                                                                 <userDefinedRuntimeAttributes>
                                                                     <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
                                                                     <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
-                                                                        <color key="value" red="0.0" green="0.47058823529999999" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                                                        <color key="value" red="0.42745098040000001" green="0.41176470590000003" blue="0.56470588239999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                                                     </userDefinedRuntimeAttribute>
                                                                     </userDefinedRuntimeAttribute>
                                                                     <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
                                                                     <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
-                                                                        <real key="value" value="2"/>
+                                                                        <real key="value" value="1"/>
                                                                     </userDefinedRuntimeAttribute>
                                                                     </userDefinedRuntimeAttribute>
                                                                     <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
                                                                     <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
-                                                                        <real key="value" value="4"/>
+                                                                        <real key="value" value="3"/>
                                                                     </userDefinedRuntimeAttribute>
                                                                     </userDefinedRuntimeAttribute>
                                                                 </userDefinedRuntimeAttributes>
                                                                 </userDefinedRuntimeAttributes>
-                                                            </button>
-                                                            <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="HOD-9J-wQK">
-                                                                <rect key="frame" x="179.5" y="491" width="149.5" height="40"/>
-                                                                <color key="backgroundColor" red="0.070588235289999995" green="0.27058823529999998" blue="0.4039215686" alpha="1" colorSpace="calibratedRGB"/>
+                                                            </view>
+                                                            <view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="HZX-gN-1YI" userLabel="Itinerary">
+                                                                <rect key="frame" x="8" y="218" width="339" height="949"/>
+                                                                <subviews>
+                                                                    <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Itinerario" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="cjj-sd-Gou" userLabel="Title">
+                                                                        <rect key="frame" x="10" y="10" width="319" height="21.5"/>
+                                                                        <constraints>
+                                                                            <constraint firstAttribute="height" constant="21.5" id="2zz-qZ-PEW"/>
+                                                                        </constraints>
+                                                                        <fontDescription key="fontDescription" type="boldSystem" pointSize="18"/>
+                                                                        <color key="textColor" red="0.1529411765" green="0.33333333329999998" blue="0.45098039220000002" alpha="1" colorSpace="calibratedRGB"/>
+                                                                        <nil key="highlightedColor"/>
+                                                                    </label>
+                                                                    <stackView opaque="NO" contentMode="scaleToFill" ambiguous="YES" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="3lO-kN-Y0S">
+                                                                        <rect key="frame" x="9.5" y="374" width="319" height="200"/>
+                                                                    </stackView>
+                                                                </subviews>
+                                                                <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
                                                                 <constraints>
                                                                 <constraints>
-                                                                    <constraint firstAttribute="height" constant="40" id="6oc-MW-3JE"/>
+                                                                    <constraint firstItem="3lO-kN-Y0S" firstAttribute="width" secondItem="HZX-gN-1YI" secondAttribute="width" constant="-20" id="Hz4-jl-pQ1"/>
+                                                                    <constraint firstItem="3lO-kN-Y0S" firstAttribute="top" secondItem="cjj-sd-Gou" secondAttribute="bottom" constant="10" id="Okn-6j-Z72"/>
+                                                                    <constraint firstItem="cjj-sd-Gou" firstAttribute="width" secondItem="HZX-gN-1YI" secondAttribute="width" constant="-20" id="Vpb-9J-POY"/>
+                                                                    <constraint firstAttribute="bottom" secondItem="3lO-kN-Y0S" secondAttribute="bottom" constant="10" id="hpN-tm-PLc"/>
+                                                                    <constraint firstItem="cjj-sd-Gou" firstAttribute="centerX" secondItem="HZX-gN-1YI" secondAttribute="centerX" id="qlD-cC-2hf"/>
+                                                                    <constraint firstItem="cjj-sd-Gou" firstAttribute="top" secondItem="HZX-gN-1YI" secondAttribute="top" constant="10" id="sUG-Wx-Qba"/>
+                                                                    <constraint firstItem="3lO-kN-Y0S" firstAttribute="centerX" secondItem="HZX-gN-1YI" secondAttribute="centerX" id="tpQ-ml-ORh"/>
                                                                 </constraints>
                                                                 </constraints>
-                                                                <fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
-                                                                <state key="normal" title="&gt;">
-                                                                    <color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
-                                                                </state>
+                                                                <edgeInsets key="layoutMargins" top="8" left="8" bottom="8" right="8"/>
                                                                 <userDefinedRuntimeAttributes>
                                                                 <userDefinedRuntimeAttributes>
                                                                     <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
                                                                     <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
-                                                                        <color key="value" red="0.0" green="0.47058823529999999" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                                                        <color key="value" red="0.42745098040000001" green="0.41176470590000003" blue="0.56470588239999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                                                     </userDefinedRuntimeAttribute>
                                                                     </userDefinedRuntimeAttribute>
                                                                     <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
                                                                     <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
-                                                                        <real key="value" value="2"/>
+                                                                        <real key="value" value="1"/>
                                                                     </userDefinedRuntimeAttribute>
                                                                     </userDefinedRuntimeAttribute>
                                                                     <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
                                                                     <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
-                                                                        <real key="value" value="4"/>
+                                                                        <real key="value" value="3"/>
                                                                     </userDefinedRuntimeAttribute>
                                                                     </userDefinedRuntimeAttribute>
                                                                 </userDefinedRuntimeAttributes>
                                                                 </userDefinedRuntimeAttributes>
-                                                            </button>
+                                                            </view>
                                                         </subviews>
                                                         </subviews>
-                                                        <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
-                                                        <constraints>
-                                                            <constraint firstItem="2wg-l8-Thi" firstAttribute="top" secondItem="jIN-Yy-3GU" secondAttribute="top" constant="10" id="D28-DF-HF9"/>
-                                                            <constraint firstAttribute="bottom" secondItem="Jcy-kv-ggg" secondAttribute="bottom" constant="10" id="HPg-ft-VEj"/>
-                                                            <constraint firstItem="2wg-l8-Thi" firstAttribute="centerX" secondItem="jIN-Yy-3GU" secondAttribute="centerX" id="KoA-A3-Ygf"/>
-                                                            <constraint firstItem="Vhb-gI-4I7" firstAttribute="bottom" secondItem="HOD-9J-wQK" secondAttribute="top" constant="-20" id="NVj-fY-b6d"/>
-                                                            <constraint firstAttribute="trailing" secondItem="HOD-9J-wQK" secondAttribute="trailing" constant="10" id="can-PT-Neg"/>
-                                                            <constraint firstAttribute="bottom" secondItem="HOD-9J-wQK" secondAttribute="bottom" constant="10" id="dsJ-0z-vOa"/>
-                                                            <constraint firstItem="Vhb-gI-4I7" firstAttribute="width" secondItem="jIN-Yy-3GU" secondAttribute="width" constant="-20" id="geF-9Y-pxJ"/>
-                                                            <constraint firstItem="Jcy-kv-ggg" firstAttribute="leading" secondItem="jIN-Yy-3GU" secondAttribute="leading" constant="10" id="grR-FP-FE3"/>
-                                                            <constraint firstItem="Vhb-gI-4I7" firstAttribute="centerX" secondItem="jIN-Yy-3GU" secondAttribute="centerX" id="hDr-cv-Tma"/>
-                                                            <constraint firstItem="HOD-9J-wQK" firstAttribute="width" secondItem="jIN-Yy-3GU" secondAttribute="width" multiplier="0.5" constant="-20" id="pQ0-vJ-Uv1"/>
-                                                            <constraint firstItem="Jcy-kv-ggg" firstAttribute="width" secondItem="jIN-Yy-3GU" secondAttribute="width" multiplier="0.5" constant="-20" id="rnQ-m4-XQ0"/>
-                                                            <constraint firstItem="2wg-l8-Thi" firstAttribute="height" secondItem="jIN-Yy-3GU" secondAttribute="height" multiplier="0.75" id="vhz-lJ-2fm"/>
-                                                            <constraint firstItem="2wg-l8-Thi" firstAttribute="width" secondItem="jIN-Yy-3GU" secondAttribute="width" constant="-20" id="wQB-Hs-vSs"/>
-                                                        </constraints>
+                                                        <color key="backgroundColor" red="0.59607843140000005" green="0.7843137255" blue="1" alpha="1" colorSpace="calibratedRGB"/>
                                                         <edgeInsets key="layoutMargins" top="8" left="8" bottom="8" right="8"/>
                                                         <edgeInsets key="layoutMargins" top="8" left="8" bottom="8" right="8"/>
-                                                        <userDefinedRuntimeAttributes>
-                                                            <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
-                                                                <color key="value" red="0.42745098040000001" green="0.41176470590000003" blue="0.56470588239999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
-                                                            </userDefinedRuntimeAttribute>
-                                                            <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
-                                                                <real key="value" value="1"/>
-                                                            </userDefinedRuntimeAttribute>
-                                                            <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
-                                                                <real key="value" value="3"/>
-                                                            </userDefinedRuntimeAttribute>
-                                                        </userDefinedRuntimeAttributes>
-                                                    </view>
+                                                    </stackView>
                                                 </subviews>
                                                 </subviews>
                                                 <color key="backgroundColor" red="0.59607843140000005" green="0.7843137255" blue="1" alpha="1" colorSpace="calibratedRGB"/>
                                                 <color key="backgroundColor" red="0.59607843140000005" green="0.7843137255" blue="1" alpha="1" colorSpace="calibratedRGB"/>
-                                                <edgeInsets key="layoutMargins" top="8" left="8" bottom="8" right="8"/>
-                                            </stackView>
+                                                <constraints>
+                                                    <constraint firstItem="pz6-97-sPy" firstAttribute="centerX" secondItem="kyg-VN-Jc1" secondAttribute="centerX" id="Fdn-EI-QGl"/>
+                                                    <constraint firstItem="2yK-fO-giD" firstAttribute="centerX" secondItem="kyg-VN-Jc1" secondAttribute="centerX" id="kDg-sI-VYI"/>
+                                                    <constraint firstAttribute="bottom" secondItem="2yK-fO-giD" secondAttribute="bottom" id="ogx-5T-Dfd"/>
+                                                    <constraint firstItem="2yK-fO-giD" firstAttribute="top" secondItem="pz6-97-sPy" secondAttribute="bottom" id="qPT-dv-eVg"/>
+                                                    <constraint firstItem="pz6-97-sPy" firstAttribute="width" secondItem="kyg-VN-Jc1" secondAttribute="width" id="qWi-1Z-VWQ"/>
+                                                    <constraint firstItem="2yK-fO-giD" firstAttribute="width" secondItem="kyg-VN-Jc1" secondAttribute="width" id="rY6-hl-afc"/>
+                                                    <constraint firstItem="pz6-97-sPy" firstAttribute="top" secondItem="kyg-VN-Jc1" secondAttribute="top" id="sw5-Qt-DUd"/>
+                                                </constraints>
+                                                <edgeInsets key="layoutMargins" top="10" left="10" bottom="10" right="10"/>
+                                                <userDefinedRuntimeAttributes>
+                                                    <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
+                                                        <color key="value" red="0.0" green="0.0" blue="0.066666666669999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                                    </userDefinedRuntimeAttribute>
+                                                    <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                                                        <real key="value" value="1"/>
+                                                    </userDefinedRuntimeAttribute>
+                                                    <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
+                                                        <real key="value" value="8"/>
+                                                    </userDefinedRuntimeAttribute>
+                                                </userDefinedRuntimeAttributes>
+                                            </view>
                                         </subviews>
                                         </subviews>
-                                        <color key="backgroundColor" red="0.59607843140000005" green="0.7843137255" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+                                        <color key="backgroundColor" red="0.70980392160000005" green="0.82745098039999998" blue="0.8980392157" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                         <constraints>
                                         <constraints>
-                                            <constraint firstAttribute="bottom" secondItem="78P-mw-WXM" secondAttribute="bottom" constant="10" id="JdO-O4-mee"/>
-                                            <constraint firstItem="78P-mw-WXM" firstAttribute="width" secondItem="bqh-wV-GNf" secondAttribute="width" id="PpI-M2-bDk"/>
-                                            <constraint firstItem="78P-mw-WXM" firstAttribute="centerX" secondItem="bqh-wV-GNf" secondAttribute="centerX" id="bEw-TV-GOh"/>
-                                            <constraint firstItem="78P-mw-WXM" firstAttribute="top" secondItem="esM-2C-p2i" secondAttribute="bottom" id="muK-Pd-v3M"/>
-                                            <constraint firstItem="esM-2C-p2i" firstAttribute="width" secondItem="bqh-wV-GNf" secondAttribute="width" id="vEo-Fa-qdK"/>
-                                            <constraint firstItem="esM-2C-p2i" firstAttribute="centerX" secondItem="bqh-wV-GNf" secondAttribute="centerX" id="zPh-03-gDc"/>
+                                            <constraint firstItem="kyg-VN-Jc1" firstAttribute="trailing" secondItem="Gqf-Sj-1VO" secondAttribute="trailing" constant="10" id="4CW-W7-4ND"/>
+                                            <constraint firstItem="kyg-VN-Jc1" firstAttribute="top" secondItem="Gqf-Sj-1VO" secondAttribute="top" constant="10" id="fyr-qO-Cdl"/>
+                                            <constraint firstItem="kyg-VN-Jc1" firstAttribute="centerX" secondItem="Gqf-Sj-1VO" secondAttribute="centerX" id="hjI-3k-lKK"/>
+                                            <constraint firstItem="kyg-VN-Jc1" firstAttribute="leading" secondItem="Gqf-Sj-1VO" secondAttribute="leading" constant="10" id="hmA-Z3-r1z"/>
+                                            <constraint firstAttribute="bottom" secondItem="kyg-VN-Jc1" secondAttribute="bottom" constant="10" id="nGV-76-wZo"/>
                                         </constraints>
                                         </constraints>
                                         <edgeInsets key="layoutMargins" top="10" left="10" bottom="10" right="10"/>
                                         <edgeInsets key="layoutMargins" top="10" left="10" bottom="10" right="10"/>
                                         <userDefinedRuntimeAttributes>
                                         <userDefinedRuntimeAttributes>
-                                            <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
-                                                <color key="value" red="0.0" green="0.0" blue="0.066666666669999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
-                                            </userDefinedRuntimeAttribute>
                                             <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
                                             <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
-                                                <real key="value" value="1"/>
-                                            </userDefinedRuntimeAttribute>
-                                            <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
-                                                <real key="value" value="8"/>
+                                                <real key="value" value="0.0"/>
                                             </userDefinedRuntimeAttribute>
                                             </userDefinedRuntimeAttribute>
                                         </userDefinedRuntimeAttributes>
                                         </userDefinedRuntimeAttributes>
-                                    </view>
+                                    </scrollView>
                                 </subviews>
                                 </subviews>
                                 <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
                                 <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
                                 <constraints>
                                 <constraints>
-                                    <constraint firstItem="bqh-wV-GNf" firstAttribute="width" secondItem="dh0-OE-3US" secondAttribute="width" constant="-20" id="8a3-am-7Ch"/>
-                                    <constraint firstItem="bqh-wV-GNf" firstAttribute="height" secondItem="dh0-OE-3US" secondAttribute="height" constant="-20" id="Tgd-YQ-aEQ"/>
-                                    <constraint firstItem="bqh-wV-GNf" firstAttribute="centerY" secondItem="dh0-OE-3US" secondAttribute="centerY" id="U2v-3X-Ub1"/>
-                                    <constraint firstItem="bqh-wV-GNf" firstAttribute="centerX" secondItem="dh0-OE-3US" secondAttribute="centerX" id="eI3-vW-bvZ"/>
+                                    <constraint firstItem="Gqf-Sj-1VO" firstAttribute="width" secondItem="Sqd-hf-hGI" secondAttribute="width" id="RkS-ku-LcK"/>
+                                    <constraint firstItem="Gqf-Sj-1VO" firstAttribute="centerX" secondItem="Sqd-hf-hGI" secondAttribute="centerX" id="bTt-jg-jEg"/>
+                                    <constraint firstItem="Gqf-Sj-1VO" firstAttribute="top" secondItem="Sqd-hf-hGI" secondAttribute="top" id="wgm-EO-9Fw"/>
+                                    <constraint firstAttribute="bottom" secondItem="Gqf-Sj-1VO" secondAttribute="bottom" id="zBV-o0-Ah0"/>
                                 </constraints>
                                 </constraints>
                                 <userDefinedRuntimeAttributes>
                                 <userDefinedRuntimeAttributes>
                                     <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
                                     <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
@@ -1433,26 +1466,30 @@
                         </subviews>
                         </subviews>
                         <color key="backgroundColor" red="0.0" green="0.47058823529999999" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                         <color key="backgroundColor" red="0.0" green="0.47058823529999999" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                         <constraints>
                         <constraints>
-                            <constraint firstItem="XUY-te-9PN" firstAttribute="width" secondItem="zXb-Ja-8dX" secondAttribute="width" id="1gg-3z-VTT"/>
-                            <constraint firstItem="XUY-te-9PN" firstAttribute="top" secondItem="iD5-7d-BcL" secondAttribute="bottom" id="6xm-50-tbJ"/>
-                            <constraint firstItem="dh0-OE-3US" firstAttribute="top" secondItem="XUY-te-9PN" secondAttribute="bottom" id="Cwk-RG-Bdj"/>
-                            <constraint firstItem="dh0-OE-3US" firstAttribute="centerX" secondItem="zXb-Ja-8dX" secondAttribute="centerX" id="FEt-9c-pvb"/>
-                            <constraint firstItem="XUY-te-9PN" firstAttribute="centerX" secondItem="zXb-Ja-8dX" secondAttribute="centerX" id="vfQ-Yn-21i"/>
-                            <constraint firstItem="UVa-jE-Gqw" firstAttribute="top" secondItem="dh0-OE-3US" secondAttribute="bottom" id="w47-kr-EXB"/>
+                            <constraint firstItem="Sqd-hf-hGI" firstAttribute="width" secondItem="Tll-v9-w0T" secondAttribute="width" id="4Oi-mE-zRB"/>
+                            <constraint firstItem="Sqd-hf-hGI" firstAttribute="top" secondItem="Wso-as-8H4" secondAttribute="bottom" id="5pc-Qo-6wP"/>
+                            <constraint firstItem="Sqd-hf-hGI" firstAttribute="centerX" secondItem="Tll-v9-w0T" secondAttribute="centerX" id="D9r-lY-5aj"/>
+                            <constraint firstItem="94e-TO-KhL" firstAttribute="top" secondItem="Sqd-hf-hGI" secondAttribute="bottom" id="F8t-mE-en5"/>
+                            <constraint firstItem="Wso-as-8H4" firstAttribute="top" secondItem="yac-Xq-lM3" secondAttribute="bottom" id="Ip2-eX-rdk"/>
+                            <constraint firstItem="Wso-as-8H4" firstAttribute="centerX" secondItem="Tll-v9-w0T" secondAttribute="centerX" id="Mxx-Zd-rFC"/>
+                            <constraint firstItem="Wso-as-8H4" firstAttribute="width" secondItem="Tll-v9-w0T" secondAttribute="width" id="gSn-Ue-Gl1"/>
                         </constraints>
                         </constraints>
                     </view>
                     </view>
                     <connections>
                     <connections>
-                        <outlet property="barButton" destination="4tx-eL-rur" id="fAC-j7-Kuv"/>
-                        <outlet property="barTitle" destination="ifO-mU-TPV" id="Yba-nJ-MyQ"/>
-                        <outlet property="btNext" destination="HOD-9J-wQK" id="mc4-j1-seA"/>
-                        <outlet property="btPrev" destination="Jcy-kv-ggg" id="L1Q-2X-H43"/>
-                        <outlet property="photoDate" destination="Vhb-gI-4I7" id="pyP-a1-Iz7"/>
-                        <outlet property="photoImage" destination="2wg-l8-Thi" id="xgu-JA-6Zs"/>
-                        <outlet property="photoTitle" destination="esM-2C-p2i" id="ev5-QE-lS6"/>
+                        <outlet property="activityDate" destination="6gj-f6-Ggb" id="eBH-rF-6p2"/>
+                        <outlet property="activityImage" destination="Ztx-jl-MsD" id="kAh-WI-jsg"/>
+                        <outlet property="activityPrice" destination="2JU-8j-g42" id="0na-jU-hcv"/>
+                        <outlet property="activityText" destination="s4H-vW-9W1" id="edz-vu-9kL"/>
+                        <outlet property="activityTitle" destination="pz6-97-sPy" id="QFy-g3-k0u"/>
+                        <outlet property="barButton" destination="FiC-sd-IGL" id="cbn-gb-Nj5"/>
+                        <outlet property="barTitle" destination="v7W-BZ-qle" id="aQB-IA-P19"/>
+                        <outlet property="itineraryContainer" destination="HZX-gN-1YI" id="1lZ-0m-TwZ"/>
+                        <outlet property="itineraryList" destination="3lO-kN-Y0S" id="Vf3-t6-l0Y"/>
                     </connections>
                     </connections>
                 </viewController>
                 </viewController>
-                <placeholder placeholderIdentifier="IBFirstResponder" id="jtA-t8-aan" userLabel="First Responder" sceneMemberID="firstResponder"/>
+                <placeholder placeholderIdentifier="IBFirstResponder" id="IHt-fO-2Q0" userLabel="First Responder" sceneMemberID="firstResponder"/>
             </objects>
             </objects>
+            <point key="canvasLocation" x="1302" y="-403"/>
         </scene>
         </scene>
     </scenes>
     </scenes>
     <resources>
     <resources>

+ 3 - 3
app/BlogView.swift

@@ -62,7 +62,7 @@ class BlogView: UIView {
 		self.storyboard = UIStoryboard(name: "Main", bundle: nil)
 		self.storyboard = UIStoryboard(name: "Main", bundle: nil)
 		self.controller = storyboard?.instantiateViewController(withIdentifier: "GMViewController") as! ViewController
 		self.controller = storyboard?.instantiateViewController(withIdentifier: "GMViewController") as! ViewController
 		self.context = NSManagedObjectContext(concurrencyType: .privateQueueConcurrencyType)
 		self.context = NSManagedObjectContext(concurrencyType: .privateQueueConcurrencyType)
-		self.delegate = UIApplication.shared.delegate as! AppDelegate
+		self.delegate = UIApplication.shared.delegate as? AppDelegate
 		self.lang = getLanguage()
 		self.lang = getLanguage()
 		self.context?.persistentStoreCoordinator = delegate?.persistentStoreCoordinator
 		self.context?.persistentStoreCoordinator = delegate?.persistentStoreCoordinator
 		
 		
@@ -95,7 +95,7 @@ class BlogView: UIView {
 			var text: String
 			var text: String
 			var image: String
 			var image: String
 			
 			
-			for r in searchResults as! [NSManagedObject] {
+			for r in searchResults! {
 								
 								
 				//Create a new row
 				//Create a new row
 				row = RowBlog.init(s: "rowBlog\(count)", i: count)
 				row = RowBlog.init(s: "rowBlog\(count)", i: count)
@@ -116,7 +116,7 @@ class BlogView: UIView {
 				imgFetchRequest.fetchLimit = 1
 				imgFetchRequest.fetchLimit = 1
 				do{
 				do{
 					let imgSearchResults = try context?.fetch(imgFetchRequest)
 					let imgSearchResults = try context?.fetch(imgFetchRequest)
-					for imgR in imgSearchResults as! [NSManagedObject]{
+					for imgR in imgSearchResults!{
 						image = imgR.value(forKey: "image")! as! String
 						image = imgR.value(forKey: "image")! as! String
 						row.setImage(filename: image)
 						row.setImage(filename: image)
 					}
 					}

+ 0 - 1
app/FetchLocation.swift

@@ -50,7 +50,6 @@ class FetchLocation{
 			if status == 200{
 			if status == 200{
 			
 			
 				guard let data = data else {
 				guard let data = data else {
-					NSLog(":LOCATION:DEBUG: No data received.")
 					return
 					return
 				}
 				}
 
 

+ 309 - 0
app/FutureActivityViewController.swift

@@ -0,0 +1,309 @@
+// Copyright (C) 2016 Inigo Valentin
+//
+// This file is part of the Gasteizko Margolariak IOS app.
+//
+// The Gasteizko Margolariak IOS app is free software: you can
+// redistribute it and/or modify it under the terms of the
+// GNU General Public License as published by the Free Software
+// Foundation, either version 3 of the License, or (at your
+// option) any later version.
+//
+// The Gasteizko Margolariak IOS app is distributed in the
+// hope that it will be useful, but WITHOUT ANY WARRANTY;
+// without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
+// Public License for more details.
+//
+// You should have received a copy of the GNU General Public
+// License along with the Gasteizko Margolariak IOS app.
+// If not, see <http://www.gnu.org/licenses/>.
+
+import UIKit
+import CoreData
+
+/**
+Controller to show a future activity.
+*/
+class FutureActivityViewController: UIViewController, UIGestureRecognizerDelegate {
+	
+	@IBOutlet weak var barButton: UIButton!
+	@IBOutlet weak var barTitle: UILabel!
+	@IBOutlet weak var activityTitle: UILabel!
+	@IBOutlet weak var activityImage: UIImageView!
+	@IBOutlet weak var activityText: UILabel!
+	@IBOutlet weak var activityDate: UILabel!
+	@IBOutlet weak var itineraryContainer: UIView!
+	@IBOutlet weak var itineraryList: UIStackView!
+	@IBOutlet weak var activityPrice: UILabel!
+	
+	// Activity id
+	var id: Int = -1
+	
+	var delegate: AppDelegate?
+	
+	var passId: Int = -1
+	
+	
+	/**
+	Get the app context.
+	:return: The app context.
+	*/
+	func getContext () -> NSManagedObjectContext {
+		return NSManagedObjectContext(concurrencyType: .mainQueueConcurrencyType)
+	}
+	
+	
+	/**
+	Run when the app loads.
+	*/
+	override func viewDidLoad() {
+		super.viewDidLoad()
+		self.loadActivity(id: id)
+		// Set button action
+		barButton.addTarget(self, action: #selector(self.back), for: .touchUpInside)
+	}
+	
+	
+	/**
+	Dismisses the controller.
+	*/
+	func back() {
+		self.dismiss(animated: true, completion: nil)
+	}
+	
+	
+	/**
+	Dispose of any resources that can be recreated.
+	*/
+	override func didReceiveMemoryWarning() {
+		super.didReceiveMemoryWarning()
+	}
+	
+	
+	/**
+	Loads the selected post.
+	:param: id Post id.
+	*/
+	public func loadActivity(id: Int){
+		
+		let context = NSManagedObjectContext(concurrencyType: .privateQueueConcurrencyType)
+		let appDelegate = UIApplication.shared.delegate as! AppDelegate
+		let lang : String = getLanguage()
+		context.persistentStoreCoordinator = appDelegate.persistentStoreCoordinator
+		let fetchRequest: NSFetchRequest<Activity> = Activity.fetchRequest()
+		fetchRequest.predicate = NSPredicate(format: "id = %i", id)
+		
+		do {
+			let searchResults = try context.fetch(fetchRequest)
+			var count = 0
+			var sTitle: String
+			var sText: String
+			var image: String
+			var date: NSDate
+			var price: Int
+			
+			for r in searchResults as [NSManagedObject] {
+				count = count + 1
+				sTitle = r.value(forKey: "title_\(lang)")! as! String
+				sText = r.value(forKey: "text_\(lang)")! as! String
+				date = r.value(forKey: "date")! as! NSDate
+				price = r.value(forKey: "price")! as! Int
+				activityTitle.text = "  \(sTitle.decode().stripHtml())"
+				activityText.text = sText.decode().stripHtml()
+				activityDate.text = formatDate(date: date, lang: lang)
+				activityPrice.text = "Precio: \(price) €"
+				
+				// Get main image
+				image = ""
+				let imgFetchRequest: NSFetchRequest<Activity_image> = Activity_image.fetchRequest()
+				let imgSortDescriptor = NSSortDescriptor(key: "idx", ascending: true)
+				let imgSortDescriptors = [imgSortDescriptor]
+				imgFetchRequest.sortDescriptors = imgSortDescriptors
+				imgFetchRequest.predicate = NSPredicate(format: "activity == %i", id)
+				imgFetchRequest.fetchLimit = 1
+				do{
+					let imgSearchResults = try context.fetch(imgFetchRequest)
+					for imgR in imgSearchResults as [NSManagedObject]{
+						image = imgR.value(forKey: "image")! as! String
+						let path = "img/actividades/preview/\(image)"
+						self.activityImage.setImage(localPath: path, remotePath: "https://margolariak.com/\(path)")
+					}
+				}
+				catch {
+					NSLog(":FUTUREACTIVITYCONTROLLER:ERROR: Error getting image for past activity \(id): \(error)")
+				}
+				
+				// Get itinerary
+				let itiFetchRequest: NSFetchRequest<Activity_itinerary> = Activity_itinerary.fetchRequest()
+				let itiSortDescriptor = NSSortDescriptor(key: "start", ascending: true)
+				let itiSortDescriptors = [itiSortDescriptor]
+				itiFetchRequest.sortDescriptors = itiSortDescriptors
+				itiFetchRequest.predicate = NSPredicate(format: "activity == %i", id)
+				do {
+					let itiSearchResults = try context.fetch(itiFetchRequest)
+					if itiSearchResults.count == 0{
+						NSLog(":FUTUREACTIVITY:DEBUG: No itinerary for activity \(id)")
+						self.itineraryContainer.isHidden = true
+					}
+					else{
+					
+						var row: RowItinerary
+						var count = 0
+						var itiId: Int
+						var itiTitle: String
+						var itiText: String
+						var itiPlace: Int
+						var itiStart: NSDate
+						var place: [String]
+					
+						for r in itiSearchResults {
+							count = count + 1
+						
+							// Create a new row
+							row = RowItinerary.init(s: "rowItinerary\(count)", i: count)
+							itiId = r.value(forKey: "id")! as! Int
+							itiTitle = r.value(forKey: "name_\(lang)")! as! String
+							itiText = r.value(forKey: "description_\(lang)")! as! String
+							itiStart = r.value(forKey: "start")! as! NSDate
+							itiPlace = r.value(forKey: "place")! as! Int
+							place = getPlace(place: itiPlace, lang: lang, context: context)
+														
+							row.setTitle(text: itiTitle)
+							row.setText(text: itiText)
+							row.setStart(str: formatTime(date: itiStart))
+							row.setPlace(place: place[0], address: place[1])
+							row.id = id
+						
+							self.itineraryList?.addArrangedSubview(row)
+						}
+						self.itineraryList?.setNeedsLayout()
+						self.itineraryList?.layoutIfNeeded()
+						
+					}
+				}
+				catch {
+					NSLog(":FUTUREACTIVITY:ERROR: Error getting itinerary: \(error)")
+				}
+			}
+		} catch {
+			NSLog(":FUTUREACTIVITYCONTROLLER:ERROR: Error loading past activity: \(error)")
+		}
+	}
+	
+	
+	/**
+	Formats a date to the desired language.
+	:param: text The date.
+	:param: lang Device language (only 'es', 'en', or 'eu').
+	*/
+	func formatDate(date: NSDate, lang: String) -> String{
+		
+		let months_es = ["0index", "enero", "febrero", "marzo", "abril", "mayo", "junio", "julio", "agosto", "septiembre", "octubre", "noviembre", "diciembre"]
+		let months_en = ["0index", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]
+		let months_eu = ["0index", "urtarrilaren", "otsailaren", "martxoaren", "abrilaren", "maiatzaren", "ekainaren", "ustailaren", "abustuaren", "irailaren", "urriaren", "azaroaren", "abenduaren"]
+		let days_es = ["0index", "Lunes", "Martes", "Miercoles", "Jueves", "Viernes", "Sábado", "Domingo"]
+		let days_en = ["0index", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]
+		let days_eu = ["0index", "Astelehena", "Asteartea", "Asteazkena", "Osteguna", "Ostirala", "Larumbata", "Igandea"]
+		
+		let calendar = Calendar.current
+		let day = calendar.component(.day, from: date as Date)
+		let month = calendar.component(.month, from: date as Date)
+		let weekday = calendar.component(.weekday, from: date as Date)
+		var strDate = ""
+		
+		switch lang{
+		case "en":
+			
+			var dayNum = ""
+			switch day{
+			case 1:
+				dayNum = "1th"
+				break
+			case 2:
+				dayNum = "2nd"
+				break;
+			case 3:
+				dayNum = "3rd"
+				break;
+			default:
+				dayNum = "\(weekday)th"
+			}
+			
+			strDate = "\(days_en[weekday]), \(months_en[month]) \(dayNum)"
+			break
+		case "eu":
+			strDate = "\(days_eu[weekday]) \(months_eu[month]) \(day)an"
+			break
+		default:
+			strDate = "\(days_es[weekday]) \(day) de \(months_es[month])"
+		}
+		
+		return strDate
+	}
+	
+	
+	/**
+	Extracts the time from a date to a string.
+	:param: text The date.
+	:return: Time, in string format.
+	*/
+	func formatTime(date: NSDate) -> String{
+
+		let calendar = Calendar.current
+		let hour: Int = calendar.component(.hour, from: date as Date)
+		let minute: Int = calendar.component(.minute, from: date as Date)
+		
+		var strTime = ""
+		if minute <= 9{
+			strTime = "\(hour):0\(minute)"
+		}
+		else{
+			strTime = "\(hour):\(minute)"
+		}
+		
+		return strTime
+	}
+	
+	
+	/**
+	Gets info about a place in the device language.
+	:param: place Place id.
+	:param: lang Device language (only 'es', 'en', or 'eu').
+	:param: context Application context.
+	:return: String array. 0-index item contains the place name. The 1-index one contains the address.
+	*/
+	func getPlace(place: Int, lang: String, context: NSManagedObjectContext) -> [String]{
+		var placeName = ""
+		var placeAddress = ""
+		let fetchRequest: NSFetchRequest<Place> = Place.fetchRequest()
+		fetchRequest.predicate = NSPredicate(format: "id = %i", place)
+		do {
+			let searchResults = try context.fetch(fetchRequest)
+			let r: NSManagedObject = searchResults[0]
+			placeName = r.value(forKey: "name_\(lang)")! as! String
+			placeAddress = r.value(forKey: "address_\(lang)")! as! String
+		}
+		catch{
+			NSLog(":FUTUREACTIVITY:ERROR: Error getting infor about place \(place): \(error)")
+		}
+		return [placeName, placeAddress]
+	}
+	
+	
+	/**
+	Gets the device language. The only recognized languages are Spanish, English and Basque.
+	If the device has another language, Spanish will be selected by default.
+	:return: Two-letter language code.
+	*/
+	func getLanguage() -> String{
+		let pre = NSLocale.preferredLanguages[0].subStr(start: 0, end: 1)
+		if(pre == "es" || pre == "en" || pre == "eu"){
+			return pre
+		}
+		else{
+			return "es"
+		}
+	}
+	
+}
+

+ 1 - 3
app/GalleryView.swift

@@ -73,7 +73,7 @@ class GalleryView: UIView {
 		let lang : String = getLanguage()
 		let lang : String = getLanguage()
 		context.persistentStoreCoordinator = appDelegate.persistentStoreCoordinator
 		context.persistentStoreCoordinator = appDelegate.persistentStoreCoordinator
 		let fetchRequest: NSFetchRequest<Album> = Album.fetchRequest()
 		let fetchRequest: NSFetchRequest<Album> = Album.fetchRequest()
-		let sortDescriptor = NSSortDescriptor(key: "time", ascending: false)
+		let sortDescriptor = NSSortDescriptor(key: "id", ascending: false)
 		let sortDescriptors = [sortDescriptor]
 		let sortDescriptors = [sortDescriptor]
 		fetchRequest.sortDescriptors = sortDescriptors
 		fetchRequest.sortDescriptors = sortDescriptors
 		
 		
@@ -164,7 +164,6 @@ class GalleryView: UIView {
 	*/
 	*/
 	func openAlbum(_ sender:UITapGestureRecognizer? = nil){
 	func openAlbum(_ sender:UITapGestureRecognizer? = nil){
 		let id = (sender?.view as! RowGallery).id
 		let id = (sender?.view as! RowGallery).id
-		NSLog(":GALLERY:DEBUG: getting delegate and showing album \(id).")
 		let delegate: AppDelegate = UIApplication.shared.delegate as! AppDelegate
 		let delegate: AppDelegate = UIApplication.shared.delegate as! AppDelegate
 		delegate.controller?.showAlbum(id: id)
 		delegate.controller?.showAlbum(id: id)
 	}
 	}
@@ -190,7 +189,6 @@ class GalleryView: UIView {
 	Handles the click events to open albums.
 	Handles the click events to open albums.
 	*/
 	*/
 	func setUpRowsTapRecognizers(){
 	func setUpRowsTapRecognizers(){
-		NSLog(":GALLERY:DEBUG: Setting up tap recognizers")
 		for row in self.rows{
 		for row in self.rows{
 			let tapRecognizer = UITapGestureRecognizer(target: row, action: #selector(openAlbum(_:)))
 			let tapRecognizer = UITapGestureRecognizer(target: row, action: #selector(openAlbum(_:)))
 			row.isUserInteractionEnabled = true
 			row.isUserInteractionEnabled = true

+ 3 - 3
app/GalleryView.xib

@@ -1,11 +1,11 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11762" systemVersion="16E195" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="12120" systemVersion="16E195" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
     <device id="retina4_7" orientation="portrait">
     <device id="retina4_7" orientation="portrait">
         <adaptation id="fullscreen"/>
         <adaptation id="fullscreen"/>
     </device>
     </device>
     <dependencies>
     <dependencies>
         <deployment identifier="iOS"/>
         <deployment identifier="iOS"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12088"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     </dependencies>
     <objects>
     <objects>
@@ -24,7 +24,7 @@
                 <scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" ambiguous="YES" alwaysBounceVertical="YES" showsHorizontalScrollIndicator="NO" translatesAutoresizingMaskIntoConstraints="NO" id="aoy-Mh-gpR">
                 <scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" ambiguous="YES" alwaysBounceVertical="YES" showsHorizontalScrollIndicator="NO" translatesAutoresizingMaskIntoConstraints="NO" id="aoy-Mh-gpR">
                     <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
                     <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
                     <subviews>
                     <subviews>
-                        <stackView opaque="NO" contentMode="scaleToFill" ambiguous="YES" misplaced="YES" axis="vertical" alignment="center" spacing="10" translatesAutoresizingMaskIntoConstraints="NO" id="ULw-PH-L95">
+                        <stackView opaque="NO" contentMode="scaleToFill" ambiguous="YES" axis="vertical" alignment="center" spacing="10" translatesAutoresizingMaskIntoConstraints="NO" id="ULw-PH-L95">
                             <rect key="frame" x="0.0" y="0.0" width="375" height="3000"/>
                             <rect key="frame" x="0.0" y="0.0" width="375" height="3000"/>
                             <subviews>
                             <subviews>
                                 <view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="3TY-0K-6q1" customClass="Section" customModule="app">
                                 <view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="3TY-0K-6q1" customClass="Section" customModule="app">

+ 18 - 5
app/HomeView.swift

@@ -469,14 +469,30 @@ class HomeView: UIView {
 	
 	
 			var id: Int
 			var id: Int
 			var image: String
 			var image: String
+			var albumId: Int
 			var i = 0
 			var i = 0
 			for r in searchResults as [NSManagedObject] {
 			for r in searchResults as [NSManagedObject] {
 				
 				
 				image = r.value(forKey: "file")! as! String
 				image = r.value(forKey: "file")! as! String
+				id = r.value(forKey: "id")! as! Int
+				
+				// TODO Get album id
+				// Get album title
+				let albumFetchRequest: NSFetchRequest<Photo_album> = Photo_album.fetchRequest()
+				albumFetchRequest.predicate = NSPredicate(format: "photo = %i", id)
+				do {
+					let results = try context.fetch(albumFetchRequest)
+					let r = results[0]
+					albumId = r.value(forKey: "album")! as! Int
+					row.albumIds[i] = albumId
+				}
+				catch {
+					NSLog(":GALLERYCONTROLLER:ERROR: Error getting album info: \(error)")
+				}
+				
 				row.setImage(idx: i, filename: image)
 				row.setImage(idx: i, filename: image)
-				NSLog(":HOME:DEBUG: Photo \(i)")
+				row.photoIds[i] = id
 				
 				
-				//TODO Set click listener
 				i = i + 1
 				i = i + 1
 			}
 			}
 		}
 		}
@@ -536,7 +552,6 @@ class HomeView: UIView {
 	Opens a post.
 	Opens a post.
 	*/
 	*/
 	func openPost(_ sender:UITapGestureRecognizer? = nil){
 	func openPost(_ sender:UITapGestureRecognizer? = nil){
-		NSLog(":HOME:DEBUG: Getting delegate and showing post.")
 		let delegate: AppDelegate = UIApplication.shared.delegate as! AppDelegate
 		let delegate: AppDelegate = UIApplication.shared.delegate as! AppDelegate
 		delegate.controller?.showPost(id: (sender?.view as! RowHomeBlog).id)
 		delegate.controller?.showPost(id: (sender?.view as! RowHomeBlog).id)
 	}
 	}
@@ -546,7 +561,6 @@ class HomeView: UIView {
 	Opens the La Blanca section when tapping the section.
 	Opens the La Blanca section when tapping the section.
 	*/
 	*/
 	func openLablanca(_ sender:UITapGestureRecognizer? = nil){
 	func openLablanca(_ sender:UITapGestureRecognizer? = nil){
-		NSLog(":HOME:DEBUG: Getting delegate opening the La Blanca section.")
 		let delegate: AppDelegate = UIApplication.shared.delegate as! AppDelegate
 		let delegate: AppDelegate = UIApplication.shared.delegate as! AppDelegate
 		delegate.controller?.showComponent(selected: 2)
 		delegate.controller?.showComponent(selected: 2)
 	}
 	}
@@ -556,7 +570,6 @@ class HomeView: UIView {
 	Opens the Location section when tapping the section.
 	Opens the Location section when tapping the section.
 	*/
 	*/
 	func openLocation(_ sender:UITapGestureRecognizer? = nil){
 	func openLocation(_ sender:UITapGestureRecognizer? = nil){
-		NSLog(":HOME:DEBUG: Getting delegate opening the location section.")
 		let delegate: AppDelegate = UIApplication.shared.delegate as! AppDelegate
 		let delegate: AppDelegate = UIApplication.shared.delegate as! AppDelegate
 		delegate.controller?.showComponent(selected: 1)
 		delegate.controller?.showComponent(selected: 1)
 	}
 	}

+ 2 - 2
app/Info.plist

@@ -17,9 +17,9 @@
 	<key>CFBundlePackageType</key>
 	<key>CFBundlePackageType</key>
 	<string>APPL</string>
 	<string>APPL</string>
 	<key>CFBundleShortVersionString</key>
 	<key>CFBundleShortVersionString</key>
-	<string>0.0.7</string>
+	<string>0.1.1</string>
 	<key>CFBundleVersion</key>
 	<key>CFBundleVersion</key>
-	<string>8</string>
+	<string>11</string>
 	<key>LSRequiresIPhoneOS</key>
 	<key>LSRequiresIPhoneOS</key>
 	<true/>
 	<true/>
 	<key>NSLocationWhenInUseUsageDescription</key>
 	<key>NSLocationWhenInUseUsageDescription</key>

+ 0 - 6
app/LablancaView.swift

@@ -146,8 +146,6 @@ class LablancaView: UIView {
 			// Get info from festivals
 			// Get info from festivals
 			let offerSearchResults = try context.fetch(offerFetchRequest)
 			let offerSearchResults = try context.fetch(offerFetchRequest)
 			
 			
-			NSLog(":LABLANCA:DEBUG: \(offerSearchResults.count) offes found.")
-
 			var row: RowLablancaOffer
 			var row: RowLablancaOffer
 			var count: Int = 0
 			var count: Int = 0
 
 
@@ -245,10 +243,8 @@ class LablancaView: UIView {
 	:param: sender The view that triggered the event.
 	:param: sender The view that triggered the event.
 	*/
 	*/
 	func openSchedule(_ sender:UITapGestureRecognizer? = nil){
 	func openSchedule(_ sender:UITapGestureRecognizer? = nil){
-		NSLog(":LABLANCA:DEBUG: Getting delegate and showing schedule.")
 		let delegate: AppDelegate = UIApplication.shared.delegate as! AppDelegate
 		let delegate: AppDelegate = UIApplication.shared.delegate as! AppDelegate
 		delegate.controller?.showSchedule(margolari: false)
 		delegate.controller?.showSchedule(margolari: false)
-		NSLog(":LABLANCA:DEBUG: Schedule should be shown.")
 	}
 	}
 
 
 
 
@@ -257,10 +253,8 @@ class LablancaView: UIView {
 	:param: sender The view that triggered the event.
 	:param: sender The view that triggered the event.
 	*/
 	*/
 	func openGMSchedule(_ sender:UITapGestureRecognizer? = nil){
 	func openGMSchedule(_ sender:UITapGestureRecognizer? = nil){
-		NSLog(":LABLANCA:DEBUG: Getting delegate and showing GM schedule.")
 		let delegate: AppDelegate = UIApplication.shared.delegate as! AppDelegate
 		let delegate: AppDelegate = UIApplication.shared.delegate as! AppDelegate
 		delegate.controller?.showSchedule(margolari: true)
 		delegate.controller?.showSchedule(margolari: true)
-		NSLog(":LABLANCA:DEBUG: GM schedule should be shown.")
 	}
 	}
 
 
 	
 	

+ 1 - 6
app/LocationView.swift

@@ -92,7 +92,7 @@ class LocationView: UIView {
 	Get new location
 	Get new location
 	*/
 	*/
 	func getNewLocation(){
 	func getNewLocation(){
-		NSLog(":LOCATION:DEBUG: Setting marker.")
+		NSLog(":LOCATION:LOG: Recalculating location.")
 		let defaults = UserDefaults.standard
 		let defaults = UserDefaults.standard
 		if (defaults.value(forKey: "GMLocLat") != nil && defaults.value(forKey: "GMLocLon") != nil){
 		if (defaults.value(forKey: "GMLocLat") != nil && defaults.value(forKey: "GMLocLon") != nil){
 			let lat = defaults.value(forKey: "GMLocLat") as! Double
 			let lat = defaults.value(forKey: "GMLocLat") as! Double
@@ -110,12 +110,10 @@ class LocationView: UIView {
 				marker.title = "Gasteizko Margolariak"
 				marker.title = "Gasteizko Margolariak"
 				//marker.snippet = "Australia"
 				//marker.snippet = "Australia"
 				marker.map = self.map
 				marker.map = self.map
-				NSLog(":LOCATION:DEBUG: Marker set.")
 			
 			
 				let location = self.controller.getLocation()
 				let location = self.controller.getLocation()
 				if location != nil {
 				if location != nil {
 					let d: Int = calculateDistance(lat1: location.latitude, lon1: location.longitude, lat2: lat, lon2: lon)
 					let d: Int = calculateDistance(lat1: location.latitude, lon1: location.longitude, lat2: lat, lon2: lon)
-					NSLog(":LOCATION:LOG: Distance (m): \(d)")
 				
 				
 					if d <= 1000 {
 					if d <= 1000 {
 						self.lbDistance.text = "A \(d) metros de ti."
 						self.lbDistance.text = "A \(d) metros de ti."
@@ -132,9 +130,6 @@ class LocationView: UIView {
 				self.lbNo.isHidden = false
 				self.lbNo.isHidden = false
 			}
 			}
 		}
 		}
-		else{
-			NSLog(":LOCATION:DEBUG: No location saved yet.")
-		}
 	}
 	}
 
 
 
 

+ 3 - 3
app/LocationView.xib

@@ -36,7 +36,7 @@
                         <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="3aZ-8G-e8X" userLabel="Entry">
                         <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="3aZ-8G-e8X" userLabel="Entry">
                             <rect key="frame" x="10" y="43" width="335" height="594"/>
                             <rect key="frame" x="10" y="43" width="335" height="594"/>
                             <subviews>
                             <subviews>
-                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="La cuadrilla está por ahí!" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="jwp-Sd-GF5" userLabel="Title">
+                                <label hidden="YES" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="La cuadrilla está por ahí!" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="jwp-Sd-GF5" userLabel="Title">
                                     <rect key="frame" x="10" y="10" width="315" height="22"/>
                                     <rect key="frame" x="10" y="10" width="315" height="22"/>
                                     <constraints>
                                     <constraints>
                                         <constraint firstAttribute="height" constant="22" id="JQk-vd-DLN"/>
                                         <constraint firstAttribute="height" constant="22" id="JQk-vd-DLN"/>
@@ -45,7 +45,7 @@
                                     <color key="textColor" red="0.1529411765" green="0.33333333329999998" blue="0.45098039220000002" alpha="1" colorSpace="calibratedRGB"/>
                                     <color key="textColor" red="0.1529411765" green="0.33333333329999998" blue="0.45098039220000002" alpha="1" colorSpace="calibratedRGB"/>
                                     <nil key="highlightedColor"/>
                                     <nil key="highlightedColor"/>
                                 </label>
                                 </label>
-                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="lB5-i1-GOe" userLabel="Message">
+                                <label hidden="YES" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="lB5-i1-GOe" userLabel="Message">
                                     <rect key="frame" x="11.5" y="42" width="311" height="21"/>
                                     <rect key="frame" x="11.5" y="42" width="311" height="21"/>
                                     <constraints>
                                     <constraints>
                                         <constraint firstAttribute="height" constant="21" id="ann-h3-NzS"/>
                                         <constraint firstAttribute="height" constant="21" id="ann-h3-NzS"/>
@@ -60,7 +60,7 @@
                                     <nil key="textColor"/>
                                     <nil key="textColor"/>
                                     <nil key="highlightedColor"/>
                                     <nil key="highlightedColor"/>
                                 </label>
                                 </label>
-                                <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="guk-vu-ykd" customClass="GMSMapView">
+                                <view hidden="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="guk-vu-ykd" customClass="GMSMapView">
                                     <rect key="frame" x="10" y="73" width="315" height="492"/>
                                     <rect key="frame" x="10" y="73" width="315" height="492"/>
                                     <color key="backgroundColor" red="1" green="0.20334201390000001" blue="0.32001410590000001" alpha="1" colorSpace="calibratedRGB"/>
                                     <color key="backgroundColor" red="1" green="0.20334201390000001" blue="0.32001410590000001" alpha="1" colorSpace="calibratedRGB"/>
                                     <userDefinedRuntimeAttributes>
                                     <userDefinedRuntimeAttributes>

+ 223 - 0
app/Notifications.swift

@@ -0,0 +1,223 @@
+// Copyright (C) 2016 Inigo Valentin
+//
+// This file is part of the Gasteizko Margolariak IOS app.
+//
+// The Gasteizko Margolariak IOS app is free software: you can
+// redistribute it and/or modify it under the terms of the
+// GNU General Public License as published by the Free Software
+// Foundation, either version 3 of the License, or (at your
+// option) any later version.
+//
+// The Gasteizko Margolariak IOS app is distributed in the
+// hope that it will be useful, but WITHOUT ANY WARRANTY;
+// without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
+// Public License for more details.
+//
+// You should have received a copy of the GNU General Public
+// License along with the Gasteizko Margolariak IOS app.
+// If not, see <http://www.gnu.org/licenses/>.
+
+import Foundation
+import CoreData
+import UIKit
+import UserNotifications
+
+/**
+Class to handle server sync.
+*/
+class Notifications{
+	
+	/**
+	Starts the sync process.
+	Always asynchronously.
+	*/
+	init(){
+		let url = buildUrl();
+		notification(url: url)
+	}
+	
+	
+	/**
+	Builds the URL to perform the sync against.
+	:returns: The URL.
+	*/
+	func buildUrl() -> URL{
+		
+		let url = URL(string: "https://margolariak.com/API/v1/notifications.php")
+		
+		return url!
+	}
+	
+	
+	/**
+	Performs an asynchronous sync.
+	It fetches the info from the server and stores as Core Data
+	:param: url The url to sync.
+	*/
+	func notification(url: URL){
+		
+		NSLog(":NOTIFICATION:LOG: Notification fetch started.")
+		
+		//Synchronously get data
+		let task = URLSession.shared.dataTask(with: url) { data, response, error in
+			guard error == nil else {
+				NSLog(":NOTIFICATION:ERROR: Unknown error.")
+				return
+			}
+			guard let data = data else {
+				NSLog(":NOTIFICATION:ERROR: Data is empty.")
+				return
+			}
+			
+			let strData: String = String(data:data, encoding: String.Encoding.utf8)!
+			NSLog(":NOTIFICATION:LOG: Data received: \(strData)")
+			if strData.length > 0{
+				let dataNotification: [String] = self.getData(data: strData)
+				self.saveNotifications(entries: dataNotification)
+			}
+			
+		}
+		
+		task.resume()
+	}
+	
+	
+	/**
+	Extracts notifications from the raw data received.
+	:param: param Received data in JSON format.
+	:return: Array of strings containing the notifications.
+	*/
+	func getData(data: String) -> [String]{
+		
+		//Separate the entries
+		var entries : [String] = data.components(separatedBy: "},{")
+		
+		//Modify the first and the last one to remove bracers
+		entries[0] = entries[0].subStr(start: 1, end: entries[0].length - 1)
+		entries[entries.count - 1] = entries[entries.count - 1].subStr(start: 0, end: entries[entries.count - 1].length - 2)
+		
+		
+		//Return the array
+		return entries
+	}
+	
+	
+	/**
+	Saves the data in the table.
+	:param: entries Array of strings containing the rows of the table, in JSON format.
+	*/
+	func saveNotifications(entries : [String]){
+		
+		let dateFormatter = DateFormatter()
+		dateFormatter.timeZone = TimeZone.ReferenceType.local
+		
+		//Set up context
+		let appDelegate = UIApplication.shared.delegate as! AppDelegate
+		let context = NSManagedObjectContext(concurrencyType: .privateQueueConcurrencyType)
+		context.persistentStoreCoordinator = appDelegate.persistentStoreCoordinator
+		
+		let entity =  NSEntityDescription.entity(forEntityName: "Notification", in: context)
+		
+		var row: NSManagedObject
+		
+		//Loop new entries
+		for entry in entries{
+			
+			//Get id
+			var str = entry
+			let id: Int = Int(str.subStr(start : str.indexOf(target : "\"id\":")! + 6, end : str.indexOf(target : ",\"")! - 2))!
+			
+			//Get title_es
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let title_es: String = str.subStr(start : str.indexOf(target : "\"title_es\":")! + 12, end : str.indexOf(target : ",\"")! - 2)
+			
+			//Get title_en
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let title_en: String = str.subStr(start : str.indexOf(target : "\"title_en\":")! + 12, end : str.indexOf(target : ",\"")! - 2)
+			
+			//Get title_eu
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let title_eu: String = str.subStr(start : str.indexOf(target : "\"title_eu\":")! + 12, end : str.indexOf(target : ",\"")! - 2)
+			
+			//Get text_es
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let text_es: String = str.subStr(start : str.indexOf(target : "\"text_es\":")! + 11, end : str.indexOf(target : ",\"")! - 2)
+			
+			//Get text_en
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let text_en: String = str.subStr(start : str.indexOf(target : "\"text_en\":")! + 11, end : str.indexOf(target : ",\"")! - 2)
+			
+			//Get text_eu
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let text_eu: String = str.subStr(start : str.indexOf(target : "\"text_eu\":")! + 11, end: str.indexOf(target : ",\"")! - 2)
+			
+			//Get dtime
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss"
+			let dtime = dateFormatter.date(from : str.subStr(start : str.indexOf(target : "\"dtime\":")! + 9, end : str.indexOf(target : ",\"")! - 2))!
+			
+			//Get GM
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let gm: Int = Int(str.subStr(start : str.indexOf(target : "\"gm\":")! + 6, end : str.indexOf(target : ",\"")! - 2))!
+			
+			// Not getting seen
+			
+			// Save & show
+			let fetchRequest: NSFetchRequest<Notification> = Notification.fetchRequest()
+			fetchRequest.predicate = NSPredicate(format: "id == %i", id)
+			fetchRequest.fetchLimit = 1
+			do{
+				let searchResults = try context.fetch(fetchRequest)
+				if (searchResults.count == 0){
+					row = NSManagedObject(entity: entity!, insertInto: context)
+					row.setValue(id, forKey: "id")
+					row.setValue(title_es, forKey: "title_es")
+					row.setValue(title_en, forKey: "title_en")
+					row.setValue(title_eu, forKey: "title_eu")
+					row.setValue(text_es, forKey: "text_es")
+					row.setValue(text_en, forKey: "text_en")
+					row.setValue(text_eu, forKey: "text_eu")
+					row.setValue(dtime, forKey: "dtime")
+					row.setValue(gm, forKey: "gm")
+					do {
+						try context.save()
+						
+						if #available(iOS 10.0, *) {
+							let content = UNMutableNotificationContent()
+							
+							// TODO Select language.
+							content.title = title_es
+							content.body = text_es
+							content.sound = UNNotificationSound.default()
+							let trigger = UNTimeIntervalNotificationTrigger.init(timeInterval: 1, repeats: false)
+							let request = UNNotificationRequest.init(identifier: "Not", content: content, trigger: trigger)
+							
+							// Schedule the notification.
+							let center = UNUserNotificationCenter.current()
+							center.add(request) {
+								(error) in
+								NSLog(":NOTIFICATION:ERROR: Error showing notification \(String(describing: error))")
+							}
+						} else {
+							// Fallback on earlier versions
+						}
+						// TODO Get language
+						
+					}
+					catch let error as NSError  {
+						NSLog(":NOTIFICATION:ERROR: Could not save notification with id \(id): \(error), \(error.userInfo).")
+					}
+					catch {
+						NSLog(":NOTIFICATION:ERROR: Could not save notification with id \(id).")
+					}
+				}
+			}
+			catch {
+				NSLog(":NOTIFICATION:ERROR: Error getting notifications: \(error)")
+			}
+		}
+	}
+	
+	
+}

+ 2 - 5
app/PastActivityViewController.swift

@@ -65,7 +65,6 @@ class PastActivityViewController: UIViewController, UIGestureRecognizerDelegate
 	Dismisses the controller.
 	Dismisses the controller.
 	*/
 	*/
 	func back() {
 	func back() {
-		NSLog(":FUTUREACTIVITYCONTROLLER:CONTROLLER:DEBUG: Back")
 		self.dismiss(animated: true, completion: nil)
 		self.dismiss(animated: true, completion: nil)
 	}
 	}
 	
 	
@@ -84,8 +83,6 @@ class PastActivityViewController: UIViewController, UIGestureRecognizerDelegate
 	*/
 	*/
 	public func loadActivity(id: Int){
 	public func loadActivity(id: Int){
 		
 		
-		NSLog(":PASTACTIVITYCONTROLLER:DEBUG: Loading past activity \(id)")
-		
 		let context = NSManagedObjectContext(concurrencyType: .privateQueueConcurrencyType)
 		let context = NSManagedObjectContext(concurrencyType: .privateQueueConcurrencyType)
 		let appDelegate = UIApplication.shared.delegate as! AppDelegate
 		let appDelegate = UIApplication.shared.delegate as! AppDelegate
 		let lang : String = getLanguage()
 		let lang : String = getLanguage()
@@ -131,12 +128,12 @@ class PastActivityViewController: UIViewController, UIGestureRecognizerDelegate
 						self.activityImage.setImage(localPath: path, remotePath: "https://margolariak.com/\(path)")
 						self.activityImage.setImage(localPath: path, remotePath: "https://margolariak.com/\(path)")
 					}
 					}
 				} catch {
 				} catch {
-					NSLog(":PASTACTIVITYCONTROLLER:DEBUG: Error getting image for post \(id): \(error)")
+					NSLog(":PASTACTIVITYCONTROLLER:ERROR: Error getting image for past activity \(id): \(error)")
 				}
 				}
 				
 				
 			}
 			}
 		} catch {
 		} catch {
-			NSLog(":PASTACTIVITYCONTROLLER:DEBUG: Error with request: \(error)")
+			NSLog(":PASTACTIVITYCONTROLLER:ERROR: Error loading past activity: \(error)")
 		}
 		}
 	}
 	}
 	
 	

+ 156 - 39
app/PhotoViewController.swift

@@ -25,13 +25,7 @@ import CoreData
 The view controller of the app.
 The view controller of the app.
 */
 */
 class PhotoViewController: UIViewController, UIGestureRecognizerDelegate {
 class PhotoViewController: UIViewController, UIGestureRecognizerDelegate {
-	
-	
-	//@IBOutlet weak var barTitle: UILabel!
-	//@IBOutlet weak var barButton: UIButton!
-	//@IBOutlet weak var postText: UILabel!
-	//@IBOutlet weak var postTitle: UILabel!
-	//@IBOutlet weak var postImage: UIImageView!
+
 	@IBOutlet weak var barButton: UIButton!
 	@IBOutlet weak var barButton: UIButton!
 	@IBOutlet weak var barTitle: UILabel!
 	@IBOutlet weak var barTitle: UILabel!
 	@IBOutlet weak var photoTitle: UILabel!
 	@IBOutlet weak var photoTitle: UILabel!
@@ -43,8 +37,10 @@ class PhotoViewController: UIViewController, UIGestureRecognizerDelegate {
 	var albumId: Int = -1
 	var albumId: Int = -1
 	var photoId: Int = -1
 	var photoId: Int = -1
 	var photoIds: [Int] = []
 	var photoIds: [Int] = []
+	var photoIdx: Int = 0
 	var passPhotoId: Int = -1
 	var passPhotoId: Int = -1
 	var passAlbumId: Int = -1
 	var passAlbumId: Int = -1
+	var albumTitle: String = ""
 	var delegate: AppDelegate?
 	var delegate: AppDelegate?
 	
 	
 	
 	
@@ -61,15 +57,59 @@ class PhotoViewController: UIViewController, UIGestureRecognizerDelegate {
 	Run when the app loads.
 	Run when the app loads.
 	*/
 	*/
 	override func viewDidLoad() {
 	override func viewDidLoad() {
-		NSLog(":PHOTOCONTROLLER:DEBUG: viewDidLoad")
+		
+		// Populate photo array.
+		let context = NSManagedObjectContext(concurrencyType: .privateQueueConcurrencyType)
+		let appDelegate = UIApplication.shared.delegate as! AppDelegate
+		let lang : String = getLanguage()
+		context.persistentStoreCoordinator = appDelegate.persistentStoreCoordinator
+		let fetchRequest: NSFetchRequest<Photo_album> = Photo_album.fetchRequest()
+		fetchRequest.predicate = NSPredicate(format: "album = %i", albumId)
+		do {
+			let searchResults = try context.fetch(fetchRequest)
+			
+			var id: Int
+			var i = 0
+			
+			for r in searchResults as [NSManagedObject] {
+				
+				id = r.value(forKey: "photo")! as! Int
+				photoIds.append(id)
+				if id == photoId{
+					photoIdx = i
+				}
+				i = i + 1
+			}
+			
+			// Get album title
+			let albumFetchRequest: NSFetchRequest<Album> = Album.fetchRequest()
+			albumFetchRequest.predicate = NSPredicate(format: "id = %i", albumId)
+			do {
+				let results = try context.fetch(albumFetchRequest)
+				let r = results[0]
+				self.albumTitle = r.value(forKey: "title_\(lang)")! as! String
+			}
+			catch {
+				NSLog(":GALLERYCONTROLLER:ERROR: Error getting album info: \(error)")
+			}
+			
+		} catch {
+			NSLog(":PHOTO:ERROR: Error getting infor from album \(albumId): \(error)")
+		}
+		
+		// Set up buttons
+		let tapRecognizerNext = UITapGestureRecognizer(target: self, action: #selector(nextPhoto(_:)))
+		btNext.isUserInteractionEnabled = true
+		btNext.addGestureRecognizer(tapRecognizerNext)
+		let tapRecognizerPrev = UITapGestureRecognizer(target: self, action: #selector(prevPhoto(_:)))
+		btPrev.isUserInteractionEnabled = true
+		btPrev.addGestureRecognizer(tapRecognizerPrev)
 		
 		
 		super.viewDidLoad()
 		super.viewDidLoad()
 		self.loadPhoto(id: photoId)
 		self.loadPhoto(id: photoId)
 		
 		
-		// TODO populate photo array
-		
 		// Set button action
 		// Set button action
-		// TODO barButton.addTarget(self, action: #selector(self.back), for: .touchUpInside)
+		self.barButton.addTarget(self, action: #selector(self.back), for: .touchUpInside)
 	}
 	}
 	
 	
 	
 	
@@ -77,7 +117,6 @@ class PhotoViewController: UIViewController, UIGestureRecognizerDelegate {
 	Dismisses the controller.
 	Dismisses the controller.
 	*/
 	*/
 	func back() {
 	func back() {
-		NSLog(":PHOTOCONTROLLER:DEBUG: Back")
 		self.dismiss(animated: true, completion: nil)
 		self.dismiss(animated: true, completion: nil)
 	}
 	}
 	
 	
@@ -90,6 +129,24 @@ class PhotoViewController: UIViewController, UIGestureRecognizerDelegate {
 	}
 	}
 	
 	
 	
 	
+	/**
+	Opens the next photo.
+	*/
+	func nextPhoto(_ sender:UITapGestureRecognizer? = nil){
+		photoIdx = photoIdx + 1
+		loadPhoto(id: photoIds[photoIdx])
+	}
+	
+	
+	/**
+	Opens the previous photo.
+	*/
+	func prevPhoto(_ sender:UITapGestureRecognizer? = nil){
+		photoIdx = photoIdx - 1
+		loadPhoto(id: photoIds[photoIdx])
+	}
+	
+	
 	/**
 	/**
 	Loads a photo in the viewer.
 	Loads a photo in the viewer.
 	:param: id
 	:param: id
@@ -107,42 +164,52 @@ class PhotoViewController: UIViewController, UIGestureRecognizerDelegate {
 			let searchResults = try context.fetch(fetchRequest)
 			let searchResults = try context.fetch(fetchRequest)
 			
 			
 			var sTitle: String
 			var sTitle: String
-			var sText: String
 			var image: String
 			var image: String
+			var date: NSDate
 			
 			
 			for r in searchResults as [NSManagedObject] {
 			for r in searchResults as [NSManagedObject] {
 				
 				
 				sTitle = r.value(forKey: "title_\(lang)")! as! String
 				sTitle = r.value(forKey: "title_\(lang)")! as! String
-				// TODO photoTitle.text = "  \(sTitle.decode().stripHtml())"
-				// TODO date
+				if sTitle == "" || sTitle == "ul" {
+					sTitle = self.albumTitle
+				}
+				self.photoTitle.text = "  \(sTitle.decode().stripHtml())"
 				
 				
-				// TODO set photo
+				// Enable or disable buttons
+				if photoIdx == 0{
+					self.btPrev.isEnabled = false
+					self.btPrev.alpha = 0.5
+				}
+				else{
+					self.btPrev.isEnabled = true
+					self.btPrev.alpha = 1
+				}
+				if photoIdx == photoIds.count - 1{
+					self.btNext.isEnabled = false
+					self.btNext.alpha = 0.5
+				}
+				else{
+					self.btNext.isEnabled = true
+					self.btNext.alpha = 1
+				}
 				
 				
-				/*
-				// Get main image
+				// Get image
 				image = ""
 				image = ""
-				let imgFetchRequest: NSFetchRequest<Post_image> = Post_image.fetchRequest()
-				let imgSortDescriptor = NSSortDescriptor(key: "idx", ascending: true)
-				let imgSortDescriptors = [imgSortDescriptor]
-				imgFetchRequest.sortDescriptors = imgSortDescriptors
-				imgFetchRequest.predicate = NSPredicate(format: "post == %i", id)
-				imgFetchRequest.fetchLimit = 1
-				//TODO get more images
+				let imgFetchRequest: NSFetchRequest<Photo> = Photo.fetchRequest()
+				imgFetchRequest.predicate = NSPredicate(format: "id == %i", id)
 				do{
 				do{
 					let imgSearchResults = try context.fetch(imgFetchRequest)
 					let imgSearchResults = try context.fetch(imgFetchRequest)
-					for imgR in imgSearchResults as [NSManagedObject]{
-						image = imgR.value(forKey: "image")! as! String
-						if image == ""{
-							self.postImage.isHidden = true
-						}
-						else{
-							let path = "img/actividades/thumb/\(image)"
-							self.postImage.setImage(localPath: path, remotePath: "https://margolariak.com/\(path)")
-						}
-					}
-				} catch {
-					NSLog(":POST:ERROR: Error getting image for post \(id): \(error)")
-				}*/
+					let r: NSManagedObject = imgSearchResults[0]
+					image = r.value(forKey: "file")! as! String
+					date = r.value(forKey: "uploaded")! as! NSDate
+					let path = "img/galeria/preview/\(image)"
+					// TODO: Every time, set placeholder image
+					self.photoImage.setImage(localPath: path, remotePath: "https://margolariak.com/\(path)")
+					self.photoDate.text = formatDate(date: date, lang: lang)
+				}
+				catch {
+					NSLog(":PHOTO:ERROR: Error getting image for post \(id): \(error)")
+				}
 				
 				
 			}
 			}
 		} catch {
 		} catch {
@@ -150,8 +217,58 @@ class PhotoViewController: UIViewController, UIGestureRecognizerDelegate {
 		}
 		}
 	}
 	}
 	
 	
+
 	
 	
-	// TODO Buttons
+	/**
+	Formats a date to the desired language.
+	:param: text The date.
+	:param: lang Device language (only 'es', 'en', or 'eu').
+	*/
+	func formatDate(date: NSDate, lang: String) -> String{
+		
+		let months_es = ["0index", "enero", "febrero", "marzo", "abril", "mayo", "junio", "julio", "agosto", "septiembre", "octubre", "noviembre", "diciembre"]
+		let months_en = ["0index", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]
+		let months_eu = ["0index", "urtarrilaren", "otsailaren", "martxoaren", "abrilaren", "maiatzaren", "ekainaren", "ustailaren", "abustuaren", "irailaren", "urriaren", "azaroaren", "abenduaren"]
+		let days_es = ["0index", "Lunes", "Martes", "Miercoles", "Jueves", "Viernes", "Sábado", "Domingo"]
+		let days_en = ["0index", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]
+		let days_eu = ["0index", "Astelehena", "Asteartea", "Asteazkena", "Osteguna", "Ostirala", "Larumbata", "Igandea"]
+		
+		let calendar = Calendar.current
+		let year = calendar.component(.year, from: date as Date)
+		let day = calendar.component(.day, from: date as Date)
+		let month = calendar.component(.month, from: date as Date)
+		let weekday = calendar.component(.weekday, from: date as Date)
+		var strDate = ""
+		
+		switch lang{
+		case "en":
+			
+			var dayNum = ""
+			switch day{
+			case 1:
+				dayNum = "1th"
+				break
+			case 2:
+				dayNum = "2nd"
+				break;
+			case 3:
+				dayNum = "3rd"
+				break;
+			default:
+				dayNum = "\(weekday)th"
+			}
+			
+			strDate = "\(days_en[weekday]), \(months_en[month]) \(dayNum), \(year)"
+			break
+		case "eu":
+			strDate = "\(year)ko \(days_eu[weekday]) \(months_eu[month]) \(day)an"
+			break
+		default:
+			strDate = "\(days_es[weekday]) \(day) de \(months_es[month]) de \(year)"
+		}
+		
+		return strDate
+	}
 	
 	
 	
 	
 	/**
 	/**

+ 2 - 5
app/PostViewController.swift

@@ -53,12 +53,9 @@ class PostViewController: UIViewController, UIGestureRecognizerDelegate {
 		// Set button action
 		// Set button action
 		barButton.addTarget(self, action: #selector(self.back), for: .touchUpInside)
 		barButton.addTarget(self, action: #selector(self.back), for: .touchUpInside)
 	}
 	}
-	
-	//TODO implement all the logic for post loading here, including iboutlts
-	
+		
 	
 	
 	func back() {
 	func back() {
-		print("POSTCONTROLLER:DEBUG: Back")
 		self.dismiss(animated: true, completion: nil)
 		self.dismiss(animated: true, completion: nil)
 	}
 	}
 	
 	
@@ -112,7 +109,7 @@ class PostViewController: UIViewController, UIGestureRecognizerDelegate {
 							self.postImage.isHidden = true
 							self.postImage.isHidden = true
 						}
 						}
 						else{
 						else{
-							let path = "img/actividades/thumb/\(image)"
+							let path = "img/blog/thumb/\(image)"
 							self.postImage.setImage(localPath: path, remotePath: "https://margolariak.com/\(path)")
 							self.postImage.setImage(localPath: path, remotePath: "https://margolariak.com/\(path)")
 						}
 						}
 					}
 					}

+ 3 - 8
app/RowAlbum.swift

@@ -53,7 +53,7 @@ Extension of UIView to be formatted as sections.
 	private func loadViewFromNib() {
 	private func loadViewFromNib() {
 		let bundle = Bundle(for: type(of: self))
 		let bundle = Bundle(for: type(of: self))
 		let nib = UINib(nibName: String(describing: type(of: self)), bundle: bundle)
 		let nib = UINib(nibName: String(describing: type(of: self)), bundle: bundle)
-		nib.instantiate(withOwner: self, options: nil).first
+		nib.instantiate(withOwner: self, options: nil)
 		
 		
 		self.frame = self.bounds
 		self.frame = self.bounds
 		self.autoresizingMask = [.flexibleWidth, .flexibleHeight]
 		self.autoresizingMask = [.flexibleWidth, .flexibleHeight]
@@ -73,7 +73,6 @@ Extension of UIView to be formatted as sections.
 	:param: i Custom identifier
 	:param: i Custom identifier
 	*/
 	*/
 	init(s: String, i: Int) {
 	init(s: String, i: Int) {
-		NSLog(":ROWALBUM:DEBUG: Init \(s), \(i)")
 		
 		
 		super.init(frame: CGRect(x: 0, y: 0, width: 0, height: 0))
 		super.init(frame: CGRect(x: 0, y: 0, width: 0, height: 0))
 		loadViewFromNib()
 		loadViewFromNib()
@@ -99,15 +98,13 @@ Extension of UIView to be formatted as sections.
 	}
 	}
 	
 	
 	func openLeftPhoto(_ sender:UITapGestureRecognizer? = nil){
 	func openLeftPhoto(_ sender:UITapGestureRecognizer? = nil){
-		NSLog(":ROWALBUM:DEBUG: Getting delegate and showing left photo.")
 		let delegate: AppDelegate = UIApplication.shared.delegate as! AppDelegate
 		let delegate: AppDelegate = UIApplication.shared.delegate as! AppDelegate
-		delegate.controller?.showPhoto(album: self.id, photo: self.photoIds[0])
+		delegate.albumController?.showPhoto(album: self.id, photo: self.photoIds[0])
 	}
 	}
 	
 	
 	func openRightPhoto(_ sender:UITapGestureRecognizer? = nil){
 	func openRightPhoto(_ sender:UITapGestureRecognizer? = nil){
-		NSLog(":ROWALBUM:DEBUG: Getting delegate and showing right photo.")
 		let delegate: AppDelegate = UIApplication.shared.delegate as! AppDelegate
 		let delegate: AppDelegate = UIApplication.shared.delegate as! AppDelegate
-		delegate.controller?.showPhoto(album: self.id, photo: self.photoIds[1])
+		delegate.albumController?.showPhoto(album: self.id, photo: self.photoIds[1])
 	}
 	}
 	
 	
 	
 	
@@ -130,14 +127,12 @@ Extension of UIView to be formatted as sections.
 				let tapRecognizer = UITapGestureRecognizer(target: self, action: #selector (RowAlbum.openLeftPhoto(_:)))
 				let tapRecognizer = UITapGestureRecognizer(target: self, action: #selector (RowAlbum.openLeftPhoto(_:)))
 				tapRecognizer.delegate = (UIApplication.shared.delegate as! AppDelegate).controller
 				tapRecognizer.delegate = (UIApplication.shared.delegate as! AppDelegate).controller
 				self.preview[idx].isUserInteractionEnabled = true
 				self.preview[idx].isUserInteractionEnabled = true
-				NSLog(":ROWALBUM:DEBUG: Setting tap recognizer for left photo.")
 				self.preview[idx].addGestureRecognizer(tapRecognizer)
 				self.preview[idx].addGestureRecognizer(tapRecognizer)
 			}
 			}
 			else{
 			else{
 				let tapRecognizer = UITapGestureRecognizer(target: self, action: #selector (RowAlbum.openRightPhoto(_:)))
 				let tapRecognizer = UITapGestureRecognizer(target: self, action: #selector (RowAlbum.openRightPhoto(_:)))
 				tapRecognizer.delegate = (UIApplication.shared.delegate as! AppDelegate).controller
 				tapRecognizer.delegate = (UIApplication.shared.delegate as! AppDelegate).controller
 				self.preview[idx].isUserInteractionEnabled = true
 				self.preview[idx].isUserInteractionEnabled = true
-				NSLog(":ROWALBUM:DEBUG: Setting tap recognizer for right photo.")
 				self.preview[idx].addGestureRecognizer(tapRecognizer)
 				self.preview[idx].addGestureRecognizer(tapRecognizer)
 			}
 			}
 		}
 		}

+ 1 - 2
app/RowBlog.swift

@@ -51,7 +51,7 @@ Extension of UIView to be formatted as post rows.
 	private func loadViewFromNib() {
 	private func loadViewFromNib() {
 		let bundle = Bundle(for: type(of: self))
 		let bundle = Bundle(for: type(of: self))
 		let nib = UINib(nibName: String(describing: type(of: self)), bundle: bundle)
 		let nib = UINib(nibName: String(describing: type(of: self)), bundle: bundle)
-		nib.instantiate(withOwner: self, options: nil).first as! UIView
+		nib.instantiate(withOwner: self, options: nil)
 	}
 	}
 	
 	
 	
 	
@@ -127,7 +127,6 @@ Extension of UIView to be formatted as post rows.
 	Opens an activity.
 	Opens an activity.
 	*/
 	*/
 	func openPost(_ sender:UITapGestureRecognizer? = nil){
 	func openPost(_ sender:UITapGestureRecognizer? = nil){
-		NSLog(":ROWBLOG:DEBUG: Getting delegate and showing post \(self.id).")
 		let delegate: AppDelegate = UIApplication.shared.delegate as! AppDelegate
 		let delegate: AppDelegate = UIApplication.shared.delegate as! AppDelegate
 		delegate.controller?.showPost(id: self.id)
 		delegate.controller?.showPost(id: self.id)
 	}
 	}

+ 1 - 1
app/RowBlog.xib

@@ -36,7 +36,7 @@
                                     <color key="textColor" red="0.1529411765" green="0.33333333329999998" blue="0.45098039220000002" alpha="1" colorSpace="calibratedRGB"/>
                                     <color key="textColor" red="0.1529411765" green="0.33333333329999998" blue="0.45098039220000002" alpha="1" colorSpace="calibratedRGB"/>
                                     <nil key="highlightedColor"/>
                                     <nil key="highlightedColor"/>
                                 </label>
                                 </label>
-                                <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="PhotoPlaceholder" translatesAutoresizingMaskIntoConstraints="NO" id="6hA-MD-OsD" userLabel="Image">
+                                <imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="PhotoPlaceholder" translatesAutoresizingMaskIntoConstraints="NO" id="6hA-MD-OsD" userLabel="Image">
                                     <rect key="frame" x="10" y="40" width="71" height="64"/>
                                     <rect key="frame" x="10" y="40" width="71" height="64"/>
                                     <constraints>
                                     <constraints>
                                         <constraint firstAttribute="height" constant="64" id="68z-jj-fIa"/>
                                         <constraint firstAttribute="height" constant="64" id="68z-jj-fIa"/>

+ 2 - 3
app/RowFutureActivity.swift

@@ -54,7 +54,7 @@ Extension of UIView to be formatted as future activity rows.
 	private func loadViewFromNib() {
 	private func loadViewFromNib() {
 		let bundle = Bundle(for: type(of: self))
 		let bundle = Bundle(for: type(of: self))
 		let nib = UINib(nibName: String(describing: type(of: self)), bundle: bundle)
 		let nib = UINib(nibName: String(describing: type(of: self)), bundle: bundle)
-		nib.instantiate(withOwner: self, options: nil).first
+		nib.instantiate(withOwner: self, options: nil)
 	}
 	}
 	
 	
 	
 	
@@ -203,8 +203,7 @@ Extension of UIView to be formatted as future activity rows.
 	Opens an activity.
 	Opens an activity.
 	*/
 	*/
 	func openActivity(_ sender:UITapGestureRecognizer? = nil){
 	func openActivity(_ sender:UITapGestureRecognizer? = nil){
-		NSLog(":ROWFUTUREACTIVITY:DEBUG: Getting delegate and showing past activity \(self.id).")
 		let delegate: AppDelegate = UIApplication.shared.delegate as! AppDelegate
 		let delegate: AppDelegate = UIApplication.shared.delegate as! AppDelegate
-		delegate.controller?.showPastActivity(id: self.id)
+		delegate.controller?.showFutureActivity(id: self.id)
 	}
 	}
 }
 }

+ 19 - 18
app/RowFutureActivity.xib

@@ -1,11 +1,11 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11762" systemVersion="16E195" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="12120" systemVersion="16E195" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
     <device id="retina4_7" orientation="portrait">
     <device id="retina4_7" orientation="portrait">
         <adaptation id="fullscreen"/>
         <adaptation id="fullscreen"/>
     </device>
     </device>
     <dependencies>
     <dependencies>
         <deployment identifier="iOS"/>
         <deployment identifier="iOS"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12088"/>
         <capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
         <capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     </dependencies>
@@ -27,10 +27,10 @@
             <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
             <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
             <subviews>
             <subviews>
                 <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="LXM-17-fy1" userLabel="Container">
                 <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="LXM-17-fy1" userLabel="Container">
-                    <rect key="frame" x="0.0" y="263.5" width="375" height="140"/>
+                    <rect key="frame" x="0.0" y="248.5" width="375" height="170"/>
                     <subviews>
                     <subviews>
                         <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Oax-mA-mEd" userLabel="Entry">
                         <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Oax-mA-mEd" userLabel="Entry">
-                            <rect key="frame" x="10" y="10" width="355" height="140"/>
+                            <rect key="frame" x="10" y="10" width="355" height="170"/>
                             <subviews>
                             <subviews>
                                 <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Vd3-c0-iYd" userLabel="Title">
                                 <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Vd3-c0-iYd" userLabel="Title">
                                     <rect key="frame" x="10" y="10" width="335" height="22"/>
                                     <rect key="frame" x="10" y="10" width="335" height="22"/>
@@ -39,35 +39,36 @@
                                     <nil key="highlightedColor"/>
                                     <nil key="highlightedColor"/>
                                 </label>
                                 </label>
                                 <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="pCj-dq-5rF" userLabel="Date">
                                 <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="pCj-dq-5rF" userLabel="Date">
-                                    <rect key="frame" x="14.5" y="32" width="325" height="21"/>
-                                    <fontDescription key="fontDescription" type="system" pointSize="17"/>
+                                    <rect key="frame" x="9.5" y="40" width="335" height="21"/>
+                                    <fontDescription key="fontDescription" type="italicSystem" pointSize="17"/>
                                     <color key="textColor" red="0.15294117647058825" green="0.33333333333333331" blue="0.45098039215686275" alpha="1" colorSpace="calibratedRGB"/>
                                     <color key="textColor" red="0.15294117647058825" green="0.33333333333333331" blue="0.45098039215686275" alpha="1" colorSpace="calibratedRGB"/>
                                     <nil key="highlightedColor"/>
                                     <nil key="highlightedColor"/>
                                 </label>
                                 </label>
-                                <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="PhotoPlaceholder" translatesAutoresizingMaskIntoConstraints="NO" id="xIf-kY-gPW" userLabel="Image">
+                                <imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="PhotoPlaceholder" translatesAutoresizingMaskIntoConstraints="NO" id="xIf-kY-gPW" userLabel="Image">
+                                    <rect key="frame" x="10" y="69" width="71" height="64"/>
                                     <rect key="frame" x="10" y="53" width="71" height="64"/>
                                     <rect key="frame" x="10" y="53" width="71" height="64"/>
                                     <constraints>
                                     <constraints>
                                         <constraint firstAttribute="height" constant="64" id="GGt-lC-syI"/>
                                         <constraint firstAttribute="height" constant="64" id="GGt-lC-syI"/>
                                     </constraints>
                                     </constraints>
                                 </imageView>
                                 </imageView>
                                 <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" numberOfLines="3" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="m6I-vy-k36" userLabel="Text">
                                 <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" numberOfLines="3" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="m6I-vy-k36" userLabel="Text">
-                                    <rect key="frame" x="97" y="53" width="248" height="21"/>
+                                    <rect key="frame" x="97" y="61" width="248" height="21"/>
                                     <fontDescription key="fontDescription" type="system" pointSize="17"/>
                                     <fontDescription key="fontDescription" type="system" pointSize="17"/>
                                     <nil key="textColor"/>
                                     <nil key="textColor"/>
                                     <nil key="highlightedColor"/>
                                     <nil key="highlightedColor"/>
                                 </label>
                                 </label>
                                 <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="VQF-xA-wca" userLabel="City">
                                 <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="VQF-xA-wca" userLabel="City">
-                                    <rect key="frame" x="20" y="119" width="275" height="21"/>
-                                    <fontDescription key="fontDescription" type="system" pointSize="17"/>
+                                    <rect key="frame" x="10" y="144" width="275" height="21"/>
+                                    <fontDescription key="fontDescription" type="italicSystem" pointSize="17"/>
                                     <color key="textColor" red="0.1529411765" green="0.33333333329999998" blue="0.45098039220000002" alpha="1" colorSpace="calibratedRGB"/>
                                     <color key="textColor" red="0.1529411765" green="0.33333333329999998" blue="0.45098039220000002" alpha="1" colorSpace="calibratedRGB"/>
                                     <nil key="highlightedColor"/>
                                     <nil key="highlightedColor"/>
                                 </label>
                                 </label>
                                 <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="U3K-kD-4pK" userLabel="Price">
                                 <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="U3K-kD-4pK" userLabel="Price">
-                                    <rect key="frame" x="285" y="119" width="50" height="21"/>
+                                    <rect key="frame" x="285" y="144" width="50" height="21"/>
                                     <constraints>
                                     <constraints>
                                         <constraint firstAttribute="width" constant="50" id="uI7-D4-q0g"/>
                                         <constraint firstAttribute="width" constant="50" id="uI7-D4-q0g"/>
                                     </constraints>
                                     </constraints>
-                                    <fontDescription key="fontDescription" type="system" pointSize="17"/>
+                                    <fontDescription key="fontDescription" type="italicSystem" pointSize="17"/>
                                     <color key="textColor" red="0.1529411765" green="0.33333333329999998" blue="0.45098039220000002" alpha="1" colorSpace="calibratedRGB"/>
                                     <color key="textColor" red="0.1529411765" green="0.33333333329999998" blue="0.45098039220000002" alpha="1" colorSpace="calibratedRGB"/>
                                     <nil key="highlightedColor"/>
                                     <nil key="highlightedColor"/>
                                 </label>
                                 </label>
@@ -75,7 +76,7 @@
                             <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
                             <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
                             <constraints>
                             <constraints>
                                 <constraint firstItem="VQF-xA-wca" firstAttribute="width" secondItem="Oax-mA-mEd" secondAttribute="width" constant="-80" id="1bi-lD-f66"/>
                                 <constraint firstItem="VQF-xA-wca" firstAttribute="width" secondItem="Oax-mA-mEd" secondAttribute="width" constant="-80" id="1bi-lD-f66"/>
-                                <constraint firstItem="pCj-dq-5rF" firstAttribute="top" secondItem="Vd3-c0-iYd" secondAttribute="bottom" id="2SS-dr-xRe"/>
+                                <constraint firstItem="pCj-dq-5rF" firstAttribute="top" secondItem="Vd3-c0-iYd" secondAttribute="bottom" constant="8" id="2SS-dr-xRe"/>
                                 <constraint firstItem="Vd3-c0-iYd" firstAttribute="top" secondItem="Oax-mA-mEd" secondAttribute="top" constant="10" id="6ON-9I-XV5"/>
                                 <constraint firstItem="Vd3-c0-iYd" firstAttribute="top" secondItem="Oax-mA-mEd" secondAttribute="top" constant="10" id="6ON-9I-XV5"/>
                                 <constraint firstItem="xIf-kY-gPW" firstAttribute="width" secondItem="Oax-mA-mEd" secondAttribute="width" multiplier="0.2" id="7yL-vu-0hi"/>
                                 <constraint firstItem="xIf-kY-gPW" firstAttribute="width" secondItem="Oax-mA-mEd" secondAttribute="width" multiplier="0.2" id="7yL-vu-0hi"/>
                                 <constraint firstItem="m6I-vy-k36" firstAttribute="width" secondItem="Oax-mA-mEd" secondAttribute="width" multiplier="0.7" id="G5a-55-w2d"/>
                                 <constraint firstItem="m6I-vy-k36" firstAttribute="width" secondItem="Oax-mA-mEd" secondAttribute="width" multiplier="0.7" id="G5a-55-w2d"/>
@@ -83,14 +84,14 @@
                                 <constraint firstItem="pCj-dq-5rF" firstAttribute="centerX" secondItem="Oax-mA-mEd" secondAttribute="centerX" id="LiY-tJ-HN8"/>
                                 <constraint firstItem="pCj-dq-5rF" firstAttribute="centerX" secondItem="Oax-mA-mEd" secondAttribute="centerX" id="LiY-tJ-HN8"/>
                                 <constraint firstAttribute="trailing" secondItem="Vd3-c0-iYd" secondAttribute="trailing" constant="10" id="QqW-8x-l8D"/>
                                 <constraint firstAttribute="trailing" secondItem="Vd3-c0-iYd" secondAttribute="trailing" constant="10" id="QqW-8x-l8D"/>
                                 <constraint firstAttribute="trailing" secondItem="m6I-vy-k36" secondAttribute="trailing" constant="10" id="d6m-wH-hZ4"/>
                                 <constraint firstAttribute="trailing" secondItem="m6I-vy-k36" secondAttribute="trailing" constant="10" id="d6m-wH-hZ4"/>
-                                <constraint firstItem="pCj-dq-5rF" firstAttribute="width" secondItem="Oax-mA-mEd" secondAttribute="width" constant="-30" id="ec5-Em-Hvc"/>
-                                <constraint firstItem="VQF-xA-wca" firstAttribute="leading" secondItem="Oax-mA-mEd" secondAttribute="leading" constant="20" id="fKa-XB-zgY"/>
+                                <constraint firstItem="pCj-dq-5rF" firstAttribute="width" secondItem="Oax-mA-mEd" secondAttribute="width" constant="-20" id="ec5-Em-Hvc"/>
+                                <constraint firstItem="VQF-xA-wca" firstAttribute="leading" secondItem="Oax-mA-mEd" secondAttribute="leading" constant="10" id="fKa-XB-zgY"/>
                                 <constraint firstAttribute="trailing" secondItem="U3K-kD-4pK" secondAttribute="trailing" constant="20" id="fib-sq-y5t"/>
                                 <constraint firstAttribute="trailing" secondItem="U3K-kD-4pK" secondAttribute="trailing" constant="20" id="fib-sq-y5t"/>
                                 <constraint firstItem="U3K-kD-4pK" firstAttribute="centerY" secondItem="VQF-xA-wca" secondAttribute="centerY" id="fxM-45-fab"/>
                                 <constraint firstItem="U3K-kD-4pK" firstAttribute="centerY" secondItem="VQF-xA-wca" secondAttribute="centerY" id="fxM-45-fab"/>
                                 <constraint firstItem="m6I-vy-k36" firstAttribute="top" secondItem="pCj-dq-5rF" secondAttribute="bottom" id="jKd-mD-fFn"/>
                                 <constraint firstItem="m6I-vy-k36" firstAttribute="top" secondItem="pCj-dq-5rF" secondAttribute="bottom" id="jKd-mD-fFn"/>
-                                <constraint firstAttribute="bottom" secondItem="VQF-xA-wca" secondAttribute="bottom" id="rUq-Gl-Ma0"/>
+                                <constraint firstAttribute="bottom" secondItem="VQF-xA-wca" secondAttribute="bottom" constant="5" id="rUq-Gl-Ma0"/>
                                 <constraint firstItem="xIf-kY-gPW" firstAttribute="leading" secondItem="Oax-mA-mEd" secondAttribute="leading" constant="10" id="xRs-gP-CBO"/>
                                 <constraint firstItem="xIf-kY-gPW" firstAttribute="leading" secondItem="Oax-mA-mEd" secondAttribute="leading" constant="10" id="xRs-gP-CBO"/>
-                                <constraint firstItem="xIf-kY-gPW" firstAttribute="top" secondItem="pCj-dq-5rF" secondAttribute="bottom" id="xYq-wH-6dd"/>
+                                <constraint firstItem="xIf-kY-gPW" firstAttribute="top" secondItem="pCj-dq-5rF" secondAttribute="bottom" constant="8" id="xYq-wH-6dd"/>
                             </constraints>
                             </constraints>
                             <edgeInsets key="layoutMargins" top="8" left="8" bottom="8" right="8"/>
                             <edgeInsets key="layoutMargins" top="8" left="8" bottom="8" right="8"/>
                             <userDefinedRuntimeAttributes>
                             <userDefinedRuntimeAttributes>
@@ -111,7 +112,7 @@
                         <constraint firstItem="Oax-mA-mEd" firstAttribute="bottom" secondItem="LXM-17-fy1" secondAttribute="bottom" constant="10" id="cGe-u0-Et9"/>
                         <constraint firstItem="Oax-mA-mEd" firstAttribute="bottom" secondItem="LXM-17-fy1" secondAttribute="bottom" constant="10" id="cGe-u0-Et9"/>
                         <constraint firstAttribute="top" secondItem="Oax-mA-mEd" secondAttribute="top" constant="-10" id="dfL-CJ-4Ja"/>
                         <constraint firstAttribute="top" secondItem="Oax-mA-mEd" secondAttribute="top" constant="-10" id="dfL-CJ-4Ja"/>
                         <constraint firstAttribute="trailing" secondItem="Oax-mA-mEd" secondAttribute="trailing" constant="10" id="mgX-om-hx4"/>
                         <constraint firstAttribute="trailing" secondItem="Oax-mA-mEd" secondAttribute="trailing" constant="10" id="mgX-om-hx4"/>
-                        <constraint firstAttribute="height" constant="140" id="pnJ-Mv-tz4"/>
+                        <constraint firstAttribute="height" constant="170" id="pnJ-Mv-tz4"/>
                     </constraints>
                     </constraints>
                     <edgeInsets key="layoutMargins" top="8" left="8" bottom="8" right="8"/>
                     <edgeInsets key="layoutMargins" top="8" left="8" bottom="8" right="8"/>
                     <userDefinedRuntimeAttributes>
                     <userDefinedRuntimeAttributes>

+ 1 - 3
app/RowGallery.swift

@@ -55,7 +55,7 @@ Extension of UIView to be formatted as sections.
 	private func loadViewFromNib() {
 	private func loadViewFromNib() {
 		let bundle = Bundle(for: type(of: self))
 		let bundle = Bundle(for: type(of: self))
 		let nib = UINib(nibName: String(describing: type(of: self)), bundle: bundle)
 		let nib = UINib(nibName: String(describing: type(of: self)), bundle: bundle)
-		nib.instantiate(withOwner: self, options: nil).first
+		nib.instantiate(withOwner: self, options: nil)
 	}
 	}
 	
 	
 	
 	
@@ -100,7 +100,6 @@ Extension of UIView to be formatted as sections.
 	Opens an album.
 	Opens an album.
 	*/
 	*/
 	func openAlbum(_ sender:UITapGestureRecognizer? = nil){
 	func openAlbum(_ sender:UITapGestureRecognizer? = nil){
-		NSLog(":ROW_GALLERY:DEBUG: Getting delegate and showing album \(self.id).")
 		let delegate: AppDelegate = UIApplication.shared.delegate as! AppDelegate
 		let delegate: AppDelegate = UIApplication.shared.delegate as! AppDelegate
 		delegate.controller?.showAlbum(id: self.id)
 		delegate.controller?.showAlbum(id: self.id)
 	}
 	}
@@ -122,7 +121,6 @@ Extension of UIView to be formatted as sections.
 	*/
 	*/
 	func setImage(idx: Int, filename: String){
 	func setImage(idx: Int, filename: String){
 		if (filename == ""){
 		if (filename == ""){
-			NSLog(":ROWGALLERY:DEBUG: No image for album \(self.id) at index \(idx).")
 			self.preview[idx].isHidden = true
 			self.preview[idx].isHidden = true
 		}
 		}
 		else{
 		else{

+ 0 - 1
app/RowHomeBlog.swift

@@ -126,7 +126,6 @@ Extension of UIView to be formatted as sections.
 	Opens a post.
 	Opens a post.
 	*/
 	*/
 	func openPost(_ sender:UITapGestureRecognizer? = nil){
 	func openPost(_ sender:UITapGestureRecognizer? = nil){
-		NSLog(":ROWHOMEBLOG:DEBUG: Getting delegate and showing post \(self.id).")
 		let delegate: AppDelegate = UIApplication.shared.delegate as! AppDelegate
 		let delegate: AppDelegate = UIApplication.shared.delegate as! AppDelegate
 		delegate.controller?.showPost(id: self.id)
 		delegate.controller?.showPost(id: self.id)
 	}
 	}

+ 109 - 109
app/RowHomeBlog.xib

@@ -1,111 +1,111 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11762" systemVersion="16B2657" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
-<device id="retina4_7" orientation="portrait">
-<adaptation id="fullscreen"/>
-</device>
-<dependencies>
-<deployment identifier="iOS"/>
-<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
-<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
-<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
-</dependencies>
-<objects>
-<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="RowHomeBlog" customModule="app">
-<connections>
-<outlet property="container" destination="2hI-rc-KPm" id="rWX-Vl-kOp"/>
-<outlet property="descrip" destination="f4E-5p-Bid" id="IF5-ck-qUL"/>
-<outlet property="entry" destination="wLM-VU-VYk" id="Gkq-yE-fdN"/>
-<outlet property="image" destination="WSe-uz-Uhz" id="iU4-jm-UzQ"/>
-<outlet property="title" destination="Bkz-DV-HVr" id="1ok-yI-Npt"/>
-</connections>
-</placeholder>
-<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
-<view contentMode="scaleToFill" id="iN0-l3-epB" userLabel="RowHomePastActivities" customClass="RowHomePastActivities" customModule="app">
-<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
-<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
-<subviews>
-<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="2hI-rc-KPm" userLabel="Container">
-<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
-<subviews>
-<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="wLM-VU-VYk" userLabel="Entry">
-<rect key="frame" x="10" y="10" width="355" height="667"/>
-<subviews>
-<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Bkz-DV-HVr" userLabel="Title">
-<rect key="frame" x="10" y="10" width="335" height="21.5"/>
-<fontDescription key="fontDescription" type="boldSystem" pointSize="18"/>
-<color key="textColor" red="0.15294117647058825" green="0.33333333333333331" blue="0.45098039215686275" alpha="1" colorSpace="calibratedRGB"/>
-<nil key="highlightedColor"/>
-</label>
-<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="PhotoPlaceholder" translatesAutoresizingMaskIntoConstraints="NO" id="WSe-uz-Uhz" userLabel="Image">
-<rect key="frame" x="10" y="40" width="89" height="64"/>
-<constraints>
-<constraint firstAttribute="height" constant="64" id="EJ3-uo-Xp3"/>
-</constraints>
-</imageView>
-<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" numberOfLines="3" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="f4E-5p-Bid" userLabel="Text">
-<rect key="frame" x="98" y="40" width="214" height="64"/>
-<fontDescription key="fontDescription" type="system" pointSize="17"/>
-<nil key="textColor"/>
-<nil key="highlightedColor"/>
-</label>
-</subviews>
-<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
-<constraints>
-<constraint firstItem="WSe-uz-Uhz" firstAttribute="width" secondItem="wLM-VU-VYk" secondAttribute="width" multiplier="0.2" id="9Lz-WQ-1aS"/>
-<constraint firstItem="f4E-5p-Bid" firstAttribute="top" secondItem="wLM-VU-VYk" secondAttribute="top" constant="40" id="Emi-Ob-27Q"/>
-<constraint firstItem="Bkz-DV-HVr" firstAttribute="leading" secondItem="wLM-VU-VYk" secondAttribute="leading" constant="10" id="LSz-FM-x2V"/>
-<constraint firstItem="f4E-5p-Bid" firstAttribute="width" secondItem="wLM-VU-VYk" secondAttribute="width" multiplier="0.7" id="MdM-ps-4b8"/>
-<constraint firstAttribute="trailing" secondItem="Bkz-DV-HVr" secondAttribute="trailing" constant="10" id="MdM-yF-pmK"/>
-<constraint firstItem="WSe-uz-Uhz" firstAttribute="top" secondItem="wLM-VU-VYk" secondAttribute="top" constant="40" id="Pyf-oT-PQl"/>
-<constraint firstItem="WSe-uz-Uhz" firstAttribute="leading" secondItem="wLM-VU-VYk" secondAttribute="leading" constant="10" id="YG6-eX-oTj"/>
-<constraint firstItem="Bkz-DV-HVr" firstAttribute="top" secondItem="wLM-VU-VYk" secondAttribute="top" constant="10" id="mwG-d2-HQL"/>
-<constraint firstAttribute="trailing" secondItem="f4E-5p-Bid" secondAttribute="trailing" constant="10" id="svU-xx-LsR"/>
-</constraints>
-<edgeInsets key="layoutMargins" top="8" left="8" bottom="8" right="8"/>
-<userDefinedRuntimeAttributes>
-<userDefinedRuntimeAttribute type="color" keyPath="borderColor">
-<color key="value" red="0.42745098039215684" green="0.41176470588235292" blue="0.56470588235294117" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
-</userDefinedRuntimeAttribute>
-<userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
-<real key="value" value="1"/>
-</userDefinedRuntimeAttribute>
-<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
-<real key="value" value="3"/>
-</userDefinedRuntimeAttribute>
-</userDefinedRuntimeAttributes>
-</view>
-</subviews>
-<constraints>
-<constraint firstItem="wLM-VU-VYk" firstAttribute="bottom" secondItem="2hI-rc-KPm" secondAttribute="bottom" constant="10" id="39K-W7-EIE"/>
-<constraint firstAttribute="trailing" secondItem="wLM-VU-VYk" secondAttribute="trailing" constant="10" id="HSF-55-R5c"/>
-<constraint firstAttribute="height" constant="120" id="PdT-5v-I0r"/>
-<constraint firstItem="wLM-VU-VYk" firstAttribute="top" secondItem="2hI-rc-KPm" secondAttribute="top" constant="10" id="fWN-oO-QzS"/>
-<constraint firstItem="wLM-VU-VYk" firstAttribute="leading" secondItem="2hI-rc-KPm" secondAttribute="leading" constant="10" id="teN-oh-Db9"/>
-</constraints>
-<edgeInsets key="layoutMargins" top="8" left="8" bottom="8" right="8"/>
-<userDefinedRuntimeAttributes>
-<userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
-<real key="value" value="0.0"/>
-</userDefinedRuntimeAttribute>
-</userDefinedRuntimeAttributes>
-</view>
-</subviews>
-<constraints>
-<constraint firstItem="2hI-rc-KPm" firstAttribute="height" secondItem="iN0-l3-epB" secondAttribute="height" id="Kwy-25-YES"/>
-<constraint firstItem="2hI-rc-KPm" firstAttribute="width" secondItem="iN0-l3-epB" secondAttribute="width" id="clR-QU-zlD"/>
-<constraint firstItem="2hI-rc-KPm" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="centerY" id="htS-q0-otF"/>
-<constraint firstItem="2hI-rc-KPm" firstAttribute="centerX" secondItem="iN0-l3-epB" secondAttribute="centerX" id="rig-k7-6bz"/>
-</constraints>
-<nil key="simulatedStatusBarMetrics"/>
-<userDefinedRuntimeAttributes>
-<userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
-<real key="value" value="0.0"/>
-</userDefinedRuntimeAttribute>
-</userDefinedRuntimeAttributes>
-<point key="canvasLocation" x="45.5" y="-43.5"/>
-</view>
-</objects>
-<resources>
-<image name="PhotoPlaceholder" width="170" height="108"/>
-</resources>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="12120" systemVersion="16E195" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
+    <device id="retina4_7" orientation="portrait">
+        <adaptation id="fullscreen"/>
+    </device>
+    <dependencies>
+        <deployment identifier="iOS"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12088"/>
+        <capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="RowHomeBlog" customModule="app">
+            <connections>
+                <outlet property="container" destination="2hI-rc-KPm" id="rWX-Vl-kOp"/>
+                <outlet property="descrip" destination="f4E-5p-Bid" id="IF5-ck-qUL"/>
+                <outlet property="entry" destination="wLM-VU-VYk" id="Gkq-yE-fdN"/>
+                <outlet property="image" destination="WSe-uz-Uhz" id="iU4-jm-UzQ"/>
+                <outlet property="title" destination="Bkz-DV-HVr" id="1ok-yI-Npt"/>
+            </connections>
+        </placeholder>
+        <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
+        <view contentMode="scaleToFill" id="iN0-l3-epB" userLabel="RowHomePastActivities" customClass="RowHomePastActivities" customModule="app">
+            <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
+            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+            <subviews>
+                <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="2hI-rc-KPm" userLabel="Container">
+                    <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
+                    <subviews>
+                        <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="wLM-VU-VYk" userLabel="Entry">
+                            <rect key="frame" x="10" y="10" width="355" height="667"/>
+                            <subviews>
+                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Bkz-DV-HVr" userLabel="Title">
+                                    <rect key="frame" x="10" y="10" width="335" height="21.5"/>
+                                    <fontDescription key="fontDescription" type="boldSystem" pointSize="18"/>
+                                    <color key="textColor" red="0.15294117647058825" green="0.33333333333333331" blue="0.45098039215686275" alpha="1" colorSpace="calibratedRGB"/>
+                                    <nil key="highlightedColor"/>
+                                </label>
+                                <imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="PhotoPlaceholder" translatesAutoresizingMaskIntoConstraints="NO" id="WSe-uz-Uhz" userLabel="Image">
+                                    <rect key="frame" x="10" y="40" width="71" height="64"/>
+                                    <constraints>
+                                        <constraint firstAttribute="height" constant="64" id="EJ3-uo-Xp3"/>
+                                    </constraints>
+                                </imageView>
+                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" numberOfLines="3" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="f4E-5p-Bid" userLabel="Text">
+                                    <rect key="frame" x="96.5" y="40" width="248.5" height="20.5"/>
+                                    <fontDescription key="fontDescription" type="system" pointSize="17"/>
+                                    <nil key="textColor"/>
+                                    <nil key="highlightedColor"/>
+                                </label>
+                            </subviews>
+                            <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+                            <constraints>
+                                <constraint firstItem="WSe-uz-Uhz" firstAttribute="width" secondItem="wLM-VU-VYk" secondAttribute="width" multiplier="0.2" id="9Lz-WQ-1aS"/>
+                                <constraint firstItem="f4E-5p-Bid" firstAttribute="top" secondItem="wLM-VU-VYk" secondAttribute="top" constant="40" id="Emi-Ob-27Q"/>
+                                <constraint firstItem="Bkz-DV-HVr" firstAttribute="leading" secondItem="wLM-VU-VYk" secondAttribute="leading" constant="10" id="LSz-FM-x2V"/>
+                                <constraint firstItem="f4E-5p-Bid" firstAttribute="width" secondItem="wLM-VU-VYk" secondAttribute="width" multiplier="0.7" id="MdM-ps-4b8"/>
+                                <constraint firstAttribute="trailing" secondItem="Bkz-DV-HVr" secondAttribute="trailing" constant="10" id="MdM-yF-pmK"/>
+                                <constraint firstItem="WSe-uz-Uhz" firstAttribute="top" secondItem="wLM-VU-VYk" secondAttribute="top" constant="40" id="Pyf-oT-PQl"/>
+                                <constraint firstItem="WSe-uz-Uhz" firstAttribute="leading" secondItem="wLM-VU-VYk" secondAttribute="leading" constant="10" id="YG6-eX-oTj"/>
+                                <constraint firstItem="Bkz-DV-HVr" firstAttribute="top" secondItem="wLM-VU-VYk" secondAttribute="top" constant="10" id="mwG-d2-HQL"/>
+                                <constraint firstAttribute="trailing" secondItem="f4E-5p-Bid" secondAttribute="trailing" constant="10" id="svU-xx-LsR"/>
+                            </constraints>
+                            <edgeInsets key="layoutMargins" top="8" left="8" bottom="8" right="8"/>
+                            <userDefinedRuntimeAttributes>
+                                <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
+                                    <color key="value" red="0.42745098039215684" green="0.41176470588235292" blue="0.56470588235294117" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                </userDefinedRuntimeAttribute>
+                                <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                                    <real key="value" value="1"/>
+                                </userDefinedRuntimeAttribute>
+                                <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
+                                    <real key="value" value="3"/>
+                                </userDefinedRuntimeAttribute>
+                            </userDefinedRuntimeAttributes>
+                        </view>
+                    </subviews>
+                    <constraints>
+                        <constraint firstItem="wLM-VU-VYk" firstAttribute="bottom" secondItem="2hI-rc-KPm" secondAttribute="bottom" constant="10" id="39K-W7-EIE"/>
+                        <constraint firstAttribute="trailing" secondItem="wLM-VU-VYk" secondAttribute="trailing" constant="10" id="HSF-55-R5c"/>
+                        <constraint firstAttribute="height" constant="120" id="PdT-5v-I0r"/>
+                        <constraint firstItem="wLM-VU-VYk" firstAttribute="top" secondItem="2hI-rc-KPm" secondAttribute="top" constant="10" id="fWN-oO-QzS"/>
+                        <constraint firstItem="wLM-VU-VYk" firstAttribute="leading" secondItem="2hI-rc-KPm" secondAttribute="leading" constant="10" id="teN-oh-Db9"/>
+                    </constraints>
+                    <edgeInsets key="layoutMargins" top="8" left="8" bottom="8" right="8"/>
+                    <userDefinedRuntimeAttributes>
+                        <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                            <real key="value" value="0.0"/>
+                        </userDefinedRuntimeAttribute>
+                    </userDefinedRuntimeAttributes>
+                </view>
+            </subviews>
+            <constraints>
+                <constraint firstItem="2hI-rc-KPm" firstAttribute="height" secondItem="iN0-l3-epB" secondAttribute="height" id="Kwy-25-YES"/>
+                <constraint firstItem="2hI-rc-KPm" firstAttribute="width" secondItem="iN0-l3-epB" secondAttribute="width" id="clR-QU-zlD"/>
+                <constraint firstItem="2hI-rc-KPm" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="centerY" id="htS-q0-otF"/>
+                <constraint firstItem="2hI-rc-KPm" firstAttribute="centerX" secondItem="iN0-l3-epB" secondAttribute="centerX" id="rig-k7-6bz"/>
+            </constraints>
+            <nil key="simulatedStatusBarMetrics"/>
+            <userDefinedRuntimeAttributes>
+                <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                    <real key="value" value="0.0"/>
+                </userDefinedRuntimeAttribute>
+            </userDefinedRuntimeAttributes>
+            <point key="canvasLocation" x="45.5" y="-43.5"/>
+        </view>
+    </objects>
+    <resources>
+        <image name="PhotoPlaceholder" width="170" height="108"/>
+    </resources>
 </document>
 </document>

+ 0 - 1
app/RowHomeFutureActivities.swift

@@ -126,7 +126,6 @@ Extension of UIView to be formatted as sections.
 	Opens an activity.
 	Opens an activity.
 	*/
 	*/
 	func openActivity(_ sender:UITapGestureRecognizer? = nil){
 	func openActivity(_ sender:UITapGestureRecognizer? = nil){
-		NSLog(":ROWFUTUREACTIVITY:DEBUG: Getting delegate and showing past activity \(self.id).")
 		let delegate: AppDelegate = UIApplication.shared.delegate as! AppDelegate
 		let delegate: AppDelegate = UIApplication.shared.delegate as! AppDelegate
 		delegate.controller?.showFutureActivity(id: self.id)
 		delegate.controller?.showFutureActivity(id: self.id)
 	}
 	}

+ 109 - 109
app/RowHomeFutureActivities.xib

@@ -1,111 +1,111 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11762" systemVersion="16B2657" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
-<device id="retina4_7" orientation="portrait">
-<adaptation id="fullscreen"/>
-</device>
-<dependencies>
-<deployment identifier="iOS"/>
-<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
-<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
-<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
-</dependencies>
-<objects>
-<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="RowHomeFutureActivities" customModule="app">
-<connections>
-<outlet property="container" destination="2hI-rc-KPm" id="rWX-Vl-kOp"/>
-<outlet property="descrip" destination="f4E-5p-Bid" id="IF5-ck-qUL"/>
-<outlet property="entry" destination="wLM-VU-VYk" id="Gkq-yE-fdN"/>
-<outlet property="image" destination="WSe-uz-Uhz" id="iU4-jm-UzQ"/>
-<outlet property="title" destination="Bkz-DV-HVr" id="1ok-yI-Npt"/>
-</connections>
-</placeholder>
-<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
-<view contentMode="scaleToFill" id="iN0-l3-epB" userLabel="RowHomePastActivities" customClass="RowHomePastActivities" customModule="app">
-<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
-<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
-<subviews>
-<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="2hI-rc-KPm" userLabel="Container">
-<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
-<subviews>
-<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="wLM-VU-VYk" userLabel="Entry">
-<rect key="frame" x="10" y="10" width="355" height="667"/>
-<subviews>
-<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Bkz-DV-HVr" userLabel="Title">
-<rect key="frame" x="10" y="10" width="335" height="21.5"/>
-<fontDescription key="fontDescription" type="boldSystem" pointSize="18"/>
-<color key="textColor" red="0.15294117647058825" green="0.33333333333333331" blue="0.45098039215686275" alpha="1" colorSpace="calibratedRGB"/>
-<nil key="highlightedColor"/>
-</label>
-<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="PhotoPlaceholder" translatesAutoresizingMaskIntoConstraints="NO" id="WSe-uz-Uhz" userLabel="Image">
-<rect key="frame" x="10" y="40" width="89" height="64"/>
-<constraints>
-<constraint firstAttribute="height" constant="64" id="EJ3-uo-Xp3"/>
-</constraints>
-</imageView>
-<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" numberOfLines="3" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="f4E-5p-Bid" userLabel="Text">
-<rect key="frame" x="98" y="40" width="214" height="64"/>
-<fontDescription key="fontDescription" type="system" pointSize="17"/>
-<nil key="textColor"/>
-<nil key="highlightedColor"/>
-</label>
-</subviews>
-<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
-<constraints>
-<constraint firstItem="WSe-uz-Uhz" firstAttribute="width" secondItem="wLM-VU-VYk" secondAttribute="width" multiplier="0.2" id="9Lz-WQ-1aS"/>
-<constraint firstItem="f4E-5p-Bid" firstAttribute="top" secondItem="wLM-VU-VYk" secondAttribute="top" constant="40" id="Emi-Ob-27Q"/>
-<constraint firstItem="Bkz-DV-HVr" firstAttribute="leading" secondItem="wLM-VU-VYk" secondAttribute="leading" constant="10" id="LSz-FM-x2V"/>
-<constraint firstItem="f4E-5p-Bid" firstAttribute="width" secondItem="wLM-VU-VYk" secondAttribute="width" multiplier="0.7" id="MdM-ps-4b8"/>
-<constraint firstAttribute="trailing" secondItem="Bkz-DV-HVr" secondAttribute="trailing" constant="10" id="MdM-yF-pmK"/>
-<constraint firstItem="WSe-uz-Uhz" firstAttribute="top" secondItem="wLM-VU-VYk" secondAttribute="top" constant="40" id="Pyf-oT-PQl"/>
-<constraint firstItem="WSe-uz-Uhz" firstAttribute="leading" secondItem="wLM-VU-VYk" secondAttribute="leading" constant="10" id="YG6-eX-oTj"/>
-<constraint firstItem="Bkz-DV-HVr" firstAttribute="top" secondItem="wLM-VU-VYk" secondAttribute="top" constant="10" id="mwG-d2-HQL"/>
-<constraint firstAttribute="trailing" secondItem="f4E-5p-Bid" secondAttribute="trailing" constant="10" id="svU-xx-LsR"/>
-</constraints>
-<edgeInsets key="layoutMargins" top="8" left="8" bottom="8" right="8"/>
-<userDefinedRuntimeAttributes>
-<userDefinedRuntimeAttribute type="color" keyPath="borderColor">
-<color key="value" red="0.42745098039215684" green="0.41176470588235292" blue="0.56470588235294117" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
-</userDefinedRuntimeAttribute>
-<userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
-<real key="value" value="1"/>
-</userDefinedRuntimeAttribute>
-<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
-<real key="value" value="3"/>
-</userDefinedRuntimeAttribute>
-</userDefinedRuntimeAttributes>
-</view>
-</subviews>
-<constraints>
-<constraint firstItem="wLM-VU-VYk" firstAttribute="bottom" secondItem="2hI-rc-KPm" secondAttribute="bottom" constant="10" id="39K-W7-EIE"/>
-<constraint firstAttribute="trailing" secondItem="wLM-VU-VYk" secondAttribute="trailing" constant="10" id="HSF-55-R5c"/>
-<constraint firstAttribute="height" constant="120" id="PdT-5v-I0r"/>
-<constraint firstItem="wLM-VU-VYk" firstAttribute="top" secondItem="2hI-rc-KPm" secondAttribute="top" constant="10" id="fWN-oO-QzS"/>
-<constraint firstItem="wLM-VU-VYk" firstAttribute="leading" secondItem="2hI-rc-KPm" secondAttribute="leading" constant="10" id="teN-oh-Db9"/>
-</constraints>
-<edgeInsets key="layoutMargins" top="8" left="8" bottom="8" right="8"/>
-<userDefinedRuntimeAttributes>
-<userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
-<real key="value" value="0.0"/>
-</userDefinedRuntimeAttribute>
-</userDefinedRuntimeAttributes>
-</view>
-</subviews>
-<constraints>
-<constraint firstItem="2hI-rc-KPm" firstAttribute="height" secondItem="iN0-l3-epB" secondAttribute="height" id="Kwy-25-YES"/>
-<constraint firstItem="2hI-rc-KPm" firstAttribute="width" secondItem="iN0-l3-epB" secondAttribute="width" id="clR-QU-zlD"/>
-<constraint firstItem="2hI-rc-KPm" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="centerY" id="htS-q0-otF"/>
-<constraint firstItem="2hI-rc-KPm" firstAttribute="centerX" secondItem="iN0-l3-epB" secondAttribute="centerX" id="rig-k7-6bz"/>
-</constraints>
-<nil key="simulatedStatusBarMetrics"/>
-<userDefinedRuntimeAttributes>
-<userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
-<real key="value" value="0.0"/>
-</userDefinedRuntimeAttribute>
-</userDefinedRuntimeAttributes>
-<point key="canvasLocation" x="45.5" y="-43.5"/>
-</view>
-</objects>
-<resources>
-<image name="PhotoPlaceholder" width="170" height="108"/>
-</resources>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="12120" systemVersion="16E195" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
+    <device id="retina4_7" orientation="portrait">
+        <adaptation id="fullscreen"/>
+    </device>
+    <dependencies>
+        <deployment identifier="iOS"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12088"/>
+        <capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="RowHomeFutureActivities" customModule="app">
+            <connections>
+                <outlet property="container" destination="2hI-rc-KPm" id="rWX-Vl-kOp"/>
+                <outlet property="descrip" destination="f4E-5p-Bid" id="IF5-ck-qUL"/>
+                <outlet property="entry" destination="wLM-VU-VYk" id="Gkq-yE-fdN"/>
+                <outlet property="image" destination="WSe-uz-Uhz" id="iU4-jm-UzQ"/>
+                <outlet property="title" destination="Bkz-DV-HVr" id="1ok-yI-Npt"/>
+            </connections>
+        </placeholder>
+        <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
+        <view contentMode="scaleToFill" id="iN0-l3-epB" userLabel="RowHomePastActivities" customClass="RowHomePastActivities" customModule="app">
+            <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
+            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+            <subviews>
+                <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="2hI-rc-KPm" userLabel="Container">
+                    <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
+                    <subviews>
+                        <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="wLM-VU-VYk" userLabel="Entry">
+                            <rect key="frame" x="10" y="10" width="355" height="667"/>
+                            <subviews>
+                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Bkz-DV-HVr" userLabel="Title">
+                                    <rect key="frame" x="10" y="10" width="335" height="21.5"/>
+                                    <fontDescription key="fontDescription" type="boldSystem" pointSize="18"/>
+                                    <color key="textColor" red="0.15294117647058825" green="0.33333333333333331" blue="0.45098039215686275" alpha="1" colorSpace="calibratedRGB"/>
+                                    <nil key="highlightedColor"/>
+                                </label>
+                                <imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="PhotoPlaceholder" translatesAutoresizingMaskIntoConstraints="NO" id="WSe-uz-Uhz" userLabel="Image">
+                                    <rect key="frame" x="10" y="40" width="71" height="64"/>
+                                    <constraints>
+                                        <constraint firstAttribute="height" constant="64" id="EJ3-uo-Xp3"/>
+                                    </constraints>
+                                </imageView>
+                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" numberOfLines="3" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="f4E-5p-Bid" userLabel="Text">
+                                    <rect key="frame" x="96.5" y="40" width="248.5" height="20.5"/>
+                                    <fontDescription key="fontDescription" type="system" pointSize="17"/>
+                                    <nil key="textColor"/>
+                                    <nil key="highlightedColor"/>
+                                </label>
+                            </subviews>
+                            <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+                            <constraints>
+                                <constraint firstItem="WSe-uz-Uhz" firstAttribute="width" secondItem="wLM-VU-VYk" secondAttribute="width" multiplier="0.2" id="9Lz-WQ-1aS"/>
+                                <constraint firstItem="f4E-5p-Bid" firstAttribute="top" secondItem="wLM-VU-VYk" secondAttribute="top" constant="40" id="Emi-Ob-27Q"/>
+                                <constraint firstItem="Bkz-DV-HVr" firstAttribute="leading" secondItem="wLM-VU-VYk" secondAttribute="leading" constant="10" id="LSz-FM-x2V"/>
+                                <constraint firstItem="f4E-5p-Bid" firstAttribute="width" secondItem="wLM-VU-VYk" secondAttribute="width" multiplier="0.7" id="MdM-ps-4b8"/>
+                                <constraint firstAttribute="trailing" secondItem="Bkz-DV-HVr" secondAttribute="trailing" constant="10" id="MdM-yF-pmK"/>
+                                <constraint firstItem="WSe-uz-Uhz" firstAttribute="top" secondItem="wLM-VU-VYk" secondAttribute="top" constant="40" id="Pyf-oT-PQl"/>
+                                <constraint firstItem="WSe-uz-Uhz" firstAttribute="leading" secondItem="wLM-VU-VYk" secondAttribute="leading" constant="10" id="YG6-eX-oTj"/>
+                                <constraint firstItem="Bkz-DV-HVr" firstAttribute="top" secondItem="wLM-VU-VYk" secondAttribute="top" constant="10" id="mwG-d2-HQL"/>
+                                <constraint firstAttribute="trailing" secondItem="f4E-5p-Bid" secondAttribute="trailing" constant="10" id="svU-xx-LsR"/>
+                            </constraints>
+                            <edgeInsets key="layoutMargins" top="8" left="8" bottom="8" right="8"/>
+                            <userDefinedRuntimeAttributes>
+                                <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
+                                    <color key="value" red="0.42745098039215684" green="0.41176470588235292" blue="0.56470588235294117" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                </userDefinedRuntimeAttribute>
+                                <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                                    <real key="value" value="1"/>
+                                </userDefinedRuntimeAttribute>
+                                <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
+                                    <real key="value" value="3"/>
+                                </userDefinedRuntimeAttribute>
+                            </userDefinedRuntimeAttributes>
+                        </view>
+                    </subviews>
+                    <constraints>
+                        <constraint firstItem="wLM-VU-VYk" firstAttribute="bottom" secondItem="2hI-rc-KPm" secondAttribute="bottom" constant="10" id="39K-W7-EIE"/>
+                        <constraint firstAttribute="trailing" secondItem="wLM-VU-VYk" secondAttribute="trailing" constant="10" id="HSF-55-R5c"/>
+                        <constraint firstAttribute="height" constant="120" id="PdT-5v-I0r"/>
+                        <constraint firstItem="wLM-VU-VYk" firstAttribute="top" secondItem="2hI-rc-KPm" secondAttribute="top" constant="10" id="fWN-oO-QzS"/>
+                        <constraint firstItem="wLM-VU-VYk" firstAttribute="leading" secondItem="2hI-rc-KPm" secondAttribute="leading" constant="10" id="teN-oh-Db9"/>
+                    </constraints>
+                    <edgeInsets key="layoutMargins" top="8" left="8" bottom="8" right="8"/>
+                    <userDefinedRuntimeAttributes>
+                        <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                            <real key="value" value="0.0"/>
+                        </userDefinedRuntimeAttribute>
+                    </userDefinedRuntimeAttributes>
+                </view>
+            </subviews>
+            <constraints>
+                <constraint firstItem="2hI-rc-KPm" firstAttribute="height" secondItem="iN0-l3-epB" secondAttribute="height" id="Kwy-25-YES"/>
+                <constraint firstItem="2hI-rc-KPm" firstAttribute="width" secondItem="iN0-l3-epB" secondAttribute="width" id="clR-QU-zlD"/>
+                <constraint firstItem="2hI-rc-KPm" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="centerY" id="htS-q0-otF"/>
+                <constraint firstItem="2hI-rc-KPm" firstAttribute="centerX" secondItem="iN0-l3-epB" secondAttribute="centerX" id="rig-k7-6bz"/>
+            </constraints>
+            <nil key="simulatedStatusBarMetrics"/>
+            <userDefinedRuntimeAttributes>
+                <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                    <real key="value" value="0.0"/>
+                </userDefinedRuntimeAttribute>
+            </userDefinedRuntimeAttributes>
+            <point key="canvasLocation" x="45.5" y="-43.5"/>
+        </view>
+    </objects>
+    <resources>
+        <image name="PhotoPlaceholder" width="170" height="108"/>
+    </resources>
 </document>
 </document>

+ 70 - 1
app/RowHomeGallery.swift

@@ -34,6 +34,9 @@ Extension of UIView to be formatted as sections.
 	
 	
 	var photos: [UIImageView] = []
 	var photos: [UIImageView] = []
 	
 	
+	var photoIds: [Int] = [-1, -1, -1, -1]
+	var albumIds: [Int] = [-1, -1, -1, -1]
+	
 	
 	
 	/**
 	/**
 	Default constructor
 	Default constructor
@@ -49,7 +52,7 @@ Extension of UIView to be formatted as sections.
 	private func loadViewFromNib() {
 	private func loadViewFromNib() {
 		let bundle = Bundle(for: type(of: self))
 		let bundle = Bundle(for: type(of: self))
 		let nib = UINib(nibName: String(describing: type(of: self)), bundle: bundle)
 		let nib = UINib(nibName: String(describing: type(of: self)), bundle: bundle)
-		nib.instantiate(withOwner: self, options: nil).first as! UIView
+		nib.instantiate(withOwner: self, options: nil)
 	}
 	}
 	
 	
 	
 	
@@ -77,6 +80,42 @@ Extension of UIView to be formatted as sections.
 	}
 	}
 	
 	
 	
 	
+	/**
+	Open the first photo in the photo viewer.
+	*/
+	func openFirstPhoto(_ sender:UITapGestureRecognizer? = nil){
+		let delegate: AppDelegate = UIApplication.shared.delegate as! AppDelegate
+		delegate.controller?.showPhoto(album: self.albumIds[0], photo: self.photoIds[0])
+	}
+	
+	
+	/**
+	Open the second photo in the photo viewer.
+	*/
+	func openSecondPhoto(_ sender:UITapGestureRecognizer? = nil){
+		let delegate: AppDelegate = UIApplication.shared.delegate as! AppDelegate
+		delegate.controller?.showPhoto(album: self.albumIds[1], photo: self.photoIds[1])
+	}
+	
+	
+	/**
+	Open the third photo in the photo viewer.
+	*/
+	func openThirdPhoto(_ sender:UITapGestureRecognizer? = nil){
+		let delegate: AppDelegate = UIApplication.shared.delegate as! AppDelegate
+		delegate.controller?.showPhoto(album: self.albumIds[2], photo: self.photoIds[2])
+	}
+	
+	
+	/**
+	Open the fourth photo in the photo viewer.
+	*/
+	func openFourthPhoto(_ sender:UITapGestureRecognizer? = nil){
+		let delegate: AppDelegate = UIApplication.shared.delegate as! AppDelegate
+		delegate.controller?.showPhoto(album: self.albumIds[3], photo: self.photoIds[3])
+	}
+	
+	
 	/**
 	/**
 	Default constructor for the interface builder
 	Default constructor for the interface builder
 	*/
 	*/
@@ -98,6 +137,36 @@ Extension of UIView to be formatted as sections.
 		else{
 		else{
 			let path = "img/galeria/thumb/\(filename)"
 			let path = "img/galeria/thumb/\(filename)"
 			photos[idx].setImage(localPath: path, remotePath: "https://margolariak.com/\(path)")
 			photos[idx].setImage(localPath: path, remotePath: "https://margolariak.com/\(path)")
+			
+			// Set tap recognizer
+			switch idx{
+				case 0:
+					let tapRecognizer = UITapGestureRecognizer(target: self, action: #selector (RowHomeGallery.openFirstPhoto(_:)))
+					tapRecognizer.delegate = (UIApplication.shared.delegate as! AppDelegate).controller
+					self.photos[idx].isUserInteractionEnabled = true
+					self.photos[idx].addGestureRecognizer(tapRecognizer)
+					break;
+				case 1:
+					let tapRecognizer = UITapGestureRecognizer(target: self, action: #selector (RowHomeGallery.openSecondPhoto(_:)))
+					tapRecognizer.delegate = (UIApplication.shared.delegate as! AppDelegate).controller
+					self.photos[idx].isUserInteractionEnabled = true
+					self.photos[idx].addGestureRecognizer(tapRecognizer)
+					break;
+				case 2:
+					let tapRecognizer = UITapGestureRecognizer(target: self, action: #selector (RowHomeGallery.openThirdPhoto(_:)))
+					tapRecognizer.delegate = (UIApplication.shared.delegate as! AppDelegate).controller
+					self.photos[idx].isUserInteractionEnabled = true
+					self.photos[idx].addGestureRecognizer(tapRecognizer)
+					break;
+				case 3:
+					let tapRecognizer = UITapGestureRecognizer(target: self, action: #selector (RowHomeGallery.openFourthPhoto(_:)))
+					tapRecognizer.delegate = (UIApplication.shared.delegate as! AppDelegate).controller
+					self.photos[idx].isUserInteractionEnabled = true
+					self.photos[idx].addGestureRecognizer(tapRecognizer)
+					break;
+				default:
+					NSLog(":ROWHOMEGALLERY:ERROR: Trying to set tap recognizer for invalid photo index \(idx).")
+			}
 		}
 		}
 	}
 	}
 	
 	

+ 2 - 2
app/RowHomeGallery.xib

@@ -1,11 +1,11 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11762" systemVersion="16D32" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="12120" systemVersion="16E195" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
     <device id="retina4_7" orientation="portrait">
     <device id="retina4_7" orientation="portrait">
         <adaptation id="fullscreen"/>
         <adaptation id="fullscreen"/>
     </device>
     </device>
     <dependencies>
     <dependencies>
         <deployment identifier="iOS"/>
         <deployment identifier="iOS"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12088"/>
         <capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
         <capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     </dependencies>

+ 1 - 2
app/RowHomePastActivities.swift

@@ -51,7 +51,7 @@ Extension of UIView to be formatted as past activity rows.
 	private func loadViewFromNib() {
 	private func loadViewFromNib() {
 		let bundle = Bundle(for: type(of: self))
 		let bundle = Bundle(for: type(of: self))
 		let nib = UINib(nibName: String(describing: type(of: self)), bundle: bundle)
 		let nib = UINib(nibName: String(describing: type(of: self)), bundle: bundle)
-		nib.instantiate(withOwner: self, options: nil).first
+		nib.instantiate(withOwner: self, options: nil)
 	}
 	}
 	
 	
 	
 	
@@ -126,7 +126,6 @@ Extension of UIView to be formatted as past activity rows.
 	Opens an activity.
 	Opens an activity.
 	*/
 	*/
 	func openActivity(_ sender:UITapGestureRecognizer? = nil){
 	func openActivity(_ sender:UITapGestureRecognizer? = nil){
-		NSLog(":ROWPASTACTIVITY:DEBUG: Getting delegate and showing past activity \(self.id).")
 		let delegate: AppDelegate = UIApplication.shared.delegate as! AppDelegate
 		let delegate: AppDelegate = UIApplication.shared.delegate as! AppDelegate
 		delegate.controller?.showPastActivity(id: self.id)
 		delegate.controller?.showPastActivity(id: self.id)
 	}
 	}

+ 10 - 5
app/RowHomePastActivities.xib

@@ -1,11 +1,11 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11762" systemVersion="16B2657" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="12120" systemVersion="16E195" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
     <device id="retina4_7" orientation="portrait">
     <device id="retina4_7" orientation="portrait">
         <adaptation id="fullscreen"/>
         <adaptation id="fullscreen"/>
     </device>
     </device>
     <dependencies>
     <dependencies>
         <deployment identifier="iOS"/>
         <deployment identifier="iOS"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12088"/>
         <capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
         <capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     </dependencies>
@@ -36,14 +36,19 @@
                                     <color key="textColor" red="0.15294117647058825" green="0.33333333333333331" blue="0.45098039215686275" alpha="1" colorSpace="calibratedRGB"/>
                                     <color key="textColor" red="0.15294117647058825" green="0.33333333333333331" blue="0.45098039215686275" alpha="1" colorSpace="calibratedRGB"/>
                                     <nil key="highlightedColor"/>
                                     <nil key="highlightedColor"/>
                                 </label>
                                 </label>
-                                <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="PhotoPlaceholder" translatesAutoresizingMaskIntoConstraints="NO" id="WSe-uz-Uhz" userLabel="Image">
-                                    <rect key="frame" x="10" y="40" width="89" height="64"/>
+                                <imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="PhotoPlaceholder" translatesAutoresizingMaskIntoConstraints="NO" id="WSe-uz-Uhz" userLabel="Image">
+                                    <rect key="frame" x="10" y="40" width="71" height="64"/>
                                     <constraints>
                                     <constraints>
                                         <constraint firstAttribute="height" constant="64" id="EJ3-uo-Xp3"/>
                                         <constraint firstAttribute="height" constant="64" id="EJ3-uo-Xp3"/>
                                     </constraints>
                                     </constraints>
+                                    <userDefinedRuntimeAttributes>
+                                        <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                                            <real key="value" value="0.0"/>
+                                        </userDefinedRuntimeAttribute>
+                                    </userDefinedRuntimeAttributes>
                                 </imageView>
                                 </imageView>
                                 <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" numberOfLines="3" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="f4E-5p-Bid" userLabel="Text">
                                 <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" numberOfLines="3" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="f4E-5p-Bid" userLabel="Text">
-                                    <rect key="frame" x="98" y="40" width="214" height="64"/>
+                                    <rect key="frame" x="96.5" y="40" width="248.5" height="20.5"/>
                                     <fontDescription key="fontDescription" type="system" pointSize="17"/>
                                     <fontDescription key="fontDescription" type="system" pointSize="17"/>
                                     <nil key="textColor"/>
                                     <nil key="textColor"/>
                                     <nil key="highlightedColor"/>
                                     <nil key="highlightedColor"/>

+ 1 - 1
app/RowHomeSocial.swift

@@ -56,7 +56,7 @@ Extension of UIView to be formatted as sections.
 	private func loadViewFromNib() {
 	private func loadViewFromNib() {
 		let bundle = Bundle(for: type(of: self))
 		let bundle = Bundle(for: type(of: self))
 		let nib = UINib(nibName: String(describing: type(of: self)), bundle: bundle)
 		let nib = UINib(nibName: String(describing: type(of: self)), bundle: bundle)
-		nib.instantiate(withOwner: self, options: nil).first
+		nib.instantiate(withOwner: self, options: nil)
 	}
 	}
 	
 	
 	/**
 	/**

+ 168 - 0
app/RowItinerary.swift

@@ -0,0 +1,168 @@
+// Copyright (C) 2016 Inigo Valentin
+//
+// This file is part of the Gasteizko Margolariak IOS app.
+//
+// The Gasteizko Margolariak IOS app is free software: you can
+// redistribute it and/or modify it under the terms of the
+// GNU General Public License as published by the Free Software
+// Foundation, either version 3 of the License, or (at your
+// option) any later version.
+//
+// The Gasteizko Margolariak IOS app is distributed in the
+// hope that it will be useful, but WITHOUT ANY WARRANTY;
+// without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
+// Public License for more details.
+//
+// You should have received a copy of the GNU General Public
+// License along with the Gasteizko Margolariak IOS app.
+// If not, see <http://www.gnu.org/licenses/>.
+
+import Foundation
+import UIKit
+
+/**
+Extension of UIView to be formatted an activity itinerary.
+*/
+@IBDesignable class RowItinerary: UIView {
+
+	
+	// Outlets
+	@IBOutlet weak var container: UIView!
+	@IBOutlet weak var lbTime: UILabel!
+	@IBOutlet weak var lbTitle: UILabel!
+	@IBOutlet weak var lbText: UILabel!
+	@IBOutlet weak var lbLocation: UILabel!
+	
+	var id: Int = -1
+	
+	/**
+	Default constructor
+	*/
+	required init?(coder aDecoder: NSCoder) {
+		super.init(coder: aDecoder)
+	}
+	
+	
+	/**
+	Loads the view from the xib with the same name as the class.
+	*/
+	private func loadViewFromNib() {
+		let bundle = Bundle(for: type(of: self))
+		let nib = UINib(nibName: String(describing: type(of: self)), bundle: bundle)
+		nib.instantiate(withOwner: self, options: nil)
+	}
+	
+	
+	/**
+	Default constructor.
+	:param: s Custom identifier
+	:param: i Custom identifier
+	*/
+	init(s: String, i: Int) {
+		super.init(frame: CGRect(x: 0, y: 0, width: 0, height: 0))
+		loadViewFromNib()
+		self.frame = self.bounds
+		self.autoresizingMask = [.flexibleWidth, .flexibleHeight]
+		self.translatesAutoresizingMaskIntoConstraints = true
+		
+		container.autoresizingMask = [.flexibleWidth, .flexibleHeight]
+		container.translatesAutoresizingMaskIntoConstraints = true
+		
+		container.frame = self.bounds
+		self.addSubview(container)
+	}
+	
+	
+	/**
+	Default constructor for the interface builder
+	*/
+	override init(frame: CGRect){
+		super.init(frame: frame)
+	}
+	
+	
+	/**
+	Sets the time of the event.
+	:param: str String with the time to set.
+	*/
+	func setStart(str: String){
+		self.lbTime.text = str
+	}
+	
+	
+	/**
+	Sets the time of the event.
+	:param: hours Hour of the event start.
+	:param: minutes Minutes of the event start.
+	*/
+	func setStart(hours: Int, minutes: Int){
+		var strMinutes: String = ""
+		if "\(minutes)".length == 1{
+			strMinutes = "0\(minutes)"
+		}
+		else{
+			strMinutes = "\(minutes)"
+		}
+		self.lbTime.text = "\(hours):\(strMinutes)"
+	}
+	
+	
+	/**
+	Sets the time of the event.
+	:param: dtime Datetime of the event start.
+	*/
+	func setStart(time: NSDate){
+		let calendar = Calendar.current
+		let hours = calendar.component(.hour, from: time as Date)
+		let minutes = calendar.component(.minute, from: time as Date)
+		var strMinutes: String = ""
+		if "\(minutes)".length == 1{
+			strMinutes = "0\(minutes)"
+		}
+		else{
+			strMinutes = "\(minutes)"
+		}
+		self.lbTime.text = "\(hours):\(strMinutes)"
+	}
+	
+	
+	/**
+	Sets the title of the event.
+	:param: text The title of the event.
+	*/
+	func setTitle(text: String){
+		self.lbTitle.text = text.decode().stripHtml()
+	}
+	
+	
+	/**
+	Sets the location of the event.
+	:param: text The location of the event.
+	*/
+	func setLocation(text: String){
+		self.lbLocation.text = text.decode().stripHtml()
+	}
+	
+	
+	/**
+	Sets the description of the event. Decodes HTML.
+	:param: text The new text.
+	*/
+	func setText(text: String){
+		self.lbText.text = text.decode().stripHtml()
+	}
+	
+	func setPlace(place: String, address: String){
+		self.lbLocation.text = place.decode().stripHtml()
+	}
+	
+	
+	/**
+	Opens an event dialog.
+	*/
+	func openItinerary(_ sender:UITapGestureRecognizer? = nil){
+		// TODO implement openItinerary.
+		NSLog(":ROWITINERARY:DEBUG: Open Itinerary")
+	}
+}

+ 139 - 0
app/RowItinerary.xib

@@ -0,0 +1,139 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="12120" systemVersion="16E195" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
+    <device id="retina4_7" orientation="portrait">
+        <adaptation id="fullscreen"/>
+    </device>
+    <dependencies>
+        <deployment identifier="iOS"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12088"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="Rowitinerary" customModule="app" customModuleProvider="target">
+            <connections>
+                <outlet property="container" destination="EhP-FW-f8V" id="t03-Fa-qsA"/>
+                <outlet property="lbLocation" destination="uRl-ey-EbX" id="lHa-cl-mdu"/>
+                <outlet property="lbText" destination="qBt-Fr-7yc" id="uYt-t9-bvT"/>
+                <outlet property="lbTime" destination="9A7-eH-but" id="Ekg-l7-hwE"/>
+                <outlet property="lbTitle" destination="olV-oe-BVn" id="aXe-tE-yTK"/>
+            </connections>
+        </placeholder>
+        <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
+        <view contentMode="scaleToFill" id="iN0-l3-epB">
+            <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
+            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+            <subviews>
+                <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="EhP-FW-f8V" userLabel="Container">
+                    <rect key="frame" x="0.5" y="273.5" width="375" height="120"/>
+                    <subviews>
+                        <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="1UU-eM-8rG" userLabel="Entry">
+                            <rect key="frame" x="0.0" y="0.0" width="375" height="120"/>
+                            <subviews>
+                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="00:00" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="9A7-eH-but" userLabel="Time">
+                                    <rect key="frame" x="10" y="10" width="55" height="22"/>
+                                    <constraints>
+                                        <constraint firstAttribute="width" constant="55" id="cfM-Es-4BC"/>
+                                    </constraints>
+                                    <fontDescription key="fontDescription" type="boldSystem" pointSize="18"/>
+                                    <color key="textColor" red="0.1529411765" green="0.33333333329999998" blue="0.45098039220000002" alpha="1" colorSpace="calibratedRGB"/>
+                                    <nil key="highlightedColor"/>
+                                </label>
+                                <imageView userInteractionEnabled="NO" alpha="0.75" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="04F-rE-gcn" userLabel="Line">
+                                    <rect key="frame" x="76" y="-0.5" width="2" height="120"/>
+                                    <color key="backgroundColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
+                                    <constraints>
+                                        <constraint firstAttribute="width" constant="2" id="W5y-7c-FbE"/>
+                                    </constraints>
+                                </imageView>
+                                <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="ScheduleBullet" translatesAutoresizingMaskIntoConstraints="NO" id="Pne-3z-V34" userLabel="Bullet">
+                                    <rect key="frame" x="67" y="11" width="20" height="20"/>
+                                    <constraints>
+                                        <constraint firstAttribute="width" constant="20" id="2pe-00-Pl0"/>
+                                        <constraint firstAttribute="height" constant="20" id="uvd-36-GaV"/>
+                                    </constraints>
+                                </imageView>
+                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="olV-oe-BVn" userLabel="Title">
+                                    <rect key="frame" x="92" y="10" width="283" height="22"/>
+                                    <fontDescription key="fontDescription" type="boldSystem" pointSize="18"/>
+                                    <color key="textColor" red="0.1529411765" green="0.33333333329999998" blue="0.45098039220000002" alpha="1" colorSpace="calibratedRGB"/>
+                                    <nil key="highlightedColor"/>
+                                </label>
+                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Text" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="qBt-Fr-7yc" userLabel="Text">
+                                    <rect key="frame" x="102" y="37" width="263" height="21"/>
+                                    <fontDescription key="fontDescription" type="system" pointSize="17"/>
+                                    <nil key="textColor"/>
+                                    <nil key="highlightedColor"/>
+                                </label>
+                                <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="Pinpoint" translatesAutoresizingMaskIntoConstraints="NO" id="Oyf-6H-nyi" userLabel="Pinpoint">
+                                    <rect key="frame" x="107" y="68" width="10" height="13"/>
+                                    <constraints>
+                                        <constraint firstAttribute="width" constant="10" id="2XO-EO-huO"/>
+                                        <constraint firstAttribute="height" constant="13" id="SmO-lI-jeP"/>
+                                    </constraints>
+                                </imageView>
+                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Location" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="uRl-ey-EbX">
+                                    <rect key="frame" x="122" y="66.5" width="243" height="17"/>
+                                    <fontDescription key="fontDescription" type="italicSystem" pointSize="14"/>
+                                    <color key="textColor" red="0.32931472080000002" green="0.32931472080000002" blue="0.32931472080000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                    <nil key="highlightedColor"/>
+                                </label>
+                            </subviews>
+                            <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+                            <constraints>
+                                <constraint firstItem="Pne-3z-V34" firstAttribute="centerY" secondItem="9A7-eH-but" secondAttribute="centerY" id="1dN-8O-oB5"/>
+                                <constraint firstItem="uRl-ey-EbX" firstAttribute="trailing" secondItem="qBt-Fr-7yc" secondAttribute="trailing" id="6Oo-nZ-4s3"/>
+                                <constraint firstItem="Oyf-6H-nyi" firstAttribute="top" secondItem="qBt-Fr-7yc" secondAttribute="bottom" constant="10" id="A2q-yN-Iyq"/>
+                                <constraint firstItem="uRl-ey-EbX" firstAttribute="leading" secondItem="Oyf-6H-nyi" secondAttribute="trailing" constant="5" id="Bc8-R8-h8w"/>
+                                <constraint firstItem="9A7-eH-but" firstAttribute="leading" secondItem="1UU-eM-8rG" secondAttribute="leading" constant="10" id="Cs3-Oz-o5l"/>
+                                <constraint firstItem="qBt-Fr-7yc" firstAttribute="top" secondItem="olV-oe-BVn" secondAttribute="bottom" constant="5" id="DB6-Jb-AGq"/>
+                                <constraint firstItem="olV-oe-BVn" firstAttribute="leading" secondItem="Pne-3z-V34" secondAttribute="trailing" constant="5" id="JVf-b7-HDS"/>
+                                <constraint firstItem="qBt-Fr-7yc" firstAttribute="width" secondItem="olV-oe-BVn" secondAttribute="width" constant="-20" id="Nsn-Ui-8Ps"/>
+                                <constraint firstAttribute="trailing" secondItem="olV-oe-BVn" secondAttribute="trailing" id="Stw-8D-5t9"/>
+                                <constraint firstItem="uRl-ey-EbX" firstAttribute="centerY" secondItem="Oyf-6H-nyi" secondAttribute="centerY" id="TGQ-2i-XtB"/>
+                                <constraint firstItem="Oyf-6H-nyi" firstAttribute="leading" secondItem="qBt-Fr-7yc" secondAttribute="leading" constant="5" id="ZF0-zr-8EU"/>
+                                <constraint firstItem="04F-rE-gcn" firstAttribute="centerX" secondItem="Pne-3z-V34" secondAttribute="centerX" id="i3w-iX-ZQX"/>
+                                <constraint firstItem="Pne-3z-V34" firstAttribute="leading" secondItem="9A7-eH-but" secondAttribute="trailing" constant="2" id="iJ7-Ke-nqO"/>
+                                <constraint firstItem="9A7-eH-but" firstAttribute="top" secondItem="1UU-eM-8rG" secondAttribute="top" constant="10" id="joe-bR-4kc"/>
+                                <constraint firstItem="qBt-Fr-7yc" firstAttribute="centerX" secondItem="olV-oe-BVn" secondAttribute="centerX" id="phh-bC-fo7"/>
+                                <constraint firstItem="04F-rE-gcn" firstAttribute="top" secondItem="1UU-eM-8rG" secondAttribute="top" id="yPF-Ef-pJl"/>
+                                <constraint firstItem="olV-oe-BVn" firstAttribute="centerY" secondItem="9A7-eH-but" secondAttribute="centerY" id="zRU-yr-HSW"/>
+                            </constraints>
+                            <userDefinedRuntimeAttributes>
+                                <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                                    <real key="value" value="0.0"/>
+                                </userDefinedRuntimeAttribute>
+                                <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
+                                    <real key="value" value="0.0"/>
+                                </userDefinedRuntimeAttribute>
+                            </userDefinedRuntimeAttributes>
+                        </view>
+                    </subviews>
+                    <constraints>
+                        <constraint firstAttribute="height" constant="120" id="S1t-ne-rLH"/>
+                        <constraint firstItem="1UU-eM-8rG" firstAttribute="leading" secondItem="EhP-FW-f8V" secondAttribute="leading" id="Sj6-i1-pJV"/>
+                        <constraint firstItem="04F-rE-gcn" firstAttribute="height" secondItem="EhP-FW-f8V" secondAttribute="height" id="cb8-Lg-GQP"/>
+                        <constraint firstItem="1UU-eM-8rG" firstAttribute="bottom" secondItem="EhP-FW-f8V" secondAttribute="bottom" id="iTi-VX-QEp"/>
+                        <constraint firstAttribute="trailing" secondItem="1UU-eM-8rG" secondAttribute="trailing" id="xDv-a5-7wM"/>
+                        <constraint firstAttribute="top" secondItem="1UU-eM-8rG" secondAttribute="top" id="y1f-q3-Um8"/>
+                    </constraints>
+                    <edgeInsets key="layoutMargins" top="8" left="8" bottom="8" right="8"/>
+                    <userDefinedRuntimeAttributes>
+                        <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                            <real key="value" value="0.0"/>
+                        </userDefinedRuntimeAttribute>
+                    </userDefinedRuntimeAttributes>
+                </view>
+            </subviews>
+            <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+            <constraints>
+                <constraint firstItem="EhP-FW-f8V" firstAttribute="width" secondItem="iN0-l3-epB" secondAttribute="width" id="444-cT-i3J"/>
+                <constraint firstItem="EhP-FW-f8V" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="centerY" id="H8x-AV-wUI"/>
+                <constraint firstItem="EhP-FW-f8V" firstAttribute="centerX" secondItem="iN0-l3-epB" secondAttribute="centerX" id="wxV-2s-Ojx"/>
+            </constraints>
+        </view>
+    </objects>
+    <resources>
+        <image name="Pinpoint" width="10" height="13"/>
+        <image name="ScheduleBullet" width="12" height="12"/>
+    </resources>
+</document>

+ 1 - 1
app/RowLabel.swift

@@ -46,7 +46,7 @@ Extension of UIView to be formatted as sections.
 	private func loadViewFromNib() {
 	private func loadViewFromNib() {
 		let bundle = Bundle(for: type(of: self))
 		let bundle = Bundle(for: type(of: self))
 		let nib = UINib(nibName: String(describing: type(of: self)), bundle: bundle)
 		let nib = UINib(nibName: String(describing: type(of: self)), bundle: bundle)
-		nib.instantiate(withOwner: self, options: nil).first
+		nib.instantiate(withOwner: self, options: nil)
 	}
 	}
 	
 	
 	
 	

+ 1 - 1
app/RowLablancaDay.swift

@@ -49,7 +49,7 @@ Extension of UIView to be formatted as sections.
 	private func loadViewFromNib() {
 	private func loadViewFromNib() {
 		let bundle = Bundle(for: type(of: self))
 		let bundle = Bundle(for: type(of: self))
 		let nib = UINib(nibName: String(describing: type(of: self)), bundle: bundle)
 		let nib = UINib(nibName: String(describing: type(of: self)), bundle: bundle)
-		nib.instantiate(withOwner: self, options: nil).first
+		nib.instantiate(withOwner: self, options: nil)
 		
 		
 		self.frame = self.bounds
 		self.frame = self.bounds
 		self.autoresizingMask = [.flexibleWidth, .flexibleHeight]
 		self.autoresizingMask = [.flexibleWidth, .flexibleHeight]

+ 1 - 2
app/RowLablancaOffer.swift

@@ -48,7 +48,7 @@ Extension of UIView to be formatted as sections.
 	private func loadViewFromNib() {
 	private func loadViewFromNib() {
 		let bundle = Bundle(for: type(of: self))
 		let bundle = Bundle(for: type(of: self))
 		let nib = UINib(nibName: String(describing: type(of: self)), bundle: bundle)
 		let nib = UINib(nibName: String(describing: type(of: self)), bundle: bundle)
-		nib.instantiate(withOwner: self, options: nil).first
+		nib.instantiate(withOwner: self, options: nil)
 		
 		
 		self.frame = self.bounds
 		self.frame = self.bounds
 		self.autoresizingMask = [.flexibleWidth, .flexibleHeight]
 		self.autoresizingMask = [.flexibleWidth, .flexibleHeight]
@@ -68,7 +68,6 @@ Extension of UIView to be formatted as sections.
 	:param: i Custom identifier
 	:param: i Custom identifier
 	*/
 	*/
 	init(s: String, i: Int) {
 	init(s: String, i: Int) {
-		NSLog(":ROWLABLANCAOFFER:DEBUG: Init \(s), \(i)")
 		
 		
 		super.init(frame: CGRect(x: 0, y: 0, width: 0, height: 0))
 		super.init(frame: CGRect(x: 0, y: 0, width: 0, height: 0))
 		loadViewFromNib()
 		loadViewFromNib()

+ 0 - 1
app/RowPastActivity.swift

@@ -124,7 +124,6 @@ Extension of UIView to be formatted as sections.
 	Opens an activity.
 	Opens an activity.
 	*/
 	*/
 	func openActivity(_ sender:UITapGestureRecognizer? = nil){
 	func openActivity(_ sender:UITapGestureRecognizer? = nil){
-		NSLog(":ROWPASTACTIVITY:DEBUG: Getting delegate and showing past activity \(self.id).")
 		let delegate: AppDelegate = UIApplication.shared.delegate as! AppDelegate
 		let delegate: AppDelegate = UIApplication.shared.delegate as! AppDelegate
 		delegate.controller?.showPastActivity(id: self.id)
 		delegate.controller?.showPastActivity(id: self.id)
 	}
 	}

+ 3 - 3
app/RowPastActivity.xib

@@ -1,11 +1,11 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11762" systemVersion="16E195" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="12120" systemVersion="16E195" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
     <device id="retina4_7" orientation="portrait">
     <device id="retina4_7" orientation="portrait">
         <adaptation id="fullscreen"/>
         <adaptation id="fullscreen"/>
     </device>
     </device>
     <dependencies>
     <dependencies>
         <deployment identifier="iOS"/>
         <deployment identifier="iOS"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12088"/>
         <capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
         <capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     </dependencies>
@@ -35,7 +35,7 @@
                                     <color key="textColor" red="0.1529411765" green="0.33333333329999998" blue="0.45098039220000002" alpha="1" colorSpace="calibratedRGB"/>
                                     <color key="textColor" red="0.1529411765" green="0.33333333329999998" blue="0.45098039220000002" alpha="1" colorSpace="calibratedRGB"/>
                                     <nil key="highlightedColor"/>
                                     <nil key="highlightedColor"/>
                                 </label>
                                 </label>
-                                <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="PhotoPlaceholder" translatesAutoresizingMaskIntoConstraints="NO" id="dtJ-G2-LyM" userLabel="Image">
+                                <imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="PhotoPlaceholder" translatesAutoresizingMaskIntoConstraints="NO" id="dtJ-G2-LyM" userLabel="Image">
                                     <rect key="frame" x="10" y="40" width="71" height="64"/>
                                     <rect key="frame" x="10" y="40" width="71" height="64"/>
                                     <constraints>
                                     <constraints>
                                         <constraint firstAttribute="height" constant="64" id="5JB-2b-om6"/>
                                         <constraint firstAttribute="height" constant="64" id="5JB-2b-om6"/>

+ 2 - 8
app/RowSchedule.swift

@@ -49,7 +49,7 @@ Extension of UIView to be formatted as sections.
 	private func loadViewFromNib() {
 	private func loadViewFromNib() {
 		let bundle = Bundle(for: type(of: self))
 		let bundle = Bundle(for: type(of: self))
 		let nib = UINib(nibName: String(describing: type(of: self)), bundle: bundle)
 		let nib = UINib(nibName: String(describing: type(of: self)), bundle: bundle)
-		nib.instantiate(withOwner: self, options: nil).first
+		nib.instantiate(withOwner: self, options: nil)
 	}
 	}
 	
 	
 	
 	
@@ -70,12 +70,6 @@ Extension of UIView to be formatted as sections.
 		
 		
 		container.frame = self.bounds
 		container.frame = self.bounds
 		self.addSubview(container)
 		self.addSubview(container)
-		
-		// Set tap recognizer
-		/*print("ROW_BLOG:DEBUG: set tap recognizer")
-		let tapRecognizer = UITapGestureRecognizer(target: self, action: #selector (self.openPost (_:)))
-		tapRecognizer.delegate = (UIApplication.shared.delegate as! AppDelegate).controller
-		addGestureRecognizer(tapRecognizer)*/
 	}
 	}
 	
 	
 	
 	
@@ -164,6 +158,6 @@ Extension of UIView to be formatted as sections.
 	*/
 	*/
 	func openEvent(_ sender:UITapGestureRecognizer? = nil){
 	func openEvent(_ sender:UITapGestureRecognizer? = nil){
 		// TODO implement openEvent.
 		// TODO implement openEvent.
-		print("ROW_BLOG:DEBUG: Open Event")
+		NSLog(":ROWSCHEDULE:DEBUG: Open Event")
 	}
 	}
 }
 }

+ 2 - 3
app/ScheduleViewController.swift

@@ -259,7 +259,7 @@ class ScheduleViewController: UIViewController, UIGestureRecognizerDelegate {
 			for r in searchResults! {
 			for r in searchResults! {
 				
 				
 				title = r.value(forKey: "title_\(lang!)") as! String
 				title = r.value(forKey: "title_\(lang!)") as! String
-				if let tx = r.value(forKey: "description_\(lang!)"){
+				if r.value(forKey: "description_\(lang!)") != nil{
 					text = r.value(forKey: "description_\(lang!)") as! String
 					text = r.value(forKey: "description_\(lang!)") as! String
 				}
 				}
 				else{
 				else{
@@ -279,7 +279,7 @@ class ScheduleViewController: UIViewController, UIGestureRecognizerDelegate {
 				locationFetchRequest.fetchLimit = 1
 				locationFetchRequest.fetchLimit = 1
 				do{
 				do{
 					var locationSearchResults = try self.context?.fetch(locationFetchRequest)
 					var locationSearchResults = try self.context?.fetch(locationFetchRequest)
-					var locationR = locationSearchResults?[0]
+					let locationR = locationSearchResults?[0]
 					location = locationR?.value(forKey: "name_\(lang!)")! as! String
 					location = locationR?.value(forKey: "name_\(lang!)")! as! String
 					
 					
 					row.setLocation(text: location)
 					row.setLocation(text: location)
@@ -325,7 +325,6 @@ class ScheduleViewController: UIViewController, UIGestureRecognizerDelegate {
 	:param: increment Days to advance the schedule. Negative values to back it up.
 	:param: increment Days to advance the schedule. Negative values to back it up.
 	*/
 	*/
 	func changeDay(increment: Int){
 	func changeDay(increment: Int){
-		NSLog(":SCHEDULECONTROLLER:DEBUG: Change day increment: \(increment)")
 		self.selectedDay = self.selectedDay + increment
 		self.selectedDay = self.selectedDay + increment
 		if self.selectedDay <= -1{
 		if self.selectedDay <= -1{
 			self.selectedDay = 0
 			self.selectedDay = 0

+ 17 - 7
app/Sync.swift

@@ -33,7 +33,7 @@ class Sync{
 	var vGallery: Int = 0
 	var vGallery: Int = 0
 	var vBlanca: Int = 0
 	var vBlanca: Int = 0
 	var vAll: Int = 0
 	var vAll: Int = 0
-	
+		
 	/**
 	/**
 	Starts the sync process.
 	Starts the sync process.
 	Always asynchronously.
 	Always asynchronously.
@@ -51,6 +51,7 @@ class Sync{
 		if synchronous == true{
 		if synchronous == true{
 			NSLog(":SYNC:LOG: Synchronous sync started.")
 			NSLog(":SYNC:LOG: Synchronous sync started.")
 			self.initial = true
 			self.initial = true
+			
 		}
 		}
 		let url = buildUrl();
 		let url = buildUrl();
 		sync(url: url)
 		sync(url: url)
@@ -94,6 +95,8 @@ class Sync{
 	func sync(url: URL){
 	func sync(url: URL){
 		
 		
 		NSLog(":SYNC:LOG: Sync started.")
 		NSLog(":SYNC:LOG: Sync started.")
+		let delegate: AppDelegate = UIApplication.shared.delegate as! AppDelegate
+		delegate.syncController?.nowSyncing = true
 		
 		
 		//Synchronously get data
 		//Synchronously get data
 		let task = URLSession.shared.dataTask(with: url) { data, response, error in
 		let task = URLSession.shared.dataTask(with: url) { data, response, error in
@@ -198,8 +201,10 @@ class Sync{
 			// If it's the initial sync, hide the segue
 			// If it's the initial sync, hide the segue
 			if self.initial == true{
 			if self.initial == true{
 				NSLog(":SYNC:LOG: Finishing synchronous sync.")
 				NSLog(":SYNC:LOG: Finishing synchronous sync.")
+				//let delegate: AppDelegate = UIApplication.shared.delegate as! AppDelegate
+				//delegate.syncController?.startApp()
 				let delegate: AppDelegate = UIApplication.shared.delegate as! AppDelegate
 				let delegate: AppDelegate = UIApplication.shared.delegate as! AppDelegate
-				delegate.controller?.initialSync(showScreen: false)
+				delegate.syncController?.nowSyncing = false
 			}
 			}
 		}
 		}
 		
 		
@@ -1323,17 +1328,23 @@ class Sync{
 			//Get title_es
 			//Get title_es
 			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
 			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
 			let title_es : String = str.subStr(start : str.indexOf(target : "\"title_es\":")! + 12, end : str.indexOf(target : ",\"")! - 2)
 			let title_es : String = str.subStr(start : str.indexOf(target : "\"title_es\":")! + 12, end : str.indexOf(target : ",\"")! - 2)
-			row.setValue(title_es, forKey: "title_es")
+			if (title_es != "ul"){ //From "null"
+				row.setValue(title_es, forKey: "title_es")
+			}
 			
 			
 			//Get title_en
 			//Get title_en
 			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
 			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
 			let title_en : String = str.subStr(start : str.indexOf(target : "\"title_en\":")! + 12, end : str.indexOf(target : ",\"")! - 2)
 			let title_en : String = str.subStr(start : str.indexOf(target : "\"title_en\":")! + 12, end : str.indexOf(target : ",\"")! - 2)
-			row.setValue(title_en, forKey: "title_en")
+			if (title_en != "ul"){ //From "null"
+				row.setValue(title_en, forKey: "title_en")
+			}
 			
 			
 			//Get title_eu
 			//Get title_eu
 			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
 			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
 			let title_eu : String = str.subStr(start : str.indexOf(target : "\"title_eu\":")! + 12, end : str.indexOf(target : ",\"")! - 2)
 			let title_eu : String = str.subStr(start : str.indexOf(target : "\"title_eu\":")! + 12, end : str.indexOf(target : ",\"")! - 2)
-			row.setValue(title_eu, forKey: "title_eu")
+			if (title_eu != "ul"){ //From "null"
+				row.setValue(title_eu, forKey: "title_eu")
+			}
 			
 			
 			//Get description_es
 			//Get description_es
 			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
 			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
@@ -1814,9 +1825,8 @@ class Sync{
 			dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss"
 			dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss"
 			dateFormatter.calendar = NSCalendar(calendarIdentifier: NSCalendar.Identifier.ISO8601)! as Calendar
 			dateFormatter.calendar = NSCalendar(calendarIdentifier: NSCalendar.Identifier.ISO8601)! as Calendar
 			dateFormatter.locale = NSLocale(localeIdentifier: "en_US_POSIX") as Locale!
 			dateFormatter.locale = NSLocale(localeIdentifier: "en_US_POSIX") as Locale!
-			//dateFormatter.timeZone = NSTimeZone(forSecondsFromGMT: 0) as TimeZone!
 			dateFormatter.timeZone = NSTimeZone.local
 			dateFormatter.timeZone = NSTimeZone.local
-			var dayString = "\(str.subStr(start : str.indexOf(target : "\"start\":")! + 9, end : str.indexOf(target : ",\"")! - 11)) 00:00:00"
+			let dayString = "\(str.subStr(start : str.indexOf(target : "\"start\":")! + 9, end : str.indexOf(target : ",\"")! - 11)) 00:00:00"
 			var day = dateFormatter.date(from: dayString)!
 			var day = dateFormatter.date(from: dayString)!
 			// If on the first hours of the next day...
 			// If on the first hours of the next day...
 			let calendar = Calendar.current
 			let calendar = Calendar.current

+ 72 - 5
app/SyncController.swift

@@ -26,6 +26,11 @@ The view controller of the app.
 */
 */
 class SyncController: UIViewController{
 class SyncController: UIViewController{
 	
 	
+	var delegate: AppDelegate?
+	
+	var nowSyncing: Bool = false
+	var syncTimer: Timer? = nil
+	
 	@IBOutlet weak var pb: UIProgressView!
 	@IBOutlet weak var pb: UIProgressView!
 	@IBOutlet weak var lb: UILabel!
 	@IBOutlet weak var lb: UILabel!
 	
 	
@@ -39,18 +44,80 @@ class SyncController: UIViewController{
 	*/
 	*/
 	override func viewDidLoad() {
 	override func viewDidLoad() {
 		
 		
-		NSLog(":SYNC:LOG: SyncController shown.")
+		NSLog(":SYNCCONTROLLER:LOG: SyncController shown.")
+		self.delegate = UIApplication.shared.delegate as? AppDelegate
+		self.delegate?.syncController = self
 		
 		
 		super.viewDidLoad()
 		super.viewDidLoad()
 		
 		
-		// Initial setup
-		pb.progress = 0
 		
 		
-		// Start the timer
-		Timer.scheduledTimer(timeInterval: 0.1, target: self, selector: #selector(progress), userInfo: nil, repeats: true)
 		
 		
 	}
 	}
 	
 	
+	override func viewDidAppear(_ animated: Bool) {
+		if UserDefaults.standard.object(forKey: "userId") == nil{
+			NSLog(":SYNCCONTROLLER:LOG: First run. Generating user ID and syncing...")
+			let newUid = randomString(length: 16)
+			let defaults = UserDefaults.standard
+			defaults.set(newUid, forKey: "userId")
+			// Initial setup
+			pb.progress = 0
+			
+			// Start the timer
+			Timer.scheduledTimer(timeInterval: 0.1, target: self, selector: #selector(progress), userInfo: nil, repeats: true)
+			
+			syncTimer = Timer.scheduledTimer(timeInterval: 5, target: self, selector: #selector(endSync), userInfo: nil, repeats: true)
+			
+			initialSync()
+		}
+		else{
+			startApp()
+		}
+	}
+	
+	func endSync(){
+		if self.nowSyncing == false{
+			syncTimer?.invalidate()
+			startApp()
+		}
+	}
+	
+	func startApp(){
+		performSegue(withIdentifier: "SegueInit", 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(){
+		//performSegue(withIdentifier: "SegueSync", sender: nil)
+		Sync(synchronous: true)
+	}
+	
+	
+	/**
+	Generates a random string to be used as a user identifier.
+	:param: length The length of the generated string.
+	:return: A random alphanumeric string with the indicated length.
+	*/
+	func randomString(length: Int) -> String {
+		
+		let letters : NSString = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
+		let len = UInt32(letters.length)
+		
+		var randomString = ""
+		
+		for _ in 0 ..< length {
+			let rand = arc4random_uniform(len)
+			var nextChar = letters.character(at: Int(rand))
+			randomString += NSString(characters: &nextChar, length: 1) as String
+		}
+		
+		return randomString
+	}
+	
 	
 	
 	/**
 	/**
 	Signal to update the progressbar and, maybe, the tag.
 	Signal to update the progressbar and, maybe, the tag.

+ 2 - 6
app/UIImageView.swift

@@ -79,14 +79,10 @@ extension UIImageView {
 			let task = session.downloadTask(with: request) { (tempLocalUrl, response, error) in
 			let task = session.downloadTask(with: request) { (tempLocalUrl, response, error) in
 				if let tempLocalUrl = tempLocalUrl, error == nil {
 				if let tempLocalUrl = tempLocalUrl, error == nil {
 					
 					
-					// Success
-					if let statusCode = (response as? HTTPURLResponse)?.statusCode {
-						// TODO something.
-					}
-					
 					do {
 					do {
 						try FileManager.default.copyItem(at: tempLocalUrl, to: destinationFileUrl)
 						try FileManager.default.copyItem(at: tempLocalUrl, to: destinationFileUrl)
-					} catch (let writeError) {
+					}
+					catch (let writeError) {
 						NSLog(":IMAGE:ERROR: Error creating a file \(destinationFileUrl) : \(writeError)")
 						NSLog(":IMAGE:ERROR: Error creating a file \(destinationFileUrl) : \(writeError)")
 					}
 					}
 					
 					

+ 0 - 1
app/UIView.swift

@@ -63,7 +63,6 @@ import UIKit
 	
 	
 	var parentViewController: ViewController? {
 	var parentViewController: ViewController? {
 		var parentResponder: UIResponder? = self
 		var parentResponder: UIResponder? = self
-		var i = 0
 		while parentResponder != nil {
 		while parentResponder != nil {
 			parentResponder = parentResponder!.next
 			parentResponder = parentResponder!.next
 			if let viewController = parentResponder as? ViewController {
 			if let viewController = parentResponder as? ViewController {

+ 11 - 45
app/ViewController.swift

@@ -60,7 +60,7 @@ class ViewController: UIViewController, UICollectionViewDataSource, UICollection
 	:param: coder Coder.
 	:param: coder Coder.
 	*/
 	*/
 	required init?(coder aDecoder: NSCoder) {
 	required init?(coder aDecoder: NSCoder) {
-		NSLog(":CONTROLLER:DEBUG: Init!")
+		NSLog(":CONTROLLER:DEBUG: Init.")
 		super.init(coder: aDecoder)
 		super.init(coder: aDecoder)
 		
 		
 	}
 	}
@@ -86,7 +86,6 @@ class ViewController: UIViewController, UICollectionViewDataSource, UICollection
 	:param: id The post id.
 	:param: id The post id.
 	*/
 	*/
 	func showPost(id: Int){
 	func showPost(id: Int){
-		NSLog(":CONTROLLER:DEBUG: Showing Post \(id)")
 		self.passId = id
 		self.passId = id
 		performSegue(withIdentifier: "SeguePost", sender: nil)
 		performSegue(withIdentifier: "SeguePost", sender: nil)
 	}
 	}
@@ -97,7 +96,6 @@ class ViewController: UIViewController, UICollectionViewDataSource, UICollection
 	:param: id The activity id.
 	:param: id The activity id.
 	*/
 	*/
 	func showPastActivity(id: Int){
 	func showPastActivity(id: Int){
-		NSLog(":CONTROLLER:DEBUG: Showing past activity \(id)")
 		self.passId = id
 		self.passId = id
 		performSegue(withIdentifier: "SeguePastActivity", sender: nil)
 		performSegue(withIdentifier: "SeguePastActivity", sender: nil)
 	}
 	}
@@ -108,10 +106,8 @@ class ViewController: UIViewController, UICollectionViewDataSource, UICollection
 	:param: id The activity id.
 	:param: id The activity id.
 	*/
 	*/
 	func showFutureActivity(id: Int){
 	func showFutureActivity(id: Int){
-		NSLog(":CONTROLLER:DEBUG: Showing future activity \(id)")
 		self.passId = id
 		self.passId = id
-		// TODO
-		//performSegue(withIdentifier: "SegueFutureActivity", sender: nil)
+		performSegue(withIdentifier: "SegueFutureActivity", sender: nil)
 	}
 	}
 	
 	
 	
 	
@@ -120,23 +116,19 @@ class ViewController: UIViewController, UICollectionViewDataSource, UICollection
 	:param: id The album id.
 	:param: id The album id.
 	*/
 	*/
 	func showAlbum(id: Int){
 	func showAlbum(id: Int){
-		NSLog(":CONTROLLER:DEBUG: Showing album \(id)")
 		self.passId = id
 		self.passId = id
 		performSegue(withIdentifier: "SegueAlbum", sender: nil)
 		performSegue(withIdentifier: "SegueAlbum", sender: nil)
 	}
 	}
 	
 	
 	
 	
-	// TODO: This must go in it AlbumViewController
 	/**
 	/**
 	Shows a photo.
 	Shows a photo.
 	:param: id The album id.
 	:param: id The album id.
 	*/
 	*/
 	func showPhoto(album: Int, photo: Int){
 	func showPhoto(album: Int, photo: Int){
-		NSLog(":CONTROLLER:DEBUG: Showing photo \(photo) of album \(album)")
 		self.passAlbum = album
 		self.passAlbum = album
 		self.passId = photo
 		self.passId = photo
 		performSegue(withIdentifier: "SeguePhoto", sender: nil)
 		performSegue(withIdentifier: "SeguePhoto", sender: nil)
-		NSLog(":CONTROLLER:DEBUG: PHOTO should be shown")
 	}
 	}
 	
 	
 	
 	
@@ -145,7 +137,6 @@ class ViewController: UIViewController, UICollectionViewDataSource, UICollection
 	:param: margolari True for the margolari schedule, false for the city one.
 	:param: margolari True for the margolari schedule, false for the city one.
 	*/
 	*/
 	func showSchedule(margolari: Bool){
 	func showSchedule(margolari: Bool){
-		NSLog(":CONTROLLER:DEBUG: Showing schedule. Margolari: \(margolari)")
 		if margolari == true{
 		if margolari == true{
 			self.passId = 1
 			self.passId = 1
 		}
 		}
@@ -156,19 +147,18 @@ class ViewController: UIViewController, UICollectionViewDataSource, UICollection
 	}
 	}
 	
 	
 	
 	
-	/** m
+	/** 
 	Handles the initial sync process.
 	Handles the initial sync process.
 	It can start it, showing the sync screen, or finish it, hidding the screen.
 	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.
 	:param: showScreen True to start the sync, false to end it.
 	*/
 	*/
 	func initialSync(showScreen: Bool){
 	func initialSync(showScreen: Bool){
 		if showScreen == true{
 		if showScreen == true{
-			NSLog(":CONTROLLER:DEBUG: Showing initial sync screen.")
-			performSegue(withIdentifier: "SegueSync", sender: nil)
+			//performSegue(withIdentifier: "SegueSync", sender: nil)
 			Sync(synchronous: true)
 			Sync(synchronous: true)
 		}
 		}
 		else{
 		else{
-			NSLog(":CONTROLLER:DEBUG: Re-populating views and hidding initial sync screen.")
+			// TODO CHECK this
 			NSLog(":CONTROLLER:DEBUG: Re-populating disabled: Throws error.")
 			NSLog(":CONTROLLER:DEBUG: Re-populating disabled: Throws error.")
 			//self.populate()
 			//self.populate()
 			syncSegue?.destination.dismiss(animated: true, completion: nil)
 			syncSegue?.destination.dismiss(animated: true, completion: nil)
@@ -182,7 +172,6 @@ class ViewController: UIViewController, UICollectionViewDataSource, UICollection
 	:sender: The calling view.
 	:sender: The calling view.
 	*/
 	*/
 	override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
 	override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
-		NSLog(":CONTROLLER:DEBUG: preparing for segue '\(String(describing: segue.identifier))' with id \(self.passId)")
 		if segue.identifier == "SeguePost"{
 		if segue.identifier == "SeguePost"{
 			(segue.destination as! PostViewController).id = passId
 			(segue.destination as! PostViewController).id = passId
 		}
 		}
@@ -208,13 +197,11 @@ class ViewController: UIViewController, UICollectionViewDataSource, UICollection
 			(segue.destination as! PastActivityViewController).id = passId
 			(segue.destination as! PastActivityViewController).id = passId
 		}
 		}
 		if segue.identifier == "SegueFutureActivity"{
 		if segue.identifier == "SegueFutureActivity"{
-			// TODO
-			//(segue.destination as! FutureActivityViewController).id = passId
+			(segue.destination as! FutureActivityViewController).id = passId
 		}
 		}
 	}
 	}
 	
 	
 	override func viewWillAppear(_ animated: Bool) {
 	override func viewWillAppear(_ animated: Bool) {
-		NSLog(":CONTROLLER:DEBUG: Forcing a call to populate")
 		self.populate()
 		self.populate()
 		super.viewWillAppear(animated)
 		super.viewWillAppear(animated)
 	}
 	}
@@ -241,7 +228,8 @@ class ViewController: UIViewController, UICollectionViewDataSource, UICollection
 				
 				
 		NSLog(":CONTROLLER:DEBUG: Don't skyp sync")
 		NSLog(":CONTROLLER:DEBUG: Don't skyp sync")
 		//NSLog(":CONTROLLER:DEBUG: Skyp sync")
 		//NSLog(":CONTROLLER:DEBUG: Skyp sync")
-		Sync()
+		//Notifications()
+		//Sync()
 
 
 		
 		
 		self.delegate = UIApplication.shared.delegate as? AppDelegate
 		self.delegate = UIApplication.shared.delegate as? AppDelegate
@@ -262,6 +250,7 @@ class ViewController: UIViewController, UICollectionViewDataSource, UICollection
 	As of now, not working.
 	As of now, not working.
 	*/
 	*/
 	func populate(){
 	func populate(){
+		// TODO Set this up.
 		if (self.containerViewHome != nil){
 		if (self.containerViewHome != nil){
 			//(self.containerViewHome as HomeView).populate()
 			//(self.containerViewHome as HomeView).populate()
 			//let ng = self.containerViewHome.dbgTxt
 			//let ng = self.containerViewHome.dbgTxt
@@ -285,12 +274,12 @@ class ViewController: UIViewController, UICollectionViewDataSource, UICollection
 	*/
 	*/
 	override func viewDidAppear(_ animated: Bool) {
 	override func viewDidAppear(_ animated: Bool) {
 		super.viewDidAppear(animated)
 		super.viewDidAppear(animated)
-		if UserDefaults.standard.object(forKey: "userId") == nil{
+		/*if UserDefaults.standard.object(forKey: "userId") == nil{
 			let newUid = randomString(length: 16)
 			let newUid = randomString(length: 16)
 			let defaults = UserDefaults.standard
 			let defaults = UserDefaults.standard
 			defaults.set(newUid, forKey: "userId")
 			defaults.set(newUid, forKey: "userId")
 			initialSync(showScreen: true)
 			initialSync(showScreen: true)
-		}
+		}*/
 		
 		
 	}
 	}
 	
 	
@@ -342,8 +331,6 @@ class ViewController: UIViewController, UICollectionViewDataSource, UICollection
 	//Make a cell for each section
 	//Make a cell for each section
 	func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
 	func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
 		
 		
-		var first = true
-		
 		//Get a reference to our storyboard cell
 		//Get a reference to our storyboard cell
 		let cell = collectionView.dequeueReusableCell(withReuseIdentifier: reuseIdentifier, for: indexPath as IndexPath) as! MenuCollectionViewCell
 		let cell = collectionView.dequeueReusableCell(withReuseIdentifier: reuseIdentifier, for: indexPath as IndexPath) as! MenuCollectionViewCell
 		
 		
@@ -353,7 +340,6 @@ class ViewController: UIViewController, UICollectionViewDataSource, UICollection
 		// Mark the first one as selected.
 		// Mark the first one as selected.
 		if indexPath.item == 0{
 		if indexPath.item == 0{
 			cell.isSelected = true
 			cell.isSelected = true
-			first = false
 		}
 		}
 		
 		
 		return cell
 		return cell
@@ -371,24 +357,7 @@ class ViewController: UIViewController, UICollectionViewDataSource, UICollection
 	:param: selected Index of the selected item.
 	:param: selected Index of the selected item.
 	*/
 	*/
 	@IBAction func showComponent(selected: Int) {
 	@IBAction func showComponent(selected: Int) {
-		NSLog(":CONTROLLER:DEBUG: Selected: \(selected)")
-		//Activate label
-		var i = 0
-
-		
-		/*for cell in sectionCollection.visibleCells as! [MenuCollectionViewCell]{ //TODO: Not only visibles!
-			if i == selected + 1{
-				cell.bar.backgroundColor = UIColor(red: 90/255, green: 180/255, blue: 255/255, alpha: 1)
-				cell.label.font = UIFont.boldSystemFont(ofSize: cell.label.font.pointSize)
-			}
-			else{
-				cell.bar.backgroundColor = UIColor(red: 148/255, green: 209/255, blue: 255/255, alpha: 1)
-				cell.label.font = UIFont.systemFont(ofSize: cell.label.font.pointSize)
 				
 				
-			}
-			i = i + 1
-		}*/
-		
 		//Show the view
 		//Show the view
 		if selected == 0 {
 		if selected == 0 {
 			UIView.animate(withDuration: 0.5, animations: {
 			UIView.animate(withDuration: 0.5, animations: {
@@ -450,9 +419,6 @@ class ViewController: UIViewController, UICollectionViewDataSource, UICollection
 				self.containerViewGallery.alpha = 1
 				self.containerViewGallery.alpha = 1
 			})
 			})
 		}
 		}
-		
 	}
 	}
-
-
 }
 }