[ios] rename TrackRecordingInfo to the TrackInfo and remove unused dir

This entity will be used both for the tracks and _track recordings_ to store the current info.

Signed-off-by: Kiryl Kaveryn <kirylkaveryn@gmail.com>
This commit is contained in:
Kiryl Kaveryn 2024-12-22 14:32:21 +04:00 committed by Roman Tsisyk
parent 3da20576e1
commit d747702611
14 changed files with 42 additions and 46 deletions

View file

@ -95,9 +95,9 @@
ED49D75B2CEF8BD2004AF27E /* ProductsConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = ED49D7562CEF850F004AF27E /* ProductsConfiguration.swift */; };
ED49D75F2CEFA8C0004AF27E /* Product+Core.h in Headers */ = {isa = PBXBuildFile; fileRef = ED49D75E2CEFA8C0004AF27E /* Product+Core.h */; };
ED49D7612CEFA8E1004AF27E /* Product+Core.mm in Sources */ = {isa = PBXBuildFile; fileRef = ED49D7602CEFA8E1004AF27E /* Product+Core.mm */; };
ED7306F42D0C5D2400523AA1 /* TrackRecordingInfo.mm in Sources */ = {isa = PBXBuildFile; fileRef = ED7306F12D0C5D2400523AA1 /* TrackRecordingInfo.mm */; };
ED7306F52D0C5D2400523AA1 /* TrackRecordingInfo+Core.h in Headers */ = {isa = PBXBuildFile; fileRef = ED7306F22D0C5D2400523AA1 /* TrackRecordingInfo+Core.h */; };
ED7306F62D0C5D2400523AA1 /* TrackRecordingInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = ED7306F02D0C5D2400523AA1 /* TrackRecordingInfo.h */; settings = {ATTRIBUTES = (Public, ); }; };
ED7306F42D0C5D2400523AA1 /* TrackInfo.mm in Sources */ = {isa = PBXBuildFile; fileRef = ED7306F12D0C5D2400523AA1 /* TrackInfo.mm */; };
ED7306F52D0C5D2400523AA1 /* TrackInfo+Core.h in Headers */ = {isa = PBXBuildFile; fileRef = ED7306F22D0C5D2400523AA1 /* TrackInfo+Core.h */; };
ED7306F62D0C5D2400523AA1 /* TrackInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = ED7306F02D0C5D2400523AA1 /* TrackInfo.h */; settings = {ATTRIBUTES = (Public, ); }; };
ED965B0D2CD67A470049E39E /* DistanceFormatter.mm in Sources */ = {isa = PBXBuildFile; fileRef = ED965B0A2CD67A470049E39E /* DistanceFormatter.mm */; };
ED965B102CD67A470049E39E /* DistanceFormatter.h in Headers */ = {isa = PBXBuildFile; fileRef = ED965B092CD67A470049E39E /* DistanceFormatter.h */; settings = {ATTRIBUTES = (Public, ); }; };
ED965B132CD67A9B0049E39E /* AltitudeFormatter.mm in Sources */ = {isa = PBXBuildFile; fileRef = ED965B122CD67A9B0049E39E /* AltitudeFormatter.mm */; };
@ -206,9 +206,9 @@
ED49D7562CEF850F004AF27E /* ProductsConfiguration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProductsConfiguration.swift; sourceTree = "<group>"; };
ED49D75E2CEFA8C0004AF27E /* Product+Core.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Product+Core.h"; sourceTree = "<group>"; };
ED49D7602CEFA8E1004AF27E /* Product+Core.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = "Product+Core.mm"; sourceTree = "<group>"; };
ED7306F02D0C5D2400523AA1 /* TrackRecordingInfo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TrackRecordingInfo.h; sourceTree = "<group>"; };
ED7306F12D0C5D2400523AA1 /* TrackRecordingInfo.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = TrackRecordingInfo.mm; sourceTree = "<group>"; };
ED7306F22D0C5D2400523AA1 /* TrackRecordingInfo+Core.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "TrackRecordingInfo+Core.h"; sourceTree = "<group>"; };
ED7306F02D0C5D2400523AA1 /* TrackInfo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TrackInfo.h; sourceTree = "<group>"; };
ED7306F12D0C5D2400523AA1 /* TrackInfo.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = TrackInfo.mm; sourceTree = "<group>"; };
ED7306F22D0C5D2400523AA1 /* TrackInfo+Core.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "TrackInfo+Core.h"; sourceTree = "<group>"; };
ED965B092CD67A470049E39E /* DistanceFormatter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DistanceFormatter.h; sourceTree = "<group>"; };
ED965B0A2CD67A470049E39E /* DistanceFormatter.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = DistanceFormatter.mm; sourceTree = "<group>"; };
ED965B112CD67A9B0049E39E /* AltitudeFormatter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AltitudeFormatter.h; sourceTree = "<group>"; };
@ -256,7 +256,6 @@
470015F12342509C00EBF03D /* CoreApi */ = {
isa = PBXGroup;
children = (
ED7306F32D0C5D2400523AA1 /* TrackRecorder */,
ED965B0B2CD67A470049E39E /* Formatting */,
47F4F1F623A333280022FD56 /* Storage */,
9957FAE5237AE59C00855F48 /* Logger */,
@ -388,6 +387,9 @@
47CA68DC2502022400671019 /* MWMBookmark.mm */,
47CA68E62506F61300671019 /* MWMTrack.h */,
47CA68EA2506F6F100671019 /* MWMTrack+Core.h */,
ED7306F02D0C5D2400523AA1 /* TrackInfo.h */,
ED7306F12D0C5D2400523AA1 /* TrackInfo.mm */,
ED7306F22D0C5D2400523AA1 /* TrackInfo+Core.h */,
47CA68E72506F61300671019 /* MWMTrack.mm */,
47F0D2132516847F00BC685E /* MWMBookmarksSection.h */,
47F0D2142516847F00BC685E /* MWMBookmarksSection.m */,
@ -466,16 +468,6 @@
path = ElevationProfile;
sourceTree = "<group>";
};
ED7306F32D0C5D2400523AA1 /* TrackRecorder */ = {
isa = PBXGroup;
children = (
ED7306F02D0C5D2400523AA1 /* TrackRecordingInfo.h */,
ED7306F12D0C5D2400523AA1 /* TrackRecordingInfo.mm */,
ED7306F22D0C5D2400523AA1 /* TrackRecordingInfo+Core.h */,
);
path = TrackRecorder;
sourceTree = "<group>";
};
ED965B0B2CD67A470049E39E /* Formatting */ = {
isa = PBXGroup;
children = (
@ -514,8 +506,8 @@
ED965B102CD67A470049E39E /* DistanceFormatter.h in Headers */,
47942D6D237CC3E300DEFAE3 /* PlacePagePreviewData.h in Headers */,
47CA68DD2502022400671019 /* MWMBookmark.h in Headers */,
ED7306F52D0C5D2400523AA1 /* TrackRecordingInfo+Core.h in Headers */,
ED7306F62D0C5D2400523AA1 /* TrackRecordingInfo.h in Headers */,
ED7306F52D0C5D2400523AA1 /* TrackInfo+Core.h in Headers */,
ED7306F62D0C5D2400523AA1 /* TrackInfo.h in Headers */,
9940622023EAC57900493D1A /* ElevationHeightPoint.h in Headers */,
9957FACE237AB01400855F48 /* DeepLinkParser.h in Headers */,
9974CA2D23DF197B003FE824 /* ElevationProfileData+Core.h in Headers */,
@ -655,7 +647,7 @@
479F7062234FBC4700011E2E /* MWMCarPlayBookmarkObject.mm in Sources */,
47942D6C237CC3DE00DEFAE3 /* PlacePageData.mm in Sources */,
479F705E234FBB8C00011E2E /* MWMBookmarkGroup.m in Sources */,
ED7306F42D0C5D2400523AA1 /* TrackRecordingInfo.mm in Sources */,
ED7306F42D0C5D2400523AA1 /* TrackInfo.mm in Sources */,
47F0D2162516847F00BC685E /* MWMBookmarksSection.m in Sources */,
479F7057234FB7F200011E2E /* MWMBookmarksManager.mm in Sources */,
47942D71237CC40800DEFAE3 /* PlacePageInfoData.mm in Sources */,

View file

@ -1,10 +1,10 @@
#import "TrackRecordingInfo.h"
#import "TrackInfo.h"
#include <CoreApi/Framework.h>
#include "map/gps_track_collection.hpp"
#include "map/elevation_info.hpp"
@interface TrackRecordingInfo (Core)
@interface TrackInfo (Core)
- (instancetype)initWithGpsTrackInfo:(GpsTrackInfo const &)info;
- (instancetype)initWithDistance:(double)distance duration:(double)duration;

View file

@ -2,7 +2,7 @@
NS_ASSUME_NONNULL_BEGIN
@interface TrackRecordingInfo : NSObject
@interface TrackInfo : NSObject
@property (nonatomic, readonly) double distance;
@property (nonatomic, readonly) double duration;
@ -13,7 +13,7 @@ NS_ASSUME_NONNULL_BEGIN
- (BOOL)hasElevationInfo;
+ (TrackRecordingInfo *)emptyInfo;
+ (TrackInfo *)emptyInfo;
@end

View file

@ -1,19 +1,23 @@
#import "TrackRecordingInfo+Core.h"
#import "TrackInfo+Core.h"
#import "AltitudeFormatter.h"
#import "DistanceFormatter.h"
#import "DurationFormatter.h"
#include "map/elevation_info.hpp"
@implementation TrackRecordingInfo
@implementation TrackInfo
- (BOOL)hasElevationInfo {
return _ascent != 0 || _descent != 0 || _maxElevation != 0 || _minElevation != 0;
}
+ (TrackInfo *)emptyInfo {
return [[TrackInfo alloc] init];
}
@end
@implementation TrackRecordingInfo (Core)
@implementation TrackInfo (Core)
- (instancetype)initWithGpsTrackInfo:(GpsTrackInfo const &)trackInfo {
if (self = [super init]) {

View file

@ -31,7 +31,7 @@ FOUNDATION_EXPORT const unsigned char CoreApiVersionString[];
#import "CoreApi/DistanceFormatter.h"
#import "CoreApi/AltitudeFormatter.h"
#import "CoreApi/DurationFormatter.h"
#import "CoreApi/TrackRecordingInfo.h"
#import "CoreApi/TrackInfo.h"
#pragma mark - Place Page

View file

@ -4,7 +4,7 @@
#import "MWMTypes.h"
@class MWMMapSearchResult;
@class TrackRecordingInfo;
@class TrackInfo;
typedef NS_ENUM(NSUInteger, MWMZoomMode) { MWMZoomModeIn = 0, MWMZoomModeOut };
@ -18,7 +18,7 @@ typedef NS_ENUM(NSInteger, ProductsPopupCloseReason) {
NS_ASSUME_NONNULL_BEGIN
typedef void (^SearchInDownloaderCompletions)(NSArray<MWMMapSearchResult *> *results, BOOL finished);
typedef void (^TrackRecordingUpdatedHandler)(TrackRecordingInfo * _Nonnull trackStatistics);
typedef void (^TrackRecordingUpdatedHandler)(TrackInfo * _Nonnull trackInfo);
@protocol TrackRecorder <NSObject>

View file

@ -2,7 +2,7 @@
#import "MWMMapSearchResult+Core.h"
#import "ProductsConfiguration+Core.h"
#import "Product+Core.h"
#import "TrackRecordingInfo+Core.h"
#import "TrackInfo+Core.h"
#include "Framework.h"
@ -225,7 +225,7 @@ static Framework::ProductsPopupCloseReason ConvertProductPopupCloseReasonToCore(
return;
}
GetFramework().SetTrackRecordingUpdateHandler([trackRecordingDidUpdate](GpsTrackInfo const & gpsTrackInfo) {
TrackRecordingInfo * info = [[TrackRecordingInfo alloc] initWithGpsTrackInfo:gpsTrackInfo];
TrackInfo * info = [[TrackInfo alloc] initWithGpsTrackInfo:gpsTrackInfo];
trackRecordingDidUpdate(info);
});
}

View file

@ -1,7 +1,7 @@
#import <Foundation/Foundation.h>
#import "MWMTypes.h"
@class TrackRecordingInfo;
@class TrackInfo;
@class ElevationProfileData;
NS_ASSUME_NONNULL_BEGIN
@ -10,7 +10,7 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly) MWMTrackID trackId;
@property(nonatomic, readonly) MWMMarkGroupID groupId;
@property(nonatomic, readonly, nonnull) TrackRecordingInfo * trackInfo;
@property(nonatomic, readonly, nonnull) TrackInfo * trackInfo;
@property(nonatomic, readonly, nullable) ElevationProfileData * elevationProfileData;
@end

View file

@ -1,6 +1,6 @@
#import "PlacePageTrackData+Core.h"
#import "ElevationProfileData+Core.h"
#import "TrackRecordingInfo+Core.h"
#import "TrackInfo+Core.h"
@implementation PlacePageTrackData
@ -12,7 +12,7 @@
self = [super init];
if (self) {
_trackId = track.GetData().m_id;
_trackInfo = [[TrackRecordingInfo alloc] initWithDistance:track.GetLengthMeters()
_trackInfo = [[TrackInfo alloc] initWithDistance:track.GetLengthMeters()
duration:track.GetDurationInSeconds()];
auto const & elevationInfo = track.GetElevationInfo();
if (track.HasAltitudes() && elevationInfo.has_value()) {

View file

@ -9,7 +9,7 @@
@class PlacePageInfoData;
@class PlacePageBookmarkData;
@class MWMMapNodeAttributes;
@class TrackRecordingInfo;
@class TrackInfo;
typedef NS_ENUM(NSInteger, PlacePageRoadType) {
PlacePageRoadTypeToll,

View file

@ -3,8 +3,8 @@ import ActivityKit
#if canImport(ActivityKit)
protocol TrackRecordingActivityManager {
func start(with info: TrackRecordingInfo) throws
func update(_ info: TrackRecordingInfo)
func start(with info: TrackInfo) throws
func update(_ info: TrackInfo)
func stop()
}
@ -22,7 +22,7 @@ final class TrackRecordingLiveActivityManager {
@available(iOS 16.2, *)
extension TrackRecordingLiveActivityManager: TrackRecordingActivityManager {
func start(with info: TrackRecordingInfo) throws {
func start(with info: TrackInfo) throws {
guard activity == nil else { return }
let state = TrackRecordingLiveActivityAttributes.ContentState(trackInfo: info)
let content = ActivityContent<TrackRecordingLiveActivityAttributes.ContentState>(state: state, staleDate: nil)
@ -30,7 +30,7 @@ extension TrackRecordingLiveActivityManager: TrackRecordingActivityManager {
activity = try LiveActivityManager.startActivity(attributes, content: content)
}
func update(_ info: TrackRecordingInfo) {
func update(_ info: TrackInfo) {
guard let activity else { return }
let state = TrackRecordingLiveActivityAttributes.ContentState(trackInfo: info)
let content = ActivityContent<TrackRecordingLiveActivityAttributes.ContentState>(state: state, staleDate: nil)
@ -47,7 +47,7 @@ extension TrackRecordingLiveActivityManager: TrackRecordingActivityManager {
// MARK: - Wrap TrackRecordingInfo to TrackRecordingLiveActivityAttributes.ContentState
private extension TrackRecordingLiveActivityAttributes.ContentState {
init(trackInfo: TrackRecordingInfo) {
init(trackInfo: TrackInfo) {
let distance = DistanceFormatter.distanceString(fromMeters: trackInfo.distance)
let duration = DurationFormatter.durationString(from: trackInfo.duration)
let maxElevation = AltitudeFormatter.altitudeString(fromMeters: Double(trackInfo.maxElevation))

View file

@ -48,7 +48,7 @@ final class TrackRecordingManager: NSObject {
private let trackRecorder: TrackRecorder.Type
private var activityManager: TrackRecordingActivityManager?
private var observations: [Observation] = []
private var trackRecordingInfo: TrackRecordingInfo?
private var trackRecordingInfo: TrackInfo?
var recordingState: TrackRecordingState {
trackRecorder.isTrackRecordingEnabled() ? .active : .inactive

View file

@ -1,7 +1,7 @@
import CoreApi
class ElevationProfileBuilder {
static func build(trackInfo: TrackRecordingInfo,
static func build(trackInfo: TrackInfo,
elevationProfileData: ElevationProfileData?,
delegate: ElevationProfileViewControllerDelegate?) -> ElevationProfileViewController {
let storyboard = UIStoryboard.instance(.placePage)

View file

@ -21,7 +21,7 @@ fileprivate struct DescriptionsViewModel {
final class ElevationProfilePresenter: NSObject {
private weak var view: ElevationProfileViewProtocol?
private let trackInfo: TrackRecordingInfo
private let trackInfo: TrackInfo
private let profileData: ElevationProfileData?
private let delegate: ElevationProfileViewControllerDelegate?
@ -31,7 +31,7 @@ final class ElevationProfilePresenter: NSObject {
private let formatter: ElevationProfileFormatter
init(view: ElevationProfileViewProtocol,
trackInfo: TrackRecordingInfo,
trackInfo: TrackInfo,
profileData: ElevationProfileData?,
formatter: ElevationProfileFormatter = ElevationProfileFormatter(),
delegate: ElevationProfileViewControllerDelegate?) {