Mini survey added.

Minor fiexes.
This commit is contained in:
Oliver Hauff 2021-08-01 17:24:15 +02:00
parent ddfea49ea6
commit e321764119
73 changed files with 1628 additions and 185 deletions

View file

@ -31,11 +31,11 @@ namespace TINK.ViewModel.Bikes.Bike.BC.RequestHandler
protected ISmartDevice SmartDevice;
/// <summary>
/// Reference on view servcie to show modal notifications and to perform navigation.
/// Reference on view service to show modal notifications and to perform navigation.
/// </summary>
protected IViewService ViewService { get; }
/// <summary> Provides an connector object.</summary>
/// <summary> Provides a connector object.</summary>
protected Func<bool, IConnector> ConnectorFactory { get; }
/// <summary> Delegate to retrieve connected state. </summary>

View file

@ -25,7 +25,7 @@ namespace TINK.ViewModel.Bikes.Bike.BC.RequestHandler
public string ButtonText => AppResources.ActionReturn; // "Miete beenden"
/// <summary>
/// Reference on view servcie to show modal notifications and to perform navigation.
/// Reference on view service to show modal notifications and to perform navigation.
/// </summary>
protected IViewService ViewService { get; }

View file

@ -33,7 +33,7 @@ namespace TINK.ViewModel.Bikes.Bike.BC.RequestHandler
public string ActionText { get => BikesViewModel.ActionText; private set => BikesViewModel.ActionText = value; }
/// <summary>
/// Reference on view servcie to show modal notifications and to perform navigation.
/// Reference on view service to show modal notifications and to perform navigation.
/// </summary>
protected IViewService ViewService { get; }

View file

@ -30,11 +30,11 @@ namespace TINK.ViewModel.Bikes.Bike
protected ISmartDevice SmartDevice;
/// <summary>
/// Reference on view servcie to show modal notifications and to perform navigation.
/// Reference on view service to show modal notifications and to perform navigation.
/// </summary>
protected IViewService ViewService { get; }
/// <summary> Provides an connector object.</summary>
/// <summary> Provides a connect orobject.</summary>
protected Func<bool, IConnector> ConnectorFactory { get; }
/// <summary> Delegate to retrieve connected state. </summary>

View file

@ -15,6 +15,7 @@ using TINK.Model.User;
using Xamarin.Essentials;
using TINK.Repository.Request;
using TINK.Model.Device;
using TINK.Model.MiniSurvey;
namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
{
@ -126,10 +127,10 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
IsConnected = IsConnectedDelegate();
var feedBackUri = SelectedBike?.OperatorUri;
MiniSurveyModel miniSurvey;
try
{
await ConnectorFactory(IsConnected).Command.DoReturn(
miniSurvey = await ConnectorFactory(IsConnected).Command.DoReturn(
SelectedBike,
currentLocationDto);
@ -229,11 +230,11 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
if (exception is ResponseException copriException)
{
// Copri server is not reachable.
Log.ForContext<BookedOpen>().Information("User selected booked bike {bike} but returing failed. COPRI returned an error.", SelectedBike);
Log.ForContext<BookedOpen>().Information("Submitting feedback for bike {bike} failed. COPRI returned an error.", SelectedBike);
}
else
{
Log.ForContext<BookedOpen>().Error("User selected availalbe bike {bike} but reserving failed. {@l_oException}", SelectedBike.Id, exception);
Log.ForContext<BookedOpen>().Error("Submitting feedback for bike {bike} failed. {@l_oException}", SelectedBike.Id, exception);
}
await ViewService.DisplayAlert(
@ -250,6 +251,10 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
return RequestHandlerFactory.Create(SelectedBike, IsConnectedDelegate, ConnectorFactory, Geolocation, LockService, ViewUpdateManager, SmartDevice, ViewService, BikesViewModel, ActiveUser);
}
#endif
if (miniSurvey != null && miniSurvey.Questions.Count > 0)
{
await ViewService.PushModalAsync(ViewTypes.MiniSurvey);
}
// Restart polling again.
BikesViewModel.ActionText = AppResources.ActivityTextStartingUpdater;

View file

@ -15,6 +15,7 @@ using TINK.Model.Bikes.Bike.BluetoothLock;
using TINK.Model.User;
using TINK.Repository.Request;
using TINK.Model.Device;
using TINK.Model.MiniSurvey;
namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
{
@ -195,10 +196,10 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
IsConnected = IsConnectedDelegate();
var feedBackUri = SelectedBike?.OperatorUri;
MiniSurveyModel miniSurvey;
try
{
await ConnectorFactory(IsConnected).Command.DoReturn(
miniSurvey = await ConnectorFactory(IsConnected).Command.DoReturn(
SelectedBike,
currentLocation != null
? new LocationDto.Builder
@ -304,11 +305,11 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
if (exception is ResponseException copriException)
{
// Copri server is not reachable.
Log.ForContext<BookedOpen>().Information("User selected booked bike {bike} but returing failed. COPRI returned an error.", SelectedBike);
Log.ForContext<BookedOpen>().Information("Submitting feedback for bike {bike} failed. COPRI returned an error.", SelectedBike);
}
else
{
Log.ForContext<BookedOpen>().Error("User selected availalbe bike {bike} but reserving failed. {@l_oException}", SelectedBike.Id, exception);
Log.ForContext<BookedOpen>().Error("Submitting feedback for bike {bike} failed. {@l_oException}", SelectedBike.Id, exception);
}
await ViewService.DisplayAlert(
@ -325,6 +326,11 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
}
#endif
if (miniSurvey != null && miniSurvey.Questions.Count > 0)
{
await ViewService.PushModalAsync(ViewTypes.MiniSurvey);
}
BikesViewModel.ActionText = AppResources.ActivityTextStartingUpdater;
await ViewUpdateManager().StartUpdateAyncPeridically();
BikesViewModel.ActionText = string.Empty;

View file

@ -34,7 +34,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock
public string LockitButtonText => GetType().Name;
/// <summary>
/// Reference on view servcie to show modal notifications and to perform navigation.
/// Reference on view service to show modal notifications and to perform navigation.
/// </summary>
private IViewService ViewService { get; }

View file

@ -25,7 +25,7 @@ namespace TINK.ViewModel.Bikes
protected ISmartDevice SmartDevice;
/// <summary>
/// Reference on view servcie to show modal notifications and to perform navigation.
/// Reference on view service to show modal notifications and to perform navigation.
/// </summary>
protected IViewService ViewService { get; }
@ -34,12 +34,12 @@ namespace TINK.ViewModel.Bikes
/// </summary>
private Exception m_oException;
/// <summary> Provides an connector object.</summary>
/// <summary> Provides a connector object.</summary>
protected Func<bool, IConnector> ConnectorFactory { get; }
protected IGeolocation Geolocation { get; }
/// <summary> Provides an connector object.</summary>
/// <summary> Provides a connector object.</summary>
protected ILocksService LockService { get; }
/// <summary> Delegate to retrieve connected state. </summary>
@ -88,7 +88,7 @@ namespace TINK.ViewModel.Bikes
/// <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>
/// <param name="p_oViewService">Interface to actuate methodes on GUI.</param>
/// <param name="viewService">Interface to actuate methodes on GUI.</param>
public BikesViewModel(
User user,
IPermissions permissions,