Version 3.0.356

This commit is contained in:
Oliver Hauff 2022-12-27 21:08:09 +01:00
parent d23aff6daf
commit 5980410182
48 changed files with 242 additions and 362 deletions

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="internalOnly" package="com.TeilRad.LastenradBayern" android:versionName="3.0.354" android:versionCode="354">
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="internalOnly" package="com.TeilRad.LastenradBayern" android:versionName="3.0.356" android:versionCode="356">
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="31" />
<!-- Google Maps related permissions -->
<!-- Permission to receive remote notifications from Google Play Services -->

View file

@ -5,6 +5,7 @@
<key>UIBackgroundModes</key>
<array>
<string>bluetooth-peripheral</string>
<string>bluetooth-central</string>
</array>
<key>UIUserInterfaceStyle</key>
<string>Light</string>
@ -55,8 +56,8 @@
<key>CFBundleDisplayName</key>
<string>LastenradBayern</string>
<key>CFBundleVersion</key>
<string>354</string>
<string>356</string>
<key>CFBundleShortVersionString</key>
<string>3.0.354</string>
<string>3.0.356</string>
</dict>
</plist>

View file

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:d="http://xamarin.com/schemas/2014/forms/design"
@ -27,12 +27,6 @@
Text="{x:Static resources:AppResources.MessageAccountPageManageLogout}"
Command="{Binding OnLogoutRequest}"
IsEnabled="{Binding IsLogoutPossible}"/>
<!--Possible SecondaryButton Style-->
<!--<Button
Style="{StaticResource SecondaryButton}"
Text="{x:Static resources:AppResources.MessageAccountPageManageLogout}"
Command="{Binding OnLogoutRequest}"
IsEnabled="{Binding IsLogoutPossible}"/>-->
</StackLayout>
</Frame>
</StackLayout>

View file

@ -51,13 +51,6 @@
IsVisible="{Binding IsLockitButtonVisible}"
IsEnabled="{Binding IsIdle}"
Command="{Binding OnLockitButtonClicked}"/>
<!--Possible SecondaryButton Style-->
<!--<Button
Style="{StaticResource SecondaryButton}"
Text="{Binding LockitButtonText}"
IsVisible="{Binding IsLockitButtonVisible}"
IsEnabled="{Binding IsIdle}"
Command="{Binding OnLockitButtonClicked}"/>-->
<!-- Copri Lock Label -->
<Label
Text="{x:Static resources:AppResources.StatusTextCopriLock}"

View file

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:conv="clr-namespace:TINK.View"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
@ -61,14 +61,6 @@
Text="{Binding PhoneNumberText}"
IsEnabled="{Binding IsDoPhoncallAvailable}"
Command="{Binding OnPhoneRequest}"/>
<!--Possible SecondaryButton Style-->
<!--<Button
Style="{StaticResource SecondaryButton}"
x:Name="PhoneNumberButton"
IsVisible="{Binding PhoneNumberText, Converter={StaticResource StringNotNullOrEmpty_Converter}}"
Text="{Binding PhoneNumberText}"
IsEnabled="{Binding IsDoPhoncallAvailable}"
Command="{Binding OnPhoneRequest}"/>-->
</StackLayout>
</Frame>
<Frame>

View file

@ -9,10 +9,6 @@
Text="{x:Static resources:AppResources.MessageAccountPageManagePersonalData}"/>
</Grid>
</Shell.TitleView>
<!-- Cross as BackButton -->
<!--<Shell.BackButtonBehavior>
<BackButtonBehavior IconOverride="{FontImage FontFamily=FA-S, Glyph={StaticResource IconClose}, Color=White, Size=16}" />
</Shell.BackButtonBehavior>-->
<ContentPage.Content>
<Grid>
<Grid.RowDefinitions>

View file

@ -9,10 +9,6 @@
Text="{x:Static resources:AppResources.ActionLoginPasswordForgotten}"/>
</Grid>
</Shell.TitleView>
<!-- Cross as BackButton -->
<!--<Shell.BackButtonBehavior>
<BackButtonBehavior IconOverride="{FontImage FontFamily=FA-S, Glyph={StaticResource IconClose}, Color=White, Size=16}" />
</Shell.BackButtonBehavior>-->
<ContentPage.Content>
<Grid>
<Grid.RowDefinitions>

View file

@ -9,10 +9,6 @@
Text="{x:Static resources:AppResources.ActionLoginRegister}"/>
</Grid>
</Shell.TitleView>
<!-- Cross as BackButton -->
<!--<Shell.BackButtonBehavior>
<BackButtonBehavior IconOverride="{FontImage FontFamily=FA-S, Glyph={StaticResource IconClose}, Color=White, Size=16}" />
</Shell.BackButtonBehavior>-->
<ContentPage.Content>
<Grid>
<Grid.RowDefinitions>

View file

@ -59,102 +59,4 @@
</Frame>
</ScrollView>
<!-- Possible New Design -->
<!--<ScrollView>
<Frame>
<StackLayout x:Name="LoginPageView">
<Frame>
<StackLayout>
<Label Text="{x:Static resources:AppResources.MarkingLoginEmailAddressLabel}"
Margin="0,0,0,-10">
<Label.Triggers>
<DataTrigger
TargetType="Label"
Binding="{Binding Source={x:Reference EMailEntry}, Path=Text, TargetNullValue=''}"
Value="">
<Setter Property="IsVisible" Value="False" />
</DataTrigger>
</Label.Triggers>
</Label>
<Entry
Placeholder="{x:Static resources:AppResources.MarkingLoginEmailAddressPlaceholder}"
Keyboard="Email"
AutomationId="mail_address_text"
x:Name="EMailEntry"
Text="{Binding MailAddress}"
IsEnabled="{Binding IsLoggedOut}"/>
<Label Text="{x:Static resources:AppResources.MarkingLoginPasswordPlaceholder}"
Margin="0,0,0,-10">
<Label.Triggers>
<DataTrigger
TargetType="Label"
Binding="{Binding Source={x:Reference PasswordEntry}, Path=Text, TargetNullValue=''}"
Value="">
<Setter Property="IsVisible" Value="False" />
</DataTrigger>
</Label.Triggers>
</Label>
<Entry Placeholder="{x:Static resources:AppResources.MarkingLoginPasswordPlaceholder}"
AutomationId="password_text"
IsPassword="true"
x:Name="PasswordEntry"
Text="{Binding Password}"
IsEnabled="{Binding IsLoggedOut}"/>
<Label Text="{x:Static resources:AppResources.MarkingLoginPasswordLabel}"
HorizontalOptions="End"
Margin="0,-10,0,5"
FontSize="Small">
<Label.Triggers>
<DataTrigger
TargetType="Label"
Binding="{Binding Source={x:Reference PasswordEntry}, Path=Text, TargetNullValue=''}"
Value="">
<Setter Property="IsVisible" Value="False" />
</DataTrigger>
</Label.Triggers>
</Label>
<Button
Text="{x:Static resources:AppResources.ActionLoginLogin}"
AutomationId="login_button"
Command="{Binding OnLoginRequest}"
IsEnabled="{Binding IsLoginRequestAllowed}">
</Button>
<Button
Text="{x:Static resources:AppResources.ActionLoginRegister}"
AutomationId="register_button"
Command="{Binding OnRegisterRequest}"
IsVisible="{Binding IsWebViewElementsVisible}">
</Button>
<Button
Style="{StaticResource SecondaryButton}"
Text="{x:Static resources:AppResources.ActionLoginRegister}"
AutomationId="register_button"
Command="{Binding OnRegisterRequest}"
IsVisible="{Binding IsWebViewElementsVisible}">
</Button>
<Label
IsVisible="{Binding IsRegisterTargetsInfoVisible}"
FormattedText="{Binding RegisterTargetsInfo}">
</Label>
<Button
Text="{x:Static resources:AppResources.ActionLoginPasswordForgotten}"
AutomationId="password_forgotten_button"
Command="{Binding OnPasswordForgottonRequest}">
</Button>
<Label
Margin="0,10,0,0"
TextType="Html"
AutomationId="password_forgotten_button"
HorizontalOptions="Center"
TextColor="{DynamicResource primary-back-title-color}"
Text="{x:Static resources:AppResources.ActionLoginPasswordForgotten}">
<Label.GestureRecognizers>
<TapGestureRecognizer Command="{Binding OnPasswordForgottonRequest}"/>
</Label.GestureRecognizers>
</Label>
</StackLayout>
</Frame>
</StackLayout>
</Frame>
</ScrollView>-->
</ContentPage>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="internalOnly" package="com.TeilRad.Meinkonrad" android:versionName="3.0.354" android:versionCode="354">
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="internalOnly" package="com.TeilRad.Meinkonrad" android:versionName="3.0.356" android:versionCode="356">
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="31" />
<!-- Google Maps related permissions -->
<!-- Permission to receive remote notifications from Google Play Services -->

View file

@ -5,6 +5,7 @@
<key>UIBackgroundModes</key>
<array>
<string>bluetooth-peripheral</string>
<string>bluetooth-central</string>
</array>
<key>UIUserInterfaceStyle</key>
<string>Light</string>
@ -55,8 +56,8 @@
<key>CFBundleDisplayName</key>
<string>Mein konrad</string>
<key>CFBundleVersion</key>
<string>354</string>
<string>356</string>
<key>CFBundleShortVersionString</key>
<string>3.0.354</string>
<string>3.0.356</string>
</dict>
</plist>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="internalOnly" package="com.hauffware.sharee" android:versionName="3.0.354" android:versionCode="354">
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="internalOnly" package="com.hauffware.sharee" android:versionName="3.0.356" android:versionCode="356">
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="31" />
<!-- Google Maps related permissions -->
<!-- Permission to receive remote notifications from Google Play Services -->

View file

@ -5,6 +5,7 @@
<key>UIBackgroundModes</key>
<array>
<string>bluetooth-peripheral</string>
<string>bluetooth-central</string>
</array>
<key>UIUserInterfaceStyle</key>
<string>Light</string>
@ -55,8 +56,8 @@
<key>CFBundleDisplayName</key>
<string>sharee.bike</string>
<key>CFBundleVersion</key>
<string>354</string>
<string>356</string>
<key>CFBundleShortVersionString</key>
<string>3.0.354</string>
<string>3.0.356</string>
</dict>
</plist>

View file

@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Serilog;
@ -127,7 +127,7 @@ namespace TINK.Model.Connector
await Task.CompletedTask;
}
public async Task DoBook(Bikes.BikeInfoNS.BC.IBikeInfoMutable bike)
public async Task DoBookAsync(Bikes.BikeInfoNS.BC.IBikeInfoMutable bike, LockingAction? nextAction = null)
{
Log.ForContext<Command>().Error("Unexpected booking request detected. No user logged in.");
await Task.CompletedTask;

View file

@ -238,7 +238,8 @@ namespace TINK.Model.Connector
/// <summary> Request to book a bike. </summary>
/// <param name="bike">Bike to book.</param>
public async Task DoBook(Bikes.BikeInfoNS.BC.IBikeInfoMutable bike)
/// <param name="nextAction">If not null next locking action which is performed after booking.</param>
public async Task DoBookAsync(Bikes.BikeInfoNS.BC.IBikeInfoMutable bike, LockingAction? nextAction = null)
{
if (bike == null)
{
@ -251,10 +252,11 @@ namespace TINK.Model.Connector
double batteryPercentage = btBike != null ? btBike.LockInfo.BatteryPercentage : double.NaN;
response = (await CopriServer.DoBookAsync(
bike.OperatorUri,
bike.Id,
guid,
batteryPercentage,
bike.OperatorUri)).GetIsBookingResponseOk(bike.Id);
nextAction)).GetIsBookingResponseOk(bike.Id);
bike.Load(
response,

View file

@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using TINK.Model.Device;
@ -49,7 +49,8 @@ namespace TINK.Model.Connector
/// <summary> Request to book a bike.</summary>
/// <param name="bike">Bike to book.</param>
Task DoBook(Bikes.BikeInfoNS.BC.IBikeInfoMutable bike);
/// <param name="nextAction">If not null next locking action which is performed after booking.</param>
Task DoBookAsync(Bikes.BikeInfoNS.BC.IBikeInfoMutable bike, LockingAction? nextAction = null);
/// <summary> Request to book a bike and open its lock.</summary>
/// <param name="bike">Bike to book and to open lock for.</param>
@ -163,4 +164,14 @@ namespace TINK.Model.Connector
public string Mail { get; }
}
/// <summary>
/// Describes a action to be performed with an lock.
/// </summary>
public enum LockingAction
{
Close,
Open,
}
}

View file

@ -662,6 +662,16 @@ namespace TINK.Model
AppResources.ChangeLog_PackageUpdates,
new List<AppFlavor> { AppFlavor.MeinKonrad, AppFlavor.ShareeBike }
},
{
new Version(3, 0, 355),
AppResources.ChangeLog_3_0_355_MK_SB_iOS,
new List<AppFlavor> { AppFlavor.MeinKonrad, AppFlavor.ShareeBike },
new List<DevicePlatform> { DevicePlatform.iOS }
},
{
new Version(3, 0, 356),
AppResources.ChangeLog3_0_231
},
};
/// <summary> Manges the whats new information.</summary>

View file

@ -738,6 +738,15 @@ namespace TINK.MultilingualResources {
}
}
/// <summary>
/// Looks up a localized string similar to Bluetooth communication improved..
/// </summary>
public static string ChangeLog_3_0_355_MK_SB_iOS {
get {
return ResourceManager.GetString("ChangeLog_3_0_355_MK_SB_iOS", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to We have fixed some bugs. Enjoy the ride!.
/// </summary>

View file

@ -1111,4 +1111,7 @@ Probieren Sie es aus!</value>
<data name="ChangeLog_PackageUpdates" xml:space="preserve">
<value>Softwarepakete wurden aktualisiert.</value>
</data>
<data name="ChangeLog_3_0_355_MK_SB_iOS" xml:space="preserve">
<value>Bluetooth-Kommunikation verbessert.</value>
</data>
</root>

View file

@ -1201,4 +1201,7 @@ Try it out!</value>
<data name="ChangeLog_PackageUpdates" xml:space="preserve">
<value>Software packages were updated.</value>
</data>
<data name="ChangeLog_3_0_355_MK_SB_iOS" xml:space="preserve">
<value>Bluetooth communication improved.</value>
</data>
</root>

View file

@ -1520,6 +1520,10 @@ Probieren Sie es aus!</target>
<source>Software packages were updated.</source>
<target state="translated">Softwarepakete wurden aktualisiert.</target>
</trans-unit>
<trans-unit id="ChangeLog_3_0_355_MK_SB_iOS" translate="yes" xml:space="preserve">
<source>Bluetooth communication improved.</source>
<target state="translated">Bluetooth-Kommunikation verbessert.</target>
</trans-unit>
</group>
</body>
</file>

View file

@ -7,6 +7,7 @@ using System.Text;
using System.Threading.Tasks;
using Serilog;
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
using TINK.Model.Connector;
using TINK.Model.Device;
using TINK.Model.Logging;
using TINK.Repository.Exception;
@ -181,19 +182,21 @@ namespace TINK.Repository
UserAgent);
/// <summary> Gets booking request request. </summary>
/// <param name="operatorUri">Holds the uri of the operator or null, in case of single operator setup.</param>
/// <param name="bikeId">Id of the bike to book.</param>
/// <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>
/// <param name="operatorUri">Holds the uri of the operator or null, in case of single operator setup.</param>
/// <param name="nextAction">If not null next locking action which is performed after booking.</param>
/// <returns>Requst on booking request.</returns>
public async Task<ReservationBookingResponse> DoBookAsync(
Uri operatorUri,
string bikeId,
Guid guid,
double batteryPercentage,
Uri operatorUri)
LockingAction? nextAction = null)
=> await DoBookAsync(
operatorUri?.AbsoluteUri ?? m_oCopriHost.AbsoluteUri,
requestBuilder.DoBook(bikeId, guid, batteryPercentage),
requestBuilder.DoBook(bikeId, guid, batteryPercentage, nextAction),
UserAgent);
/// <summary> Books a bike and starts opening bike. </summary>

View file

@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
using TINK.Model.Connector;
using TINK.Model.Device;
using TINK.Repository.Request;
using TINK.Repository.Response;
@ -1640,7 +1641,7 @@ namespace TINK.Repository
double batteryLevel,
IVersionInfo versionInfo) => null;
public Task<ReservationBookingResponse> DoBookAsync(string bikeId, Guid guid, double batteryPercentage, Uri operatorUri)
public Task<ReservationBookingResponse> DoBookAsync(Uri operatorUri, string bikeId, Guid guid, double batteryPercentage, LockingAction? nextAction = null)
=> null;
public Task<ReservationBookingResponse> BookAvailableAndStartOpeningAsync(

View file

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Threading.Tasks;
using MonkeyCache.FileStore;
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
using TINK.Model.Connector;
using TINK.Model.Device;
using TINK.Model.Services.CopriApi;
using TINK.Repository.Request;
@ -176,7 +177,7 @@ namespace TINK.Repository
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)
public Task<ReservationBookingResponse> DoBookAsync(Uri operatorUri, string bikeId, Guid guid, double batteryPercentage, LockingAction? nextAction = null)
=> throw new System.Exception("Buchung im Offlinemodus nicht möglich!");
/// <summary> Books a bike and starts opening bike. </summary>

View file

@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
using TINK.Model.Connector;
using TINK.Model.Device;
using TINK.Repository.Request;
using TINK.Repository.Response;
@ -74,16 +75,18 @@ namespace TINK.Repository
IVersionInfo versionInfo = null);
/// <summary> Books a bluetooth bike. </summary>
/// <param name="operatorUri">Holds the uri of the operator or null, in case of single operator setup.</param>
/// <param name="bikeId">Id of the bike to book.</param>
/// <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>
/// <param name="operatorUri">Holds the uri of the operator or null, in case of single operator setup.</param>
/// <param name="nextAction">If not null next locking action which is performed after booking.</param>
/// <returns>Response on booking request.</returns>
Task<ReservationBookingResponse> DoBookAsync(
Uri operatorUri,
string bikeId,
Guid guid,
double batteryPercentage,
Uri operatorUri);
LockingAction? nextAction = null);
/// <summary> Books a bike and starts opening bike. </summary>
/// <param name="bikeId">Id of the bike to book.</param>

View file

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
using TINK.Model.Connector;
using TINK.Model.Device;
namespace TINK.Repository.Request
@ -79,8 +80,9 @@ namespace TINK.Repository.Request
/// <param name="bikeId">Id of the bike to book.</param>
/// <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>
/// <param name="nextAction">If not null next locking action which is performed after booking.</param>
/// <returns>Request to booking bike.</returns>
string DoBook(string bikeId, Guid guid, double batteryPercentage);
string DoBook(string bikeId, Guid guid, double batteryPercentage, LockingAction? nextAction = null);
/// <summary> Gets the request to book and start opening the bike (synonym: booking == renting == mieten). </summary>
/// <param name="bikeId">Id of the bike to book.</param>

View file

@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.Net;
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
using TINK.Model.Connector;
using TINK.Model.Device;
using TINK.Repository.Exception;
@ -109,7 +110,7 @@ namespace TINK.Repository.Request
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)
public string DoBook(string bikeId, Guid guid, double batteryPercentage, LockingAction? nextAction = null)
=> throw new NotSupportedException();
/// <summary> Gets the request to book and start opening the bike (synonym: booking == renting == mieten). </summary>

View file

@ -1,4 +1,6 @@

using TINK.Model.Connector;
namespace TINK.Repository.Request
{
public static class RequestBuilderHelper
@ -12,5 +14,20 @@ namespace TINK.Repository.Request
=> !string.IsNullOrEmpty(uiIsoLangugageName)
? $"&lang={uiIsoLangugageName}"
: string.Empty;
public static lock_state? GetLockState(this LockingAction? action)
{
switch (action)
{
case LockingAction.Open:
return lock_state.unlocking;
case LockingAction.Close:
return lock_state.locking;
default:
return null;
}
}
}
}

View file

@ -4,6 +4,7 @@ using System.Globalization;
using System.Linq;
using System.Net;
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
using TINK.Model.Connector;
using TINK.Model.Device;
using TINK.Repository.Exception;
using TINK.Services.Logging;
@ -153,14 +154,15 @@ namespace TINK.Repository.Request
/// <param name="bikeId">Id of the bike to book.</param>
/// <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>
/// <param name="nextAction">If not null next locking action which is performed after booking.</param>
/// <returns>Request to booking bike.</returns>
public string DoBook(string bikeId, Guid guid, double batteryPercentage)
public string DoBook(string bikeId, Guid guid, double batteryPercentage, LockingAction? nextAction = null)
=> "request=booking_update" +
GetBikeIdParameter(bikeId) +
AuthCookieParameter +
$"&Ilockit_GUID={guid}" +
"&state=occupied" +
GetLockStateParameter(lock_state.unlocked) +
GetLockStateParameter(nextAction.GetLockState()) +
GetBatteryPercentageParameters(batteryPercentage) +
UiIsoLanguageNameParameter;
@ -269,9 +271,12 @@ namespace TINK.Repository.Request
private static string GetBikeIdParameter(string bikeId)
=> $"&bike={bikeId}";
private static string GetLockStateParameter(lock_state lockState)
=> $"&lock_state={lockState}";
private static string GetLockStateParameter(lock_state? lockState)
=> lockState.HasValue ? $"&lock_state={lockState}" : string.Empty;
/// <summary>
/// Gets the battery level percentage parameter if percentage is not NaN an empty string otherwise.
/// </summary>
private static string GetBatteryPercentageParameters(double batteryPercentage) => !double.IsNaN(batteryPercentage)
? $"&voltage={batteryPercentage.ToString(CultureInfo.InvariantCulture)}"
: string.Empty;

View file

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Threading.Tasks;
using Serilog;
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
using TINK.Model.Connector;
using TINK.Model.Connector.Updater;
using TINK.Model.Device;
using TINK.Repository;
@ -243,12 +244,14 @@ namespace TINK.Model.Services.CopriApi
versionInfo);
/// <summary> Books a bike. </summary>
/// <param name="operatorUri">Holds the uri of the operator or null, in case of single operator setup.</param>
/// <param name="bikeId">Id of the bike to book.</param>
/// <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>
/// <param name="nextAction">If not null next locking action which is performed after booking.</param>
/// <returns>Response on booking request.</returns>
public async Task<ReservationBookingResponse> DoBookAsync(string bikeId, Guid guid, double batteryPercentage, Uri operatorUri)
=> await HttpsServer.DoBookAsync(bikeId, guid, batteryPercentage, operatorUri);
public async Task<ReservationBookingResponse> DoBookAsync(Uri operatorUri, string bikeId, Guid guid, double batteryPercentage, LockingAction? nextAction = null)
=> await HttpsServer.DoBookAsync(operatorUri, bikeId, guid, batteryPercentage, nextAction);
/// <summary> Books a bike and starts opening bike. </summary>
/// <param name="bikeId">Id of the bike to book.</param>

View file

@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
using TINK.Model.Connector;
using TINK.Model.Device;
using TINK.Repository;
using TINK.Repository.Request;
@ -65,8 +66,8 @@ namespace TINK.Model.Services.CopriApi
batteryLevel,
versionInfo);
public async Task<ReservationBookingResponse> DoBookAsync(string bikeId, Guid guid, double batteryPercentage, Uri operatorUri)
=> await monkeyStore.DoBookAsync(bikeId, guid, batteryPercentage, operatorUri);
public async Task<ReservationBookingResponse> DoBookAsync(Uri operatorUri, string bikeId, Guid guid, double batteryPercentage, LockingAction? nextAction = null)
=> await monkeyStore.DoBookAsync(operatorUri, bikeId, guid, batteryPercentage, nextAction);
public async Task<ReservationBookingResponse> BookAvailableAndStartOpeningAsync(
string bikeId,

View file

@ -222,7 +222,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
IsConnected = IsConnectedDelegate();
try
{
await ConnectorFactory(IsConnected).Command.DoBook(SelectedBike);
await ConnectorFactory(IsConnected).Command.DoBookAsync(SelectedBike, LockingAction.Open);
}
catch (Exception l_oException)
{

View file

@ -194,7 +194,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
IsConnected = IsConnectedDelegate();
try
{
await ConnectorFactory(IsConnected).Command.DoBook(SelectedBike);
await ConnectorFactory(IsConnected).Command.DoBookAsync(SelectedBike);
}
catch (Exception l_oException)
{

View file

@ -187,7 +187,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
IsConnected = IsConnectedDelegate();
try
{
await ConnectorFactory(IsConnected).Command.DoBook(SelectedBike);
await ConnectorFactory(IsConnected).Command.DoBookAsync(SelectedBike, LockingAction.Open);
}
catch (Exception l_oException)
{

View file

@ -350,7 +350,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
IsConnected = IsConnectedDelegate();
try
{
await ConnectorFactory(IsConnected).Command.DoBook(SelectedBike);
await ConnectorFactory(IsConnected).Command.DoBookAsync(SelectedBike, LockingAction.Open);
}
catch (Exception l_oException)
{

View file

@ -106,7 +106,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
IsConnected = IsConnectedDelegate();
try
{
await ConnectorFactory(IsConnected).Command.DoBook(SelectedBike);
await ConnectorFactory(IsConnected).Command.DoBookAsync(SelectedBike);
}
catch (Exception l_oException)
{

View file

@ -858,98 +858,6 @@ namespace TINK.ViewModel.Map
}
}
/// <summary> Command object to bind CurrentLocation Button to view model.</summary>
public System.Windows.Input.ICommand OnCurrentLocationButtonClicked => new Xamarin.Forms.Command(async () => await CenterToCurrentLocation());
/// <summary> User request to center to currentLocation. </summary>
public async Task CenterToCurrentLocation()
{
try
{
ActionText = AppResources.ActivityTextCenterMap;
IsMapPageEnabled = false;
Log.ForContext<MapPageViewModel>().Information($"Request to center to current position.");
// Stop polling.
//ActionText = AppResources.ActivityTextOneMomentPlease;
await m_oViewUpdateManager.StopUpdatePeridically();
// Clear error info.
Exception = null;
ActiveFilterMap = tinkKonradToggleViewModel.FilterDictionary;
TinkApp.GroupFilterMapPage = ActiveFilterMap;
TinkApp.Save();
TinkApp.UpdateConnector();
// Check location permission
var status = await RequestLocationPermission();
if (status == Status.Granted)
{
// Move and scale.
Location currentLocation = null;
try
{
currentLocation = await GeolocationService.GetAsync();
}
catch (Exception ex)
{
Log.ForContext<MapPageViewModel>().Error("Getting location failed. {Exception}", ex);
}
if (currentLocation != null)
{
ActionText = AppResources.ActivityTextCenterMap;
TinkApp.UserMapSpan = MapSpan.FromCenterAndRadius(
new Xamarin.Forms.GoogleMaps.Position(currentLocation.Latitude, currentLocation.Longitude),
TinkApp.ActiveMapSpan.Radius);
TinkApp.Save();
MoveAndScale(m_oMoveToRegionDelegate, TinkApp.ActiveMapSpan);
try
{
// Update bikes at station or my bikes depending on context.
await m_oViewUpdateManager.StartUpdateAyncPeridically(Polling);
}
catch (Exception)
{
// Excpetions are handled insde update task;
}
}
else
{
await ViewService.DisplayAlert(
AppResources.MessageTitleHint,
AppResources.MessageErrorLocationIsOff,
AppResources.MessageAnswerOk);
}
}
IsMapPageEnabled = true;
Log.ForContext<MapPageViewModel>().Information($"Center to current Position done.");
ActionText = String.Empty;
}
catch (Exception l_oException)
{
Log.ForContext<MapPageViewModel>().Error("An error occurred while centering to current position.");
ActionText = String.Empty;
await ViewService.DisplayAlert(
"Fehler",
AppResources.MessageMapPageErrorSwitch,
String.Format(AppResources.MessageErrorQueryLocationMessage, l_oException.Message),
AppResources.MessageAnswerOk);
IsMapPageEnabled = true;
}
}
/// <summary> Command object to bind login button to view model.</summary>
public System.Windows.Input.ICommand OnToggleTinkToKonrad => new Xamarin.Forms.Command(async () => await ToggleTinkToKonrad());
@ -1015,43 +923,6 @@ namespace TINK.ViewModel.Map
Pins.Clear();
//// Move and scale before getting stations and bikes which takes some time.
//if (TinkApp.CenterMapToCurrentLocation)
//{
// // Check location permission
// //ActionText = AppResources.ActivityTextRequestingLocationPermissions;
// var status = await RequestLocationPermission();
// if (status == Status.Granted)
// {
// //ActionText = AppResources.ActivityTextCenterMap;
// Location currentLocation = null;
// try
// {
// currentLocation = await GeolocationService.GetAsync();
// }
// catch (Exception ex)
// {
// Log.ForContext<MapPageViewModel>().Error("Getting location failed. {Exception}", ex);
// }
// if (currentLocation != null)
// {
// TinkApp.UserMapSpan = MapSpan.FromCenterAndRadius(
// new Xamarin.Forms.GoogleMaps.Position(currentLocation.Latitude, currentLocation.Longitude),
// TinkApp.ActiveMapSpan.Radius);
// TinkApp.Save();
// //MoveAndScale(m_oMoveToRegionDelegate, TinkApp.ActiveMapSpan);
// }
// else
// {
// ActionText = AppResources.ActivityTextErrorQueryLocationWhenAny;
// }
// }
//}
// Update stations
ActionText = AppResources.ActivityTextMapLoadingStationsAndBikes;
IsConnected = TinkApp.GetIsConnected();

View file

@ -5,6 +5,7 @@ using System.Reflection;
using System.Threading.Tasks;
using TINK.Model;
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
using TINK.Model.Connector;
using TINK.Model.Device;
using TINK.Repository;
using TINK.Repository.Request;
@ -263,7 +264,7 @@ namespace TestFramework.Repository
IVersionInfo versionInfo)
=> null;
public Task<ReservationBookingResponse> DoBookAsync(string bikeId, Guid guid, double batteryPercentage, Uri operatorUri)
public Task<ReservationBookingResponse> DoBookAsync(Uri operatorUri, string bikeId, Guid guid, double batteryPercentage, LockingAction? nextAction = null)
=> null;
public Task<ReservationBookingResponse> BookAvailableAndStartOpeningAsync(string bikeId, Uri operatorUri)
=> null;

View file

@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
using TINK.Model.Connector;
using TINK.Model.Device;
using TINK.Repository;
using TINK.Repository.Request;
@ -64,7 +65,7 @@ namespace TestFramework.Repository
IVersionInfo versionInfo)
=> throw new NotImplementedException();
public Task<ReservationBookingResponse> DoBookAsync(string bikeId, Guid guid, double batteryPercentage, Uri operatorUri)
public Task<ReservationBookingResponse> DoBookAsync(Uri operatorUri, string bikeId, Guid guid, double batteryPercentage, LockingAction? nextAction = null)
=> throw new NotImplementedException();
public Task<ReservationBookingResponse> BookAvailableAndStartOpeningAsync(string bikeId, Uri operatorUri)

View file

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Threading.Tasks;
using TestFramework.Repository;
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
using TINK.Model.Connector;
using TINK.Model.Device;
using TINK.Model.Services.CopriApi;
using TINK.Repository.Request;
@ -84,7 +85,7 @@ namespace TestFramework.Services.CopriApi.Connector
IVersionInfo versionInfo)
=> throw new NotImplementedException();
public Task<ReservationBookingResponse> DoBookAsync(string bikeId, Guid guid, double batteryPercentage, Uri operatorUri)
public Task<ReservationBookingResponse> DoBookAsync(Uri operatorUri, string bikeId, Guid guid, double batteryPercentage, LockingAction? nextAction = null)
=> throw new NotImplementedException();
public Task<ReservationBookingResponse> BookAvailableAndStartOpeningAsync(string bikeId, Uri operatorUri)

View file

@ -0,0 +1,36 @@
using System;
using NUnit.Framework;
using TINK.Model.Connector;
using TINK.Repository.Request;
namespace TestShareeLib.Repository.Request
{
[TestFixture]
public class TestRequestBuilderHelper
{
[Test]
public void TestGetLockStateNull()
=> Assert.That(
RequestBuilderHelper.GetLockState(null),
Is.Null);
[Test]
public void TestGetLockState([Values] LockingAction action)
{
switch (action)
{
case LockingAction.Open:
case LockingAction.Close:
break;
default:
throw new ArgumentException("Tests need possibly exended.");
}
Assert.That(
RequestBuilderHelper.GetLockState(action),
Is.EqualTo(action == LockingAction.Open ? lock_state.unlocking : lock_state.locking));
}
}
}

View file

@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.Net;
using NUnit.Framework;
using TINK.Model.Connector;
using TINK.Repository.Exception;
using TINK.Repository.Request;
@ -117,18 +118,35 @@ namespace TestShareeLib.Repository.Request
public void TestDoBook()
{
Assert.AreEqual(
"request=booking_update&bike=42&authcookie=456123&Ilockit_GUID=0000f00d-1212-efde-1523-785fef13d123&state=occupied&lock_state=unlocked&voltage=33.21",
new RequestBuilderLoggedIn("123", null /*UI language */, "456").DoBook("42", new Guid("0000f00d-1212-efde-1523-785fef13d123"), 33.21));
"request=booking_update&bike=42&authcookie=456123&Ilockit_GUID=0000f00d-1212-efde-1523-785fef13d123&state=occupied&lock_state=unlocking&voltage=33.21",
new RequestBuilderLoggedIn("123", null /*UI language */, "456").DoBook("42", new Guid("0000f00d-1212-efde-1523-785fef13d123"), 33.21, LockingAction.Open));
}
[Test]
public void TestDoBookNoBatery()
{
Assert.AreEqual(
"request=booking_update&bike=42&authcookie=456123&Ilockit_GUID=0000f00d-1212-efde-1523-785fef13d123&state=occupied&lock_state=unlocked",
"request=booking_update&bike=42&authcookie=456123&Ilockit_GUID=0000f00d-1212-efde-1523-785fef13d123&state=occupied",
new RequestBuilderLoggedIn("123", null /*UI language */, "456").DoBook("42", new Guid("0000f00d-1212-efde-1523-785fef13d123"), double.NaN));
}
[Test]
public void TestDoBookActionNone()
{
Assert.AreEqual(
"request=booking_update&bike=42&authcookie=456123&Ilockit_GUID=0000f00d-1212-efde-1523-785fef13d123&state=occupied",
new RequestBuilderLoggedIn("123", null /*UI language */, "456").DoBook("42", new Guid("0000f00d-1212-efde-1523-785fef13d123"), double.NaN));
}
/// <summary> Hypothetical scenario.</summary>
[Test]
public void TestDoBookActionClose()
{
Assert.AreEqual(
"request=booking_update&bike=42&authcookie=456123&Ilockit_GUID=0000f00d-1212-efde-1523-785fef13d123&state=occupied&lock_state=locking",
new RequestBuilderLoggedIn("123", null /*UI language */, "456").DoBook("42", new Guid("0000f00d-1212-efde-1523-785fef13d123"), double.NaN, LockingAction.Close));
}
[Test]
public void TestBookAndStartOpening()
=> Assert.That(

View file

@ -157,7 +157,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.Re
locks.ConnectAsync(Arg.Any<LockInfoAuthTdo>(), Arg.Any<TimeSpan>());
bikesViewModel.ActionText = "";
bikesViewModel.ActionText = "Renting bike...";
connector.Command.DoBook(bike); // Booking must be performed
connector.Command.DoBookAsync(bike, LockingAction.Open); // Booking must be performed
bikesViewModel.ActionText = "<h4><b>Lock is opening.<br/>Please wait until it is completely open.</b></h4>";
locks.Received()[0].OpenAsync(); // Lock must be opened
bikesViewModel.ActionText = "Reading charging level...";

View file

@ -281,7 +281,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.Re
bikesViewModel.ActionText = "Reading charging level...";
locks[0].GetBatteryPercentageAsync();
bikesViewModel.ActionText = "Renting bike...";
connector.Command.DoBook(bike);
connector.Command.DoBookAsync(bike);
bikesViewModel.ActionText = "Updating...";
pollingManager.StartUpdateAyncPeridically(); // polling must be restarted again
bikesViewModel.ActionText = "";
@ -328,7 +328,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.Re
viewService.DisplayAlert(string.Empty, "Fahrrad Nr. 0 mieten oder Schloss schließen?", "Mieten", "Schloss schließen").Returns(Task.FromResult(true));
connector.Command.DoBook(bike).Returns(x => throw new WebConnectFailureException("Context info.", new Exception("chub")));
connector.Command.DoBookAsync(bike).Returns(x => throw new WebConnectFailureException("Context info.", new Exception("chub")));
locks[0].CloseAsync().Returns(Task.FromResult((LockitLockingState?)LockitLockingState.Closed));
@ -345,7 +345,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.Re
bikesViewModel.ActionText = "Reading charging level...";
locks[0].GetBatteryPercentageAsync();
bikesViewModel.ActionText = "Renting bike...";
connector.Command.DoBook(bike);
connector.Command.DoBookAsync(bike);
bikesViewModel.ActionText = "";
viewService.DisplayAlert(
"Connection error when renting the bike!",
@ -401,7 +401,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.Re
viewService.DisplayAlert(string.Empty, "Fahrrad Nr. 0 mieten oder Schloss schließen?", "Mieten", "Schloss schließen").Returns(Task.FromResult(true));
connector.Command.DoBook(bike).Returns(x => throw new Exception("Exception message."));
connector.Command.DoBookAsync(bike).Returns(x => throw new Exception("Exception message."));
locks[0].CloseAsync().Returns(Task.FromResult((LockitLockingState?)LockitLockingState.Closed));
@ -418,7 +418,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.Re
bikesViewModel.ActionText = "Reading charging level...";
locks[0].GetBatteryPercentageAsync();
bikesViewModel.ActionText = "Renting bike...";
connector.Command.DoBook(bike);
connector.Command.DoBookAsync(bike);
bikesViewModel.ActionText = "";
viewService.DisplayAlert("Error when renting the bike!", "Attention: Lock is closed!\r\nException message.", "OK");
bikesViewModel.ActionText = "Verschließe Schloss...";

View file

@ -472,7 +472,7 @@ namespace TestShareeLib.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
bikesViewModel.ActionText = "One moment please...";
pollingManager.StopUpdatePeridically(); // Polling must be stopped before any COPR and lock service action
bikesViewModel.ActionText = "Renting bike...";
connector.Command.DoBook(bike); // Booking must be performed
connector.Command.DoBookAsync(bike, LockingAction.Open); // Booking must be performed
bikesViewModel.ActionText = "<h4><b>Lock is opening.<br/>Please wait until it is completely open.</b></h4>";
locks.Received()[0].OpenAsync(); // Lock must be opened
bikesViewModel.ActionText = "Reading charging level...";
@ -528,7 +528,7 @@ namespace TestShareeLib.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
bike.LockInfo.State.Returns(LockingState.Closed); // Locking state does not change.
connector.Command.DoBook(bike).Returns(x => throw new WebConnectFailureException("Context info", new Exception("Tst")));
connector.Command.DoBookAsync(bike, LockingAction.Open).Returns(x => throw new WebConnectFailureException("Context info", new Exception("Tst")));
bike.State.Value.Returns(InUseStateEnum.Reserved); // State remains reserved because booking request failed.
@ -541,7 +541,7 @@ namespace TestShareeLib.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
bikesViewModel.ActionText = "One moment please...";
pollingManager.StopUpdatePeridically(); // Polling must be stopped before any COPR and lock service action
bikesViewModel.ActionText = "Renting bike...";
connector.Command.DoBook(bike); // Booking must be performed
connector.Command.DoBookAsync(bike, LockingAction.Open); // Booking must be performed
bikesViewModel.ActionText = "";
viewService.DisplayAdvancedAlert(
"Connection error when renting the bike!",
@ -597,7 +597,7 @@ namespace TestShareeLib.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
bike.LockInfo.State.Returns(LockingState.Closed); // Locking state does not change.
connector.Command.DoBook(bike).Returns(x => throw new Exception("Exception message."));
connector.Command.DoBookAsync(bike, LockingAction.Open).Returns(x => throw new Exception("Exception message."));
bike.State.Value.Returns(InUseStateEnum.Reserved); // When booking fails state remains reserved.
@ -610,7 +610,7 @@ namespace TestShareeLib.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
bikesViewModel.ActionText = "One moment please...";
pollingManager.StopUpdatePeridically(); // Polling must be stopped before any COPR and lock service action
bikesViewModel.ActionText = "Renting bike...";
connector.Command.DoBook(bike); // Booking must be performed
connector.Command.DoBookAsync(bike, LockingAction.Open); // Booking must be performed
bikesViewModel.ActionText = "";
viewService.DisplayAdvancedAlert(
"Error when renting the bike!",
@ -679,7 +679,7 @@ namespace TestShareeLib.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
bikesViewModel.ActionText = "One moment please...";
pollingManager.StopUpdatePeridically(); // Polling must be stopped before any COPR and lock service action
bikesViewModel.ActionText = "Renting bike...";
connector.Command.DoBook(bike); // Booking must be performed
connector.Command.DoBookAsync(bike, LockingAction.Open); // Booking must be performed
bikesViewModel.ActionText = "<h4><b>Lock is opening.<br/>Please wait until it is completely open.</b></h4>";
locks.Received()[0].OpenAsync(); // Lock must be opened
bikesViewModel.ActionText = "";
@ -746,7 +746,7 @@ namespace TestShareeLib.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
bikesViewModel.ActionText = "One moment please...";
pollingManager.StopUpdatePeridically(); // Polling must be stopped before any COPR and lock service action
bikesViewModel.ActionText = "Renting bike...";
connector.Command.DoBook(bike); // Booking must be performed
connector.Command.DoBookAsync(bike, LockingAction.Open); // Booking must be performed
bikesViewModel.ActionText = "<h4><b>Lock is opening.<br/>Please wait until it is completely open.</b></h4>";
locks.Received()[0].OpenAsync(); // Lock must be opened
bikesViewModel.ActionText = "";
@ -812,7 +812,7 @@ namespace TestShareeLib.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
bikesViewModel.ActionText = "One moment please...";
pollingManager.StopUpdatePeridically(); // Polling must be stopped before any COPR and lock service action
bikesViewModel.ActionText = "Renting bike...";
connector.Command.DoBook(bike); // Booking must be performed
connector.Command.DoBookAsync(bike, LockingAction.Open); // Booking must be performed
bikesViewModel.ActionText = "<h4><b>Lock is opening.<br/>Please wait until it is completely open.</b></h4>";
locks.Received()[0].OpenAsync(); // Lock must be opened
bikesViewModel.ActionText = "Updating...";
@ -878,7 +878,7 @@ namespace TestShareeLib.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
bikesViewModel.ActionText = "One moment please...";
pollingManager.StopUpdatePeridically(); // Polling must be stopped before any COPR and lock service action
bikesViewModel.ActionText = "Renting bike...";
connector.Command.DoBook(bike); // Booking must be performed
connector.Command.DoBookAsync(bike, LockingAction.Open); // Booking must be performed
bikesViewModel.ActionText = "<h4><b>Lock is opening.<br/>Please wait until it is completely open.</b></h4>";
locks.Received()[0].OpenAsync(); // Lock must be opened
bikesViewModel.ActionText = "Reading charging level...";
@ -949,7 +949,7 @@ namespace TestShareeLib.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
bikesViewModel.ActionText = "One moment please...";
pollingManager.StopUpdatePeridically(); // Polling must be stopped before any COPR and lock service action
bikesViewModel.ActionText = "Renting bike...";
connector.Command.DoBook(bike); // Booking must be performed
connector.Command.DoBookAsync(bike, LockingAction.Open); // Booking must be performed
bikesViewModel.ActionText = "<h4><b>Lock is opening.<br/>Please wait until it is completely open.</b></h4>";
locks.Received()[0].OpenAsync(); // Lock must be opened
bikesViewModel.ActionText = "Reading charging level...";
@ -1020,7 +1020,7 @@ namespace TestShareeLib.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
bikesViewModel.ActionText = "One moment please...";
pollingManager.StopUpdatePeridically(); // Polling must be stopped before any COPR and lock service action
bikesViewModel.ActionText = "Renting bike...";
connector.Command.DoBook(bike); // Booking must be performed
connector.Command.DoBookAsync(bike, LockingAction.Open); // Booking must be performed
bikesViewModel.ActionText = "<h4><b>Lock is opening.<br/>Please wait until it is completely open.</b></h4>";
locks.Received()[0].OpenAsync(); // Lock must be opened
bikesViewModel.ActionText = "Reading charging level...";
@ -1091,7 +1091,7 @@ namespace TestShareeLib.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
bikesViewModel.ActionText = "One moment please...";
pollingManager.StopUpdatePeridically(); // Polling must be stopped before any COPR and lock service action
bikesViewModel.ActionText = "Renting bike...";
connector.Command.DoBook(bike); // Booking must be performed
connector.Command.DoBookAsync(bike, LockingAction.Open); // Booking must be performed
bikesViewModel.ActionText = "<h4><b>Lock is opening.<br/>Please wait until it is completely open.</b></h4>";
locks.Received()[0].OpenAsync(); // Lock must be opened
bikesViewModel.ActionText = "Reading charging level...";
@ -1163,7 +1163,7 @@ namespace TestShareeLib.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
bikesViewModel.ActionText = "One moment please...";
pollingManager.StopUpdatePeridically(); // Polling must be stopped before any COPR and lock service action
bikesViewModel.ActionText = "Renting bike...";
connector.Command.DoBook(bike); // Booking must be performed
connector.Command.DoBookAsync(bike, LockingAction.Open); // Booking must be performed
bikesViewModel.ActionText = "<h4><b>Lock is opening.<br/>Please wait until it is completely open.</b></h4>";
locks.Received()[0].OpenAsync(); // Lock must be opened
bikesViewModel.ActionText = "Reading charging level...";

View file

@ -422,7 +422,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.Re
locks.ConnectAsync(Arg.Any<LockInfoAuthTdo>(), Arg.Any<TimeSpan>());
bikesViewModel.ActionText = "";
bikesViewModel.ActionText = "Renting bike...";
connector.Command.DoBook(bike); // Booking must be performed
connector.Command.DoBookAsync(bike, LockingAction.Open); // Booking must be performed
bikesViewModel.ActionText = "<h4><b>Lock is opening.<br/>Please wait until it is completely open.</b></h4>";
locks.Received()[0].OpenAsync(); // Lock must be opened
bikesViewModel.ActionText = "Reading charging level...";

View file

@ -94,7 +94,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.Re
bikesViewModel.ActionText = "Reading charging level...";
locks[0].GetBatteryPercentageAsync();
bikesViewModel.ActionText = "Renting bike...";
connector.Command.DoBook(bike);
connector.Command.DoBookAsync(bike);
bikesViewModel.ActionText = "Updating...";
pollingManager.StartUpdateAyncPeridically(); // polling must be restarted again
bikesViewModel.ActionText = "";
@ -139,7 +139,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.Re
viewService.DisplayAlert(string.Empty, "Rad Nr. 0 abschließen und zurückgeben oder Rad mieten?", "Zurückgeben", "Mieten").Returns(Task.FromResult(false));
connector.Command.DoBook(bike).Returns(x => throw new WebConnectFailureException("Context info.", new Exception("Tst")));
connector.Command.DoBookAsync(bike).Returns(x => throw new WebConnectFailureException("Context info.", new Exception("Tst")));
locks[0].CloseAsync().Returns(LockitLockingState.Closed);
@ -156,7 +156,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.Re
bikesViewModel.ActionText = "Reading charging level...";
locks[0].GetBatteryPercentageAsync();
bikesViewModel.ActionText = "Renting bike...";
connector.Command.DoBook(bike);
connector.Command.DoBookAsync(bike);
bikesViewModel.ActionText = "";
viewService.DisplayAlert(
"Connection error when renting the bike!",
@ -208,7 +208,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.Re
viewService.DisplayAlert(string.Empty, "Rad Nr. 0 abschließen und zurückgeben oder Rad mieten?", "Zurückgeben", "Mieten").Returns(Task.FromResult(false));
connector.Command.DoBook(bike).Returns(x => throw new Exception("Exception message."));
connector.Command.DoBookAsync(bike).Returns(x => throw new Exception("Exception message."));
locks[0].CloseAsync().Returns(LockitLockingState.Closed);
@ -225,7 +225,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.Re
bikesViewModel.ActionText = "Reading charging level...";
locks[0].GetBatteryPercentageAsync();
bikesViewModel.ActionText = "Renting bike...";
connector.Command.DoBook(bike);
connector.Command.DoBookAsync(bike);
bikesViewModel.ActionText = "";
viewService.DisplayAlert("Error when renting the bike!", "Attention: Lock is closed!\r\nException message.", "OK");
bikesViewModel.ActionText = "Wiederverschließe Schloss...";

View file

@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
using TINK.Model.Connector;
using TINK.Model.Device;
using TINK.Model.Services.CopriApi;
using TINK.Repository;
@ -89,7 +90,7 @@ namespace TestTINKLib.Mocks.Connector
IVersionInfo versionInfo)
=> throw new NotImplementedException();
public Task<ReservationBookingResponse> DoBookAsync(string bikeId, Guid guid, double batteryPercentage, Uri operatorUri)
public Task<ReservationBookingResponse> DoBookAsync(Uri operatorUri, string bikeId, Guid guid, double batteryPercentage, LockingAction? nextAction = null)
=> throw new NotImplementedException();
public Task<ReservationBookingResponse> BookAvailableAndStartOpeningAsync(string bikeId, Uri operatorUri)