[ios] add TrackRecordingInfo mapper class for the core's GpsTrackInfo

Signed-off-by: Kiryl Kaveryn <kirylkaveryn@gmail.com>
This commit is contained in:
Kiryl Kaveryn 2024-10-11 23:17:12 +04:00
parent c187bcc72b
commit 28f0dfeac1
5 changed files with 74 additions and 0 deletions

View file

@ -88,6 +88,9 @@
AC6A585728057EF6003EABAF /* StringUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = AC6A585628057CC1003EABAF /* StringUtils.h */; settings = {ATTRIBUTES = (Public, ); }; };
ED0B1FF42CAAE3FF006E31A4 /* DeepLinkInAppFeatureHighlightData.h in Headers */ = {isa = PBXBuildFile; fileRef = ED0B1FF22CAAE3FF006E31A4 /* DeepLinkInAppFeatureHighlightData.h */; settings = {ATTRIBUTES = (Public, ); }; };
ED0B1FF52CAAE3FF006E31A4 /* DeepLinkInAppFeatureHighlightData.mm in Sources */ = {isa = PBXBuildFile; fileRef = ED0B1FF32CAAE3FF006E31A4 /* DeepLinkInAppFeatureHighlightData.mm */; };
ED6FD54D2CB95A5500F6099F /* TrackStatistics.h in Headers */ = {isa = PBXBuildFile; fileRef = ED6FD54B2CB95A5500F6099F /* TrackStatistics.h */; settings = {ATTRIBUTES = (Public, ); }; };
ED6FD54E2CB95A5500F6099F /* TrackStatistics.mm in Sources */ = {isa = PBXBuildFile; fileRef = ED6FD54C2CB95A5500F6099F /* TrackStatistics.mm */; };
ED6FD5542CB9736A00F6099F /* TrackStatistics+Core.h in Headers */ = {isa = PBXBuildFile; fileRef = ED6FD5532CB9736A00F6099F /* TrackStatistics+Core.h */; };
EDC4E3512C5D222D009286A2 /* RecentlyDeletedCategory.mm in Sources */ = {isa = PBXBuildFile; fileRef = EDC4E34E2C5D222D009286A2 /* RecentlyDeletedCategory.mm */; };
EDC4E3522C5D222D009286A2 /* RecentlyDeletedCategory.h in Headers */ = {isa = PBXBuildFile; fileRef = EDC4E34F2C5D222D009286A2 /* RecentlyDeletedCategory.h */; settings = {ATTRIBUTES = (Public, ); }; };
EDC4E3532C5D222D009286A2 /* RecentlyDeletedCategory+Core.h in Headers */ = {isa = PBXBuildFile; fileRef = EDC4E3502C5D222D009286A2 /* RecentlyDeletedCategory+Core.h */; };
@ -182,6 +185,9 @@
AC6A585628057CC1003EABAF /* StringUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StringUtils.h; sourceTree = "<group>"; };
ED0B1FF22CAAE3FF006E31A4 /* DeepLinkInAppFeatureHighlightData.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DeepLinkInAppFeatureHighlightData.h; sourceTree = "<group>"; };
ED0B1FF32CAAE3FF006E31A4 /* DeepLinkInAppFeatureHighlightData.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = DeepLinkInAppFeatureHighlightData.mm; sourceTree = "<group>"; };
ED6FD54B2CB95A5500F6099F /* TrackStatistics.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TrackStatistics.h; sourceTree = "<group>"; };
ED6FD54C2CB95A5500F6099F /* TrackStatistics.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = TrackStatistics.mm; sourceTree = "<group>"; };
ED6FD5532CB9736A00F6099F /* TrackStatistics+Core.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "TrackStatistics+Core.h"; sourceTree = "<group>"; };
EDC4E34E2C5D222D009286A2 /* RecentlyDeletedCategory.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RecentlyDeletedCategory.mm; sourceTree = "<group>"; };
EDC4E34F2C5D222D009286A2 /* RecentlyDeletedCategory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RecentlyDeletedCategory.h; sourceTree = "<group>"; };
EDC4E3502C5D222D009286A2 /* RecentlyDeletedCategory+Core.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "RecentlyDeletedCategory+Core.h"; sourceTree = "<group>"; };
@ -222,6 +228,7 @@
470015F12342509C00EBF03D /* CoreApi */ = {
isa = PBXGroup;
children = (
ED6FD5452CB959EE00F6099F /* TrackRecorder */,
47F4F1F623A333280022FD56 /* Storage */,
9957FAE5237AE59C00855F48 /* Logger */,
9957FAC1237AABD800855F48 /* DeepLink */,
@ -423,6 +430,16 @@
path = ElevationProfile;
sourceTree = "<group>";
};
ED6FD5452CB959EE00F6099F /* TrackRecorder */ = {
isa = PBXGroup;
children = (
ED6FD54B2CB95A5500F6099F /* TrackStatistics.h */,
ED6FD5532CB9736A00F6099F /* TrackStatistics+Core.h */,
ED6FD54C2CB95A5500F6099F /* TrackStatistics.mm */,
);
path = TrackRecorder;
sourceTree = "<group>";
};
EDC4E3542C5D2251009286A2 /* RecentlyDeletedCategory */ = {
isa = PBXGroup;
children = (
@ -440,6 +457,7 @@
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
ED6FD54D2CB95A5500F6099F /* TrackStatistics.h in Headers */,
9957FAE8237AE5B000855F48 /* Logger.h in Headers */,
470015F42342509C00EBF03D /* CoreApi.h in Headers */,
479F705F234FBB8F00011E2E /* MWMBookmarkGroup.h in Headers */,
@ -482,6 +500,7 @@
47F4F1F923A3336C0022FD56 /* MWMMapNodeAttributes.h in Headers */,
479F704A234F785B00011E2E /* MWMTypes.h in Headers */,
47C637D72354AEBE00E12DE0 /* MWMMapOverlayManager.h in Headers */,
ED6FD5542CB9736A00F6099F /* TrackStatistics+Core.h in Headers */,
47942D9C237D927800DEFAE3 /* PlacePageBookmarkData.h in Headers */,
EDC4E3522C5D222D009286A2 /* RecentlyDeletedCategory.h in Headers */,
47942D72237CC40B00DEFAE3 /* OpeningHours.h in Headers */,
@ -595,6 +614,7 @@
47EEAFF42350CEDB005CF316 /* AppInfo.mm in Sources */,
47E8163623B1889C008FD836 /* MWMStorage.mm in Sources */,
EDC4E3512C5D222D009286A2 /* RecentlyDeletedCategory.mm in Sources */,
ED6FD54E2CB95A5500F6099F /* TrackStatistics.mm in Sources */,
47CA68DE2502022400671019 /* MWMBookmark.mm in Sources */,
9957FAE9237AE5B000855F48 /* Logger.mm in Sources */,
);

View file

@ -28,6 +28,7 @@ FOUNDATION_EXPORT const unsigned char CoreApiVersionString[];
#import <CoreApi/MWMTrack.h>
#import <CoreApi/MWMTypes.h>
#import <CoreApi/RecentlyDeletedCategory.h>
#import <CoreApi/TrackStatistics.h>
#pragma mark - Place Page

View file

@ -0,0 +1,11 @@
#import "TrackStatistics.h"
#include <CoreApi/Framework.h>
#include "map/gps_track_collection.hpp"
@interface TrackStatistics (Core)
- (instancetype)initWithTrackData:(Track const *)track;
- (instancetype)initWithGpsTrackInfo:(GpsTrackCollection::GpsTrackInfo const &)info;
@end

View file

@ -0,0 +1,13 @@
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface TrackStatistics : NSObject
@property (nonatomic, readonly) double length;
@property (nonatomic, readonly) double duration;
@property (nonatomic, readonly) double elevationGain;
@end
NS_ASSUME_NONNULL_END

View file

@ -0,0 +1,29 @@
#import "TrackStatistics+Core.h"
@implementation TrackStatistics
@end
@implementation TrackStatistics (Core)
- (instancetype)initWithTrackData:(Track const *)track {
self = [super init];
if (self) {
_length = track->GetLengthMeters();
// TODO: add methods to call
_duration = 0;
_elevationGain = 0;
}
return self;
}
- (instancetype)initWithGpsTrackInfo:(GpsTrackCollection::GpsTrackInfo const &)trackInfo {
if (self = [super init]) {
_length = trackInfo.length;
_duration = trackInfo.duration;
_elevationGain = trackInfo.elevationGain;
}
return self;
}
@end