diff --git a/iphone/Maps/Maps.xcodeproj/project.pbxproj b/iphone/Maps/Maps.xcodeproj/project.pbxproj index e17d284e8d..9b5d22b54f 100644 --- a/iphone/Maps/Maps.xcodeproj/project.pbxproj +++ b/iphone/Maps/Maps.xcodeproj/project.pbxproj @@ -7472,7 +7472,7 @@ SWIFT_OBJC_BRIDGING_HEADER = "Bridging-Header.h"; SWIFT_OBJC_INTERFACE_HEADER_NAME = SwiftBridge.h; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_SWIFT3_OBJC_INFERENCE = On; + SWIFT_SWIFT3_OBJC_INFERENCE = Default; SWIFT_VERSION = 4.0; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; diff --git a/iphone/Maps/UI/PlacePage/MWMPlacePageData.h b/iphone/Maps/UI/PlacePage/MWMPlacePageData.h index c42cd6ed86..6351a4c39b 100644 --- a/iphone/Maps/UI/PlacePage/MWMPlacePageData.h +++ b/iphone/Maps/UI/PlacePage/MWMPlacePageData.h @@ -142,6 +142,7 @@ using CianIsReady = void (^)(NSArray * items); @class MWMViatorItemModel; @class MWMCianItemModel; @class MWMUGCViewModel; +@class MWMUGCReviewModel; @class MWMUGCRatingValueType; @protocol MWMBanner; @@ -187,6 +188,10 @@ using CianIsReady = void (^)(NSArray * items); - (NSURL *)URLToAllReviews; - (NSArray *)photos; +// UGC +- (ftraits::UGCRatingCategories)ugcRatingCategories; +- (void)setUGCUpdateFrom:(MWMUGCReviewModel *)reviewModel; + // Viator - (void)fillOnlineViatorSection; - (NSArray *)viatorItems; diff --git a/iphone/Maps/UI/PlacePage/MWMPlacePageData.mm b/iphone/Maps/UI/PlacePage/MWMPlacePageData.mm index 1b51c75551..71e12f619c 100644 --- a/iphone/Maps/UI/PlacePage/MWMPlacePageData.mm +++ b/iphone/Maps/UI/PlacePage/MWMPlacePageData.mm @@ -1,4 +1,5 @@ #import "MWMPlacePageData.h" +#import "LocaleTranslator.h" #import "MWMBannerHelpers.h" #import "MWMNetworkPolicy.h" #import "MWMUGCViewModel.h" @@ -8,6 +9,8 @@ #include "local_ads/event.hpp" +#include "platform/preferred_languages.hpp" + #include "partners_api/booking_api.hpp" #include "3party/opening_hours/opening_hours.hpp" @@ -54,40 +57,8 @@ NSString * const kUserDefaultsLatLonAsDMSKey = @"UserDefaultsLatLonAsDMS"; { self = [super init]; if (self) - { m_info = info; - __weak auto weakSelf = self; - _ugc = [[MWMUGCViewModel alloc] - initWithInfo:info - refresh:^{ - __strong auto self = weakSelf; - auto ugc = self.ugc; - if ([ugc isAvailable]) - { - self.refreshPreviewCallback(); - - auto & sections = self->m_sections; - auto const begin = sections.begin(); - auto const end = sections.end(); - - auto it = find(begin, end, Sections::UGCRating); - if (it == end) - return; - NSUInteger const position = std::distance(begin, it); - NSUInteger length = 1; - - sections.push_back(Sections::UGCRating); - if ([ugc canAddReview] && ![ugc isYourReviewAvailable]) - length++; - if ([ugc isReviewsAvailable]) - length++; - - self.sectionsAreReadyCallback({position, length}, self, YES /* It's a section */); - } - }]; - } - return self; } @@ -131,23 +102,70 @@ NSString * const kUserDefaultsLatLonAsDMSKey = @"UserDefaultsLatLonAsDMS"; [Statistics logEvent:kStatPlacepageTaxiShow withParameters:@{ @"provider" : provider }]; } - auto ugc = self.ugc; - if ([ugc isAvailable]) - { - m_sections.push_back(Sections::UGCRating); - if ([ugc canAddReview] && ![ugc isYourReviewAvailable]) - m_sections.push_back(Sections::UGCAddReview); - if ([ugc isReviewsAvailable]) - m_sections.push_back(Sections::UGCReviews); - } - - // There is at least one of these buttons. if (m_info.ShouldShowAddPlace() || m_info.ShouldShowEditPlace() || m_info.ShouldShowAddBusiness() || m_info.IsSponsored()) { m_sections.push_back(Sections::Buttons); [self fillButtonsSection]; } + + if (m_info.ShouldShowUGC()) + [self addUGCSections]; +} + +- (void)addUGCSections +{ + NSAssert(m_info.ShouldShowUGC(), @""); + + __weak auto wself = self; + GetFramework().GetUGCApi()->GetUGC( + m_info.GetID(), [wself](ugc::UGC const & ugc, ugc::UGCUpdate const & update) { + __strong auto self = wself; + self.ugc = [[MWMUGCViewModel alloc] initWithUGC:ugc update:update]; + + { + auto & previewRows = self->m_previewRows; + auto it = find(previewRows.begin(), previewRows.end(), PreviewRows::Address); + if (it == previewRows.end()) + it = find(previewRows.begin(), previewRows.end(), PreviewRows::Space); + + previewRows.insert(it, PreviewRows::Review); + self.refreshPreviewCallback(); + } + + auto & sections = self->m_sections; + auto const begin = sections.begin(); + auto const end = sections.end(); + + auto it = find(begin, end, Sections::Buttons); + NSUInteger const position = std::distance(begin, it); + NSUInteger length = 0; + + if (!self.ugc.isUGCEmpty) + { + length = 2; + it = sections.insert(it, Sections::UGCRating) + 1; + if (self.ugc.isUGCUpdateEmpty) + { + it = sections.insert(it, Sections::UGCAddReview) + 1; + length++; + } + + it = sections.insert(it, Sections::UGCReviews) + 1; + } + else if (self.ugc.isUGCUpdateEmpty) + { + it = sections.insert(it, Sections::UGCAddReview); + length = 1; + } + else + { + it = sections.insert(it, Sections::UGCReviews); + length = 1; + } + + self.sectionsAreReadyCallback({position, length}, self, YES /* It's a section */); + }); } - (void)fillPreviewSection @@ -156,10 +174,11 @@ NSString * const kUserDefaultsLatLonAsDMSKey = @"UserDefaultsLatLonAsDMS"; if (self.externalTitle.length) m_previewRows.push_back(PreviewRows::ExternalTitle); if (self.subtitle.length || self.isMyPosition) m_previewRows.push_back(PreviewRows::Subtitle); if (self.schedule != OpeningHours::Unknown) m_previewRows.push_back(PreviewRows::Schedule); - if (self.isBooking || [self.ugc isAvailable]) + if (self.isBooking) m_previewRows.push_back(PreviewRows::Review); if (self.address.length) m_previewRows.push_back(PreviewRows::Address); - + m_previewRows.push_back(PreviewRows::Space); + NSAssert(!m_previewRows.empty(), @"Preview row's can't be empty!"); if (network_policy::CanUseNetwork() && ![MWMSettings adForbidden] && m_info.HasBanner() && @@ -670,6 +689,27 @@ NSString * const kUserDefaultsLatLonAsDMSKey = @"UserDefaultsLatLonAsDMS"; return _photos; } +#pragma mark - UGC + +- (ftraits::UGCRatingCategories)ugcRatingCategories { return m_info.GetRatingCategories(); } + +- (void)setUGCUpdateFrom:(MWMUGCReviewModel *)reviewModel +{ + using namespace ugc; + + auto const locale = + static_cast(StringUtf8Multilang::GetLangIndex(languages::GetCurrentNorm())); + Text t{reviewModel.text.UTF8String, locale}; + Ratings r; + for (MWMUGCRatingStars * star in reviewModel.ratings) + r.emplace_back(star.title.UTF8String, star.value); + + UGCUpdate update{r, t, std::chrono::system_clock::now()}; + auto & f = GetFramework(); + f.GetUGCApi()->SetUGCUpdate(m_info.GetID(), update); + f.UpdatePlacePageInfoForCurrentSelection(); +} + #pragma mark - Bookmark - (NSString *)externalTitle diff --git a/iphone/Maps/UI/PlacePage/MWMPlacePageManager.mm b/iphone/Maps/UI/PlacePage/MWMPlacePageManager.mm index 43f77c78b1..804973274e 100644 --- a/iphone/Maps/UI/PlacePage/MWMPlacePageManager.mm +++ b/iphone/Maps/UI/PlacePage/MWMPlacePageManager.mm @@ -571,20 +571,24 @@ void logSponsoredEvent(MWMPlacePageData * data, NSString * eventName) auto data = self.data; if (!data) return; - // TODO(ios, UGC): Fill ratings. - NSArray * ratings = @[]; - auto const canAddTextToReview = [data.ugc canAddTextToReview]; - auto title = [data title]; - // TODO(ios, UGC): Fill your review text. - auto text = @""; - auto ugcReviewModel = [[MWMUGCReviewModel alloc] initWithReviewValue:value - ratings:ratings - canAddTextToReview:canAddTextToReview - title:title - text:text]; + + NSMutableArray * ratings = [@[] mutableCopy]; + for (auto & cat : data.ugcRatingCategories) + [ratings addObject:[[MWMUGCRatingStars alloc] initWithTitle:@(cat.c_str()) + value:value + maxValue:5.0f]]; + auto title = data.title; + auto ugcReviewModel = + [[MWMUGCReviewModel alloc] initWithReviewValue:value ratings:ratings title:title text:@""]; auto ugcVC = [MWMUGCAddReviewController instanceWithModel:ugcReviewModel - onSave:^(MWMUGCReviewModel * model){ - // TODO(ios, UGC): Save review (model). + onSave:^(MWMUGCReviewModel * model) { + auto data = self.data; + if (!data) + { + NSAssert(false, @""); + return; + } + [data setUGCUpdateFrom:model]; }]; [[MapViewController controller].navigationController pushViewController:ugcVC animated:YES]; } 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 @@ - + - + @@ -15,7 +15,7 @@ - + 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) diff --git a/iphone/Maps/UI/PlacePage/PlacePageLayout/MWMPlacePageLayout.mm b/iphone/Maps/UI/PlacePage/PlacePageLayout/MWMPlacePageLayout.mm index 60f884525e..f08e20d133 100644 --- a/iphone/Maps/UI/PlacePage/PlacePageLayout/MWMPlacePageLayout.mm +++ b/iphone/Maps/UI/PlacePage/PlacePageLayout/MWMPlacePageLayout.mm @@ -689,6 +689,7 @@ map const kMetaInfoCells = { auto tv = self.placePageView.tableView; [tv reloadSections:[NSIndexSet indexSetWithIndex:0] withRowAnimation:UITableViewRowAnimationFade]; + [self.previewLayoutHelper notifyHeightWashChanded]; }; data.sectionsAreReadyCallback = ^(NSRange const & range, MWMPlacePageData * d, BOOL isSection) { diff --git a/iphone/Maps/UI/PlacePage/PlacePageLayout/Preview/MWMPPPreviewLayoutHelper.h b/iphone/Maps/UI/PlacePage/PlacePageLayout/Preview/MWMPPPreviewLayoutHelper.h index fc7485e78c..36df5d2f9e 100644 --- a/iphone/Maps/UI/PlacePage/PlacePageLayout/Preview/MWMPPPreviewLayoutHelper.h +++ b/iphone/Maps/UI/PlacePage/PlacePageLayout/Preview/MWMPPPreviewLayoutHelper.h @@ -17,6 +17,7 @@ - (void)setDistanceToObject:(NSString *)distance; - (void)setSpeedAndAltitude:(NSString *)speedAndAltitude; - (void)insertRowAtTheEnd; +- (void)notifyHeightWashChanded; - (CGFloat)height; - (void)layoutInOpenState:(BOOL)isOpen; diff --git a/iphone/Maps/UI/PlacePage/PlacePageLayout/Preview/MWMPPPreviewLayoutHelper.mm b/iphone/Maps/UI/PlacePage/PlacePageLayout/Preview/MWMPPPreviewLayoutHelper.mm index a4d9773d76..1bc28d29cf 100644 --- a/iphone/Maps/UI/PlacePage/PlacePageLayout/Preview/MWMPPPreviewLayoutHelper.mm +++ b/iphone/Maps/UI/PlacePage/PlacePageLayout/Preview/MWMPPPreviewLayoutHelper.mm @@ -244,10 +244,10 @@ array const kPreviewCells = {{[_MWMPPPTitle class], } else { - auto ugc = data.ugc; - [reviewCell configWithRating:[ugc summaryRating] - canAddReview:[ugc canAddReview] && ![ugc isYourReviewAvailable] - reviewsCount:[ugc totalReviewsCount] + NSAssert(data.ugc, @""); + [reviewCell configWithRating:data.ugc.summaryRating + canAddReview:data.ugc.isUGCUpdateEmpty + reviewsCount:data.ugc.totalReviewsCount priceSetter:^(UILabel * _Nonnull) { } onAddReview:^{ @@ -349,6 +349,8 @@ array const kPreviewCells = {{[_MWMPPPTitle class], [self.delegate heightWasChanged]; } +- (void)notifyHeightWashChanded { [self.delegate heightWasChanged]; } + - (CGFloat)height { auto const rect = [self.tableView rectForRowAtIndexPath:self.lastCellIndexPath]; diff --git a/iphone/Maps/UI/PlacePage/UGCViewModel/MWMUGCViewModel.h b/iphone/Maps/UI/PlacePage/UGCViewModel/MWMUGCViewModel.h index 9998b7a7cb..6e0aa2d906 100644 --- a/iphone/Maps/UI/PlacePage/UGCViewModel/MWMUGCViewModel.h +++ b/iphone/Maps/UI/PlacePage/UGCViewModel/MWMUGCViewModel.h @@ -6,9 +6,10 @@ typedef NS_ENUM(NSUInteger, MWMUGCViewModelPrice) { MWMUGCViewModelPriceHigh }; -namespace place_page +namespace ugc { -class Info; +struct UGC; +struct UGCUpdate; } @class MWMUGCRatingValueType; @@ -19,18 +20,15 @@ class Info; @interface MWMUGCViewModel : NSObject -- (instancetype)initWithInfo:(place_page::Info const &)info refresh:(MWMVoidBlock)refresh; +- (instancetype)initWithUGC:(ugc::UGC const &)ugc update:(ugc::UGCUpdate const &)update; -- (BOOL)isAvailable; -- (BOOL)canAddReview; -- (BOOL)canAddTextToReview; -- (BOOL)isYourReviewAvailable; -- (BOOL)isReviewsAvailable; +- (BOOL)isUGCEmpty; +- (BOOL)isUGCUpdateEmpty; -- (NSInteger)ratingCellsCount; -- (NSInteger)addReviewCellsCount; +- (NSUInteger)ratingCellsCount; +- (NSUInteger)addReviewCellsCount; -- (NSInteger)totalReviewsCount; +- (NSUInteger)totalReviewsCount; - (MWMUGCRatingValueType *)summaryRating; - (NSArray *)ratings; diff --git a/iphone/Maps/UI/PlacePage/UGCViewModel/MWMUGCViewModel.mm b/iphone/Maps/UI/PlacePage/UGCViewModel/MWMUGCViewModel.mm index c8a10747be..2fd27301af 100644 --- a/iphone/Maps/UI/PlacePage/UGCViewModel/MWMUGCViewModel.mm +++ b/iphone/Maps/UI/PlacePage/UGCViewModel/MWMUGCViewModel.mm @@ -2,12 +2,8 @@ #import "MWMPlacePageData.h" #import "SwiftBridge.h" -#include "Framework.h" - #include "ugc/types.hpp" -#include "map/place_page_info.hpp" - using namespace place_page; namespace @@ -32,7 +28,6 @@ MWMUGCRatingValueType * ratingValueType(float rating) @interface MWMUGCViewModel () @property(copy, nonatomic) MWMVoidBlock refreshCallback; -@property(nonatomic) BOOL isFilled; @end @implementation MWMUGCViewModel @@ -42,79 +37,34 @@ MWMUGCRatingValueType * ratingValueType(float rating) ugc::UGCUpdate m_ugcUpdate; } -- (instancetype)initWithInfo:(place_page::Info const &)info refresh:(MWMVoidBlock)refresh +- (instancetype)initWithUGC:(ugc::UGC const &)ugc update:(ugc::UGCUpdate const &)update { self = [super init]; if (self) - m_info = info; - - if ([self isAvailable]) { - [self fill]; - self.refreshCallback = refresh; + m_ugc = ugc; + m_ugcUpdate = update; } - return self; } -- (BOOL)isAvailable { return m_info.ShouldShowUGC(); } -- (BOOL)canAddReview { return m_info.CanBeRated(); } -- (BOOL)canAddTextToReview { return m_info.CanBeRated() && m_info.CanBeReviewed(); } -- (BOOL)isYourReviewAvailable -{ - if (!self.isFilled) - return NO; - // TODO(ios, UGC): Add logic - // return m_ugcUpdate.isValid(); - return YES; -} -- (BOOL)isReviewsAvailable { return [self numberOfReviews] != 0; } - -- (void)fill -{ - self.isFilled = NO; - auto & f = GetFramework(); - auto const featureID = m_info.GetID(); - f.GetUGCApi()->GetUGC(featureID, [self](ugc::UGC const & ugc, ugc::UGCUpdate const & update) { - self->m_ugc = ugc; - self->m_ugcUpdate = update; - self.isFilled = YES; - self.refreshCallback(); - }); -} - -- (NSInteger)ratingCellsCount { return 1; } -- (NSInteger)addReviewCellsCount { return [self isYourReviewAvailable] ? 0 : 1; } - -- (NSInteger)totalReviewsCount -{ - // TODO(ios, UGC): Add logic - // Used for display in string - return 32; -} -- (MWMUGCRatingValueType *)summaryRating { return ratingValueType(m_ugc.m_aggRating); } - -- (NSArray *)ratings -{ - NSAssert(self.isFilled, @"UGC is not filled"); - return starsRatings(m_ugc.m_ratings); -} +- (BOOL)isUGCEmpty { return static_cast(m_ugc.IsEmpty()); } +- (BOOL)isUGCUpdateEmpty { return static_cast(m_ugcUpdate.IsEmpty()); } +- (NSUInteger)ratingCellsCount { return 1; } +- (NSUInteger)addReviewCellsCount { return 1; } +- (NSUInteger)totalReviewsCount { return static_cast(m_ugc.m_basedOn); } +- (MWMUGCRatingValueType *)summaryRating { return ratingValueType(m_ugc.m_totalRating); } +- (NSArray *)ratings { return starsRatings(m_ugc.m_ratings); } #pragma mark - MWMReviewsViewModelProtocol -- (NSInteger)numberOfReviews -{ - if (!self.isFilled) - return 0; - return m_ugc.m_reviews.size() + ([self isYourReviewAvailable] ? 1 : 0); -} +- (NSUInteger)numberOfReviews { return m_ugc.m_reviews.size() + !self.isUGCUpdateEmpty; } -- (id _Nonnull)reviewWithIndex:(NSInteger)index +- (id _Nonnull)reviewWithIndex:(NSUInteger)index { - NSAssert(self.isFilled, @"UGC is not filled"); auto idx = index; NSAssert(idx >= 0, @"Invalid index"); - if ([self isYourReviewAvailable]) + if (!self.isUGCUpdateEmpty) { if (idx == 0) { @@ -130,7 +80,7 @@ MWMUGCRatingValueType * ratingValueType(float rating) NSAssert(idx < m_ugc.m_reviews.size(), @"Invalid index"); auto const & review = m_ugc.m_reviews[idx]; return [[MWMUGCReview alloc] - initWithTitle:@(review.m_author.m_name.c_str()) + initWithTitle:@(review.m_author.c_str()) date:[NSDate dateWithTimeIntervalSince1970:review.m_time.time_since_epoch().count()] text:@(review.m_text.m_text.c_str()) rating:ratingValueType(review.m_rating)];