mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2024-11-05 02:26:29 +01:00
35 lines
1.1 KiB
C#
35 lines
1.1 KiB
C#
using System;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using TINK.Model.Device;
|
|
using Xamarin.Essentials;
|
|
|
|
namespace TINK.Services.Geolocation
|
|
{
|
|
public class SimulatedGeolocationService : IGeolocationService
|
|
{
|
|
private IGeolodationDependent Dependent { get; }
|
|
|
|
public SimulatedGeolocationService(IGeolodationDependent dependent)
|
|
{
|
|
Dependent = dependent;
|
|
}
|
|
|
|
/// <summary> Gets the current location.</summary>
|
|
/// <param name="cancelToken">Token to cancel request for geolocation.</param>
|
|
/// <param name="timeStamp">Time when geolocation is of interest. Is used to determine whether cached geolocation can be used or not.</param>
|
|
public async Task<IGeolocation> GetAsync(CancellationToken? cancelToken = null, DateTime? timeStamp = null)
|
|
{
|
|
return await Task.FromResult(new Geolocation.Builder {
|
|
Latitude = 47.976634,
|
|
Longitude = 7.825490,
|
|
Accuracy = 0,
|
|
Timestamp = timeStamp ?? DateTime.Now }.Build()); ;
|
|
}
|
|
|
|
/// <summary> If true location data returned is simulated.</summary>
|
|
public bool IsSimulation { get => true; }
|
|
|
|
public bool IsGeolcationEnabled => Dependent.IsGeolcationEnabled;
|
|
}
|
|
}
|