Version 3.0.363

This commit is contained in:
Anja 2023-04-19 12:14:14 +02:00
parent 4ff3307997
commit 91d42552c7
212 changed files with 1799 additions and 1318 deletions

View file

@ -44,7 +44,7 @@ namespace TINK.ViewModel.Bikes.Bike.BC.RequestHandler
if (l_oResult == false)
{
// User aborted booking process
Log.ForContext<Disposable>().Information("User selected availalbe bike {l_oId} in order to reserve but action was canceled.", SelectedBike.Id);
Log.ForContext<Disposable>().Information("User selected centered bike {l_oId} in order to reserve but action was canceled.", SelectedBike.Id);
BikesViewModel.IsIdle = true;
return this;
}
@ -77,7 +77,7 @@ namespace TINK.ViewModel.Bikes.Bike.BC.RequestHandler
|| exception is RequestNotCachableException)
{
// Copri server is not reachable.
Log.ForContext<Disposable>().Information("User selected availalbe bike {l_oId} but reserving failed (Copri server not reachable).", SelectedBike.Id);
Log.ForContext<Disposable>().Information("User selected centered bike {l_oId} but reserving failed (Copri server not reachable).", SelectedBike.Id);
BikesViewModel.ActionText = string.Empty;
await ViewService.DisplayAlert(
@ -87,7 +87,7 @@ namespace TINK.ViewModel.Bikes.Bike.BC.RequestHandler
}
else
{
Log.ForContext<Disposable>().Error("User selected availalbe bike {l_oId} but reserving failed. {@l_oException}", SelectedBike.Id, exception);
Log.ForContext<Disposable>().Error("User selected centered bike {l_oId} but reserving failed. {@l_oException}", SelectedBike.Id, exception);
BikesViewModel.ActionText = string.Empty;
await ViewService.DisplayAlert(AppResources.MessageReservingBikeErrorGeneralTitle, exception.Message, AppResources.MessageAnswerOk);

View file

@ -61,7 +61,7 @@ namespace TINK.ViewModel.Bikes.Bike.BC.RequestHandler
await ConnectorFactory(IsConnected).Command.DoCancelReservation(SelectedBike);
// If canceling bike succedes remove bike because it is not ready to be booked again
// If canceling bike succeeds remove bike because it is not ready to be booked again
IsRemoveBikeRequired = true;
}
catch (Exception exception)

View file

@ -1,4 +1,4 @@
using System;
using System;
using TINK.Model.Connector;
using TINK.Model.Device;
using TINK.Model.User;
@ -37,7 +37,7 @@ namespace TINK.ViewModel.Bikes.Bike.BC
activeUser);
case Model.State.InUseStateEnum.Reserved:
// Reservation can be cancelled.
// Reservation can be canceled.
return new Reserved(
selectedBike,
isConnectedDelegate,

View file

@ -2,6 +2,7 @@ using Serilog;
using System;
using System.ComponentModel;
using System.Text.RegularExpressions;
using TINK.Model.Bikes.BikeInfoNS.BikeNS;
#if !USEFLYOUT
#endif
using TINK.Model.Connector;
@ -38,7 +39,7 @@ namespace TINK.ViewModel.Bikes.Bike
/// </summary>
protected IViewService ViewService { get; }
/// <summary> Provides a connect orobject.</summary>
/// <summary> Provides a connect object.</summary>
protected Func<bool, IConnector> ConnectorFactory { get; }
/// <summary> Delegate to retrieve connected state. </summary>
@ -75,7 +76,7 @@ namespace TINK.ViewModel.Bikes.Bike
public abstract event PropertyChangedEventHandler PropertyChanged;
/// <summary>
/// Notfies childs about changed bike state.
/// Notifies children about changed bike state.
/// </summary>
public abstract void OnSelectedBikeStateChanged();
@ -175,6 +176,11 @@ namespace TINK.ViewModel.Bikes.Bike
public string TypeOfBike => Bike.GetDisplayTypeOfBike();
/// <summary>
/// Gets whether bike is a AA bike (bike must be always returned a the same station) or AB bike (start and end stations can be different stations).
/// </summary>
public AaRideType? AaRideType => Bike.AaRideType;
public string WheelType => Bike.GetDisplayWheelType();
/// <summary>
@ -187,6 +193,8 @@ namespace TINK.ViewModel.Bikes.Bike
/// </summary>
public string Id => Bike.Id;
public string StationId => $"Station {Bike.StationId}";
public bool IsBikeWithCopriLock => Bike.LockModel == Model.Bikes.BikeInfoNS.BikeNS.LockModel.Sigo;
/// Returns if type of bike is a cargo pedelec bike.

View file

@ -23,6 +23,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock
public class BikeViewModel : BikeViewModelBase, INotifyPropertyChanged
{
public Xamarin.Forms.Command ShowTrackingInfoCommand { get; private set; }
public Xamarin.Forms.Command ShowRideTypeInfoCommand { get; private set; }
/// <summary> Notifies GUI about changes. </summary>
public override event PropertyChangedEventHandler PropertyChanged;
@ -112,6 +113,15 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock
});
ShowRideTypeInfoCommand = new Xamarin.Forms.Command(async () => {
await ViewService.DisplayAlert(
AppResources.MessageAaRideTypeInfoTitle,
TariffDescription.RideTypeText,
AppResources.MessageAnswerOk);
});
RequestHandler = user.IsLoggedIn
? RequestHandlerFactory.Create(
selectedBike,

View file

@ -101,7 +101,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
return RequestHandlerFactory.Create(SelectedBike, IsConnectedDelegate, ConnectorFactory, GeolocationService, LockService, ViewUpdateManager, SmartDevice, ViewService, BikesViewModel, ActiveUser);
}
// Check if quering geolocation is required.
// Check if querying geolocation is required.
if (currentLocation == null)
{
BikesViewModel.ActionText = AppResources.ActivityTextQueryLocationStart;
@ -216,7 +216,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
SelectedBike,
currentLocationDto);
// If canceling bike succedes remove bike because it is not ready to be booked again
// If canceling bike succeeds remove bike because it is not ready to be booked again
IsRemoveBikeRequired = true;
}
catch (Exception exception)
@ -238,7 +238,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
{
// COPRI returned an error.
Log.ForContext<BookedClosed>().Information(
"User selected booked bike {bike} but returning failed. COPRI returned out of GEO fencing error. Postion send to COPRI {@position}.",
"User selected booked bike {bike} but returning failed. COPRI returned out of GEO fencing error. Position send to COPRI {@position}.",
SelectedBike,
currentLocationDto);
@ -427,7 +427,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
"OK");
}
// When bold is blocked lock is still closed even if exception occurres.
// When bold is blocked lock is still closed even if exception occurs.
// In all other cases state is supposed to be unknown. Example: Lock is out of reach and no more bluetooth connected.
SelectedBike.LockInfo.State = exception is StateAwareException stateAwareException
? stateAwareException.State
@ -449,13 +449,13 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
{
if (exception is OutOfReachException)
{
Log.ForContext<BookedClosed>().Debug("Akkustate can not be read, bike out of range. {Exception}", exception);
Log.ForContext<BookedClosed>().Debug("Battery state can not be read, bike out of range. {Exception}", exception);
BikesViewModel.ActionText = AppResources.ActivityTextErrorReadingChargingLevelOutOfReach;
}
else
{
Log.ForContext<BookedClosed>().Error("Akkustate can not be read. {Exception}", exception);
Log.ForContext<BookedClosed>().Error("Battery state can not be read. {Exception}", exception);
BikesViewModel.ActionText = AppResources.ActivityTextErrorReadingChargingLevelGeneral;
}

View file

@ -55,7 +55,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
/// <returns></returns>
public async Task<IRequestHandler> HandleRequestOption2() => await ConnectLock();
/// <summary> Requst is not supported, button should be disabled. </summary>
/// <summary> Request is not supported, button should be disabled. </summary>
/// <returns></returns>
public async Task<IRequestHandler> UnsupportedRequest()
{

View file

@ -119,11 +119,11 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
return this;
}
// Start of closing lock and returing bike sequence.
// Start of closing lock and returning bike sequence.
Log.ForContext<BookedOpen>().Information("Request to return bike {bike} detected.", SelectedBike);
// Clear logging memory sink to avoid passing log data not related to returning of bike to backend.
// Log data is passed to backend when calling CopriCallsHttps.DoReturn().
// Clear logging memory sink to avoid passing log data not related to returning of bike to back-end.
// Log data is passed to back end when calling CopriCallsHttps.DoReturn().
MemoryStackSink.ClearMessages();
// Stop polling before returning bike.
@ -260,7 +260,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
// Check locking state.
if (SelectedBike.LockInfo.State != LockingState.Closed)
{
Log.ForContext<BookedOpen>().Error($"Lock can not be closed. Invalid locking state state {SelectedBike.LockInfo.State} detected.");
Log.ForContext<BookedOpen>().Error($"Lock can not be closed. Invalid locking state {SelectedBike.LockInfo.State} detected.");
BikesViewModel.ActionText = string.Empty;
@ -298,7 +298,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
catch (Exception innerExWhenAll)
{
// No location information available.
Log.ForContext<BookedOpen>().Information("Canceling query location/ updating lock state failed failed on unexpected lock state failed. {Exception}", SelectedBike, innerExWhenAll);
Log.ForContext<BookedOpen>().Information("Canceling query location/ updating lock state failed on unexpected lock state failed. {Exception}", SelectedBike, innerExWhenAll);
}
BikesViewModel.ActionText = AppResources.ActivityTextStartingUpdater;
@ -360,7 +360,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
SelectedBike,
currentLocationDto,
SmartDevice);
// If canceling bike succedes remove bike because it is not ready to be booked again
// If canceling bike succeeds remove bike because it is not ready to be booked again
IsRemoveBikeRequired = true;
}
catch (Exception exception)
@ -382,7 +382,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
{
// COPRI returned an error.
Log.ForContext<BookedOpen>().Information(
"User selected booked bike {bike} but returning failed. COPRI returned out of GEO fencing error. Postion send to COPRI {@position}.",
"User selected booked bike {bike} but returning failed. COPRI returned out of GEO fencing error. Position send to COPRI {@position}.",
SelectedBike,
currentLocationDto);
@ -510,8 +510,8 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
BikesViewModel.IsIdle = false;
Log.ForContext<BookedOpen>().Information("User request to lock bike {bike} in order to pause ride.", SelectedBike);
// Clear logging memory sink to avoid passing log data not related to returning of bike to backend.
// Log data is passed to backend when calling CopriCallsHttps.DoReturn().
// Clear logging memory sink to avoid passing log data not related to returning of bike to back end.
// Log data is passed to back end when calling CopriCallsHttps.DoReturn().
MemoryStackSink.ClearMessages();
// Start getting geolocation.
@ -608,7 +608,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
return RequestHandlerFactory.Create(SelectedBike, IsConnectedDelegate, ConnectorFactory, GeolocationService, LockService, ViewUpdateManager, SmartDevice, ViewService, BikesViewModel, ActiveUser);
}
// Get geoposition.
// Get geolocation.
BikesViewModel.ActionText = AppResources.ActivityTextQueryLocation;
IGeolocation currentLocation = null;
try

View file

@ -14,7 +14,6 @@ using TINK.Services.BluetoothLock;
using TINK.Services.BluetoothLock.Exception;
using TINK.Services.Geolocation;
using TINK.View;
using Xamarin.Essentials;
namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
{
@ -126,7 +125,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
AppResources.MessageAnswerOk);
}
// When bold is blocked lock is still closed even if exception occurres.
// When bold is blocked lock is still closed even if exception occurs.
// In all other cases state is supposed to be unknown. Example: Lock is out of reach and no more bluetooth connected.
SelectedBike.LockInfo.State = exception is StateAwareException stateAwareException
? stateAwareException.State
@ -148,13 +147,13 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
{
if (exception is OutOfReachException)
{
Log.ForContext<BookedUnknown>().Debug("Akkustate can not be read, bike out of range. {Exception}", exception);
Log.ForContext<BookedUnknown>().Debug("Battery state can not be read, bike out of range. {Exception}", exception);
BikesViewModel.ActionText = AppResources.ActivityTextErrorReadingChargingLevelOutOfReach;
}
else
{
Log.ForContext<BookedUnknown>().Error("Akkustate can not be read. {Exception}", exception);
Log.ForContext<BookedUnknown>().Error("Battery state can not be read. {Exception}", exception);
BikesViewModel.ActionText = AppResources.ActivityTextErrorReadingChargingLevelGeneral;
}

View file

@ -69,7 +69,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
if (alertResult == false)
{
// User aborted booking process
Log.ForContext<DisposableDisconnected>().Information("User selected availalbe bike {bike} in order to reserve but action was canceled.", SelectedBike);
Log.ForContext<DisposableDisconnected>().Information("User selected centered bike {bike} in order to reserve but action was canceled.", SelectedBike);
BikesViewModel.IsIdle = true;
return this;
}
@ -106,7 +106,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
|| exception is RequestNotCachableException)
{
// Copri server is not reachable.
Log.ForContext<DisposableDisconnected>().Information("User selected availalbe bike {bike} but reserving failed (Copri server not reachable).", SelectedBike);
Log.ForContext<DisposableDisconnected>().Information("User selected centered bike {bike} but reserving failed (Copri server not reachable).", SelectedBike);
await ViewService.DisplayAlert(
AppResources.MessageReservingBikeErrorConnectionTitle,
@ -115,7 +115,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
}
else
{
Log.ForContext<DisposableDisconnected>().Error("User selected availalbe bike {bike} but reserving failed. {@l_oException}", SelectedBike, exception);
Log.ForContext<DisposableDisconnected>().Error("User selected centered bike {bike} but reserving failed. {@l_oException}", SelectedBike, exception);
await ViewService.DisplayAlert(
AppResources.MessageReservingBikeErrorGeneralTitle,
@ -346,13 +346,13 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
{
if (exception is OutOfReachException)
{
Log.ForContext<DisposableDisconnected>().Debug("Akkustate can not be read, bike out of range. {Exception}", exception);
Log.ForContext<DisposableDisconnected>().Debug("Battery state can not be read, bike out of range. {Exception}", exception);
BikesViewModel.ActionText = AppResources.ActivityTextErrorReadingChargingLevelOutOfReach;
}
else
{
Log.ForContext<DisposableDisconnected>().Error("Akkustate can not be read. {Exception}", exception);
Log.ForContext<DisposableDisconnected>().Error("Battery state can not be read. {Exception}", exception);
BikesViewModel.ActionText = AppResources.ActivityTextErrorReadingChargingLevelGeneral;
}
@ -407,7 +407,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
return RequestHandlerFactory.Create(SelectedBike, IsConnectedDelegate, ConnectorFactory, GeolocationService, LockService, ViewUpdateManager, SmartDevice, ViewService, BikesViewModel, ActiveUser);
}
/// <summary> Requst is not supported, button should be disabled. </summary>
/// <summary> Request is not supported, button should be disabled. </summary>
/// <returns></returns>
public async Task<IRequestHandler> UnsupportedRequest()
{

View file

@ -1,4 +1,4 @@
using System;
using System;
using System.Threading.Tasks;
using Serilog;
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
@ -26,7 +26,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
{
/// <summary> Bike is disposable, lock is open and can be reached via bluetooth. </summary>
/// <remarks>
/// This state should never occure because as long as a ILOCKIT is connected it
/// This state should never occur because as long as a ILOCKIT is connected it
/// - cannot be closed manually
/// - no other device can access lock
/// - app itself should never event attempt to open a lock which is not rented.
@ -177,19 +177,19 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
{
if (exception is OutOfReachException)
{
Log.ForContext<DisposableOpen>().Debug("Akkustate can not be read, bike out of range. {Exception}", exception);
Log.ForContext<DisposableOpen>().Debug("Battery state can not be read, bike out of range. {Exception}", exception);
BikesViewModel.ActionText = AppResources.ActivityTextErrorReadingChargingLevelOutOfReach;
}
else
{
Log.ForContext<DisposableOpen>().Error("Akkustate can not be read. {Exception}", exception);
Log.ForContext<DisposableOpen>().Error("Battery state can not be read. {Exception}", exception);
BikesViewModel.ActionText = AppResources.ActivityTextErrorReadingChargingLevelGeneral;
}
}
// Notify corpi about unlock action in order to start booking.
// Notify copri about unlock action in order to start booking.
BikesViewModel.ActionText = AppResources.ActivityTextRentingBike;
IsConnected = IsConnectedDelegate();
try
@ -270,7 +270,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
return RequestHandlerFactory.Create(SelectedBike, IsConnectedDelegate, ConnectorFactory, GeolocationService, LockService, ViewUpdateManager, SmartDevice, ViewService, BikesViewModel, ActiveUser);
}
/// <summary> Requst is not supported, button should be disabled. </summary>
/// <summary> Request is not supported, button should be disabled. </summary>
/// <returns></returns>
public async Task<IRequestHandler> UnsupportedRequest()
{

View file

@ -16,11 +16,11 @@ using IBikeInfoMutable = TINK.Model.Bikes.BikeInfoNS.BluetoothLock.IBikeInfoMuta
namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
{
/// <summary> Bike is reserved, lock is closed and and connected to app. </summary>
/// <summary> Bike is reserved, lock is closed and connected to app. </summary>
/// <remarks>
/// Occures when
/// - biks was reserved out of reach and is in reach now
/// - bike is is reserved while in reach
/// Occurs when
/// - bike was reserved out of reach and is in reach now
/// - bike is reserved while in reach
/// </remarks>
public class ReservedClosed : Base, IRequestHandler
{
@ -91,7 +91,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
{
await ConnectorFactory(IsConnected).Command.DoCancelReservation(SelectedBike);
// If canceling bike succedes remove bike because it is not ready to be booked again
// If canceling bike succeeds remove bike because it is not ready to be booked again
IsRemoveBikeRequired = true;
}
catch (Exception exception)
@ -311,13 +311,13 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
{
if (exception is OutOfReachException)
{
Log.ForContext<ReservedClosed>().Debug("Akkustate can not be read, bike out of range. {Exception}", exception);
Log.ForContext<ReservedClosed>().Debug("Battery state can not be read, bike out of range. {Exception}", exception);
BikesViewModel.ActionText = AppResources.ActivityTextErrorReadingChargingLevelOutOfReach;
}
else
{
Log.ForContext<ReservedClosed>().Error("Akkustate can not be read. {Exception}", exception);
Log.ForContext<ReservedClosed>().Error("Battery state can not be read. {Exception}", exception);
BikesViewModel.ActionText = AppResources.ActivityTextErrorReadingChargingLevelGeneral;
}

View file

@ -51,7 +51,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
/// <summary> Cancel reservation. </summary>
public async Task<IRequestHandler> HandleRequestOption1() => await CancelReservation();
/// <summary> Connect to reserved bike ask whether to book bike bike or not and if yes open lock. </summary>
/// <summary> Connect to reserved bike ask whether to book bike or not and if yes open lock. </summary>
/// <returns></returns>
public async Task<IRequestHandler> HandleRequestOption2() => await ConnectLockAndBook();
@ -86,7 +86,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
{
await ConnectorFactory(IsConnected).Command.DoCancelReservation(SelectedBike);
// If canceling bike succedes remove bike because it is not ready to be booked again
// If canceling bike succeeds remove bike because it is not ready to be booked again
IsRemoveBikeRequired = true;
}
catch (Exception exception)
@ -136,7 +136,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
return RequestHandlerFactory.Create(SelectedBike, IsConnectedDelegate, ConnectorFactory, GeolocationService, LockService, ViewUpdateManager, SmartDevice, ViewService, BikesViewModel, ActiveUser);
}
/// <summary> Connect to reserved bike ask whether to book bike bike or not and if yes open lock. </summary>
/// <summary> Connect to reserved bike ask whether to book bike or not and if yes open lock. </summary>
/// <returns></returns>
public async Task<IRequestHandler> ConnectLockAndBook()
{
@ -474,13 +474,13 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
{
if (exception is OutOfReachException)
{
Log.ForContext<ReservedDisconnected>().Debug("Akkustate can not be read, bike out of range. {Exception}", exception);
Log.ForContext<ReservedDisconnected>().Debug("Battery state can not be read, bike out of range. {Exception}", exception);
BikesViewModel.ActionText = AppResources.ActivityTextErrorReadingChargingLevelOutOfReach;
}
else
{
Log.ForContext<ReservedDisconnected>().Error("Akkustate can not be read. {Exception}", exception);
Log.ForContext<ReservedDisconnected>().Error("Battery state can not be read. {Exception}", exception);
BikesViewModel.ActionText = AppResources.ActivityTextErrorReadingChargingLevelGeneral;
}

View file

@ -17,10 +17,10 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
{
/// <summary> Bike is reserved, lock is open and connected to app. </summary>
/// <remarks>
/// This state might occure when a ILOCKIT was manually opened (color code) and app connects afterwards.
/// This state might occur when a ILOCKIT was manually opened (color code) and app connects afterwards.
/// This should never during ILOCKIT is connected to app because
/// - manually opening lock is not possible when lock is connected
/// - two devices can not simultaneously conect to same lock.
/// - two devices can not simultaneously connect to same lock.
public class ReservedOpen : Base, IRequestHandler
{
/// <param name="smartDevice">Provides info about the smart device (phone, tablet, ...)</param>
@ -89,13 +89,13 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
{
if (exception is OutOfReachException)
{
Log.ForContext<ReservedOpen>().Debug("Akkustate can not be read, bike out of range. {Exception}", exception);
Log.ForContext<ReservedOpen>().Debug("Battery state can not be read, bike out of range. {Exception}", exception);
BikesViewModel.ActionText = AppResources.ActivityTextErrorReadingChargingLevelOutOfReach;
}
else
{
Log.ForContext<ReservedOpen>().Error("Akkustate can not be read. {Exception}", exception);
Log.ForContext<ReservedOpen>().Error("Battery state can not be read. {Exception}", exception);
BikesViewModel.ActionText = AppResources.ActivityTextErrorReadingChargingLevelGeneral;
}
@ -229,7 +229,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
{
await ConnectorFactory(IsConnected).Command.DoCancelReservation(SelectedBike);
// If canceling bike succedes remove bike because it is not ready to be booked again
// If canceling bike succeeds remove bike because it is not ready to be booked again
IsRemoveBikeRequired = true;
}
catch (Exception exception)

View file

@ -122,7 +122,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
AppResources.MessageAnswerOk);
}
// When bold is blocked lock is still closed even if exception occurres.
// When bold is blocked lock is still closed even if exception occurs.
// In all other cases state is supposed to be unknown. Example: Lock is out of reach and no more bluetooth connected.
SelectedBike.LockInfo.State = exception is StateAwareException stateAwareException
? stateAwareException.State
@ -144,13 +144,13 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
{
if (exception is OutOfReachException)
{
Log.ForContext<ReservedUnknown>().Debug("Akkustate can not be read, bike out of range. {Exception}", exception);
Log.ForContext<ReservedUnknown>().Debug("Battery state can not be read, bike out of range. {Exception}", exception);
BikesViewModel.ActionText = AppResources.ActivityTextErrorReadingChargingLevelOutOfReach;
}
else
{
Log.ForContext<ReservedUnknown>().Error("Akkustate can not be read. {Exception}", exception);
Log.ForContext<ReservedUnknown>().Error("Battery state can not be read. {Exception}", exception);
BikesViewModel.ActionText = AppResources.ActivityTextErrorReadingChargingLevelGeneral;
}
@ -310,7 +310,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
return RequestHandlerFactory.Create(SelectedBike, IsConnectedDelegate, ConnectorFactory, GeolocationService, LockService, ViewUpdateManager, SmartDevice, ViewService, BikesViewModel, ActiveUser);
}
// Get geoposition.
// Get geolocation.
BikesViewModel.ActionText = AppResources.ActivityTextQueryLocation;
IGeolocation currentLocation = null;
try

View file

@ -43,11 +43,11 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock
{
case Model.State.InUseStateEnum.Disposable:
// Bike is reserved, selecte action depending on lock state.
// Bike is reserved, select action depending on lock state.
switch (selectedBluetoothLockBike.LockInfo.State)
{
case LockingState.Closed:
// Unexepected state detected.
// Unexpected state detected.
// This state is unexpected because connection is closed
// - when reservation is canceled or
// - when bike is returned.
@ -60,13 +60,13 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock
case LockingState.Open:
case LockingState.UnknownFromHardwareError:
// Unexepected state detected.
// Unexpected state detected.
/// This state is unexpected because
/// - app does not allow to return bike/ cancel reservation when lock is closed
/// - as long as app is connected to lock
/// - lock can not be opened manually
/// - no other device can access lock
/// Nevetheless this state is not expected let user either
/// Nevertheless this state is not expected let user either
/// - close lock or
/// - rent bike
/// </remarks>
@ -100,7 +100,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock
case Model.State.InUseStateEnum.Reserved:
// Bike is reserved, selecte action depending on lock state.
// Bike is reserved, select action depending on lock state.
switch (selectedBluetoothLockBike.LockInfo.State)
{
case LockingState.Closed:
@ -132,7 +132,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock
case LockingState.Open:
// Unwanted state detected.
/// This state might occure when a ILOCKIT was manually opened (color code) and app connects afterwards.
/// This state might occur when a ILOCKIT was manually opened (color code) and app connects afterwards.
Log.Error("Unwanted state {BookingState}/ {LockingState} detected.", selectedBluetoothLockBike.State.Value, selectedBluetoothLockBike.LockInfo.State);
return new ReservedOpen(
selectedBluetoothLockBike,
@ -167,7 +167,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock
case Model.State.InUseStateEnum.Booked:
// Bike is booked, selecte action depending on lock state.
// Bike is booked, select action depending on lock state.
switch (selectedBluetoothLockBike.LockInfo.State)
{
case LockingState.Closed:
@ -214,7 +214,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock
default:
// Invalid state detected.
// If bike is booked lock state must be querried before creating view model.
// If bike is booked lock state must be queried before creating view model.
return new BookedDisconnected(
selectedBluetoothLockBike,
isConnectedDelegate,

View file

@ -1,4 +1,4 @@
using System;
using System;
using System.Threading.Tasks;
using Serilog;
using TINK.Model.Bikes.BikeInfoNS.CopriLock;
@ -47,7 +47,7 @@ namespace TINK.ViewModel.Bikes.Bike.CopriLock.RequestHandler
/// <summary> Open bike and update COPRI lock state. </summary>
public async Task<IRequestHandler> HandleRequestOption2() => await OpenLock();
/// <summary> Requst is not supported, button should be disabled. </summary>
/// <summary> Request is not supported, button should be disabled. </summary>
public async Task<IRequestHandler> UnsupportedRequest()
{
Log.ForContext<BookedClosed>().Error("Click of unsupported button click detected.");

View file

@ -1,4 +1,4 @@
using System;
using System;
using System.Threading.Tasks;
using Serilog;
using TINK.Model.Bikes.BikeInfoNS.CopriLock;
@ -48,7 +48,7 @@ namespace TINK.ViewModel.Bikes.Bike.CopriLock.RequestHandler
/// <summary> Close lock in order to pause ride and update COPRI lock state.</summary>
public async Task<IRequestHandler> HandleRequestOption2() => await OpenLock();
/// <summary> Requst is not supported, button should be disabled. </summary>
/// <summary> Request is not supported, button should be disabled. </summary>
public async Task<IRequestHandler> UnsupportedRequest()
{
Log.ForContext<BookedOpen>().Error("Click of unsupported button click detected.");

View file

@ -63,7 +63,7 @@ namespace TINK.ViewModel.Bikes.Bike.CopriLock.RequestHandler
if (alertResult == false)
{
// User aborted booking process
Log.ForContext<DisposableClosed>().Information("User selected bike {bike} in order to book and release bike from station but action was cancelled.", SelectedBike);
Log.ForContext<DisposableClosed>().Information("User selected bike {bike} in order to book and release bike from station but action was canceled.", SelectedBike);
BikesViewModel.IsIdle = true;
return this;
@ -139,7 +139,7 @@ namespace TINK.ViewModel.Bikes.Bike.CopriLock.RequestHandler
if (alertResult == false)
{
// User aborted booking process
Log.ForContext<DisposableClosed>().Information("User selected availalbe bike {bike} in order to reserve but action was canceled.", SelectedBike);
Log.ForContext<DisposableClosed>().Information("User selected centered bike {bike} in order to reserve but action was canceled.", SelectedBike);
BikesViewModel.IsIdle = true;
return this;
}
@ -175,7 +175,7 @@ namespace TINK.ViewModel.Bikes.Bike.CopriLock.RequestHandler
|| exception is RequestNotCachableException)
{
// Copri server is not reachable.
Log.ForContext<DisposableClosed>().Information("User selected availalbe bike {bike} but reserving failed (Copri server not reachable).", SelectedBike);
Log.ForContext<DisposableClosed>().Information("User selected centered bike {bike} but reserving failed (Copri server not reachable).", SelectedBike);
await ViewService.DisplayAdvancedAlert(
AppResources.MessageReservingBikeErrorConnectionTitle,
@ -185,7 +185,7 @@ namespace TINK.ViewModel.Bikes.Bike.CopriLock.RequestHandler
}
else
{
Log.ForContext<DisposableClosed>().Error("User selected availalbe bike {bike} but reserving failed. {@exception}", SelectedBike, exception);
Log.ForContext<DisposableClosed>().Error("User selected centered bike {bike} but reserving failed. {@exception}", SelectedBike, exception);
await ViewService.DisplayAlert(
AppResources.MessageReservingBikeErrorGeneralTitle,

View file

@ -1,4 +1,4 @@
using System;
using System;
using System.Threading.Tasks;
using Serilog;
using TINK.Model.Bikes.BikeInfoNS.CopriLock;
@ -46,7 +46,7 @@ namespace TINK.ViewModel.Bikes.Bike.CopriLock.RequestHandler
/// <summary> Open bike and update COPRI lock state. </summary>
public async Task<IRequestHandler> HandleRequestOption2() => await GiveFeedback();
/// <summary> Requst is not supported, button should be disabled. </summary>
/// <summary> Request is not supported, button should be disabled. </summary>
/// <returns></returns>
public async Task<IRequestHandler> UnsupportedRequest()
{
@ -110,7 +110,7 @@ namespace TINK.ViewModel.Bikes.Bike.CopriLock.RequestHandler
if (SelectedBike?.BookingFinishedModel?.MiniSurvey?.Questions?.Count > 0)
{
// No need to restrart polling again because different page is shown.
// No need to restart polling again because different page is shown.
await ViewService.PushModalAsync(ViewTypes.MiniSurvey);
}
@ -121,4 +121,4 @@ namespace TINK.ViewModel.Bikes.Bike.CopriLock.RequestHandler
return RequestHandlerFactory.Create(SelectedBike, IsConnectedDelegate, ConnectorFactory, ViewUpdateManager, SmartDevice, ViewService, BikesViewModel, ActiveUser);
}
}
}
}

View file

@ -14,11 +14,11 @@ namespace TINK.ViewModel.Bikes.Bike.CopriLock.RequestHandler
{
using IRequestHandler = BluetoothLock.IRequestHandler;
/// <summary> Bike is reserved, lock is closed and and connected to app. </summary>
/// <summary> Bike is reserved, lock is closed and connected to app. </summary>
/// <remarks>
/// Occures when
/// - biks was reserved out of reach and is in reach now
/// - bike is is reserved while in reach
/// Occurs when
/// - bike was reserved out of reach and is in reach now
/// - bike is reserved while in reach
/// </remarks>
public class ReservedClosed : Base, IRequestHandler
{
@ -85,7 +85,7 @@ namespace TINK.ViewModel.Bikes.Bike.CopriLock.RequestHandler
{
await ConnectorFactory(IsConnected).Command.DoCancelReservation(SelectedBike);
// If canceling bike succedes remove bike because it is not ready to be booked again
// If canceling bike succeeds remove bike because it is not ready to be booked again
IsRemoveBikeRequired = true;
}
catch (Exception exception)

View file

@ -11,6 +11,8 @@ namespace TINK.ViewModel.Bikes.Bike
{
private const string TRACKINGKEY = "TRACKING";
private const string RIDETYPEKEY = "AAFAHRTEN";
public TariffDescriptionViewModel(RentalDescription tariff)
{
Name = tariff?.Name ?? string.Empty;
@ -19,13 +21,17 @@ namespace TINK.ViewModel.Bikes.Bike
? new ObservableCollection<RentalDescription.TariffElement>(tariff.TariffEntries.OrderBy(x => x.Key).Select(x => x.Value))
: new ObservableCollection<RentalDescription.TariffElement>();
// Add all entires except the known entries which are kept as properties.
InfoEntries = tariff != null && tariff?.InfoEntries != null
? new ObservableCollection<string>(tariff.InfoEntries
.Where(x => x.Value.Key.ToUpper() != TRACKINGKEY)
.Where(x => x.Value.Key.ToUpper() != TRACKINGKEY
&& x.Value.Key.ToUpper() != RIDETYPEKEY)
.OrderBy(x => x.Key)
.Select(x => x.Value.Value))
: new ObservableCollection<string>();
RideTypeText = tariff?.InfoEntries != null ? tariff?.InfoEntries?.FirstOrDefault(x => x.Value.Key.ToUpper() == RIDETYPEKEY).Value?.Value ?? string.Empty : string.Empty;
TrackingInfoText = tariff?.InfoEntries != null ? tariff?.InfoEntries?.FirstOrDefault(x => x.Value.Key.ToUpper() == TRACKINGKEY).Value?.Value ?? string.Empty : string.Empty;
}
@ -44,6 +50,11 @@ namespace TINK.ViewModel.Bikes.Bike
/// </summary>
public ObservableCollection<string> InfoEntries { get; private set; }
/// <summary>
/// Holds the tracking info text or empty if not applicable.
/// </summary>
public string RideTypeText { get; private set; }
/// <summary>
/// Holds the tracking info text or empty if not applicable.
/// </summary>

View file

@ -44,7 +44,7 @@ namespace TINK.ViewModel.Bikes
/// <summary> Delegate to retrieve connected state. </summary>
protected Func<bool> IsConnectedDelegate { get; }
/// <summary>Holds whether to poll or not and the periode leght is polling is on.</summary>
/// <summary>Holds whether to poll or not and the period length is polling is on.</summary>
private TINK.Settings.PollingParameters m_oPolling;
/// <summary> Object to manage update of view model objects from Copri.</summary>
@ -61,7 +61,7 @@ namespace TINK.ViewModel.Bikes
protected override void OnPropertyChanged(PropertyChangedEventArgs p_oEventArgs) => base.OnPropertyChanged(p_oEventArgs);
/// <summary>
/// Handles events from bike viewmodel which require GUI updates.
/// Handles events from bike view model which require GUI updates.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
@ -81,16 +81,16 @@ namespace TINK.ViewModel.Bikes
/// </param>
/// <param name="p_oUser">Mail address of active user.</param>
/// <param name="isReportLevelVerbose">True if report level is verbose, false if not.</param>
/// <param name="permissions">Holds object to query location permisions.</param>
/// <param name="permissions">Holds object to query location permissions.</param>
/// <param name="bluetoothLE">Holds object to query bluetooth state.</param>
/// <param name="runtimPlatform">Specifies on which platform code is run.</param>
/// <param name="isConnectedDelegate">Returns if mobile is connected to web or not.</param>
/// <param name="connectorFactory">Connects system to copri for purposes of requesting a bike/ cancel request.</param>
/// <param name="lockService">Service to control lock retrieve info.</param>
/// <param name="p_oPolling"> Holds whether to poll or not and the periode leght is polling is on. </param>
/// <param name="p_oPolling"> Holds whether to poll or not and the period length 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>
/// <param name="viewService">Interface to actuate methodes on GUI.</param>
/// <param name="viewService">Interface to actuate methods on GUI.</param>
/// <param name="openUrlInBrowser">Delegate to open browser.</param>
public BikesViewModel(
User user,
@ -156,7 +156,7 @@ namespace TINK.ViewModel.Bikes
CollectionChanged += (sender, eventargs) =>
{
// Notify about bikes occuring/ vanishing from list.
// Notify about bikes occurring/ vanishing from list.
OnPropertyChanged(new PropertyChangedEventArgs(nameof(IsBikesListVisible)));
};
}
@ -173,7 +173,7 @@ namespace TINK.ViewModel.Bikes
{
case System.Collections.Specialized.NotifyCollectionChangedAction.Add:
// New bike avaialbe (new arrived at station or bike wased booked on a different device)
// New bike available (new arrived at station or bike was booked on a different device)
foreach (var bike in BikeCollection)
{
if (Contains(bike.Id))
@ -415,7 +415,7 @@ namespace TINK.ViewModel.Bikes
/// <summary>
/// Gets whether a bike is contained in collection of bikes.
/// </summary>
/// <param name="id">Id of bike to check existance.</param>
/// <param name="id">Id of bike to check existence.</param>
/// <returns>True if bike exists.</returns>
private bool Contains(string id)
{
@ -448,14 +448,14 @@ namespace TINK.ViewModel.Bikes
/// <summary>
/// Invoked when page is shown and starts update process.
/// </summary>
/// <param name="updateAction"> Update fuction passed as argument by child class.</param>
/// <param name="updateAction"> Update function passed as argument by child class.</param>
protected async Task OnAppearing(Action updateAction)
=> await StartUpdateTask(updateAction);
/// <summary>
/// Starts update process.
/// </summary>
/// <param name="updateAction"> Update fuction passed as argument by child class.</param>
/// <param name="updateAction"> Update function passed as argument by child class.</param>
public async Task StartUpdateTask(Action updateAction)
{
m_oViewUpdateManager = new PollingUpdateTaskManager(updateAction);