Version 3.0.337

This commit is contained in:
Anja Müller-Meißner 2022-08-30 15:42:25 +02:00
parent fd0e63cf10
commit 573fe77e12
2336 changed files with 33688 additions and 86082 deletions

View file

@ -1,29 +1,29 @@

using Serilog;
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using TINK.Model.Bike;
using TINK.Model.Connector;
using TINK.Model.User;
using TINK.View;
using TINK.Settings;
using TINK.Model.Bike.BluetoothLock;
using System.Collections.Generic;
using TINK.Services.BluetoothLock;
using TINK.Services.Geolocation;
using System.Linq;
using TINK.Model;
using Xamarin.Forms;
using TINK.ViewModel.Bikes;
using TINK.Services.BluetoothLock.Tdo;
using TINK.Services.Permissions;
using Plugin.BLE.Abstractions.Contracts;
using TINK.MultilingualResources;
using Serilog;
using TINK.Model;
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.User;
using TINK.MultilingualResources;
using TINK.Services.BluetoothLock;
using TINK.Services.BluetoothLock.Tdo;
using TINK.Services.Geolocation;
using TINK.Services.Permissions;
using TINK.Settings;
using TINK.View;
using TINK.ViewModel.Bikes;
using Xamarin.Forms;
namespace TINK.ViewModel.FindBike
{
@ -32,7 +32,7 @@ namespace TINK.ViewModel.FindBike
private string bikeIdUserInput = string.Empty;
/// <summary> Text entered by user to specify a bike.</summary>
public string BikeIdUserInput
public string BikeIdUserInput
{
get => bikeIdUserInput;
set
@ -69,7 +69,7 @@ namespace TINK.ViewModel.FindBike
/// <summary> Do not allow to select bike if id is not set.</summary>
public bool IsSelectBikeEnabled => IsIdle && BikeIdUserInput != null && BikeIdUserInput.Length > 0;
/// <summary> Hide id input fields as soon as bike is found.</summary>
public bool IsSelectBikeVisible => BikeCollection != null && BikeCollection.Count == 0;
@ -131,13 +131,13 @@ namespace TINK.ViewModel.FindBike
Exception = bikes.Exception; // Update communication error from query for bikes occupied.
Bikes = bikes.Response;
ActionText = "";
IsIdle = true;
}
/// <summary> Command object to bind select bike button to view model. </summary>
public System.Windows.Input.ICommand OnSelectBikeRequest => new Xamarin.Forms.Command(async () => await SelectBike(), () => IsSelectBikeEnabled);
public System.Windows.Input.ICommand OnSelectBikeRequest => new Xamarin.Forms.Command(async () => await SelectBike(), () => IsSelectBikeEnabled);
/// <summary> Select a bike by ID</summary>
public async Task SelectBike()
@ -149,17 +149,17 @@ namespace TINK.ViewModel.FindBike
if (selectedBike == null)
{
await ViewService.DisplayAlert(
AppResources.MessageTitleHint,
string.Format(AppResources.MessageErrorSelectBikeNoBikeFound, BikeIdUserInput),
AppResources.MessageTitleHint,
string.Format(AppResources.MessageErrorSelectBikeNoBikeFound, BikeIdUserInput),
AppResources.MessageAnswerOk);
return;
}
var bikeCollection = new BikeCollection(new Dictionary<string, Model.Bike.BC.BikeInfo> { { selectedBike.Id, selectedBike } });
var bikeCollection = new BikeCollection(new Dictionary<string, Model.Bikes.BikeInfoNS.BC.BikeInfo> { { selectedBike.Id, selectedBike } });
var lockIdList = bikeCollection
.GetLockIt()
.Cast<BikeInfo>()
.Cast<Model.Bikes.BikeInfoNS.BluetoothLock.BikeInfo>()
.Select(x => x.LockInfo)
.ToList();
@ -171,7 +171,7 @@ namespace TINK.ViewModel.FindBike
// Check bluetooth and location permission and states
ActionText = AppResources.ActivityTextCheckBluetoothState;
if (bikeCollection.FirstOrDefault(x => x is BikeInfo btBike) != null
if (bikeCollection.FirstOrDefault(x => x is Model.Bikes.BikeInfoNS.BluetoothLock.BikeInfo btBike) != null
&& RuntimePlatform == Device.Android)
{
// Check location permission
@ -263,11 +263,12 @@ namespace TINK.ViewModel.FindBike
ActionText = "";
IsIdle = true;
} catch (Exception exception)
}
catch (Exception exception)
{
await ViewService.DisplayAlert(
AppResources.MessageErrorSelectBikeTitle,
exception.Message,
AppResources.MessageErrorSelectBikeTitle,
exception.Message,
AppResources.MessageAnswerOk);
Log.ForContext<FindBikePageViewModel>().Error("Running command to select bike failed. {Exception}", exception);
@ -300,7 +301,7 @@ namespace TINK.ViewModel.FindBike
var selectedBike = bikes.FirstOrDefault(x => x.Id.Equals(BikeIdUserInput.Trim(), StringComparison.OrdinalIgnoreCase));
bikes = selectedBike != null
? new BikeCollection(new Dictionary<string, Model.Bike.BC.BikeInfo> { { selectedBike.Id, selectedBike } })
? new BikeCollection(new Dictionary<string, Model.Bikes.BikeInfoNS.BC.BikeInfo> { { selectedBike.Id, selectedBike } })
: new BikeCollection();
PostAction(