diff options
author | VladiMihaylenko <vxmihaylenko@gmail.com> | 2017-10-16 16:15:59 +0300 |
---|---|---|
committer | Roman Kuznetsov <r.kuznetsow@gmail.com> | 2017-10-16 17:17:33 +0300 |
commit | 3271d0f5dd4f67268c85e77f111178a5d2915e98 (patch) | |
tree | adfcaff3cbeb0b75850563e259d9b414cfe39467 /iphone/Maps/UI/PlacePage/PlacePageLayout/Content/UGC | |
parent | 18874322a2f8c59ffcf0f127e91a32cd468d7f9c (diff) |
[ios] Uncommented dummy impl.
Diffstat (limited to 'iphone/Maps/UI/PlacePage/PlacePageLayout/Content/UGC')
5 files changed, 20 insertions, 17 deletions
diff --git a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/UGC/UGCAddReview/UGCAddReviewController.swift b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/UGC/UGCAddReview/UGCAddReviewController.swift index 5f6c96ce51..efbb78d5b7 100644 --- a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/UGC/UGCAddReview/UGCAddReviewController.swift +++ b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/UGC/UGCAddReview/UGCAddReviewController.swift @@ -2,6 +2,8 @@ final class UGCAddReviewController: MWMTableViewController { typealias Model = UGCReviewModel + weak var textCell: UGCAddReviewTextCell? + enum Sections { case ratings case text @@ -17,12 +19,9 @@ final class UGCAddReviewController: MWMTableViewController { private var model: Model! { didSet { sections = [] - if !model.ratings.isEmpty { - sections.append(.ratings) - } - if model.canAddTextToReview { - sections.append(.text) - } + assert(!model.ratings.isEmpty); + sections.append(.ratings) + sections.append(.text) } } @@ -49,6 +48,11 @@ final class UGCAddReviewController: MWMTableViewController { } @objc private func onDone() { + guard let text = textCell?.reviewText else { + assert(false); + return + } + model.text = text onSave(model) guard let nc = navigationController else { return } if MWMAuthorizationViewModel.isAuthenticated() { @@ -80,6 +84,7 @@ final class UGCAddReviewController: MWMTableViewController { case .text: let cell = tableView.dequeueReusableCell(withCellClass: UGCAddReviewTextCell.self, indexPath: indexPath) as! UGCAddReviewTextCell cell.reviewText = model.text + textCell = cell; return cell } } diff --git a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/UGC/UGCAddReview/UGCAddReviewController.xib b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/UGC/UGCAddReview/UGCAddReviewController.xib index 67e2e12e41..eb6bb07aea 100644 --- a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/UGC/UGCAddReview/UGCAddReviewController.xib +++ b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/UGC/UGCAddReview/UGCAddReviewController.xib @@ -1,11 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> -<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="12121" systemVersion="16G29" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES"> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="13196" 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="12089"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13173"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> </dependencies> <objects> @@ -15,7 +15,7 @@ </connections> </placeholder> <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> - <tableView opaque="NO" clipsSubviews="YES" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" bouncesZoom="NO" style="grouped" separatorStyle="none" allowsSelection="NO" rowHeight="44" sectionHeaderHeight="18" sectionFooterHeight="18" id="i5M-Pr-FkT"> + <tableView opaque="NO" clipsSubviews="YES" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" bouncesZoom="NO" keyboardDismissMode="interactive" style="grouped" separatorStyle="none" allowsSelection="NO" rowHeight="44" sectionHeaderHeight="18" sectionFooterHeight="18" id="i5M-Pr-FkT"> <rect key="frame" x="0.0" y="0.0" width="375" height="667"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/> diff --git a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/UGC/UGCAddReview/UGCReviewModel.swift b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/UGC/UGCAddReview/UGCReviewModel.swift index abc5aa0195..70a4473275 100644 --- a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/UGC/UGCAddReview/UGCReviewModel.swift +++ b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/UGC/UGCAddReview/UGCReviewModel.swift @@ -2,17 +2,14 @@ final class UGCReviewModel: NSObject { let reviewValue: MWMRatingSummaryViewValueType - let ratings: [UGCRatingStars] - - let canAddTextToReview: Bool + @objc let ratings: [UGCRatingStars] + @objc var text: String let title: String - let text: String - @objc init(reviewValue: MWMRatingSummaryViewValueType, ratings: [UGCRatingStars], canAddTextToReview: Bool, title: String, text: String) { + @objc init(reviewValue: MWMRatingSummaryViewValueType, ratings: [UGCRatingStars], title: String, text: String) { self.reviewValue = reviewValue self.ratings = ratings - self.canAddTextToReview = canAddTextToReview self.title = title self.text = text } diff --git a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/UGC/UGCRating.swift b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/UGC/UGCRating.swift index 01c50b3582..04252d7229 100644 --- a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/UGC/UGCRating.swift +++ b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/UGC/UGCRating.swift @@ -12,8 +12,8 @@ class UGCRatingValueType: NSObject { @objc(MWMUGCRatingStars) final class UGCRatingStars: NSObject { - let title: String - var value: CGFloat + @objc let title: String + @objc var value: CGFloat let maxValue: CGFloat @objc init(title: String, value: CGFloat, maxValue: CGFloat) { diff --git a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/UGC/UGCYourReviewCell.swift b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/UGC/UGCYourReviewCell.swift index 4f823db004..fe7583950a 100644 --- a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/UGC/UGCYourReviewCell.swift +++ b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/UGC/UGCYourReviewCell.swift @@ -83,6 +83,7 @@ final class UGCYourReviewCell: MWMTableViewCell { layout.minimumInteritemSpacing = interitemSpacing layout.itemSize = CGSize(width: itemWidth, height: Config.estimatedItemSize.height) + assert(itemsPerRow > 0); let rowsCount = ceil(ratingsCount / itemsPerRow) self.ratingCollectionViewHeight.constant = rowsCount * Config.estimatedItemSize.height + (rowsCount - 1) * layout.minimumLineSpacing + inset.top + inset.bottom self.ratingCollectionView.performBatchUpdates(updates, completion: nil) |