Jelajahi Sumber

Merge branch 'BaseProject'

Iñigo Valentin 9 tahun lalu
induk
melakukan
47183d4ff8

+ 3 - 15
MenuCollectionViewCell.swift

@@ -20,8 +20,6 @@
 
 
 import UIKit
 import UIKit
 
 
-private let highlightedColor = UIColor(rgb: 0xD8D8D8)
-
 /**
 /**
  Extension of UICollectionViewCell for the main menu.
  Extension of UICollectionViewCell for the main menu.
  */
  */
@@ -31,25 +29,21 @@ class MenuCollectionViewCell: UICollectionViewCell {
  
  
 	@IBOutlet weak var bar: UIView!
 	@IBOutlet weak var bar: UIView!
 	
 	
-	var shouldTintBackgroundWhenSelected = true // You can change default value
-	var specialHighlightedArea: UIView?
 	
 	
-	override var isHighlighted: Bool { // make lightgray background show immediately
+	override var isHighlighted: Bool {
 		willSet {
 		willSet {
 			onSelected(newValue)
 			onSelected(newValue)
 		}
 		}
 	}
 	}
-	override var isSelected: Bool { // keep lightGray background until unselected
+	override var isSelected: Bool {
 		willSet {
 		willSet {
 			onSelected(newValue)
 			onSelected(newValue)
 		}
 		}
 	}
 	}
 	func onSelected(_ newValue: Bool) {
 	func onSelected(_ newValue: Bool) {
-		//self.bar.backgroundColor = UIColor(red: 90/255, green: 180/255, blue: 255/255, alpha: 1)
-		//self.label.font = UIFont.boldSystemFont(ofSize: self.label.font.pointSize)
+
 		guard selectedBackgroundView == nil else { return }
 		guard selectedBackgroundView == nil else { return }
 		if newValue == true {
 		if newValue == true {
-			//contentView.backgroundColor = newValue ? highlightedColor : UIColor.clear
 			self.bar.backgroundColor = UIColor(red: 148/255, green: 209/255, blue: 255/255, alpha: 1)
 			self.bar.backgroundColor = UIColor(red: 148/255, green: 209/255, blue: 255/255, alpha: 1)
 			self.label.font = UIFont.boldSystemFont(ofSize: self.label.font.pointSize)
 			self.label.font = UIFont.boldSystemFont(ofSize: self.label.font.pointSize)
 			self.label.textColor = UIColor(red: 255/255, green: 255/255, blue: 255/255, alpha: 1)
 			self.label.textColor = UIColor(red: 255/255, green: 255/255, blue: 255/255, alpha: 1)
@@ -61,9 +55,3 @@ class MenuCollectionViewCell: UICollectionViewCell {
 		}
 		}
 	}
 	}
 }
 }
-
-extension UIColor {
-	convenience init(rgb: Int, alpha: CGFloat = 1.0) {
-		self.init(red: CGFloat((rgb & 0xFF0000) >> 16) / 255.0, green: CGFloat((rgb & 0xFF00) >> 8) / 255.0, blue: CGFloat(rgb & 0xFF) / 255.0, alpha: alpha)
-	}
-}

+ 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)

+ 49 - 3
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]
@@ -156,7 +176,8 @@ 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)")
 		}
 		}
 	}
 	}
@@ -177,5 +198,30 @@ class AlbumViewController: UIViewController, UIGestureRecognizerDelegate {
 		}
 		}
 	}
 	}
 	
 	
+	
+	/**
+	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
+		}
+	}
+	
+	
+	/**
+	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)
+	}
+	
 }
 }
 
 

+ 1 - 0
app/AppDelegate.swift

@@ -27,6 +27,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
 
 
 	var window: UIWindow?
 	var window: UIWindow?
 	var controller: ViewController?
 	var controller: ViewController?
+	var albumController: AlbumViewController?
 
 
 	
 	
 	func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
 	func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

+ 34 - 16
app/Base.lproj/Main.storyboard

@@ -382,13 +382,13 @@
                                                                 <rect key="frame" x="8" y="8" width="339" height="949"/>
                                                                 <rect key="frame" x="8" y="8" width="339" height="949"/>
                                                                 <subviews>
                                                                 <subviews>
                                                                     <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="PhotoPlaceholder" translatesAutoresizingMaskIntoConstraints="NO" id="u3M-mi-Tyn" userLabel="Image">
                                                                     <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="PhotoPlaceholder" translatesAutoresizingMaskIntoConstraints="NO" id="u3M-mi-Tyn" userLabel="Image">
-                                                                        <rect key="frame" x="0.0" y="10" width="339" height="71"/>
+                                                                        <rect key="frame" x="10" y="10" width="319" height="180"/>
                                                                         <constraints>
                                                                         <constraints>
-                                                                            <constraint firstAttribute="height" constant="71" id="fQp-wR-eLU"/>
+                                                                            <constraint firstAttribute="height" constant="180" id="fQp-wR-eLU"/>
                                                                         </constraints>
                                                                         </constraints>
                                                                     </imageView>
                                                                     </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="2i2-HF-HyI" userLabel="Text">
                                                                     <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="2i2-HF-HyI" userLabel="Text">
-                                                                        <rect key="frame" x="17" y="91" width="305.5" height="826"/>
+                                                                        <rect key="frame" x="17" y="200" width="305.5" height="717"/>
                                                                         <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"/>
@@ -412,7 +412,7 @@
                                                                 </subviews>
                                                                 </subviews>
                                                                 <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
                                                                 <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
                                                                 <constraints>
                                                                 <constraints>
-                                                                    <constraint firstItem="u3M-mi-Tyn" firstAttribute="width" secondItem="7t9-eQ-KC7" secondAttribute="width" id="4ZF-fF-btB"/>
+                                                                    <constraint firstItem="u3M-mi-Tyn" firstAttribute="width" secondItem="7t9-eQ-KC7" secondAttribute="width" constant="-20" id="4ZF-fF-btB"/>
                                                                     <constraint firstItem="tAc-xa-mg2" firstAttribute="centerX" secondItem="7t9-eQ-KC7" secondAttribute="centerX" id="Bf4-vV-UnB"/>
                                                                     <constraint firstItem="tAc-xa-mg2" firstAttribute="centerX" secondItem="7t9-eQ-KC7" secondAttribute="centerX" id="Bf4-vV-UnB"/>
                                                                     <constraint firstItem="pX4-mq-dj0" firstAttribute="width" secondItem="7t9-eQ-KC7" secondAttribute="width" multiplier="0.9" id="Dqr-hS-PV9"/>
                                                                     <constraint firstItem="pX4-mq-dj0" firstAttribute="width" secondItem="7t9-eQ-KC7" secondAttribute="width" multiplier="0.9" id="Dqr-hS-PV9"/>
                                                                     <constraint firstItem="2i2-HF-HyI" firstAttribute="centerX" secondItem="7t9-eQ-KC7" secondAttribute="centerX" id="Hoe-4Q-YTi"/>
                                                                     <constraint firstItem="2i2-HF-HyI" firstAttribute="centerX" secondItem="7t9-eQ-KC7" secondAttribute="centerX" id="Hoe-4Q-YTi"/>
@@ -697,6 +697,7 @@
                         <outlet property="albumView" destination="YEF-04-q7Y" id="7tR-Lr-9nh"/>
                         <outlet property="albumView" destination="YEF-04-q7Y" id="7tR-Lr-9nh"/>
                         <outlet property="barButton" destination="Thj-0t-rxK" id="6bX-xo-abt"/>
                         <outlet property="barButton" destination="Thj-0t-rxK" id="6bX-xo-abt"/>
                         <outlet property="barTitle" destination="LLe-aQ-Sbj" id="bFR-jT-Xmq"/>
                         <outlet property="barTitle" destination="LLe-aQ-Sbj" id="bFR-jT-Xmq"/>
+                        <segue destination="hRA-2q-Tv9" kind="show" identifier="SeguePhotoAlbum" id="ftR-BO-YPe"/>
                     </connections>
                     </connections>
                 </viewController>
                 </viewController>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="GLj-OZ-Cqc" userLabel="First Responder" sceneMemberID="firstResponder"/>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="GLj-OZ-Cqc" userLabel="First Responder" sceneMemberID="firstResponder"/>
@@ -1101,13 +1102,13 @@
                                                                 <rect key="frame" x="8" y="8" width="339" height="949"/>
                                                                 <rect key="frame" x="8" y="8" width="339" height="949"/>
                                                                 <subviews>
                                                                 <subviews>
                                                                     <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="PhotoPlaceholder" translatesAutoresizingMaskIntoConstraints="NO" id="8Jn-h7-TSJ" userLabel="Image">
                                                                     <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="PhotoPlaceholder" translatesAutoresizingMaskIntoConstraints="NO" id="8Jn-h7-TSJ" userLabel="Image">
-                                                                        <rect key="frame" x="0.0" y="10" width="339" height="71"/>
+                                                                        <rect key="frame" x="10" y="10" width="319" height="180"/>
                                                                         <constraints>
                                                                         <constraints>
-                                                                            <constraint firstAttribute="height" constant="71" id="lZg-2O-4LP"/>
+                                                                            <constraint firstAttribute="height" constant="180" id="lZg-2O-4LP"/>
                                                                         </constraints>
                                                                         </constraints>
                                                                     </imageView>
                                                                     </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="Usd-Rm-Tq2" userLabel="Text">
                                                                     <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="Usd-Rm-Tq2" userLabel="Text">
-                                                                        <rect key="frame" x="17" y="91" width="305.5" height="826"/>
+                                                                        <rect key="frame" x="17" y="200" width="305.5" height="717"/>
                                                                         <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"/>
@@ -1140,7 +1141,7 @@
                                                                     <constraint firstItem="Usd-Rm-Tq2" firstAttribute="centerX" secondItem="Omg-cP-uvF" secondAttribute="centerX" id="SHM-nk-s9u"/>
                                                                     <constraint firstItem="Usd-Rm-Tq2" firstAttribute="centerX" secondItem="Omg-cP-uvF" secondAttribute="centerX" id="SHM-nk-s9u"/>
                                                                     <constraint firstItem="dvg-B2-xmI" firstAttribute="centerX" secondItem="Omg-cP-uvF" secondAttribute="centerX" id="XBR-sR-Yqg"/>
                                                                     <constraint firstItem="dvg-B2-xmI" firstAttribute="centerX" secondItem="Omg-cP-uvF" secondAttribute="centerX" id="XBR-sR-Yqg"/>
                                                                     <constraint firstItem="LmH-0o-Hku" firstAttribute="centerX" secondItem="Omg-cP-uvF" secondAttribute="centerX" id="a8v-br-EaA"/>
                                                                     <constraint firstItem="LmH-0o-Hku" firstAttribute="centerX" secondItem="Omg-cP-uvF" secondAttribute="centerX" id="a8v-br-EaA"/>
-                                                                    <constraint firstItem="8Jn-h7-TSJ" firstAttribute="width" secondItem="Omg-cP-uvF" secondAttribute="width" id="gm5-CU-FKw"/>
+                                                                    <constraint firstItem="8Jn-h7-TSJ" firstAttribute="width" secondItem="Omg-cP-uvF" secondAttribute="width" constant="-20" id="gm5-CU-FKw"/>
                                                                     <constraint firstItem="8Jn-h7-TSJ" firstAttribute="top" secondItem="Omg-cP-uvF" secondAttribute="top" constant="10" id="js6-Fg-pg1"/>
                                                                     <constraint firstItem="8Jn-h7-TSJ" firstAttribute="top" secondItem="Omg-cP-uvF" secondAttribute="top" constant="10" id="js6-Fg-pg1"/>
                                                                     <constraint firstAttribute="bottom" secondItem="dvg-B2-xmI" secondAttribute="bottom" id="lta-H9-CYI"/>
                                                                     <constraint firstAttribute="bottom" secondItem="dvg-B2-xmI" secondAttribute="bottom" id="lta-H9-CYI"/>
                                                                     <constraint firstItem="LmH-0o-Hku" firstAttribute="width" secondItem="Omg-cP-uvF" secondAttribute="width" multiplier="0.9" id="xmH-tU-ZFp"/>
                                                                     <constraint firstItem="LmH-0o-Hku" firstAttribute="width" secondItem="Omg-cP-uvF" secondAttribute="width" multiplier="0.9" id="xmH-tU-ZFp"/>
@@ -1298,16 +1299,28 @@
                                                 <nil key="highlightedColor"/>
                                                 <nil key="highlightedColor"/>
                                             </label>
                                             </label>
                                             <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="10" translatesAutoresizingMaskIntoConstraints="NO" id="78P-mw-WXM" userLabel="Content">
                                             <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"/>
+                                                <rect key="frame" x="0.0" y="30" width="355" height="567"/>
                                                 <subviews>
                                                 <subviews>
                                                     <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="jIN-Yy-3GU" userLabel="Photo">
                                                     <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="jIN-Yy-3GU" userLabel="Photo">
-                                                        <rect key="frame" x="8" y="8" width="339" height="541"/>
+                                                        <rect key="frame" x="8" y="8" width="339" height="551"/>
                                                         <subviews>
                                                         <subviews>
                                                             <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="PhotoPlaceholder" translatesAutoresizingMaskIntoConstraints="NO" id="2wg-l8-Thi" userLabel="Image">
                                                             <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"/>
+                                                                <rect key="frame" x="10" y="10" width="319" height="413.5"/>
+                                                                <color key="backgroundColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
+                                                                <userDefinedRuntimeAttributes>
+                                                                    <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                                                                        <real key="value" value="2"/>
+                                                                    </userDefinedRuntimeAttribute>
+                                                                    <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
+                                                                        <color key="value" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
+                                                                    </userDefinedRuntimeAttribute>
+                                                                    <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
+                                                                        <real key="value" value="4"/>
+                                                                    </userDefinedRuntimeAttribute>
+                                                                </userDefinedRuntimeAttributes>
                                                             </imageView>
                                                             </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">
                                                             <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"/>
+                                                                <rect key="frame" x="10.5" y="461" width="319" height="20"/>
                                                                 <constraints>
                                                                 <constraints>
                                                                     <constraint firstAttribute="height" constant="20" id="fXM-sB-Ii7"/>
                                                                     <constraint firstAttribute="height" constant="20" id="fXM-sB-Ii7"/>
                                                                 </constraints>
                                                                 </constraints>
@@ -1316,7 +1329,7 @@
                                                                 <nil key="highlightedColor"/>
                                                                 <nil key="highlightedColor"/>
                                                             </label>
                                                             </label>
                                                             <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Jcy-kv-ggg">
                                                             <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"/>
+                                                                <rect key="frame" x="10" y="501" width="149.5" height="40"/>
                                                                 <color key="backgroundColor" red="0.070588235289999995" green="0.27058823529999998" blue="0.4039215686" alpha="1" colorSpace="calibratedRGB"/>
                                                                 <color key="backgroundColor" red="0.070588235289999995" green="0.27058823529999998" blue="0.4039215686" alpha="1" colorSpace="calibratedRGB"/>
                                                                 <constraints>
                                                                 <constraints>
                                                                     <constraint firstAttribute="height" constant="40" id="voU-YV-2ln"/>
                                                                     <constraint firstAttribute="height" constant="40" id="voU-YV-2ln"/>
@@ -1338,7 +1351,7 @@
                                                                 </userDefinedRuntimeAttributes>
                                                                 </userDefinedRuntimeAttributes>
                                                             </button>
                                                             </button>
                                                             <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="HOD-9J-wQK">
                                                             <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"/>
+                                                                <rect key="frame" x="179.5" y="501" width="149.5" height="40"/>
                                                                 <color key="backgroundColor" red="0.070588235289999995" green="0.27058823529999998" blue="0.4039215686" alpha="1" colorSpace="calibratedRGB"/>
                                                                 <color key="backgroundColor" red="0.070588235289999995" green="0.27058823529999998" blue="0.4039215686" alpha="1" colorSpace="calibratedRGB"/>
                                                                 <constraints>
                                                                 <constraints>
                                                                     <constraint firstAttribute="height" constant="40" id="6oc-MW-3JE"/>
                                                                     <constraint firstAttribute="height" constant="40" id="6oc-MW-3JE"/>
@@ -1396,7 +1409,8 @@
                                         </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"/>
                                         <constraints>
                                         <constraints>
-                                            <constraint firstAttribute="bottom" secondItem="78P-mw-WXM" secondAttribute="bottom" constant="10" id="JdO-O4-mee"/>
+                                            <constraint firstAttribute="bottom" secondItem="78P-mw-WXM" secondAttribute="bottom" id="JdO-O4-mee"/>
+                                            <constraint firstItem="esM-2C-p2i" firstAttribute="top" secondItem="bqh-wV-GNf" secondAttribute="top" id="KOQ-eg-hXm"/>
                                             <constraint firstItem="78P-mw-WXM" firstAttribute="width" secondItem="bqh-wV-GNf" secondAttribute="width" id="PpI-M2-bDk"/>
                                             <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="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="78P-mw-WXM" firstAttribute="top" secondItem="esM-2C-p2i" secondAttribute="bottom" id="muK-Pd-v3M"/>
@@ -1417,7 +1431,7 @@
                                         </userDefinedRuntimeAttributes>
                                         </userDefinedRuntimeAttributes>
                                     </view>
                                     </view>
                                 </subviews>
                                 </subviews>
-                                <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                                <color key="backgroundColor" red="0.70980392160000005" green="0.82745098039999998" blue="0.8980392157" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                 <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="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="height" secondItem="dh0-OE-3US" secondAttribute="height" constant="-20" id="Tgd-YQ-aEQ"/>
@@ -1437,6 +1451,7 @@
                             <constraint firstItem="XUY-te-9PN" firstAttribute="top" secondItem="iD5-7d-BcL" secondAttribute="bottom" id="6xm-50-tbJ"/>
                             <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="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="dh0-OE-3US" firstAttribute="centerX" secondItem="zXb-Ja-8dX" secondAttribute="centerX" id="FEt-9c-pvb"/>
+                            <constraint firstItem="dh0-OE-3US" firstAttribute="width" secondItem="zXb-Ja-8dX" secondAttribute="width" id="MlH-pm-QQM"/>
                             <constraint firstItem="XUY-te-9PN" firstAttribute="centerX" secondItem="zXb-Ja-8dX" secondAttribute="centerX" id="vfQ-Yn-21i"/>
                             <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="UVa-jE-Gqw" firstAttribute="top" secondItem="dh0-OE-3US" secondAttribute="bottom" id="w47-kr-EXB"/>
                         </constraints>
                         </constraints>
@@ -1460,4 +1475,7 @@
         <image name="Logo" width="83" height="83"/>
         <image name="Logo" width="83" height="83"/>
         <image name="PhotoPlaceholder" width="170" height="108"/>
         <image name="PhotoPlaceholder" width="170" height="108"/>
     </resources>
     </resources>
+    <inferredMetricsTieBreakers>
+        <segue reference="ftR-BO-YPe"/>
+    </inferredMetricsTieBreakers>
 </document>
 </document>

+ 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
 				}
 				}
 
 

+ 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

+ 48 - 4
app/HomeView.swift

@@ -148,6 +148,12 @@ class HomeView: UIView {
 			let minutes = Calendar.current.dateComponents([.minute], from: time, to: cTime).minute
 			let minutes = Calendar.current.dateComponents([.minute], from: time, to: cTime).minute
 			if (minutes! < 30){
 			if (minutes! < 30){
 				self.locationSection.isHidden = false
 				self.locationSection.isHidden = false
+				
+				// Set tap recognizer.
+				let tapRecognizer = UITapGestureRecognizer(target: self, action: #selector (HomeView.openLocation (_:)))
+				tapRecognizer.delegate = (UIApplication.shared.delegate as! AppDelegate).controller
+				self.locationSection.addGestureRecognizer(tapRecognizer)
+				
 				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)
@@ -182,11 +188,16 @@ class HomeView: UIView {
 	*/
 	*/
 	func setUpLablanca(context : NSManagedObjectContext, delegate: AppDelegate, lang: String){
 	func setUpLablanca(context : NSManagedObjectContext, delegate: AppDelegate, lang: String){
 		
 		
-		// TODO set listener.
 		let defaults = UserDefaults.standard
 		let defaults = UserDefaults.standard
 		if (defaults.value(forKey: "festivals") != nil){
 		if (defaults.value(forKey: "festivals") != nil){
 			let festivals = defaults.value(forKey: "festivals") as! Int
 			let festivals = defaults.value(forKey: "festivals") as! Int
 			if festivals == 1{
 			if festivals == 1{
+				
+				// Set tap recognizer
+				let tapRecognizer = UITapGestureRecognizer(target: self, action: #selector (HomeView.openLablanca (_:)))
+				tapRecognizer.delegate = (UIApplication.shared.delegate as! AppDelegate).controller
+				self.lablancaSection.addGestureRecognizer(tapRecognizer)
+				
 				// TODO: Get current year
 				// TODO: Get current year
 				let year = 2017
 				let year = 2017
 				
 				
@@ -458,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
 			}
 			}
 		}
 		}
@@ -525,8 +552,25 @@ 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)
 	}
 	}
+	
+	
+	/**
+	Opens the La Blanca section when tapping the section.
+	*/
+	func openLablanca(_ sender:UITapGestureRecognizer? = nil){
+		let delegate: AppDelegate = UIApplication.shared.delegate as! AppDelegate
+		delegate.controller?.showComponent(selected: 2)
+	}
+	
+	
+	/**
+	Opens the Location section when tapping the section.
+	*/
+	func openLocation(_ sender:UITapGestureRecognizer? = nil){
+		let delegate: AppDelegate = UIApplication.shared.delegate as! AppDelegate
+		delegate.controller?.showComponent(selected: 1)
+	}
 }
 }

+ 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.")
-		}
 	}
 	}
 
 
 
 

+ 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 - 38
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
@@ -109,40 +166,51 @@ class PhotoViewController: UIViewController, UIGestureRecognizerDelegate {
 			var sTitle: String
 			var sTitle: String
 			var sText: 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 +218,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)")
 						}
 						}
 					}
 					}

+ 2 - 7
app/RowAlbum.swift

@@ -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)
 			}
 			}
 		}
 		}

+ 0 - 1
app/RowBlog.swift

@@ -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"/>

+ 0 - 1
app/RowFutureActivity.swift

@@ -203,7 +203,6 @@ 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?.showPastActivity(id: self.id)
 	}
 	}

+ 3 - 3
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>
@@ -44,7 +44,7 @@
                                     <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="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"/>

+ 0 - 2
app/RowGallery.swift

@@ -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>

+ 69 - 0
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
@@ -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>

+ 0 - 1
app/RowHomePastActivities.swift

@@ -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"/>

+ 0 - 1
app/RowLablancaOffer.swift

@@ -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"/>

+ 1 - 7
app/RowSchedule.swift

@@ -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")
 	}
 	}
 }
 }

+ 0 - 1
app/ScheduleViewController.swift

@@ -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

+ 9 - 3
app/Sync.swift

@@ -1323,17 +1323,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)

+ 12 - 45
app/ViewController.swift

@@ -60,7 +60,6 @@ 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!")
 		super.init(coder: aDecoder)
 		super.init(coder: aDecoder)
 		
 		
 	}
 	}
@@ -86,7 +85,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 +95,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 +105,10 @@ 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
+		// TODO set future segue
 		//performSegue(withIdentifier: "SegueFutureActivity", sender: nil)
 		//performSegue(withIdentifier: "SegueFutureActivity", sender: nil)
+		performSegue(withIdentifier: "SeguePastActivity", sender: nil)
 	}
 	}
 	
 	
 	
 	
@@ -120,23 +117,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 +138,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
 		}
 		}
@@ -163,12 +155,10 @@ class ViewController: UIViewController, UICollectionViewDataSource, UICollection
 	*/
 	*/
 	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.")
 			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
 		}
 		}
@@ -214,7 +203,6 @@ class ViewController: UIViewController, UICollectionViewDataSource, UICollection
 	}
 	}
 	
 	
 	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)
 	}
 	}
@@ -247,6 +235,8 @@ class ViewController: UIViewController, UICollectionViewDataSource, UICollection
 		self.delegate = UIApplication.shared.delegate as? AppDelegate
 		self.delegate = UIApplication.shared.delegate as? AppDelegate
 		self.delegate?.controller = self
 		self.delegate?.controller = self
 		
 		
+		//self.sectionCollection.visibleCells[0].isSelected = true
+		
 		super.viewDidLoad()
 		super.viewDidLoad()
 		
 		
 	}
 	}
@@ -260,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
@@ -339,26 +330,20 @@ 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
 		
 		
 		//Set text
 		//Set text
 		cell.label.text = self.items[indexPath.item]
 		cell.label.text = self.items[indexPath.item]
 		
 		
-		//Mark the first cell as selected...
-		/*if indexPath.item == selected{
-			cell.bar.backgroundColor = UIColor(red: 148/255, green: 209/255, blue: 255/255, alpha: 1)
-			cell.label.font = UIFont.boldSystemFont(ofSize: cell.label.font.pointSize)
-			cell.label.textColor = UIColor(red: 255/255, green: 255/255, blue: 255/255, alpha: 1)
+		// Mark the first one as selected.
+		if indexPath.item == 0{
+			cell.isSelected = true
+			first = false
 		}
 		}
-			
-		//... and the others as unselected
-		else{
-			cell.bar.backgroundColor = UIColor(red: 90/255, green: 180/255, blue: 255/255, alpha: 1)
-			cell.label.font = UIFont.systemFont(ofSize: cell.label.font.pointSize)
-			cell.label.textColor = UIColor(red: 200/255, green: 200/255, blue: 200/255, alpha: 1)
-		}*/
 		
 		
 		return cell
 		return cell
 	}
 	}
@@ -375,23 +360,8 @@ 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
 		//Activate label
 		var i = 0
 		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 {
@@ -454,9 +424,6 @@ class ViewController: UIViewController, UICollectionViewDataSource, UICollection
 				self.containerViewGallery.alpha = 1
 				self.containerViewGallery.alpha = 1
 			})
 			})
 		}
 		}
-		
 	}
 	}
-
-
 }
 }