From 52c9f6f1d961dfe2d634a2809f3fc1f45175e47e Mon Sep 17 00:00:00 2001 From: Anja Date: Fri, 16 Sep 2022 11:19:46 +0200 Subject: [PATCH] Version 3.0.339 --- .../Properties/AndroidManifest.xml | 2 +- LastenradBayern/TINK.iOS/Info.plist | 6 +- .../TINK/View/RootShell/AppShell.xaml | 5 + .../Properties/AndroidManifest.xml | 2 +- Meinkonrad/TINK.iOS/Info.plist | 6 +- Meinkonrad/TINK/View/Bike/ILockItBike.xaml | 73 +++--- .../TINK/View/RootShell/FlyoutFooter.xaml | 31 ++- .../ShareeSharedGuiLib.projitems | 17 ++ ShareeSharedGuiLib/View/BarLevelView.xaml | 6 +- .../View/RunningProcessView.xaml | 46 ++++ .../View/RunningProcessView.xaml.cs | 20 ++ .../View/VersionNumberView.xaml | 21 ++ .../View/VersionNumberView.xaml.cs | 23 ++ .../Properties/AndroidManifest.xml | 2 +- TINK/TINK.iOS/Info.plist | 6 +- .../BikesAtStation/BikesAtStationPage.xaml | 202 ++++++++-------- .../View/CopriWebView/ManageAccountPage.xaml | 74 +++--- .../CopriWebView/PasswordForgottenPage.xaml | 18 +- TINK/TINK/View/CopriWebView/RegisterPage.xaml | 18 +- TINK/TINK/View/FindBike/FindBikePage.xaml | 136 +++++------ TINK/TINK/View/Map/MapPage.xaml | 224 +++++++++--------- TINK/TINK/View/MyBikes/MyBikesPage.xaml | 129 +++++----- TINK/TINK/View/RootShell/AppShell.xaml | 139 +++++------ TINKLib/Model/CurrentAppInfos.cs | 9 + TINKLib/Model/Device/ISmartDevice.cs | 3 +- .../Model/Logging/AppAndEnvironmentInfo.cs | 16 ++ TINKLib/Model/TinkApp.cs | 56 ++++- TINKLib/Model/WhatsNew.cs | 12 +- .../AppResources.Designer.cs | 29 +++ .../AppResources.de.resx | 11 + .../MultilingualResources/AppResources.resx | 11 + TINKLib/MultilingualResources/TINKLib.de.xlf | 16 ++ .../Exception/NotAtStationException.cs | 37 ++- TINKLib/TINKLib.csproj | 8 + TINKLib/View/Themes/ShareeBike.xaml | 32 ++- .../RequestHandler/BookedClosed.cs | 13 +- .../RequestHandler/BookedOpen.cs | 29 ++- TestFramework/Model/Device/DeviceMock.cs | 8 +- .../Exception/TestBookingDeclinedException.cs | 0 .../Exception/TestNoGPSDataException.cs | 0 .../Exception/TestNotAtStationException.cs | 71 ++++++ .../Exception/TestNotAtStationException.cs | 37 --- TestTINKLib/TestTINKLib.csproj | 3 - 43 files changed, 993 insertions(+), 614 deletions(-) create mode 100644 ShareeSharedGuiLib/View/RunningProcessView.xaml create mode 100644 ShareeSharedGuiLib/View/RunningProcessView.xaml.cs create mode 100644 ShareeSharedGuiLib/View/VersionNumberView.xaml create mode 100644 ShareeSharedGuiLib/View/VersionNumberView.xaml.cs create mode 100644 TINKLib/Model/CurrentAppInfos.cs create mode 100644 TINKLib/Model/Logging/AppAndEnvironmentInfo.cs rename {TestTINKLib/Fixtures/ObjectTests => TestShareeLib}/Repository/Exception/TestBookingDeclinedException.cs (100%) rename {TestTINKLib/Fixtures/ObjectTests => TestShareeLib}/Repository/Exception/TestNoGPSDataException.cs (100%) create mode 100644 TestShareeLib/Repository/Exception/TestNotAtStationException.cs delete mode 100644 TestTINKLib/Fixtures/ObjectTests/Repository/Exception/TestNotAtStationException.cs diff --git a/LastenradBayern/TINK.Android/Properties/AndroidManifest.xml b/LastenradBayern/TINK.Android/Properties/AndroidManifest.xml index 3a74495..8a2a8df 100644 --- a/LastenradBayern/TINK.Android/Properties/AndroidManifest.xml +++ b/LastenradBayern/TINK.Android/Properties/AndroidManifest.xml @@ -1,5 +1,5 @@  - + diff --git a/LastenradBayern/TINK.iOS/Info.plist b/LastenradBayern/TINK.iOS/Info.plist index 1df5dc7..763ff40 100644 --- a/LastenradBayern/TINK.iOS/Info.plist +++ b/LastenradBayern/TINK.iOS/Info.plist @@ -1,4 +1,4 @@ - + @@ -55,8 +55,8 @@ CFBundleDisplayName LastenradBayern CFBundleVersion - 338 + 339 CFBundleShortVersionString - 3.0.338 + 3.0.339 diff --git a/LastenradBayern/TINK/View/RootShell/AppShell.xaml b/LastenradBayern/TINK/View/RootShell/AppShell.xaml index 3f1682a..c2ae6fe 100644 --- a/LastenradBayern/TINK/View/RootShell/AppShell.xaml +++ b/LastenradBayern/TINK/View/RootShell/AppShell.xaml @@ -11,6 +11,7 @@ xmlns:contact="clr-namespace:TINK.View.Contact" xmlns:info="clr-namespace:TINK.View.Info" xmlns:header="clr-namespace:TINK.View.RootShell" + xmlns:version="clr-namespace:ShareeSharedGuiLib.View" BackgroundColor="{DynamicResource Key=primary-back-title-color}" Title="Shell" x:Class="TINK.View.RootShell.AppShell"> @@ -107,4 +108,8 @@ + + + + diff --git a/Meinkonrad/TINK.Android/Properties/AndroidManifest.xml b/Meinkonrad/TINK.Android/Properties/AndroidManifest.xml index 1aa4466..204b1c9 100644 --- a/Meinkonrad/TINK.Android/Properties/AndroidManifest.xml +++ b/Meinkonrad/TINK.Android/Properties/AndroidManifest.xml @@ -1,5 +1,5 @@  - + diff --git a/Meinkonrad/TINK.iOS/Info.plist b/Meinkonrad/TINK.iOS/Info.plist index eb15ae2..506f30a 100644 --- a/Meinkonrad/TINK.iOS/Info.plist +++ b/Meinkonrad/TINK.iOS/Info.plist @@ -1,4 +1,4 @@ - + @@ -55,8 +55,8 @@ CFBundleDisplayName Mein konrad CFBundleVersion - 338 + 339 CFBundleShortVersionString - 3.0.338 + 3.0.339 diff --git a/Meinkonrad/TINK/View/Bike/ILockItBike.xaml b/Meinkonrad/TINK/View/Bike/ILockItBike.xaml index 958671f..6e016c8 100644 --- a/Meinkonrad/TINK/View/Bike/ILockItBike.xaml +++ b/Meinkonrad/TINK/View/Bike/ILockItBike.xaml @@ -1,4 +1,4 @@ - + - - - - - - - - - - - - - + + + + + + + - - + + - - - + + + + + - \ No newline at end of file + diff --git a/Meinkonrad/TINK/View/RootShell/FlyoutFooter.xaml b/Meinkonrad/TINK/View/RootShell/FlyoutFooter.xaml index 100de72..4b7158d 100644 --- a/Meinkonrad/TINK/View/RootShell/FlyoutFooter.xaml +++ b/Meinkonrad/TINK/View/RootShell/FlyoutFooter.xaml @@ -1,28 +1,31 @@ - + - - - - - - + + + + + + + - - \ No newline at end of file + --> + + + + diff --git a/ShareeSharedGuiLib/ShareeSharedGuiLib.projitems b/ShareeSharedGuiLib/ShareeSharedGuiLib.projitems index 6d53f08..ad163d1 100644 --- a/ShareeSharedGuiLib/ShareeSharedGuiLib.projitems +++ b/ShareeSharedGuiLib/ShareeSharedGuiLib.projitems @@ -12,6 +12,10 @@ MSBuild:UpdateDesignTimeXaml + + Designer + MSBuild:UpdateDesignTimeXaml + @@ -25,10 +29,23 @@ BarLevelView.xaml Code + + RunningProcessView.xaml + Code + + + VersionNumberView.xaml + MSBuild:UpdateDesignTimeXaml + + + Designer + MSBuild:UpdateDesignTimeXaml + + \ No newline at end of file diff --git a/ShareeSharedGuiLib/View/BarLevelView.xaml b/ShareeSharedGuiLib/View/BarLevelView.xaml index c5e6f9c..42b4426 100644 --- a/ShareeSharedGuiLib/View/BarLevelView.xaml +++ b/ShareeSharedGuiLib/View/BarLevelView.xaml @@ -1,4 +1,4 @@ - + @@ -8,6 +8,8 @@ @@ -17,4 +19,4 @@ IsVisible="{Binding IsBatteryChargeLevelLabelVisible}"/> - \ No newline at end of file + diff --git a/ShareeSharedGuiLib/View/RunningProcessView.xaml b/ShareeSharedGuiLib/View/RunningProcessView.xaml new file mode 100644 index 0000000..4a61fc1 --- /dev/null +++ b/ShareeSharedGuiLib/View/RunningProcessView.xaml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ShareeSharedGuiLib/View/RunningProcessView.xaml.cs b/ShareeSharedGuiLib/View/RunningProcessView.xaml.cs new file mode 100644 index 0000000..7f30e6f --- /dev/null +++ b/ShareeSharedGuiLib/View/RunningProcessView.xaml.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +using Xamarin.Forms; +using Xamarin.Forms.Xaml; + +namespace ShareeSharedGuiLib.View +{ + [XamlCompilation(XamlCompilationOptions.Compile)] + public partial class RunningProcessView : ContentView + { + public RunningProcessView() + { + InitializeComponent(); + } + } +} diff --git a/ShareeSharedGuiLib/View/VersionNumberView.xaml b/ShareeSharedGuiLib/View/VersionNumberView.xaml new file mode 100644 index 0000000..a575eda --- /dev/null +++ b/ShareeSharedGuiLib/View/VersionNumberView.xaml @@ -0,0 +1,21 @@ + + + + + + + diff --git a/ShareeSharedGuiLib/View/VersionNumberView.xaml.cs b/ShareeSharedGuiLib/View/VersionNumberView.xaml.cs new file mode 100644 index 0000000..d44d50b --- /dev/null +++ b/ShareeSharedGuiLib/View/VersionNumberView.xaml.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +using Xamarin.Forms; +using Xamarin.Forms.Xaml; + +namespace ShareeSharedGuiLib.View +{ + [XamlCompilation(XamlCompilationOptions.Compile)] + public partial class VersionNumberView : ContentView + { + public VersionNumberView() + { + InitializeComponent(); + + CurrentAppVersionNumber.Text = TINK.Model.CurrentAppInfos.CurrentAppVersion; + + } + } +} diff --git a/TINK/TINK.Android/Properties/AndroidManifest.xml b/TINK/TINK.Android/Properties/AndroidManifest.xml index 7dae90f..c1a5910 100644 --- a/TINK/TINK.Android/Properties/AndroidManifest.xml +++ b/TINK/TINK.Android/Properties/AndroidManifest.xml @@ -1,5 +1,5 @@  - + diff --git a/TINK/TINK.iOS/Info.plist b/TINK/TINK.iOS/Info.plist index f5f5779..55fc5ca 100644 --- a/TINK/TINK.iOS/Info.plist +++ b/TINK/TINK.iOS/Info.plist @@ -1,4 +1,4 @@ - + @@ -55,8 +55,8 @@ CFBundleDisplayName sharee.bike CFBundleVersion - 338 + 339 CFBundleShortVersionString - 3.0.338 + 3.0.339 diff --git a/TINK/TINK/View/BikesAtStation/BikesAtStationPage.xaml b/TINK/TINK/View/BikesAtStation/BikesAtStationPage.xaml index 741d321..5ddffd4 100644 --- a/TINK/TINK/View/BikesAtStation/BikesAtStationPage.xaml +++ b/TINK/TINK/View/BikesAtStation/BikesAtStationPage.xaml @@ -1,95 +1,107 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/TINK/TINK/View/CopriWebView/ManageAccountPage.xaml b/TINK/TINK/View/CopriWebView/ManageAccountPage.xaml index 8867313..6436686 100644 --- a/TINK/TINK/View/CopriWebView/ManageAccountPage.xaml +++ b/TINK/TINK/View/CopriWebView/ManageAccountPage.xaml @@ -1,33 +1,43 @@ - - - - - - - - - - - - - - - + + - - - - - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/TINK/TINK/View/CopriWebView/PasswordForgottenPage.xaml b/TINK/TINK/View/CopriWebView/PasswordForgottenPage.xaml index a6688e6..7ae4f4b 100644 --- a/TINK/TINK/View/CopriWebView/PasswordForgottenPage.xaml +++ b/TINK/TINK/View/CopriWebView/PasswordForgottenPage.xaml @@ -1,4 +1,4 @@ - + - - + + + - \ No newline at end of file + diff --git a/TINK/TINK/View/CopriWebView/RegisterPage.xaml b/TINK/TINK/View/CopriWebView/RegisterPage.xaml index 8055797..887a150 100644 --- a/TINK/TINK/View/CopriWebView/RegisterPage.xaml +++ b/TINK/TINK/View/CopriWebView/RegisterPage.xaml @@ -1,4 +1,4 @@ - + - - + + + - \ No newline at end of file + diff --git a/TINK/TINK/View/FindBike/FindBikePage.xaml b/TINK/TINK/View/FindBike/FindBikePage.xaml index d62047d..fe62a0a 100644 --- a/TINK/TINK/View/FindBike/FindBikePage.xaml +++ b/TINK/TINK/View/FindBike/FindBikePage.xaml @@ -1,68 +1,68 @@ - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - \ No newline at end of file + xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" + xmlns:maps="clr-namespace:Xamarin.Forms.GoogleMaps;assembly=Xamarin.Forms.GoogleMaps" + xmlns:bindings="clr-namespace:Xamarin.Forms.GoogleMaps.Bindings;assembly=Xamarin.Forms.GoogleMaps.Bindings" + xmlns:resources="clr-namespace:TINK.MultilingualResources;assembly=TINKLib" + x:Class="TINK.View.Map.MapPage" + BackgroundColor="{DynamicResource Key=primary-back-title-color}"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/TINK/TINK/View/MyBikes/MyBikesPage.xaml b/TINK/TINK/View/MyBikes/MyBikesPage.xaml index b17291a..2f2ccbd 100644 --- a/TINK/TINK/View/MyBikes/MyBikesPage.xaml +++ b/TINK/TINK/View/MyBikes/MyBikesPage.xaml @@ -1,64 +1,65 @@ - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/TINK/TINK/View/RootShell/AppShell.xaml b/TINK/TINK/View/RootShell/AppShell.xaml index 0cd43a8..c726958 100644 --- a/TINK/TINK/View/RootShell/AppShell.xaml +++ b/TINK/TINK/View/RootShell/AppShell.xaml @@ -11,100 +11,105 @@ xmlns:contact="clr-namespace:TINK.View.Contact" xmlns:info="clr-namespace:TINK.View.Info" xmlns:header="clr-namespace:TINK.View.RootShell" + xmlns:version="clr-namespace:ShareeSharedGuiLib.View" BackgroundColor="{DynamicResource Key=primary-back-title-color}" Title="Shell" x:Class="TINK.View.RootShell.AppShell"> - - - - - - + + + + + - - - - - - - + + + + + + - - - - - - - + + + + + + - - - - - - - + + + + + + - - - - - - - + + + + + + - - - - - - - + + + + + + - - - - - - - + + + + + + - - - - - - - + + + + + + - - - - - - - + + + + + + - - - - - + + + + + + + + + diff --git a/TINKLib/Model/CurrentAppInfos.cs b/TINKLib/Model/CurrentAppInfos.cs new file mode 100644 index 0000000..21e4a61 --- /dev/null +++ b/TINKLib/Model/CurrentAppInfos.cs @@ -0,0 +1,9 @@ +using Xamarin.Essentials; + +namespace TINK.Model +{ + public static class CurrentAppInfos + { + public static string CurrentAppVersion => VersionTracking.CurrentVersion; + } +} diff --git a/TINKLib/Model/Device/ISmartDevice.cs b/TINKLib/Model/Device/ISmartDevice.cs index 7c1e13f..9f82494 100644 --- a/TINKLib/Model/Device/ISmartDevice.cs +++ b/TINKLib/Model/Device/ISmartDevice.cs @@ -1,4 +1,4 @@ -using Xamarin.Essentials; +using Xamarin.Essentials; namespace TINK.Model.Device { @@ -14,6 +14,7 @@ namespace TINK.Model.Device /// Device Model (SMG-950U, iPhone10,6). string Model { get; } + /// Operation system. DevicePlatform Platform { get; } /// Operating System Version Number (7.0) as text diff --git a/TINKLib/Model/Logging/AppAndEnvironmentInfo.cs b/TINKLib/Model/Logging/AppAndEnvironmentInfo.cs new file mode 100644 index 0000000..3e81d6a --- /dev/null +++ b/TINKLib/Model/Logging/AppAndEnvironmentInfo.cs @@ -0,0 +1,16 @@ +using System; +using Serilog; +using TINK.Model.Device; + +namespace TINK.Model.Logging +{ + public class AppAndEnvironmentInfo + { + public void LogHeader(ISmartDevice device, AppFlavor appFlavor, Version appVersion) + { + Log.ForContext().Information($"App: {appFlavor.GetDisplayName()}, version {appVersion}"); + Log.ForContext().Information($"OS: {device.Platform}, version: {device.VersionText}"); + Log.ForContext().Information($"Device: {device.Model}, manufacturer: {device.Manufacturer}"); + } + } +} diff --git a/TINKLib/Model/TinkApp.cs b/TINKLib/Model/TinkApp.cs index bc22049..c74dccf 100644 --- a/TINKLib/Model/TinkApp.cs +++ b/TINKLib/Model/TinkApp.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Runtime.Serialization; using System.Threading; @@ -190,6 +190,9 @@ namespace TINK.Model Flavor = flavor; + // Log application and environment information. + new AppAndEnvironmentInfo().LogHeader(device, flavor, currentVersion); + var locksServices = locksService != null ? new HashSet { locksService } : new HashSet { @@ -440,15 +443,50 @@ namespace TINK.Model LoggingLevelSwitch levelSwitch, string logFilePath) { + bool LogToFileFilter(LogEvent e) + { + if (e.Level >= levelSwitch.MinimumLevel) + { + // If level is above global logging level do log. + return true; + } + + if (!e.Properties.ContainsKey(Constants.SourceContextPropertyName)) + { + // Do not log if source context is not available. + return false; + } + var sourceContex = e.Properties[Constants.SourceContextPropertyName].ToString(); + + if ((e.Level == LogEventLevel.Information) && + (sourceContex.Contains(typeof(AppAndEnvironmentInfo).Namespace) /* Log App and enviroment info. */ + || sourceContex.Contains(typeof(ViewModel.Bikes.Bike.BluetoothLock.RequestHandler.Base).Namespace /* Log info-level messages to provide context for bluetooth log. */ ))) + { + return true; + } + + if (e.Level >= LogEventLevel.Debug + && sourceContex.Contains(typeof(LockItBase).Namespace /*Scanning, connect and management functionality */)) + { + return true; + } + + return false; + } + Log.Logger = new LoggerConfiguration() - .MinimumLevel.ControlledBy(levelSwitch) - .MinimumLevel.Override("TINK.Services.BluetoothLock.BLE", LogEventLevel.Debug) /* Scanning, connect and management functionality */ - .MinimumLevel.Override("TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler", LogEventLevel.Information) /* Provides use case context */ - .WriteTo.Debug() - .WriteTo.File(logFilePath, Logging.RollingInterval.Session) - .WriteTo.Logger(lg => lg - .MinimumLevel.ControlledBy(new LoggingLevelSwitch(LogEventLevel.Debug)) - .Filter.ByIncludingOnly(Matching.FromSource("TINK.Services.BluetoothLock.BLE")) + .MinimumLevel.Verbose() + .WriteTo.Logger(consoleLoggerConfig => consoleLoggerConfig + .MinimumLevel.Information() + .WriteTo.Debug() + ) + .WriteTo.Logger(fileLoggerConfig => fileLoggerConfig + .Filter.ByIncludingOnly(e => LogToFileFilter(e)) + .WriteTo.File(logFilePath, Logging.RollingInterval.Session) + ) + .WriteTo.Logger(copriLoggerConfig => copriLoggerConfig + .MinimumLevel.Debug() + .Filter.ByIncludingOnly(Matching.FromSource(typeof(LockItBase/*Scanning, connect and management functionality */).Namespace)) .WriteTo.MemoryQueueSink() ) .CreateLogger(); diff --git a/TINKLib/Model/WhatsNew.cs b/TINKLib/Model/WhatsNew.cs index 42829c5..91f84dc 100644 --- a/TINKLib/Model/WhatsNew.cs +++ b/TINKLib/Model/WhatsNew.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using TINK.MultilingualResources; using Xamarin.Essentials; @@ -584,6 +584,16 @@ namespace TINK.Model new Version(3, 0, 338), AppResources.ChangeLog3_0_338_SB, new List { AppFlavor.ShareeBike } + }, + { + new Version(3, 0, 339), + AppResources.ChangeLog3_0_339_SB_LB, + new List { AppFlavor.LastenradBayern, AppFlavor.ShareeBike } + }, + { + new Version(3, 0, 339), + AppResources.ChangeLog3_0_339_MK, + new List { AppFlavor.MeinKonrad } } }; diff --git a/TINKLib/MultilingualResources/AppResources.Designer.cs b/TINKLib/MultilingualResources/AppResources.Designer.cs index 6ecd09e..10f7862 100644 --- a/TINKLib/MultilingualResources/AppResources.Designer.cs +++ b/TINKLib/MultilingualResources/AppResources.Designer.cs @@ -1210,6 +1210,26 @@ namespace TINK.MultilingualResources { } } + /// + /// Looks up a localized string similar to The cargo bikes from the suburbs now show their home station in their name. These bikes must be returned there! + /// + ///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!. + /// + public static string ChangeLog3_0_339_MK { + get { + return ResourceManager.GetString("ChangeLog3_0_339_MK", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to 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!. + /// + public static string ChangeLog3_0_339_SB_LB { + get { + return ResourceManager.GetString("ChangeLog3_0_339_SB_LB", resourceCulture); + } + } + /// /// Looks up a localized string similar to Failed to query available bikes.. /// @@ -2636,6 +2656,15 @@ namespace TINK.MultilingualResources { } } + /// + /// Looks up a localized string similar to Enter bike number here. + /// + public static string PlaceholderFindBike { + get { + return ResourceManager.GetString("PlaceholderFindBike", resourceCulture); + } + } + /// /// Looks up a localized string similar to No. /// diff --git a/TINKLib/MultilingualResources/AppResources.de.resx b/TINKLib/MultilingualResources/AppResources.de.resx index c7e75a1..b66b6a3 100644 --- a/TINKLib/MultilingualResources/AppResources.de.resx +++ b/TINKLib/MultilingualResources/AppResources.de.resx @@ -1020,4 +1020,15 @@ Außerdem: Kleine Grafiken lassen auf einen Blick erkennen um was für einen Rad Einwilligung + + Fahrrad-Nummer hier eingeben + + + Die Lastenräder aus den Vororten zeigen nun ihre Heimatstation im Namen an. Diese Räder müssen dort wieder abgeben werden! + +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! + + + 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! + \ No newline at end of file diff --git a/TINKLib/MultilingualResources/AppResources.resx b/TINKLib/MultilingualResources/AppResources.resx index 35d1727..d8a1c21 100644 --- a/TINKLib/MultilingualResources/AppResources.resx +++ b/TINKLib/MultilingualResources/AppResources.resx @@ -1112,4 +1112,15 @@ In addition: Small graphics let you see at a glance what type of bike it is. Consent + + Enter bike number here + + + The cargo bikes from the suburbs now show their home station in their name. These bikes must be returned there! + +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! + + + 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! + \ No newline at end of file diff --git a/TINKLib/MultilingualResources/TINKLib.de.xlf b/TINKLib/MultilingualResources/TINKLib.de.xlf index 1bc164c..0580d8e 100644 --- a/TINKLib/MultilingualResources/TINKLib.de.xlf +++ b/TINKLib/MultilingualResources/TINKLib.de.xlf @@ -1384,6 +1384,22 @@ Außerdem: Kleine Grafiken lassen auf einen Blick erkennen um was für einen Rad Consent Einwilligung + + Enter bike number here + Fahrrad-Nummer hier eingeben + + + The cargo bikes from the suburbs now show their home station in their name. These bikes must be returned there! + +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! + Die Lastenräder aus den Vororten zeigen nun ihre Heimatstation im Namen an. Diese Räder müssen dort wieder abgeben werden! + +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! + + + 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! + 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! + diff --git a/TINKLib/Repository/Exception/NotAtStationException.cs b/TINKLib/Repository/Exception/NotAtStationException.cs index d6b615b..3841ba2 100644 --- a/TINKLib/Repository/Exception/NotAtStationException.cs +++ b/TINKLib/Repository/Exception/NotAtStationException.cs @@ -1,11 +1,13 @@ -using System.Text.RegularExpressions; +using System.Text.RegularExpressions; namespace TINK.Repository.Exception { public class NotAtStationException : InvalidResponseException { - /// COPRI response status regular expression. - public const string RETURNBIKE_FAILURE_STATUS_MESSAGE_UPPERCASE = "(FAILURE 2178: BIKE [0-9]+ OUT OF GEO FENCING\\. )([0-9]+)( METER DISTANCE TO NEXT STATION )([0-9]+)"; + public const string RETURNBIKE_FAILURE_STATUS_MESSAGE_CODE = "FAILURE 2178:"; + + /// COPRI response status regular expression to extract detail information. + public const string RETURNBIKE_FAILURE_STATUS_MESSAGE_UPPERCASE = "(BIKE [A-Za-z0-9_]+ OUT OF GEO FENCING\\. )([0-9]+)( METER DISTANCE TO NEXT STATION )([A-Za-z0-9_]+)"; /// Prevents invalid use of exception. private NotAtStationException() : base(typeof(NotAtStationException).Name) @@ -15,25 +17,36 @@ namespace TINK.Repository.Exception public static bool IsNotAtStation(string responseState, out NotAtStationException exception) { // Check if there are too many bikes requested/ booked. - var match = Regex.Match( - responseState.ToUpper(), - RETURNBIKE_FAILURE_STATUS_MESSAGE_UPPERCASE); - if (match.Groups.Count != 5 - || !int.TryParse(match.Groups[2].ToString(), out int meters) - || !int.TryParse(match.Groups[4].ToString(), out int stationNr)) + var response = responseState.Trim().ToUpper(); + + if (!response.StartsWith(RETURNBIKE_FAILURE_STATUS_MESSAGE_CODE)) { exception = null; return false; } - exception = new NotAtStationException { Distance = meters, StationNr = stationNr }; + var match = Regex.Match( + responseState.ToUpper(), + RETURNBIKE_FAILURE_STATUS_MESSAGE_UPPERCASE); + if (match.Groups.Count != 5 + || !int.TryParse(match.Groups[2].ToString(), out int meters)) + { + exception = new NotAtStationException(); + return true; + } + + exception = new NotAtStationException { + Distance = meters, + StationNr = match.Groups[4].ToString() + }; + return true; } /// Holds the maximum count of bikes allowed to reserve/ book. - public int Distance { get; private set; } + public int? Distance { get; private set; } = null; /// Holds the maximum count of bikes allowed to reserve/ book. - public int StationNr { get; private set; } + public string StationNr { get; private set; } = string.Empty; } } diff --git a/TINKLib/TINKLib.csproj b/TINKLib/TINKLib.csproj index bad016f..0c72f77 100644 --- a/TINKLib/TINKLib.csproj +++ b/TINKLib/TINKLib.csproj @@ -63,6 +63,14 @@ + + + ..\..\..\..\..\..\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v11.0\Mono.Android.dll + + + ..\..\..\..\..\..\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\Xamarin.iOS\v1.0\Xamarin.iOS.dll + + True diff --git a/TINKLib/View/Themes/ShareeBike.xaml b/TINKLib/View/Themes/ShareeBike.xaml index 549c5a4..d0cbd23 100644 --- a/TINKLib/View/Themes/ShareeBike.xaml +++ b/TINKLib/View/Themes/ShareeBike.xaml @@ -1,10 +1,12 @@ - + - #009899 + + #009899 + + + + + + + + - + + + + - - - \ No newline at end of file + + + diff --git a/TINKLib/ViewModel/Bikes/Bike/BluetoothLock/RequestHandler/BookedClosed.cs b/TINKLib/ViewModel/Bikes/Bike/BluetoothLock/RequestHandler/BookedClosed.cs index 0855f9e..46b8804 100644 --- a/TINKLib/ViewModel/Bikes/Bike/BluetoothLock/RequestHandler/BookedClosed.cs +++ b/TINKLib/ViewModel/Bikes/Bike/BluetoothLock/RequestHandler/BookedClosed.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; @@ -174,7 +174,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler if (exception is WebConnectFailureException) { // Copri server is not reachable. - Log.ForContext().Information("User selected booked bike {bike} but returing failed (Copri server not reachable).", SelectedBike); + Log.ForContext().Information("User selected booked bike {bike} but returning failed (Copri server not reachable).", SelectedBike); await ViewService.DisplayAdvancedAlert( AppResources.ErrorReturnBikeNoWebTitle, @@ -185,7 +185,10 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler else if (exception is NotAtStationException notAtStationException) { // COPRI returned an error. - Log.ForContext().Information("User selected booked bike {bike} but returning failed. COPRI returned an not at station error.", SelectedBike); + Log.ForContext().Information( + "User selected booked bike {bike} but returning failed. COPRI returned out of GEO fencing error. Postion send to COPRI {@position}.", + SelectedBike, + currentLocationDto); await ViewService.DisplayAlert( AppResources.ErrorReturnBikeTitle, @@ -195,7 +198,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler else if (exception is NoGPSDataException) { // COPRI returned an error. - Log.ForContext().Information("User selected booked bike {bike} but returing failed. COPRI returned an no GPS- data error.", SelectedBike); + Log.ForContext().Information("User selected booked bike {bike} but returning failed. COPRI returned an no GPS- data error.", SelectedBike); await ViewService.DisplayAlert( AppResources.ErrorReturnBikeTitle, @@ -205,7 +208,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler else if (exception is ResponseException copriException) { // COPRI returned an error. - Log.ForContext().Information("User selected booked bike {bike} but returing failed. COPRI returned an error.", SelectedBike); + Log.ForContext().Information("User selected booked bike {bike} but returning failed. COPRI returned an error.", SelectedBike); await ViewService.DisplayAdvancedAlert( "Statusfehler beim Zurückgeben des Rads!", diff --git a/TINKLib/ViewModel/Bikes/Bike/BluetoothLock/RequestHandler/BookedOpen.cs b/TINKLib/ViewModel/Bikes/Bike/BluetoothLock/RequestHandler/BookedOpen.cs index 8ff3c61..852c2ed 100644 --- a/TINKLib/ViewModel/Bikes/Bike/BluetoothLock/RequestHandler/BookedOpen.cs +++ b/TINKLib/ViewModel/Bikes/Bike/BluetoothLock/RequestHandler/BookedOpen.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; @@ -145,7 +145,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler if (exception is WebConnectFailureException) { // Copri server is not reachable. - Log.ForContext().Information("User selected booked bike {bike} but returing failed (Copri server not reachable).", SelectedBike); + Log.ForContext().Information("User selected booked bike {bike} but returning failed (Copri server not reachable).", SelectedBike); await ViewService.DisplayAdvancedAlert( AppResources.ErrorReturnBikeNoWebTitle, @@ -343,20 +343,23 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler IsConnected = IsConnectedDelegate(); var feedBackUri = SelectedBike?.OperatorUri; + LocationDto currentLocationDto = null; BookingFinishedModel bookingFinished; try { - bookingFinished = await ConnectorFactory(IsConnected).Command.DoReturn( - SelectedBike, - currentLocation != null - ? new LocationDto.Builder + currentLocationDto = currentLocation != null + ? new LocationDto.Builder { Latitude = currentLocation.Latitude, Longitude = currentLocation.Longitude, Accuracy = currentLocation.Accuracy ?? double.NaN, Age = timeStamp.Subtract(currentLocation.Timestamp.DateTime), }.Build() - : null, + : null; + + bookingFinished = await ConnectorFactory(IsConnected).Command.DoReturn( + SelectedBike, + currentLocationDto, SmartDevice); // If canceling bike succedes remove bike because it is not ready to be booked again IsRemoveBikeRequired = true; @@ -367,7 +370,8 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler if (exception is WebConnectFailureException) { // Copri server is not reachable. - Log.ForContext().Information("User selected booked bike {bike} but returing failed (Copri server not reachable).", SelectedBike); + Log.ForContext().Information( + "User selected booked bike {bike} but returning failed (Copri server not reachable).", SelectedBike); await ViewService.DisplayAdvancedAlert( AppResources.ErrorReturnBikeNoWebTitle, @@ -378,7 +382,10 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler else if (exception is NotAtStationException notAtStationException) { // COPRI returned an error. - Log.ForContext().Information("User selected booked bike {bike} but returing failed. COPRI returned an error.", SelectedBike); + Log.ForContext().Information( + "User selected booked bike {bike} but returning failed. COPRI returned out of GEO fencing error. Postion send to COPRI {@position}.", + SelectedBike, + currentLocationDto); await ViewService.DisplayAlert( AppResources.ErrorReturnBikeTitle, @@ -388,7 +395,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler else if (exception is NoGPSDataException) { // COPRI returned an error. - Log.ForContext().Information("User selected booked bike {bike} but returing failed. COPRI returned an no GPS- data error.", SelectedBike); + Log.ForContext().Information("User selected booked bike {bike} but returning failed. COPRI returned an no GPS- data error.", SelectedBike); await ViewService.DisplayAlert( AppResources.ErrorReturnBikeTitle, @@ -398,7 +405,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler else if (exception is ResponseException copriException) { // Copri server is not reachable. - Log.ForContext().Information("User selected booked bike {bike} but returing failed. COPRI returned an error.", SelectedBike); + Log.ForContext().Information("User selected booked bike {bike} but returning failed. COPRI returned an error.", SelectedBike); await ViewService.DisplayAdvancedAlert( "Statusfehler beim Zurückgeben des Rads!", diff --git a/TestFramework/Model/Device/DeviceMock.cs b/TestFramework/Model/Device/DeviceMock.cs index e71c288..0d76fcd 100644 --- a/TestFramework/Model/Device/DeviceMock.cs +++ b/TestFramework/Model/Device/DeviceMock.cs @@ -1,4 +1,4 @@ -using TINK.Model.Device; +using TINK.Model.Device; using Xamarin.Essentials; namespace TestFramework.Model.Device @@ -10,13 +10,13 @@ namespace TestFramework.Model.Device /// private string m_strDeviceId = "522c6ff6886198fd"; - public string Manufacturer => throw new System.NotImplementedException(); + public string Manufacturer => "Faiphone"; - public string Model => throw new System.NotImplementedException(); + public string Model => "987"; public DevicePlatform Platform => DevicePlatform.UWP; - public string VersionText => throw new System.NotImplementedException(); + public string VersionText => "17.11"; /// /// Constructs a device mock object setting device id to default value. diff --git a/TestTINKLib/Fixtures/ObjectTests/Repository/Exception/TestBookingDeclinedException.cs b/TestShareeLib/Repository/Exception/TestBookingDeclinedException.cs similarity index 100% rename from TestTINKLib/Fixtures/ObjectTests/Repository/Exception/TestBookingDeclinedException.cs rename to TestShareeLib/Repository/Exception/TestBookingDeclinedException.cs diff --git a/TestTINKLib/Fixtures/ObjectTests/Repository/Exception/TestNoGPSDataException.cs b/TestShareeLib/Repository/Exception/TestNoGPSDataException.cs similarity index 100% rename from TestTINKLib/Fixtures/ObjectTests/Repository/Exception/TestNoGPSDataException.cs rename to TestShareeLib/Repository/Exception/TestNoGPSDataException.cs diff --git a/TestShareeLib/Repository/Exception/TestNotAtStationException.cs b/TestShareeLib/Repository/Exception/TestNotAtStationException.cs new file mode 100644 index 0000000..41fcc1c --- /dev/null +++ b/TestShareeLib/Repository/Exception/TestNotAtStationException.cs @@ -0,0 +1,71 @@ +using NUnit.Framework; +using TINK.Repository.Exception; + +namespace TestTINKLib.Fixtures.ObjectTests.Repository.Exception +{ + [TestFixture] + public class TestNotAtStationException + { + [Test] + public void TestIsNotAtStationNumericBikeAndStationId() + { + const string responseText = "Failure 2178: bike 1545 out of GEO fencing. 15986 meter distance to next station 105. OK: bike 1545 locked confirmed"; + + NotAtStationException exception = null; + + Assert.That(() => NotAtStationException.IsNotAtStation(responseText, out exception), + Is.EqualTo(true)); + + Assert.That(() => exception.StationNr, + Is.EqualTo("105")); + + Assert.That(() => exception.Distance, + Is.EqualTo(15986)); + } + + [Test] + public void TestIsNotAtStationAlphanumBikeAndStationId() + { + const string responseText = "Failure 2178: bike KN247 out of GEO fencing. 764 meter distance to next station KN20 . OK: bike KN247 locked confirmed"; + + NotAtStationException exception = null; + + Assert.That(() => NotAtStationException.IsNotAtStation(responseText, out exception), + Is.EqualTo(true)); + + Assert.That(() => exception.StationNr, + Is.EqualTo("KN20")); + + Assert.That(() => exception.Distance, + Is.EqualTo(764)); + } + + [Test] + public void TestIsNotAtStationUnexpected() + { + const string responseText = "Failure 2178: Message from COPRI does not match expectations."; + + NotAtStationException exception = null; + + Assert.That(() => NotAtStationException.IsNotAtStation(responseText, out exception), + Is.EqualTo(true)); + + Assert.That(() => exception.StationNr, + Is.EqualTo(string.Empty)); + + Assert.That(() => exception.Distance, + Is.Null); + } + + [Test] + public void TestIsNotAtStation_InvalidFailureNr() + { + const string responseText = "Failure 2177: bike 1545 out of GEO fencing. 15986 meter distance to next station 105. OK: bike 1545 locked confirmed"; + + NotAtStationException exception = null; + + Assert.That(() => NotAtStationException.IsNotAtStation(responseText, out exception), + Is.EqualTo(false)); + } + } +} diff --git a/TestTINKLib/Fixtures/ObjectTests/Repository/Exception/TestNotAtStationException.cs b/TestTINKLib/Fixtures/ObjectTests/Repository/Exception/TestNotAtStationException.cs deleted file mode 100644 index c4dd011..0000000 --- a/TestTINKLib/Fixtures/ObjectTests/Repository/Exception/TestNotAtStationException.cs +++ /dev/null @@ -1,37 +0,0 @@ -using NUnit.Framework; -using TINK.Repository.Exception; - -namespace TestTINKLib.Fixtures.ObjectTests.Repository.Exception -{ - [TestFixture] - public class TestNotAtStationException - { - [Test] - public void TestIsNotAtStation() - { - const string responseText = "Failure 2178: bike 1545 out of GEO fencing. 15986 meter distance to next station 105. OK: bike 1545 locked confirmed"; - - NotAtStationException exception = null; - - Assert.That(() => NotAtStationException.IsNotAtStation(responseText, out exception), - Is.EqualTo(true)); - - Assert.That(() => exception.StationNr, - Is.EqualTo(105)); - - Assert.That(() => exception.Distance, - Is.EqualTo(15986)); - } - - [Test] - public void TestIsNotAtStation_InvalidNr() - { - const string responseText = "Failure 2177: bike 1545 out of GEO fencing. 15986 meter distance to next station 105. OK: bike 1545 locked confirmed"; - - NotAtStationException exception = null; - - Assert.That(() => NotAtStationException.IsNotAtStation(responseText, out exception), - Is.EqualTo(false)); - } - } -} diff --git a/TestTINKLib/TestTINKLib.csproj b/TestTINKLib/TestTINKLib.csproj index 48de2e7..0ed3bd2 100644 --- a/TestTINKLib/TestTINKLib.csproj +++ b/TestTINKLib/TestTINKLib.csproj @@ -38,9 +38,6 @@ - - -