mirror of
https://codeberg.org/comaps/comaps
synced 2026-01-04 03:43:46 +00:00
[ios] Add random smoothly changed elevation to iOS Simulator for testing track recording
Signed-off-by: Alexander Borsuk <me@alex.bio>
This commit is contained in:
committed by
Yannik Bloscheck
parent
529272cd54
commit
f3bc6d9d8b
@@ -10,6 +10,10 @@
|
||||
|
||||
#include "map/gps_tracker.hpp"
|
||||
|
||||
#if TARGET_OS_SIMULATOR
|
||||
#include "MountainElevationGenerator.hpp"
|
||||
#endif
|
||||
|
||||
namespace
|
||||
{
|
||||
using Observer = id<MWMLocationObserver>;
|
||||
@@ -472,6 +476,25 @@ void setShowLocationAlert(BOOL needShow) {
|
||||
if (location.horizontalAccuracy < 0.)
|
||||
return;
|
||||
|
||||
#if TARGET_OS_SIMULATOR
|
||||
// There is no simulator < 15.0 in the new XCode.
|
||||
if (@available(iOS 15.0, *))
|
||||
{
|
||||
// iOS Simulator doesn't provide any elevation in its locations. Mock it.
|
||||
static MountainElevationGenerator generator;
|
||||
location = [[CLLocation alloc] initWithCoordinate:location.coordinate
|
||||
altitude:generator.NextElevation()
|
||||
horizontalAccuracy:location.horizontalAccuracy
|
||||
verticalAccuracy:location.horizontalAccuracy
|
||||
course:location.course
|
||||
courseAccuracy:location.courseAccuracy
|
||||
speed:location.speed
|
||||
speedAccuracy:location.speedAccuracy
|
||||
timestamp:location.timestamp
|
||||
sourceInfo:location.sourceInformation];
|
||||
}
|
||||
#endif
|
||||
|
||||
self.lastLocationStatus = MWMLocationStatusNoError;
|
||||
self.locationSource = location::EAppleNative;
|
||||
[self processLocationUpdate:location];
|
||||
|
||||
Reference in New Issue
Block a user