Version 3.0.290

This commit is contained in:
Oliver Hauff 2022-04-10 17:38:34 +02:00
parent af3c20ea1c
commit ad3cdbcadf
231 changed files with 14555 additions and 7798 deletions

View file

@ -0,0 +1,13 @@
using TINK.Model.Device;
using Xamarin.Essentials;
namespace TINK.Services.Geolocation
{
public class GeolocationAccuracyBestService : GeolocationService
{
public GeolocationAccuracyBestService(IGeolodationDependent dependent) : base(
dependent, GeolocationAccuracy.Best)
{
}
}
}

View file

@ -0,0 +1,13 @@
using TINK.Model.Device;
using Xamarin.Essentials;
namespace TINK.Services.Geolocation
{
public class GeolocationAccuracyHighService : GeolocationService
{
public GeolocationAccuracyHighService(IGeolodationDependent dependent) : base(
dependent, GeolocationAccuracy.High)
{
}
}
}

View file

@ -0,0 +1,13 @@
using TINK.Model.Device;
using Xamarin.Essentials;
namespace TINK.Services.Geolocation
{
public class GeolocationAccuracyMediumService : GeolocationService
{
public GeolocationAccuracyMediumService(IGeolodationDependent dependent) : base(
dependent, GeolocationAccuracy.Medium)
{
}
}
}

View file

@ -5,18 +5,23 @@ using System.Threading.Tasks;
using TINK.Model.Device;
using Xamarin.Essentials;
namespace TINK.Model.Services.Geolocation
namespace TINK.Services.Geolocation
{
public class GeolocationService : IGeolocation
public abstract class GeolocationService : IGeolocation
{
/// <summary> Timeout for geolocation request operations.</summary>
private const int GEOLOCATIONREQUEST_TIMEOUT_MS = 5000;
private IGeolodationDependent Dependent { get; }
public GeolocationService(IGeolodationDependent dependent)
private GeolocationAccuracy Accuracy { get; }
public GeolocationService(
IGeolodationDependent dependent,
GeolocationAccuracy accuracy = GeolocationAccuracy.Default)
{
Dependent = dependent;
Accuracy = accuracy;
}
public bool IsSimulation => false;
@ -30,7 +35,7 @@ namespace TINK.Model.Services.Geolocation
{
try
{
var request = new GeolocationRequest(GeolocationAccuracy.Medium, TimeSpan.FromMilliseconds(GEOLOCATIONREQUEST_TIMEOUT_MS));
var request = new GeolocationRequest(Accuracy, TimeSpan.FromMilliseconds(GEOLOCATIONREQUEST_TIMEOUT_MS));
return cancellationToken.HasValue
? await Xamarin.Essentials.Geolocation.GetLocationAsync(request, cancellationToken.Value)
: await Xamarin.Essentials.Geolocation.GetLocationAsync(request);

View file

@ -4,7 +4,7 @@ using System.Threading.Tasks;
using TINK.Model.Device;
using Xamarin.Essentials;
namespace TINK.Model.Services.Geolocation
namespace TINK.Services.Geolocation
{
/// <summary> Query geolocation. </summary>
public interface IGeolocation : IGeolodationDependent

View file

@ -5,7 +5,7 @@ using System.Threading.Tasks;
using TINK.Model.Device;
using Xamarin.Essentials;
namespace TINK.Model.Services.Geolocation
namespace TINK.Services.Geolocation
{
public class LastKnownGeolocationService : IGeolocation
{
@ -58,7 +58,7 @@ namespace TINK.Model.Services.Geolocation
return location;
}
return await new GeolocationService(Dependent).GetAsync(cancelationToken, timeStamp);
return await new GeolocationAccuracyMediumService(Dependent).GetAsync(cancelationToken, timeStamp);
}
/// <summary> If true location data returned is simulated.</summary>

View file

@ -4,7 +4,7 @@ using System.Threading.Tasks;
using TINK.Model.Device;
using Xamarin.Essentials;
namespace TINK.Model.Services.Geolocation
namespace TINK.Services.Geolocation
{
public class SimulatedGeolocationService : IGeolocation
{