mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2025-04-22 21:06:30 +02:00
Code updated to 3.0.238
This commit is contained in:
parent
3302d80678
commit
9c6a1fa92b
257 changed files with 7763 additions and 2861 deletions
|
@ -1,9 +1,9 @@
|
|||
using Serilog;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using TINK.Model.Repository;
|
||||
using TINK.Model.Repository.Request;
|
||||
using TINK.Model.Repository.Response;
|
||||
using TINK.Model.Device;
|
||||
using TINK.Repository;
|
||||
using TINK.Repository.Request;
|
||||
using TINK.Repository.Response;
|
||||
|
||||
namespace TINK.Model.Services.CopriApi
|
||||
|
@ -123,9 +123,12 @@ namespace TINK.Model.Services.CopriApi
|
|||
try
|
||||
{
|
||||
Log.ForContext<CopriProviderHttps>().Debug($"Querrying stations from copri.");
|
||||
|
||||
var stations = await HttpsServer.GetStationsAsync();
|
||||
|
||||
return new Result<StationsAllResponse>(
|
||||
typeof(CopriCallsHttps),
|
||||
(await HttpsServer.GetStationsAsync()).GetIsResponseOk("Abfrage der Stationen fehlsgeschlagen."));
|
||||
stations.GetIsResponseOk("Abfrage der Stationen fehlsgeschlagen."));
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
|
@ -197,23 +200,23 @@ namespace TINK.Model.Services.CopriApi
|
|||
return await HttpsServer.DoAuthoutAsync();
|
||||
}
|
||||
|
||||
public async Task<ReservationBookingResponse> DoReserveAsync(int p_iBikeId, Uri operatorUri)
|
||||
public async Task<ReservationBookingResponse> DoReserveAsync(string bikeId, Uri operatorUri)
|
||||
{
|
||||
return await HttpsServer.DoReserveAsync(p_iBikeId, operatorUri);
|
||||
return await HttpsServer.DoReserveAsync(bikeId, operatorUri);
|
||||
}
|
||||
|
||||
public async Task<ReservationCancelReturnResponse> DoCancelReservationAsync(int p_iBikeId, Uri operatorUri)
|
||||
public async Task<ReservationCancelReturnResponse> DoCancelReservationAsync(string bikeId, Uri operatorUri)
|
||||
{
|
||||
return await HttpsServer.DoCancelReservationAsync(p_iBikeId, operatorUri);
|
||||
return await HttpsServer.DoCancelReservationAsync(bikeId, operatorUri);
|
||||
}
|
||||
|
||||
public async Task<ReservationBookingResponse> CalculateAuthKeysAsync(int bikeId, Uri operatorUri)
|
||||
public async Task<ReservationBookingResponse> CalculateAuthKeysAsync(string bikeId, Uri operatorUri)
|
||||
{
|
||||
return await HttpsServer.CalculateAuthKeysAsync(bikeId, operatorUri);
|
||||
}
|
||||
|
||||
public async Task<ReservationBookingResponse> UpdateLockingStateAsync(
|
||||
int bikeId,
|
||||
string bikeId,
|
||||
LocationDto location,
|
||||
lock_state state,
|
||||
double batteryLevel,
|
||||
|
@ -225,22 +228,27 @@ namespace TINK.Model.Services.CopriApi
|
|||
/// <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>
|
||||
/// <returns>Response on booking request.</returns>
|
||||
public async Task<ReservationBookingResponse> DoBookAsync(int bikeId, Guid guid, double batteryPercentage, Uri operatorUri)
|
||||
public async Task<ReservationBookingResponse> DoBookAsync(string bikeId, Guid guid, double batteryPercentage, Uri operatorUri)
|
||||
{
|
||||
return await HttpsServer.DoBookAsync(bikeId, guid, batteryPercentage, operatorUri);
|
||||
}
|
||||
|
||||
public async Task<ReservationCancelReturnResponse> DoReturn(int bikeId, LocationDto location, Uri operatorUri)
|
||||
public async Task<ReservationCancelReturnResponse> DoReturn(
|
||||
string bikeId,
|
||||
LocationDto location,
|
||||
ISmartDevice smartDevice,
|
||||
Uri operatorUri)
|
||||
{
|
||||
return await HttpsServer.DoReturn(bikeId, location, operatorUri);
|
||||
return await HttpsServer.DoReturn(bikeId, location, smartDevice, operatorUri);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Submits feedback to copri server.
|
||||
/// </summary>
|
||||
/// <param name="bikeId">Id of the bike to submit feedback for.</param>
|
||||
/// <param name="message">General purpose message or error description.</param>
|
||||
/// <param name="isBikeBroken">True if bike is broken.</param>
|
||||
public async Task<SubmitFeedbackResponse> DoSubmitFeedback(string message, bool isBikeBroken, Uri opertorUri) =>
|
||||
await HttpsServer.DoSubmitFeedback(message, isBikeBroken, opertorUri);
|
||||
public async Task<SubmitFeedbackResponse> DoSubmitFeedback(string bikeId, string message, bool isBikeBroken, Uri opertorUri) =>
|
||||
await HttpsServer.DoSubmitFeedback(bikeId, message, isBikeBroken, opertorUri);
|
||||
}
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using TINK.Model.Repository;
|
||||
using TINK.Model.Repository.Request;
|
||||
using TINK.Model.Repository.Response;
|
||||
using TINK.Model.Device;
|
||||
using TINK.Repository;
|
||||
using TINK.Repository.Request;
|
||||
using TINK.Repository.Response;
|
||||
|
||||
namespace TINK.Model.Services.CopriApi
|
||||
|
@ -30,34 +30,38 @@ namespace TINK.Model.Services.CopriApi
|
|||
/// <summary> Gets the merchant id.</summary>
|
||||
public string MerchantId => monkeyStore.MerchantId;
|
||||
|
||||
public Task<ReservationBookingResponse> DoReserveAsync(int p_iBikeId, Uri operatorUri)
|
||||
public Task<ReservationBookingResponse> DoReserveAsync(string bikeId, Uri operatorUri)
|
||||
=> throw new NotSupportedException($"{nameof(DoReserveAsync)} is not cachable.");
|
||||
|
||||
public Task<ReservationCancelReturnResponse> DoCancelReservationAsync(int p_iBikeId, Uri operatorUri)
|
||||
public Task<ReservationCancelReturnResponse> DoCancelReservationAsync(string bikeId, Uri operatorUri)
|
||||
=> throw new NotSupportedException($"{nameof(DoCancelReservationAsync)} is not cachable.");
|
||||
|
||||
public Task<ReservationBookingResponse> CalculateAuthKeysAsync(int bikeId, Uri operatorUri)
|
||||
public Task<ReservationBookingResponse> CalculateAuthKeysAsync(string bikeId, Uri operatorUri)
|
||||
=> throw new NotSupportedException($"{nameof(CalculateAuthKeysAsync)} is not cachable.");
|
||||
|
||||
public async Task<ReservationBookingResponse> UpdateLockingStateAsync(
|
||||
int bikeId,
|
||||
string bikeId,
|
||||
LocationDto geolocation,
|
||||
lock_state state,
|
||||
double batteryLevel,
|
||||
Uri operatorUri)
|
||||
=> await monkeyStore.UpdateLockingStateAsync(bikeId, geolocation, state, batteryLevel, operatorUri);
|
||||
|
||||
public async Task<ReservationBookingResponse> DoBookAsync(int bikeId, Guid guid, double batteryPercentage, Uri operatorUri)
|
||||
public async Task<ReservationBookingResponse> DoBookAsync(string bikeId, Guid guid, double batteryPercentage, Uri operatorUri)
|
||||
{
|
||||
return await monkeyStore.DoBookAsync(bikeId, guid, batteryPercentage, operatorUri);
|
||||
}
|
||||
|
||||
public async Task<ReservationCancelReturnResponse> DoReturn(int bikeId, LocationDto geolocation, Uri operatorUri)
|
||||
public async Task<ReservationCancelReturnResponse> DoReturn(
|
||||
string bikeId,
|
||||
LocationDto geolocation,
|
||||
ISmartDevice smartDevice,
|
||||
Uri operatorUri)
|
||||
{
|
||||
return await monkeyStore.DoReturn(bikeId, geolocation, operatorUri);
|
||||
return await monkeyStore.DoReturn(bikeId, geolocation, smartDevice, operatorUri);
|
||||
}
|
||||
|
||||
public Task<SubmitFeedbackResponse> DoSubmitFeedback(string messge, bool bIsBikeBroke, Uri operatorUri) => throw new NotImplementedException();
|
||||
public Task<SubmitFeedbackResponse> DoSubmitFeedback(string bikeId, string messge, bool bIsBikeBroke, Uri operatorUri) => throw new NotImplementedException();
|
||||
|
||||
public async Task<AuthorizationResponse> DoAuthorizationAsync(string p_strMailAddress, string p_strPassword, string p_strDeviceId)
|
||||
{
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using TINK.Model.Repository;
|
||||
using TINK.Model.Repository.Response;
|
||||
using TINK.Repository;
|
||||
using TINK.Repository.Response;
|
||||
|
||||
namespace TINK.Model.Services.CopriApi
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
using TINK.Model.Repository;
|
||||
using TINK.Model.Repository.Response;
|
||||
using TINK.Repository;
|
||||
using TINK.Repository.Response;
|
||||
|
||||
namespace TINK.Model.Services.CopriApi
|
||||
{
|
||||
|
|
|
@ -32,13 +32,13 @@ namespace TINK.Services.CopriApi.ServerUris
|
|||
|
||||
/// <summary> Get the agb resource name name depending on host name. </summary>
|
||||
/// <param name="hostName">Host name.</param>
|
||||
/// <returns>AGB resource..</returns>
|
||||
/// <returns>AGB resource.</returns>
|
||||
public static string GetAGBResource(this string hostName)
|
||||
=> $"{hostName.GetSiteFolderName()}/{(hostName.GetIsCopri()? "konrad-TINK-AGB" : "agb.html")}";
|
||||
|
||||
/// <summary> Get the agb resource name name depending on host name. </summary>
|
||||
/// <summary> Get the privacy resource name name depending on host name. </summary>
|
||||
/// <param name="hostName">Host name.</param>
|
||||
/// <returns>AGB resource..</returns>
|
||||
/// <returns>Privacy resource.</returns>
|
||||
public static string GetPrivacyResource(this string hostName)
|
||||
=> $"{hostName.GetSiteFolderName()}/{(hostName.GetIsCopri() ? "Datenschutz" : "privacy.html")}";
|
||||
}
|
||||
|
|
|
@ -73,7 +73,11 @@ namespace TINK.Model.Services.CopriApi.ServerUris
|
|||
public Uri ActiveUri { get; }
|
||||
|
||||
/// <summary> Gets the active uri. </summary>
|
||||
public static Uri DevelopUri => new(TINK_DEVEL);
|
||||
#if USCSHARP9
|
||||
public static Uri DevelopUri => new (TINK_DEVEL);
|
||||
#else
|
||||
public static Uri DevelopUri => new Uri(TINK_DEVEL);
|
||||
#endif
|
||||
|
||||
/// <summary> Gets the known uris. </summary>
|
||||
[JsonProperty]
|
||||
|
|
14
TINKLib/Services/IServicesContainer.cs
Normal file
14
TINKLib/Services/IServicesContainer.cs
Normal file
|
@ -0,0 +1,14 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace TINK.Services
|
||||
{
|
||||
public interface IServicesContainer<T> : IEnumerable<T>
|
||||
{
|
||||
/// <summary> Get the active service.</summary>
|
||||
T Active { get; }
|
||||
|
||||
/// <summary> Sets service as active service by name. </summary>
|
||||
/// <param name="active">Name of the new service obecs.</param>
|
||||
void SetActive(string active);
|
||||
}
|
||||
}
|
|
@ -8,7 +8,7 @@ namespace TINK.Services
|
|||
{
|
||||
/// <summary> Container of service objects (locks , geolocation, ...) where one service is active. </summary>
|
||||
/// <remarks> All service objects must be of different type. </remarks>
|
||||
public class ServicesContainerMutable<T>: IEnumerable<T>, INotifyPropertyChanged
|
||||
public class ServicesContainerMutable<T>: IEnumerable<T>, INotifyPropertyChanged, IServicesContainer<T>
|
||||
{
|
||||
private readonly Dictionary<string, T> serviceDict;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue