forked from organicmaps/organicmaps
[iOS] update bookmark related section in PP on bookmark add/remove
https://jira.mail.ru/browse/MAPSME-13674
This commit is contained in:
parent
88c1867b60
commit
aff7779d5f
4 changed files with 38 additions and 24 deletions
|
@ -314,6 +314,7 @@ static PlacePageRoadType convertRoadType(RoadWarningMarkType roadType) {
|
|||
} else {
|
||||
_bookmarkData = nil;
|
||||
}
|
||||
_previewData = [[PlacePagePreviewData alloc] initWithRawData:rawData()];
|
||||
if (self.onBookmarkStatusUpdate != nil) {
|
||||
self.onBookmarkStatusUpdate();
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class PlacePageDirectionView: UIView {
|
||||
final class PlacePageDirectionView: UIView {
|
||||
@IBOutlet var imageView: UIImageView!
|
||||
@IBOutlet var label: UILabel!
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ protocol PlacePagePreviewViewControllerDelegate: AnyObject {
|
|||
func previewDidPressRemoveAds()
|
||||
}
|
||||
|
||||
class PlacePagePreviewViewController: UIViewController {
|
||||
final class PlacePagePreviewViewController: UIViewController {
|
||||
@IBOutlet var stackView: UIStackView!
|
||||
@IBOutlet var popularView: UIView!
|
||||
@IBOutlet var subtitleLabel: UILabel!
|
||||
|
@ -45,7 +45,14 @@ class PlacePagePreviewViewController: UIViewController {
|
|||
return view
|
||||
}()
|
||||
|
||||
var placePagePreviewData: PlacePagePreviewData!
|
||||
var placePagePreviewData: PlacePagePreviewData! {
|
||||
didSet {
|
||||
if isViewLoaded {
|
||||
updateViews()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
weak var delegate: PlacePagePreviewViewControllerDelegate?
|
||||
|
||||
private var distance: String? = nil
|
||||
|
@ -53,6 +60,23 @@ class PlacePagePreviewViewController: UIViewController {
|
|||
private var heading: CGFloat? = nil
|
||||
|
||||
override func viewDidLoad() {
|
||||
updateViews()
|
||||
|
||||
if let distance = distance {
|
||||
placePageDirectionView?.isHidden = false
|
||||
placePageDirectionView?.label.text = distance
|
||||
}
|
||||
|
||||
if let heading = heading {
|
||||
updateHeading(heading)
|
||||
} else {
|
||||
placePageDirectionView?.imageView.isHidden = true
|
||||
}
|
||||
|
||||
stackView.addArrangedSubview(adView)
|
||||
}
|
||||
|
||||
private func updateViews() {
|
||||
super.viewDidLoad()
|
||||
if placePagePreviewData.isMyPosition {
|
||||
if let speedAndAltitude = speedAndAltitude {
|
||||
|
@ -93,19 +117,6 @@ class PlacePagePreviewViewController: UIViewController {
|
|||
configSchedule()
|
||||
configUgc()
|
||||
ugcContainerView.isHidden = !placePagePreviewData.isBookingPlace
|
||||
|
||||
if let distance = distance {
|
||||
placePageDirectionView?.isHidden = false
|
||||
placePageDirectionView?.label.text = distance
|
||||
}
|
||||
|
||||
if let heading = heading {
|
||||
updateHeading(heading)
|
||||
} else {
|
||||
placePageDirectionView?.imageView.isHidden = true
|
||||
}
|
||||
|
||||
stackView.addArrangedSubview(adView)
|
||||
}
|
||||
|
||||
func updateBanner(_ banner: MWMBanner) {
|
||||
|
|
|
@ -2355,7 +2355,7 @@
|
|||
<scene sceneID="HJX-eR-h7W">
|
||||
<objects>
|
||||
<viewController storyboardIdentifier="CatalogSingleItemViewController" id="Uqa-lN-kxa" customClass="CatalogSingleItemViewController" customModule="maps_me" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<view key="view" contentMode="scaleToFill" id="8M2-fC-tzU">
|
||||
<view key="view" clipsSubviews="YES" contentMode="scaleToFill" id="8M2-fC-tzU">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="454"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
|
@ -2583,7 +2583,7 @@
|
|||
<scene sceneID="2SQ-Cj-ThU">
|
||||
<objects>
|
||||
<viewController storyboardIdentifier="CatalogGalleryViewController" id="JgS-R4-vTi" customClass="CatalogGalleryViewController" customModule="maps_me" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<view key="view" contentMode="scaleToFill" id="VPS-rm-qWf">
|
||||
<view key="view" clipsSubviews="YES" contentMode="scaleToFill" id="VPS-rm-qWf">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="247"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
|
|
|
@ -223,7 +223,8 @@ class PlacePageCommonLayout: NSObject, IPlacePageLayout {
|
|||
if self.placePageData.bookmarkData == nil {
|
||||
self.actionBarViewController.resetButtons()
|
||||
}
|
||||
self.updateBookmarkSection()
|
||||
self.previewViewController.placePagePreviewData = self.placePageData.previewData
|
||||
self.updateBookmarkRelatedSections()
|
||||
}
|
||||
placePageData.onUgcStatusUpdate = { [weak self] in
|
||||
self?.onLoadUgc()
|
||||
|
@ -368,16 +369,17 @@ extension PlacePageCommonLayout {
|
|||
presenter?.updatePreviewOffset()
|
||||
}
|
||||
|
||||
func updateBookmarkSection() {
|
||||
var hidden = false
|
||||
func updateBookmarkRelatedSections() {
|
||||
var isBookmark = false
|
||||
if let bookmarkData = placePageData.bookmarkData {
|
||||
bookmarkViewController.bookmarkData = bookmarkData
|
||||
} else {
|
||||
hidden = true
|
||||
isBookmark = true
|
||||
}
|
||||
self.presenter?.layoutIfNeeded()
|
||||
UIView.animate(withDuration: kDefaultAnimationDuration) { [unowned self] in
|
||||
self.bookmarkViewController.view.isHidden = hidden
|
||||
self.bookmarkViewController.view.isHidden = !isBookmark
|
||||
self.catalogGalleryViewController.view.isHidden = isBookmark
|
||||
self.catalogGalleryViewController.view.isHidden = isBookmark
|
||||
self.presenter?.layoutIfNeeded()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue