Version 3.0.340

This commit is contained in:
Anja 2022-09-20 13:51:55 +02:00
parent 52c9f6f1d9
commit bad07e1ec9
62 changed files with 1401 additions and 1000 deletions

View file

@ -1,13 +1,12 @@
using System;
using System;
using System.Collections.Generic;
using TINK.Model.Bikes.BikeInfoNS.BikeNS;
using TINK.Model.Bikes.BikeInfoNS.DriveNS;
using TINK.Model.State;
namespace TINK.Model.Bikes.BikeInfoNS.BluetoothLock
{
public class BikeInfo : Model.Bikes.BikeInfoNS.BC.BikeInfo, IBikeInfo
public class BikeInfo : BC.BikeInfo, IBikeInfo
{
/// <summary>
/// Constructs a bike info object for a available bike.
@ -18,7 +17,7 @@ namespace TINK.Model.Bikes.BikeInfoNS.BluetoothLock
/// <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(
BikeNS.Bike bike,
Bike bike,
Drive drive,
int lockId,
Guid lockGuid,
@ -29,7 +28,7 @@ namespace TINK.Model.Bikes.BikeInfoNS.BluetoothLock
IEnumerable<string> group = null) : base(
new StateInfo(),
bike != null
? new BikeNS.Bike(
? new Bike(
bike.Id,
LockModel.ILockIt /* Ensure consistend lock model value */,
bike.WheelType,
@ -43,7 +42,7 @@ namespace TINK.Model.Bikes.BikeInfoNS.BluetoothLock
operatorUri,
tariffDescription)
{
LockInfo = new Model.Bikes.BikeInfoNS.BluetoothLock.LockInfo.Builder { Id = lockId, Guid = lockGuid }.Build();
LockInfo = new LockInfo.Builder { Id = lockId, Guid = lockGuid }.Build();
}
/// <summary>
@ -59,7 +58,7 @@ namespace TINK.Model.Bikes.BikeInfoNS.BluetoothLock
/// <param name="tariffDescription">Hold tariff description of bike.</param>
/// <param name="dateTimeProvider">Date time provider to calculate reaining time.</param>
public BikeInfo(
BikeNS.Bike bike,
Bike bike,
Drive drive,
int lockId,
Guid lockGuid,
@ -80,7 +79,7 @@ namespace TINK.Model.Bikes.BikeInfoNS.BluetoothLock
mailAddress,
""),
bike != null
? new BikeNS.Bike(
? new Bike(
bike.Id,
LockModel.ILockIt /* Ensure consistend lock model value */,
bike.WheelType,
@ -94,7 +93,7 @@ namespace TINK.Model.Bikes.BikeInfoNS.BluetoothLock
operatorUri,
tariffDescription)
{
LockInfo = new Model.Bikes.BikeInfoNS.BluetoothLock.LockInfo.Builder { Id = lockId, Guid = lockGuid, UserKey = userKey, AdminKey = adminKey, Seed = seed }.Build();
LockInfo = new LockInfo.Builder { Id = lockId, Guid = lockGuid, UserKey = userKey, AdminKey = adminKey, Seed = seed }.Build();
}
/// <summary>
@ -110,7 +109,7 @@ namespace TINK.Model.Bikes.BikeInfoNS.BluetoothLock
/// <param name="tariffDescription">Hold tariff description of bike.</param>
/// <param name="wheelType"></param>
public BikeInfo(
BikeNS.Bike bike,
Bike bike,
Drive drive,
int lockId,
Guid lockGuid,
@ -129,7 +128,7 @@ namespace TINK.Model.Bikes.BikeInfoNS.BluetoothLock
mailAddress,
""),
bike != null
? new BikeNS.Bike(
? new Bike(
bike.Id,
LockModel.ILockIt /* Ensure consistend lock model value */,
bike.WheelType,
@ -143,16 +142,16 @@ namespace TINK.Model.Bikes.BikeInfoNS.BluetoothLock
operatorUri,
tariffDescription)
{
LockInfo = new Model.Bikes.BikeInfoNS.BluetoothLock.LockInfo.Builder { Id = lockId, Guid = lockGuid, UserKey = userKey, AdminKey = adminKey, Seed = seed }.Build();
LockInfo = new LockInfo.Builder { Id = lockId, Guid = lockGuid, UserKey = userKey, AdminKey = adminKey, Seed = seed }.Build();
}
public BikeInfo(Model.Bikes.BikeInfoNS.BC.BikeInfo bikeInfo, Model.Bikes.BikeInfoNS.BluetoothLock.LockInfo lockInfo) : base(
public BikeInfo(Model.Bikes.BikeInfoNS.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
?? throw new ArgumentException($"Can not copy-construct {typeof(BikeInfo).Name}-object. Source lock object must not be null.");
}
public Model.Bikes.BikeInfoNS.BluetoothLock.LockInfo LockInfo { get; private set; }
public LockInfo LockInfo { get; private set; }
}
}

View file

@ -1,4 +1,4 @@
using System;
using System;
namespace TINK.Model.Bikes.BikeInfoNS.BluetoothLock
{
@ -19,5 +19,10 @@ namespace TINK.Model.Bikes.BikeInfoNS.BluetoothLock
Guid Guid { get; set; }
byte[] Seed { get; }
/// <summary>
/// Gets the version info of the locks.
/// </summary>
IVersionInfo VersionInfo { get; set; }
}
}

View file

@ -0,0 +1,20 @@
namespace TINK.Model.Bikes.BikeInfoNS.BluetoothLock
{
public interface IVersionInfo
{
/// <summary>
/// Holds the firmware version of the lock.
/// </summary>
int FirmwareVersion { get; }
/// <summary>
/// Holds the hardware version (revision) of the lock.
/// </summary>
int HardwareVersion { get; }
/// <summary>
/// Holds lock version (2 classic, 3 plus, 4 GPS).
/// </summary>
int LockVersion { get; }
}
}

View file

@ -1,11 +1,11 @@
using System;
using System;
namespace TINK.Model.Bikes.BikeInfoNS.BluetoothLock
{
public class LockInfoMutable : TINK.Model.Bikes.BikeInfoNS.BluetoothLock.ILockInfoMutable
public class LockInfoMutable : ILockInfoMutable
{
/// <summary> Lock info object. </summary>
private Model.Bikes.BikeInfoNS.BluetoothLock.LockInfo LockInfo { get; set; }
private LockInfo LockInfo { get; set; }
/// <summary> Constructs a bluetooth lock info object. </summary>
/// <param name="id">Id of lock must always been known when constructing an lock info object.</param>
@ -15,9 +15,9 @@ namespace TINK.Model.Bikes.BikeInfoNS.BluetoothLock
byte[] userKey,
byte[] adminKey,
byte[] seed,
Model.Bikes.BikeInfoNS.BluetoothLock.LockingState state)
LockingState state)
{
LockInfo = new Model.Bikes.BikeInfoNS.BluetoothLock.LockInfo.Builder() { Id = id, Guid = guid, UserKey = userKey, AdminKey = adminKey, Seed = seed, State = state }.Build();
LockInfo = new LockInfo.Builder() { Id = id, Guid = guid, UserKey = userKey, AdminKey = adminKey, Seed = seed, State = state }.Build();
}
public int Id => LockInfo.Id;
@ -26,7 +26,7 @@ namespace TINK.Model.Bikes.BikeInfoNS.BluetoothLock
public Guid Guid
{
get => LockInfo.Guid;
set => LockInfo = new Model.Bikes.BikeInfoNS.BluetoothLock.LockInfo.Builder(LockInfo) { Guid = value }.Build();
set => LockInfo = new LockInfo.Builder(LockInfo) { Guid = value }.Build();
}
public byte[] Seed => LockInfo.Seed;
@ -35,19 +35,24 @@ namespace TINK.Model.Bikes.BikeInfoNS.BluetoothLock
public byte[] AdminKey => LockInfo.AdminKey;
public Model.Bikes.BikeInfoNS.BluetoothLock.LockingState State
public LockingState State
{
get => LockInfo.State;
set => LockInfo = new Model.Bikes.BikeInfoNS.BluetoothLock.LockInfo.Builder(LockInfo) { State = value }.Build();
set => LockInfo = new LockInfo.Builder(LockInfo) { State = value }.Build();
}
/// <summary> Holds the percentage of lock battery.</summary>
public double BatteryPercentage { get; set; } = double.NaN;
/// <summary>
/// Gets the version info of the lock.
/// </summary>
public IVersionInfo VersionInfo { get; set; } = new VersionInfo.Builder().Build();
/// <summary> Loads lock info object from values. </summary>
public void Load(int id, Guid guid, byte[] seed, byte[] userKey, byte[] adminKey)
{
LockInfo = new Model.Bikes.BikeInfoNS.BluetoothLock.LockInfo.Builder(LockInfo) { Id = id, Guid = guid, Seed = seed, UserKey = userKey, AdminKey = adminKey }.Build();
LockInfo = new LockInfo.Builder(LockInfo) { Id = id, Guid = guid, Seed = seed, UserKey = userKey, AdminKey = adminKey }.Build();
}
}
}

View file

@ -0,0 +1,69 @@
using Newtonsoft.Json;
namespace TINK.Model.Bikes.BikeInfoNS.BluetoothLock
{
public class VersionInfo : IVersionInfo
{
/// <summary>
/// Holds info about firmware- and hardware version of a lock and the type of lock (lock version).
/// </summary>
private VersionInfo() { }
/// <summary>
/// Holds the firmware version of the lock.
/// </summary>
public int FirmwareVersion { get; private set; } = 0;
/// <summary>
/// Holds the hardware version (revision) of the lock.
/// </summary>
public int HardwareVersion { get; private set; } = 0;
/// <summary>
/// Holds lock version (2 classic, 3 plus, 4 GPS).
/// </summary>
public int LockVersion { get; private set; } = 0;
public override bool Equals(object obj)
=> Equals(obj as VersionInfo);
public bool Equals(VersionInfo other)
{
if (ReferenceEquals(other, null)) return false;
if (ReferenceEquals(this, other)) return true;
if (GetType() != other.GetType()) return false;
return ToString() == other.ToString();
}
public override int GetHashCode() => ToString().GetHashCode();
public override string ToString() => JsonConvert.SerializeObject(this);
public static bool operator ==(VersionInfo lhs, VersionInfo rhs)
{
if (ReferenceEquals(lhs, null))
return ReferenceEquals(rhs, null) ? true /*null == null = true*/: false;
return lhs.Equals(rhs);
}
public static bool operator !=(VersionInfo lhs, VersionInfo rhs)
=> !(lhs == rhs);
public class Builder
{
private VersionInfo versionInfo = new VersionInfo();
public int FirmwareVersion { get => versionInfo.FirmwareVersion; set => versionInfo.FirmwareVersion = value; }
public int HardwareVersion { get => versionInfo.HardwareVersion; set => versionInfo.HardwareVersion = value; }
public int LockVersion { get => versionInfo.LockVersion; set => versionInfo.LockVersion = value; }
public VersionInfo Build()
{
return versionInfo;
}
}
}
}

View file

@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
@ -226,7 +226,8 @@ namespace TINK.Model.Connector
state.Value,
bike.OperatorUri,
location,
bike.LockInfo.BatteryPercentage)).GetIsBookingResponseOk(bike.Id);
bike.LockInfo.BatteryPercentage,
bike.LockInfo.VersionInfo)).GetIsBookingResponseOk(bike.Id);
}
catch (Exception)
{
@ -320,4 +321,4 @@ namespace TINK.Model.Connector
public async Task CloseLockAsync(Bikes.BikeInfoNS.CopriLock.IBikeInfoMutable bike)
=> await CopriServer.CloseAync(bike);
}
}
}

View file

@ -594,6 +594,16 @@ namespace TINK.Model
new Version(3, 0, 339),
AppResources.ChangeLog3_0_339_MK,
new List<AppFlavor> { AppFlavor.MeinKonrad }
},
{
new Version(3, 0, 340),
AppResources.ChangeLog_MinorDesignImprovements,
new List<AppFlavor> { AppFlavor.LastenradBayern, AppFlavor.MeinKonrad }
},
{
new Version(3, 0, 340),
AppResources.ChangeLog_MinorBugFixes,
new List<AppFlavor> { AppFlavor.ShareeBike }
}
};

View file

@ -645,6 +645,15 @@ namespace TINK.MultilingualResources {
}
}
/// <summary>
/// Looks up a localized string similar to A few small things have been changed in the design..
/// </summary>
public static string ChangeLog_MinorDesignImprovements {
get {
return ResourceManager.GetString("ChangeLog_MinorDesignImprovements", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Updated to latest lock firmware..
/// </summary>

View file

@ -1031,4 +1031,7 @@ Sie können nun auf einen Blick sehen, welche App-Version Sie installiert haben:
<data name="ChangeLog3_0_339_SB_LB" xml:space="preserve">
<value>Sie können nun auf einen Blick sehen, welche App-Version Sie installiert haben: im Menü ganz unten. Bitte aktualisieren Sie die App regelmäßig, um in Funktionalität und Design auf dem neuesten Stand zu sein!</value>
</data>
<data name="ChangeLog_MinorDesignImprovements" xml:space="preserve">
<value>Es wurden ein paar Kleinigkeiten im Design verändert.</value>
</data>
</root>

View file

@ -1123,4 +1123,7 @@ You can now see at a glance which app version you have installed: in the menu at
<data name="ChangeLog3_0_339_SB_LB" xml:space="preserve">
<value>You can now see at a glance which app version you have installed: in the menu at the very bottom. Please update the app regularly to be up to date in functionality and design!</value>
</data>
<data name="ChangeLog_MinorDesignImprovements" xml:space="preserve">
<value>A few small things have been changed in the design.</value>
</data>
</root>

View file

@ -1400,6 +1400,10 @@ Sie können nun auf einen Blick sehen, welche App-Version Sie installiert haben:
<source>You can now see at a glance which app version you have installed: in the menu at the very bottom. Please update the app regularly to be up to date in functionality and design!</source>
<target state="translated">Sie können nun auf einen Blick sehen, welche App-Version Sie installiert haben: im Menü ganz unten. Bitte aktualisieren Sie die App regelmäßig, um in Funktionalität und Design auf dem neuesten Stand zu sein!</target>
</trans-unit>
<trans-unit id="ChangeLog_MinorDesignImprovements" translate="yes" xml:space="preserve">
<source>A few small things have been changed in the design.</source>
<target state="translated">Es wurden ein paar Kleinigkeiten im Design verändert.</target>
</trans-unit>
</group>
</body>
</file>

View file

@ -1,4 +1,4 @@

using System;
using System.Collections.Generic;
using System.IO;
@ -6,6 +6,7 @@ using System.Net;
using System.Text;
using System.Threading.Tasks;
using Serilog;
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
using TINK.Model.Device;
using TINK.Model.Logging;
using TINK.Repository.Exception;
@ -172,10 +173,11 @@ namespace TINK.Repository
lock_state state,
Uri operatorUri,
LocationDto location,
double batteryLevel) =>
double batteryLevel,
IVersionInfo versionInfo) =>
await DoUpdateLockingStateAsync(
operatorUri?.AbsoluteUri ?? m_oCopriHost.AbsoluteUri,
requestBuilder.UpateLockingState(bikeId, state, location, batteryLevel),
requestBuilder.UpateLockingState(bikeId, state, location, batteryLevel, versionInfo),
UserAgent);
/// <summary> Gets booking request request. </summary>

View file

@ -1,6 +1,7 @@
using System;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
using TINK.Model.Device;
using TINK.Repository.Request;
using TINK.Repository.Response;
@ -1636,7 +1637,8 @@ namespace TINK.Repository
lock_state state,
Uri operatorUri,
LocationDto geolocation,
double batteryLevel) => null;
double batteryLevel,
IVersionInfo versionInfo) => null;
public Task<ReservationBookingResponse> DoBookAsync(string bikeId, Guid guid, double batteryPercentage, Uri operatorUri)
=> null;

View file

@ -1,7 +1,8 @@
using System;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using MonkeyCache.FileStore;
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
using TINK.Model.Device;
using TINK.Model.Services.CopriApi;
using TINK.Repository.Request;
@ -171,7 +172,8 @@ namespace TINK.Repository
lock_state state,
Uri operatorUri,
LocationDto geolocation,
double batteryLevel)
double batteryLevel,
IVersionInfo versionInfo)
=> throw new System.Exception("Aktualisierung des Schlossstatuses im Offlinemodus nicht möglich!");
public Task<ReservationBookingResponse> DoBookAsync(string bikeId, Guid guid, double batteryPercentage, Uri operatorUri)

View file

@ -1,6 +1,7 @@
using System;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
using TINK.Model.Device;
using TINK.Repository.Request;
using TINK.Repository.Response;
@ -69,7 +70,8 @@ namespace TINK.Repository
lock_state state,
Uri operatorUri,
LocationDto location = null,
double batteryPercentage = double.NaN);
double batteryPercentage = double.NaN,
IVersionInfo versionInfo = null);
/// <summary> Books a bluetooth bike. </summary>
/// <param name="bikeId">Id of the bike to book.</param>

View file

@ -1,5 +1,6 @@
using System;
using System;
using System.Collections.Generic;
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
using TINK.Model.Device;
namespace TINK.Repository.Request
@ -63,14 +64,16 @@ namespace TINK.Repository.Request
/// <summary> Gets the request for updating lock state for a booked bike. </summary>
/// <param name="bikeId">Id of the bike to update locking state for.</param>
/// <param name="location">Geolocation of lock when state change occurred.</param>
/// <param name="state">New locking state.</param>
/// <param name="location">Geolocation of lock when state change occurred.</param>
/// <param name="versionInfo">Information about lock (firmware version, hardware version, ...).</param>
/// <returns>Request to update locking state.</returns>
string UpateLockingState(
string bikeId,
lock_state state,
LocationDto location = null,
double batteryPercentage = double.NaN);
double batteryPercentage = double.NaN,
IVersionInfo versionInfo = null);
/// <summary> Gets the booking request (synonym: booking == renting == mieten). </summary>
/// <param name="bikeId">Id of the bike to book.</param>

View file

@ -1,6 +1,7 @@
using System;
using System;
using System.Collections.Generic;
using System.Net;
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
using TINK.Model.Device;
using TINK.Repository.Exception;
@ -101,7 +102,11 @@ namespace TINK.Repository.Request
public string StartReturningBike(string bikeId)
=> throw new NotSupportedException();
public string UpateLockingState(string bikeId, lock_state state, LocationDto geolocation, double batteryPercentage)
/// <summary>
/// Not supported if user is not logged in. Lock state is only updated after open/ close which is only possible if user is logged in.
/// </summary>
/// <exception cref="NotSupportedException"></exception>
public string UpateLockingState(string bikeId, lock_state state, LocationDto geolocation, double batteryPercentage, IVersionInfo versionInfo)
=> throw new NotSupportedException();
public string DoBook(string bikeId, Guid guid, double batteryPercentage)

View file

@ -1,8 +1,9 @@
using System;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Net;
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
using TINK.Model.Device;
using TINK.Repository.Exception;
using TINK.Services.Logging;
@ -129,17 +130,20 @@ namespace TINK.Repository.Request
/// <remarks> Operator specific call.</remarks>
/// <param name="bikeId">Id of the bike to update locking state for.</param>
/// <param name="state">New locking state.</param>
/// <param name="versionInfo">Information about lock (firmware version, hardware version, ...).</param>
/// <returns>Request to update locking state.</returns>
public string UpateLockingState(
string bikeId,
lock_state state,
LocationDto geolocation,
double batteryPercentage)
double batteryPercentage,
IVersionInfo versionInfo)
=> "request=booking_update" +
GetBikeIdParameter(bikeId) +
GetLocationParameters(geolocation) +
GetLockStateParameter(state) +
GetBatteryPercentageParameters(batteryPercentage) +
GetVersionInfoParameter(versionInfo) +
AuthCookieParameter +
UiIsoLanguageNameParameter;
@ -272,6 +276,10 @@ namespace TINK.Repository.Request
? $"&voltage={batteryPercentage.ToString(CultureInfo.InvariantCulture)}"
: string.Empty;
private static string GetVersionInfoParameter(IVersionInfo versionInfo) => versionInfo?.FirmwareVersion > 0 || versionInfo?.HardwareVersion > 0 || versionInfo?.LockVersion > 0
? $"&firmware=HW%20{versionInfo.HardwareVersion};FW%20{versionInfo.FirmwareVersion};Lock%20{versionInfo.LockVersion}"
: string.Empty;
/// <summary> Gets the geolocation parameter. </summary>
/// <param name="geolocation">Geolocation or null.</param>
private static string GetLocationParameters(LocationDto geolocation)

View file

@ -1,7 +1,8 @@
using System;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Serilog;
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
using TINK.Model.Connector.Updater;
using TINK.Model.Device;
using TINK.Repository;
@ -235,13 +236,15 @@ namespace TINK.Model.Services.CopriApi
lock_state state,
Uri operatorUri,
LocationDto location,
double batteryLevel)
double batteryLevel,
IVersionInfo versionInfo)
=> await HttpsServer.UpdateLockingStateAsync(
bikeId,
state,
operatorUri,
location,
batteryLevel);
batteryLevel,
versionInfo);
/// <summary> Books a bike. </summary>
/// <param name="bikeId">Id of the bike to book.</param>
@ -303,4 +306,4 @@ namespace TINK.Model.Services.CopriApi
=> await HttpsServer.DoSubmitMiniSurvey(answers);
}
}
}

View file

@ -1,6 +1,7 @@
using System;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
using TINK.Model.Device;
using TINK.Repository;
using TINK.Repository.Request;
@ -53,13 +54,15 @@ namespace TINK.Model.Services.CopriApi
lock_state state,
Uri operatorUri,
LocationDto geolocation,
double batteryLevel)
double batteryLevel,
IVersionInfo versionInfo)
=> await monkeyStore.UpdateLockingStateAsync(
bikeId,
state,
operatorUri,
geolocation,
batteryLevel);
batteryLevel,
versionInfo);
public async Task<ReservationBookingResponse> DoBookAsync(string bikeId, Guid guid, double batteryPercentage, Uri operatorUri)
{

View file

@ -1,11 +1,15 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8" ?>
<ResourceDictionary xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="TINK.Themes.Konrad">
<!--Main color-->
<Color x:Key="primary-back-title-color">#D21113</Color>
<!--Secondary color-->
<Color x:Key="secondary-back-title-color">#FF0020</Color>
<!--Primary Button-->
<Style TargetType="Button">
<Setter Property="WidthRequest" Value="400" />
<Setter Property="HorizontalOptions" Value="Center" />
@ -28,6 +32,8 @@
</Trigger>
</Style.Triggers>
</Style>
<!--Secondary Button-->
<Style x:Key="SecondaryButton" TargetType="Button">
<Setter Property="WidthRequest" Value="400" />
<Setter Property="HorizontalOptions" Value="Center" />
@ -51,6 +57,7 @@
</Style.Triggers>
</Style>
<!--Switch-->
<Style TargetType="Switch">
<Style.Triggers>
<Trigger TargetType="Switch"
@ -65,17 +72,24 @@
</Trigger>
</Style.Triggers>
</Style>
<!--Slider-->
<Style TargetType="Slider">
<Setter Property="ThumbColor" Value="{DynamicResource Key=primary-back-title-color}"/>
<Setter Property="Background" Value="LightGray"/>
</Style>
<!--Label-->
<Style TargetType="Label">
<Setter Property="FontSize" Value="Default"/>
</Style>
<!--Flyout Item-->
<Style TargetType="FlyoutItem">
<Setter Property="Shell.BackgroundColor" Value="{DynamicResource Key=secondary-back-title-color}" />
</Style>
<!--Navbar-->
<Style x:Key="Label-Navbar" TargetType="Label">
<Setter Property="FontSize" Value="20"/>
<Setter Property="TextTransform" Value="Uppercase"/>
@ -90,4 +104,4 @@
<Setter Property="Grid.ColumnSpan" Value="2"/>
</Style>
</ResourceDictionary>
</ResourceDictionary>

View file

@ -1,83 +1,92 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8" ?>
<ResourceDictionary xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="TINK.Themes.LastenradBayern">
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="TINK.Themes.LastenradBayern">
<Color x:Key="primary-back-title-color">#009BDB</Color>
<!--Main color-->
<Color x:Key="primary-back-title-color">#009BDB</Color>
<!--<Style TargetType="Button">
<Setter Property="WidthRequest" Value="400" />
<Setter Property="HorizontalOptions" Value="Center" />
<Setter Property="BorderWidth" Value="1"/>
<Setter Property="BorderRadius" Value="10" />
<Setter Property="FontSize" Value="Medium"/>
<Setter Property="TextColor" Value="White"/>
<Style.Triggers>
<Trigger TargetType="Button"
Property="IsEnabled"
Value="True">
<Setter Property="BorderColor" Value="{DynamicResource Key=primary-back-title-color}"/>
<Setter Property="BackgroundColor" Value="{DynamicResource Key=primary-back-title-color}"/>
</Trigger>
<Trigger TargetType="Button"
Property="IsEnabled"
Value="False">
<Setter Property="BorderColor" Value="LightGray"/>
<Setter Property="BackgroundColor" Value="LightGray"/>
</Trigger>
</Style.Triggers>
</Style>
<Style x:Key="SecondaryButton" TargetType="Button">
<Setter Property="WidthRequest" Value="400" />
<Setter Property="HorizontalOptions" Value="Center" />
<Setter Property="BorderWidth" Value="1"/>
<Setter Property="BorderRadius" Value="10" />
<Setter Property="FontSize" Value="Medium"/>
<Setter Property="TextColor" Value="{DynamicResource Key=primary-back-title-color}"/>
<Style.Triggers>
<Trigger TargetType="Button"
Property="IsEnabled"
Value="True">
<Setter Property="BorderColor" Value="{DynamicResource Key=primary-back-title-color}"/>
<Setter Property="BackgroundColor" Value="White"/>
</Trigger>
<Trigger TargetType="Button"
Property="IsEnabled"
Value="False">
<Setter Property="BorderColor" Value="LightGray"/>
<Setter Property="BackgroundColor" Value="DimGray"/>
</Trigger>
</Style.Triggers>
</Style>
<!--Primary Button-->
<!--<<Style TargetType="Button">
<Setter Property="WidthRequest" Value="400" />
<Setter Property="HorizontalOptions" Value="Center" />
<Setter Property="BorderWidth" Value="1"/>
<Setter Property="BorderRadius" Value="10" />
<Setter Property="FontSize" Value="Medium"/>
<Setter Property="TextColor" Value="White"/>
<Style.Triggers>
<Trigger TargetType="Button"
Property="IsEnabled"
Value="True">
<Setter Property="BorderColor" Value="{DynamicResource Key=primary-back-title-color}"/>
<Setter Property="BackgroundColor" Value="{DynamicResource Key=primary-back-title-color}"/>
</Trigger>
<Trigger TargetType="Button"
Property="IsEnabled"
Value="False">
<Setter Property="BorderColor" Value="LightGray"/>
<Setter Property="BackgroundColor" Value="LightGray"/>
</Trigger>
</Style.Triggers>
</Style>-->
<Style TargetType="Switch">
<Style.Triggers>
<Trigger TargetType="Switch"
Property="IsToggled"
Value="True">
<Setter Property="ThumbColor" Value="{DynamicResource Key=primary-back-title-color}"/>
</Trigger>
<Trigger TargetType="Switch"
Property="IsToggled"
Value="False">
<Setter Property="ThumbColor" Value="DimGray"/>
</Trigger>
</Style.Triggers>
</Style>
<Style TargetType="Slider">
<Setter Property="ThumbColor" Value="{DynamicResource Key=primary-back-title-color}"/>
<Setter Property="Background" Value="LightGray"/>
</Style>
<Style TargetType="Label">
<Setter Property="FontSize" Value="Default"/>
</Style>
</Style>-->
<!--Sedondary Button-->
<!--<Style x:Key="SecondaryButton" TargetType="Button">
<Setter Property="WidthRequest" Value="400" />
<Setter Property="HorizontalOptions" Value="Center" />
<Setter Property="BorderWidth" Value="1"/>
<Setter Property="BorderRadius" Value="10" />
<Setter Property="FontSize" Value="Medium"/>
<Setter Property="TextColor" Value="{DynamicResource Key=primary-back-title-color}"/>
<Style.Triggers>
<Trigger TargetType="Button"
Property="IsEnabled"
Value="True">
<Setter Property="BorderColor" Value="{DynamicResource Key=primary-back-title-color}"/>
<Setter Property="BackgroundColor" Value="White"/>
</Trigger>
<Trigger TargetType="Button"
Property="IsEnabled"
Value="False">
<Setter Property="BorderColor" Value="LightGray"/>
<Setter Property="BackgroundColor" Value="DimGray"/>
</Trigger>
</Style.Triggers>
</Style>-->
<!--Switch-->
<!--<Style TargetType="Switch">
<Style.Triggers>
<Trigger TargetType="Switch"
Property="IsToggled"
Value="True">
<Setter Property="ThumbColor" Value="{DynamicResource Key=primary-back-title-color}"/>
</Trigger>
<Trigger TargetType="Switch"
Property="IsToggled"
Value="False">
<Setter Property="ThumbColor" Value="DimGray"/>
</Trigger>
</Style.Triggers>
</Style>-->
<!--Slider-->
<!--<Style TargetType="Slider">
<Setter Property="ThumbColor" Value="{DynamicResource Key=primary-back-title-color}"/>
<Setter Property="Background" Value="LightGray"/>
</Style>-->
<!--Label-->
<!--<Style TargetType="Label">
<Setter Property="FontSize" Value="Default"/>
</Style>-->
<!--Flyout Item-->
<Style TargetType="FlyoutItem">
<Setter Property="Shell.BackgroundColor" Value="{DynamicResource Key=primary-back-title-color}" />
</Style>
<!--Navbar-->
<Style x:Key="Label-Navbar" TargetType="Label">
<Setter Property="FontSize" Value="20"/>
<!--<Setter Property="TextTransform" Value="Uppercase"/>-->
@ -92,4 +101,4 @@
<Setter Property="Grid.ColumnSpan" Value="2"/>
</Style>
</ResourceDictionary>
</ResourceDictionary>

View file

@ -318,13 +318,15 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
await ViewUpdateManager().StopUpdatePeridically();
BikesViewModel.ActionText = AppResources.ActivityTextOpeningLock;
ILockService btLock;
try
{
SelectedBike.LockInfo.State = (await LockService[SelectedBike.LockInfo.Id].OpenAsync())?.GetLockingState() ?? LockingState.UnknownDisconnected;
btLock = LockService[SelectedBike.LockInfo.Id];
SelectedBike.LockInfo.State = (await btLock.OpenAsync())?.GetLockingState() ?? LockingState.UnknownDisconnected;
}
catch (Exception exception)
{
BikesViewModel.ActionText = string.Empty;
BikesViewModel.ActionText = string.Empty;
if (exception is OutOfReachException)
{
@ -389,7 +391,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
BikesViewModel.ActionText = AppResources.ActivityTextReadingChargingLevel;
try
{
SelectedBike.LockInfo.BatteryPercentage = await LockService[SelectedBike.LockInfo.Id].GetBatteryPercentageAsync();
SelectedBike.LockInfo.BatteryPercentage = await btLock.GetBatteryPercentageAsync();
}
catch (Exception exception)
{
@ -409,7 +411,16 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
// Lock list to avoid multiple taps while copri action is pending.
BikesViewModel.ActionText = AppResources.ActivityTextStartingUpdatingLockingState;
var versionTdo = btLock.VersionInfo;
if (versionTdo != null)
{
SelectedBike.LockInfo.VersionInfo = new VersionInfo.Builder
{
FirmwareVersion = versionTdo.FirmwareVersion,
HardwareVersion = versionTdo.HardwareVersion,
LockVersion = versionTdo.LockVersion,
}.Build();
}
IsConnected = IsConnectedDelegate();
try

View file

@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
@ -69,8 +69,10 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
await ViewUpdateManager().StopUpdatePeridically();
BikesViewModel.ActionText = AppResources.ActivityTextOpeningLock;
ILockService btLock;
try
{
btLock = LockService[SelectedBike.LockInfo.Id];
SelectedBike.LockInfo.State = (await LockService[SelectedBike.LockInfo.Id].OpenAsync())?.GetLockingState() ?? LockingState.UnknownDisconnected;
}
catch (Exception exception)
@ -140,7 +142,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
BikesViewModel.ActionText = AppResources.ActivityTextReadingChargingLevel;
try
{
SelectedBike.LockInfo.BatteryPercentage = await LockService[SelectedBike.LockInfo.Id].GetBatteryPercentageAsync();
SelectedBike.LockInfo.BatteryPercentage = await btLock.GetBatteryPercentageAsync();
}
catch (Exception exception)
{
@ -160,7 +162,16 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
// Lock list to avoid multiple taps while copri action is pending.
BikesViewModel.ActionText = AppResources.ActivityTextStartingUpdatingLockingState;
var versionTdo = btLock.VersionInfo;
if (versionTdo != null)
{
SelectedBike.LockInfo.VersionInfo = new VersionInfo.Builder
{
FirmwareVersion = versionTdo.FirmwareVersion,
HardwareVersion = versionTdo.HardwareVersion,
LockVersion = versionTdo.LockVersion,
}.Build();
}
IsConnected = IsConnectedDelegate();
try

View file

@ -1,4 +1,4 @@
using System;
using System;
using System.Threading.Tasks;
using Serilog;
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
@ -58,7 +58,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
{
BikesViewModel.IsIdle = false;
// Ask whether to really book bike?
// Ask whether to really reserve bike?
var alertResult = await ViewService.DisplayAlert(
string.Empty,
string.Format(AppResources.QuestionReserveBike, SelectedBike.GetFullDisplayName(), StateRequestedInfo.MaximumReserveTime.Minutes),
@ -257,9 +257,11 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
// Unlock bike.
BikesViewModel.ActionText = AppResources.ActivityTextOpeningLock;
ILockService btLock;
try
{
SelectedBike.LockInfo.State = (await LockService[SelectedBike.LockInfo.Id].OpenAsync())?.GetLockingState() ?? LockingState.UnknownDisconnected;
btLock = LockService[SelectedBike.LockInfo.Id];
SelectedBike.LockInfo.State = (await btLock.OpenAsync())?.GetLockingState() ?? LockingState.UnknownDisconnected;
}
catch (Exception exception)
{
@ -336,7 +338,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
BikesViewModel.ActionText = AppResources.ActivityTextReadingChargingLevel;
try
{
SelectedBike.LockInfo.BatteryPercentage = await LockService[SelectedBike.LockInfo.Id].GetBatteryPercentageAsync();
SelectedBike.LockInfo.BatteryPercentage = await btLock.GetBatteryPercentageAsync();
}
catch (Exception exception)
{
@ -356,7 +358,16 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
// Lock list to avoid multiple taps while copri action is pending.
BikesViewModel.ActionText = AppResources.ActivityTextStartingUpdatingLockingState;
var versionTdo = btLock.VersionInfo;
if (versionTdo != null)
{
SelectedBike.LockInfo.VersionInfo = new VersionInfo.Builder
{
FirmwareVersion = versionTdo.FirmwareVersion,
HardwareVersion = versionTdo.HardwareVersion,
LockVersion = versionTdo.LockVersion,
}.Build();
}
IsConnected = IsConnectedDelegate();
try

View file

@ -1,4 +1,4 @@
using System;
using System;
using System.Threading.Tasks;
using Serilog;
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
@ -222,9 +222,11 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
// Unlock bike.
BikesViewModel.ActionText = AppResources.ActivityTextOpeningLock;
ILockService btLock;
try
{
SelectedBike.LockInfo.State = (await LockService[SelectedBike.LockInfo.Id].OpenAsync())?.GetLockingState() ?? LockingState.UnknownDisconnected;
btLock = LockService[SelectedBike.LockInfo.Id];
SelectedBike.LockInfo.State = (await btLock.OpenAsync())?.GetLockingState() ?? LockingState.UnknownDisconnected;
}
catch (Exception exception)
{
@ -301,7 +303,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
BikesViewModel.ActionText = AppResources.ActivityTextReadingChargingLevel;
try
{
SelectedBike.LockInfo.BatteryPercentage = await LockService[SelectedBike.LockInfo.Id].GetBatteryPercentageAsync();
SelectedBike.LockInfo.BatteryPercentage = await btLock.GetBatteryPercentageAsync();
}
catch (Exception exception)
{
@ -321,7 +323,16 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
// Lock list to avoid multiple taps while copri action is pending.
BikesViewModel.ActionText = AppResources.ActivityTextStartingUpdatingLockingState;
var versionTdo = btLock.VersionInfo;
if (versionTdo != null)
{
SelectedBike.LockInfo.VersionInfo = new VersionInfo.Builder
{
FirmwareVersion = versionTdo.FirmwareVersion,
HardwareVersion = versionTdo.HardwareVersion,
LockVersion = versionTdo.LockVersion,
}.Build();
}
IsConnected = IsConnectedDelegate();
try

View file

@ -1,4 +1,4 @@
using System;
using System;
using System.Threading.Tasks;
using Serilog;
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
@ -246,7 +246,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
}
else
{
Log.ForContext<BookedDisconnected>().Error("Lock can not be found. {Exception}", exception);
Log.ForContext<ReservedDisconnected>().Error("Lock can not be found. {Exception}", exception);
string message;
if (retryCount < 2)
@ -384,9 +384,11 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
// Unlock bike.
BikesViewModel.ActionText = AppResources.ActivityTextOpeningLock;
ILockService btLock;
try
{
SelectedBike.LockInfo.State = (await LockService[SelectedBike.LockInfo.Id].OpenAsync())?.GetLockingState() ?? LockingState.UnknownDisconnected;
btLock = LockService[SelectedBike.LockInfo.Id];
SelectedBike.LockInfo.State = (await btLock.OpenAsync())?.GetLockingState() ?? LockingState.UnknownDisconnected;
}
catch (Exception exception)
{
@ -463,7 +465,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
BikesViewModel.ActionText = AppResources.ActivityTextReadingChargingLevel;
try
{
SelectedBike.LockInfo.BatteryPercentage = await LockService[SelectedBike.LockInfo.Id].GetBatteryPercentageAsync();
SelectedBike.LockInfo.BatteryPercentage = await btLock.GetBatteryPercentageAsync();
}
catch (Exception exception)
{
@ -483,7 +485,16 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
// Lock list to avoid multiple taps while copri action is pending.
BikesViewModel.ActionText = AppResources.ActivityTextStartingUpdatingLockingState;
var versionTdo = btLock.VersionInfo;
if (versionTdo != null)
{
SelectedBike.LockInfo.VersionInfo = new VersionInfo.Builder
{
FirmwareVersion = versionTdo.FirmwareVersion,
HardwareVersion = versionTdo.HardwareVersion,
LockVersion = versionTdo.LockVersion,
}.Build();
}
IsConnected = IsConnectedDelegate();
try

View file

@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
@ -65,9 +65,11 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
await ViewUpdateManager().StopUpdatePeridically();
BikesViewModel.ActionText = AppResources.ActivityTextOpeningLock;
ILockService btLock;
try
{
SelectedBike.LockInfo.State = (await LockService[SelectedBike.LockInfo.Id].OpenAsync())?.GetLockingState() ?? LockingState.UnknownDisconnected;
btLock = LockService[SelectedBike.LockInfo.Id];
SelectedBike.LockInfo.State = (await btLock.OpenAsync())?.GetLockingState() ?? LockingState.UnknownDisconnected;
}
catch (Exception exception)
{
@ -136,7 +138,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
BikesViewModel.ActionText = AppResources.ActivityTextReadingChargingLevel;
try
{
SelectedBike.LockInfo.BatteryPercentage = await LockService[SelectedBike.LockInfo.Id].GetBatteryPercentageAsync();
SelectedBike.LockInfo.BatteryPercentage = await btLock.GetBatteryPercentageAsync();
}
catch (Exception exception)
{
@ -156,7 +158,16 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
// Lock list to avoid multiple taps while copri action is pending.
BikesViewModel.ActionText = AppResources.ActivityTextStartingUpdatingLockingState;
var versionTdo = btLock.VersionInfo;
if (versionTdo != null)
{
SelectedBike.LockInfo.VersionInfo = new VersionInfo.Builder
{
FirmwareVersion = versionTdo.FirmwareVersion,
HardwareVersion = versionTdo.HardwareVersion,
LockVersion = versionTdo.LockVersion,
}.Build();
}
IsConnected = IsConnectedDelegate();
try