mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2025-04-19 03:27:29 +02:00
Version 3.0.270
This commit is contained in:
parent
67999ef4ae
commit
e0c75d5b37
81 changed files with 812 additions and 474 deletions
|
@ -195,13 +195,13 @@ namespace TINK.ViewModel.Bikes.Bike
|
|||
case InUseStateEnum.Reserved:
|
||||
return GetReservedInfo(
|
||||
bike.State.RemainingTime,
|
||||
bike.CurrentStation,
|
||||
bike.StationId,
|
||||
null); // Hide reservation code because no one but active user should see code
|
||||
|
||||
case InUseStateEnum.Booked:
|
||||
return GetBookedInfo(
|
||||
bike.State.From,
|
||||
bike.CurrentStation,
|
||||
bike.StationId,
|
||||
null); // Hide reservation code because no one but active user should see code
|
||||
|
||||
default:
|
||||
|
@ -215,7 +215,7 @@ namespace TINK.ViewModel.Bikes.Bike
|
|||
return bike.State.MailAddress == ActiveUser.Mail
|
||||
? GetReservedInfo(
|
||||
bike.State.RemainingTime,
|
||||
bike.CurrentStation,
|
||||
bike.StationId,
|
||||
bike.State.Code)
|
||||
: "Fahrrad bereits reserviert durch anderen Nutzer.";
|
||||
|
||||
|
@ -223,7 +223,7 @@ namespace TINK.ViewModel.Bikes.Bike
|
|||
return bike.State.MailAddress == ActiveUser.Mail
|
||||
? GetBookedInfo(
|
||||
bike.State.From,
|
||||
bike.CurrentStation,
|
||||
bike.StationId,
|
||||
bike.State.Code)
|
||||
: "Fahrrad bereits gebucht durch anderen Nutzer.";
|
||||
|
||||
|
|
|
@ -27,14 +27,11 @@ namespace TINK.ViewModel.Bikes.Bike
|
|||
// No tariff description details available.
|
||||
return string.Empty;
|
||||
|
||||
// Up to version MessageBikesManagementTariffDescriptionTariffHeaderNameId
|
||||
#if USCSHARP9
|
||||
return Tariff?.Number != null
|
||||
? string.Format(AppResources.MessageBikesManagementTariffDescriptionTariffHeaderNameId, Tariff?.Name ?? "-", Tariff?.Number != null ? Tariff.Number : "-");
|
||||
: string.Format(AppResources.MessageBikesManagementTariffDescriptionTariffHeader, Tariff?.Name ?? "-");
|
||||
return string.Format(AppResources.MessageBikesManagementTariffDescriptionTariffHeader, Tariff?.Name ?? "-");
|
||||
#else
|
||||
return Tariff?.Number != null
|
||||
? string.Format(AppResources.MessageBikesManagementTariffDescriptionTariffHeaderNameId, Tariff?.Name ?? "-", Tariff?.Number != null ? Tariff.Number.ToString() : "-")
|
||||
: string.Format(AppResources.MessageBikesManagementTariffDescriptionTariffHeader, Tariff?.Name ?? "-");
|
||||
return string.Format(AppResources.MessageBikesManagementTariffDescriptionTariffHeader, Tariff?.Name ?? "-");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
|
@ -266,7 +266,7 @@ namespace TINK.ViewModel.BikesAtStation
|
|||
if (!dialogResult)
|
||||
{
|
||||
// User decided not to give access to locations permissions.
|
||||
BikeCollection.Update(bikesAtStation);
|
||||
BikeCollection.Update(bikesAtStation, new List<IStation> { m_oStation});
|
||||
|
||||
await OnAppearing(() => UpdateTask());
|
||||
|
||||
|
@ -287,7 +287,7 @@ namespace TINK.ViewModel.BikesAtStation
|
|||
AppResources.MessageBikesManagementLocationActivation,
|
||||
AppResources.MessageAnswerOk);
|
||||
|
||||
BikeCollection.Update(bikesAtStation);
|
||||
BikeCollection.Update(bikesAtStation, new List<IStation> { m_oStation });
|
||||
|
||||
await OnAppearing(() => UpdateTask());
|
||||
|
||||
|
@ -303,7 +303,7 @@ namespace TINK.ViewModel.BikesAtStation
|
|||
AppResources.MessageBikesManagementBluetoothActivation,
|
||||
AppResources.MessageAnswerOk);
|
||||
|
||||
BikeCollection.Update(bikesAtStation);
|
||||
BikeCollection.Update(bikesAtStation, new List<IStation> { m_oStation });
|
||||
|
||||
await OnAppearing(() => UpdateTask());
|
||||
|
||||
|
@ -330,7 +330,7 @@ namespace TINK.ViewModel.BikesAtStation
|
|||
|
||||
var locksInfo = lockIdList.UpdateById(locksInfoTdo);
|
||||
|
||||
BikeCollection.Update(bikesAtStation.UpdateLockInfo(locksInfo));
|
||||
BikeCollection.Update(bikesAtStation.UpdateLockInfo(locksInfo), new List<IStation> { m_oStation });
|
||||
|
||||
// Backup GUI synchronization context.
|
||||
await OnAppearing(() => UpdateTask());
|
||||
|
@ -363,7 +363,7 @@ namespace TINK.ViewModel.BikesAtStation
|
|||
PostAction(
|
||||
unused =>
|
||||
{
|
||||
BikeCollection.Update(bikes);
|
||||
BikeCollection.Update(bikes, new List<IStation> { m_oStation });
|
||||
Exception = result.Exception;
|
||||
ActionText = string.Empty;
|
||||
},
|
||||
|
|
|
@ -508,7 +508,7 @@ namespace TINK.ViewModel.Contact
|
|||
foreach (var stationId in stationsId)
|
||||
{
|
||||
// Get color of given station.
|
||||
var bikesAtStation = bikesAll.Where(x => x.CurrentStation == stationId).ToList();
|
||||
var bikesAtStation = bikesAll.Where(x => x.StationId == stationId).ToList();
|
||||
if (bikesAtStation.FirstOrDefault(x => x.State.Value != Model.State.InUseStateEnum.Disposable) != null)
|
||||
{
|
||||
// There is at least one requested or booked bike
|
||||
|
|
|
@ -4,16 +4,23 @@ namespace TINK.ViewModel.CopriWebView
|
|||
{
|
||||
public class RegisterPageViewModel
|
||||
{
|
||||
/// <summary> Holds the merchant id.</summary>
|
||||
private string MerchantId { get; }
|
||||
|
||||
/// <summary> Holds the name of the host.</summary>
|
||||
private string HostName { get; }
|
||||
|
||||
public RegisterPageViewModel(
|
||||
string merchantId,
|
||||
string hostName)
|
||||
{
|
||||
HostName = hostName;
|
||||
} /// <summary>Get Uri of web view for creating account.</summary>
|
||||
MerchantId = merchantId;
|
||||
}
|
||||
|
||||
/// <summary>Get Uri of web view for creating account.</summary>
|
||||
public string Uri =>
|
||||
$"https://{HostName}/{HostName.GetAppFolderName()}/Account/1.%20Kundendaten";
|
||||
$"https://{HostName}/{HostName.GetAppFolderName()}/Account/1.%20Kundendaten?sessionid={MerchantId}";
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ using TINK.Services.Permissions;
|
|||
using Plugin.BLE.Abstractions.Contracts;
|
||||
using TINK.MultilingualResources;
|
||||
using TINK.Model.Device;
|
||||
using TINK.Model.Station;
|
||||
|
||||
namespace TINK.ViewModel.FindBike
|
||||
{
|
||||
|
@ -55,6 +56,9 @@ namespace TINK.ViewModel.FindBike
|
|||
/// <summary> Hide id input fields as soon as bike is found.</summary>
|
||||
public bool IsSelectBikeVisible => BikeCollection != null && BikeCollection.Count == 0;
|
||||
|
||||
/// <summary> Holds the stations to get station names form station ids. </summary>
|
||||
private IEnumerable<IStation> Stations { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Constructs bike collection view model in case information about occupied bikes is available.
|
||||
/// </summary>
|
||||
|
@ -66,6 +70,7 @@ namespace TINK.ViewModel.FindBike
|
|||
/// <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="stations">Stations to get station name from station id.</param>
|
||||
/// <param name="polling"> Holds whether to poll or not and the periode leght is polling is on. </param>
|
||||
/// <param name="postAction">Executes actions on GUI thread.</param>
|
||||
/// <param name="smartDevice">Provides info about the smart device (phone, tablet, ...).</param>
|
||||
|
@ -79,6 +84,7 @@ namespace TINK.ViewModel.FindBike
|
|||
Func<bool, IConnector> connectorFactory,
|
||||
IGeolocation geolocation,
|
||||
ILocksService lockService,
|
||||
IEnumerable<IStation> stations,
|
||||
PollingParameters polling,
|
||||
Action<SendOrPostCallback, object> postAction,
|
||||
ISmartDevice smartDevice,
|
||||
|
@ -88,6 +94,8 @@ namespace TINK.ViewModel.FindBike
|
|||
{
|
||||
OnPropertyChanged(new PropertyChangedEventArgs(nameof(IsSelectBikeVisible)));
|
||||
};
|
||||
|
||||
Stations = stations ?? throw new ArgumentException(nameof(stations));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -159,7 +167,7 @@ namespace TINK.ViewModel.FindBike
|
|||
if (!dialogResult)
|
||||
{
|
||||
// User decided not to give access to locations permissions.
|
||||
BikeCollection.Update(bikeCollection);
|
||||
BikeCollection.Update(bikeCollection, Stations);
|
||||
|
||||
//await OnAppearing(() => UpdateTask());
|
||||
|
||||
|
@ -181,7 +189,7 @@ namespace TINK.ViewModel.FindBike
|
|||
AppResources.MessageBikesManagementLocationActivation,
|
||||
AppResources.MessageAnswerOk);
|
||||
|
||||
BikeCollection.Update(bikeCollection);
|
||||
BikeCollection.Update(bikeCollection, Stations);
|
||||
|
||||
await OnAppearing(() => UpdateTask());
|
||||
|
||||
|
@ -198,7 +206,7 @@ namespace TINK.ViewModel.FindBike
|
|||
AppResources.MessageBikesManagementBluetoothActivation,
|
||||
AppResources.MessageAnswerOk);
|
||||
|
||||
BikeCollection.Update(bikeCollection);
|
||||
BikeCollection.Update(bikeCollection, Stations);
|
||||
|
||||
await OnAppearing(() => UpdateTask());
|
||||
|
||||
|
@ -225,7 +233,7 @@ namespace TINK.ViewModel.FindBike
|
|||
|
||||
var locksInfo = lockIdList.UpdateById(locksInfoTdo);
|
||||
|
||||
BikeCollection.Update(bikeCollection.UpdateLockInfo(locksInfo));
|
||||
BikeCollection.Update(bikeCollection.UpdateLockInfo(locksInfo), Stations);
|
||||
|
||||
await OnAppearing(() => UpdateTask());
|
||||
|
||||
|
@ -265,7 +273,7 @@ namespace TINK.ViewModel.FindBike
|
|||
PostAction(
|
||||
unused =>
|
||||
{
|
||||
BikeCollection.Update(bikes); // Updating collection leads to update of GUI.
|
||||
BikeCollection.Update(bikes, Stations); // Updating collection leads to update of GUI.
|
||||
Exception = result.Exception;
|
||||
ActionText = string.Empty;
|
||||
},
|
||||
|
|
|
@ -214,6 +214,7 @@ namespace TINK.ViewModel
|
|||
public async Task Login()
|
||||
#endif
|
||||
{
|
||||
IAccount account = new EmptyAccount();
|
||||
try
|
||||
{
|
||||
Log.ForContext<LoginPageViewModel>().Information("User taped login button.");
|
||||
|
@ -223,9 +224,9 @@ namespace TINK.ViewModel
|
|||
TinkApp.ActiveUser.CheckIsPasswordValid(MailAddress, Password);
|
||||
|
||||
// Do login.
|
||||
var l_oAccount = await TinkApp.GetConnector(CrossConnectivity.Current.IsConnected).Command.DoLogin(MailAddress, Password, TinkApp.ActiveUser.DeviceId);
|
||||
account = await TinkApp.GetConnector(CrossConnectivity.Current.IsConnected).Command.DoLogin(MailAddress, Password, TinkApp.ActiveUser.DeviceId);
|
||||
|
||||
await TinkApp.ActiveUser.Login(l_oAccount);
|
||||
await TinkApp.ActiveUser.Login(account);
|
||||
|
||||
// Update map page filter because user might be of both groups TINK an Konrad.
|
||||
TinkApp.GroupFilterMapPage =
|
||||
|
@ -318,7 +319,8 @@ namespace TINK.ViewModel
|
|||
{
|
||||
// No need to show "Anleitung TINK Räder" because user can not use tink.
|
||||
#if USEFLYOUT
|
||||
m_oViewService.ShowPage(ViewTypes.MapPage);
|
||||
|
||||
m_oViewService.ShowPage(account.IsAgbAcknowledged ? ViewTypes.MapPage : ViewTypes.ManageAccountPage);
|
||||
#else
|
||||
await m_oViewService.ShowPage("//MapPage");
|
||||
#endif
|
||||
|
|
|
@ -34,6 +34,10 @@ namespace TINK.ViewModel.Map
|
|||
{
|
||||
public class MapPageViewModel : INotifyPropertyChanged
|
||||
{
|
||||
/// <summary> True if message was already shown to user. </summary>
|
||||
private static bool WasMerchantMessageAlreadyShown { get; set; } = false;
|
||||
|
||||
|
||||
/// <summary> Holds the count of custom icons availalbe.</summary>
|
||||
private const int CUSTOM_ICONS_COUNT = 30;
|
||||
|
||||
|
@ -322,6 +326,16 @@ namespace TINK.ViewModel.Map
|
|||
|
||||
TinkApp.Stations = resultStationsAndBikes.Response.StationsAll;
|
||||
|
||||
if (!string.IsNullOrEmpty(resultStationsAndBikes?.GeneralData?.MerchantMessage)
|
||||
&& !WasMerchantMessageAlreadyShown)
|
||||
{
|
||||
await ViewService.DisplayAlert(
|
||||
"Information",
|
||||
resultStationsAndBikes.GeneralData.MerchantMessage,
|
||||
"OK");
|
||||
WasMerchantMessageAlreadyShown = true;
|
||||
}
|
||||
|
||||
await SetStationsOnMap(resultStationsAndBikes.Response.StationsAll);
|
||||
await HandleAuthCookieNotDefinedException(resultStationsAndBikes.Exception);
|
||||
|
||||
|
@ -677,7 +691,7 @@ namespace TINK.ViewModel.Map
|
|||
foreach (var stationId in stationsId)
|
||||
{
|
||||
// Get color of given station.
|
||||
var bikesAtStation = bikesAll.Where(x => x.CurrentStation == stationId).ToList();
|
||||
var bikesAtStation = bikesAll.Where(x => x.StationId == stationId).ToList();
|
||||
if (bikesAtStation.FirstOrDefault(x => x.State.Value != Model.State.InUseStateEnum.Disposable) != null)
|
||||
{
|
||||
// There is at least one requested or booked bike
|
||||
|
|
|
@ -22,11 +22,15 @@ using TINK.Services.Permissions;
|
|||
using Plugin.BLE.Abstractions.Contracts;
|
||||
using TINK.MultilingualResources;
|
||||
using TINK.Model.Device;
|
||||
using TINK.Model.Station;
|
||||
|
||||
namespace TINK.ViewModel.MyBikes
|
||||
{
|
||||
public class MyBikesPageViewModel : BikesViewModel, INotifyCollectionChanged, INotifyPropertyChanged
|
||||
{
|
||||
/// <summary> Holds the stations to get station names form station ids. </summary>
|
||||
private IEnumerable<IStation> Stations { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Constructs bike collection view model in case information about occupied bikes is available.
|
||||
/// </summary>
|
||||
|
@ -38,6 +42,7 @@ namespace TINK.ViewModel.MyBikes
|
|||
/// <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="stations">Stations to get station name from station id.</param>
|
||||
/// <param name="p_oPolling"> Holds whether to poll or not and the periode leght is polling is on. </param>
|
||||
/// <param name="postAction">Executes actions on GUI thread.</param>
|
||||
/// <param name="smartDevice">Provides info about the smart device (phone, tablet, ...).</param>
|
||||
|
@ -51,6 +56,7 @@ namespace TINK.ViewModel.MyBikes
|
|||
Func<bool, IConnector> connectorFactory,
|
||||
IGeolocation geolocation,
|
||||
ILocksService lockService,
|
||||
IEnumerable<IStation> stations,
|
||||
PollingParameters p_oPolling,
|
||||
Action<SendOrPostCallback, object> postAction,
|
||||
ISmartDevice smartDevice,
|
||||
|
@ -61,6 +67,8 @@ namespace TINK.ViewModel.MyBikes
|
|||
OnPropertyChanged(new PropertyChangedEventArgs(nameof(IsNoBikesOccupiedVisible)));
|
||||
OnPropertyChanged(new PropertyChangedEventArgs(nameof(NoBikesOccupiedText)));
|
||||
};
|
||||
|
||||
Stations = stations ?? throw new ArgumentException(nameof(stations));
|
||||
}
|
||||
|
||||
/// <summary> Returns if info about the fact that user did not request or book any bikes is visible or not.<summary>
|
||||
|
@ -134,7 +142,7 @@ namespace TINK.ViewModel.MyBikes
|
|||
if (!dialogResult)
|
||||
{
|
||||
// User decided not to give access to locations permissions.
|
||||
BikeCollection.Update(bikesOccupied.Response);
|
||||
BikeCollection.Update(bikesOccupied.Response, Stations);
|
||||
|
||||
await OnAppearing(() => UpdateTask());
|
||||
|
||||
|
@ -156,7 +164,7 @@ namespace TINK.ViewModel.MyBikes
|
|||
AppResources.MessageBikesManagementLocationActivation,
|
||||
AppResources.MessageAnswerOk);
|
||||
|
||||
BikeCollection.Update(bikesOccupied.Response);
|
||||
BikeCollection.Update(bikesOccupied.Response, Stations);
|
||||
|
||||
await OnAppearing(() => UpdateTask());
|
||||
|
||||
|
@ -173,7 +181,7 @@ namespace TINK.ViewModel.MyBikes
|
|||
AppResources.MessageBikesManagementBluetoothActivation,
|
||||
AppResources.MessageAnswerOk);
|
||||
|
||||
BikeCollection.Update(bikesOccupied.Response);
|
||||
BikeCollection.Update(bikesOccupied.Response, Stations);
|
||||
|
||||
await OnAppearing(() => UpdateTask());
|
||||
|
||||
|
@ -200,7 +208,7 @@ namespace TINK.ViewModel.MyBikes
|
|||
|
||||
var locksInfo = lockIdList.UpdateById(locksInfoTdo);
|
||||
|
||||
BikeCollection.Update(bikesOccupied.Response.UpdateLockInfo(locksInfo));
|
||||
BikeCollection.Update(bikesOccupied.Response.UpdateLockInfo(locksInfo), Stations);
|
||||
|
||||
await OnAppearing(() => UpdateTask());
|
||||
|
||||
|
@ -251,7 +259,7 @@ namespace TINK.ViewModel.MyBikes
|
|||
PostAction(
|
||||
unused =>
|
||||
{
|
||||
BikeCollection.Update(bikes); // Updating collection leads to update of GUI.
|
||||
BikeCollection.Update(bikes, Stations); // Updating collection leads to update of GUI.
|
||||
Exception = result.Exception;
|
||||
ActionText = string.Empty;
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue