mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-22 14:13:45 +00:00
[ios] Review fixes
Signed-off-by: Kiryl Kaveryn <kirylkaveryn@gmail.com>
This commit is contained in:
committed by
Konstantin Pastbin
parent
aec82794ac
commit
1bb2b2274f
@@ -12,8 +12,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@property(nonatomic, readonly) MWMMarkGroupID groupId;
|
||||
@property(nonatomic, readwrite, nonnull) TrackInfo * trackInfo;
|
||||
@property(nonatomic, readwrite, nullable) ElevationProfileData * elevationProfileData;
|
||||
@property(nonatomic, readonly) double activePoint;
|
||||
@property(nonatomic, readonly) double myPosition;
|
||||
@property(nonatomic, readonly) double activePointDistance;
|
||||
@property(nonatomic, readonly) double myPositionDistance;
|
||||
@property(nonatomic) MWMVoidBlock onActivePointChangedHandler;
|
||||
|
||||
- (instancetype)initWithTrackInfo:(TrackInfo *)trackInfo
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
@interface PlacePageTrackData ()
|
||||
|
||||
@property(nonatomic, readwrite) double activePoint;
|
||||
@property(nonatomic, readwrite) double activePointDistance;
|
||||
|
||||
@end
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
}
|
||||
|
||||
- (void)updateActivePointDistance:(double)distance {
|
||||
self.activePoint = distance;
|
||||
self.activePointDistance = distance;
|
||||
if (self.onActivePointChangedHandler)
|
||||
self.onActivePointChangedHandler();
|
||||
}
|
||||
@@ -40,8 +40,8 @@
|
||||
_trackInfo = [[TrackInfo alloc] initWithTrackStatistics:track.GetStatistics()];
|
||||
|
||||
auto const & bm = GetFramework().GetBookmarkManager();
|
||||
_activePoint = bm.GetElevationActivePoint(_trackId);
|
||||
_myPosition = bm.GetElevationMyPosition(_trackId);
|
||||
_activePointDistance = bm.GetElevationActivePoint(_trackId);
|
||||
_myPositionDistance = bm.GetElevationMyPosition(_trackId);
|
||||
_onActivePointChangedHandler = onActivePointChangedHandler;
|
||||
|
||||
auto const & elevationInfo = track.GetElevationInfo();
|
||||
|
||||
@@ -119,7 +119,7 @@ static PlacePageRoadType convertRoadType(RoadWarningMarkType roadType) {
|
||||
if (!self || !rawData().IsTrack())
|
||||
return;
|
||||
auto const & trackInfo = GetFramework().GetBookmarkManager().GetTrackSelectionInfo(rawData().GetTrackId());
|
||||
auto latlon = mercator::ToLatLon(trackInfo.m_trackPoint);
|
||||
auto const latlon = mercator::ToLatLon(trackInfo.m_trackPoint);
|
||||
_locationCoordinate = CLLocationCoordinate2DMake(latlon.m_lat, latlon.m_lon);
|
||||
self.previewData = [[PlacePagePreviewData alloc] initWithRawData:rawData()];
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@ import Chart
|
||||
import CoreApi
|
||||
|
||||
protocol TrackActivePointPresenter: AnyObject {
|
||||
func updateActivePoint(_ distance: Double)
|
||||
func updateMyPosition(_ distance: Double)
|
||||
func updateActivePointDistance(_ distance: Double)
|
||||
func updateMyPositionDistance(_ distance: Double)
|
||||
}
|
||||
|
||||
protocol ElevationProfilePresenterProtocol: UICollectionViewDataSource, UICollectionViewDelegateFlowLayout, TrackActivePointPresenter {
|
||||
@@ -71,14 +71,14 @@ extension ElevationProfilePresenter: ElevationProfilePresenterProtocol {
|
||||
configure()
|
||||
}
|
||||
|
||||
func updateActivePoint(_ distance: Double) {
|
||||
func updateActivePointDistance(_ distance: Double) {
|
||||
guard let view, !view.isChartViewInfoHidden else { return }
|
||||
view.setActivePoint(distance)
|
||||
view.setActivePointDistance(distance)
|
||||
}
|
||||
|
||||
func updateMyPosition(_ distance: Double) {
|
||||
func updateMyPositionDistance(_ distance: Double) {
|
||||
guard let view, !view.isChartViewInfoHidden else { return }
|
||||
view.setMyPosition(distance)
|
||||
view.setMyPositionDistance(distance)
|
||||
}
|
||||
|
||||
func configure() {
|
||||
@@ -101,8 +101,8 @@ extension ElevationProfilePresenter: ElevationProfilePresenterProtocol {
|
||||
return
|
||||
}
|
||||
|
||||
view?.setActivePoint(trackData.activePoint)
|
||||
view?.setMyPosition(trackData.myPosition)
|
||||
view?.setActivePointDistance(trackData.activePointDistance)
|
||||
view?.setMyPositionDistance(trackData.myPositionDistance)
|
||||
}
|
||||
|
||||
func onDifficultyButtonPressed() {
|
||||
|
||||
@@ -8,8 +8,8 @@ protocol ElevationProfileViewProtocol: AnyObject {
|
||||
var isChartViewInfoHidden: Bool { get set }
|
||||
|
||||
func setChartData(_ data: ChartPresentationData)
|
||||
func setActivePoint(_ distance: Double)
|
||||
func setMyPosition(_ distance: Double)
|
||||
func setActivePointDistance(_ distance: Double)
|
||||
func setMyPositionDistance(_ distance: Double)
|
||||
func reloadDescription()
|
||||
}
|
||||
|
||||
@@ -143,11 +143,11 @@ extension ElevationProfileViewController: ElevationProfileViewProtocol {
|
||||
chartView.chartData = data
|
||||
}
|
||||
|
||||
func setActivePoint(_ distance: Double) {
|
||||
func setActivePointDistance(_ distance: Double) {
|
||||
chartView.setSelectedPoint(distance)
|
||||
}
|
||||
|
||||
func setMyPosition(_ distance: Double) {
|
||||
func setMyPositionDistance(_ distance: Double) {
|
||||
chartView.myPosition = distance
|
||||
}
|
||||
|
||||
|
||||
@@ -56,16 +56,16 @@ class PlacePageInteractor: NSObject {
|
||||
private func subscribeOnTrackActivePointUpdates() {
|
||||
guard placePageData.objectType == .track, let trackData = placePageData.trackData else { return }
|
||||
bookmarksManager.setElevationActivePointChanged(trackData.trackId) { [weak self] distance in
|
||||
self?.trackActivePointPresenter?.updateActivePoint(distance)
|
||||
self?.trackActivePointPresenter?.updateActivePointDistance(distance)
|
||||
trackData.updateActivePointDistance(distance)
|
||||
}
|
||||
bookmarksManager.setElevationMyPositionChanged(trackData.trackId) { [weak self] distance in
|
||||
self?.trackActivePointPresenter?.updateMyPosition(distance)
|
||||
self?.trackActivePointPresenter?.updateMyPositionDistance(distance)
|
||||
}
|
||||
}
|
||||
|
||||
private func unsubscribeFromTrackActivePointUpdates() {
|
||||
guard placePageData.objectType == .track, let trackData = placePageData.trackData else { return }
|
||||
guard placePageData.trackData?.onActivePointChangedHandler != nil else { return }
|
||||
bookmarksManager.resetElevationActivePointChanged()
|
||||
bookmarksManager.resetElevationMyPositionChanged()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user