diff options
author | VladiMihaylenko <vxmihaylenko@gmail.com> | 2017-10-17 18:04:25 +0300 |
---|---|---|
committer | r.kuznetsov <r.kuznetsov@corp.mail.ru> | 2017-11-09 10:46:44 +0300 |
commit | 8d904e9ffa026c30a570fc4207a2615c9174e912 (patch) | |
tree | 4ac113a14999215051b4a569b567d54ac23b9750 /iphone/Maps/UI/PlacePage/PlacePageLayout/Content/UGC | |
parent | c29b1deb6551e5e08d840b72dbd43601d1428ced (diff) |
[ios] Compressed empty reviews
Diffstat (limited to 'iphone/Maps/UI/PlacePage/PlacePageLayout/Content/UGC')
5 files changed, 10 insertions, 12 deletions
diff --git a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/UGC/UGCReview.swift b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/UGC/UGCReview.swift index bb11c9e958..f0bf756d2e 100644 --- a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/UGC/UGCReview.swift +++ b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/UGC/UGCReview.swift @@ -1,11 +1,11 @@ @objc(MWMUGCReview) final class UGCReview: NSObject, MWMReviewProtocol { let title: String - let date: Date + let date: String let text: String let rating: UGCRatingValueType - @objc init(title: String, date: Date, text: String, rating: UGCRatingValueType) { + @objc init(title: String, date: String, text: String, rating: UGCRatingValueType) { self.title = title self.date = date self.text = text diff --git a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/UGC/UGCReviewCell.swift b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/UGC/UGCReviewCell.swift index cc95f4cddb..5209343f81 100644 --- a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/UGC/UGCReviewCell.swift +++ b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/UGC/UGCReviewCell.swift @@ -37,10 +37,7 @@ final class UGCReviewCell: MWMTableViewCell { @objc func config(review: UGCReview, onUpdate: @escaping () -> Void) { titleLabel.text = review.title - let dateFormatter = DateFormatter() - dateFormatter.dateStyle = .medium - dateFormatter.timeStyle = .none - dateLabel.text = dateFormatter.string(from: review.date) + dateLabel.text = review.date reviewLabel.text = review.text reviewLabel.onUpdate = onUpdate ratingView.value = review.rating.value diff --git a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/UGC/UGCYourReview.swift b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/UGC/UGCYourReview.swift index 9391193ae0..3c3b2f5ec4 100644 --- a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/UGC/UGCYourReview.swift +++ b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/UGC/UGCYourReview.swift @@ -1,10 +1,10 @@ @objc(MWMUGCYourReview) final class UGCYourReview: NSObject, MWMReviewProtocol { - let date: Date + let date: String let text: String let ratings: [UGCRatingStars] - @objc init(date: Date, text: String, ratings: [UGCRatingStars]) { + @objc init(date: String, text: String, ratings: [UGCRatingStars]) { self.date = date self.text = text self.ratings = ratings diff --git a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/UGC/UGCYourReviewCell.swift b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/UGC/UGCYourReviewCell.swift index fe7583950a..4f23f6ac72 100644 --- a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/UGC/UGCYourReviewCell.swift +++ b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/UGC/UGCYourReviewCell.swift @@ -1,6 +1,7 @@ @objc(MWMUGCYourReviewCell) final class UGCYourReviewCell: MWMTableViewCell { private enum Config { + static let defaultReviewBottomOffset: CGFloat = 16 static let minimumInteritemSpacing: CGFloat = 16 static let minItemsPerRow: CGFloat = 3 static let estimatedItemSize = CGSize(width: 96, height: 32) @@ -30,6 +31,7 @@ final class UGCYourReviewCell: MWMTableViewCell { } } + @IBOutlet private weak var reviewBottomOffset: NSLayoutConstraint! @IBOutlet private weak var ratingCollectionViewHeight: NSLayoutConstraint! @IBOutlet private weak var ratingCollectionView: UICollectionView! { didSet { @@ -50,12 +52,10 @@ final class UGCYourReviewCell: MWMTableViewCell { } @objc func config(yourReview: UGCYourReview, onUpdate: @escaping () -> Void) { - let dateFormatter = DateFormatter() - dateFormatter.dateStyle = .medium - dateFormatter.timeStyle = .none - dateLabel.text = dateFormatter.string(from: yourReview.date) + dateLabel.text = yourReview.date self.yourReview = yourReview reviewLabel.text = yourReview.text + reviewBottomOffset.constant = yourReview.text.isEmpty ? 0 : Config.defaultReviewBottomOffset reviewLabel.onUpdate = onUpdate updateCollectionView { [weak self] in self?.ratingCollectionView.reloadSections(IndexSet(integer: 0)) diff --git a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/UGC/UGCYourReviewCell.xib b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/UGC/UGCYourReviewCell.xib index 5ea2a7cb5b..50e78095d7 100644 --- a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/UGC/UGCYourReviewCell.xib +++ b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/UGC/UGCYourReviewCell.xib @@ -111,6 +111,7 @@ <outlet property="dateLabel" destination="qZ5-I9-7dJ" id="Hkf-h6-ybf"/> <outlet property="ratingCollectionView" destination="w6j-GC-6Bv" id="SbY-HY-zXO"/> <outlet property="ratingCollectionViewHeight" destination="2hn-mr-UAw" id="xbR-Dl-OR3"/> + <outlet property="reviewBottomOffset" destination="NW0-Eu-IsI" id="emL-VB-8lD"/> <outlet property="reviewLabel" destination="G4x-pj-fmv" id="pWq-RG-xv0"/> <outlet property="titleLabel" destination="nht-6C-S3i" id="1lQ-nA-n7z"/> </connections> |