diff --git a/Eglaf.xcodeproj/project.pbxproj b/Eglaf.xcodeproj/project.pbxproj index ae352335e56c8415593acb46ccf75c0831edb2da..32eb90ef72f957e63e9ff8edbd037844ba57d75c 100644 --- a/Eglaf.xcodeproj/project.pbxproj +++ b/Eglaf.xcodeproj/project.pbxproj @@ -19,6 +19,10 @@ C501951C209112F000F81D9B /* ProfileViewController.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C501951B209112F000F81D9B /* ProfileViewController.storyboard */; }; C501951E2091130C00F81D9B /* QRViewController.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C501951D2091130C00F81D9B /* QRViewController.storyboard */; }; C556C3E420911857002E582C /* StoryboardInit.swift in Sources */ = {isa = PBXBuildFile; fileRef = C556C3E320911857002E582C /* StoryboardInit.swift */; }; + C556C3E620912165002E582C /* IssuesViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C556C3E520912165002E582C /* IssuesViewModel.swift */; }; + C556C3E920912221002E582C /* Issue.swift in Sources */ = {isa = PBXBuildFile; fileRef = C556C3E820912221002E582C /* Issue.swift */; }; + C556C3EC209124BF002E582C /* SF-Pro-Display-Bold.otf in Resources */ = {isa = PBXBuildFile; fileRef = C556C3EA20912479002E582C /* SF-Pro-Display-Bold.otf */; }; + C556C3ED209124BF002E582C /* SF-Pro-Display-Regular.otf in Resources */ = {isa = PBXBuildFile; fileRef = C556C3EB20912489002E582C /* SF-Pro-Display-Regular.otf */; }; C5C26C952085240A006448EF /* DBProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5C26C942085240A006448EF /* DBProvider.swift */; }; C5C26C982085244F006448EF /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5C26C972085244F006448EF /* Constants.swift */; }; C5C26C9A20852502006448EF /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = C5C26C9920852502006448EF /* GoogleService-Info.plist */; }; @@ -48,6 +52,10 @@ C501951B209112F000F81D9B /* ProfileViewController.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = ProfileViewController.storyboard; sourceTree = "<group>"; }; C501951D2091130C00F81D9B /* QRViewController.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = QRViewController.storyboard; sourceTree = "<group>"; }; C556C3E320911857002E582C /* StoryboardInit.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StoryboardInit.swift; sourceTree = "<group>"; }; + C556C3E520912165002E582C /* IssuesViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IssuesViewModel.swift; sourceTree = "<group>"; }; + C556C3E820912221002E582C /* Issue.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Issue.swift; sourceTree = "<group>"; }; + C556C3EA20912479002E582C /* SF-Pro-Display-Bold.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "SF-Pro-Display-Bold.otf"; sourceTree = "<group>"; }; + C556C3EB20912489002E582C /* SF-Pro-Display-Regular.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "SF-Pro-Display-Regular.otf"; sourceTree = "<group>"; }; C5C26C942085240A006448EF /* DBProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DBProvider.swift; sourceTree = "<group>"; }; C5C26C972085244F006448EF /* Constants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Constants.swift; sourceTree = "<group>"; }; C5C26C9920852502006448EF /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = "<group>"; }; @@ -133,6 +141,14 @@ path = Extension; sourceTree = "<group>"; }; + C556C3E72091220E002E582C /* ViewModel */ = { + isa = PBXGroup; + children = ( + C556C3E520912165002E582C /* IssuesViewModel.swift */, + ); + path = ViewModel; + sourceTree = "<group>"; + }; C5C26C8F2085231F006448EF /* Storyboards */ = { isa = PBXGroup; children = ( @@ -160,6 +176,7 @@ C5C26C912085233A006448EF /* Model */ = { isa = PBXGroup; children = ( + C556C3E820912221002E582C /* Issue.swift */, ); path = Model; sourceTree = "<group>"; @@ -220,6 +237,7 @@ C5DBF2E52058834300FFA015 /* Eglaf */ = { isa = PBXGroup; children = ( + C556C3E72091220E002E582C /* ViewModel */, C556C3E220911833002E582C /* Extension */, C5C26C962085243E006448EF /* Constants */, C5C26C9220852340006448EF /* Networking */, @@ -231,6 +249,8 @@ C5DBF2EF2058834300FFA015 /* LaunchScreen.storyboard */, C5DBF2F22058834300FFA015 /* Info.plist */, C5C26C9920852502006448EF /* GoogleService-Info.plist */, + C556C3EA20912479002E582C /* SF-Pro-Display-Bold.otf */, + C556C3EB20912489002E582C /* SF-Pro-Display-Regular.otf */, ); path = Eglaf; sourceTree = "<group>"; @@ -296,6 +316,8 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + C556C3EC209124BF002E582C /* SF-Pro-Display-Bold.otf in Resources */, + C556C3ED209124BF002E582C /* SF-Pro-Display-Regular.otf in Resources */, C5DBF2F12058834300FFA015 /* LaunchScreen.storyboard in Resources */, C501951E2091130C00F81D9B /* QRViewController.storyboard in Resources */, C50195142091124900F81D9B /* IssuesViewController.storyboard in Resources */, @@ -375,6 +397,7 @@ C5C26C9F20852562006448EF /* IssueHandler.swift in Sources */, C5C26CA1208525B3006448EF /* EventHandler.swift in Sources */, C501950F2091119A00F81D9B /* TapBarViewController.swift in Sources */, + C556C3E920912221002E582C /* Issue.swift in Sources */, C556C3E420911857002E582C /* StoryboardInit.swift in Sources */, C50195172091127B00F81D9B /* ProfileViewController.swift in Sources */, C5C26C952085240A006448EF /* DBProvider.swift in Sources */, @@ -382,6 +405,7 @@ C5DBF2E72058834300FFA015 /* AppDelegate.swift in Sources */, C501951A209112C500F81D9B /* QRViewController.swift in Sources */, C50195122091121700F81D9B /* IssuesViewController.swift in Sources */, + C556C3E620912165002E582C /* IssuesViewModel.swift in Sources */, C5C26C982085244F006448EF /* Constants.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/Eglaf/Assets.xcassets/Close.imageset/Close@1x.pdf b/Eglaf/Assets.xcassets/Close.imageset/Close@1x.pdf new file mode 100644 index 0000000000000000000000000000000000000000..a732fcc18c65d711ae7aff8daaf501c61679a178 Binary files /dev/null and b/Eglaf/Assets.xcassets/Close.imageset/Close@1x.pdf differ diff --git a/Eglaf/Assets.xcassets/Close.imageset/Contents.json b/Eglaf/Assets.xcassets/Close.imageset/Contents.json new file mode 100644 index 0000000000000000000000000000000000000000..b746982795f5d34c82dba678bac8efe7a778dae1 --- /dev/null +++ b/Eglaf/Assets.xcassets/Close.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "Close@1x.pdf", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Eglaf/Assets.xcassets/add.imageset/Contents.json b/Eglaf/Assets.xcassets/add.imageset/Contents.json new file mode 100644 index 0000000000000000000000000000000000000000..b3c659b76337697e8528c9bba0f9b9a7d8843b81 --- /dev/null +++ b/Eglaf/Assets.xcassets/add.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "add@1x.pdf", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Eglaf/Assets.xcassets/add.imageset/add@1x.pdf b/Eglaf/Assets.xcassets/add.imageset/add@1x.pdf new file mode 100644 index 0000000000000000000000000000000000000000..ffbfcdd67ff14b0c308f3e105a948f45b641e395 Binary files /dev/null and b/Eglaf/Assets.xcassets/add.imageset/add@1x.pdf differ diff --git a/Eglaf/Assets.xcassets/guy.imageset/Contents.json b/Eglaf/Assets.xcassets/guy.imageset/Contents.json new file mode 100644 index 0000000000000000000000000000000000000000..a348674c715e0cdbd62125fbdc3c0d4678e03b86 --- /dev/null +++ b/Eglaf/Assets.xcassets/guy.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "guy.jpg", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Eglaf/Assets.xcassets/guy.imageset/guy.jpg b/Eglaf/Assets.xcassets/guy.imageset/guy.jpg new file mode 100644 index 0000000000000000000000000000000000000000..693bd42fe807127177217c42a4d62a4cb520fd9c Binary files /dev/null and b/Eglaf/Assets.xcassets/guy.imageset/guy.jpg differ diff --git a/Eglaf/Controllers/Issues/IssueTableViewCell.swift b/Eglaf/Controllers/Issues/IssueTableViewCell.swift index 33e79f274ca5971b2a7044653d491be2ed49aacb..55f17a73f72f4fd7f055a3094f06d2a79a2b0084 100644 --- a/Eglaf/Controllers/Issues/IssueTableViewCell.swift +++ b/Eglaf/Controllers/Issues/IssueTableViewCell.swift @@ -9,16 +9,29 @@ import UIKit class IssueTableViewCell: UITableViewCell { - + + @IBOutlet weak var profileImageView: UIImageView! + @IBOutlet weak var nameLabel: UILabel! + @IBOutlet weak var issueTextLabel: UILabel! + @IBOutlet weak var timeLabel: UILabel! + @IBOutlet weak var tagView: UIView! + @IBOutlet weak var categoryLabel: UILabel! + + override func awakeFromNib() { super.awakeFromNib() - // Initialization code + self.tagView.layer.borderWidth = 1 + self.tagView.layer.borderColor = UIColor(red:0.27, green:0.71, blue:0.77, alpha:1).cgColor + self.tagView.layer.cornerRadius = 4 + self.profileImageView.layer.cornerRadius = self.profileImageView.frame.size.width / 2 + self.profileImageView.clipsToBounds = true } - + override func setSelected(_ selected: Bool, animated: Bool) { super.setSelected(selected, animated: animated) - + // Configure the view for the selected state } } + diff --git a/Eglaf/Controllers/Issues/IssueTableViewCell.xib b/Eglaf/Controllers/Issues/IssueTableViewCell.xib index d23e92f7413f2acf62ad557901820b470565c31d..92b3a2757cdbc828038f2f2dcbadb6b50cf010a6 100644 --- a/Eglaf/Controllers/Issues/IssueTableViewCell.xib +++ b/Eglaf/Controllers/Issues/IssueTableViewCell.xib @@ -1,21 +1,119 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="13142" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> +<?xml version="1.0" encoding="UTF-8"?> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="13771" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> + <device id="retina4_7" orientation="portrait"> + <adaptation id="fullscreen"/> + </device> <dependencies> - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12042"/> + <deployment identifier="iOS"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13772"/> <capability name="Safe area layout guides" minToolsVersion="9.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> </dependencies> + <customFonts key="customFonts"> + <array key="SF-Pro-Display-Bold.otf"> + <string>SFProDisplay-Bold</string> + </array> + <array key="SF-Pro-Display-Regular.otf"> + <string>SFProDisplay-Regular</string> + </array> + </customFonts> <objects> <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/> <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> - <tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="KGk-i7-Jjw" customClass="IssueTableViewCell" customModuleProvider="target"> - <rect key="frame" x="0.0" y="0.0" width="320" height="44"/> + <tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="IssueTableViewCell" rowHeight="110" id="VGb-V0-UpH" customClass="IssueTableViewCell" customModule="Eglaf" customModuleProvider="target"> + <rect key="frame" x="0.0" y="0.0" width="368" height="114"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> - <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM"> - <rect key="frame" x="0.0" y="0.0" width="320" height="43"/> + <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="VGb-V0-UpH" id="YXU-fr-J80"> + <rect key="frame" x="0.0" y="0.0" width="368" height="113.5"/> <autoresizingMask key="autoresizingMask"/> + <subviews> + <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="guy" translatesAutoresizingMaskIntoConstraints="NO" id="amR-pp-Lrx"> + <rect key="frame" x="16" y="16" width="50" height="50"/> + <constraints> + <constraint firstAttribute="height" constant="50" id="6fU-d9-ytX"/> + <constraint firstAttribute="width" constant="50" id="BK6-Sh-xjc"/> + </constraints> + </imageView> + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Jonathan Palmer" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="7dq-Xk-Csq"> + <rect key="frame" x="81" y="12" width="107.5" height="17"/> + <fontDescription key="fontDescription" name="SFProDisplay-Bold" family="SF Pro Display" pointSize="14"/> + <color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/> + <nil key="highlightedColor"/> + </label> + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="7Sw-Xw-QzN"> + <rect key="frame" x="81" y="34" width="272" height="42"/> + <constraints> + <constraint firstAttribute="height" constant="42" id="PaI-Nr-abm"/> + </constraints> + <string key="text">Have you ever finally just gave in to the temptation and read your horoscope in the newspaper on Sunday morning? Sure, we all have. For most of us, it’s a curiosity, an amusement to see what they say our day will be like based on the sign of the zodiac that we were born under. </string> + <fontDescription key="fontDescription" name="SFProDisplay-Regular" family="SF Pro Display" pointSize="13"/> + <color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/> + <nil key="highlightedColor"/> + </label> + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="10 minutes ago" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="bj3-gy-d7x"> + <rect key="frame" x="269" y="13" width="83" height="16"/> + <fontDescription key="fontDescription" name="SFProDisplay-Regular" family="SF Pro Display" pointSize="13"/> + <color key="textColor" red="0.31764705879999999" green="0.3411764706" blue="0.49803921569999998" alpha="1" colorSpace="calibratedRGB"/> + <nil key="highlightedColor"/> + </label> + <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="HEU-JE-tGY"> + <rect key="frame" x="81" y="81" width="98" height="20"/> + <subviews> + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="#CATERING" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="FnR-Ic-Fxy"> + <rect key="frame" x="0.0" y="0.0" width="98" height="20"/> + <fontDescription key="fontDescription" name="SFProDisplay-Regular" family="SF Pro Display" pointSize="10"/> + <color key="textColor" red="0.2666666667" green="0.71372549019999998" blue="0.76862745099999996" alpha="1" colorSpace="calibratedRGB"/> + <nil key="highlightedColor"/> + </label> + </subviews> + <constraints> + <constraint firstAttribute="trailing" secondItem="FnR-Ic-Fxy" secondAttribute="trailing" id="Ey2-nO-fWO"/> + <constraint firstAttribute="height" constant="20" id="T5h-y7-cZ3"/> + <constraint firstItem="FnR-Ic-Fxy" firstAttribute="top" secondItem="HEU-JE-tGY" secondAttribute="top" id="WLH-uW-KEr"/> + <constraint firstAttribute="width" constant="98" id="X9V-wu-eAf"/> + <constraint firstAttribute="bottom" secondItem="FnR-Ic-Fxy" secondAttribute="bottom" id="jf1-7u-4AT"/> + <constraint firstItem="FnR-Ic-Fxy" firstAttribute="leading" secondItem="HEU-JE-tGY" secondAttribute="leading" id="u3e-zP-2YP"/> + </constraints> + </view> + <view alpha="0.05000000074505806" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Mem-ct-LTV"> + <rect key="frame" x="0.0" y="113" width="368" height="1"/> + <color key="backgroundColor" red="0.34509803919999998" green="0.42745098040000001" blue="0.52156862749999999" alpha="1" colorSpace="calibratedRGB"/> + <constraints> + <constraint firstAttribute="height" constant="1" id="4n6-5W-qOB"/> + </constraints> + </view> + </subviews> + <color key="backgroundColor" red="0.0" green="0.1019607843" blue="0.2156862745" alpha="1" colorSpace="custom" customColorSpace="displayP3"/> + <constraints> + <constraint firstItem="amR-pp-Lrx" firstAttribute="top" secondItem="YXU-fr-J80" secondAttribute="top" constant="16" id="0ry-Oa-4lV"/> + <constraint firstItem="HEU-JE-tGY" firstAttribute="top" secondItem="7Sw-Xw-QzN" secondAttribute="bottom" constant="5" id="Bqj-28-SPq"/> + <constraint firstAttribute="trailing" secondItem="7Sw-Xw-QzN" secondAttribute="trailing" constant="15" id="Guw-j5-uYs"/> + <constraint firstAttribute="bottom" secondItem="Mem-ct-LTV" secondAttribute="bottom" id="IA2-1m-yyL"/> + <constraint firstItem="HEU-JE-tGY" firstAttribute="leading" secondItem="7Sw-Xw-QzN" secondAttribute="leading" id="IIw-rR-aW5"/> + <constraint firstItem="7Sw-Xw-QzN" firstAttribute="leading" secondItem="7dq-Xk-Csq" secondAttribute="leading" id="LKx-NK-KDQ"/> + <constraint firstAttribute="trailing" secondItem="Mem-ct-LTV" secondAttribute="trailing" id="M3J-aQ-InJ"/> + <constraint firstAttribute="trailing" secondItem="bj3-gy-d7x" secondAttribute="trailing" constant="16" id="eo5-Cz-g2Z"/> + <constraint firstItem="7dq-Xk-Csq" firstAttribute="top" secondItem="YXU-fr-J80" secondAttribute="top" constant="12" id="gGf-Jq-NrQ"/> + <constraint firstItem="7Sw-Xw-QzN" firstAttribute="top" secondItem="7dq-Xk-Csq" secondAttribute="bottom" constant="5" id="nwW-Fo-r2E"/> + <constraint firstItem="bj3-gy-d7x" firstAttribute="top" secondItem="YXU-fr-J80" secondAttribute="top" constant="13" id="qAU-zj-rQA"/> + <constraint firstItem="7dq-Xk-Csq" firstAttribute="leading" secondItem="amR-pp-Lrx" secondAttribute="trailing" constant="15" id="qVd-Ma-HPQ"/> + <constraint firstItem="amR-pp-Lrx" firstAttribute="leading" secondItem="YXU-fr-J80" secondAttribute="leading" constant="16" id="t9I-DZ-J9x"/> + <constraint firstItem="Mem-ct-LTV" firstAttribute="leading" secondItem="YXU-fr-J80" secondAttribute="leading" id="zUx-RR-QUY"/> + </constraints> </tableViewCellContentView> - <viewLayoutGuide key="safeArea" id="njF-e1-oar"/> + <viewLayoutGuide key="safeArea" id="bLa-8k-TQn"/> + <connections> + <outlet property="categoryLabel" destination="FnR-Ic-Fxy" id="70y-kH-oWY"/> + <outlet property="issueTextLabel" destination="7Sw-Xw-QzN" id="Zgz-a7-2gd"/> + <outlet property="nameLabel" destination="7dq-Xk-Csq" id="lOv-gG-M1Z"/> + <outlet property="profileImageView" destination="amR-pp-Lrx" id="bTe-3E-hkb"/> + <outlet property="tagView" destination="HEU-JE-tGY" id="gFN-t2-WDE"/> + <outlet property="timeLabel" destination="bj3-gy-d7x" id="HND-Ed-uKN"/> + </connections> + <point key="canvasLocation" x="-53" y="7"/> </tableViewCell> </objects> + <resources> + <image name="guy" width="600" height="600"/> + </resources> </document> diff --git a/Eglaf/Controllers/Issues/IssuesViewController.swift b/Eglaf/Controllers/Issues/IssuesViewController.swift index 362eb6734a30836c58af9bc3ee70e0b3b363818f..f79e1ad3a6e0b4aefde22781441077424396ba33 100644 --- a/Eglaf/Controllers/Issues/IssuesViewController.swift +++ b/Eglaf/Controllers/Issues/IssuesViewController.swift @@ -9,29 +9,93 @@ import UIKit class IssuesViewController: UIViewController, StoryboardInit { - + + //MARK: Outlets + @IBOutlet weak var tableView: UITableView! + + let viewModel = IssuesViewModel() + + + //MARK: Life Cycle override func viewDidLoad() { - super.viewDidLoad() - - self.view.backgroundColor = .blue +// issueHandler.observeIssues { (issuesFetched) in +// self.issues = [] +// for issue in issuesFetched { +// self.issues.append(issue) +// } +// self.tableView.reloadData() +// } - // Do any additional setup after loading the view. + prepareUI() + registerXibs() } + + override func viewWillAppear(_ animated: Bool) { + + + + } +} - override func didReceiveMemoryWarning() { - super.didReceiveMemoryWarning() - // Dispose of any resources that can be recreated. +//MARK: - HomeViewController (UI) + +extension IssuesViewController { + func prepareUI() { + tableView.delegate = self + tableView.dataSource = self + self.navigationController?.navigationBar.setBackgroundImage(UIImage(), for: UIBarMetrics.default) + self.navigationController?.navigationBar.isTranslucent = true + self.navigationController?.view.backgroundColor = UIColor.clear + self.navigationItem.title = "DASHBOARD" + self.navigationController?.navigationBar.titleTextAttributes = [ + NSAttributedStringKey.font: UIFont(name: "SFProDisplay-Regular", size: 14)!, + NSAttributedStringKey.foregroundColor: UIColor.white, + NSAttributedStringKey.kern: 4 + ] + self.navigationItem.rightBarButtonItem = UIBarButtonItem(image: #imageLiteral(resourceName: "add"), style: .plain, target: self, action: #selector(showReportScreen)) + self.navigationController?.navigationBar.tintColor = UIColor(red:0.35, green:0.43, blue:0.52, alpha:1) + self.navigationItem.leftBarButtonItem = UIBarButtonItem(title: "ALL", style: .plain, target: self, action: nil) + self.navigationItem.leftBarButtonItem?.setTitleTextAttributes([ + NSAttributedStringKey.font: UIFont(name: "SFProDisplay-Regular", size: 14)!, + NSAttributedStringKey.foregroundColor: UIColor(red:0.35, green:0.43, blue:0.52, alpha:1), + NSAttributedStringKey.kern: 2 + ], for: .normal) + } + + @objc func showReportScreen() { + let vc = ReportViewController.storyboardInit() + let navVC = UINavigationController(rootViewController: vc) + present(navVC, animated: true, completion: nil) } + func registerXibs() { + tableView.register(UINib(nibName: "IssueTableViewCell", bundle: nil), forCellReuseIdentifier: "IssueTableViewCell") + } +} - /* - // MARK: - Navigation +extension IssuesViewController: UITableViewDelegate { + func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { + return 114 + } +} - // In a storyboard-based application, you will often want to do a little preparation before navigation - override func prepare(for segue: UIStoryboardSegue, sender: Any?) { - // Get the new view controller using segue.destinationViewController. - // Pass the selected object to the new view controller. +extension IssuesViewController: UITableViewDataSource { + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + return self.viewModel.numberOfIssues() } - */ + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + guard let cell = tableView.dequeueReusableCell(withIdentifier: "IssueTableViewCell") as? IssueTableViewCell else { + return UITableViewCell() + } + + + guard let issue = self.viewModel.getIssue(index: indexPath.row) else { + return cell + } + + // TODO, connect issue to cell's componets + + return cell + } } diff --git a/Eglaf/Controllers/Report/ReportViewController.swift b/Eglaf/Controllers/Report/ReportViewController.swift index d3125a65b70fe94773a6e7ac935155d1696ca1cf..df05bef3b9928e9bdecc3b00d471babd49ad98eb 100644 --- a/Eglaf/Controllers/Report/ReportViewController.swift +++ b/Eglaf/Controllers/Report/ReportViewController.swift @@ -8,7 +8,7 @@ import UIKit -class ReportViewController: UIViewController { +class ReportViewController: UIViewController, StoryboardInit { override func viewDidLoad() { super.viewDidLoad() diff --git a/Eglaf/Model/Issue.swift b/Eglaf/Model/Issue.swift new file mode 100644 index 0000000000000000000000000000000000000000..b27f45b47fe48ca864c93ae38e06175b6c3cb374 --- /dev/null +++ b/Eglaf/Model/Issue.swift @@ -0,0 +1,88 @@ +// +// Issue.swift +// Eglaf +// +// Created by Adam Zvada on 25.04.18. +// Copyright © 2018 Adam Zvada. All rights reserved. +// + +import Foundation + + +class Issue { + + var issueId: String? + var creator: String? // USER_ID + var createdTime: String? + var description: String? + var category: String? + var urgent: Bool? + var resolved: Bool? + var solver: String? // USER_ID + var location: String? + + init(id: String, dictionary: [String : Any]) { + //super.init() + + // if let issueId = dictionary["issueId"] as? String { + // self.issueId = issueId + // } + + self.issueId = id + + if let creator = dictionary["creator"] as? String { + self.creator = creator + } + + if let createdTime = dictionary["created_time"] as? String { + self.createdTime = createdTime + } + + if let description = dictionary["description"] as? String { + self.description = description + } + + if let category = dictionary["category"] as? String { + self.category = category + } + + if let urgent = dictionary["urgent"] as? Bool { + self.urgent = urgent + } + + if let resolved = dictionary["resolved"] as? Bool { + self.resolved = resolved + } + + if let solver = dictionary["solver"] as? String { + self.solver = solver + } + + if let location = dictionary["location"] as? String { + self.location = location + } + } + + init(description: String, category: String, urgent: Bool, location: String) { + self.description = description + self.category = category + self.urgent = urgent + self.location = location + } + + func createDictionary() -> Dictionary<String, Any> { + let data: Dictionary<String, Any> = ["creator": self.creator ?? "user-hash1", + "created_time": self.createdTime ?? "", + "description" : self.description ?? "", + "category" : self.category ?? "", + "urgent" : self.urgent ?? false, + "resolved": self.resolved ?? false, + "solver" : self.solver ?? "", + "location" : self.location ?? "" + ] + return data + } + +} + + diff --git a/Eglaf/SF-Pro-Display-Bold.otf b/Eglaf/SF-Pro-Display-Bold.otf new file mode 100755 index 0000000000000000000000000000000000000000..025b25c27aae647e146418e2f8bc12260015382f Binary files /dev/null and b/Eglaf/SF-Pro-Display-Bold.otf differ diff --git a/Eglaf/SF-Pro-Display-Regular.otf b/Eglaf/SF-Pro-Display-Regular.otf new file mode 100755 index 0000000000000000000000000000000000000000..09aaca9fcc08ccfd0666b128a23a3ba6066757a5 Binary files /dev/null and b/Eglaf/SF-Pro-Display-Regular.otf differ diff --git a/Eglaf/Storyboards/IssuesViewController.storyboard b/Eglaf/Storyboards/IssuesViewController.storyboard index ffd80c2973729145b9ae09b47574e579a0d8bbfa..5f0944e9100395742a0979599f9cc9c76b1638ec 100644 --- a/Eglaf/Storyboards/IssuesViewController.storyboard +++ b/Eglaf/Storyboards/IssuesViewController.storyboard @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13771" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="69j-Es-xHw"> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13771" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="hnz-NF-IQv"> <device id="retina4_7" orientation="portrait"> <adaptation id="fullscreen"/> </device> @@ -11,19 +11,34 @@ </dependencies> <scenes> <!--IssuesViewController--> - <scene sceneID="bc8-Ih-N7v"> + <scene sceneID="qGd-KZ-fvi"> <objects> - <viewController storyboardIdentifier="IssuesViewController" title="IssuesViewController" useStoryboardIdentifierAsRestorationIdentifier="YES" id="69j-Es-xHw" customClass="IssuesViewController" customModule="Eglaf" customModuleProvider="target" sceneMemberID="viewController"> - <view key="view" contentMode="scaleToFill" id="8DF-CJ-Shh"> + <viewController storyboardIdentifier="IssuesViewController" title="IssuesViewController" useStoryboardIdentifierAsRestorationIdentifier="YES" id="hnz-NF-IQv" customClass="IssuesViewController" customModule="Eglaf" customModuleProvider="target" sceneMemberID="viewController"> + <view key="view" contentMode="scaleToFill" id="GNU-7P-fvt"> <rect key="frame" x="0.0" y="0.0" width="375" height="667"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> - <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> - <viewLayoutGuide key="safeArea" id="FTF-d8-9Uo"/> + <subviews> + <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="none" allowsSelection="NO" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="nPE-fM-MQn"> + <rect key="frame" x="0.0" y="20" width="375" height="647"/> + <color key="backgroundColor" red="0.0" green="0.1019607843" blue="0.2156862745" alpha="1" colorSpace="custom" customColorSpace="displayP3"/> + </tableView> + </subviews> + <color key="backgroundColor" red="0.0" green="0.1019607843" blue="0.2156862745" alpha="1" colorSpace="custom" customColorSpace="displayP3"/> + <constraints> + <constraint firstItem="nPE-fM-MQn" firstAttribute="leading" secondItem="esC-uL-Qh8" secondAttribute="leading" id="DpP-kl-rd1"/> + <constraint firstItem="esC-uL-Qh8" firstAttribute="trailing" secondItem="nPE-fM-MQn" secondAttribute="trailing" id="RUF-CS-qKM"/> + <constraint firstItem="nPE-fM-MQn" firstAttribute="top" secondItem="esC-uL-Qh8" secondAttribute="top" id="cFf-9Y-yWJ"/> + <constraint firstItem="esC-uL-Qh8" firstAttribute="bottom" secondItem="nPE-fM-MQn" secondAttribute="bottom" id="nRT-su-kjI"/> + </constraints> + <viewLayoutGuide key="safeArea" id="esC-uL-Qh8"/> </view> + <connections> + <outlet property="tableView" destination="nPE-fM-MQn" id="Jpq-my-EaQ"/> + </connections> </viewController> - <placeholder placeholderIdentifier="IBFirstResponder" id="y6q-wK-ute" userLabel="First Responder" sceneMemberID="firstResponder"/> + <placeholder placeholderIdentifier="IBFirstResponder" id="Utd-l4-rYj" userLabel="First Responder" sceneMemberID="firstResponder"/> </objects> - <point key="canvasLocation" x="-97" y="20"/> + <point key="canvasLocation" x="490" y="-266"/> </scene> </scenes> </document> diff --git a/Eglaf/ViewModel/IssuesViewModel.swift b/Eglaf/ViewModel/IssuesViewModel.swift new file mode 100644 index 0000000000000000000000000000000000000000..68138b336b3fff7f514a7f09eea95914540c8d97 --- /dev/null +++ b/Eglaf/ViewModel/IssuesViewModel.swift @@ -0,0 +1,35 @@ +// +// IssuesViewModel.swift +// Eglaf +// +// Created by Adam Zvada on 25.04.18. +// Copyright © 2018 Adam Zvada. All rights reserved. +// + +import Foundation + +class IssuesViewModel { + + var issues: [Issue] + + init() { + self.issues = [] + } + + public func numberOfIssues() -> Int { + //return self.issues.count + return 5 + } + + public func getIssue(index: Int) -> Issue? { + if issues.count < index || issues.count == 0 { + return nil + } + return issues[index] + } + + public func loadIssues(complition: (() -> Void)) { + // TODO, integrate with backend + complition() + } +}