Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/iphone
diff options
context:
space:
mode:
authorZoia Pribytkova <niakris90@gmail.com>2019-03-12 14:09:23 +0300
committerAleksandr Zatsepin <alexzatsepin@users.noreply.github.com>2019-03-13 12:57:30 +0300
commitc618cbe1f6c90b70f5acc9855f095bb08c8e4693 (patch)
treeb3e051027fbfaaa40c41aa0250f452f27e730aeb /iphone
parent6acbf7deab44304a0e86309039b048e7fc05adae (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.swift11
-rw-r--r--iphone/Maps/UI/PlacePage/PlacePageLayout/Preview/MWMPPPreviewLayoutHelper.mm10
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;
+ }];
+ }
});
}