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

@ -22,11 +22,15 @@ using TINK.Services.Permissions;
using Plugin.BLE.Abstractions.Contracts;
using TINK.MultilingualResources;
using TINK.Model.Device;
using TINK.Model.Station;
namespace TINK.ViewModel.MyBikes
{
public class MyBikesPageViewModel : BikesViewModel, INotifyCollectionChanged, INotifyPropertyChanged
{
/// <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>
@ -38,6 +42,7 @@ namespace TINK.ViewModel.MyBikes
/// <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="p_oPolling"> 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>
@ -51,6 +56,7 @@ namespace TINK.ViewModel.MyBikes
Func<bool, IConnector> connectorFactory,
IGeolocation geolocation,
ILocksService lockService,
IEnumerable<IStation> stations,
PollingParameters p_oPolling,
Action<SendOrPostCallback, object> postAction,
ISmartDevice smartDevice,
@ -61,6 +67,8 @@ namespace TINK.ViewModel.MyBikes
OnPropertyChanged(new PropertyChangedEventArgs(nameof(IsNoBikesOccupiedVisible)));
OnPropertyChanged(new PropertyChangedEventArgs(nameof(NoBikesOccupiedText)));
};
Stations = stations ?? throw new ArgumentException(nameof(stations));
}
/// <summary> Returns if info about the fact that user did not request or book any bikes is visible or not.<summary>
@ -134,7 +142,7 @@ namespace TINK.ViewModel.MyBikes
if (!dialogResult)
{
// User decided not to give access to locations permissions.
BikeCollection.Update(bikesOccupied.Response);
BikeCollection.Update(bikesOccupied.Response, Stations);
await OnAppearing(() => UpdateTask());
@ -156,7 +164,7 @@ namespace TINK.ViewModel.MyBikes
AppResources.MessageBikesManagementLocationActivation,
AppResources.MessageAnswerOk);
BikeCollection.Update(bikesOccupied.Response);
BikeCollection.Update(bikesOccupied.Response, Stations);
await OnAppearing(() => UpdateTask());
@ -173,7 +181,7 @@ namespace TINK.ViewModel.MyBikes
AppResources.MessageBikesManagementBluetoothActivation,
AppResources.MessageAnswerOk);
BikeCollection.Update(bikesOccupied.Response);
BikeCollection.Update(bikesOccupied.Response, Stations);
await OnAppearing(() => UpdateTask());
@ -200,7 +208,7 @@ namespace TINK.ViewModel.MyBikes
var locksInfo = lockIdList.UpdateById(locksInfoTdo);
BikeCollection.Update(bikesOccupied.Response.UpdateLockInfo(locksInfo));
BikeCollection.Update(bikesOccupied.Response.UpdateLockInfo(locksInfo), Stations);
await OnAppearing(() => UpdateTask());
@ -251,7 +259,7 @@ namespace TINK.ViewModel.MyBikes
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;
},