diff options
author | Zoia Pribytkova <niakris90@gmail.com> | 2019-03-12 14:09:23 +0300 |
---|---|---|
committer | Aleksandr Zatsepin <alexzatsepin@users.noreply.github.com> | 2019-03-13 12:57:30 +0300 |
commit | c618cbe1f6c90b70f5acc9855f095bb08c8e4693 (patch) | |
tree | b3e051027fbfaaa40c41aa0250f452f27e730aeb /iphone | |
parent | 6acbf7deab44304a0e86309039b048e7fc05adae (diff) |
This fix should reduce an amount of crashes for UITableView.update()
+ tweak for an empty review text
Diffstat (limited to 'iphone')
-rw-r--r-- | iphone/Maps/Classes/Components/ExpandableReviewView/ExpandableReviewView.swift | 11 | ||||
-rw-r--r-- | iphone/Maps/UI/PlacePage/PlacePageLayout/Preview/MWMPPPreviewLayoutHelper.mm | 10 |
2 files changed, 9 insertions, 12 deletions
diff --git a/iphone/Maps/Classes/Components/ExpandableReviewView/ExpandableReviewView.swift b/iphone/Maps/Classes/Components/ExpandableReviewView/ExpandableReviewView.swift index 35dd541795..ded9ffae1f 100644 --- a/iphone/Maps/Classes/Components/ExpandableReviewView/ExpandableReviewView.swift +++ b/iphone/Maps/Classes/Components/ExpandableReviewView/ExpandableReviewView.swift @@ -99,12 +99,7 @@ final class ExpandableReviewView: UIView { } func updateRepresentation() { - guard let text = contentLabel.text else { - return - } - if isExpanded { - moreLabelZeroHeight.isActive = true - } else { + if let text = contentLabel.text, !text.isEmpty, !isExpanded { let height = (text as NSString).boundingRect(with: CGSize(width: contentLabel.bounds.width, height: .greatestFiniteMagnitude), options: .usesLineFragmentOrigin, @@ -112,9 +107,9 @@ final class ExpandableReviewView: UIView { context: nil).height if height > contentLabel.bounds.height { moreLabelZeroHeight.isActive = false - } else { - moreLabelZeroHeight.isActive = true + return } } + moreLabelZeroHeight.isActive = true } } diff --git a/iphone/Maps/UI/PlacePage/PlacePageLayout/Preview/MWMPPPreviewLayoutHelper.mm b/iphone/Maps/UI/PlacePage/PlacePageLayout/Preview/MWMPPPreviewLayoutHelper.mm index 36b7d51779..2bd4558e2b 100644 --- a/iphone/Maps/UI/PlacePage/PlacePageLayout/Preview/MWMPPPreviewLayoutHelper.mm +++ b/iphone/Maps/UI/PlacePage/PlacePageLayout/Preview/MWMPPPreviewLayoutHelper.mm @@ -398,10 +398,12 @@ std::array<Class, 9> const kPreviewCells = {{[_MWMPPPTitle class], auto data = self.data; if (!data) return; - - [self.tableView update:^{ - self.cachedBannerCell.state = isOpen ? MWMAdBannerStateDetailed : MWMAdBannerStateCompact; - }]; + MWMAdBannerState destinationState = isOpen ? MWMAdBannerStateDetailed : MWMAdBannerStateCompact; + if (destinationState != self.cachedBannerCell.state) { + [self.tableView update:^{ + self.cachedBannerCell.state = destinationState; + }]; + } }); } |