mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2025-07-07 20:16:44 +02:00
Version 3.0.376
This commit is contained in:
parent
ca080c87c0
commit
f963c0a219
158 changed files with 3228 additions and 1279 deletions
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using TINK.Model.Bikes;
|
||||
|
||||
|
@ -15,20 +15,16 @@ namespace TINK.Model
|
|||
public static BikeCollection GetAtStation(
|
||||
this BikeCollection bikesAtAnyStation,
|
||||
string selectedStation)
|
||||
{
|
||||
return new BikeCollection(bikesAtAnyStation?
|
||||
=> new BikeCollection(bikesAtAnyStation?
|
||||
.Where(bike => !string.IsNullOrEmpty(selectedStation) && bike.StationId == selectedStation)
|
||||
.ToDictionary(bike => bike.Id) ?? new Dictionary<string, BikeInfo>());
|
||||
}
|
||||
|
||||
/// <summary> Filters bikes by bike type. </summary>
|
||||
/// <param name="bcAndLockItBikes">Bikes available, requested and/ or occupied bikes to filter.</param>
|
||||
/// <returns>BikeCollection holding LockIt-bikes empty BikeCollection, if there are no LockIt-bikes.</returns>
|
||||
public static BikeCollection GetLockIt(this BikeCollection bcAndLockItBikes)
|
||||
{
|
||||
return new BikeCollection(bcAndLockItBikes?
|
||||
=> new BikeCollection(bcAndLockItBikes?
|
||||
.Where(bike => bike is Bikes.BikeInfoNS.BluetoothLock.BikeInfo)
|
||||
.ToDictionary(x => x.Id) ?? new Dictionary<string, BikeInfo>());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,9 +65,11 @@ namespace TINK.Model.Connector
|
|||
|
||||
/// <summary> Gets bikes either bikes available if no user is logged in or bikes available and bikes occupied if a user is logged in. </summary>
|
||||
/// <param name="operatorUri">Uri of the operator host to get bikes from or null if bikes have to be gotten form primary host.</param>
|
||||
public async Task<Result<BikeCollection>> GetBikesAsync(Uri operatorUri = null)
|
||||
/// <param name="stationId"> Id of station which is used for filtering bikes. Null if no filtering should be applied.</param>
|
||||
/// <param name="bikeId"> Id of bike which is used for filtering bikes. Null if no filtering should be applied.</param>
|
||||
public async Task<Result<BikeCollection>> GetBikesAsync(Uri operatorUri = null, string stationId = null, string bikeId = null)
|
||||
{
|
||||
var result = await m_oInnerQuery.GetBikesAsync(operatorUri);
|
||||
var result = await m_oInnerQuery.GetBikesAsync(operatorUri, stationId, bikeId);
|
||||
return new Result<BikeCollection>(
|
||||
result.Source,
|
||||
new BikeCollection(DoFilter(result.Response, Filter)),
|
||||
|
|
|
@ -57,9 +57,11 @@ namespace TINK.Model.Connector
|
|||
|
||||
/// <summary> Gets bikes either bikes available if no user is logged in or bikes available and bikes occupied if a user is logged in. </summary>
|
||||
/// <param name="operatorUri">Uri of the operator host to get bikes from or null if bikes have to be gotten form primary host.</param>
|
||||
public async Task<Result<BikeCollection>> GetBikesAsync(Uri operatorUri = null)
|
||||
/// <param name="stationId"> Id of station which is used for filtering bikes. Null if no filtering should be applied.</param>
|
||||
/// <param name="bikeId"> Id of bike which is used for filtering bikes. Null if no filtering should be applied.</param>
|
||||
public async Task<Result<BikeCollection>> GetBikesAsync(Uri operatorUri = null, string stationId = null, string bikeId = null)
|
||||
{
|
||||
var result = await m_oInnerQuery.GetBikesAsync(operatorUri);
|
||||
var result = await m_oInnerQuery.GetBikesAsync(operatorUri, stationId, bikeId);
|
||||
return new Result<BikeCollection>(
|
||||
result.Source,
|
||||
new BikeCollection(result.Response.ToDictionary(x => x.Id)),
|
||||
|
|
|
@ -72,17 +72,18 @@ namespace TINK.Model.Connector
|
|||
|
||||
/// <summary> Gets bikes available. </summary>
|
||||
/// <param name="operatorUri">Uri of the operator host to get bikes from or null if bikes have to be gotten form primary host.</param>
|
||||
/// <param name="stationId"> Id of station which is used for filtering bikes. Null if no filtering should be applied.</param>
|
||||
/// <param name="bikeId"> Id of bike which is used for filtering bikes. Null if no filtering should be applied.</param>
|
||||
/// <returns>Collection of bikes.</returns>
|
||||
public async Task<Result<BikeCollection>> GetBikesAsync(Uri operatorUri = null)
|
||||
public async Task<Result<BikeCollection>> GetBikesAsync(Uri operatorUri = null, string stationId = null, string bikeId = null)
|
||||
{
|
||||
var result = await server.GetBikesAvailable(operatorUri: operatorUri);
|
||||
var result = await server.GetBikesAvailable(operatorUri: operatorUri, stationId: stationId, bikeId: bikeId);
|
||||
|
||||
if (result.Source != typeof(CopriCallsMonkeyStore))
|
||||
{
|
||||
server.AddToCache(result, operatorUri);
|
||||
server.AddToCache(result, operatorUri, stationId, bikeId);
|
||||
}
|
||||
|
||||
|
||||
return new Result<BikeCollection>(
|
||||
result.Source,
|
||||
result.Response.GetBikesAvailable(result.Source == typeof(CopriCallsMonkeyStore)
|
||||
|
|
|
@ -128,10 +128,12 @@ namespace TINK.Model.Connector
|
|||
|
||||
/// <summary> Gets bikes available and bikes occupied. </summary>
|
||||
/// <param name="operatorUri">Uri of the operator host to get bikes from or null if bikes have to be gotten form primary host.</param>
|
||||
/// <param name="stationId"> Id of station which is used for filtering bikes. Null if no filtering should be applied.</param>
|
||||
/// <param name="bikeId"> Id of bike which is used for filtering bikes. Null if no filtering should be applied.</param>
|
||||
/// <returns>Collection of bikes.</returns>
|
||||
public async Task<Result<BikeCollection>> GetBikesAsync(Uri operatorUri = null)
|
||||
public async Task<Result<BikeCollection>> GetBikesAsync(Uri operatorUri = null, string stationId = null, string bikeId = null)
|
||||
{
|
||||
var bikesAvailableResponse = await Server.GetBikesAvailable(operatorUri: operatorUri);
|
||||
var bikesAvailableResponse = await Server.GetBikesAvailable(operatorUri: operatorUri, stationId: stationId, bikeId: bikeId);
|
||||
|
||||
if (bikesAvailableResponse.Source == typeof(CopriCallsMonkeyStore)
|
||||
|| bikesAvailableResponse.Exception != null)
|
||||
|
@ -155,7 +157,7 @@ namespace TINK.Model.Connector
|
|||
if (operatorUri?.AbsoluteUri != null)
|
||||
{
|
||||
// Both types bikes could read from copri successfully => update cache
|
||||
Server.AddToCache(bikesAvailableResponse, operatorUri);
|
||||
Server.AddToCache(bikesAvailableResponse, operatorUri, stationId, bikeId);
|
||||
|
||||
Log.ForContext<CachedQueryLoggedIn>().Debug("Bikes available and occupied read successfully from server invoking one single request.");
|
||||
return new Result<BikeCollection>(
|
||||
|
@ -181,7 +183,7 @@ namespace TINK.Model.Connector
|
|||
return new Result<BikeCollection>(
|
||||
bikesOccupiedResponse.Source,
|
||||
BikeCollectionFactory.GetBikesAll(
|
||||
(await Server.GetBikesAvailable(true, operatorUri)).Response?.bikes?.Values,
|
||||
(await Server.GetBikesAvailable(true, operatorUri, stationId, bikeId)).Response?.bikes?.Values,
|
||||
bikesOccupiedResponse.Response?.bikes_occupied?.Values,
|
||||
Mail,
|
||||
DateTimeProvider,
|
||||
|
@ -191,7 +193,7 @@ namespace TINK.Model.Connector
|
|||
}
|
||||
|
||||
// Both types bikes could read from copri => update cache
|
||||
Server.AddToCache(bikesAvailableResponse, operatorUri);
|
||||
Server.AddToCache(bikesAvailableResponse, operatorUri, stationId, bikeId);
|
||||
Server.AddToCache(bikesOccupiedResponse);
|
||||
|
||||
Log.ForContext<CachedQueryLoggedIn>().Debug("Bikes available and occupied read successfully from server.");
|
||||
|
|
|
@ -16,7 +16,8 @@ namespace TINK.Model.Connector
|
|||
|
||||
/// <summary> Gets bikes either bikes available if no user is logged in or bikes available and bikes occupied if a user is logged in. </summary>
|
||||
/// <param name="operatorUri">Uri of the operator host to get bikes from or null if bikes have to be gotten form primary host.</param>
|
||||
/// <param name="stationId"> Id of station which is used for filtering bikes. Null if no filtering should be applied.</param>
|
||||
/// <returns>Collection of bikes.</returns>
|
||||
Task<Result<BikeCollection>> GetBikesAsync(Uri operatorUri = null);
|
||||
Task<Result<BikeCollection>> GetBikesAsync(Uri operatorUri = null, string stationId = null, string bikeId = null);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,14 +55,18 @@ namespace TINK.Model.Connector
|
|||
|
||||
/// <summary> Gets bikes occupied. </summary>
|
||||
/// <param name="operatorUri">Uri of the operator host to get bikes from or null if bikes have to be gotten form primary host.</param>
|
||||
/// <param name="stationId"> Id of station which is used for filtering bikes. Null if no filtering should be applied.</param>
|
||||
/// <param name="bikeId"> Id of bike which is used for filtering bikes. Null if no filtering should be applied.</param>
|
||||
/// <returns> Collection of bikes. </returns>
|
||||
public async Task<Result<BikeCollection>> GetBikesAsync(Uri operatorUri = null)
|
||||
public async Task<Result<BikeCollection>> GetBikesAsync(Uri operatorUri = null, string stationId = null, string bikeId = null)
|
||||
{
|
||||
var bikesAvailableResponse = await server.GetBikesAvailableAsync(operatorUri);
|
||||
var bikesAvailableResponse = await server.GetBikesAvailableAsync(operatorUri, stationId, bikeId);
|
||||
return new Result<BikeCollection>(
|
||||
typeof(CopriCallsMonkeyStore),
|
||||
bikesAvailableResponse.GetBikesAvailable(Bikes.BikeInfoNS.BC.DataSource.Cache),
|
||||
bikesAvailableResponse.GetGeneralData());
|
||||
bikesAvailableResponse != null
|
||||
? bikesAvailableResponse.GetBikesAvailable(Bikes.BikeInfoNS.BC.DataSource.Cache)
|
||||
: await Task.FromResult(new BikeCollection(new Dictionary<string, BikeInfo>())),
|
||||
bikesAvailableResponse?.GetGeneralData());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,10 +70,26 @@ namespace TINK.Model.Connector
|
|||
|
||||
/// <summary> Gets bikes available and bikes occupied. </summary>
|
||||
/// <param name="operatorUri">Uri of the operator host to get bikes from or null if bikes have to be gotten form primary host.</param>
|
||||
/// <param name="stationId"> Id of station which is used for filtering bikes. Null if no filtering should be applied.</param>
|
||||
/// <param name="bikeId"> Id of bike which is used for filtering bikes. Null if no filtering should be applied.</param>
|
||||
/// <returns>Collection of bikes.</returns>
|
||||
public async Task<Result<BikeCollection>> GetBikesAsync(Uri operatorUri = null)
|
||||
public async Task<Result<BikeCollection>> GetBikesAsync(Uri operatorUri = null, string stationId = null, string bikeId = null)
|
||||
{
|
||||
var bikesAvailableResponse = await server.GetBikesAvailableAsync(operatorUri);
|
||||
var bikesAvailableResponse = await server.GetBikesAvailableAsync(operatorUri, stationId, bikeId);
|
||||
|
||||
if (operatorUri?.AbsoluteUri != null)
|
||||
{
|
||||
return new Result<BikeCollection>(
|
||||
typeof(CopriCallsMonkeyStore),
|
||||
BikeCollectionFactory.GetBikesAll(
|
||||
bikesAvailableResponse?.bikes?.Values,
|
||||
bikesAvailableResponse?.bikes_occupied?.Values,
|
||||
Mail,
|
||||
DateTimeProvider,
|
||||
Bikes.BikeInfoNS.BC.DataSource.Cache),
|
||||
bikesAvailableResponse?.GetGeneralData());
|
||||
}
|
||||
|
||||
var bikesOccupiedResponse = await server.GetBikesOccupiedAsync();
|
||||
|
||||
return new Result<BikeCollection>(
|
||||
|
@ -84,7 +100,7 @@ namespace TINK.Model.Connector
|
|||
Mail,
|
||||
DateTimeProvider,
|
||||
Bikes.BikeInfoNS.BC.DataSource.Cache),
|
||||
bikesAvailableResponse.GetGeneralData());
|
||||
bikesAvailableResponse?.GetGeneralData());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -122,11 +122,11 @@ namespace TINK.Model
|
|||
|
||||
public interface IResourceUrls
|
||||
{
|
||||
string FeesResourcePath { get; }
|
||||
string TariffsResourcePath { get; }
|
||||
|
||||
string BikesResourcePath { get; }
|
||||
string ManualResourcePath { get; }
|
||||
|
||||
string AgbResourcePath { get; }
|
||||
string GtcResourcePath { get; }
|
||||
|
||||
string PrivacyResourcePath { get; }
|
||||
|
||||
|
|
|
@ -3,24 +3,24 @@ namespace TINK.Model
|
|||
public class ResourceUrls : IResourceUrls
|
||||
{
|
||||
public ResourceUrls(
|
||||
string feesResourcePath = null,
|
||||
string bikesResourcePath = null,
|
||||
string agbResourcePath = null,
|
||||
string tariffsResourcePath = null,
|
||||
string manualResourcePath = null,
|
||||
string gtcResourcePath = null,
|
||||
string privacyResourcePath = null,
|
||||
string impressResourcePath = null)
|
||||
{
|
||||
FeesResourcePath = !string.IsNullOrEmpty(feesResourcePath) ? feesResourcePath : "";
|
||||
BikesResourcePath = !string.IsNullOrEmpty(bikesResourcePath) ? bikesResourcePath : "";
|
||||
AgbResourcePath = !string.IsNullOrEmpty(agbResourcePath) ? agbResourcePath : "";
|
||||
TariffsResourcePath = !string.IsNullOrEmpty(tariffsResourcePath) ? tariffsResourcePath : "";
|
||||
ManualResourcePath = !string.IsNullOrEmpty(manualResourcePath) ? manualResourcePath : "";
|
||||
GtcResourcePath = !string.IsNullOrEmpty(gtcResourcePath) ? gtcResourcePath : "";
|
||||
PrivacyResourcePath = !string.IsNullOrEmpty(privacyResourcePath) ? privacyResourcePath : "";
|
||||
ImpressResourcePath = !string.IsNullOrEmpty(impressResourcePath) ? impressResourcePath : "";
|
||||
}
|
||||
|
||||
public string FeesResourcePath { get; }
|
||||
public string TariffsResourcePath { get; }
|
||||
|
||||
public string BikesResourcePath { get; }
|
||||
public string ManualResourcePath { get; }
|
||||
|
||||
public string AgbResourcePath { get; }
|
||||
public string GtcResourcePath { get; }
|
||||
|
||||
public string PrivacyResourcePath { get; }
|
||||
|
||||
|
|
|
@ -733,7 +733,7 @@ namespace TINK.Model
|
|||
new List<AppFlavor> { AppFlavor.MeinKonrad, AppFlavor.ShareeBike }
|
||||
},
|
||||
{
|
||||
new Version(3, 0, 375),
|
||||
new Version(3, 0, 376),
|
||||
string.Format("{0} <br /> {1} <br /> {2}", AppResources.ChangeLog_MinorImprovements, AppResources.ChangeLog_PackageUpdates, AppResources.ChangeLog_MinorBugFixes),
|
||||
new List<AppFlavor> { AppFlavor.MeinKonrad, AppFlavor.ShareeBike }
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue