Version 3.0.270

This commit is contained in:
Oliver Hauff 2022-01-04 18:59:16 +01:00
parent 67999ef4ae
commit e0c75d5b37
81 changed files with 812 additions and 474 deletions

View file

@ -23,6 +23,7 @@ using TINK.Services.Permissions;
using Plugin.BLE.Abstractions.Contracts;
using TINK.MultilingualResources;
using TINK.Model.Device;
using TINK.Model.Station;
namespace TINK.ViewModel.FindBike
{
@ -55,6 +56,9 @@ namespace TINK.ViewModel.FindBike
/// <summary> Hide id input fields as soon as bike is found.</summary>
public bool IsSelectBikeVisible => BikeCollection != null && BikeCollection.Count == 0;
/// <summary> Holds the stations to get station names form station ids. </summary>
private IEnumerable<IStation> Stations { get; }
/// <summary>
/// Constructs bike collection view model in case information about occupied bikes is available.
/// </summary>
@ -66,6 +70,7 @@ namespace TINK.ViewModel.FindBike
/// <param name="isConnectedDelegate">Returns if mobile is connected to web or not.</param>
/// <param name="connectorFactory">Connects system to copri.</param>
/// <param name="lockService">Service to control lock retrieve info.</param>
/// <param name="stations">Stations to get station name from station id.</param>
/// <param name="polling"> Holds whether to poll or not and the periode leght is polling is on. </param>
/// <param name="postAction">Executes actions on GUI thread.</param>
/// <param name="smartDevice">Provides info about the smart device (phone, tablet, ...).</param>
@ -79,6 +84,7 @@ namespace TINK.ViewModel.FindBike
Func<bool, IConnector> connectorFactory,
IGeolocation geolocation,
ILocksService lockService,
IEnumerable<IStation> stations,
PollingParameters polling,
Action<SendOrPostCallback, object> postAction,
ISmartDevice smartDevice,
@ -88,6 +94,8 @@ namespace TINK.ViewModel.FindBike
{
OnPropertyChanged(new PropertyChangedEventArgs(nameof(IsSelectBikeVisible)));
};
Stations = stations ?? throw new ArgumentException(nameof(stations));
}
/// <summary>
@ -159,7 +167,7 @@ namespace TINK.ViewModel.FindBike
if (!dialogResult)
{
// User decided not to give access to locations permissions.
BikeCollection.Update(bikeCollection);
BikeCollection.Update(bikeCollection, Stations);
//await OnAppearing(() => UpdateTask());
@ -181,7 +189,7 @@ namespace TINK.ViewModel.FindBike
AppResources.MessageBikesManagementLocationActivation,
AppResources.MessageAnswerOk);
BikeCollection.Update(bikeCollection);
BikeCollection.Update(bikeCollection, Stations);
await OnAppearing(() => UpdateTask());
@ -198,7 +206,7 @@ namespace TINK.ViewModel.FindBike
AppResources.MessageBikesManagementBluetoothActivation,
AppResources.MessageAnswerOk);
BikeCollection.Update(bikeCollection);
BikeCollection.Update(bikeCollection, Stations);
await OnAppearing(() => UpdateTask());
@ -225,7 +233,7 @@ namespace TINK.ViewModel.FindBike
var locksInfo = lockIdList.UpdateById(locksInfoTdo);
BikeCollection.Update(bikeCollection.UpdateLockInfo(locksInfo));
BikeCollection.Update(bikeCollection.UpdateLockInfo(locksInfo), Stations);
await OnAppearing(() => UpdateTask());
@ -265,7 +273,7 @@ namespace TINK.ViewModel.FindBike
PostAction(
unused =>
{
BikeCollection.Update(bikes); // Updating collection leads to update of GUI.
BikeCollection.Update(bikes, Stations); // Updating collection leads to update of GUI.
Exception = result.Exception;
ActionText = string.Empty;
},