Prechádzať zdrojové kódy

Merge branch 'Gallery' into BaseProject

Iñigo Valentin 9 rokov pred
rodič
commit
d1809e8868

+ 4 - 0
app.xcodeproj/project.pbxproj

@@ -84,6 +84,7 @@
 		93E0C5EE1EBE25BD00905811 /* RowLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93E0C5ED1EBE25BC00905811 /* RowLabel.swift */; };
 		93E0C5EE1EBE25BD00905811 /* RowLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93E0C5ED1EBE25BC00905811 /* RowLabel.swift */; };
 		93E0C5F21EBE264F00905811 /* RowLabel.xib in Resources */ = {isa = PBXBuildFile; fileRef = 93E0C5F11EBE264F00905811 /* RowLabel.xib */; };
 		93E0C5F21EBE264F00905811 /* RowLabel.xib in Resources */ = {isa = PBXBuildFile; fileRef = 93E0C5F11EBE264F00905811 /* RowLabel.xib */; };
 		93E0C5F41EBE306900905811 /* ScheduleViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93E0C5F31EBE306900905811 /* ScheduleViewController.swift */; };
 		93E0C5F41EBE306900905811 /* ScheduleViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93E0C5F31EBE306900905811 /* ScheduleViewController.swift */; };
+		93E5058F1EEB0DCC00560B4A /* PhotoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93E5058E1EEB0DCC00560B4A /* PhotoViewController.swift */; };
 		93EB2F0C1EBF5AEB00F64186 /* RowSchedule.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93EB2F0B1EBF5AEB00F64186 /* RowSchedule.swift */; };
 		93EB2F0C1EBF5AEB00F64186 /* RowSchedule.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93EB2F0B1EBF5AEB00F64186 /* RowSchedule.swift */; };
 		93EB2F0E1EBF5BF500F64186 /* RowSchedule.xib in Resources */ = {isa = PBXBuildFile; fileRef = 93EB2F0D1EBF5BF500F64186 /* RowSchedule.xib */; };
 		93EB2F0E1EBF5BF500F64186 /* RowSchedule.xib in Resources */ = {isa = PBXBuildFile; fileRef = 93EB2F0D1EBF5BF500F64186 /* RowSchedule.xib */; };
 		93EE9ECB1EE9B87100288F6E /* PastActivityViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93EE9ECA1EE9B87100288F6E /* PastActivityViewController.swift */; };
 		93EE9ECB1EE9B87100288F6E /* PastActivityViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93EE9ECA1EE9B87100288F6E /* PastActivityViewController.swift */; };
@@ -170,6 +171,7 @@
 		93E0C5ED1EBE25BC00905811 /* RowLabel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RowLabel.swift; sourceTree = "<group>"; };
 		93E0C5ED1EBE25BC00905811 /* RowLabel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RowLabel.swift; sourceTree = "<group>"; };
 		93E0C5F11EBE264F00905811 /* RowLabel.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = RowLabel.xib; sourceTree = "<group>"; };
 		93E0C5F11EBE264F00905811 /* RowLabel.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = RowLabel.xib; sourceTree = "<group>"; };
 		93E0C5F31EBE306900905811 /* ScheduleViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ScheduleViewController.swift; sourceTree = "<group>"; };
 		93E0C5F31EBE306900905811 /* ScheduleViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ScheduleViewController.swift; sourceTree = "<group>"; };
+		93E5058E1EEB0DCC00560B4A /* PhotoViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PhotoViewController.swift; sourceTree = "<group>"; };
 		93EB2F0B1EBF5AEB00F64186 /* RowSchedule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RowSchedule.swift; sourceTree = "<group>"; };
 		93EB2F0B1EBF5AEB00F64186 /* RowSchedule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RowSchedule.swift; sourceTree = "<group>"; };
 		93EB2F0D1EBF5BF500F64186 /* RowSchedule.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = RowSchedule.xib; sourceTree = "<group>"; };
 		93EB2F0D1EBF5BF500F64186 /* RowSchedule.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = RowSchedule.xib; sourceTree = "<group>"; };
 		93EE9ECA1EE9B87100288F6E /* PastActivityViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PastActivityViewController.swift; sourceTree = "<group>"; };
 		93EE9ECA1EE9B87100288F6E /* PastActivityViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PastActivityViewController.swift; sourceTree = "<group>"; };
@@ -287,6 +289,7 @@
 				93B9113E1ED7582B0061BA71 /* LocationView.swift */,
 				93B9113E1ED7582B0061BA71 /* LocationView.swift */,
 				93B9115E1ED765510061BA71 /* app-Bridging-Header.h */,
 				93B9115E1ED765510061BA71 /* app-Bridging-Header.h */,
 				93EE9ECA1EE9B87100288F6E /* PastActivityViewController.swift */,
 				93EE9ECA1EE9B87100288F6E /* PastActivityViewController.swift */,
+				93E5058E1EEB0DCC00560B4A /* PhotoViewController.swift */,
 			);
 			);
 			path = app;
 			path = app;
 			sourceTree = "<group>";
 			sourceTree = "<group>";
@@ -435,6 +438,7 @@
 				93D9EA761DE3ACBB00089002 /* Sync.swift in Sources */,
 				93D9EA761DE3ACBB00089002 /* Sync.swift in Sources */,
 				93E0C5EA1EBDFFB400905811 /* RowPastActivity.swift in Sources */,
 				93E0C5EA1EBDFFB400905811 /* RowPastActivity.swift in Sources */,
 				93BAD2F41E585EE6009DF853 /* RowHomeFutureActivities.swift in Sources */,
 				93BAD2F41E585EE6009DF853 /* RowHomeFutureActivities.swift in Sources */,
+				93E5058F1EEB0DCC00560B4A /* PhotoViewController.swift in Sources */,
 				931AA5891E1AFF8C003A2290 /* String.swift in Sources */,
 				931AA5891E1AFF8C003A2290 /* String.swift in Sources */,
 				935AE18A1EC6138D0055E71F /* SyncController.swift in Sources */,
 				935AE18A1EC6138D0055E71F /* SyncController.swift in Sources */,
 				93B84B9C1D9C31AB006C0F67 /* ViewController.swift in Sources */,
 				93B84B9C1D9C31AB006C0F67 /* ViewController.swift in Sources */,

+ 3 - 3
app/ActivitiesView.xib

@@ -1,11 +1,11 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11762" systemVersion="16E195" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="12120" systemVersion="16E195" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
     <device id="retina4_7" orientation="portrait">
     <device id="retina4_7" orientation="portrait">
         <adaptation id="fullscreen"/>
         <adaptation id="fullscreen"/>
     </device>
     </device>
     <dependencies>
     <dependencies>
         <deployment identifier="iOS"/>
         <deployment identifier="iOS"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12088"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     </dependencies>
     <objects>
     <objects>
@@ -24,7 +24,7 @@
                 <scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="xyM-cc-W1r">
                 <scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="xyM-cc-W1r">
                     <rect key="frame" x="0.0" y="0.0" width="375" height="666"/>
                     <rect key="frame" x="0.0" y="0.0" width="375" height="666"/>
                     <subviews>
                     <subviews>
-                        <stackView opaque="NO" contentMode="scaleToFill" ambiguous="YES" misplaced="YES" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="gvi-ij-s5Q">
+                        <stackView opaque="NO" contentMode="scaleToFill" ambiguous="YES" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="gvi-ij-s5Q">
                             <rect key="frame" x="0.0" y="0.0" width="375" height="306"/>
                             <rect key="frame" x="0.0" y="0.0" width="375" height="306"/>
                             <subviews>
                             <subviews>
                                 <view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Jdf-74-tJS" customClass="Section" customModule="app">
                                 <view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Jdf-74-tJS" customClass="Section" customModule="app">

+ 7 - 1
app/AlbumViewController.swift

@@ -108,8 +108,11 @@ class AlbumViewController: UIViewController, UIGestureRecognizerDelegate {
 				
 				
 				var r = searchResults[i]
 				var r = searchResults[i]
 				var photoId = r.value(forKey: "photo")! as! Int
 				var photoId = r.value(forKey: "photo")! as! Int
+				var leftId: Int = -1
+				var rightId: Int = -1
 				
 				
 				row = RowAlbum.init(s: "rowAlbum\(i)", i: i)
 				row = RowAlbum.init(s: "rowAlbum\(i)", i: i)
+				row.id = id
 				
 				
 				// Get photo info from Photo entity
 				// Get photo info from Photo entity
 				let imgFetchRequest: NSFetchRequest<Photo> = Photo.fetchRequest()
 				let imgFetchRequest: NSFetchRequest<Photo> = Photo.fetchRequest()
@@ -122,17 +125,20 @@ class AlbumViewController: UIViewController, UIGestureRecognizerDelegate {
 					var imgSearchResults = try context.fetch(imgFetchRequest)
 					var imgSearchResults = try context.fetch(imgFetchRequest)
 					var imgR = imgSearchResults[0]
 					var imgR = imgSearchResults[0]
 					image = imgR.value(forKey: "file")! as! String
 					image = imgR.value(forKey: "file")! as! String
+					leftId = imgR.value(forKey: "id")! as! Int
 					NSLog(":GALLERYCONTROLLER:LOG: Image Row \(i) left: \(image)")
 					NSLog(":GALLERYCONTROLLER:LOG: Image Row \(i) left: \(image)")
 					row.setImage(idx: 0, filename: image)
 					row.setImage(idx: 0, filename: image)
 					if i + 1 < searchResults.count {
 					if i + 1 < searchResults.count {
 						r = searchResults[i + 1]
 						r = searchResults[i + 1]
 						photoId = r.value(forKey: "photo")! as! Int
 						photoId = r.value(forKey: "photo")! as! Int
+						
 						imgFetchRequest.predicate = NSPredicate(format: "id == %i", photoId)
 						imgFetchRequest.predicate = NSPredicate(format: "id == %i", photoId)
 						imgSearchResults = try context.fetch(imgFetchRequest)
 						imgSearchResults = try context.fetch(imgFetchRequest)
 						
 						
 						
 						
 						imgR = imgSearchResults[0]
 						imgR = imgSearchResults[0]
 						image = imgR.value(forKey: "file")! as! String
 						image = imgR.value(forKey: "file")! as! String
+						rightId = imgR.value(forKey: "id")! as! Int
 						NSLog(":GALLERYCONTROLLER:LOG: Image Row \(i) right: \(image)")
 						NSLog(":GALLERYCONTROLLER:LOG: Image Row \(i) right: \(image)")
 						row.setImage(idx: 1, filename: image)
 						row.setImage(idx: 1, filename: image)
 					}
 					}
@@ -145,7 +151,7 @@ class AlbumViewController: UIViewController, UIGestureRecognizerDelegate {
 					NSLog(":GALLERYCONTROLLER:ERROR: Error getting image for post \(id): \(error)")
 					NSLog(":GALLERYCONTROLLER:ERROR: Error getting image for post \(id): \(error)")
 				}
 				}
 				
 				
-				NSLog(":GALLERYCONTROLLER:DEBUG: Adding row: height: \(row.frame.height)")
+				row.setIds(left: leftId, right: rightId)
 				albumContainer.addArrangedSubview(row)
 				albumContainer.addArrangedSubview(row)
 				
 				
 				rowcount = rowcount + 1
 				rowcount = rowcount + 1

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

@@ -200,6 +200,7 @@
                         <segue destination="zJF-Mh-CNb" kind="show" identifier="SegueSchedule" id="A70-jo-yAP"/>
                         <segue destination="zJF-Mh-CNb" kind="show" identifier="SegueSchedule" id="A70-jo-yAP"/>
                         <segue destination="3o1-ab-AT4" kind="show" identifier="SegueSync" id="E96-mK-gE9"/>
                         <segue destination="3o1-ab-AT4" kind="show" identifier="SegueSync" id="E96-mK-gE9"/>
                         <segue destination="jfx-Q2-RtY" kind="show" identifier="SeguePastActivity" id="MmG-k2-wHn"/>
                         <segue destination="jfx-Q2-RtY" kind="show" identifier="SeguePastActivity" id="MmG-k2-wHn"/>
+                        <segue destination="hRA-2q-Tv9" kind="show" identifier="SeguePhoto" id="XIb-zK-EYd"/>
                     </connections>
                     </connections>
                 </viewController>
                 </viewController>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
@@ -1239,6 +1240,220 @@
                 <placeholder placeholderIdentifier="IBFirstResponder" id="YKC-ZH-aSz" userLabel="First Responder" sceneMemberID="firstResponder"/>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="YKC-ZH-aSz" userLabel="First Responder" sceneMemberID="firstResponder"/>
             </objects>
             </objects>
         </scene>
         </scene>
+        <!--Photo-->
+        <scene sceneID="Qxt-8f-I5l">
+            <objects>
+                <viewController title="Photo" id="hRA-2q-Tv9" customClass="PhotoViewController" customModule="app" customModuleProvider="target" sceneMemberID="viewController">
+                    <layoutGuides>
+                        <viewControllerLayoutGuide type="top" id="iD5-7d-BcL"/>
+                        <viewControllerLayoutGuide type="bottom" id="UVa-jE-Gqw"/>
+                    </layoutGuides>
+                    <view key="view" contentMode="scaleToFill" id="zXb-Ja-8dX" userLabel="Container">
+                        <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="XUY-te-9PN" userLabel="Toolbar">
+                                <rect key="frame" x="0.0" y="20" width="375" height="30"/>
+                                <subviews>
+                                    <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="4tx-eL-rur">
+                                        <rect key="frame" x="0.0" y="0.0" width="56.5" height="30"/>
+                                        <fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
+                                        <state key="normal" title="&lt;">
+                                            <color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                                        </state>
+                                    </button>
+                                    <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Gasteizko Margolariak" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ifO-mU-TPV">
+                                        <rect key="frame" x="56.5" y="0.0" width="262.5" height="30"/>
+                                        <fontDescription key="fontDescription" type="boldSystem" pointSize="17"/>
+                                        <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                                        <nil key="highlightedColor"/>
+                                    </label>
+                                </subviews>
+                                <color key="backgroundColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                <constraints>
+                                    <constraint firstItem="4tx-eL-rur" firstAttribute="centerY" secondItem="XUY-te-9PN" secondAttribute="centerY" id="AgA-QN-AMl"/>
+                                    <constraint firstItem="4tx-eL-rur" firstAttribute="width" secondItem="XUY-te-9PN" secondAttribute="width" multiplier="0.15" id="C5z-S4-EpK"/>
+                                    <constraint firstItem="ifO-mU-TPV" firstAttribute="centerY" secondItem="XUY-te-9PN" secondAttribute="centerY" id="DDx-b3-3ds"/>
+                                    <constraint firstItem="4tx-eL-rur" firstAttribute="leading" secondItem="XUY-te-9PN" secondAttribute="leading" id="W4J-mY-EF9"/>
+                                    <constraint firstItem="ifO-mU-TPV" firstAttribute="height" secondItem="XUY-te-9PN" secondAttribute="height" id="aKD-k3-Rn6"/>
+                                    <constraint firstItem="4tx-eL-rur" firstAttribute="height" secondItem="XUY-te-9PN" secondAttribute="height" id="msK-d2-NhX"/>
+                                    <constraint firstItem="ifO-mU-TPV" firstAttribute="centerX" secondItem="XUY-te-9PN" secondAttribute="centerX" id="r98-kb-UcD"/>
+                                    <constraint firstItem="ifO-mU-TPV" firstAttribute="width" secondItem="XUY-te-9PN" secondAttribute="width" multiplier="0.7" id="stn-gW-qHw"/>
+                                </constraints>
+                            </view>
+                            <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="dh0-OE-3US">
+                                <rect key="frame" x="0.0" y="50" width="375" height="617"/>
+                                <subviews>
+                                    <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="bqh-wV-GNf" userLabel="Section">
+                                        <rect key="frame" x="10" y="10" width="355" height="597"/>
+                                        <subviews>
+                                            <label opaque="NO" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" restorationIdentifier="Title" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="esM-2C-p2i" userLabel="Title">
+                                                <rect key="frame" x="0.0" y="0.0" width="355" height="30"/>
+                                                <color key="backgroundColor" red="0.0" green="0.47058823529999999" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                                <constraints>
+                                                    <constraint firstAttribute="height" constant="30" id="RzN-hZ-tOL"/>
+                                                </constraints>
+                                                <fontDescription key="fontDescription" type="boldSystem" pointSize="14"/>
+                                                <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                                                <nil key="highlightedColor"/>
+                                            </label>
+                                            <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="10" translatesAutoresizingMaskIntoConstraints="NO" id="78P-mw-WXM" userLabel="Content">
+                                                <rect key="frame" x="0.0" y="30" width="355" height="557"/>
+                                                <subviews>
+                                                    <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="jIN-Yy-3GU" userLabel="Photo">
+                                                        <rect key="frame" x="8" y="8" width="339" height="541"/>
+                                                        <subviews>
+                                                            <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="PhotoPlaceholder" translatesAutoresizingMaskIntoConstraints="NO" id="2wg-l8-Thi" userLabel="Image">
+                                                                <rect key="frame" x="10" y="10" width="319" height="406"/>
+                                                            </imageView>
+                                                            <label opaque="NO" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="254" text="Date" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Vhb-gI-4I7" userLabel="Date">
+                                                                <rect key="frame" x="10.5" y="451" width="319" height="20"/>
+                                                                <constraints>
+                                                                    <constraint firstAttribute="height" constant="20" id="fXM-sB-Ii7"/>
+                                                                </constraints>
+                                                                <fontDescription key="fontDescription" type="italicSystem" pointSize="16"/>
+                                                                <color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
+                                                                <nil key="highlightedColor"/>
+                                                            </label>
+                                                            <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Jcy-kv-ggg">
+                                                                <rect key="frame" x="10" y="491" width="149.5" height="40"/>
+                                                                <color key="backgroundColor" red="0.070588235289999995" green="0.27058823529999998" blue="0.4039215686" alpha="1" colorSpace="calibratedRGB"/>
+                                                                <constraints>
+                                                                    <constraint firstAttribute="height" constant="40" id="voU-YV-2ln"/>
+                                                                </constraints>
+                                                                <fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
+                                                                <state key="normal" title="&lt;">
+                                                                    <color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                                                                </state>
+                                                                <userDefinedRuntimeAttributes>
+                                                                    <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
+                                                                        <color key="value" red="0.0" green="0.47058823529999999" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                                                    </userDefinedRuntimeAttribute>
+                                                                    <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                                                                        <real key="value" value="2"/>
+                                                                    </userDefinedRuntimeAttribute>
+                                                                    <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
+                                                                        <real key="value" value="4"/>
+                                                                    </userDefinedRuntimeAttribute>
+                                                                </userDefinedRuntimeAttributes>
+                                                            </button>
+                                                            <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="HOD-9J-wQK">
+                                                                <rect key="frame" x="179.5" y="491" width="149.5" height="40"/>
+                                                                <color key="backgroundColor" red="0.070588235289999995" green="0.27058823529999998" blue="0.4039215686" alpha="1" colorSpace="calibratedRGB"/>
+                                                                <constraints>
+                                                                    <constraint firstAttribute="height" constant="40" id="6oc-MW-3JE"/>
+                                                                </constraints>
+                                                                <fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
+                                                                <state key="normal" title="&gt;">
+                                                                    <color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                                                                </state>
+                                                                <userDefinedRuntimeAttributes>
+                                                                    <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
+                                                                        <color key="value" red="0.0" green="0.47058823529999999" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                                                    </userDefinedRuntimeAttribute>
+                                                                    <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                                                                        <real key="value" value="2"/>
+                                                                    </userDefinedRuntimeAttribute>
+                                                                    <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
+                                                                        <real key="value" value="4"/>
+                                                                    </userDefinedRuntimeAttribute>
+                                                                </userDefinedRuntimeAttributes>
+                                                            </button>
+                                                        </subviews>
+                                                        <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                                                        <constraints>
+                                                            <constraint firstItem="2wg-l8-Thi" firstAttribute="top" secondItem="jIN-Yy-3GU" secondAttribute="top" constant="10" id="D28-DF-HF9"/>
+                                                            <constraint firstAttribute="bottom" secondItem="Jcy-kv-ggg" secondAttribute="bottom" constant="10" id="HPg-ft-VEj"/>
+                                                            <constraint firstItem="2wg-l8-Thi" firstAttribute="centerX" secondItem="jIN-Yy-3GU" secondAttribute="centerX" id="KoA-A3-Ygf"/>
+                                                            <constraint firstItem="Vhb-gI-4I7" firstAttribute="bottom" secondItem="HOD-9J-wQK" secondAttribute="top" constant="-20" id="NVj-fY-b6d"/>
+                                                            <constraint firstAttribute="trailing" secondItem="HOD-9J-wQK" secondAttribute="trailing" constant="10" id="can-PT-Neg"/>
+                                                            <constraint firstAttribute="bottom" secondItem="HOD-9J-wQK" secondAttribute="bottom" constant="10" id="dsJ-0z-vOa"/>
+                                                            <constraint firstItem="Vhb-gI-4I7" firstAttribute="width" secondItem="jIN-Yy-3GU" secondAttribute="width" constant="-20" id="geF-9Y-pxJ"/>
+                                                            <constraint firstItem="Jcy-kv-ggg" firstAttribute="leading" secondItem="jIN-Yy-3GU" secondAttribute="leading" constant="10" id="grR-FP-FE3"/>
+                                                            <constraint firstItem="Vhb-gI-4I7" firstAttribute="centerX" secondItem="jIN-Yy-3GU" secondAttribute="centerX" id="hDr-cv-Tma"/>
+                                                            <constraint firstItem="HOD-9J-wQK" firstAttribute="width" secondItem="jIN-Yy-3GU" secondAttribute="width" multiplier="0.5" constant="-20" id="pQ0-vJ-Uv1"/>
+                                                            <constraint firstItem="Jcy-kv-ggg" firstAttribute="width" secondItem="jIN-Yy-3GU" secondAttribute="width" multiplier="0.5" constant="-20" id="rnQ-m4-XQ0"/>
+                                                            <constraint firstItem="2wg-l8-Thi" firstAttribute="height" secondItem="jIN-Yy-3GU" secondAttribute="height" multiplier="0.75" id="vhz-lJ-2fm"/>
+                                                            <constraint firstItem="2wg-l8-Thi" firstAttribute="width" secondItem="jIN-Yy-3GU" secondAttribute="width" constant="-20" id="wQB-Hs-vSs"/>
+                                                        </constraints>
+                                                        <edgeInsets key="layoutMargins" top="8" left="8" bottom="8" right="8"/>
+                                                        <userDefinedRuntimeAttributes>
+                                                            <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
+                                                                <color key="value" red="0.42745098040000001" green="0.41176470590000003" blue="0.56470588239999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                                            </userDefinedRuntimeAttribute>
+                                                            <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                                                                <real key="value" value="1"/>
+                                                            </userDefinedRuntimeAttribute>
+                                                            <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
+                                                                <real key="value" value="3"/>
+                                                            </userDefinedRuntimeAttribute>
+                                                        </userDefinedRuntimeAttributes>
+                                                    </view>
+                                                </subviews>
+                                                <color key="backgroundColor" red="0.59607843140000005" green="0.7843137255" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+                                                <edgeInsets key="layoutMargins" top="8" left="8" bottom="8" right="8"/>
+                                            </stackView>
+                                        </subviews>
+                                        <color key="backgroundColor" red="0.59607843140000005" green="0.7843137255" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+                                        <constraints>
+                                            <constraint firstAttribute="bottom" secondItem="78P-mw-WXM" secondAttribute="bottom" constant="10" id="JdO-O4-mee"/>
+                                            <constraint firstItem="78P-mw-WXM" firstAttribute="width" secondItem="bqh-wV-GNf" secondAttribute="width" id="PpI-M2-bDk"/>
+                                            <constraint firstItem="78P-mw-WXM" firstAttribute="centerX" secondItem="bqh-wV-GNf" secondAttribute="centerX" id="bEw-TV-GOh"/>
+                                            <constraint firstItem="78P-mw-WXM" firstAttribute="top" secondItem="esM-2C-p2i" secondAttribute="bottom" id="muK-Pd-v3M"/>
+                                            <constraint firstItem="esM-2C-p2i" firstAttribute="width" secondItem="bqh-wV-GNf" secondAttribute="width" id="vEo-Fa-qdK"/>
+                                            <constraint firstItem="esM-2C-p2i" firstAttribute="centerX" secondItem="bqh-wV-GNf" secondAttribute="centerX" id="zPh-03-gDc"/>
+                                        </constraints>
+                                        <edgeInsets key="layoutMargins" top="10" left="10" bottom="10" right="10"/>
+                                        <userDefinedRuntimeAttributes>
+                                            <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
+                                                <color key="value" red="0.0" green="0.0" blue="0.066666666669999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                            </userDefinedRuntimeAttribute>
+                                            <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                                                <real key="value" value="1"/>
+                                            </userDefinedRuntimeAttribute>
+                                            <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
+                                                <real key="value" value="8"/>
+                                            </userDefinedRuntimeAttribute>
+                                        </userDefinedRuntimeAttributes>
+                                    </view>
+                                </subviews>
+                                <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                                <constraints>
+                                    <constraint firstItem="bqh-wV-GNf" firstAttribute="width" secondItem="dh0-OE-3US" secondAttribute="width" constant="-20" id="8a3-am-7Ch"/>
+                                    <constraint firstItem="bqh-wV-GNf" firstAttribute="height" secondItem="dh0-OE-3US" secondAttribute="height" constant="-20" id="Tgd-YQ-aEQ"/>
+                                    <constraint firstItem="bqh-wV-GNf" firstAttribute="centerY" secondItem="dh0-OE-3US" secondAttribute="centerY" id="U2v-3X-Ub1"/>
+                                    <constraint firstItem="bqh-wV-GNf" firstAttribute="centerX" secondItem="dh0-OE-3US" secondAttribute="centerX" id="eI3-vW-bvZ"/>
+                                </constraints>
+                                <userDefinedRuntimeAttributes>
+                                    <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
+                                        <color key="value" red="0.70980392160000005" green="0.82745098039999998" blue="0.8980392157" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                    </userDefinedRuntimeAttribute>
+                                </userDefinedRuntimeAttributes>
+                            </view>
+                        </subviews>
+                        <color key="backgroundColor" red="0.0" green="0.47058823529999999" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                        <constraints>
+                            <constraint firstItem="XUY-te-9PN" firstAttribute="width" secondItem="zXb-Ja-8dX" secondAttribute="width" id="1gg-3z-VTT"/>
+                            <constraint firstItem="XUY-te-9PN" firstAttribute="top" secondItem="iD5-7d-BcL" secondAttribute="bottom" id="6xm-50-tbJ"/>
+                            <constraint firstItem="dh0-OE-3US" firstAttribute="top" secondItem="XUY-te-9PN" secondAttribute="bottom" id="Cwk-RG-Bdj"/>
+                            <constraint firstItem="dh0-OE-3US" firstAttribute="centerX" secondItem="zXb-Ja-8dX" secondAttribute="centerX" id="FEt-9c-pvb"/>
+                            <constraint firstItem="XUY-te-9PN" firstAttribute="centerX" secondItem="zXb-Ja-8dX" secondAttribute="centerX" id="vfQ-Yn-21i"/>
+                            <constraint firstItem="UVa-jE-Gqw" firstAttribute="top" secondItem="dh0-OE-3US" secondAttribute="bottom" id="w47-kr-EXB"/>
+                        </constraints>
+                    </view>
+                    <connections>
+                        <outlet property="barButton" destination="4tx-eL-rur" id="fAC-j7-Kuv"/>
+                        <outlet property="barTitle" destination="ifO-mU-TPV" id="Yba-nJ-MyQ"/>
+                        <outlet property="btNext" destination="HOD-9J-wQK" id="mc4-j1-seA"/>
+                        <outlet property="btPrev" destination="Jcy-kv-ggg" id="L1Q-2X-H43"/>
+                        <outlet property="photoDate" destination="Vhb-gI-4I7" id="pyP-a1-Iz7"/>
+                        <outlet property="photoImage" destination="2wg-l8-Thi" id="xgu-JA-6Zs"/>
+                        <outlet property="photoTitle" destination="esM-2C-p2i" id="ev5-QE-lS6"/>
+                    </connections>
+                </viewController>
+                <placeholder placeholderIdentifier="IBFirstResponder" id="jtA-t8-aan" userLabel="First Responder" sceneMemberID="firstResponder"/>
+            </objects>
+        </scene>
     </scenes>
     </scenes>
     <resources>
     <resources>
         <image name="GM" width="120" height="120"/>
         <image name="GM" width="120" height="120"/>

+ 1 - 0
app/HomeView.swift

@@ -347,6 +347,7 @@ class HomeView: UIView {
 				
 				
 				image = r.value(forKey: "file")! as! String
 				image = r.value(forKey: "file")! as! String
 				row.setImage(idx: i, filename: image)
 				row.setImage(idx: i, filename: image)
+				NSLog(":HOME:DEBUG: Photo \(i)")
 				
 				
 				//TODO Set click listener
 				//TODO Set click listener
 				i = i + 1
 				i = i + 1

+ 172 - 0
app/PhotoViewController.swift

@@ -0,0 +1,172 @@
+// Copyright (C) 2016 Inigo Valentin
+//
+// This file is part of the Gasteizko Margolariak IOS app.
+//
+// The Gasteizko Margolariak IOS app is free software: you can
+// redistribute it and/or modify it under the terms of the
+// GNU General Public License as published by the Free Software
+// Foundation, either version 3 of the License, or (at your
+// option) any later version.
+//
+// The Gasteizko Margolariak IOS app is distributed in the
+// hope that it will be useful, but WITHOUT ANY WARRANTY;
+// without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
+// Public License for more details.
+//
+// You should have received a copy of the GNU General Public
+// License along with the Gasteizko Margolariak IOS app.
+// If not, see <http://www.gnu.org/licenses/>.
+
+import UIKit
+import CoreData
+
+/**
+The view controller of the app.
+*/
+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 barTitle: UILabel!
+	@IBOutlet weak var photoTitle: UILabel!
+	@IBOutlet weak var photoImage: UIImageView!
+	@IBOutlet weak var photoDate: UILabel!
+	@IBOutlet weak var btPrev: UIButton!
+	@IBOutlet weak var btNext: UIButton!
+	
+	var albumId: Int = -1
+	var photoId: Int = -1
+	var photoIds: [Int] = []
+	var passPhotoId: Int = -1
+	var passAlbumId: Int = -1
+	var delegate: AppDelegate?
+	
+	
+	/**
+	Gets the application context.
+	:return: The application context.
+	*/
+	func getContext () -> NSManagedObjectContext {
+		return NSManagedObjectContext(concurrencyType: .mainQueueConcurrencyType)
+	}
+	
+	
+	/**
+	Run when the app loads.
+	*/
+	override func viewDidLoad() {
+		NSLog(":PHOTOCONTROLLER:DEBUG: viewDidLoad")
+		
+		super.viewDidLoad()
+		self.loadPhoto(id: photoId)
+		
+		// TODO populate photo array
+		
+		// Set button action
+		// TODO barButton.addTarget(self, action: #selector(self.back), for: .touchUpInside)
+	}
+	
+	
+	/**
+	Dismisses the controller.
+	*/
+	func back() {
+		NSLog(":PHOTOCONTROLLER:DEBUG: Back")
+		self.dismiss(animated: true, completion: nil)
+	}
+	
+	
+	/**
+	Dispose of any resources that can be recreated.
+	*/
+	override func didReceiveMemoryWarning() {
+		super.didReceiveMemoryWarning()
+	}
+	
+	
+	/**
+	Loads a photo in the viewer.
+	:param: id
+	*/
+	public func loadPhoto(id: Int){
+		
+		let context = NSManagedObjectContext(concurrencyType: .privateQueueConcurrencyType)
+		let appDelegate = UIApplication.shared.delegate as! AppDelegate
+		let lang : String = getLanguage()
+		context.persistentStoreCoordinator = appDelegate.persistentStoreCoordinator
+		let fetchRequest: NSFetchRequest<Photo> = Photo.fetchRequest()
+		fetchRequest.predicate = NSPredicate(format: "id = %i", id)
+		
+		do {
+			let searchResults = try context.fetch(fetchRequest)
+			
+			var sTitle: String
+			var sText: String
+			var image: String
+			
+			for r in searchResults as [NSManagedObject] {
+				
+				sTitle = r.value(forKey: "title_\(lang)")! as! String
+				// TODO photoTitle.text = "  \(sTitle.decode().stripHtml())"
+				// TODO date
+				
+				// TODO set photo
+				
+				/*
+				// Get main 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
+				do{
+					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)")
+				}*/
+				
+			}
+		} catch {
+			NSLog(":PHOTO:ERROR: Error setting up photo \(id): \(error)")
+		}
+	}
+	
+	
+	// TODO Buttons
+	
+	
+	/**
+	Gets the device language. The only recognized languages are Spanish, English and Basque.
+	If the device has another language, Spanish will be selected by default.
+	:return: Two-letter language code.
+	*/
+	func getLanguage() -> String{
+		let pre = NSLocale.preferredLanguages[0].subStr(start: 0, end: 1)
+		if(pre == "es" || pre == "en" || pre == "eu"){
+			return pre
+		}
+		else{
+			return "es"
+		}
+	}
+}
+

+ 34 - 6
app/RowAlbum.swift

@@ -34,6 +34,9 @@ Extension of UIView to be formatted as sections.
 	// Album ID
 	// Album ID
 	var id = -1
 	var id = -1
 	
 	
+	// Photo ids
+	var photoIds: [Int] = [-1, -1]
+	
 	// Array with the imageviews
 	// Array with the imageviews
 	var preview: [UIImageView] = []
 	var preview: [UIImageView] = []
 
 
@@ -95,29 +98,54 @@ Extension of UIView to be formatted as sections.
 		super.init(frame: frame)
 		super.init(frame: frame)
 	}
 	}
 	
 	
-	func openPhoto(_ sender:UITapGestureRecognizer? = nil){
-		NSLog(":ROWALBUM:DEBUG: Getting delegate and showing photo.")
-		// TODO
-		//let delegate: AppDelegate = UIApplication.shared.delegate as! AppDelegate
-		//delegate.controller?.showAlbum(id: self.id)
+	func openLeftPhoto(_ sender:UITapGestureRecognizer? = nil){
+		NSLog(":ROWALBUM:DEBUG: Getting delegate and showing left photo.")
+		let delegate: AppDelegate = UIApplication.shared.delegate as! AppDelegate
+		delegate.controller?.showPhoto(album: self.id, photo: self.photoIds[0])
+	}
+	
+	func openRightPhoto(_ sender:UITapGestureRecognizer? = nil){
+		NSLog(":ROWALBUM:DEBUG: Getting delegate and showing right photo.")
+		let delegate: AppDelegate = UIApplication.shared.delegate as! AppDelegate
+		delegate.controller?.showPhoto(album: self.id, photo: self.photoIds[1])
 	}
 	}
 	
 	
 	
 	
 	/**
 	/**
 	Changes the preview image of the photos.
 	Changes the preview image of the photos.
 	If null or empty, the igage is hidden.
 	If null or empty, the igage is hidden.
+	It also sets the tap listener to show the photo.
 	:param: idx Id of the image in the row. 0 for left, 1 for right.
 	:param: idx Id of the image in the row. 0 for left, 1 for right.
 	:param: filename Filename of the image.
 	:param: filename Filename of the image.
 	*/
 	*/
 	func setImage(idx: Int, filename: String){
 	func setImage(idx: Int, filename: String){
 		if (filename == ""){
 		if (filename == ""){
 			self.preview[idx].isHidden = true
 			self.preview[idx].isHidden = true
-			//TODO hide the imageview
 		}
 		}
 		else{
 		else{
 			let path = "img/galeria/thumb/\(filename)"
 			let path = "img/galeria/thumb/\(filename)"
 			self.preview[idx].setImage(localPath: path, remotePath: "https://margolariak.com/\(path)")
 			self.preview[idx].setImage(localPath: path, remotePath: "https://margolariak.com/\(path)")
+			// Set tap listener
+			if idx == 0 {
+				let tapRecognizer = UITapGestureRecognizer(target: self, action: #selector (RowAlbum.openLeftPhoto(_:)))
+				tapRecognizer.delegate = (UIApplication.shared.delegate as! AppDelegate).controller
+				self.preview[idx].isUserInteractionEnabled = true
+				NSLog(":ROWALBUM:DEBUG: Setting tap recognizer for left photo.")
+				self.preview[idx].addGestureRecognizer(tapRecognizer)
+			}
+			else{
+				let tapRecognizer = UITapGestureRecognizer(target: self, action: #selector (RowAlbum.openRightPhoto(_:)))
+				tapRecognizer.delegate = (UIApplication.shared.delegate as! AppDelegate).controller
+				self.preview[idx].isUserInteractionEnabled = true
+				NSLog(":ROWALBUM:DEBUG: Setting tap recognizer for right photo.")
+				self.preview[idx].addGestureRecognizer(tapRecognizer)
+			}
 		}
 		}
 	}
 	}
 	
 	
+	func setIds(left: Int, right: Int){
+		self.photoIds[0] = left
+		self.photoIds[1] = right
+	}
+	
 }
 }

+ 20 - 1
app/ViewController.swift

@@ -45,6 +45,7 @@ class ViewController: UIViewController, UICollectionViewDataSource, UICollection
 	
 	
 	// Passed id to perform segues.
 	// Passed id to perform segues.
 	var passId: Int = -1
 	var passId: Int = -1
+	var passAlbum: Int = -1
 	
 	
 	// Location-related variables.
 	// Location-related variables.
 	var locationManager = CLLocationManager()
 	var locationManager = CLLocationManager()
@@ -125,6 +126,20 @@ class ViewController: UIViewController, UICollectionViewDataSource, UICollection
 	}
 	}
 	
 	
 	
 	
+	// TODO: This must go in it AlbumViewController
+	/**
+	Shows a photo.
+	:param: id The album id.
+	*/
+	func showPhoto(album: Int, photo: Int){
+		NSLog(":CONTROLLER:DEBUG: Showing photo \(photo) of album \(album)")
+		self.passAlbum = album
+		self.passId = photo
+		performSegue(withIdentifier: "SeguePhoto", sender: nil)
+		NSLog(":CONTROLLER:DEBUG: PHOTO should be shown")
+	}
+	
+	
 	/**
 	/**
 	Shows a schedule.
 	Shows a schedule.
 	:param: margolari True for the margolari schedule, false for the city one.
 	:param: margolari True for the margolari schedule, false for the city one.
@@ -141,7 +156,7 @@ class ViewController: UIViewController, UICollectionViewDataSource, UICollection
 	}
 	}
 	
 	
 	
 	
-	/**
+	/** m
 	Handles the initial sync process.
 	Handles the initial sync process.
 	It can start it, showing the sync screen, or finish it, hidding the screen.
 	It can start it, showing the sync screen, or finish it, hidding the screen.
 	:param: showScreen True to start the sync, false to end it.
 	:param: showScreen True to start the sync, false to end it.
@@ -174,6 +189,10 @@ class ViewController: UIViewController, UICollectionViewDataSource, UICollection
 		if segue.identifier == "SegueAlbum"{
 		if segue.identifier == "SegueAlbum"{
 			(segue.destination as! AlbumViewController).id = passId
 			(segue.destination as! AlbumViewController).id = passId
 		}
 		}
+		if segue.identifier == "SeguePhoto"{
+			(segue.destination as! PhotoViewController).photoId = passId
+			(segue.destination as! PhotoViewController).albumId = passAlbum
+		}
 		if segue.identifier == "SegueSchedule"{
 		if segue.identifier == "SegueSchedule"{
 			if passId == 1{
 			if passId == 1{
 				(segue.destination as! ScheduleViewController).margolari = true
 				(segue.destination as! ScheduleViewController).margolari = true