mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2025-06-21 21:46:27 +02:00
Version 3.0.363
This commit is contained in:
parent
4ff3307997
commit
91d42552c7
212 changed files with 1799 additions and 1318 deletions
|
@ -3,7 +3,7 @@ using System.Collections.Generic;
|
|||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using Serilog;
|
||||
using TINK.Model.Station;
|
||||
using TINK.Model.Stations.StationNS;
|
||||
using BikeInfo = TINK.Model.Bikes.BikeInfoNS.BC.BikeInfo;
|
||||
using BikeInfoMutable = TINK.Model.Bikes.BikeInfoNS.BC.BikeInfoMutable;
|
||||
|
||||
|
@ -25,7 +25,7 @@ namespace TINK.Model.Bikes
|
|||
/// </summary>
|
||||
/// <param name="bikesAll"> Object holding bikes info from copri to update from. Holds station id but not station name.</param>
|
||||
/// <param name="stations"> All stations to get station names from.</param>
|
||||
/// <param name="p_oDateTimeProvider">Provices date time information.</param>
|
||||
/// <param name="p_oDateTimeProvider">Provides date time information.</param>
|
||||
public void Update(
|
||||
IEnumerable<BikeInfo> bikesAll,
|
||||
IEnumerable<IStation> stations)
|
||||
|
@ -74,18 +74,18 @@ namespace TINK.Model.Bikes
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a new bike to collecion of bike.
|
||||
/// Adds a new bike to collection of bike.
|
||||
/// </summary>
|
||||
/// <param name="newBike">New bike to add.</param>
|
||||
/// <exception cref="Exception">Thrown if bike is not unique.</exception>
|
||||
public new void Add(BikeInfoMutable newBike)
|
||||
{
|
||||
// Ensure that bike id of new bike is is unique
|
||||
// Ensure that bike id of new bike is unique
|
||||
foreach (BikeInfoMutable bike in Items)
|
||||
{
|
||||
if (bike.Id == newBike.Id)
|
||||
{
|
||||
throw new Exception(string.Format("Can not add bike with {0} to collection ob bike. Id is not unnique.", newBike));
|
||||
throw new Exception(string.Format("Can not add bike with {0} to collection ob bike. Id is not unique.", newBike));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,7 @@ namespace TINK.Model.Bikes
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Bike selected by user for regerving or cancel reservation.
|
||||
/// Bike selected by user for reserving or cancel reservation.
|
||||
/// </summary>
|
||||
public BikeInfoMutable SelectedBike
|
||||
{
|
||||
|
@ -115,7 +115,7 @@ namespace TINK.Model.Bikes
|
|||
=> this.FirstOrDefault(bike => bike.Id == id);
|
||||
|
||||
/// <summary>
|
||||
/// Deteermines whether a bike by given key exists.
|
||||
/// Determines whether a bike by given key exists.
|
||||
/// </summary>
|
||||
/// <param name="p_strKey">Key to check.</param>
|
||||
/// <returns>True if bike exists.</returns>
|
||||
|
|
|
@ -6,7 +6,7 @@ using TINK.Model.State;
|
|||
|
||||
namespace TINK.Model.Bikes.BikeInfoNS.BC
|
||||
{
|
||||
public class BikeInfo : IBikeInfo
|
||||
public abstract class BikeInfo : IBikeInfo
|
||||
{
|
||||
/// <summary> Default value of demo property. </summary>
|
||||
public const bool DEFAULTVALUEISDEMO = false;
|
||||
|
@ -64,72 +64,6 @@ namespace TINK.Model.Bikes.BikeInfoNS.BC
|
|||
bikeInfo.TariffDescription)
|
||||
{ }
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a bike info object for a available bike.
|
||||
/// </summary>
|
||||
/// <param name="dataSource">Specified the source of the data.</param>
|
||||
/// <param name="stationId">Id of station where bike is located.</param>
|
||||
/// <param name="operatorUri">Holds the uri of the operator or null, in case of single operator setup.</param>
|
||||
/// <param name="tariffDescription">Hold tariff description of bike.</param>
|
||||
public BikeInfo(
|
||||
Bike bike,
|
||||
Drive drive,
|
||||
DataSource dataSource,
|
||||
string stationId,
|
||||
Uri operatorUri = null,
|
||||
RentalDescription tariffDescription = null,
|
||||
bool? isDemo = DEFAULTVALUEISDEMO,
|
||||
IEnumerable<string> group = null) : this(
|
||||
new StateInfo(),
|
||||
bike,
|
||||
drive,
|
||||
dataSource,
|
||||
isDemo,
|
||||
group,
|
||||
stationId,
|
||||
operatorUri,
|
||||
tariffDescription)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a bike info object for a booked bike.
|
||||
/// </summary>
|
||||
/// <param name="dataSource">Specified the source of the data.</param>
|
||||
/// <param name="dateTimeProvider">Provider for current date time to calculate remainig time on demand for state of type reserved.</param>
|
||||
/// <param name="currentStationId">Name of station where bike is located, null if bike is on the road.</param>
|
||||
/// <param name="operatorUri">Holds the uri of the operator or null, in case of single operator setup.</param>
|
||||
/// <param name="tariffDescription">Hold tariff description of bike.</param>
|
||||
/// <param name="bookedAt">Date time when bike was booked</param>
|
||||
/// <param name="mailAddress">Mail address of user which booked bike.</param>
|
||||
/// <param name="code">Booking code.</param>
|
||||
public BikeInfo(
|
||||
Bike bike,
|
||||
Drive drive,
|
||||
DataSource dataSource,
|
||||
bool? isDemo,
|
||||
IEnumerable<string> group,
|
||||
string currentStationId,
|
||||
Uri operatorUri,
|
||||
RentalDescription tariffDescription,
|
||||
DateTime bookedAt,
|
||||
string mailAddress,
|
||||
string code) : this(
|
||||
new StateInfo(
|
||||
bookedAt,
|
||||
mailAddress,
|
||||
code),
|
||||
bike,
|
||||
drive,
|
||||
dataSource,
|
||||
isDemo,
|
||||
group,
|
||||
currentStationId,
|
||||
operatorUri,
|
||||
tariffDescription)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary> True if device is demo device, false otherwise. </summary>
|
||||
public bool IsDemo { get; }
|
||||
|
||||
|
@ -141,7 +75,7 @@ namespace TINK.Model.Bikes.BikeInfoNS.BC
|
|||
/// </summary>
|
||||
public string StationId { get; }
|
||||
|
||||
/// <summary> Holds description about the tarif. </summary>
|
||||
/// <summary> Holds description about the tariff. </summary>
|
||||
public RentalDescription TariffDescription { get; }
|
||||
|
||||
/// Holds the rent state of the bike.
|
||||
|
|
|
@ -9,7 +9,7 @@ using TINK.Model.State;
|
|||
namespace TINK.Model.Bikes.BikeInfoNS.BC
|
||||
{
|
||||
[DataContract]
|
||||
public class BikeInfoMutable : IBikeInfoMutable, INotifyPropertyChanged
|
||||
public abstract class BikeInfoMutable : IBikeInfoMutable, INotifyPropertyChanged
|
||||
{
|
||||
/// <summary> Holds the bike. </summary>
|
||||
private readonly Bike _Bike;
|
||||
|
@ -24,7 +24,7 @@ namespace TINK.Model.Bikes.BikeInfoNS.BC
|
|||
/// Constructs a bike.
|
||||
/// </summary>
|
||||
/// <param name="isDemo">True if device is demo device, false otherwise.</param>
|
||||
/// <param name="dateTimeProvider">Provider for current date time to calculate remainig time on demand for state of type reserved.</param>
|
||||
/// <param name="dateTimeProvider">Provider for current date time to calculate remaining time on demand for state of type reserved.</param>
|
||||
/// <param name="stationId">Name of station where bike is located, null if bike is on the road.</param>
|
||||
/// <param name="operatorUri">Holds the uri of the operator or null, in case of single operator setup.</param>
|
||||
/// <param name="tariffDescription">Hold tariff description of bike.</param>
|
||||
|
@ -55,24 +55,6 @@ namespace TINK.Model.Bikes.BikeInfoNS.BC
|
|||
TariffDescription = tariffDescription;
|
||||
}
|
||||
|
||||
/// <summary> Constructs a bike object from source. </summary>
|
||||
public BikeInfoMutable(IBikeInfo bike, string stationName) : this(
|
||||
bike != null
|
||||
? bike.Bike
|
||||
: throw new ArgumentNullException(nameof(bike)),
|
||||
bike.Drive,
|
||||
bike.DataSource,
|
||||
bike.IsDemo,
|
||||
bike.Group,
|
||||
bike.StationId,
|
||||
stationName,
|
||||
bike.OperatorUri,
|
||||
bike.TariffDescription,
|
||||
null /* date time provider */,
|
||||
bike.State)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary> Id of station a which bike is located, null otherwise.</summary>
|
||||
[DataMember]
|
||||
public string StationId { get; }
|
||||
|
@ -81,7 +63,7 @@ namespace TINK.Model.Bikes.BikeInfoNS.BC
|
|||
[DataMember]
|
||||
public string StationName { get; }
|
||||
|
||||
/// <summary> Holds description about the tarif. </summary>
|
||||
/// <summary> Holds description about the tariff. </summary>
|
||||
[DataMember]
|
||||
public RentalDescription TariffDescription { get; private set; }
|
||||
|
||||
|
@ -113,6 +95,12 @@ namespace TINK.Model.Bikes.BikeInfoNS.BC
|
|||
|
||||
public TypeOfBike? TypeOfBike => _Bike.TypeOfBike;
|
||||
|
||||
/// <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 LockModel LockModel => _Bike.LockModel;
|
||||
|
||||
public string Description => _Bike.Description;
|
||||
|
|
|
@ -30,6 +30,11 @@ namespace TINK.Model.Bikes.BikeInfoNS.BC
|
|||
/// </summary>
|
||||
TypeOfBike? TypeOfBike { get; }
|
||||
|
||||
/// <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>
|
||||
AaRideType? AaRideType { get; }
|
||||
|
||||
/// <summary> Gets the model of the lock. </summary>
|
||||
LockModel LockModel { get; }
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace TINK.Model.Bikes.BikeInfoNS.BikeNS
|
||||
|
@ -21,12 +21,19 @@ namespace TINK.Model.Bikes.BikeInfoNS.BikeNS
|
|||
City = 2,
|
||||
}
|
||||
|
||||
/// <summary> Holds 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 enum AaRideType
|
||||
{
|
||||
NoAaRide = 0,
|
||||
AaRide = 1,
|
||||
}
|
||||
|
||||
/// <summary> Holds the model of lock. </summary>
|
||||
public enum LockModel
|
||||
{
|
||||
ILockIt, // haveltec GbmH Brandenburg, Germany bluetooth lock
|
||||
BordComputer, // Teilrad BC
|
||||
Sigo, // Sigo Gmbh Darmstadt, Germany bike lock
|
||||
BordComputer, // TeilRad BC
|
||||
Sigo, // Sigo GmbH Darmstadt, Germany bike lock
|
||||
}
|
||||
|
||||
/// <summary> Holds the type of lock. </summary>
|
||||
|
@ -47,10 +54,12 @@ namespace TINK.Model.Bikes.BikeInfoNS.BikeNS
|
|||
LockModel lockModel,
|
||||
WheelType? wheelType = null,
|
||||
TypeOfBike? typeOfBike = null,
|
||||
AaRideType? aaRideType = null,
|
||||
string description = null)
|
||||
{
|
||||
WheelType = wheelType;
|
||||
TypeOfBike = typeOfBike;
|
||||
AaRideType = aaRideType;
|
||||
LockModel = lockModel;
|
||||
Id = id;
|
||||
Description = description;
|
||||
|
@ -71,6 +80,11 @@ namespace TINK.Model.Bikes.BikeInfoNS.BikeNS
|
|||
/// </summary>
|
||||
public TypeOfBike? TypeOfBike { get; }
|
||||
|
||||
/// <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 { get; }
|
||||
|
||||
/// <summary> Gets the model of the lock. </summary>
|
||||
public LockModel LockModel { get; private set; }
|
||||
|
||||
|
|
|
@ -33,9 +33,10 @@ namespace TINK.Model.Bikes.BikeInfoNS.BluetoothLock
|
|||
bike != null
|
||||
? new Bike(
|
||||
bike.Id,
|
||||
LockModel.ILockIt /* Ensure consistend lock model value */,
|
||||
LockModel.ILockIt /* Ensure consistent lock model value */,
|
||||
bike.WheelType,
|
||||
bike.TypeOfBike,
|
||||
bike.AaRideType,
|
||||
bike.Description)
|
||||
: throw new ArgumentNullException(nameof(bike)),
|
||||
drive,
|
||||
|
@ -53,7 +54,7 @@ namespace TINK.Model.Bikes.BikeInfoNS.BluetoothLock
|
|||
/// Constructs a bike info object for a requested bike.
|
||||
/// </summary>
|
||||
/// <param name="dataSource">Specified the source of the data.</param>
|
||||
/// <param name="dateTimeProvider">Provider for current date time to calculate remainig time on demand for state of type reserved.</param>
|
||||
/// <param name="dateTimeProvider">Provider for current date time to calculate remaining time on demand for state of type reserved.</param>
|
||||
/// <param name="lockId">Id of the lock.</param>
|
||||
/// <param name="lockGuid">GUID specifying the lock.</param>
|
||||
/// <param name="requestedAt">Date time when bike was requested</param>
|
||||
|
@ -61,7 +62,7 @@ namespace TINK.Model.Bikes.BikeInfoNS.BluetoothLock
|
|||
/// <param name="currentStationId">Name of station where bike is located, null if bike is on the road.</param>
|
||||
/// <param name="operatorUri">Holds the uri of the operator or null, in case of single operator setup.</param>
|
||||
/// <param name="tariffDescription">Hold tariff description of bike.</param>
|
||||
/// <param name="dateTimeProvider">Date time provider to calculate reaining time.</param>
|
||||
/// <param name="dateTimeProvider">Date time provider to calculate remaining time.</param>
|
||||
public BikeInfo(
|
||||
Bike bike,
|
||||
Drive drive,
|
||||
|
@ -87,9 +88,10 @@ namespace TINK.Model.Bikes.BikeInfoNS.BluetoothLock
|
|||
bike != null
|
||||
? new Bike(
|
||||
bike.Id,
|
||||
LockModel.ILockIt /* Ensure consistend lock model value */,
|
||||
LockModel.ILockIt /* Ensure consistent lock model value */,
|
||||
bike.WheelType,
|
||||
bike.TypeOfBike,
|
||||
bike.AaRideType,
|
||||
bike.Description)
|
||||
: throw new ArgumentNullException(nameof(bike)),
|
||||
drive,
|
||||
|
@ -139,9 +141,10 @@ namespace TINK.Model.Bikes.BikeInfoNS.BluetoothLock
|
|||
bike != null
|
||||
? new Bike(
|
||||
bike.Id,
|
||||
LockModel.ILockIt /* Ensure consistend lock model value */,
|
||||
LockModel.ILockIt /* Ensure consistent lock model value */,
|
||||
bike.WheelType,
|
||||
bike.TypeOfBike,
|
||||
bike.AaRideType,
|
||||
bike.Description)
|
||||
: throw new ArgumentNullException(),
|
||||
drive,
|
||||
|
@ -155,7 +158,7 @@ namespace TINK.Model.Bikes.BikeInfoNS.BluetoothLock
|
|||
LockInfo = new LockInfo.Builder { Id = lockId, Guid = lockGuid, UserKey = userKey, AdminKey = adminKey, Seed = seed }.Build();
|
||||
}
|
||||
|
||||
public BikeInfo(Model.Bikes.BikeInfoNS.BC.BikeInfo bikeInfo, LockInfo lockInfo) : base(
|
||||
public BikeInfo(BC.BikeInfo bikeInfo, LockInfo lockInfo) : base(
|
||||
bikeInfo ?? throw new ArgumentException($"Can not copy-construct {typeof(BikeInfo).Name}-object. Source bike info must not be null."))
|
||||
{
|
||||
LockInfo = lockInfo
|
||||
|
|
|
@ -38,8 +38,9 @@ namespace TINK.Model.Bikes.BikeInfoNS.CopriLock
|
|||
? new Bike(
|
||||
bike.Id,
|
||||
LockModel.Sigo,
|
||||
bike.WheelType /* Ensure consistend lock model value */,
|
||||
bike.WheelType /* Ensure consistent lock model value */,
|
||||
bike.TypeOfBike,
|
||||
bike.AaRideType,
|
||||
bike.Description)
|
||||
: throw new ArgumentNullException(nameof(bike)),
|
||||
drive,
|
||||
|
@ -66,7 +67,7 @@ namespace TINK.Model.Bikes.BikeInfoNS.CopriLock
|
|||
/// <param name="lockInfo">Lock info.</param>
|
||||
/// <param name="operatorUri">Holds the uri of the operator or null, in case of single operator setup.</param>
|
||||
/// <param name="tariffDescription">Hold tariff description of bike.</param>
|
||||
/// <param name="dateTimeProvider">Provider for current date time to calculate remainig time on demand for state of type reserved.</param>
|
||||
/// <param name="dateTimeProvider">Provider for current date time to calculate remaining time on demand for state of type reserved.</param>
|
||||
public BikeInfo(
|
||||
Bike bike,
|
||||
Drive drive,
|
||||
|
@ -88,9 +89,10 @@ namespace TINK.Model.Bikes.BikeInfoNS.CopriLock
|
|||
bike != null
|
||||
? new Bike(
|
||||
bike.Id,
|
||||
LockModel.Sigo /* Ensure consistend lock model value */,
|
||||
LockModel.Sigo /* Ensure consistent lock model value */,
|
||||
bike.WheelType,
|
||||
bike.TypeOfBike,
|
||||
bike.AaRideType,
|
||||
bike.Description)
|
||||
: throw new ArgumentNullException(nameof(bike)),
|
||||
drive,
|
||||
|
@ -136,9 +138,10 @@ namespace TINK.Model.Bikes.BikeInfoNS.CopriLock
|
|||
bike != null
|
||||
? new Bike(
|
||||
bike.Id,
|
||||
LockModel.Sigo /* Ensure consistend lock model value */,
|
||||
LockModel.Sigo /* Ensure consistent lock model value */,
|
||||
bike.WheelType,
|
||||
bike.TypeOfBike,
|
||||
bike.AaRideType,
|
||||
bike.Description)
|
||||
: throw new ArgumentNullException(nameof(bike)),
|
||||
drive,
|
||||
|
|
|
@ -35,7 +35,7 @@ namespace TINK.Model.Bikes.BikeInfoNS.CopriLock
|
|||
return;
|
||||
}
|
||||
|
||||
// Add a dummy querry. Querries are not yet read from COPRI but compiled into the app.
|
||||
// Add a dummy query. Querries are not yet read from COPRI but compiled into the app.
|
||||
BookingFinishedModel.MiniSurvey.Questions.Add("q1", new MiniSurvey.QuestionModel());
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using Serilog;
|
||||
using Serilog;
|
||||
|
||||
namespace TINK.Model.Bikes.BikeInfoNS.DriveNS.BatteryNS
|
||||
{
|
||||
|
@ -12,12 +12,12 @@ namespace TINK.Model.Bikes.BikeInfoNS.DriveNS.BatteryNS
|
|||
public double CurrentChargePercent { get; private set; } = double.NaN;
|
||||
|
||||
/// <summary>
|
||||
/// Holds the current chargeing level of the battery in bars, null if unkonwn.
|
||||
/// Holds the current charging level of the battery in bars, null if unknown.
|
||||
/// </summary>
|
||||
public int? CurrentChargeBars { get; private set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// Holds the maximum chargeing level of the battery in bars, null if unkonwn.
|
||||
/// Holds the maximum charging level of the battery in bars, null if unknown.
|
||||
/// </summary>
|
||||
public int? MaxChargeBars { get; private set; } = null;
|
||||
|
||||
|
@ -34,12 +34,12 @@ namespace TINK.Model.Bikes.BikeInfoNS.DriveNS.BatteryNS
|
|||
public class Builder
|
||||
{
|
||||
/// <summary>
|
||||
/// Holds the current chargeing level of the battery in bars.
|
||||
/// Holds the current charging level of the battery in bars.
|
||||
/// </summary>
|
||||
public int? CurrentChargeBars { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// Holds the maximum chargeing level of the battery in bars.
|
||||
/// Holds the maximum charging level of the battery in bars.
|
||||
/// </summary>
|
||||
public int? MaxChargeBars { get; set; } = null;
|
||||
|
||||
|
@ -83,7 +83,7 @@ namespace TINK.Model.Bikes.BikeInfoNS.DriveNS.BatteryNS
|
|||
&& MaxChargeBars == null)
|
||||
{
|
||||
// If current charge bars is set, max charge must be set as well.
|
||||
Log.ForContext<Battery>().Error($"Current bars value can not be set to {CurrentChargeBars} if max bars is not se.");
|
||||
Log.ForContext<Battery>().Error($"Current bars value can not be set to {CurrentChargeBars} if max bars is not set.");
|
||||
CurrentChargeBars = null;
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ namespace TINK.Model.Bikes.BikeInfoNS.DriveNS.BatteryNS
|
|||
&& CurrentChargeBars > MaxChargeBars)
|
||||
{
|
||||
// If current charge bars must never be larger than max charge bars.
|
||||
Log.ForContext<Battery>().Error($"Invalid current bars value {CurrentChargeBars} detected. Value must never be largen than max value bars {MaxChargeBars}.");
|
||||
Log.ForContext<Battery>().Error($"Invalid current bars value {CurrentChargeBars} detected. Value must never be larger than max value bars {MaxChargeBars}.");
|
||||
CurrentChargeBars = null;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
|
||||
|
||||
namespace TINK.Model.Bikes.BikeInfoNS.DriveNS.BatteryNS
|
||||
{
|
||||
public interface IBattery
|
||||
|
@ -9,12 +9,12 @@ namespace TINK.Model.Bikes.BikeInfoNS.DriveNS.BatteryNS
|
|||
double CurrentChargePercent { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Holds the current chargeing level of the battery in bars. Must not be arger than MaxChargeBars, null if unkonwn.
|
||||
/// Holds the current charging level of the battery in bars. Must not be larger than MaxChargeBars, null if unknown.
|
||||
/// </summary>
|
||||
int? CurrentChargeBars { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Holds the maximum chargeing level of the battery in bars, null if unkonwn.
|
||||
/// Holds the maximum charging level of the battery in bars, null if unknown.
|
||||
/// </summary>
|
||||
int? MaxChargeBars { get; }
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace TINK.Model.Bikes
|
||||
{
|
||||
|
@ -12,7 +12,7 @@ namespace TINK.Model.Bikes
|
|||
T GetById(string id);
|
||||
|
||||
/// <summary>
|
||||
/// Deteermines whether a bike by given key exists.
|
||||
/// Determines whether a bike by given key exists.
|
||||
/// </summary>
|
||||
/// <param name="p_strKey">Key to check.</param>
|
||||
/// <returns>True if bike exists.</returns>
|
||||
|
@ -27,7 +27,7 @@ namespace TINK.Model.Bikes
|
|||
void RemoveById(string id);
|
||||
|
||||
/// <summary>
|
||||
/// Adds a new element to dictinary.
|
||||
/// Adds a new element to dictionary.
|
||||
/// </summary>
|
||||
/// <param name="newElement">New element to add.</param>
|
||||
void Add(T newElement);
|
||||
|
|
|
@ -129,7 +129,7 @@ namespace TINK.Model.Connector
|
|||
string BikeId { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Holds the current chargeing level of the battery in bars, null if unkonwn.
|
||||
/// Holds the current charging level of the battery in bars, null if unknown.
|
||||
/// </summary>
|
||||
int? CurrentChargeBars { get; set; }
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
|
||||
|
||||
namespace TINK.Model.Connector
|
||||
{
|
||||
#if USCSHARP9
|
||||
|
@ -18,7 +18,7 @@ namespace TINK.Model.Connector
|
|||
public string BikeId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Holds the current chargeing level of the battery in bars, null if unkonwn.
|
||||
/// Holds the current charging level of the battery in bars, null if unknown.
|
||||
/// </summary>
|
||||
public int? CurrentChargeBars { get; set; }
|
||||
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using TINK.Model.Bikes;
|
||||
using TINK.Model.Connector.Filter;
|
||||
using TINK.Model.Services.CopriApi;
|
||||
using TINK.Model.Station;
|
||||
|
||||
using TINK.Model.Stations;
|
||||
using TINK.Model.Stations.StationNS;
|
||||
using BikeInfo = TINK.Model.Bikes.BikeInfoNS.BC.BikeInfo;
|
||||
|
||||
namespace TINK.Model.Connector
|
||||
{
|
||||
/// <summary> Filters connector respones.</summary>
|
||||
/// <summary> Filters connector responses.</summary>
|
||||
/// <remarks>Former name: Filter</remarks>
|
||||
public class FilteredConnector : IFilteredConnector
|
||||
{
|
||||
|
@ -50,7 +50,7 @@ namespace TINK.Model.Connector
|
|||
/// <summary> Holds the filter. </summary>
|
||||
private IGroupFilter Filter { get; }
|
||||
|
||||
/// <summary> Holds the reference to object which performs copry queries.</summary>
|
||||
/// <summary> Holds the reference to object which performs copri queries.</summary>
|
||||
private IQuery m_oInnerQuery;
|
||||
|
||||
/// <summary> Constructs a query object.</summary>
|
||||
|
@ -111,7 +111,7 @@ namespace TINK.Model.Connector
|
|||
return bikes.Where(x => filter.DoFilter(x.Group).Count() > 0).ToDictionary(x => x.Id);
|
||||
}
|
||||
|
||||
/// <summary> Filter stations by broup. </summary>
|
||||
/// <summary> Filter stations by group. </summary>
|
||||
/// <returns></returns>
|
||||
private static Dictionary<string, IStation> DoFilter(StationDictionary stations, IGroupFilter filter)
|
||||
{
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using TINK.Model.Bikes;
|
||||
using TINK.Model.Services.CopriApi;
|
||||
using TINK.Model.Station;
|
||||
|
||||
using TINK.Model.Stations;
|
||||
using TINK.Model.Stations.StationNS;
|
||||
using BikeInfo = TINK.Model.Bikes.BikeInfoNS.BC.BikeInfo;
|
||||
|
||||
namespace TINK.Model.Connector
|
||||
{
|
||||
/// <summary> Filters connector respones.</summary>
|
||||
/// <summary> Filters connector responses.</summary>
|
||||
public class NullFilterConnector : IFilteredConnector
|
||||
{
|
||||
/// <summary> Constructs a filter object. </summary>
|
||||
|
@ -44,7 +44,7 @@ namespace TINK.Model.Connector
|
|||
/// <summary> Object to perform filtered queries.</summary>
|
||||
private class QueryProvider : IQuery
|
||||
{
|
||||
/// <summary> Holds the reference to object which performs copry queries.</summary>
|
||||
/// <summary> Holds the reference to object which performs copri queries.</summary>
|
||||
private IQuery m_oInnerQuery;
|
||||
|
||||
/// <summary> Constructs a query object.</summary>
|
||||
|
@ -100,7 +100,7 @@ namespace TINK.Model.Connector
|
|||
return bikes.Where(x => x.Group.Intersect(filter).Count() > 0).ToDictionary(x => x.Id);
|
||||
}
|
||||
|
||||
/// <summary> Filter stations by broup. </summary>
|
||||
/// <summary> Filter stations by group. </summary>
|
||||
/// <returns></returns>
|
||||
public static Dictionary<string, IStation> DoFilter(StationDictionary stations, IEnumerable<string> p_oFilter)
|
||||
{
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace TINK.Model.Connector
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary> Gets all stations including postions and bikes.</summary>
|
||||
/// <summary> Gets all stations including positions and bikes.</summary>
|
||||
public async Task<Result<StationsAndBikesContainer>> GetBikesAndStationsAsync()
|
||||
{
|
||||
var resultStations = await server.GetStations();
|
||||
|
@ -73,7 +73,7 @@ namespace TINK.Model.Connector
|
|||
/// <returns>Collection of bikes.</returns>
|
||||
public async Task<Result<BikeCollection>> GetBikesOccupiedAsync()
|
||||
{
|
||||
Log.ForContext<CachedQuery>().Error("Unexpected call to get be bikes occpied detected. No user is logged in.");
|
||||
Log.ForContext<CachedQuery>().Error("Unexpected call to get be bikes occupied detected. No user is logged in.");
|
||||
|
||||
return new Result<BikeCollection>(
|
||||
typeof(CopriCallsMonkeyStore),
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace TINK.Model.Connector
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary> Gets all stations including postions.</summary>
|
||||
/// <summary> Gets all stations including positions.</summary>
|
||||
public async Task<Result<StationsAndBikesContainer>> GetBikesAndStationsAsync()
|
||||
{
|
||||
var stationsResponse = await Server.GetStations();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System.Threading.Tasks;
|
||||
using System.Threading.Tasks;
|
||||
using TINK.Model.Bikes;
|
||||
using TINK.Model.Services.CopriApi;
|
||||
|
||||
|
@ -6,7 +6,7 @@ namespace TINK.Model.Connector
|
|||
{
|
||||
public interface IQuery
|
||||
{
|
||||
/// <summary> Gets all stations including postions.</summary>
|
||||
/// <summary> Gets all stations including positions.</summary>
|
||||
Task<Result<StationsAndBikesContainer>> GetBikesAndStationsAsync();
|
||||
|
||||
/// <summary> Gets bikes occupied is a user is logged in. </summary>
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace TINK.Model.Connector
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary> Gets all stations including postions.</summary>
|
||||
/// <summary> Gets all stations including positions.</summary>
|
||||
public async Task<Result<StationsAndBikesContainer>> GetBikesAndStationsAsync()
|
||||
{
|
||||
var stationsAllResponse = await server.GetStationsAsync();
|
||||
|
@ -44,7 +44,7 @@ namespace TINK.Model.Connector
|
|||
/// <returns>Collection of bikes.</returns>
|
||||
public async Task<Result<BikeCollection>> GetBikesOccupiedAsync()
|
||||
{
|
||||
Log.ForContext<Query>().Error("Unexpected call to get be bikes occpied detected. No user is logged in.");
|
||||
Log.ForContext<Query>().Error("Unexpected call to get be bikes occupied detected. No user is logged in.");
|
||||
return new Result<BikeCollection>(
|
||||
typeof(CopriCallsMonkeyStore),
|
||||
await Task.FromResult(new BikeCollection(new Dictionary<string, BikeInfo>())),
|
||||
|
|
|
@ -30,7 +30,7 @@ namespace TINK.Model.Connector
|
|||
server = copriServer as ICopriServer;
|
||||
}
|
||||
|
||||
/// <summary> Gets all stations including postions.</summary>
|
||||
/// <summary> Gets all stations including positions.</summary>
|
||||
public async Task<Result<StationsAndBikesContainer>> GetBikesAndStationsAsync()
|
||||
{
|
||||
var stationResponse = await server.GetStationsAsync();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
|
@ -9,6 +9,7 @@ using TINK.Model.Services.CopriApi.ServerUris;
|
|||
using TINK.Model.State;
|
||||
using TINK.Repository.Exception;
|
||||
using TINK.Repository.Response;
|
||||
using TINK.Repository.Response.Stations.Station;
|
||||
|
||||
namespace TINK.Model.Connector
|
||||
{
|
||||
|
@ -26,7 +27,7 @@ namespace TINK.Model.Connector
|
|||
/// </summary>
|
||||
/// <param name="stationInfo">Object to get information from.</param>
|
||||
/// <returns>Position information.</returns>
|
||||
public static IPosition GetPosition(this StationsAvailableResponse.StationInfo stationInfo)
|
||||
public static IPosition GetPosition(this StationInfo stationInfo)
|
||||
=> GetPosition(stationInfo.gps);
|
||||
|
||||
/// <summary> Gets the position from StationInfo object. </summary>
|
||||
|
@ -52,14 +53,14 @@ namespace TINK.Model.Connector
|
|||
if (group == null || group.Length == 0)
|
||||
{
|
||||
// If not logged in stations groups are empty form COPRI version v4.1.
|
||||
Log.Debug("Can not get goup form string. Group text can not be null.");
|
||||
Log.Debug("Can not get group form string. Group text can not be null.");
|
||||
return new List<string>();
|
||||
}
|
||||
|
||||
return new HashSet<string>(group).ToList();
|
||||
}
|
||||
|
||||
/// <summary> Gets if user acknowldged ags or not. </summary>
|
||||
/// <summary> Gets if user acknowledged AGBs or not. </summary>
|
||||
/// <param name="authorizationResponse">Object to get information from.</param>
|
||||
/// <returns>Position information.</returns>
|
||||
public static bool GetIsAgbAcknowledged(this AuthorizationResponse authorizationResponse)
|
||||
|
@ -77,7 +78,7 @@ namespace TINK.Model.Connector
|
|||
/// <summary> Gets the position from StationInfo object. </summary>
|
||||
/// <param name="stationInfo">Object to get information from.</param>
|
||||
/// <returns>Position information.</returns>
|
||||
public static IEnumerable<string> GetGroup(this StationsAvailableResponse.StationInfo stationInfo)
|
||||
public static IEnumerable<string> GetGroup(this StationInfo stationInfo)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -297,8 +298,19 @@ namespace TINK.Model.Connector
|
|||
? typeOfBike
|
||||
: (TypeOfBike?)null;
|
||||
|
||||
/// <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>
|
||||
/// <param name="bikeInfo">Object to get AA info from.</param>
|
||||
/// <returns>AA info.</returns>
|
||||
public static AaRideType? GetAaRideType(this BikeInfoBase bikeInfo)
|
||||
=> Enum.TryParse(bikeInfo?.aa_ride, true, out AaRideType aaRide)
|
||||
? aaRide
|
||||
: (AaRideType?)null;
|
||||
|
||||
|
||||
/// <summary> Get position from a ,- separated string. </summary>
|
||||
/// <param name="gps">Text to extract positon from.</param>
|
||||
/// <param name="gps">Text to extract position from.</param>
|
||||
/// <returns>Position object.</returns>
|
||||
public static IPosition GetPosition(Repository.Response.Position gps)
|
||||
=> PositionFactory.Create(
|
||||
|
@ -306,7 +318,7 @@ namespace TINK.Model.Connector
|
|||
double.TryParse(gps?.longitude, NumberStyles.Float, CultureInfo.InvariantCulture, out double longitude) ? longitude : double.NaN);
|
||||
|
||||
/// <summary> Get position from a ,- separated string. </summary>
|
||||
/// <param name="gps">Text to extract positon from.</param>
|
||||
/// <param name="gps">Text to extract position from.</param>
|
||||
/// <returns>Position object.</returns>
|
||||
public static Map.IMapSpan GetMapSpan(this MapSpan mapSpan)
|
||||
=> Map.MapSpanFactory.Create(
|
||||
|
@ -343,7 +355,7 @@ namespace TINK.Model.Connector
|
|||
/// Gets the operator Uri from response.
|
||||
/// </summary>
|
||||
/// <param name="bikeInfo"> Response to get uri from.</param>
|
||||
/// <returns>Operatore Uri</returns>
|
||||
/// <returns>Operator Uri</returns>
|
||||
public static Uri GetOperatorUri(this BikeInfoBase bikeInfo)
|
||||
{
|
||||
return bikeInfo?.uri_operator != null && !string.IsNullOrEmpty(bikeInfo?.uri_operator)
|
||||
|
@ -351,7 +363,7 @@ namespace TINK.Model.Connector
|
|||
: null;
|
||||
}
|
||||
|
||||
/// <summary> Tries to get the copriversion from response.</summary>
|
||||
/// <summary> Tries to get the copri version from response.</summary>
|
||||
/// <param name="response">Response to get version info from.</param>
|
||||
/// <returns>COPRI version</returns>
|
||||
public static bool TryGetCopriVersion(this CopriVersion response, out Version copriVersion)
|
||||
|
@ -362,7 +374,7 @@ namespace TINK.Model.Connector
|
|||
&& Version.TryParse(response.copri_version, out copriVersion);
|
||||
}
|
||||
|
||||
/// <summary> Gets the copriversion from.</summary>
|
||||
/// <summary> Gets the copri version from.</summary>
|
||||
/// <param name="response">Response to get version info from.</param>
|
||||
/// <returns>COPRI version</returns>
|
||||
public static Version GetCopriVersion(this CopriVersion response)
|
||||
|
|
|
@ -7,7 +7,6 @@ using TINK.Model.MiniSurvey;
|
|||
using TINK.Model.State;
|
||||
using TINK.Repository.Response;
|
||||
using BikeExtension = TINK.Model.Bikes.BikeInfoNS.BikeNS.BikeExtension;
|
||||
using BikeInfo = TINK.Model.Bikes.BikeInfoNS.BC.BikeInfo;
|
||||
|
||||
namespace TINK.Model.Connector.Updater
|
||||
{
|
||||
|
@ -63,7 +62,7 @@ namespace TINK.Model.Connector.Updater
|
|||
|
||||
var lockType = lockModel.HasValue
|
||||
? BikeExtension.GetLockType(lockModel.Value)
|
||||
: BikeExtension.GetLockType(DEFAULTLOCKMODEL); // Map bikes without "system"- entry in response to backend- locks.
|
||||
: BikeExtension.GetLockType(DEFAULTLOCKMODEL); // Map bikes without "system"- entry in response to back end- locks.
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -76,6 +75,7 @@ namespace TINK.Model.Connector.Updater
|
|||
LockModel.Sigo,
|
||||
bikeInfo.GetWheelType(),
|
||||
bikeInfo.GetTypeOfBike(),
|
||||
bikeInfo.GetAaRideType(),
|
||||
bikeInfo.description),
|
||||
DriveFactory.Create(bikeInfo?.bike_type),
|
||||
dataSource,
|
||||
|
@ -94,7 +94,7 @@ namespace TINK.Model.Connector.Updater
|
|||
bikeInfo.GetGroup(),
|
||||
miniSurvey: bikeInfo.user_miniquery != null
|
||||
? new MiniSurveyModel(new Dictionary<string, IQuestionModel> {
|
||||
{ "q1", new QuestionModel()} // Add a dummy querry. Querries are not yet read from COPRI but compiled into the app.
|
||||
{ "q1", new QuestionModel()} // Add a dummy query. Queries are not yet read from COPRI but compiled into the app.
|
||||
})
|
||||
: new MiniSurveyModel(),
|
||||
co2Saving: bikeInfo.co2saving);
|
||||
|
@ -106,6 +106,7 @@ namespace TINK.Model.Connector.Updater
|
|||
LockModel.ILockIt,
|
||||
bikeInfo.GetWheelType(),
|
||||
bikeInfo.GetTypeOfBike(),
|
||||
bikeInfo.GetAaRideType(),
|
||||
bikeInfo.description),
|
||||
DriveFactory.Create(bikeInfo?.bike_type),
|
||||
dataSource,
|
||||
|
@ -129,7 +130,7 @@ namespace TINK.Model.Connector.Updater
|
|||
}
|
||||
catch (ArgumentException ex)
|
||||
{
|
||||
// Contructor reported invalid arguemts (missing lock id, ....).
|
||||
// Constructor reported invalid arguments (missing lock id, ....).
|
||||
Log.Error($"Can not create new {nameof(BikeInfo)}-object from {nameof(BikeInfoAvailable)} argument. Invalid response detected. Available bike with id {bikeInfo.bike} skipped. {ex.Message}");
|
||||
return null;
|
||||
}
|
||||
|
@ -184,6 +185,7 @@ namespace TINK.Model.Connector.Updater
|
|||
LockModel.ILockIt,
|
||||
bikeInfo.GetWheelType(),
|
||||
bikeInfo.GetTypeOfBike(),
|
||||
bikeInfo.GetAaRideType(),
|
||||
bikeInfo.description),
|
||||
DriveFactory.Create(bikeInfo?.bike_type),
|
||||
dataSource,
|
||||
|
@ -214,6 +216,7 @@ namespace TINK.Model.Connector.Updater
|
|||
LockModel.Sigo,
|
||||
bikeInfo.GetWheelType(),
|
||||
bikeInfo.GetTypeOfBike(),
|
||||
bikeInfo.GetAaRideType(),
|
||||
bikeInfo.description),
|
||||
DriveFactory.Create(bikeInfo?.bike_type),
|
||||
dataSource,
|
||||
|
@ -238,7 +241,7 @@ namespace TINK.Model.Connector.Updater
|
|||
}
|
||||
catch (ArgumentException ex)
|
||||
{
|
||||
// Contructor reported invalid arguemts (missing lock id, ....).
|
||||
// Constructor reported invalid arguments (missing lock id, ....).
|
||||
Log.Error($"Can not create new {nameof(BikeInfo)}-object from {nameof(BikeInfoReservedOrBooked)} argument. Invalid response detected. Reserved bike with id {bikeInfo.bike} skipped. {ex.Message}");
|
||||
return null;
|
||||
}
|
||||
|
@ -255,6 +258,7 @@ namespace TINK.Model.Connector.Updater
|
|||
LockModel.ILockIt,
|
||||
bikeInfo.GetWheelType(),
|
||||
bikeInfo.GetTypeOfBike(),
|
||||
bikeInfo.GetAaRideType(),
|
||||
bikeInfo.description),
|
||||
DriveFactory.Create(bikeInfo?.bike_type),
|
||||
dataSource,
|
||||
|
@ -278,29 +282,8 @@ namespace TINK.Model.Connector.Updater
|
|||
bikeInfo.GetGroup());
|
||||
|
||||
case LockModel.BordComputer:
|
||||
return new BikeInfo(
|
||||
new Bike(
|
||||
bikeInfo.bike,
|
||||
LockModel.BordComputer,
|
||||
bikeInfo.GetWheelType(),
|
||||
bikeInfo.GetTypeOfBike(),
|
||||
bikeInfo.description),
|
||||
DriveFactory.Create(bikeInfo?.bike_type),
|
||||
dataSource,
|
||||
bikeInfo.GetIsDemo(),
|
||||
bikeInfo.GetGroup(),
|
||||
bikeInfo.station,
|
||||
bikeInfo.GetOperatorUri(),
|
||||
#if !NOTARIFFDESCRIPTION
|
||||
bikeInfo.rental_description != null
|
||||
? RentalDescriptionFactory.Create(bikeInfo.rental_description)
|
||||
: TariffDescriptionFactory.Create(bikeInfo.tariff_description),
|
||||
#else
|
||||
Create((TINK.Repository.Response.TariffDescription)null),
|
||||
#endif
|
||||
bikeInfo.GetFrom(),
|
||||
mailAddress,
|
||||
bikeInfo.timeCode);
|
||||
throw new NotSupportedException($"Bikes with lock model of type {lockModel} are no more supported.");
|
||||
|
||||
default:
|
||||
return new Bikes.BikeInfoNS.CopriLock.BikeInfo(
|
||||
new Bike(
|
||||
|
@ -308,6 +291,7 @@ namespace TINK.Model.Connector.Updater
|
|||
LockModel.Sigo,
|
||||
bikeInfo.GetWheelType(),
|
||||
bikeInfo.GetTypeOfBike(),
|
||||
bikeInfo.GetAaRideType(),
|
||||
bikeInfo.description),
|
||||
DriveFactory.Create(bikeInfo?.bike_type),
|
||||
DataSource.Copri,
|
||||
|
|
|
@ -1,17 +1,14 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Serilog;
|
||||
using TINK.Model.Bikes;
|
||||
using TINK.Model.Bikes.BikeInfoNS.BC;
|
||||
using TINK.Model.State;
|
||||
using TINK.Model.Station;
|
||||
using TINK.Model.Station.Operator;
|
||||
using TINK.Model.Stations;
|
||||
using TINK.Model.Stations.StationNS.Operator;
|
||||
using TINK.Model.User.Account;
|
||||
using TINK.Repository.Exception;
|
||||
using TINK.Repository.Response;
|
||||
using TINK.Repository.Response.Stations;
|
||||
using TINK.Services.CopriApi;
|
||||
using Xamarin.Forms;
|
||||
using BikeInfo = TINK.Model.Bikes.BikeInfoNS.BC.BikeInfo;
|
||||
using IBikeInfoMutable = TINK.Model.Bikes.BikeInfoNS.BC.IBikeInfoMutable;
|
||||
|
||||
namespace TINK.Model.Connector.Updater
|
||||
|
@ -31,7 +28,7 @@ namespace TINK.Model.Connector.Updater
|
|||
=> bike.State.Load(InUseStateEnum.Disposable, notifyLevel: notifyLevel);
|
||||
|
||||
/// <summary>
|
||||
/// Gets all statsion for station provider and add them into station list.
|
||||
/// Gets all station for station provider and add them into station list.
|
||||
/// </summary>
|
||||
/// <param name="p_oStationList">List of stations to update.</param>
|
||||
public static StationDictionary GetStationsAllMutable(this StationsAvailableResponse stationsAllResponse)
|
||||
|
@ -57,7 +54,7 @@ namespace TINK.Model.Connector.Updater
|
|||
string.Format("Station id {0} is not unique.", station.Value.station), stationsAllResponse);
|
||||
}
|
||||
|
||||
stations.Add(new Station.Station(
|
||||
stations.Add(new Stations.StationNS.Station(
|
||||
station.Value.station,
|
||||
station.Value.GetGroup(),
|
||||
station.Value.GetPosition(),
|
||||
|
@ -89,7 +86,7 @@ namespace TINK.Model.Connector.Updater
|
|||
new ResourceUrls(response.tariff_info_html, response.bike_info_html, response.agb_html, response.privacy_html, response.impress_html));
|
||||
|
||||
/// <summary> Gets account object from login response.</summary>
|
||||
/// <param name="merchantId">Needed to extract cookie from autorization response.</param>
|
||||
/// <param name="merchantId">Needed to extract cookie from authorization response.</param>
|
||||
/// <param name="loginResponse">Response to get session cookie and debug level from.</param>
|
||||
/// <param name="mail">Mail address needed to construct a complete account object (is not part of response).</param>
|
||||
/// <param name="password">Password needed to construct a complete account object (is not part of response).</param>
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using TINK.Model.Connector;
|
||||
using TINK.ViewModel.Map;
|
||||
using TINK.ViewModel.Settings;
|
||||
|
||||
namespace TINK.Model
|
||||
{
|
||||
/// <summary> Holds collecion of filters to filter options (TINK, Konrad, ....). </summary>
|
||||
/// <summary> Holds collection of filters to filter options (TINK, Konrad, ....). </summary>
|
||||
/// <remarks> Former name: FilterCollection.</remarks>
|
||||
public static class GroupFilterHelper
|
||||
{
|
||||
|
|
|
@ -7,7 +7,7 @@ using TINK.Model.Connector;
|
|||
using TINK.Model.Device;
|
||||
using TINK.Model.Services.CopriApi.ServerUris;
|
||||
using TINK.Model.Settings;
|
||||
using TINK.Model.Station;
|
||||
using TINK.Model.Stations.StationNS;
|
||||
using TINK.Services;
|
||||
using TINK.Services.BluetoothLock;
|
||||
using TINK.Settings;
|
||||
|
@ -46,15 +46,15 @@ namespace TINK.Model
|
|||
/// <summary> Name of the station which is selected. </summary>
|
||||
IStation SelectedStation { get; set; }
|
||||
|
||||
/// <summary>Polling periode.</summary>
|
||||
/// <summary>Polling period.</summary>
|
||||
PollingParameters Polling { get; set; }
|
||||
|
||||
TimeSpan ExpiresAfter { get; set; }
|
||||
|
||||
/// <summary> Holds status about whants new page. </summary>
|
||||
/// <summary> Holds status about whats new page. </summary>
|
||||
WhatsNew WhatsNew { get; }
|
||||
|
||||
/// <summary> Gets whether device is connected to internet or not. </summary>
|
||||
/// <summary> Gets whether device is connected to Internet or not. </summary>
|
||||
bool GetIsConnected();
|
||||
|
||||
/// <summary> Action to post to GUI thread.</summary>
|
||||
|
@ -69,7 +69,7 @@ namespace TINK.Model
|
|||
/// <summary>Settings determining the startup behavior of the app.</summary>
|
||||
IStartupSettings StartupSettings { get; }
|
||||
|
||||
/// <summary> Value indicating whether map is centerted to current position or not. </summary>
|
||||
/// <summary> Value indicating whether map is centered to current position or not. </summary>
|
||||
bool CenterMapToCurrentLocation { get; set; }
|
||||
|
||||
/// <summary> Holds the map area where user is or was located or null if position is unknown. </summary>
|
||||
|
@ -98,7 +98,7 @@ namespace TINK.Model
|
|||
/// <summary> Holds the different lock service implementations.</summary>
|
||||
LocksServicesContainerMutable LocksServices { get; }
|
||||
|
||||
/// <summary> Holds the flavor of the app, i.e. specifies if app is sharee.bike, Mein konrad or Lastenrad Bayern.</summary>
|
||||
/// <summary> Holds the flavor of the app, i.e. specifies if app is sharee.bike, Mein konrad or LastenRad Bayern.</summary>
|
||||
AppFlavor Flavor { get; }
|
||||
|
||||
/// <summary> Holds available app themes.</summary>
|
||||
|
@ -113,7 +113,7 @@ namespace TINK.Model
|
|||
/// <summary> Holds the external path. </summary>
|
||||
string ExternalFolder { get; }
|
||||
|
||||
/// <summary> Holds the stations availalbe. </summary>
|
||||
/// <summary> Holds the stations centered. </summary>
|
||||
IEnumerable<IStation> Stations { get; set; }
|
||||
|
||||
/// <summary> Holds the Urs to query resources from. </summary>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
|
@ -25,7 +25,7 @@ namespace TINK.Model.Logging
|
|||
|
||||
if (directoryExistsChecker == null)
|
||||
{
|
||||
throw new ArgumentException($"Can not instantiate {nameof(LoggingDirectoryManager)}- object. Directory existance checker delegate can not be null.");
|
||||
throw new ArgumentException($"Can not instantiate {nameof(LoggingDirectoryManager)}- object. Directory existence checker delegate can not be null.");
|
||||
}
|
||||
|
||||
if (directoryCreator == null)
|
||||
|
@ -42,7 +42,7 @@ namespace TINK.Model.Logging
|
|||
|
||||
if (string.IsNullOrEmpty(directorySeparatorChar.ToString()))
|
||||
{
|
||||
throw new ArgumentException($"Can not instantiate {nameof(LoggingDirectoryManager)}- object. Directory separtor character can not be null or empty.");
|
||||
throw new ArgumentException($"Can not instantiate {nameof(LoggingDirectoryManager)}- object. Directory separator character can not be null or empty.");
|
||||
}
|
||||
|
||||
if (p_iRetainedFilesCountLimit < 1)
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
|
||||
|
||||
namespace TINK.Model
|
||||
{
|
||||
public class NullPostion : IPosition
|
||||
public class NullPosition : IPosition
|
||||
{
|
||||
internal NullPostion() { }
|
||||
internal NullPosition() { }
|
||||
|
||||
public double Latitude => double.NaN;
|
||||
|
||||
|
|
|
@ -6,6 +6,6 @@ namespace TINK.Model
|
|||
public static IPosition Create(double latitude = double.NaN, double longitude = double.NaN)
|
||||
=> Position.GetIsValid(longitude, latitude)
|
||||
? new Position(latitude, longitude) as IPosition
|
||||
: new NullPostion();
|
||||
: new NullPosition();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -194,7 +194,7 @@ namespace TINK.Model.Settings
|
|||
}
|
||||
|
||||
|
||||
/// <summary> Sets whether polling is on or off and the periode if polling is on. </summary>
|
||||
/// <summary> Sets whether polling is on or off and the period if polling is on. </summary>
|
||||
/// <param name="settingsJSON">Dictionary to write entries to.</param>
|
||||
public static Dictionary<string, string> SetPollingParameters(
|
||||
this IDictionary<string, string> targetDictionary,
|
||||
|
@ -210,19 +210,19 @@ namespace TINK.Model.Settings
|
|||
}).ToDictionary(key => key.Key, value => value.Value);
|
||||
}
|
||||
|
||||
/// <summary> Get whether polling is on or off and the periode if polling is on. </summary>
|
||||
/// <summary> Get whether polling is on or off and the period if polling is on. </summary>
|
||||
/// <param name="settingsJSON">Dictionary holding parameters from JSON.</param>
|
||||
/// <returns>Polling parameters.</returns>
|
||||
public static PollingParameters GetPollingParameters(this IDictionary<string, string> settingsJSON)
|
||||
{
|
||||
// Check if dictionary contains entry for periode.
|
||||
if (settingsJSON.TryGetValue($"{typeof(PollingParameters).Name}_{typeof(TimeSpan).Name}", out string periode)
|
||||
// Check if dictionary contains entry for period.
|
||||
if (settingsJSON.TryGetValue($"{typeof(PollingParameters).Name}_{typeof(TimeSpan).Name}", out string period)
|
||||
&& settingsJSON.TryGetValue($"{typeof(PollingParameters).Name}_{typeof(bool).Name}", out string active)
|
||||
&& !string.IsNullOrEmpty(periode)
|
||||
&& !string.IsNullOrEmpty(period)
|
||||
&& !string.IsNullOrEmpty(active))
|
||||
{
|
||||
return new PollingParameters(
|
||||
JsonConvert.DeserializeObject<TimeSpan>(periode),
|
||||
JsonConvert.DeserializeObject<TimeSpan>(period),
|
||||
JsonConvert.DeserializeObject<bool>(active));
|
||||
}
|
||||
|
||||
|
|
|
@ -16,15 +16,15 @@ namespace TINK.Settings
|
|||
false);
|
||||
|
||||
/// <summary> Constructs a polling parameter object. </summary>
|
||||
/// <param name="periode">Polling periode.</param>
|
||||
/// <param name="period">Polling period.</param>
|
||||
/// <param name="activated">True if polling is activated.</param>
|
||||
public PollingParameters(TimeSpan periode, bool activated)
|
||||
public PollingParameters(TimeSpan period, bool activated)
|
||||
{
|
||||
Periode = periode; // Can not be null because is a struct.
|
||||
Periode = period; // Can not be null because is a struct.
|
||||
IsActivated = activated;
|
||||
}
|
||||
|
||||
/// <summary>Holds the polling periode.</summary>
|
||||
/// <summary>Holds the polling period.</summary>
|
||||
public TimeSpan Periode { get; }
|
||||
|
||||
/// <summary> Holds value whether polling is activated or not.</summary>
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace TINK.Model.Settings
|
|||
public const bool DEFAULTREPOTLEVEL = false;
|
||||
|
||||
/// <summary> Gets the type of the default geolocation service. </summary>
|
||||
/// <remarks> Swtiched from GeolocationService (GeolocationAccuracyMediumService) to GeolocationAccuracyHighService in app version 3.0.290.</remarks>
|
||||
/// <remarks> Switched from GeolocationService (GeolocationAccuracyMediumService) to GeolocationAccuracyHighService in app version 3.0.290.</remarks>
|
||||
public static Type DefaultLocationService => typeof(GeolocationAccuracyHighService);
|
||||
|
||||
// Default value of the expires after entry. Controls the expiration time of the cache values.
|
||||
|
@ -54,8 +54,8 @@ namespace TINK.Model.Settings
|
|||
bool? isSiteCachingOn = null,
|
||||
string activeTheme = null)
|
||||
{
|
||||
GroupFilterMapPage = groupFilterMapPage ?? new GroupFilterMapPage(); // Default behaviour: No filtering.
|
||||
GroupFilterSettings = groupFilterSettings ?? new GroupFilterSettings(); // Default behaviour: No filtering.
|
||||
GroupFilterMapPage = groupFilterMapPage ?? new GroupFilterMapPage(); // Default behavior: No filtering.
|
||||
GroupFilterSettings = groupFilterSettings ?? new GroupFilterSettings(); // Default behavior: No filtering.
|
||||
StartupSettings = startupSettings ?? new StartupSettings();
|
||||
ActiveUri = GetActiveUri(activeUri);
|
||||
PollingParameters = pollingParameters ?? PollingParameters.Default;
|
||||
|
@ -64,7 +64,7 @@ namespace TINK.Model.Settings
|
|||
ExpiresAfter = expiresAfter ?? DEFAULTEXPIRESAFTER;
|
||||
ActiveLockService = activeLockService ?? LocksServicesContainerMutable.DefaultLocksservice;
|
||||
ConnectTimeout = connectTimeout ?? new TimeSpan(0, 0, TimeOutProvider.DEFAULT_BLUETOOTHCONNECT_TIMEOUTSECONDS); // Try one sec. to connect.
|
||||
ActiveGeolocationService = activeGeolocationService ?? DefaultLocationService.Name;
|
||||
ActiveGeolocationService = activeGeolocationService ?? DefaultLocationService.FullName;
|
||||
CenterMapToCurrentLocation = centerMapToCurrentLocation ?? GetCenterMapToCurrentLocation(activeUri);
|
||||
MapSpan = mapSpan;
|
||||
LogToExternalFolder = logToExternalFolder ?? false;
|
||||
|
@ -78,7 +78,7 @@ namespace TINK.Model.Settings
|
|||
/// <summary> Holds the filters loaded from settings. </summary>
|
||||
public IGroupFilterSettings GroupFilterSettings { get; }
|
||||
|
||||
/// <summary> Holds the stettings determining app startup behavior. </summary>
|
||||
/// <summary> Holds the settings determining app startup behavior. </summary>
|
||||
public IStartupSettings StartupSettings { get; }
|
||||
|
||||
/// <summary> Holds the uri to connect to. </summary>
|
||||
|
@ -102,7 +102,7 @@ namespace TINK.Model.Settings
|
|||
/// <summary> Gets the geolocation service to use.</summary>
|
||||
public string ActiveGeolocationService { get; }
|
||||
|
||||
/// <summary> True if map is centered to current positon, false if not to center map.</summary>
|
||||
/// <summary> True if map is centered to current position, false if not to center map.</summary>
|
||||
public bool CenterMapToCurrentLocation { get; }
|
||||
|
||||
/// <summary> Holds the map area to display. </summary>
|
||||
|
@ -121,7 +121,7 @@ namespace TINK.Model.Settings
|
|||
|
||||
public static bool GetCenterMapToCurrentLocation(Uri activeUri)
|
||||
{
|
||||
// TINK does not require acess to current location. Deactivate center map to current location for this reason.
|
||||
// TINK does not require access to current location. Deactivate center map to current location for this reason.
|
||||
return !GetActiveUri(activeUri).Host.GetIsCopri();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
|
||||
namespace TINK.Model.State
|
||||
{
|
||||
|
@ -262,7 +262,7 @@ namespace TINK.Model.State
|
|||
if (_RemainingTime.HasValue == false)
|
||||
{
|
||||
// Value was not yet querried.
|
||||
// Do querry before returning object.
|
||||
// Do query before returning object.
|
||||
_StateInfo.GetIsStillReserved(out _RemainingTime);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using TINK.Model.Stations.StationNS;
|
||||
|
||||
namespace TINK.Model.Station
|
||||
namespace TINK.Model.Stations
|
||||
{
|
||||
public class StationDictionary : IEnumerable<IStation>
|
||||
{
|
||||
|
@ -31,7 +32,7 @@ namespace TINK.Model.Station
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deteermines whether a station by given key exists.
|
||||
/// Determines whether a station by given key exists.
|
||||
/// </summary>
|
||||
/// <param name="key">Key to check.</param>
|
||||
/// <returns>True if station exists.</returns>
|
|
@ -1,7 +1,7 @@
|
|||
using System.Collections.Generic;
|
||||
using TINK.Model.Station.Operator;
|
||||
using System.Collections.Generic;
|
||||
using TINK.Model.Stations.StationNS.Operator;
|
||||
|
||||
namespace TINK.Model.Station
|
||||
namespace TINK.Model.Stations.StationNS
|
||||
{
|
||||
public interface IStation
|
||||
{
|
|
@ -1,7 +1,7 @@
|
|||
using System.Collections.Generic;
|
||||
using TINK.Model.Station.Operator;
|
||||
using System.Collections.Generic;
|
||||
using TINK.Model.Stations.StationNS.Operator;
|
||||
|
||||
namespace TINK.Model.Station
|
||||
namespace TINK.Model.Stations.StationNS
|
||||
{
|
||||
/// <summary> Holds object representing null station.</summary>
|
||||
public class NullStation : IStation
|
|
@ -1,6 +1,6 @@
|
|||
using Xamarin.Forms;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace TINK.Model.Station.Operator
|
||||
namespace TINK.Model.Stations.StationNS.Operator
|
||||
{
|
||||
/// <summary> Holds operator related data.</summary>
|
||||
public class Data : IData
|
|
@ -1,6 +1,6 @@
|
|||
using Xamarin.Forms;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace TINK.Model.Station.Operator
|
||||
namespace TINK.Model.Stations.StationNS.Operator
|
||||
{
|
||||
public interface IData
|
||||
{
|
|
@ -1,8 +1,8 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using TINK.Model.Station.Operator;
|
||||
using TINK.Model.Stations.StationNS.Operator;
|
||||
|
||||
namespace TINK.Model.Station
|
||||
namespace TINK.Model.Stations.StationNS
|
||||
{
|
||||
/// <summary> Holds station info. </summary>
|
||||
public class Station : IStation
|
|
@ -13,7 +13,7 @@ using TINK.Model.Device;
|
|||
using TINK.Model.Logging;
|
||||
using TINK.Model.Services.CopriApi.ServerUris;
|
||||
using TINK.Model.Settings;
|
||||
using TINK.Model.Station;
|
||||
using TINK.Model.Stations.StationNS;
|
||||
using TINK.Model.User.Account;
|
||||
using TINK.Services;
|
||||
using TINK.Services.BluetoothLock;
|
||||
|
@ -42,7 +42,7 @@ namespace TINK.Model
|
|||
public static string MerchantId { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Holds status about whants new page.
|
||||
/// Holds status about whats new page.
|
||||
/// </summary>
|
||||
public WhatsNew WhatsNew { get; private set; }
|
||||
|
||||
|
@ -65,7 +65,7 @@ namespace TINK.Model
|
|||
set => m_oFilterDictionaryMapPage = value ?? new GroupFilterMapPage();
|
||||
}
|
||||
|
||||
/// <summary> Value indicating whether map is centerted to current position or not. </summary>
|
||||
/// <summary> Value indicating whether map is centered to current position or not. </summary>
|
||||
public bool CenterMapToCurrentLocation { get; set; }
|
||||
|
||||
/// <summary> Holds the map area to display when starting app for first time/ when center map to is off. </summary>
|
||||
|
@ -123,7 +123,7 @@ namespace TINK.Model
|
|||
/// <summary>
|
||||
/// Update connector from filters when
|
||||
/// - login state changes
|
||||
/// - view is toggled (TINK to Kornrad and vice versa)
|
||||
/// - view is toggled (TINK to Konrad and vice versa)
|
||||
/// </summary>
|
||||
public void UpdateConnector()
|
||||
{
|
||||
|
@ -133,7 +133,7 @@ namespace TINK.Model
|
|||
m_oConnector.Connector);
|
||||
}
|
||||
|
||||
/// <summary>Polling periode.</summary>
|
||||
/// <summary>Polling period.</summary>
|
||||
public PollingParameters Polling { get; set; }
|
||||
|
||||
public TimeSpan ExpiresAfter { get; set; }
|
||||
|
@ -155,7 +155,7 @@ namespace TINK.Model
|
|||
/// <param name="accountStore"></param>
|
||||
/// <param name="passwordValidator"></param>
|
||||
/// <param name="p_oConnectorFactory"></param>
|
||||
/// <param name="geolocationService">Null in productive context. Service to querry geoloation for testing purposes. Parameter can be made optional.</param>
|
||||
/// <param name="geolocationService">Null in productive context. Service to query geolocation for testing purposes. Parameter can be made optional.</param>
|
||||
/// <param name="locksService">Null in productive context. Service to control locks/ get locks information for testing proposes. Parameter can be made optional.</param>
|
||||
/// <param name="device">Object allowing platform specific operations.</param>
|
||||
/// <param name="specialFolder"></param>
|
||||
|
@ -303,7 +303,7 @@ namespace TINK.Model
|
|||
throw new ArgumentException($"Can not instantiate {nameof(TinkApp)}- object. Polling parameters must never be null.");
|
||||
|
||||
Polling = (lastVersion != null && lastVersion < new Version(3, 0, 358))
|
||||
? PollingParameters.Default // Default polling periode was 10s up to 3.0.357. Is 60s for later versions.
|
||||
? PollingParameters.Default // Default polling period was 10s up to 3.0.357. Is 60s for later versions.
|
||||
: settings.PollingParameters;
|
||||
|
||||
AppVersion = currentVersion ?? new Version(3, 0, 122);
|
||||
|
@ -342,7 +342,7 @@ namespace TINK.Model
|
|||
/// <summary> Holds delegate to determine whether device is connected or not.</summary>
|
||||
private readonly Func<bool> isConnectedFunc;
|
||||
|
||||
/// <summary> Gets whether device is connected to internet or not. </summary>
|
||||
/// <summary> Gets whether device is connected to Internet or not. </summary>
|
||||
public bool GetIsConnected() => isConnectedFunc();
|
||||
|
||||
/// <summary> Holds the folder where settings files are stored. </summary>
|
||||
|
@ -365,8 +365,8 @@ namespace TINK.Model
|
|||
/// <summary> Name of the station which is selected. </summary>
|
||||
public IStation SelectedStation { get; set; } = new NullStation();
|
||||
|
||||
/// <summary> Holds the stations availalbe. </summary>
|
||||
public IEnumerable<IStation> Stations { get; set; } = new List<Station.Station>();
|
||||
/// <summary> Holds the stations centered. </summary>
|
||||
public IEnumerable<IStation> Stations { get; set; } = new List<Station>();
|
||||
|
||||
public IResourceUrls ResourceUrls { get; set; } = new ResourceUrls();
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
|
@ -10,15 +10,15 @@ namespace TINK.Model.User.Account
|
|||
{
|
||||
None = 0, // No extra permissions.
|
||||
PickCopriServer = 2, // Allows user to switch COPRI server.
|
||||
ManageCopriCacheExpiration = 4, // Allows to manage the livetime of COPRI cache entries.
|
||||
ManagePolling = 8, // Turn polling off or on and set pollig frequency.
|
||||
PickLockServiceImplementation = 16, // Allows to pick the implementation which controls bluetooth lock mangement.
|
||||
ManageCopriCacheExpiration = 4, // Allows to manage the live time of COPRI cache entries.
|
||||
ManagePolling = 8, // Turn polling off or on and set polling frequency.
|
||||
PickLockServiceImplementation = 16, // Allows to pick the implementation which controls bluetooth lock management.
|
||||
PickLocationServiceImplementation = 32, // Allows to pick the implementation which gets location information.
|
||||
PickLoggingLevel = 64, // Allows to select the logging level.
|
||||
ShowDiagnostics = 128, // Turns on display of diagnostics.
|
||||
SwitchNoSiteCaching = 1024, // Allows to turn off/ on caching of sites displayed in app hosted by COPRI
|
||||
ReportLevel = 2048, // Allows extent to show error messages.
|
||||
SwitchTheme = 4096, // Allows user to switch theme (sharee.bike, Meinkonrad, Lastenrad Bayern)
|
||||
SwitchTheme = 4096, // Allows user to switch theme (sharee.bike, Mein konrad, LastenRad Bayern)
|
||||
All = PickCopriServer +
|
||||
ManageCopriCacheExpiration +
|
||||
ManagePolling +
|
||||
|
@ -57,7 +57,7 @@ namespace TINK.Model.User.Account
|
|||
/// <param name="mail">Mail address of the account holder.</param>
|
||||
/// <param name="password">Password.</param>
|
||||
/// <param name="sessionCookie">Session cookie from copri.</param>
|
||||
/// <param name="bikeGroup">Group holdig info about Group (TINK, Konrad, ...)</param>
|
||||
/// <param name="bikeGroup">Group holding info about Group (TINK, Konrad, ...)</param>
|
||||
/// <param name="p_iDebugLevel">Flag which controls display of debug settings.</param>
|
||||
public Account(
|
||||
string mail,
|
||||
|
@ -87,7 +87,7 @@ namespace TINK.Model.User.Account
|
|||
/// <summary>Password of to authenticate.</summary>
|
||||
public string Pwd { get; }
|
||||
|
||||
/// <summary>True if user acknowleged agbs.</summary>
|
||||
/// <summary>True if user acknowledged AGBs.</summary>
|
||||
public bool IsAgbAcknowledged { get; }
|
||||
|
||||
/// <summary>Session cookie used to sign in to copri.</summary>
|
||||
|
|
|
@ -683,8 +683,8 @@ namespace TINK.Model
|
|||
new List<AppFlavor> { AppFlavor.MeinKonrad, AppFlavor.ShareeBike }
|
||||
},
|
||||
{
|
||||
new Version(3, 0, 362),
|
||||
AppResources.ChangeLog_3_0_362_MK_SB,
|
||||
new Version(3, 0, 363),
|
||||
AppResources.ChangeLog_3_0_363_MK_SB,
|
||||
new List<AppFlavor> { AppFlavor.MeinKonrad, AppFlavor.ShareeBike }
|
||||
},
|
||||
};
|
||||
|
@ -693,7 +693,7 @@ namespace TINK.Model
|
|||
/// <param name="currentVersion">Current version of the app.</param>
|
||||
/// <param name="lastVersion">Version of app which was used before this session, null if app is installed for the first time.</param>
|
||||
/// <param name="shownInVersion">Null or version in which whats new dialog was shown last. Used to determine if AGB dialog has to be shown.</param>
|
||||
/// <param name="flavor">Flavor of the app, i.e. specified if app is sharee.bike, Lastenrad Bayern, ...</param>
|
||||
/// <param name="flavor">Flavor of the app, i.e. specified if app is sharee.bike, LastenRad Bayern, ...</param>
|
||||
/// <param name="platform">Platform on which app is running.</param>
|
||||
/// <param name="messages">Messages to inject for testing.</param>
|
||||
public WhatsNew(
|
||||
|
@ -727,7 +727,7 @@ namespace TINK.Model
|
|||
IsShowRequired = true;
|
||||
}
|
||||
|
||||
/// <summary> Gets or sets value whehter whats new was alreay shonw in current settion or not. </summary>
|
||||
/// <summary> Gets or sets value whether whats new was already shown in current session or not. </summary>
|
||||
public bool WasShownInCurrentSession { get; set; }
|
||||
|
||||
/// <summary> Holds the information in which version of the app the whats new dialog has been shown.</summary>
|
||||
|
@ -736,10 +736,10 @@ namespace TINK.Model
|
|||
/// <summary> Holds information whether whats new page was already shown or not.</summary>
|
||||
public bool IsShowRequired { get; }
|
||||
|
||||
/// <summary> True if info about modified agb has to be displayed. </summary>
|
||||
/// <summary> True if info about modified AGB has to be displayed. </summary>
|
||||
public bool IsShowAgbRequired => (WasShownVersion ?? AGBMODIFIEDBUILD) < AGBMODIFIEDBUILD;
|
||||
|
||||
/// <summary> Get the whats new text depening of version gap.</summary>
|
||||
/// <summary> Get the whats new text depending of version gap.</summary>
|
||||
/// <param name="messages">Messages to process.</param>
|
||||
public IDictionary<Version, string> WhatsNewText { get; }
|
||||
}
|
||||
|
|
|
@ -781,6 +781,18 @@ namespace TINK.MultilingualResources {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to - Bikes that must be returned to the starting station are marked as such with an icon and the station id.<br/>
|
||||
///- What used to be called 'return bike' is now called 'end rental'. Always make sure to end your chargeable rental!<br/>
|
||||
///- Bug fixes<br/>
|
||||
///- Package updates.
|
||||
/// </summary>
|
||||
public static string ChangeLog_3_0_363_MK_SB {
|
||||
get {
|
||||
return ResourceManager.GetString("ChangeLog_3_0_363_MK_SB", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to We have fixed some bugs. Enjoy the ride!.
|
||||
/// </summary>
|
||||
|
@ -2406,6 +2418,15 @@ namespace TINK.MultilingualResources {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Circular drives only!.
|
||||
/// </summary>
|
||||
public static string MessageAaRideTypeInfoTitle {
|
||||
get {
|
||||
return ResourceManager.GetString("MessageAaRideTypeInfoTitle", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Log out.
|
||||
/// </summary>
|
||||
|
@ -2552,7 +2573,7 @@ namespace TINK.MultilingualResources {
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Rental charges.
|
||||
/// Looks up a localized string similar to Rental costs.
|
||||
/// </summary>
|
||||
public static string MessageBikesManagementTariffDescriptionFeeEuroPerHour {
|
||||
get {
|
||||
|
@ -2579,7 +2600,7 @@ namespace TINK.MultilingualResources {
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Max. charges.
|
||||
/// Looks up a localized string similar to Max. costs.
|
||||
/// </summary>
|
||||
public static string MessageBikesManagementTariffDescriptionMaxFeeEuroPerDay {
|
||||
get {
|
||||
|
|
|
@ -475,7 +475,7 @@ Bitte App neu starten, um Radinfos zu bekommen.</value>
|
|||
<value>Gratis Nutzung</value>
|
||||
</data>
|
||||
<data name="MessageBikesManagementTariffDescriptionMaxFeeEuroPerDay" xml:space="preserve">
|
||||
<value>Max. Gebühr</value>
|
||||
<value>Max. Kosten</value>
|
||||
</data>
|
||||
<data name="MessageBikesManagementTariffDescriptionEuroPerHour" xml:space="preserve">
|
||||
<value>€/Std.</value>
|
||||
|
@ -1165,6 +1165,15 @@ Treten Sie an das Rad heran, schalten Sie Bluetooth und Standortdienste ein und
|
|||
<br/>
|
||||
Außerdem:<br/>
|
||||
- Kleinere Fehlerbehebungen<br/>
|
||||
- Paketaktualisierungen</value>
|
||||
</data>
|
||||
<data name="MessageAaRideTypeInfoTitle" xml:space="preserve">
|
||||
<value>Nur Kreisfahrten!</value>
|
||||
</data>
|
||||
<data name="ChangeLog_3_0_363_MK_SB" xml:space="preserve">
|
||||
<value>- Räder, die an der Startstation zurückgegeben werden müssen, sind als solche mit einem Symbol und der Stations-ID gekennzeichnet<br/>
|
||||
- Was früher als "Fahrrad zurückgeben" bezeichnet wurde, heißt jetzt "Miete beenden". Vergewissern Sie sich immer, dass Sie Ihre kostenpflichtige Miete beenden!<br/>
|
||||
- Fehlerbehebungen<br/>
|
||||
- Paketaktualisierungen</value>
|
||||
</data>
|
||||
</root>
|
|
@ -581,7 +581,7 @@ Please restart app in order to get bike info.</value>
|
|||
<value>€/hour</value>
|
||||
</data>
|
||||
<data name="MessageBikesManagementTariffDescriptionFeeEuroPerHour" xml:space="preserve">
|
||||
<value>Rental charges</value>
|
||||
<value>Rental costs</value>
|
||||
</data>
|
||||
<data name="MessageBikesManagementTariffDescriptionFreeTimePerSession" xml:space="preserve">
|
||||
<value>Free use</value>
|
||||
|
@ -590,7 +590,7 @@ Please restart app in order to get bike info.</value>
|
|||
<value>hour(s)/day</value>
|
||||
</data>
|
||||
<data name="MessageBikesManagementTariffDescriptionMaxFeeEuroPerDay" xml:space="preserve">
|
||||
<value>Max. charges</value>
|
||||
<value>Max. costs</value>
|
||||
</data>
|
||||
<data name="MessageBikesManagementTariffDescriptionTariffHeader" xml:space="preserve">
|
||||
<value>Tariff</value>
|
||||
|
@ -1254,6 +1254,15 @@ Approach the bike, turn on Bluetooth and Location services and try again.</value
|
|||
<br/>
|
||||
Also:<br/>
|
||||
- Minor bug fixes<br/>
|
||||
- Package updates</value>
|
||||
</data>
|
||||
<data name="MessageAaRideTypeInfoTitle" xml:space="preserve">
|
||||
<value>Circular drives only!</value>
|
||||
</data>
|
||||
<data name="ChangeLog_3_0_363_MK_SB" xml:space="preserve">
|
||||
<value>- Bikes that must be returned to the starting station are marked as such with an icon and the station id.<br/>
|
||||
- What used to be called 'return bike' is now called 'end rental'. Always make sure to end your chargeable rental!<br/>
|
||||
- Bug fixes<br/>
|
||||
- Package updates</value>
|
||||
</data>
|
||||
</root>
|
|
@ -20,8 +20,7 @@
|
|||
</trans-unit>
|
||||
<trans-unit id="ActionCloseAndReturn" translate="yes" xml:space="preserve">
|
||||
<source>Close lock & end rental</source>
|
||||
<target state="needs-review-translation">Schloss schließen & Miete beenden</target>
|
||||
<note from="MultilingualUpdate" annotates="source" priority="2">Please verify the translation’s accuracy as the source string was updated after it was translated.</note>
|
||||
<target state="translated">Schloss schließen & Miete beenden</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="ActionOpen" translate="yes" xml:space="preserve">
|
||||
<source>Open lock</source>
|
||||
|
@ -41,8 +40,7 @@
|
|||
</trans-unit>
|
||||
<trans-unit id="ActionReturn" translate="yes" xml:space="preserve">
|
||||
<source>End rental</source>
|
||||
<target state="needs-review-translation">Miete beenden</target>
|
||||
<note from="MultilingualUpdate" annotates="source" priority="2">Please verify the translation’s accuracy as the source string was updated after it was translated.</note>
|
||||
<target state="translated">Miete beenden</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="MarkingMapPage" translate="yes" xml:space="preserve">
|
||||
<source>Bike Locations</source>
|
||||
|
@ -307,8 +305,7 @@ Bitte melden Sie sich erneut an.</target>
|
|||
</trans-unit>
|
||||
<trans-unit id="ActionLoginRegister" translate="yes" xml:space="preserve">
|
||||
<source>Register for free</source>
|
||||
<target state="needs-review-translation">Kostenlos registrieren</target>
|
||||
<note from="MultilingualUpdate" annotates="source" priority="2">Please verify the translation’s accuracy as the source string was updated after it was translated.</note>
|
||||
<target state="translated">Kostenlos registrieren</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="MarkingLoginEmailAddressLabel" translate="yes" xml:space="preserve">
|
||||
<source>E-mail</source>
|
||||
|
@ -628,16 +625,17 @@ Bitte App neu starten, um Radinfos zu bekommen.</target>
|
|||
<target state="translated">Abo-Preis</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="MessageBikesManagementTariffDescriptionFeeEuroPerHour" translate="yes" xml:space="preserve">
|
||||
<source>Rental charges</source>
|
||||
<source>Rental costs</source>
|
||||
<target state="translated">Mietkosten</target>
|
||||
<note from="MultilingualUpdate" annotates="source" priority="2">Please verify the translation’s accuracy as the source string was updated after it was translated.</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="MessageBikesManagementTariffDescriptionFreeTimePerSession" translate="yes" xml:space="preserve">
|
||||
<source>Free use</source>
|
||||
<target state="translated">Gratis Nutzung</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="MessageBikesManagementTariffDescriptionMaxFeeEuroPerDay" translate="yes" xml:space="preserve">
|
||||
<source>Max. charges</source>
|
||||
<target state="needs-review-translation">Max. Gebühr</target>
|
||||
<source>Max. costs</source>
|
||||
<target state="translated">Max. Kosten</target>
|
||||
<note from="MultilingualUpdate" annotates="source" priority="2">Please verify the translation’s accuracy as the source string was updated after it was translated.</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="MessageBikesManagementTariffDescriptionEuroPerHour" translate="yes" xml:space="preserve">
|
||||
|
@ -729,7 +727,7 @@ Bitte kontaktieren sie den Betreiber!</target>
|
|||
</trans-unit>
|
||||
<trans-unit id="ChangeLog3_0_227" translate="yes" xml:space="preserve">
|
||||
<source>Feedback dialog added which is shown after ending rental.</source>
|
||||
<target state="needs-review-translation">Seite zur Eingabe von Rückmeldungen hinzugefügt, der nach Rückgabe eines Rads angezeigt wird.</target>
|
||||
<target state="translated">Seite zur Eingabe von Rückmeldungen hinzugefügt, der nach Rückgabe eines Rads angezeigt wird.</target>
|
||||
<note from="MultilingualUpdate" annotates="source" priority="2">Please verify the translation’s accuracy as the source string was updated after it was translated.</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="ActivityTextConnectionStateOffline" translate="yes" xml:space="preserve">
|
||||
|
@ -784,7 +782,7 @@ Layout Anzeige Radnamen und nummern verbessert.</target>
|
|||
</trans-unit>
|
||||
<trans-unit id="ChangeLog3_0_237" translate="yes" xml:space="preserve">
|
||||
<source>Hard- and software information send to backend when ending rental.</source>
|
||||
<target state="needs-review-translation">Hard- und software information werden an Backend übermittelt bei Radrückgabe.</target>
|
||||
<target state="translated">Hard- und software information werden an Backend übermittelt bei Radrückgabe.</target>
|
||||
<note from="MultilingualUpdate" annotates="source" priority="2">Please verify the translation’s accuracy as the source string was updated after it was translated.</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="ChangeLog3_0_239" translate="yes" xml:space="preserve">
|
||||
|
@ -875,8 +873,7 @@ Kleinere Verbesserungen.</target>
|
|||
</trans-unit>
|
||||
<trans-unit id="MessageErrorQueryLocationTitle" translate="yes" xml:space="preserve">
|
||||
<source>Error query location!</source>
|
||||
<target state="needs-review-translation">Fehler bei Standortabfrage!</target>
|
||||
<note from="MultilingualUpdate" annotates="source" priority="2">Please verify the translation’s accuracy as the source string was updated after it was translated.</note>
|
||||
<target state="translated">Fehler bei Standortabfrage!</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="MessageErrorQueryLocationMessage" translate="yes" xml:space="preserve">
|
||||
<source>Closing the lock and ending the rental is not possible.</source>
|
||||
|
@ -884,7 +881,7 @@ Kleinere Verbesserungen.</target>
|
|||
</trans-unit>
|
||||
<trans-unit id="MessageErrorQueryLocationStartTitle" translate="yes" xml:space="preserve">
|
||||
<source>Error start query location!</source>
|
||||
<target state="needs-review-translation">Fehler beim Start der Standortabfrage!</target>
|
||||
<target state="translated">Fehler beim Start der Standortabfrage!</target>
|
||||
<note from="MultilingualUpdate" annotates="source" priority="2">Please verify the translation’s accuracy as the source string was updated after it was translated.</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="ActivityTextErrorQueryLocationWhenAny" translate="yes" xml:space="preserve">
|
||||
|
@ -1239,12 +1236,12 @@ Kleinere Fehlerbehebungen.
|
|||
</trans-unit>
|
||||
<trans-unit id="ActionContactMailAppReleated" translate="yes" xml:space="preserve">
|
||||
<source>Feedback about the app</source>
|
||||
<target state="needs-review-translation">Rückmeldung zur App</target>
|
||||
<target state="translated">Rückmeldung zur App</target>
|
||||
<note from="MultilingualUpdate" annotates="source" priority="2">Please verify the translation’s accuracy as the source string was updated after it was translated.</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="MiscContactMailAppReleatedSubject" translate="yes" xml:space="preserve">
|
||||
<source>{0}-app releated request</source>
|
||||
<target state="needs-review-translation">{0}-App Anfrage</target>
|
||||
<target state="translated">{0}-App Anfrage</target>
|
||||
<note from="MultilingualBuild" annotates="source" priority="2">Subject of contact mail to ("Feedback about the app").</note>
|
||||
<note from="MultilingualUpdate" annotates="source" priority="2">Please verify the translation’s accuracy as the source string was updated after it was translated.</note>
|
||||
</trans-unit>
|
||||
|
@ -1567,7 +1564,7 @@ Wichtig: Schicken Sie eine E-Mail an den Betreiber (ansonsten läuft Ihre kosten
|
|||
</trans-unit>
|
||||
<trans-unit id="MarkingNoNetworkConnection" translate="yes" xml:space="preserve">
|
||||
<source>Oops, there is no Internet connection.</source>
|
||||
<target state="needs-review-translation">Ups, es ist keine Internetverbindung vorhanden.</target>
|
||||
<target state="translated">Ups, es ist keine Internetverbindung vorhanden.</target>
|
||||
<note from="MultilingualUpdate" annotates="source" priority="2">Please verify the translation’s accuracy as the source string was updated after it was translated.</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="ChangeLog_3_0_358_MK_SB" translate="yes" xml:space="preserve">
|
||||
|
@ -1614,6 +1611,21 @@ Also:<br/>
|
|||
<br/>
|
||||
Außerdem:<br/>
|
||||
- Kleinere Fehlerbehebungen<br/>
|
||||
- Paketaktualisierungen</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="MessageAaRideTypeInfoTitle" translate="yes" xml:space="preserve">
|
||||
<source>Circular drives only!</source>
|
||||
<target state="translated">Nur Kreisfahrten!</target>
|
||||
<note from="MultilingualUpdate" annotates="source" priority="2">Please verify the translation’s accuracy as the source string was updated after it was translated.</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="ChangeLog_3_0_363_MK_SB" translate="yes" xml:space="preserve">
|
||||
<source>- Bikes that must be returned to the starting station are marked as such with an icon and the station id.<br/>
|
||||
- What used to be called 'return bike' is now called 'end rental'. Always make sure to end your chargeable rental!<br/>
|
||||
- Bug fixes<br/>
|
||||
- Package updates</source>
|
||||
<target state="translated">- Räder, die an der Startstation zurückgegeben werden müssen, sind als solche mit einem Symbol und der Stations-ID gekennzeichnet<br/>
|
||||
- Was früher als "Fahrrad zurückgeben" bezeichnet wurde, heißt jetzt "Miete beenden". Vergewissern Sie sich immer, dass Sie Ihre kostenpflichtige Miete beenden!<br/>
|
||||
- Fehlerbehebungen<br/>
|
||||
- Paketaktualisierungen</target>
|
||||
</trans-unit>
|
||||
</group>
|
||||
|
|
|
@ -13,6 +13,7 @@ using TINK.Model.Logging;
|
|||
using TINK.Repository.Exception;
|
||||
using TINK.Repository.Request;
|
||||
using TINK.Repository.Response;
|
||||
using TINK.Repository.Response.Stations;
|
||||
|
||||
namespace TINK.Repository
|
||||
{
|
||||
|
@ -24,7 +25,7 @@ namespace TINK.Repository
|
|||
|
||||
/// <summary> Initializes a instance of the copri calls https object. </summary>
|
||||
/// <param name="copriHost">Host to connect to. </param>
|
||||
/// <param name="appContextInfo">Provides app related info (app name and version, merchantid) to pass to COPRI.</param>
|
||||
/// <param name="appContextInfo">Provides app related info (app name and version, merchant id) to pass to COPRI.</param>
|
||||
/// <param name="uiIsoLangugageName">Two letter ISO language name.</param>
|
||||
/// <param name="smartDevice">Holds info about smart device.</param>
|
||||
/// <param name="sessionCookie">Session cookie if user is logged in, null otherwise.</param>
|
||||
|
@ -50,7 +51,7 @@ namespace TINK.Repository
|
|||
/// <summary> Holds the URL for rest calls.</summary>
|
||||
private Uri m_oCopriHost;
|
||||
|
||||
/// <summary> Spacifies name and version of app. </summary>
|
||||
/// <summary> Specifies name and version of app. </summary>
|
||||
private string UserAgent { get; }
|
||||
|
||||
/// <summary> Returns true because value requested form copri server are returned. </summary>
|
||||
|
@ -63,7 +64,7 @@ namespace TINK.Repository
|
|||
public string SessionCookie => requestBuilder.SessionCookie;
|
||||
|
||||
/// <summary> Logs user in. </summary>
|
||||
/// <param name="mailAddress">Mailaddress of user to log in.</param>
|
||||
/// <param name="mailAddress">Mail address of user to log in.</param>
|
||||
/// <param name="password">Password to log in.</param>
|
||||
/// <param name="deviceId">Id specifying user and hardware.</param>
|
||||
/// <remarks>Response which holds auth cookie <see cref="ResponseBase.authcookie"/></remarks>
|
||||
|
@ -87,7 +88,7 @@ namespace TINK.Repository
|
|||
public async Task<BikesAvailableResponse> GetBikesAvailableAsync()
|
||||
=> await GetBikesAvailableAsync(m_oCopriHost.AbsoluteUri, requestBuilder.GetBikesAvailable(), UserAgent);
|
||||
|
||||
/// <summary> Gets a list of bikes reserved/ booked by acctive user. </summary>
|
||||
/// <summary> Gets a list of bikes reserved/ booked by active user. </summary>
|
||||
/// <returns>Response holding list of bikes.</returns>
|
||||
public async Task<BikesReservedOccupiedResponse> GetBikesOccupiedAsync()
|
||||
{
|
||||
|
@ -127,7 +128,7 @@ namespace TINK.Repository
|
|||
requestBuilder.DoReserve(bikeId),
|
||||
UserAgent);
|
||||
|
||||
/// <summary> Gets canel booking request response.</summary>
|
||||
/// <summary> Gets cancel booking request response.</summary>
|
||||
/// <param name="bikeId">Id of the bike to book.</param>
|
||||
/// <param name="operatorUri">Holds the uri of the operator or null, in case of single operator setup.</param>
|
||||
/// <returns>Response on cancel booking request.</returns>
|
||||
|
@ -183,13 +184,13 @@ namespace TINK.Repository
|
|||
requestBuilder.UpateLockingState(bikeId, state, location, batteryLevel, versionInfo),
|
||||
UserAgent);
|
||||
|
||||
/// <summary> Gets booking request request. </summary>
|
||||
/// <summary> Gets booking request. </summary>
|
||||
/// <param name="operatorUri">Holds the uri of the operator or null, in case of single operator setup.</param>
|
||||
/// <param name="bikeId">Id of the bike to book.</param>
|
||||
/// <param name="guid">Used to publish GUID from app to copri. Used for initial setup of bike in copri.</param>
|
||||
/// <param name="batteryPercentage">Holds the filling level percentage of the battery.</param>
|
||||
/// <param name="nextAction">If not null next locking action which is performed after booking.</param>
|
||||
/// <returns>Requst on booking request.</returns>
|
||||
/// <returns>Request on booking request.</returns>
|
||||
public async Task<ReservationBookingResponse> DoBookAsync(
|
||||
Uri operatorUri,
|
||||
string bikeId,
|
||||
|
@ -296,7 +297,7 @@ namespace TINK.Repository
|
|||
copriHost,
|
||||
command,
|
||||
userAgent,
|
||||
displayCommand); // Do not include password into exception output when an error occurres.
|
||||
displayCommand); // Do not include password into exception output when an error occurs.
|
||||
}
|
||||
catch (System.Exception l_oException)
|
||||
{
|
||||
|
@ -437,7 +438,7 @@ namespace TINK.Repository
|
|||
#endif
|
||||
}
|
||||
|
||||
/// <summary> Gets a list of bikes reserved/ booked by acctive user from Copri.</summary>
|
||||
/// <summary> Gets a list of bikes reserved/ booked by active user from Copri.</summary>
|
||||
/// <param name="copriHost">URL of the copri host to connect to.</param>
|
||||
/// <param name="command">Command to post.</param>
|
||||
/// <returns>Response holding list of bikes.</returns>
|
||||
|
@ -785,8 +786,8 @@ namespace TINK.Repository
|
|||
#endif
|
||||
}
|
||||
|
||||
/// <summary> http get- request.</summary>
|
||||
/// <param name="Url">Ulr to get info from.</param>
|
||||
/// <summary> Https get- request.</summary>
|
||||
/// <param name="Url">Url to get info from.</param>
|
||||
/// <returns>response from server</returns>
|
||||
public static async Task<string> Get(string Url)
|
||||
{
|
||||
|
@ -804,7 +805,7 @@ namespace TINK.Repository
|
|||
return result;
|
||||
}
|
||||
|
||||
/// <summary> http- post request.</summary>
|
||||
/// <summary> Https- post request.</summary>
|
||||
/// <param name="command">Command to send.</param>
|
||||
/// <param name="displayCommand">Command to display/ log used for error handling.</param>
|
||||
/// <param name="uRL">Address of server to communicate with.</param>
|
||||
|
@ -838,7 +839,7 @@ namespace TINK.Repository
|
|||
#if !WINDOWS_UWP
|
||||
var l_strHost = uRL;
|
||||
|
||||
// Returns a http request.
|
||||
// Returns a https request.
|
||||
var request = WebRequest.CreateHttp(l_strHost);
|
||||
|
||||
request.Method = "POST";
|
||||
|
|
|
@ -5,12 +5,13 @@ using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
|
|||
using TINK.Model.Connector;
|
||||
using TINK.Repository.Request;
|
||||
using TINK.Repository.Response;
|
||||
using TINK.Repository.Response.Stations;
|
||||
|
||||
namespace TINK.Repository
|
||||
{
|
||||
public class CopriCallsMemory : ICopriServer
|
||||
public class CopriCallsMemory : ICopriServer
|
||||
{
|
||||
/// <summary> Part in file specifying apiserver.</summary>
|
||||
/// <summary> Part in file specifying api server.</summary>
|
||||
private static string CopriDevelHostUri = @"https://tinkwwp.copri-bike.de/APIjsonserver";
|
||||
|
||||
public const string DO_AUTH_Unknown_User_FILE = @"
|
||||
|
@ -1335,7 +1336,7 @@ namespace TINK.Repository
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a list of bikes reserved/ booked by acctive user from Copri.
|
||||
/// Gets a list of bikes reserved/ booked by active user from Copri.
|
||||
/// </summary>
|
||||
/// <param name="p_strSessionCookie">Cookie to authenticate user.</param>
|
||||
/// <returns>Response holding list of bikes.</returns>
|
||||
|
@ -1343,7 +1344,7 @@ namespace TINK.Repository
|
|||
{
|
||||
try
|
||||
{
|
||||
requestBuilder.GetBikesOccupied(); // Non mock implementation if ICopriServer call this member as well. To ensure comparable behaviour this member is called here as well.
|
||||
requestBuilder.GetBikesOccupied(); // Non mock implementation if ICopriServer call this member as well. To ensure comparable behavior this member is called here as well.
|
||||
}
|
||||
catch (NotSupportedException)
|
||||
{
|
||||
|
@ -1673,7 +1674,7 @@ namespace TINK.Repository
|
|||
=> null;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a list of bikes reserved/ booked by acctive user from Copri.
|
||||
/// Gets a list of bikes reserved/ booked by active user from Copri.
|
||||
/// </summary>
|
||||
/// <param name="sessionCookie">Cookie to authenticate user.</param>
|
||||
/// <param name="SampleSet">Sample set to use.</param>
|
||||
|
|
|
@ -8,6 +8,7 @@ using TINK.Model.Device;
|
|||
using TINK.Model.Services.CopriApi;
|
||||
using TINK.Repository.Request;
|
||||
using TINK.Repository.Response;
|
||||
using TINK.Repository.Response.Stations;
|
||||
|
||||
namespace TINK.Repository
|
||||
{
|
||||
|
|
|
@ -3,9 +3,9 @@ using System.Collections.Generic;
|
|||
using System.Threading.Tasks;
|
||||
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
|
||||
using TINK.Model.Connector;
|
||||
using TINK.Model.Device;
|
||||
using TINK.Repository.Request;
|
||||
using TINK.Repository.Response;
|
||||
using TINK.Repository.Response.Stations;
|
||||
|
||||
namespace TINK.Repository
|
||||
{
|
||||
|
@ -13,7 +13,7 @@ namespace TINK.Repository
|
|||
public interface ICopriServerBase
|
||||
{
|
||||
/// <summary> Logs user in. </summary>
|
||||
/// <param name="mailAddress">Mailaddress of user to log in.</param>
|
||||
/// <param name="mailAddress">Mail address of user to log in.</param>
|
||||
/// <param name="password">Password to log in.</param>
|
||||
/// <param name="deviceId">Id specifying user and hardware.</param>
|
||||
/// <remarks>Response which holds auth cookie <see cref="ResponseBase.authcookie"/></remarks>
|
||||
|
@ -34,7 +34,7 @@ namespace TINK.Repository
|
|||
string bikeId,
|
||||
Uri operatorUri);
|
||||
|
||||
/// <summary> Cancels reservation of bik. </summary>
|
||||
/// <summary> Cancels reservation of bike. </summary>
|
||||
/// <param name="bikeId">Id of the bike to reserve.</param>
|
||||
/// <param name="operatorUri">Holds the uri of the operator or null, in case of single operator setup.</param>
|
||||
/// <returns>Response on cancel reservation request.</returns>
|
||||
|
@ -162,7 +162,7 @@ namespace TINK.Repository
|
|||
/// <returns>Response holding list of bikes.</returns>
|
||||
Task<BikesAvailableResponse> GetBikesAvailableAsync();
|
||||
|
||||
/// <summary> Gets a list of bikes reserved/ booked by acctive user from Copri.</summary>
|
||||
/// <summary> Gets a list of bikes reserved/ booked by active user from Copri.</summary>
|
||||
/// <returns>Response holding list of bikes.</returns>
|
||||
Task<BikesReservedOccupiedResponse> GetBikesOccupiedAsync();
|
||||
}
|
||||
|
|
|
@ -15,10 +15,10 @@ namespace TINK.Repository.Request
|
|||
string SessionCookie { get; }
|
||||
|
||||
/// <summary> Gets request to log user in. </summary>
|
||||
/// <param name="mailAddress">Mailaddress of user to log in.</param>
|
||||
/// <param name="mailAddress">Mail address of user to log in.</param>
|
||||
/// <param name="password">Password to log in.</param>
|
||||
/// <param name="deviceId">Id specifying user and hardware.</param>
|
||||
/// <remarks>Requst which holds auth cookie <see cref="RequstBase.authcookie"/></remarks>
|
||||
/// <remarks>Request which holds auth cookie <see cref="RequstBase.authcookie"/></remarks>
|
||||
string DoAuthorization(
|
||||
string mailAddress,
|
||||
string password,
|
||||
|
@ -37,7 +37,7 @@ namespace TINK.Repository.Request
|
|||
/// <returns>Request to query list of bikes available.</returns>
|
||||
string GetBikesAvailable();
|
||||
|
||||
/// <summary> Gets a list of bikes reserved/ booked by acctive user from Copri.</summary>
|
||||
/// <summary> Gets a list of bikes reserved/ booked by active user from Copri.</summary>
|
||||
/// <returns>Request to query list of bikes occupied.</returns>
|
||||
string GetBikesOccupied();
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ namespace TINK.Repository.Request
|
|||
SmartDevice.GetSmartDeviceParameters() +
|
||||
UiIsoLanguageNameParameter;
|
||||
|
||||
/// <summary> Gets a list of bikes reserved/ booked by acctive user from Copri.</summary>
|
||||
/// <summary> Gets a list of bikes reserved/ booked by active user from Copri.</summary>
|
||||
/// <returns>Request to query list of bikes occupied.</returns>
|
||||
public string GetBikesOccupied()
|
||||
=> throw new NotSupportedException();
|
||||
|
|
|
@ -78,7 +78,7 @@ namespace TINK.Repository.Request
|
|||
AuthCookieParameter +
|
||||
UiIsoLanguageNameParameter;
|
||||
|
||||
/// <summary> Gets a list of bikes reserved/ booked by acctive user from Copri.</summary>
|
||||
/// <summary> Gets a list of bikes reserved/ booked by active user from Copri.</summary>
|
||||
/// <returns>Request to query list of bikes occupied.</returns>
|
||||
public string GetBikesOccupied()
|
||||
=> "request=user_bikes_occupied&system=all&genkey=1" +
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System.Runtime.Serialization;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace TINK.Repository.Response
|
||||
{
|
||||
|
@ -27,7 +27,7 @@ namespace TINK.Repository.Response
|
|||
public string station { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Holds the localized (german) description of the bike.
|
||||
/// Holds the localized (German) description of the bike.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public string description { get; private set; }
|
||||
|
@ -78,6 +78,12 @@ namespace TINK.Repository.Response
|
|||
/// <summary> Describes type of the bike.</summary>
|
||||
public BikeType bike_type { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Holds 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>
|
||||
[DataMember]
|
||||
public string aa_ride { get; private set; }
|
||||
|
||||
/// <summary> Loading state of motor battery in % ]0..100[. </summary>
|
||||
[DataMember]
|
||||
public string bike_charge { get; private set; }
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System.Runtime.Serialization;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace TINK.Repository.Response
|
||||
{
|
||||
|
@ -40,7 +40,7 @@ namespace TINK.Repository.Response
|
|||
public string charge_current_percent { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Holds the maximum chargeing level of the battery in bars.
|
||||
/// Holds the maximum charging level of the battery in bars.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public string charge_max_bars { get; private set; }
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System.Linq;
|
||||
using System.Linq;
|
||||
using TINK.MultilingualResources;
|
||||
using TINK.Repository.Exception;
|
||||
|
||||
|
@ -80,7 +80,7 @@ namespace TINK.Repository.Response
|
|||
|
||||
/// <summary>Gets if a call to reserve bike succeeded or not by checking a booking response.</summary>
|
||||
/// <param name="bikeId">Id of bike which should be booked.</param>
|
||||
/// <param name="sessionCookie">Sessiong cookie of logged in user.</param>
|
||||
/// <param name="sessionCookie">Session cookie of logged in user.</param>
|
||||
/// <param name="bookingResponse">Response to check.</param>
|
||||
/// <returns></returns>
|
||||
public static BikeInfoReservedOrBooked GetIsReserveResponseOk(
|
||||
|
|
27
TINKLib/Repository/Response/Stations/Station/OperatorData.cs
Normal file
27
TINKLib/Repository/Response/Stations/Station/OperatorData.cs
Normal file
|
@ -0,0 +1,27 @@
|
|||
using System.Runtime.Serialization;
|
||||
|
||||
namespace TINK.Repository.Response.Stations.Station
|
||||
{
|
||||
/// <summary>
|
||||
/// Holds info about operator data.
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public class OperatorData
|
||||
{
|
||||
[DataMember]
|
||||
public string operator_name { get; private set; }
|
||||
|
||||
[DataMember]
|
||||
public string operator_phone { get; private set; }
|
||||
|
||||
[DataMember]
|
||||
public string operator_hours { get; private set; }
|
||||
|
||||
[DataMember]
|
||||
public string operator_email { get; private set; }
|
||||
|
||||
|
||||
[DataMember]
|
||||
public string operator_color { get; private set; }
|
||||
}
|
||||
}
|
32
TINKLib/Repository/Response/Stations/Station/StationInfo.cs
Normal file
32
TINKLib/Repository/Response/Stations/Station/StationInfo.cs
Normal file
|
@ -0,0 +1,32 @@
|
|||
using System.Runtime.Serialization;
|
||||
|
||||
namespace TINK.Repository.Response.Stations.Station
|
||||
{
|
||||
/// <summary>
|
||||
/// Holds info about a single station.
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public class StationInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Unique id of the station.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public string station { get; private set; }
|
||||
|
||||
[DataMember]
|
||||
public string[] station_group { get; private set; }
|
||||
|
||||
[DataMember]
|
||||
public string description { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Position of the station.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public Position gps { get; private set; }
|
||||
|
||||
[DataMember]
|
||||
public OperatorData operator_data { get; private set; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
using TINK.Repository.Response.Stations.Station;
|
||||
|
||||
namespace TINK.Repository.Response.Stations
|
||||
{
|
||||
/// <summary>
|
||||
/// Holds the information about all stations and is used for deserialization of copri answer.
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public class StationsAvailableResponse : ResponseBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Dictionary of bikes.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public Dictionary<string, StationInfo> stations { get; private set; }
|
||||
}
|
||||
}
|
|
@ -1,69 +0,0 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace TINK.Repository.Response
|
||||
{
|
||||
/// <summary>
|
||||
/// Holds the information about all stations and is used for deserialization of copri answer.
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public class StationsAvailableResponse : ResponseBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Holds info about a single station.
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public class StationInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Holds info about opertor data.
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public class OperatorData
|
||||
{
|
||||
[DataMember]
|
||||
public string operator_name { get; private set; }
|
||||
|
||||
[DataMember]
|
||||
public string operator_phone { get; private set; }
|
||||
|
||||
[DataMember]
|
||||
public string operator_hours { get; private set; }
|
||||
|
||||
[DataMember]
|
||||
public string operator_email { get; private set; }
|
||||
|
||||
|
||||
[DataMember]
|
||||
public string operator_color { get; private set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Unique id of the station.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public string station { get; private set; }
|
||||
|
||||
[DataMember]
|
||||
public string[] station_group { get; private set; }
|
||||
|
||||
[DataMember]
|
||||
public string description { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Position of the station.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public Position gps { get; private set; }
|
||||
|
||||
[DataMember]
|
||||
public OperatorData operator_data { get; private set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Dictionary of bikes.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public Dictionary<string, StationInfo> stations { get; private set; }
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
@ -10,13 +10,13 @@ using TINK.Services.BluetoothLock.Tdo;
|
|||
namespace TINK.Services.BluetoothLock
|
||||
{
|
||||
/// <summary>
|
||||
/// Facke locks service implementation which simulates locks which are in reach.
|
||||
/// Fake locks service implementation which simulates locks which are in reach.
|
||||
/// </summary>
|
||||
public class LocksServiceInReach : ILocksServiceFake
|
||||
{
|
||||
private IEnumerable<LockInfoTdo> LocksInfo { get; set; } = new List<LockInfoTdo>();
|
||||
|
||||
/// <summary> Holds timeout values for series of connecting attemps to a lock or multiple locks. </summary>
|
||||
/// <summary> Holds timeout values for series of connecting attempts to a lock or multiple locks. </summary>
|
||||
public ITimeOutProvider TimeOut { get; set; }
|
||||
|
||||
/// <summary> Connects to lock.</summary>
|
||||
|
@ -45,7 +45,7 @@ namespace TINK.Services.BluetoothLock
|
|||
switch (bikeInfo.State.Value)
|
||||
{
|
||||
case InUseStateEnum.Disposable:
|
||||
case InUseStateEnum.FeedbackPending: // State feedback pending does not exist for bluetooth locks but maches from bluetooth perspective state disposable.
|
||||
case InUseStateEnum.FeedbackPending: // State feedback pending does not exist for bluetooth locks but matches from bluetooth perspective state disposable.
|
||||
switch (lockInfo.State)
|
||||
{
|
||||
case LockingState.Open:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
@ -9,13 +9,13 @@ using TINK.Services.BluetoothLock.Tdo;
|
|||
namespace TINK.Services.BluetoothLock
|
||||
{
|
||||
/// <summary>
|
||||
/// Facke locks service implementation which simulates locks which are out of reach.
|
||||
/// Fake locks service implementation which simulates locks which are out of reach.
|
||||
/// </summary>
|
||||
public class LocksServiceOutOfReach : ILocksServiceFake
|
||||
{
|
||||
private IEnumerable<LockInfoTdo> LocksInfo { get; set; } = new List<LockInfoTdo>();
|
||||
|
||||
/// <summary> Holds timeout values for series of connecting attemps to a lock or multiple locks. </summary>
|
||||
/// <summary> Holds timeout values for series of connecting attempts to a lock or multiple locks. </summary>
|
||||
public ITimeOutProvider TimeOut { get; set; }
|
||||
|
||||
/// <summary> Connects to lock.</summary>
|
||||
|
@ -26,7 +26,7 @@ namespace TINK.Services.BluetoothLock
|
|||
return await Task.FromResult(new LockInfoTdo.Builder { Id = authInfo.Id, Guid = authInfo.Guid, State = null }.Build());
|
||||
}
|
||||
|
||||
/// <summary> No info availalbe because no lock is in reach.</summary>
|
||||
/// <summary> No info centered because no lock is in reach.</summary>
|
||||
/// <param name="connectTimeout">Timeout for connect operation of a single lock.</param>
|
||||
/// <returns>Empty collection.</returns>
|
||||
public async Task<IEnumerable<LockInfoTdo>> GetLocksStateAsync(IEnumerable<LockInfoAuthTdo> locksInfo, TimeSpan connectTimeout) => await Task.FromResult(LocksInfo);
|
||||
|
|
|
@ -9,6 +9,7 @@ using TINK.Model.Device;
|
|||
using TINK.Repository;
|
||||
using TINK.Repository.Request;
|
||||
using TINK.Repository.Response;
|
||||
using TINK.Repository.Response.Stations;
|
||||
|
||||
namespace TINK.Model.Services.CopriApi
|
||||
{
|
||||
|
@ -18,7 +19,7 @@ namespace TINK.Model.Services.CopriApi
|
|||
/// <summary> Object which manages stored copri answers. </summary>
|
||||
private ICopriCache CacheServer { get; }
|
||||
|
||||
/// <summary> Communicates whith copri server. </summary>
|
||||
/// <summary> Communicates with copri server. </summary>
|
||||
private ICopriServer HttpsServer { get; }
|
||||
|
||||
/// <summary> True if connector has access to copri server, false if cached values are used. </summary>
|
||||
|
@ -30,9 +31,9 @@ namespace TINK.Model.Services.CopriApi
|
|||
/// <summary> Gets the merchant id.</summary>
|
||||
public string MerchantId => HttpsServer.MerchantId;
|
||||
|
||||
/// <summary> Constructs copri provider object to connet to https using a cache objet. </summary>
|
||||
/// <summary> Constructs copri provider object to connect to https using a cache object. </summary>
|
||||
/// <param name="copriHost"></param>
|
||||
/// <param name="appContextInfo">Provides app related info (app name and version, merchantid) to pass to COPRI.</param>
|
||||
/// <param name="appContextInfo">Provides app related info (app name and version, merchant id) to pass to COPRI.</param>
|
||||
/// <param name="uiIsoLangugageName">Two letter ISO language name.</param>
|
||||
/// <param name="smartDevice">Holds info about smart device.</param>
|
||||
/// <param name="sessionCookie">Cookie of user if a user is logged in, false otherwise.</param>
|
||||
|
@ -68,7 +69,7 @@ namespace TINK.Model.Services.CopriApi
|
|||
|
||||
try
|
||||
{
|
||||
Log.ForContext<CopriProviderHttps>().Debug($"Querrying bikes available from copri.");
|
||||
Log.ForContext<CopriProviderHttps>().Debug($"Querying bikes available from copri.");
|
||||
var bikesAvailableResponse = await HttpsServer.GetBikesAvailableAsync();
|
||||
return new Result<BikesAvailableResponse>(
|
||||
typeof(CopriCallsHttps),
|
||||
|
@ -78,13 +79,13 @@ namespace TINK.Model.Services.CopriApi
|
|||
catch (Exception exception)
|
||||
{
|
||||
// Return response from cache.
|
||||
Log.ForContext<CopriProviderHttps>().Debug("An error occurred querrying bikes available. {Exception}.", exception);
|
||||
Log.ForContext<CopriProviderHttps>().Debug("An error occurred querying bikes available. {Exception}.", exception);
|
||||
var bikesAvailableResponse = await CacheServer.GetBikesAvailableAsync();
|
||||
return new Result<BikesAvailableResponse>(typeof(CopriCallsMonkeyStore), bikesAvailableResponse, bikesAvailableResponse.GetGeneralData(), exception);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Gets a list of bikes reserved/ booked by acctive user. </summary>
|
||||
/// <summary> Gets a list of bikes reserved/ booked by active user. </summary>
|
||||
/// <param name="sessionCookie">Cookie to authenticate user.</param>
|
||||
/// <returns>Response holding list of bikes.</returns>
|
||||
public async Task<Result<BikesReservedOccupiedResponse>> GetBikesOccupied(bool fromCache = false)
|
||||
|
@ -101,7 +102,7 @@ namespace TINK.Model.Services.CopriApi
|
|||
|
||||
try
|
||||
{
|
||||
Log.ForContext<CopriProviderHttps>().Debug($"Querrying bikes occupied from copri.");
|
||||
Log.ForContext<CopriProviderHttps>().Debug($"Querying bikes occupied from copri.");
|
||||
var bikesOccupiedResponse = await HttpsServer.GetBikesOccupiedAsync();
|
||||
return new Result<BikesReservedOccupiedResponse>(
|
||||
typeof(CopriCallsHttps),
|
||||
|
@ -112,7 +113,7 @@ namespace TINK.Model.Services.CopriApi
|
|||
catch (Exception exception)
|
||||
{
|
||||
// Return response from cache.
|
||||
Log.ForContext<CopriProviderHttps>().Debug("An error occurred querrying bikes occupied. {Exception}.", exception);
|
||||
Log.ForContext<CopriProviderHttps>().Debug("An error occurred querying bikes occupied. {Exception}.", exception);
|
||||
var bikesOccupiedResponse = await CacheServer.GetBikesOccupiedAsync();
|
||||
return new Result<BikesReservedOccupiedResponse>(typeof(CopriCallsMonkeyStore), bikesOccupiedResponse, bikesOccupiedResponse.GetGeneralData(), exception);
|
||||
}
|
||||
|
@ -134,7 +135,7 @@ namespace TINK.Model.Services.CopriApi
|
|||
|
||||
try
|
||||
{
|
||||
Log.ForContext<CopriProviderHttps>().Debug($"Querrying stations from copri.");
|
||||
Log.ForContext<CopriProviderHttps>().Debug($"Querying stations from copri.");
|
||||
|
||||
var stations = await HttpsServer.GetStationsAsync();
|
||||
|
||||
|
@ -146,7 +147,7 @@ namespace TINK.Model.Services.CopriApi
|
|||
catch (Exception exception)
|
||||
{
|
||||
// Return response from cache.
|
||||
Log.ForContext<CopriProviderHttps>().Debug("An error occurred querrying stations. {Exception}.", exception);
|
||||
Log.ForContext<CopriProviderHttps>().Debug("An error occurred querying stations. {Exception}.", exception);
|
||||
var stationsResponse = await CacheServer.GetStationsAsync();
|
||||
return new Result<StationsAvailableResponse>(typeof(CopriCallsMonkeyStore), stationsResponse, stationsResponse.GetGeneralData(), exception);
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ using TINK.Model.Device;
|
|||
using TINK.Repository;
|
||||
using TINK.Repository.Request;
|
||||
using TINK.Repository.Response;
|
||||
using TINK.Repository.Response.Stations;
|
||||
using TINK.Services.CopriApi.Exception;
|
||||
|
||||
namespace TINK.Model.Services.CopriApi
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
|
||||
|
||||
using System.Threading.Tasks;
|
||||
using TINK.Repository;
|
||||
using TINK.Repository.Response;
|
||||
using TINK.Repository.Response.Stations;
|
||||
|
||||
namespace TINK.Model.Services.CopriApi
|
||||
{
|
||||
|
@ -16,7 +17,7 @@ namespace TINK.Model.Services.CopriApi
|
|||
/// <returns>Response holding list of bikes.</returns>
|
||||
Task<Result<BikesAvailableResponse>> GetBikesAvailable(bool fromCache = false);
|
||||
|
||||
/// <summary> Gets a list of bikes reserved/ booked by acctive user from Copri.</summary>
|
||||
/// <summary> Gets a list of bikes reserved/ booked by active user from Copri.</summary>
|
||||
/// <returns>Response holding list of bikes.</returns>
|
||||
Task<Result<BikesReservedOccupiedResponse>> GetBikesOccupied(bool fromCache = false);
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using TINK.Repository;
|
||||
using TINK.Repository.Response;
|
||||
using TINK.Repository.Response.Stations;
|
||||
|
||||
namespace TINK.Model.Services.CopriApi
|
||||
{
|
||||
|
|
|
@ -112,7 +112,7 @@ namespace TINK.Services.CopriApi
|
|||
if (lockingState == null)
|
||||
{
|
||||
// User did not take bike out of the station
|
||||
throw new BikeStillInStationException("Booking was cancelled because bike is still in station.");
|
||||
throw new BikeStillInStationException("Booking was canceled because bike is still in station.");
|
||||
}
|
||||
|
||||
// Upate booking state.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using TINK.Services.CopriApi;
|
||||
|
||||
namespace TINK.Model.Services.CopriApi
|
||||
|
@ -10,7 +10,7 @@ namespace TINK.Model.Services.CopriApi
|
|||
/// </summary>
|
||||
/// <param name="source">Type of source (data provider).</param>
|
||||
/// <param name="response">Requested data (bikes, station).</param>
|
||||
/// <param name="generalData">General data (common to all respones).</param>
|
||||
/// <param name="generalData">General data (common to all responses).</param>
|
||||
public Result(
|
||||
Type source,
|
||||
T response,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
using TINK.Model.Bikes;
|
||||
using TINK.Model.Station;
|
||||
using TINK.Model.Bikes;
|
||||
using TINK.Model.Stations;
|
||||
|
||||
namespace TINK.Model.Services.CopriApi
|
||||
{
|
||||
|
|
|
@ -30,7 +30,7 @@ namespace TINK.Services.Geolocation
|
|||
|
||||
/// <summary> Gets the current location.</summary>
|
||||
/// <param name="cancellationToken">Token to cancel request for geolocation.</param>
|
||||
/// <param name="timeStamp">Time when geolocation is of interest. Is used to determine whether cached geoloation can be used or not.</param>
|
||||
/// <param name="timeStamp">Time when geolocation is of interest. Is used to determine whether cached geolocation can be used or not.</param>
|
||||
public async Task<IGeolocation> GetAsync(CancellationToken? cancellationToken = null, DateTime? timeStamp = null)
|
||||
{
|
||||
try
|
||||
|
|
|
@ -2,7 +2,6 @@ using System;
|
|||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using TINK.Model.Device;
|
||||
using Xamarin.Essentials;
|
||||
|
||||
namespace TINK.Services.Geolocation
|
||||
{
|
||||
|
@ -11,7 +10,7 @@ namespace TINK.Services.Geolocation
|
|||
{
|
||||
/// <summary> Gets the current location.</summary>
|
||||
/// <param name="cancellationToken">Token to cancel request for geolocation. If null request can not be cancels and times out after GeolocationService.GEOLOCATIONREQUEST_TIMEOUT_MS if geolocation is not available.</param>
|
||||
/// <param name="timeStamp">Time when geolocation is of interest. Is used to determine for some implementations whether cached geoloation can be used or not.</param>
|
||||
/// <param name="timeStamp">Time when geolocation is of interest. Is used to determine for some implementations whether cached geolocation can be used or not.</param>
|
||||
/// <returns></returns>
|
||||
Task<IGeolocation> GetAsync(CancellationToken? cancellationToken = null, DateTime? timeStamp = null);
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace TINK.Services.Geolocation
|
|||
|
||||
/// <summary> Gets the current location.</summary>
|
||||
/// <param name="cancelationToken">Token to cancel request for geolocation.</param>
|
||||
/// <param name="timeStamp">Time when geolocation is of interest. Is used to determine whether cached geoloation can be used or not.</param>
|
||||
/// <param name="timeStamp">Time when geolocation is of interest. Is used to determine whether cached geolocation can be used or not.</param>
|
||||
public async Task<IGeolocation> GetAsync(CancellationToken? cancelationToken = null, DateTime? timeStamp = null)
|
||||
{
|
||||
IGeolocation location;
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace TINK.Services.Geolocation
|
|||
|
||||
/// <summary> Gets the current location.</summary>
|
||||
/// <param name="cancelToken">Token to cancel request for geolocation.</param>
|
||||
/// <param name="timeStamp">Time when geolocation is of interest. Is used to determine whether cached geoloation can be used or not.</param>
|
||||
/// <param name="timeStamp">Time when geolocation is of interest. Is used to determine whether cached geolocation can be used or not.</param>
|
||||
public async Task<IGeolocation> GetAsync(CancellationToken? cancelToken = null, DateTime? timeStamp = null)
|
||||
{
|
||||
return await Task.FromResult(new Geolocation.Builder {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System.Threading.Tasks;
|
||||
using System.Threading.Tasks;
|
||||
using TINK.Model.Bikes.BikeInfoNS.DriveNS.BatteryNS;
|
||||
|
||||
namespace TINK.View
|
||||
|
@ -114,7 +114,7 @@ namespace TINK.View
|
|||
public interface IUserFeedback
|
||||
{
|
||||
/// <summary>
|
||||
/// Holds the current chargeing level of the battery in bars, null if unkonwn.
|
||||
/// Holds the current charging level of the battery in bars, null if unknown.
|
||||
/// </summary>
|
||||
int? CurrentChargeBars { get; set; }
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
|
||||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Threading.Tasks;
|
||||
|
@ -49,8 +49,8 @@ namespace TINK.ViewModel.Account
|
|||
/// <param name="p_oDevice"></param>
|
||||
/// <param name="p_oFilterGroup">Filter to apply on stations and bikes.</param>
|
||||
/// <param name="p_oUris">Available copri server host uris including uri to use for next start.</param>
|
||||
/// <param name="p_oPolling"> Holds whether to poll or not and the periode leght is polling is on. </param>
|
||||
/// <param name="p_oDefaultPollingPeriode">Default polling periode lenght.</param>
|
||||
/// <param name="p_oPolling"> Holds whether to poll or not and the period length is polling is on. </param>
|
||||
/// <param name="p_oDefaultPollingPeriode">Default polling period length.</param>
|
||||
/// <param name="p_oMinimumLogEventLevel">Controls logging level.</param>
|
||||
/// <param name="viewService">Interface to view</param>
|
||||
public AccountPageViewModel(
|
||||
|
@ -159,7 +159,7 @@ namespace TINK.ViewModel.Account
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether booking state info is avilable or not.
|
||||
/// Gets a value indicating whether booking state info is available or not.
|
||||
/// </summary>
|
||||
public bool IsBookingStateInfoVisible
|
||||
{
|
||||
|
@ -429,7 +429,7 @@ namespace TINK.ViewModel.Account
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>Polling periode.</summary>
|
||||
/// <summary>Polling period.</summary>
|
||||
public PollingViewModel Polling { get; }
|
||||
|
||||
/// <summary> Opens login page.</summary>
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
{
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
{
|
||||
|
|
|
@ -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()
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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.");
|
||||
|
|
|
@ -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.");
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -12,7 +12,8 @@ using TINK.Model.Bikes;
|
|||
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
|
||||
using TINK.Model.Connector;
|
||||
using TINK.Model.Device;
|
||||
using TINK.Model.Station;
|
||||
using TINK.Model.Stations;
|
||||
using TINK.Model.Stations.StationNS;
|
||||
using TINK.Model.User;
|
||||
using TINK.MultilingualResources;
|
||||
using TINK.Services.BluetoothLock;
|
||||
|
@ -60,17 +61,17 @@ namespace TINK.ViewModel.BikesAtStation
|
|||
/// Constructs bike collection view model.
|
||||
/// </summary>
|
||||
/// <param name="user">Mail address of active user.</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.</param>
|
||||
/// <param name="lockService">Service to control lock retrieve info.</param>
|
||||
/// <param name="polling"> Holds whether to poll or not and the periode leght is polling is on. </param>
|
||||
/// <param name="polling"> Holds whether to poll or not and the period length is polling is on. </param>
|
||||
/// <param name="openUrlInExternalBrowser">Action to open an external browser.</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>
|
||||
public BikesAtStationPageViewModel(
|
||||
User user,
|
||||
ILocationPermission permissions,
|
||||
|
@ -384,7 +385,7 @@ namespace TINK.ViewModel.BikesAtStation
|
|||
var exception = result.Exception;
|
||||
if (exception != null)
|
||||
{
|
||||
Log.ForContext<BikesAtStationPageViewModel>().Error("Getting all bikes bikes in polling context failed with exception {Exception}.", exception);
|
||||
Log.ForContext<BikesAtStationPageViewModel>().Error("Getting all bikes in polling context failed with exception {Exception}.", exception);
|
||||
}
|
||||
|
||||
PostAction(
|
||||
|
|
|
@ -5,7 +5,8 @@ using System.Threading.Tasks;
|
|||
using System.Windows.Input;
|
||||
using Plugin.Messaging;
|
||||
using Serilog;
|
||||
using TINK.Model.Station;
|
||||
using TINK.Model.Stations;
|
||||
using TINK.Model.Stations.StationNS;
|
||||
using TINK.MultilingualResources;
|
||||
using TINK.View;
|
||||
using Xamarin.Essentials;
|
||||
|
@ -50,7 +51,7 @@ namespace TINK.ViewModel.Info
|
|||
{
|
||||
AppFlavorName = !string.IsNullOrEmpty(appFlavorName)
|
||||
? appFlavorName
|
||||
: throw new ArgumentException("Can not instantiate contact page view model- object. No app name availalbe.");
|
||||
: throw new ArgumentException("Can not instantiate contact page view model- object. No app name centered.");
|
||||
|
||||
CreateAttachment = createAttachment
|
||||
?? throw new ArgumentException("Can not instantiate contact page view model- object. No create attachment provider available.");
|
||||
|
@ -89,7 +90,7 @@ namespace TINK.ViewModel.Info
|
|||
async () => await DoSendMailToOperator(),
|
||||
() => IsSendMailAvailable);
|
||||
|
||||
/// <summary> Command object to bind mail app releated button to model. </summary>
|
||||
/// <summary> Command object to bind mail app related button to model. </summary>
|
||||
public ICommand OnMailAppRelatedRequest
|
||||
=> new Command(
|
||||
async () => await DoSendMailAppRelated(),
|
||||
|
@ -116,11 +117,11 @@ namespace TINK.ViewModel.Info
|
|||
public string OfficeHoursText
|
||||
=> SelectedStation?.OperatorData?.Hours ?? string.Empty;
|
||||
|
||||
/// <summary> Gets whether any operator support info is avaliable. </summary>
|
||||
/// <summary> Gets whether any operator support info is available. </summary>
|
||||
public bool IsOperatorInfoAvaliable
|
||||
=> MailAddressText.Length > 0 || PhoneNumberText.Length > 0;
|
||||
|
||||
/// <returns> Returns true if eithe mail was sent or if no mailer available.</returns>
|
||||
/// <returns> Returns true if either mail was sent or if no mailer available.</returns>
|
||||
public async Task DoSendMailToOperator()
|
||||
{
|
||||
try
|
||||
|
@ -149,12 +150,12 @@ namespace TINK.ViewModel.Info
|
|||
return;
|
||||
}
|
||||
|
||||
// Send app-related related support mail to operator.
|
||||
// Send app-related support mail to operator.
|
||||
await Email.ComposeAsync(new EmailMessage
|
||||
{
|
||||
To = new List<string> { MailAddressText },
|
||||
Cc = APPSUPPORTMAILADDRESS.ToUpper() != MailAddressText.ToUpper() // do not sent copy if same mail adress
|
||||
&& MailAddressText != "konrad@sharee.bike" // do not sent copy if Meinkonrad
|
||||
Cc = APPSUPPORTMAILADDRESS.ToUpper() != MailAddressText.ToUpper() // do not sent copy if same mail address
|
||||
&& MailAddressText != "konrad@sharee.bike" // do not sent copy if Mein konrad
|
||||
? new List<string> { APPSUPPORTMAILADDRESS } : new List<string>(),
|
||||
Subject = string.Format(AppResources.SupportmailSubjectAppmail, AppFlavorName)
|
||||
});
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
using Xamarin.Forms;
|
||||
using TINK.View;
|
||||
using TINK.Model.Station;
|
||||
using TINK.Model.Stations;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using TINK.Model.Bikes;
|
||||
|
@ -27,7 +27,7 @@ namespace TINK.ViewModel.Contact
|
|||
{
|
||||
public class SelectStationPageViewModel : INotifyPropertyChanged
|
||||
{
|
||||
/// <summary> Holds the count of custom icons availalbe.</summary>
|
||||
/// <summary> Holds the count of custom icons centered.</summary>
|
||||
private const int CUSTOM_ICONS_COUNT = 30;
|
||||
|
||||
/// <summary> Reference on view service to show modal notifications and to perform navigation. </summary>
|
||||
|
@ -169,8 +169,8 @@ namespace TINK.ViewModel.Contact
|
|||
{
|
||||
if (station.Position == null)
|
||||
{
|
||||
// There should be no reason for a position object to be null but this alreay occurred in past.
|
||||
Log.ForContext<SelectStationPageViewModel>().Error("Postion object of station {@l_oStation} is null.", station);
|
||||
// There should be no reason for a position object to be null but this already occurred in past.
|
||||
Log.ForContext<SelectStationPageViewModel>().Error("Position object of station {@l_oStation} is null.", station);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -340,8 +340,8 @@ namespace TINK.ViewModel.Contact
|
|||
Pins.Clear();
|
||||
}
|
||||
|
||||
// Check if there are alreay any pins to the map
|
||||
// i.e detecte first call of member OnAppearing after construction
|
||||
// Check if there are already any pins to the map
|
||||
// i.e detects first call of member OnAppearing after construction
|
||||
if (Pins.Count <= 0)
|
||||
{
|
||||
// Map was not yet initialized.
|
||||
|
@ -457,7 +457,7 @@ namespace TINK.ViewModel.Contact
|
|||
IsMapPageEnabled = false;
|
||||
|
||||
TinkApp.SelectedStation = TinkApp.Stations.FirstOrDefault(x => x.Id == selectedStationId)
|
||||
?? new Station(selectedStationId, new List<string>(), null); // Station might not be in list StationDictinaly because this list is not updatd in background task.
|
||||
?? new Model.Stations.StationNS.Station(selectedStationId, new List<string>(), null); // Station might not be in list StationDictinaly because this list is not updated in background task.
|
||||
|
||||
#if TRYNOTBACKSTYLE
|
||||
m_oNavigation.ShowPage(
|
||||
|
@ -504,7 +504,7 @@ namespace TINK.ViewModel.Contact
|
|||
|
||||
if (bikesAll == null)
|
||||
{
|
||||
// If object is null an error occurred querrying bikes availalbe or bikes occpied which results in an unknown state.
|
||||
// If object is null an error occurred querying bikes centered or bikes occupied which results in an unknown state.
|
||||
Log.ForContext<SelectStationPageViewModel>().Error("No bikes available to determine pins color.");
|
||||
return new List<Color>(stationsId.Select(x => Color.Blue));
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue