diff --git a/LastenradBayern/TINK.Android/Properties/AndroidManifest.xml b/LastenradBayern/TINK.Android/Properties/AndroidManifest.xml index 66c4ca1..88072bb 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 e286159..0f4fc6d 100644 --- a/LastenradBayern/TINK.iOS/Info.plist +++ b/LastenradBayern/TINK.iOS/Info.plist @@ -55,8 +55,8 @@ CFBundleDisplayName LastenradBayern CFBundleVersion - 341 + 342 CFBundleShortVersionString - 3.0.341 + 3.0.342 diff --git a/LastenradBayern/TINK/View/Bike/ILockItBike.xaml b/LastenradBayern/TINK/View/Bike/ILockItBike.xaml index 3a66490..c7146d4 100644 --- a/LastenradBayern/TINK/View/Bike/ILockItBike.xaml +++ b/LastenradBayern/TINK/View/Bike/ILockItBike.xaml @@ -1,4 +1,4 @@ - + - - - + IsVisible="{Binding IsBatteryChargeVisible}"/> + \ No newline at end of file + diff --git a/LastenradBayern/TINK/View/CopriWebView/ManageAccountPage.xaml b/LastenradBayern/TINK/View/CopriWebView/ManageAccountPage.xaml index 13183d1..9fe1f86 100644 --- a/LastenradBayern/TINK/View/CopriWebView/ManageAccountPage.xaml +++ b/LastenradBayern/TINK/View/CopriWebView/ManageAccountPage.xaml @@ -25,7 +25,6 @@ Source="{Binding Uri}" /> - { - if (!ev.Url.ToUpper().EndsWith(".PDF")) - { - // Stay inside web view except for downloading pdf- files. - this.IsEnabled = false; - ActivityIndicatorLoading.IsVisible = true; - ActivityIndicatorLoading.IsRunning = true; - return; - } + ManageAccount.Navigating += WebViewHelper.SetBusyAndDisplayOrDownload; - DependencyService.Get().OpenUrl(ev.Url); - }; - - ManageAccount.Navigated += (sender, ev) => - { - if (ev.Result == WebNavigationResult.Success) - { - this.IsEnabled = true; - ActivityIndicatorLoading.IsVisible = false; - ActivityIndicatorLoading.IsRunning = false; - return; - } - - Log.ForContext().Error("Navigation did not succeed.{@Event}{@Sender}", ev, sender); - ManageAccount.Source = new HtmlWebViewSource - { - Html = "Kann persönliche Daten nicht anzeigen/ verwalten!
Verbindung mit Internet ok?" - }; - - this.IsEnabled = true; - ActivityIndicatorLoading.IsVisible = false; - ActivityIndicatorLoading.IsRunning = false; - }; + ManageAccount.Navigated += (sender, eventArgs) => WebViewHelper.SetIdleAndHandleError( + sender, + eventArgs, + "Kann persönliche Daten nicht anzeigen/ verwalten!
Verbindung mit Internet ok?"); ManageAccount.BindingContext = new ManageAccountViewModel( App.ModelRoot.ActiveUser.SessionCookie, @@ -56,4 +28,4 @@ namespace TINK.View.CopriWebView App.ModelRoot.NextActiveUri.Host); } } -} \ No newline at end of file +} diff --git a/LastenradBayern/TINK/View/FeesAndBikes/FeesAndBikesPage.xaml b/LastenradBayern/TINK/View/FeesAndBikes/FeesAndBikesPage.xaml index ad7f168..c954720 100644 --- a/LastenradBayern/TINK/View/FeesAndBikes/FeesAndBikesPage.xaml +++ b/LastenradBayern/TINK/View/FeesAndBikes/FeesAndBikesPage.xaml @@ -10,26 +10,51 @@ - + - - - + + + + + + + + - + - - - + + + + + + + - \ No newline at end of file + diff --git a/LastenradBayern/TINK/View/FeesAndBikes/FeesAndBikesPage.xaml.cs b/LastenradBayern/TINK/View/FeesAndBikes/FeesAndBikesPage.xaml.cs index b2e564f..b09973f 100644 --- a/LastenradBayern/TINK/View/FeesAndBikes/FeesAndBikesPage.xaml.cs +++ b/LastenradBayern/TINK/View/FeesAndBikes/FeesAndBikesPage.xaml.cs @@ -1,4 +1,5 @@ -using TINK.ViewModel; +using Serilog; +using TINK.ViewModel; using TINK.ViewModel.Contact; using Xamarin.Forms; using Xamarin.Forms.Xaml; @@ -14,19 +15,31 @@ namespace TINK.View.Contact { InitializeComponent(); + /// Info about renting. + InfoRentBikeWebView.Navigating += WebViewHelper.SelectDisplayTarget; + + InfoRentBikeWebView.Navigated += (sender, ev) => WebViewHelper.HandleError( + sender, + ev, + "Kann Mietinformationen nicht anzeigen!
Verbindung mit Internet ok?"); + + /// Info about types of bikes. + InfoTypesOfBikesWebView.Navigating += WebViewHelper.SelectDisplayTarget; + + InfoTypesOfBikesWebView.Navigated += (sender, ev) => WebViewHelper.HandleError( + sender, + ev, + "Kann Radinformationen nicht anzeigen!
Verbindung mit Internet ok?"); + ViewModel = new FeesAndBikesPageViewModel( App.ModelRoot.NextActiveUri.Host, App.ModelRoot.ResourceUrls.FeesResourcePath, App.ModelRoot.ResourceUrls.BikesResourcePath, - App.ModelRoot.IsSiteCachingOn); + App.ModelRoot.IsSiteCachingOn, + () => App.ModelRoot.GetConnector(App.ModelRoot.GetIsConnected()).Query, + resourceUrls => App.ModelRoot.ResourceUrls = resourceUrls); BindingContext = ViewModel; - - /// Info about renting. - InfoRentBikeWebView.Navigating += ViewModelHelper.OnNavigating; - - /// Info about types of bikes. - InfoTypesOfBikesWebView.Navigating += ViewModelHelper.OnNavigating; } /// Called when page is shown. @@ -35,4 +48,4 @@ namespace TINK.View.Contact ViewModel.OnAppearing(); } } -} \ No newline at end of file +} diff --git a/LastenradBayern/TINK/View/Info/InfoTabbedPage.xaml b/LastenradBayern/TINK/View/Info/InfoTabbedPage.xaml index ec5efb3..d97773c 100644 --- a/LastenradBayern/TINK/View/Info/InfoTabbedPage.xaml +++ b/LastenradBayern/TINK/View/Info/InfoTabbedPage.xaml @@ -1,4 +1,4 @@ - + - + - - + + + + - + + - + - - + + + + - + + - + - - + + + + - + + - + - - + + + + - + + - \ No newline at end of file diff --git a/LastenradBayern/TINK/View/Info/InfoTabbedPage.xaml.cs b/LastenradBayern/TINK/View/Info/InfoTabbedPage.xaml.cs index 17f0bba..815ad7f 100644 --- a/LastenradBayern/TINK/View/Info/InfoTabbedPage.xaml.cs +++ b/LastenradBayern/TINK/View/Info/InfoTabbedPage.xaml.cs @@ -1,4 +1,4 @@ -using System.Globalization; +using System.Globalization; using TINK.ViewModel; using TINK.ViewModel.Info; using Xamarin.Forms; @@ -21,15 +21,34 @@ namespace TINK.View.Info App.ModelRoot.ResourceUrls.PrivacyResourcePath, App.ModelRoot.ResourceUrls.ImpressResourcePath, App.ModelRoot.IsSiteCachingOn, - CultureInfo.CurrentUICulture.TwoLetterISOLanguageName, - resourceName => ViewModelResourceHelper.GetSource(resourceName)); + resourceName => ViewModelResourceHelper.GetSource(resourceName), + () => App.ModelRoot.GetConnector(App.ModelRoot.GetIsConnected()).Query, + resourceUrls => App.ModelRoot.ResourceUrls = resourceUrls); TabbedInfoPage.BindingContext = ViewModel; - InfoLicenses.Navigating += ViewModelHelper.OnNavigating; - InfoDatenschutz.Navigating += ViewModelHelper.OnNavigating; - InfoABG.Navigating += ViewModelHelper.OnNavigating; + InfoLicenses.Navigating += WebViewHelper.SelectDisplayTarget; + InfoLicenses.Navigated += (sender, ev) => WebViewHelper.HandleError( + sender, + ev, + "Kann Lizenzinformationen nicht anzeigen!
Verbindung mit Internet ok?"); - InfoImpressum.Navigating += ViewModelHelper.OnNavigating; + InfoDatenschutz.Navigating += WebViewHelper.SelectDisplayTarget; + InfoDatenschutz.Navigated += (sender, ev) => WebViewHelper.HandleError( + sender, + ev, + "Kann Datenschutzinformationen nicht anzeigen!
Verbindung mit Internet ok?"); + + InfoABG.Navigating += WebViewHelper.SelectDisplayTarget; + InfoABG.Navigated += (sender, ev) => WebViewHelper.HandleError( + sender, + ev, + "Kann allgemeine Geschäftsbedingungen nicht anzeigen!
Verbindung mit Internet ok?"); + + InfoImpressum.Navigating += WebViewHelper.SelectDisplayTarget; + InfoImpressum.Navigated += (sender, ev) => WebViewHelper.HandleError( + sender, + ev, + "Kann Impressum nicht anzeigen!
Verbindung mit Internet ok?"); } /// Called when page is shown. @@ -38,4 +57,4 @@ namespace TINK.View.Info ViewModel.OnAppearing(); } } -} \ No newline at end of file +} diff --git a/LastenradBayern/TINK/View/WhatsNew/Agb/AgbPage.xaml.cs b/LastenradBayern/TINK/View/WhatsNew/Agb/AgbPage.xaml.cs index cb114dd..3c68bdb 100644 --- a/LastenradBayern/TINK/View/WhatsNew/Agb/AgbPage.xaml.cs +++ b/LastenradBayern/TINK/View/WhatsNew/Agb/AgbPage.xaml.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Globalization; using System.Threading.Tasks; using TINK.Model.Bikes.BikeInfoNS.DriveNS.BatteryNS; @@ -19,7 +19,6 @@ namespace TINK.View.WhatsNew.Agb agbViewModel = new AgbViewModel( App.ModelRoot.NextActiveUri.Host, App.ModelRoot.IsSiteCachingOn, - CultureInfo.CurrentUICulture.TwoLetterISOLanguageName, (resourceName) => ViewModelResourceHelper.GetSource(resourceName), this); @@ -81,4 +80,4 @@ namespace TINK.View.WhatsNew.Agb public async Task DisplayUserFeedbackPopup(IBattery battery = null, string co2Saving = null) => throw new NotSupportedException(); #endif } -} \ No newline at end of file +} diff --git a/Meinkonrad/TINK.Android/Properties/AndroidManifest.xml b/Meinkonrad/TINK.Android/Properties/AndroidManifest.xml index ab6569b..9d6d14f 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 ec43ffd..d19673e 100644 --- a/Meinkonrad/TINK.iOS/Info.plist +++ b/Meinkonrad/TINK.iOS/Info.plist @@ -55,8 +55,8 @@ CFBundleDisplayName Mein konrad CFBundleVersion - 341 + 342 CFBundleShortVersionString - 3.0.341 + 3.0.342 diff --git a/Meinkonrad/TINK/View/Bike/ILockItBike.xaml b/Meinkonrad/TINK/View/Bike/ILockItBike.xaml index 6e016c8..3e53d2d 100644 --- a/Meinkonrad/TINK/View/Bike/ILockItBike.xaml +++ b/Meinkonrad/TINK/View/Bike/ILockItBike.xaml @@ -97,8 +97,6 @@ - - @@ -224,17 +222,6 @@ IsVisible="{Binding TariffDescription.InfoEntry5, Converter={StaticResource Label_Converter}}" Grid.Row="14" Grid.ColumnSpan="2"/> - - diff --git a/Meinkonrad/TINK/View/CopriWebView/ManageAccountPage.xaml b/Meinkonrad/TINK/View/CopriWebView/ManageAccountPage.xaml index 631b5c6..fc43e15 100644 --- a/Meinkonrad/TINK/View/CopriWebView/ManageAccountPage.xaml +++ b/Meinkonrad/TINK/View/CopriWebView/ManageAccountPage.xaml @@ -25,7 +25,6 @@ Source="{Binding Uri}" /> - { - if (!ev.Url.ToUpper().EndsWith(".PDF")) - { - // Stay inside web view except for downloading pdf- files. - this.IsEnabled = false; - ActivityIndicatorLoading.IsVisible = true; - ActivityIndicatorLoading.IsRunning = true; - return; - } + ManageAccount.Navigating += WebViewHelper.SetBusyAndDisplayOrDownload; - DependencyService.Get().OpenUrl(ev.Url); - }; - - ManageAccount.Navigated += (sender, ev) => - { - if (ev.Result == WebNavigationResult.Success) - { - this.IsEnabled = true; - ActivityIndicatorLoading.IsVisible = false; - ActivityIndicatorLoading.IsRunning = false; - return; - } - - Log.ForContext().Error("Navigation did not succeed.{@Event}{@Sender}", ev, sender); - ManageAccount.Source = new HtmlWebViewSource - { - Html = "Kann persönliche Daten nicht anzeigen/ verwalten!
Verbindung mit Internet ok?" - }; - - this.IsEnabled = true; - ActivityIndicatorLoading.IsVisible = false; - ActivityIndicatorLoading.IsRunning = false; - }; + ManageAccount.Navigated += (sender, eventArgs) => WebViewHelper.SetIdleAndHandleError( + sender, + eventArgs, + "Kann persönliche Daten nicht anzeigen/ verwalten!
Verbindung mit Internet ok?"); ManageAccount.BindingContext = new ManageAccountViewModel( App.ModelRoot.ActiveUser.SessionCookie, @@ -56,4 +28,4 @@ namespace TINK.View.CopriWebView App.ModelRoot.NextActiveUri.Host); } } -} \ No newline at end of file +} diff --git a/Meinkonrad/TINK/View/FeesAndBikes/FeesAndBikesPage.xaml b/Meinkonrad/TINK/View/FeesAndBikes/FeesAndBikesPage.xaml index 7dac3ef..b85c7d4 100644 --- a/Meinkonrad/TINK/View/FeesAndBikes/FeesAndBikesPage.xaml +++ b/Meinkonrad/TINK/View/FeesAndBikes/FeesAndBikesPage.xaml @@ -11,26 +11,44 @@ - + - + - + x:Name="InfoRentBikeWebView" + HeightRequest="1000" + WidthRequest="1000" + Source="{Binding RentBikeText}"/> + + - + - + - + x:Name="InfoTypesOfBikesWebView" + HeightRequest="1000" + WidthRequest="1000" + Source="{Binding TypesOfBikesText}"/> + + - \ No newline at end of file + diff --git a/Meinkonrad/TINK/View/FeesAndBikes/FeesAndBikesPage.xaml.cs b/Meinkonrad/TINK/View/FeesAndBikes/FeesAndBikesPage.xaml.cs index b2e564f..b09973f 100644 --- a/Meinkonrad/TINK/View/FeesAndBikes/FeesAndBikesPage.xaml.cs +++ b/Meinkonrad/TINK/View/FeesAndBikes/FeesAndBikesPage.xaml.cs @@ -1,4 +1,5 @@ -using TINK.ViewModel; +using Serilog; +using TINK.ViewModel; using TINK.ViewModel.Contact; using Xamarin.Forms; using Xamarin.Forms.Xaml; @@ -14,19 +15,31 @@ namespace TINK.View.Contact { InitializeComponent(); + /// Info about renting. + InfoRentBikeWebView.Navigating += WebViewHelper.SelectDisplayTarget; + + InfoRentBikeWebView.Navigated += (sender, ev) => WebViewHelper.HandleError( + sender, + ev, + "Kann Mietinformationen nicht anzeigen!
Verbindung mit Internet ok?"); + + /// Info about types of bikes. + InfoTypesOfBikesWebView.Navigating += WebViewHelper.SelectDisplayTarget; + + InfoTypesOfBikesWebView.Navigated += (sender, ev) => WebViewHelper.HandleError( + sender, + ev, + "Kann Radinformationen nicht anzeigen!
Verbindung mit Internet ok?"); + ViewModel = new FeesAndBikesPageViewModel( App.ModelRoot.NextActiveUri.Host, App.ModelRoot.ResourceUrls.FeesResourcePath, App.ModelRoot.ResourceUrls.BikesResourcePath, - App.ModelRoot.IsSiteCachingOn); + App.ModelRoot.IsSiteCachingOn, + () => App.ModelRoot.GetConnector(App.ModelRoot.GetIsConnected()).Query, + resourceUrls => App.ModelRoot.ResourceUrls = resourceUrls); BindingContext = ViewModel; - - /// Info about renting. - InfoRentBikeWebView.Navigating += ViewModelHelper.OnNavigating; - - /// Info about types of bikes. - InfoTypesOfBikesWebView.Navigating += ViewModelHelper.OnNavigating; } /// Called when page is shown. @@ -35,4 +48,4 @@ namespace TINK.View.Contact ViewModel.OnAppearing(); } } -} \ No newline at end of file +} diff --git a/Meinkonrad/TINK/View/Info/InfoTabbedPage.xaml b/Meinkonrad/TINK/View/Info/InfoTabbedPage.xaml index 948d814..708e49c 100644 --- a/Meinkonrad/TINK/View/Info/InfoTabbedPage.xaml +++ b/Meinkonrad/TINK/View/Info/InfoTabbedPage.xaml @@ -1,4 +1,4 @@ - + - + - - + + + + - + + - + - - + + + + - + + - + - - + + + + - + + - + - - + + + + - + + - \ No newline at end of file diff --git a/Meinkonrad/TINK/View/Info/InfoTabbedPage.xaml.cs b/Meinkonrad/TINK/View/Info/InfoTabbedPage.xaml.cs index 17f0bba..d77e7fe 100644 --- a/Meinkonrad/TINK/View/Info/InfoTabbedPage.xaml.cs +++ b/Meinkonrad/TINK/View/Info/InfoTabbedPage.xaml.cs @@ -1,4 +1,5 @@ -using System.Globalization; +using System.Globalization; +using AndroidX.Navigation; using TINK.ViewModel; using TINK.ViewModel.Info; using Xamarin.Forms; @@ -21,15 +22,34 @@ namespace TINK.View.Info App.ModelRoot.ResourceUrls.PrivacyResourcePath, App.ModelRoot.ResourceUrls.ImpressResourcePath, App.ModelRoot.IsSiteCachingOn, - CultureInfo.CurrentUICulture.TwoLetterISOLanguageName, - resourceName => ViewModelResourceHelper.GetSource(resourceName)); + resourceName => ViewModelResourceHelper.GetEmbeddedResource(resourceName), + () => App.ModelRoot.GetConnector(App.ModelRoot.GetIsConnected()).Query, + resourceUrls => App.ModelRoot.ResourceUrls = resourceUrls); TabbedInfoPage.BindingContext = ViewModel; - InfoLicenses.Navigating += ViewModelHelper.OnNavigating; - InfoDatenschutz.Navigating += ViewModelHelper.OnNavigating; - InfoABG.Navigating += ViewModelHelper.OnNavigating; + InfoLicenses.Navigating += WebViewHelper.SelectDisplayTarget; + InfoLicenses.Navigated += (sender, ev) => WebViewHelper.HandleError( + sender, + ev, + "Kann Lizenzinformationen nicht anzeigen!
Verbindung mit Internet ok?"); - InfoImpressum.Navigating += ViewModelHelper.OnNavigating; + InfoDatenschutz.Navigating += WebViewHelper.SelectDisplayTarget; + InfoDatenschutz.Navigated += (sender, ev) => WebViewHelper.HandleError( + sender, + ev, + "Kann Datenschutzinformationen nicht anzeigen!
Verbindung mit Internet ok?"); + + InfoABG.Navigating += WebViewHelper.SelectDisplayTarget; + InfoABG.Navigated += (sender, ev) => WebViewHelper.HandleError( + sender, + ev, + "Kann allgemeine Geschäftsbedingungen nicht anzeigen!
Verbindung mit Internet ok?"); + + InfoImpressum.Navigating += WebViewHelper.SelectDisplayTarget; + InfoImpressum.Navigated += (sender, ev) => WebViewHelper.HandleError( + sender, + ev, + "Kann Impressum nicht anzeigen!
Verbindung mit Internet ok?"); } /// Called when page is shown. @@ -38,4 +58,4 @@ namespace TINK.View.Info ViewModel.OnAppearing(); } } -} \ No newline at end of file +} diff --git a/Meinkonrad/TINK/View/WhatsNew/Agb/AgbPage.xaml.cs b/Meinkonrad/TINK/View/WhatsNew/Agb/AgbPage.xaml.cs index cb114dd..17a0d1a 100644 --- a/Meinkonrad/TINK/View/WhatsNew/Agb/AgbPage.xaml.cs +++ b/Meinkonrad/TINK/View/WhatsNew/Agb/AgbPage.xaml.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Globalization; using System.Threading.Tasks; using TINK.Model.Bikes.BikeInfoNS.DriveNS.BatteryNS; @@ -19,8 +19,7 @@ namespace TINK.View.WhatsNew.Agb agbViewModel = new AgbViewModel( App.ModelRoot.NextActiveUri.Host, App.ModelRoot.IsSiteCachingOn, - CultureInfo.CurrentUICulture.TwoLetterISOLanguageName, - (resourceName) => ViewModelResourceHelper.GetSource(resourceName), + (resourceName) => ViewModelResourceHelper.GetEmbeddedResource(resourceName), this); BindingContext = agbViewModel; @@ -81,4 +80,4 @@ namespace TINK.View.WhatsNew.Agb public async Task DisplayUserFeedbackPopup(IBattery battery = null, string co2Saving = null) => throw new NotSupportedException(); #endif } -} \ No newline at end of file +} diff --git a/Meinkonrad/TINK/ViewModel/ViewModelResourceHelper.cs b/Meinkonrad/TINK/ViewModel/ViewModelResourceHelper.cs index 979fc70..fa787ed 100644 --- a/Meinkonrad/TINK/ViewModel/ViewModelResourceHelper.cs +++ b/Meinkonrad/TINK/ViewModel/ViewModelResourceHelper.cs @@ -1,4 +1,4 @@ -using System.IO; +using System.IO; using System.Reflection; using System.Text; using Serilog; @@ -27,16 +27,16 @@ namespace TINK.ViewModel /// Gets an an embedded html ressource. /// Name of resource to get. /// - public static string GetSource(string resrouceName) + public static string GetEmbeddedResource(string resrouceName) { - var l_oRessourceName = RessourcePrefix + resrouceName; + var ressourceName = RessourcePrefix + resrouceName; Log.Verbose($"Using this resource prefix {RessourcePrefix}."); // note that the prefix includes the trailing period '.' that is required var assembly = typeof(ViewModelResourceHelper).GetTypeInfo().Assembly; - var stream = assembly.GetManifestResourceStream(l_oRessourceName); + var stream = assembly.GetManifestResourceStream(ressourceName); return stream != null ? (new StreamReader(stream, Encoding.UTF8)).ReadToEnd() - : string.Format("An error occurred loading html- ressource {0}.", l_oRessourceName); + : string.Format("An error occurred loading html- ressource {0}.", ressourceName); } } } diff --git a/TINK/TINK.Android/Properties/AndroidManifest.xml b/TINK/TINK.Android/Properties/AndroidManifest.xml index a76e3b5..dd5ed50 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 9f6656b..bc74ea0 100644 --- a/TINK/TINK.iOS/Info.plist +++ b/TINK/TINK.iOS/Info.plist @@ -55,8 +55,8 @@ CFBundleDisplayName sharee.bike CFBundleVersion - 341 + 342 CFBundleShortVersionString - 3.0.341 + 3.0.342 diff --git a/TINK/TINK/App.xaml b/TINK/TINK/App.xaml index 986c3c4..4013899 100644 --- a/TINK/TINK/App.xaml +++ b/TINK/TINK/App.xaml @@ -1,13 +1,15 @@ - + - + + @@ -29,4 +31,4 @@ - \ No newline at end of file + diff --git a/TINK/TINK/View/Bike/ILockItBike.xaml b/TINK/TINK/View/Bike/ILockItBike.xaml index 06d80ba..698d065 100644 --- a/TINK/TINK/View/Bike/ILockItBike.xaml +++ b/TINK/TINK/View/Bike/ILockItBike.xaml @@ -1,4 +1,4 @@ - + - - @@ -218,18 +216,7 @@ IsVisible="{Binding TariffDescription.InfoEntry5, Converter={StaticResource Label_Converter}}" Grid.Row="14" Grid.ColumnSpan="2"/> - - - \ No newline at end of file + diff --git a/TINK/TINK/View/CopriWebView/ManageAccountPage.xaml b/TINK/TINK/View/CopriWebView/ManageAccountPage.xaml index 6436686..ed3f958 100644 --- a/TINK/TINK/View/CopriWebView/ManageAccountPage.xaml +++ b/TINK/TINK/View/CopriWebView/ManageAccountPage.xaml @@ -31,7 +31,6 @@ Source="{Binding Uri}" /> - { - if (!ev.Url.ToUpper().EndsWith(".PDF")) - { - // Stay inside web view except for downloading pdf- files. - this.IsEnabled = false; - ActivityIndicatorLoading.IsVisible = true; - ActivityIndicatorLoading.IsRunning = true; - return; - } + ManageAccount.Navigating += WebViewHelper.SetBusyAndDisplayOrDownload; - DependencyService.Get().OpenUrl(ev.Url); - }; - - ManageAccount.Navigated += (sender, ev) => - { - if (ev.Result == WebNavigationResult.Success) - { - this.IsEnabled = true; - ActivityIndicatorLoading.IsVisible = false; - ActivityIndicatorLoading.IsRunning = false; - return; - } - - Log.ForContext().Error("Navigation did not succeed.{@Event}{@Sender}", ev, sender); - ManageAccount.Source = new HtmlWebViewSource - { - Html = "Kann persönliche Daten nicht anzeigen/ verwalten!
Verbindung mit Internet ok?" - }; - - this.IsEnabled = true; - ActivityIndicatorLoading.IsVisible = false; - ActivityIndicatorLoading.IsRunning = false; - }; + ManageAccount.Navigated += (sender, eventArgs) => WebViewHelper.SetIdleAndHandleError( + sender, + eventArgs, + "Kann persönliche Daten nicht anzeigen/ verwalten!
Verbindung mit Internet ok?"); ManageAccount.BindingContext = new ManageAccountViewModel( App.ModelRoot.ActiveUser.SessionCookie, @@ -56,4 +28,4 @@ namespace TINK.View.CopriWebView App.ModelRoot.NextActiveUri.Host); } } -} \ No newline at end of file +} diff --git a/TINK/TINK/View/FeesAndBikes/FeesAndBikesPage.xaml b/TINK/TINK/View/FeesAndBikes/FeesAndBikesPage.xaml index ad7f168..b165a8b 100644 --- a/TINK/TINK/View/FeesAndBikes/FeesAndBikesPage.xaml +++ b/TINK/TINK/View/FeesAndBikes/FeesAndBikesPage.xaml @@ -10,26 +10,50 @@ - + - - - + + + + + + + - + - - - + + + + + + + - \ No newline at end of file + diff --git a/TINK/TINK/View/FeesAndBikes/FeesAndBikesPage.xaml.cs b/TINK/TINK/View/FeesAndBikes/FeesAndBikesPage.xaml.cs index b2e564f..b09973f 100644 --- a/TINK/TINK/View/FeesAndBikes/FeesAndBikesPage.xaml.cs +++ b/TINK/TINK/View/FeesAndBikes/FeesAndBikesPage.xaml.cs @@ -1,4 +1,5 @@ -using TINK.ViewModel; +using Serilog; +using TINK.ViewModel; using TINK.ViewModel.Contact; using Xamarin.Forms; using Xamarin.Forms.Xaml; @@ -14,19 +15,31 @@ namespace TINK.View.Contact { InitializeComponent(); + /// Info about renting. + InfoRentBikeWebView.Navigating += WebViewHelper.SelectDisplayTarget; + + InfoRentBikeWebView.Navigated += (sender, ev) => WebViewHelper.HandleError( + sender, + ev, + "Kann Mietinformationen nicht anzeigen!
Verbindung mit Internet ok?"); + + /// Info about types of bikes. + InfoTypesOfBikesWebView.Navigating += WebViewHelper.SelectDisplayTarget; + + InfoTypesOfBikesWebView.Navigated += (sender, ev) => WebViewHelper.HandleError( + sender, + ev, + "Kann Radinformationen nicht anzeigen!
Verbindung mit Internet ok?"); + ViewModel = new FeesAndBikesPageViewModel( App.ModelRoot.NextActiveUri.Host, App.ModelRoot.ResourceUrls.FeesResourcePath, App.ModelRoot.ResourceUrls.BikesResourcePath, - App.ModelRoot.IsSiteCachingOn); + App.ModelRoot.IsSiteCachingOn, + () => App.ModelRoot.GetConnector(App.ModelRoot.GetIsConnected()).Query, + resourceUrls => App.ModelRoot.ResourceUrls = resourceUrls); BindingContext = ViewModel; - - /// Info about renting. - InfoRentBikeWebView.Navigating += ViewModelHelper.OnNavigating; - - /// Info about types of bikes. - InfoTypesOfBikesWebView.Navigating += ViewModelHelper.OnNavigating; } /// Called when page is shown. @@ -35,4 +48,4 @@ namespace TINK.View.Contact ViewModel.OnAppearing(); } } -} \ No newline at end of file +} diff --git a/TINK/TINK/View/Info/InfoTabbedPage.xaml b/TINK/TINK/View/Info/InfoTabbedPage.xaml index be08b73..1a996e2 100644 --- a/TINK/TINK/View/Info/InfoTabbedPage.xaml +++ b/TINK/TINK/View/Info/InfoTabbedPage.xaml @@ -1,4 +1,4 @@ - + - + - - + + + + - + + - + - - + + + + - + + - + - - + + + + - + + - + - - + + + + - + + - \ No newline at end of file diff --git a/TINK/TINK/View/Info/InfoTabbedPage.xaml.cs b/TINK/TINK/View/Info/InfoTabbedPage.xaml.cs index 17f0bba..815ad7f 100644 --- a/TINK/TINK/View/Info/InfoTabbedPage.xaml.cs +++ b/TINK/TINK/View/Info/InfoTabbedPage.xaml.cs @@ -1,4 +1,4 @@ -using System.Globalization; +using System.Globalization; using TINK.ViewModel; using TINK.ViewModel.Info; using Xamarin.Forms; @@ -21,15 +21,34 @@ namespace TINK.View.Info App.ModelRoot.ResourceUrls.PrivacyResourcePath, App.ModelRoot.ResourceUrls.ImpressResourcePath, App.ModelRoot.IsSiteCachingOn, - CultureInfo.CurrentUICulture.TwoLetterISOLanguageName, - resourceName => ViewModelResourceHelper.GetSource(resourceName)); + resourceName => ViewModelResourceHelper.GetSource(resourceName), + () => App.ModelRoot.GetConnector(App.ModelRoot.GetIsConnected()).Query, + resourceUrls => App.ModelRoot.ResourceUrls = resourceUrls); TabbedInfoPage.BindingContext = ViewModel; - InfoLicenses.Navigating += ViewModelHelper.OnNavigating; - InfoDatenschutz.Navigating += ViewModelHelper.OnNavigating; - InfoABG.Navigating += ViewModelHelper.OnNavigating; + InfoLicenses.Navigating += WebViewHelper.SelectDisplayTarget; + InfoLicenses.Navigated += (sender, ev) => WebViewHelper.HandleError( + sender, + ev, + "Kann Lizenzinformationen nicht anzeigen!
Verbindung mit Internet ok?"); - InfoImpressum.Navigating += ViewModelHelper.OnNavigating; + InfoDatenschutz.Navigating += WebViewHelper.SelectDisplayTarget; + InfoDatenschutz.Navigated += (sender, ev) => WebViewHelper.HandleError( + sender, + ev, + "Kann Datenschutzinformationen nicht anzeigen!
Verbindung mit Internet ok?"); + + InfoABG.Navigating += WebViewHelper.SelectDisplayTarget; + InfoABG.Navigated += (sender, ev) => WebViewHelper.HandleError( + sender, + ev, + "Kann allgemeine Geschäftsbedingungen nicht anzeigen!
Verbindung mit Internet ok?"); + + InfoImpressum.Navigating += WebViewHelper.SelectDisplayTarget; + InfoImpressum.Navigated += (sender, ev) => WebViewHelper.HandleError( + sender, + ev, + "Kann Impressum nicht anzeigen!
Verbindung mit Internet ok?"); } /// Called when page is shown. @@ -38,4 +57,4 @@ namespace TINK.View.Info ViewModel.OnAppearing(); } } -} \ No newline at end of file +} diff --git a/TINK/TINK/View/WhatsNew/Agb/AgbPage.xaml.cs b/TINK/TINK/View/WhatsNew/Agb/AgbPage.xaml.cs index cb114dd..3c68bdb 100644 --- a/TINK/TINK/View/WhatsNew/Agb/AgbPage.xaml.cs +++ b/TINK/TINK/View/WhatsNew/Agb/AgbPage.xaml.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Globalization; using System.Threading.Tasks; using TINK.Model.Bikes.BikeInfoNS.DriveNS.BatteryNS; @@ -19,7 +19,6 @@ namespace TINK.View.WhatsNew.Agb agbViewModel = new AgbViewModel( App.ModelRoot.NextActiveUri.Host, App.ModelRoot.IsSiteCachingOn, - CultureInfo.CurrentUICulture.TwoLetterISOLanguageName, (resourceName) => ViewModelResourceHelper.GetSource(resourceName), this); @@ -81,4 +80,4 @@ namespace TINK.View.WhatsNew.Agb public async Task DisplayUserFeedbackPopup(IBattery battery = null, string co2Saving = null) => throw new NotSupportedException(); #endif } -} \ No newline at end of file +} diff --git a/TINKLib/Model/Connector/Updater/TariffDescriptionFactory.cs b/TINKLib/Model/Connector/Updater/TariffDescriptionFactory.cs index b53b5bd..6cd1ab2 100644 --- a/TINKLib/Model/Connector/Updater/TariffDescriptionFactory.cs +++ b/TINKLib/Model/Connector/Updater/TariffDescriptionFactory.cs @@ -1,4 +1,4 @@ -using System.Globalization; +using System.Globalization; using TINK.MultilingualResources; using TINK.Repository.Response; @@ -67,12 +67,6 @@ namespace TINK.Model.Connector.Updater }); } - - if (!string.IsNullOrEmpty(tariffDesciption?.operator_agb ?? string.Empty)) - { - bike.InfoEntries.Add("1", new Bikes.BikeInfoNS.RentalDescription.InfoElement { Key = "AGB", Value = tariffDesciption.operator_agb }); - } - return bike; } diff --git a/TINKLib/Model/ResourceUrls.cs b/TINKLib/Model/ResourceUrls.cs index 9efe4fd..a7d02ff 100644 --- a/TINKLib/Model/ResourceUrls.cs +++ b/TINKLib/Model/ResourceUrls.cs @@ -1,4 +1,4 @@ -namespace TINK.Model +namespace TINK.Model { public class ResourceUrls : IResourceUrls { @@ -9,11 +9,11 @@ string privacyResourcePath = null, string impressResourcePath = null) { - FeesResourcePath = !string.IsNullOrEmpty(feesResourcePath) ? feesResourcePath : "site/tariff_info_1.html"; - BikesResourcePath = !string.IsNullOrEmpty(bikesResourcePath) ? bikesResourcePath : "site/bike_info.html"; - AgbResourcePath = !string.IsNullOrEmpty(agbResourcePath) ? agbResourcePath : "site/agb.html"; - PrivacyResourcePath = !string.IsNullOrEmpty(privacyResourcePath) ? privacyResourcePath : "site/privacy.html"; - ImpressResourcePath = !string.IsNullOrEmpty(impressResourcePath) ? impressResourcePath : "site/impress.html"; + FeesResourcePath = !string.IsNullOrEmpty(feesResourcePath) ? feesResourcePath : ""; + BikesResourcePath = !string.IsNullOrEmpty(bikesResourcePath) ? bikesResourcePath : ""; + AgbResourcePath = !string.IsNullOrEmpty(agbResourcePath) ? agbResourcePath : ""; + PrivacyResourcePath = !string.IsNullOrEmpty(privacyResourcePath) ? privacyResourcePath : ""; + ImpressResourcePath = !string.IsNullOrEmpty(impressResourcePath) ? impressResourcePath : ""; } public string FeesResourcePath { get; } diff --git a/TINKLib/Model/WhatsNew.cs b/TINKLib/Model/WhatsNew.cs index e3605ba..40848be 100644 --- a/TINKLib/Model/WhatsNew.cs +++ b/TINKLib/Model/WhatsNew.cs @@ -596,12 +596,12 @@ namespace TINK.Model new List { AppFlavor.MeinKonrad } }, { - new Version(3, 0, 341), + new Version(3, 0, 342), AppResources.ChangeLog_MinorDesignImprovements, new List { AppFlavor.LastenradBayern, AppFlavor.MeinKonrad } }, { - new Version(3, 0, 341), + new Version(3, 0, 342), AppResources.ChangeLog_MinorBugFixes, new List { AppFlavor.ShareeBike } } diff --git a/TINKLib/MultilingualResources/AppResources.Designer.cs b/TINKLib/MultilingualResources/AppResources.Designer.cs index c2d59ac..240edad 100644 --- a/TINKLib/MultilingualResources/AppResources.Designer.cs +++ b/TINKLib/MultilingualResources/AppResources.Designer.cs @@ -2081,6 +2081,15 @@ namespace TINK.MultilingualResources { } } + /// + /// Looks up a localized string similar to App. + /// + public static string MarkingTabApp { + get { + return ResourceManager.GetString("MarkingTabApp", resourceCulture); + } + } + /// /// Looks up a localized string similar to Instructions. /// @@ -2099,6 +2108,33 @@ namespace TINK.MultilingualResources { } } + /// + /// Looks up a localized string similar to GTC. + /// + public static string MarkingTabGtc { + get { + return ResourceManager.GetString("MarkingTabGtc", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Impress. + /// + public static string MarkingTabImpress { + get { + return ResourceManager.GetString("MarkingTabImpress", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Privacy. + /// + public static string MarkingTabPrivacy { + get { + return ResourceManager.GetString("MarkingTabPrivacy", resourceCulture); + } + } + /// /// Looks up a localized string similar to Verbose error messages. /// diff --git a/TINKLib/MultilingualResources/AppResources.de.resx b/TINKLib/MultilingualResources/AppResources.de.resx index 2f612ab..e545a82 100644 --- a/TINKLib/MultilingualResources/AppResources.de.resx +++ b/TINKLib/MultilingualResources/AppResources.de.resx @@ -1037,4 +1037,16 @@ Sie können nun auf einen Blick sehen, welche App-Version Sie installiert haben: {0} <font color="gray"><u>kontaktieren</u></font>. + + App + + + AGB + + + Impressum + + + Datenschutz + \ No newline at end of file diff --git a/TINKLib/MultilingualResources/AppResources.resx b/TINKLib/MultilingualResources/AppResources.resx index d501e21..54ea5a2 100644 --- a/TINKLib/MultilingualResources/AppResources.resx +++ b/TINKLib/MultilingualResources/AppResources.resx @@ -1129,4 +1129,16 @@ You can now see at a glance which app version you have installed: in the menu at <font color="gray"><u>Contact</u></font> {0}. - + + App + + + GTC + + + Impress + + + Privacy + + \ No newline at end of file diff --git a/TINKLib/MultilingualResources/TINKLib.de.xlf b/TINKLib/MultilingualResources/TINKLib.de.xlf index deec829..057c4a0 100644 --- a/TINKLib/MultilingualResources/TINKLib.de.xlf +++ b/TINKLib/MultilingualResources/TINKLib.de.xlf @@ -1408,6 +1408,22 @@ Sie können nun auf einen Blick sehen, welche App-Version Sie installiert haben: <font color="gray"><u>Contact</u></font> {0}. {0} <font color="gray"><u>kontaktieren</u></font>. + + App + App + + + GTC + AGB + + + Impress + Impressum + + + Privacy + Datenschutz + diff --git a/TINKLib/Repository/Response/TariffDescription.cs b/TINKLib/Repository/Response/TariffDescription.cs index 9ef2944..5131b08 100644 --- a/TINKLib/Repository/Response/TariffDescription.cs +++ b/TINKLib/Repository/Response/TariffDescription.cs @@ -1,4 +1,4 @@ -using System.Runtime.Serialization; +using System.Runtime.Serialization; namespace TINK.Repository.Response { @@ -48,10 +48,6 @@ namespace TINK.Repository.Response [DataMember] public string max_eur_per_day { get; private set; } - /// Info about operator agb as HTML (i.g. text and hyperlink). - [DataMember] - public string operator_agb { get; private set; } - /// Text which informs users about GPS tracking if tracking is on. [DataMember] public string track_info { get; private set; } diff --git a/TINKLib/View/WebViewHelper.cs b/TINKLib/View/WebViewHelper.cs new file mode 100644 index 0000000..e9ff76f --- /dev/null +++ b/TINKLib/View/WebViewHelper.cs @@ -0,0 +1,175 @@ +using System.Linq; +using Serilog; +using TINK.Model.Device; +using Xamarin.Forms; + +namespace TINK.View +{ + public static class WebViewHelper + { + /// Rountes request to browser if internal URI was detected or displays link in app otherwise. + /// Sender of the event. + /// Event arguments + public static void SelectDisplayTarget(object sender, WebNavigatingEventArgs eventArgs) + { + if (!eventArgs.Url.ToUpper().StartsWith("HTTP")) + { + // An internal link was detected. + // Stay inside WebView + eventArgs.Cancel = false; + return; + } + + // Do not navigate outside the document on web view. + eventArgs.Cancel = true; + // Open external link in browser. + DependencyService.Get().OpenUrl(eventArgs.Url); + } + + /// Routes request to broswer to download pdf- documents or displays link in app otherwise. + /// Sender of the event. + /// Event arguments + public static void SetBusyAndDisplayOrDownload(object sender, WebNavigatingEventArgs eventArgs) + { + if (!eventArgs.Url.ToUpper().EndsWith(".PDF")) + { + // Stay inside web view except for downloading pdf- files. + SetBusy(sender); + eventArgs.Cancel = false; + return; + } + + // Do not navigate outside the document on web view. + eventArgs.Cancel = true; + // Open external link in browser. + DependencyService.Get().OpenUrl(eventArgs.Url); + } + + /// + /// Disables WebView and shows ActivityIndicator. + /// + /// + /// Prerequisites: Both WebView and ActivityInicator must be located on the same Grid object. + /// + /// + private static void SetBusy(object sender) + { + if (!(sender is WebView webView)) + { + // Nothing to do if sender is not a web view. + Log.Error($"Unexpected call of {nameof(SetBusy)} detected. Argument must not be of type {sender.GetType()}."); + return; + } + + if (!(webView.Parent is Grid grid)) + { + // Nothing to do if web view is not located on grid. + Log.Error($"Unexpected call of {nameof(SetBusy)} detected. Parent of argument must not be of type {webView.Parent.GetType()}."); + return; + } + + grid.IsEnabled = false; + + var indicator = grid.Children.OfType().FirstOrDefault(); + if (indicator == null) + { + // Nothing to do if there is not activity indicator. + Log.Error($"Unexpected call of {nameof(SetBusy)} detected. No activity indicator found."); + return; + } + + indicator.IsVisible = true; + indicator.IsRunning = true; + } + + /// + /// Enables WebView and hides ActivityIndicator and sets error text to WebView in case an error occurred. + /// + /// + /// Prerequisites: Both WebView and ActivityInicator must be located on the same Grid object. + /// + /// HTML showing an error message. + public static void SetIdleAndHandleError( + object sender, + WebNavigatedEventArgs eventArgs, + string htmlErrorMessage) + { + if (!(sender is WebView webView)) + { + // Nothing to do if sender is not a web view. + Log.Error($"Unexpected call of {nameof(SetIdleAndHandleError)} detected. Argument must not be of type {sender.GetType()}."); + return; + } + + if (!(webView.Parent is Grid grid)) + { + // Nothing to do if web view is not located on grid. + Log.Error($"Unexpected call of {nameof(SetIdleAndHandleError)} detected. Parent of argument must not be of type {webView.Parent.GetType()}."); + return; + } + + var indicator = grid.Children.OfType().FirstOrDefault(); + if (indicator == null) + { + // Nothing to do if there is not activity indicator. + Log.Error($"Unexpected call of {nameof(SetIdleAndHandleError)} detected. No activity indicator found."); + } + + if (eventArgs.Result == WebNavigationResult.Success) + { + // Uri could be loaded successfully. + grid.IsEnabled = true; + if (indicator != null) + { + indicator.IsVisible = false; + indicator.IsRunning = false; + } + return; + } + + // Navigation failed. + Log.Error("Navigation did not succeed.{@Event}{@Sender}", eventArgs, sender); + webView.Source = new HtmlWebViewSource + { + Html = !string.IsNullOrEmpty(htmlErrorMessage) ? htmlErrorMessage : $"Navigation to {eventArgs.Url} failed." + }; + + grid.IsEnabled = true; + if (indicator != null) + { + indicator.IsVisible = false; + indicator.IsRunning = false; + } + } + + /// + /// Sets error text to WebView in case an error occurred. + /// + /// HTML showing an error message. + public static void HandleError( + object sender, + WebNavigatedEventArgs eventArgs, + string htmlErrorMessage) + { + if (eventArgs.Result == WebNavigationResult.Success) + { + // Uri could be loaded successfully. + return; + } + + if (!(sender is WebView webView)) + { + // Nothing to do if sender is not a web view. + Log.Error($"Unexpected call of {nameof(HandleError)} detected. Argument must not be of type {sender.GetType()}."); + return; + } + + // Navigation failed. + Log.Error("Navigation did not succeed.{@Event}{@Sender}", eventArgs, sender); + webView.Source = new HtmlWebViewSource + { + Html = !string.IsNullOrEmpty(htmlErrorMessage) ? htmlErrorMessage : $"Navigation to {eventArgs.Url} failed." + }; + } + } +} diff --git a/TINKLib/ViewModel/Bikes/Bike/BikeViewModelBase.cs b/TINKLib/ViewModel/Bikes/Bike/BikeViewModelBase.cs index b3a937e..a0ac07d 100644 --- a/TINKLib/ViewModel/Bikes/Bike/BikeViewModelBase.cs +++ b/TINKLib/ViewModel/Bikes/Bike/BikeViewModelBase.cs @@ -1,4 +1,4 @@ -using Serilog; +using Serilog; using System; using System.ComponentModel; using System.Text.RegularExpressions; @@ -355,32 +355,6 @@ namespace TINK.ViewModel.Bikes.Bike /// Gets the value of property when PropertyChanged was fired. public Color LastStateColor { get; set; } - /// Command object to bind login page redirect link to view model. - public System.Windows.Input.ICommand ShowAgbTappedCommand - => new Xamarin.Forms.Command(() => ShowAgbPageAsync()); - - /// Opens login page. - public void ShowAgbPageAsync() - { - try - { - var url = GetUrlFirstOrDefault(TariffDescription.OperatorAgb); - if (string.IsNullOrEmpty(url)) - { - // No url contained in string. - return; - } - - OpenUrlInBrowser(url); - - } - catch (Exception p_oException) - { - Log.Error("An unexpected error occurred opening broser. {@Exception}", p_oException); - return; - } - } - /// Gets first url from text. /// url to extract text from. /// Gets first url or an empty string if on url is contained in text. diff --git a/TINKLib/ViewModel/Bikes/Bike/BluetoothLock/RequestHandler/BookedClosed.cs b/TINKLib/ViewModel/Bikes/Bike/BluetoothLock/RequestHandler/BookedClosed.cs index e3d7a9f..c46b9ba 100644 --- a/TINKLib/ViewModel/Bikes/Bike/BluetoothLock/RequestHandler/BookedClosed.cs +++ b/TINKLib/ViewModel/Bikes/Bike/BluetoothLock/RequestHandler/BookedClosed.cs @@ -36,7 +36,7 @@ namespace TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler IUser activeUser) : base( selectedBike, AppResources.ActionReturn, // Copri button text "Miete beenden" - false, // Do no more allow to return bike. + true, // Show button to enabled returning of bike. isConnectedDelegate, connectorFactory, geolocation, diff --git a/TINKLib/ViewModel/Bikes/Bike/TariffDescriptionViewModel.cs b/TINKLib/ViewModel/Bikes/Bike/TariffDescriptionViewModel.cs index 6d0d1c4..b43e78f 100644 --- a/TINKLib/ViewModel/Bikes/Bike/TariffDescriptionViewModel.cs +++ b/TINKLib/ViewModel/Bikes/Bike/TariffDescriptionViewModel.cs @@ -1,4 +1,4 @@ -using System.Collections.ObjectModel; +using System.Collections.ObjectModel; using System.Linq; using TINK.Model.Bikes.BikeInfoNS; @@ -9,8 +9,6 @@ namespace TINK.ViewModel.Bikes.Bike /// public class TariffDescriptionViewModel { - private const string AGBKEY = "AGB"; - public TariffDescriptionViewModel(RentalDescription tariff) { Name = tariff?.Name ?? string.Empty; @@ -20,13 +18,8 @@ namespace TINK.ViewModel.Bikes.Bike : new ObservableCollection(); InfoEntries = tariff != null && tariff?.InfoEntries != null - ? new ObservableCollection(tariff.InfoEntries.OrderBy(x => x.Key).Where(x => x.Value.Key != AGBKEY).Select(x => x.Value.Value)) + ? new ObservableCollection(tariff.InfoEntries.OrderBy(x => x.Key).Select(x => x.Value.Value)) : new ObservableCollection(); - - OperatorAgb = tariff?.InfoEntries != null - && tariff.InfoEntries.Select(x => x.Value.Key).Contains(AGBKEY) - ? tariff?.InfoEntries.FirstOrDefault(x => x.Value.Key == AGBKEY).Value.Value - : string.Empty; } /// @@ -44,9 +37,6 @@ namespace TINK.ViewModel.Bikes.Bike /// public ObservableCollection InfoEntries { get; private set; } - /// Info about operator agb as HTML (i.g. text and hyperlink). - public string OperatorAgb { get; set; } - public RentalDescription.TariffElement TarifEntry1 => TariffEntries.Count > 0 ? TariffEntries[0] : new RentalDescription.TariffElement(); public RentalDescription.TariffElement TarifEntry2 => TariffEntries.Count > 1 ? TariffEntries[1] : new RentalDescription.TariffElement(); public RentalDescription.TariffElement TarifEntry3 => TariffEntries.Count > 2 ? TariffEntries[2] : new RentalDescription.TariffElement(); diff --git a/TINKLib/ViewModel/FeesAndBikes/FeesAndBikesPageViewModel.cs b/TINKLib/ViewModel/FeesAndBikes/FeesAndBikesPageViewModel.cs index 8bf3d30..3a70965 100644 --- a/TINKLib/ViewModel/FeesAndBikes/FeesAndBikesPageViewModel.cs +++ b/TINKLib/ViewModel/FeesAndBikes/FeesAndBikesPageViewModel.cs @@ -1,5 +1,12 @@ -using System.ComponentModel; +using System; +using System.ComponentModel; using System.Threading.Tasks; +using Serilog; +using TINK.Model; +using TINK.Model.Bikes; +using TINK.Model.Connector; +using TINK.Model.Services.CopriApi; +using TINK.ViewModel.Info; using Xamarin.Forms; namespace TINK.ViewModel.Contact @@ -12,24 +19,67 @@ namespace TINK.ViewModel.Contact /// Holds value wether site caching is on or off. bool IsSiteCachingOn { get; } - private string FeesResourcePath { get; } + /// + /// Relative path to fees resources of empty if value was not yet querried from backend. + /// + private string FeesResourcePath { get; set; } - private string BikesResourcePath { get; } + /// + /// Relative path to bike info resources of empty if value was not yet querried from backend. + /// + private string BikesResourcePath { get; set; } + private bool _IsIdle = false; + + /// + /// Is true if no action is pending, false otherwise. + /// + public bool IsIdle + { + get => _IsIdle; + private set + { + if (_IsIdle == value) + { + // Nothing to do. + return; + } + + _IsIdle = value; + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsIdle))); + return; + } + } + + /// + /// Object to querry resources urls object from backend if required. + /// This object is used to update resources path values , and from. + /// + private Func QueryProvider { get; } + + /// + /// Action to update shared resources urls object exposed by main model. + /// + private Action UpdateUrlsAction { get; } /// Constructs view model. /// Set of user permissions /// Delegate to get an an embedded html ressource. Used as fallback if download from web page does not work and cache is empty. + /// Object to querry resources path values if required. public FeesAndBikesPageViewModel( string hostName, string feesResourcePath, string bikesResourcePath, - bool isSiteCachingOn) + bool isSiteCachingOn, + Func queryProvider, + Action updateUrlsAction) { HostName = hostName; FeesResourcePath = feesResourcePath; BikesResourcePath = bikesResourcePath; IsSiteCachingOn = isSiteCachingOn; + QueryProvider = queryProvider; + UpdateUrlsAction = updateUrlsAction; } /// Holds the name of the host. @@ -38,10 +88,38 @@ namespace TINK.ViewModel.Contact /// Called when page is shown. public async void OnAppearing() { + // Get resource urls object from backend. + async Task GetUrls() + { + Result bikes; + try + { + bikes = await QueryProvider().GetBikesAsync(); + } + catch (Exception ex) + { + Log.ForContext().Error($"Getting resource urls from COPRI failed. {ex.Message}"); + return new ResourceUrls(); + } + + return bikes?.GeneralData?.ResourceUrls ?? new ResourceUrls(); + } + + // Set state to busy. + IsIdle = false; + + if (string.IsNullOrEmpty(FeesResourcePath)) + { + var urls = await GetUrls(); + FeesResourcePath = urls.FeesResourcePath; + BikesResourcePath = urls.BikesResourcePath; + UpdateUrlsAction(urls); // Update main model to prevent duplicate queries. + } + RentBikeText = new HtmlWebViewSource { Html = !string.IsNullOrEmpty(FeesResourcePath) - ? await ViewModelHelper.GetSource($"https://{HostName}/{FeesResourcePath}" /* "site/tariff_info_1.html" */, IsSiteCachingOn) + ? await ViewModelHelper.GetSource($"https://{HostName}/{FeesResourcePath}", IsSiteCachingOn) : await Task.FromResult(ViewModelHelper.FromBody("No fees resource available. Resource path is null or empty.")) }; @@ -51,6 +129,9 @@ namespace TINK.ViewModel.Contact ? await ViewModelHelper.GetSource($"https://{HostName}/{BikesResourcePath}" /*"site/bike_info.html"*/, IsSiteCachingOn) : await Task.FromResult(ViewModelHelper.FromBody("No bikes instruction resource available. Resource path is null or empty.")) }; + + // Set state to idle. + IsIdle = true; } private HtmlWebViewSource rentBikeText; diff --git a/TINKLib/ViewModel/Info/InfoPageViewModel.cs b/TINKLib/ViewModel/Info/InfoPageViewModel.cs index ba25576..2bda980 100644 --- a/TINKLib/ViewModel/Info/InfoPageViewModel.cs +++ b/TINKLib/ViewModel/Info/InfoPageViewModel.cs @@ -1,10 +1,14 @@ -using System; +using System; using System.ComponentModel; using System.Threading.Tasks; using Serilog; +using TINK.Model.Bikes; +using TINK.Model; using TINK.Model.Device; +using TINK.Model.Services.CopriApi; using Xamarin.Essentials; using Xamarin.Forms; +using TINK.Model.Connector; namespace TINK.ViewModel.Info { @@ -20,39 +24,80 @@ namespace TINK.ViewModel.Info /// Holds value wether site caching is on or off. bool IsSiteCachingOn { get; } - private string AgbResourcePath { get; } - - private string PrivacyResourcePath { get; } - - private string ImpressResourcePath { get; } + /// + /// Relative path to agb resources of empty if value was not yet querried from backend. + /// + private string AgbResourcePath { get; set; } /// - /// Holds the current ui two letter ISO language name. + /// Relative path to privacy resources of empty if value was not yet querried from backend. /// - private string UiIsoLanguageName { get; } + private string PrivacyResourcePath { get; set; } + + /// + /// Relative path to impress resources of empty if value was not yet querried from backend. + /// + private string ImpressResourcePath { get; set; } + + private bool _IsIdle = false; + + /// + /// Is true if no action is pending, false otherwise. + /// + public bool IsIdle + { + get => _IsIdle; + private set + { + if (_IsIdle == value) + { + // Nothing to do. + return; + } + + _IsIdle = value; + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsIdle))); + return; + } + } + + /// + /// Object to querry resources urls object from backend if required. + /// This object is used to update resources path values , and from. + /// + private Func QueryProvider { get; } + + /// + /// Action to update shared resources urls object exposed by main model. + /// + private Action UpdateUrlsAction { get; } /// Constructs Info view model + /// Name of the host to get html resources from. /// Holds value wether site caching is on or off. /// Agb resouce path received from backend. /// Privacy resouce path received from backend. /// Impress resouce path received from backend. - /// Two letter ISO language name. /// Delegate to get an an embedded html ressource. Used as fallback if download from web page does not work and cache is empty. + /// Object to querry resources urls object from backend if required. + /// Action to update shared resources urls object public InfoPageViewModel( string hostName, string agbResourcePath, string privacyResourcePath, string impressResourcePath, bool isSiteCachingOn, - string uiIsoLangugageName, - Func resourceProvider) + Func resourceProvider, + Func queryProvider, + Action updateUrlsAction) { HostName = hostName; AgbResourcePath = agbResourcePath; PrivacyResourcePath = privacyResourcePath; ImpressResourcePath = impressResourcePath; IsSiteCachingOn = isSiteCachingOn; - UiIsoLanguageName = uiIsoLangugageName; + QueryProvider = queryProvider; + UpdateUrlsAction = updateUrlsAction; InfoAgb = new HtmlWebViewSource { Html = "Loading..." }; @@ -63,6 +108,37 @@ namespace TINK.ViewModel.Info /// Called when page is shown. public async void OnAppearing() { + // Get resource urls object from backend. + async Task GetUrls() + { + Result bikes; + try + { + bikes = await QueryProvider().GetBikesAsync(); + } + catch (Exception ex) + { + Log.ForContext().Error($"Getting resource urls from COPRI failed. {ex.Message}"); + return new ResourceUrls(); + } + + IResourceUrls resourceUrls = bikes?.GeneralData?.ResourceUrls ?? new ResourceUrls(); + return resourceUrls; + } + + // Set state to busy. + IsIdle = false; + + // Check if urls to show info from are already known. + if (string.IsNullOrEmpty(PrivacyResourcePath)) + { + var urls = await GetUrls(); + PrivacyResourcePath = urls.PrivacyResourcePath; + ImpressResourcePath = urls.ImpressResourcePath; + AgbResourcePath = urls.AgbResourcePath; + UpdateUrlsAction(urls); // Update main model to prevent duplicate queries. + } + // Gets privacy info from server. async Task GetInfoPrivacy() { @@ -113,11 +189,14 @@ namespace TINK.ViewModel.Info }; } - InfoAgb = await GetAgb(HostName, AgbResourcePath, IsSiteCachingOn, UiIsoLanguageName); + InfoAgb = await GetAgb(HostName, AgbResourcePath, IsSiteCachingOn); InfoPrivacy = await GetInfoPrivacy(); InfoImpressum = await GetImpressum(); + + // Set state to idle. + IsIdle = true; } /// Gets the AGBs @@ -126,8 +205,7 @@ namespace TINK.ViewModel.Info public static async Task GetAgb( string hostName, string agbResourcePath, - bool isSiteCachingOn, - string uiIsoLangugageName) + bool isSiteCachingOn) { string GetUriText() => $"https://{hostName}/{agbResourcePath}"; diff --git a/TINKLib/ViewModel/ViewModelHelper.cs b/TINKLib/ViewModel/ViewModelHelper.cs index 043eaae..6ba56dc 100644 --- a/TINKLib/ViewModel/ViewModelHelper.cs +++ b/TINKLib/ViewModel/ViewModelHelper.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Linq; using System.Net; using System.Threading.Tasks; @@ -228,27 +228,6 @@ namespace TINK.ViewModel return l_oError; } - - /// User tabbed a URI. - /// Sender of the event. - /// Event arguments - public static void OnNavigating(object sender, WebNavigatingEventArgs eventArgs) - { - - if (!eventArgs.Url.ToUpper().StartsWith("HTTP")) - { - // An internal link was detected. - // Stay inside WebView - eventArgs.Cancel = false; - return; - } - - // Do not navigate outside the document. - eventArgs.Cancel = true; - - DependencyService.Get().OpenUrl(eventArgs.Url); - } - /// Gets the user group if a user friendly name. /// /// diff --git a/TINKLib/ViewModel/WhatsNew/Agb/AgbViewModel.cs b/TINKLib/ViewModel/WhatsNew/Agb/AgbViewModel.cs index 0151382..55a354d 100644 --- a/TINKLib/ViewModel/WhatsNew/Agb/AgbViewModel.cs +++ b/TINKLib/ViewModel/WhatsNew/Agb/AgbViewModel.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.ComponentModel; using System.Threading.Tasks; using System.Windows.Input; @@ -19,11 +19,6 @@ namespace TINK.ViewModel.WhatsNew.Agb /// Holds value wether site caching is on or off. bool IsSiteCachingOn { get; } - /// - /// Holds the current ui two letter ISO language name. - /// - private string UiIsoLanguageName { get; } - /// Constructs AGB view model /// Holds value wether site caching is on or off. /// Two letter ISO language name. @@ -32,13 +27,11 @@ namespace TINK.ViewModel.WhatsNew.Agb public AgbViewModel( string hostName, bool isSiteCachingOn, - string uiIsoLangugageName, Func resourceProvider, IViewService viewService) { HostName = hostName; IsSiteCachingOn = isSiteCachingOn; - UiIsoLanguageName = uiIsoLangugageName; ViewService = viewService ?? throw new ArgumentException($"Can not instantiate {typeof(WhatsNewViewModel)}-object. No view available."); @@ -67,7 +60,7 @@ namespace TINK.ViewModel.WhatsNew.Agb /// Called when page is shown. public async Task OnAppearing() { - InfoAgb = await InfoPageViewModel.GetAgb(HostName, "agbResourcePath", IsSiteCachingOn, UiIsoLanguageName); + InfoAgb = await InfoPageViewModel.GetAgb(HostName, "agbResourcePath", IsSiteCachingOn); } /// User clicks OK button. diff --git a/TestShareeLib/ViewModel/Bikes/Bike/BluetoothLock/RequestHandler/TestBookedClosed.cs b/TestShareeLib/ViewModel/Bikes/Bike/BluetoothLock/RequestHandler/TestBookedClosed.cs index 5c06fea..7ac48ef 100644 --- a/TestShareeLib/ViewModel/Bikes/Bike/BluetoothLock/RequestHandler/TestBookedClosed.cs +++ b/TestShareeLib/ViewModel/Bikes/Bike/BluetoothLock/RequestHandler/TestBookedClosed.cs @@ -887,9 +887,8 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.Re }); // Verify state "Booked Closed" after action - // Following two assertions are deactivated temporarily in context of issue https://dev.azure.com/TeilRad/sharee.bike%20Buchungsplattform/_workitems/edit/440/. - //Assert.AreEqual("Return bike", subsequent.ButtonText); - //Assert.IsTrue(subsequent.IsButtonVisible); + Assert.AreEqual("Return bike", subsequent.ButtonText); + Assert.IsTrue(subsequent.IsButtonVisible); Assert.AreEqual("Open lock", subsequent.LockitButtonText); Assert.IsTrue(subsequent.IsLockitButtonVisible); } diff --git a/TestShareeLib/ViewModel/Bikes/Bike/BluetoothLock/RequestHandler/TestBookedOpen.cs b/TestShareeLib/ViewModel/Bikes/Bike/BluetoothLock/RequestHandler/TestBookedOpen.cs index b7f5454..9c1ad6d 100644 --- a/TestShareeLib/ViewModel/Bikes/Bike/BluetoothLock/RequestHandler/TestBookedOpen.cs +++ b/TestShareeLib/ViewModel/Bikes/Bike/BluetoothLock/RequestHandler/TestBookedOpen.cs @@ -1095,9 +1095,8 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.Re }); // Verify state "Booked Closed" after action - // Following two assertions are deactivated temporarily in context of issue https://dev.azure.com/TeilRad/sharee.bike%20Buchungsplattform/_workitems/edit/440/. - //Assert.AreEqual("Return bike", subsequent.ButtonText); - //Assert.IsTrue(subsequent.IsButtonVisible); + Assert.AreEqual("Return bike", subsequent.ButtonText); + Assert.IsTrue(subsequent.IsButtonVisible); Assert.AreEqual("Open lock", subsequent.LockitButtonText); Assert.IsTrue(subsequent.IsLockitButtonVisible); } @@ -1278,9 +1277,8 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.Re }); // Verify state "Booked Closed" after action - // Following two assertions are deactivated temporarily in context of issue https://dev.azure.com/TeilRad/sharee.bike%20Buchungsplattform/_workitems/edit/440/. - //Assert.AreEqual("Return bike", subsequent.ButtonText); - //Assert.IsTrue(subsequent.IsButtonVisible); + Assert.AreEqual("Return bike", subsequent.ButtonText); + Assert.IsTrue(subsequent.IsButtonVisible); Assert.AreEqual("Open lock", subsequent.LockitButtonText); Assert.IsTrue(subsequent.IsLockitButtonVisible); } @@ -1341,9 +1339,8 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.Re }); // Verify state "Booked Closed" after action - // Following two assertions are deactivated temporarily in context of issue https://dev.azure.com/TeilRad/sharee.bike%20Buchungsplattform/_workitems/edit/440/. - //Assert.AreEqual("Return bike", subsequent.ButtonText); - //Assert.IsTrue(subsequent.IsButtonVisible); + Assert.AreEqual("Return bike", subsequent.ButtonText); + Assert.IsTrue(subsequent.IsButtonVisible); Assert.AreEqual("Open lock", subsequent.LockitButtonText); Assert.IsTrue(subsequent.IsLockitButtonVisible); } @@ -1405,9 +1402,8 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.Re }); // Verify state "Booked Closed" after action - // Following two assertions are deactivated temporarily in context of issue https://dev.azure.com/TeilRad/sharee.bike%20Buchungsplattform/_workitems/edit/440/. - //Assert.AreEqual("Return bike", subsequent.ButtonText); - //Assert.IsTrue(subsequent.IsButtonVisible); + Assert.AreEqual("Return bike", subsequent.ButtonText); + Assert.IsTrue(subsequent.IsButtonVisible); Assert.AreEqual("Open lock", subsequent.LockitButtonText); Assert.IsTrue(subsequent.IsLockitButtonVisible); } diff --git a/TestShareeLib/ViewModel/Bikes/Bike/BluetoothLock/RequestHandler/TestBookedUnknown.cs b/TestShareeLib/ViewModel/Bikes/Bike/BluetoothLock/RequestHandler/TestBookedUnknown.cs index f054a7d..8019369 100644 --- a/TestShareeLib/ViewModel/Bikes/Bike/BluetoothLock/RequestHandler/TestBookedUnknown.cs +++ b/TestShareeLib/ViewModel/Bikes/Bike/BluetoothLock/RequestHandler/TestBookedUnknown.cs @@ -286,9 +286,8 @@ namespace TestShareeLib.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler }); // Verify state "Booked Closed" after action - // Following two assertions are deactivated temporarily in context of issue https://dev.azure.com/TeilRad/sharee.bike%20Buchungsplattform/_workitems/edit/440/. - //Assert.AreEqual("Return bike", subsequent.ButtonText); - //Assert.IsTrue(subsequent.IsButtonVisible); + Assert.AreEqual("Return bike", subsequent.ButtonText); + Assert.IsTrue(subsequent.IsButtonVisible); Assert.AreEqual("Open lock", subsequent.LockitButtonText); Assert.IsTrue(subsequent.IsLockitButtonVisible); } @@ -973,9 +972,8 @@ namespace TestShareeLib.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler }); // Verify state "Booked Closed" after action - // Following two assertions are deactivated temporarily in context of issue https://dev.azure.com/TeilRad/sharee.bike%20Buchungsplattform/_workitems/edit/440/. - //Assert.AreEqual("Return bike", subsequent.ButtonText); - //Assert.IsTrue(subsequent.IsButtonVisible); + Assert.AreEqual("Return bike", subsequent.ButtonText); + Assert.IsTrue(subsequent.IsButtonVisible); Assert.AreEqual("Open lock", subsequent.LockitButtonText); Assert.IsTrue(subsequent.IsLockitButtonVisible); } @@ -1036,9 +1034,8 @@ namespace TestShareeLib.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler }); // Verify state "Booked Closed" after action - // Following two assertions are deactivated temporarily in context of issue https://dev.azure.com/TeilRad/sharee.bike%20Buchungsplattform/_workitems/edit/440/. - //Assert.AreEqual("Return bike", subsequent.ButtonText); - //Assert.IsTrue(subsequent.IsButtonVisible); + Assert.AreEqual("Return bike", subsequent.ButtonText); + Assert.IsTrue(subsequent.IsButtonVisible); Assert.AreEqual("Open lock", subsequent.LockitButtonText); Assert.IsTrue(subsequent.IsLockitButtonVisible); } @@ -1100,9 +1097,8 @@ namespace TestShareeLib.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler }); // Verify state "Booked Closed" after action - // Following two assertions are deactivated temporarily in context of issue https://dev.azure.com/TeilRad/sharee.bike%20Buchungsplattform/_workitems/edit/440/. - //Assert.AreEqual("Return bike", subsequent.ButtonText); - //Assert.IsTrue(subsequent.IsButtonVisible); + Assert.AreEqual("Return bike", subsequent.ButtonText); + Assert.IsTrue(subsequent.IsButtonVisible); Assert.AreEqual("Open lock", subsequent.LockitButtonText); Assert.IsTrue(subsequent.IsLockitButtonVisible); } diff --git a/TestShareeLib/ViewModel/Bikes/Bike/BluetoothLock/RequestHandler/TestReservedUnknown.cs b/TestShareeLib/ViewModel/Bikes/Bike/BluetoothLock/RequestHandler/TestReservedUnknown.cs index a082cf3..ae72929 100644 --- a/TestShareeLib/ViewModel/Bikes/Bike/BluetoothLock/RequestHandler/TestReservedUnknown.cs +++ b/TestShareeLib/ViewModel/Bikes/Bike/BluetoothLock/RequestHandler/TestReservedUnknown.cs @@ -663,9 +663,8 @@ namespace TestShareeLib.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler }); // Verify state "Booked Closed" after action - // Following two assertions are deactivated temporarily in context of issue https://dev.azure.com/TeilRad/sharee.bike%20Buchungsplattform/_workitems/edit/440/. - //Assert.AreEqual("Return bike", subsequent.ButtonText); - //Assert.IsTrue(subsequent.IsButtonVisible); + Assert.AreEqual("Return bike", subsequent.ButtonText); + Assert.IsTrue(subsequent.IsButtonVisible); Assert.AreEqual("Open lock", subsequent.LockitButtonText); Assert.IsTrue(subsequent.IsLockitButtonVisible); } @@ -843,9 +842,8 @@ namespace TestShareeLib.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler }); // Verify state "Booked Closed" after action - // Following two assertions are deactivated temporarily in context of issue https://dev.azure.com/TeilRad/sharee.bike%20Buchungsplattform/_workitems/edit/440/. - //Assert.AreEqual("Return bike", subsequent.ButtonText); - //Assert.IsTrue(subsequent.IsButtonVisible); + Assert.AreEqual("Return bike", subsequent.ButtonText); + Assert.IsTrue(subsequent.IsButtonVisible); Assert.AreEqual("Open lock", subsequent.LockitButtonText); Assert.IsTrue(subsequent.IsLockitButtonVisible); } @@ -906,9 +904,8 @@ namespace TestShareeLib.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler }); // Verify state "Booked Closed" after action - // Following two assertions are deactivated temporarily in context of issue https://dev.azure.com/TeilRad/sharee.bike%20Buchungsplattform/_workitems/edit/440/. - //Assert.AreEqual("Return bike", subsequent.ButtonText); - //Assert.IsTrue(subsequent.IsButtonVisible); + Assert.AreEqual("Return bike", subsequent.ButtonText); + Assert.IsTrue(subsequent.IsButtonVisible); Assert.AreEqual("Open lock", subsequent.LockitButtonText); Assert.IsTrue(subsequent.IsLockitButtonVisible); } @@ -970,9 +967,8 @@ namespace TestShareeLib.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler }); // Verify state "Booked Closed" after action - // Following two assertions are deactivated temporarily in context of issue https://dev.azure.com/TeilRad/sharee.bike%20Buchungsplattform/_workitems/edit/440/. - //Assert.AreEqual("Return bike", subsequent.ButtonText); - //Assert.IsTrue(subsequent.IsButtonVisible); + Assert.AreEqual("Return bike", subsequent.ButtonText); + Assert.IsTrue(subsequent.IsButtonVisible); Assert.AreEqual("Open lock", subsequent.LockitButtonText); Assert.IsTrue(subsequent.IsLockitButtonVisible); } diff --git a/TestShareeLib/ViewModel/Bikes/Bike/TestTariffDescriptionViewModel.cs b/TestShareeLib/ViewModel/Bikes/Bike/TestTariffDescriptionViewModel.cs index e7a52e0..0ae9e0e 100644 --- a/TestShareeLib/ViewModel/Bikes/Bike/TestTariffDescriptionViewModel.cs +++ b/TestShareeLib/ViewModel/Bikes/Bike/TestTariffDescriptionViewModel.cs @@ -1,4 +1,4 @@ -using NUnit.Framework; +using NUnit.Framework; using TINK.Model.Bikes.BikeInfoNS; using TINK.ViewModel.Bikes.Bike; @@ -22,7 +22,6 @@ namespace TestShareeLib.ViewModel.Bikes.Bike InfoEntries = new System.Collections.Generic.Dictionary { { "15", new RentalDescription.InfoElement { Key = "Tracking", Value = "Ich stimme der Speicherung (Tracking) meiner Fahrstrecke zwecks wissenschaftlicher Auswertung und Berechnung der CO2-Einsparung zu!" } }, - { "22", new RentalDescription.InfoElement { Key = "AGB", Value ="Mit der Mietrad Anmietung wird folgender Betreiber AGB zugestimmt"} } } }; @@ -40,10 +39,6 @@ namespace TestShareeLib.ViewModel.Bikes.Bike viewModel.InfoEntries.Count, Is.EqualTo(1)); - Assert.That( - viewModel.OperatorAgb, - Is.EqualTo("Mit der Mietrad Anmietung wird folgender Betreiber AGB zugestimmt")); - Assert.That( viewModel.TarifEntry1.Value, Is.EqualTo("Max Gebühr")); diff --git a/TestTINKLib/Fixtures/ObjectTests/ViewModel/Info/TestInfoViewModel.cs b/TestTINKLib/Fixtures/ObjectTests/ViewModel/Info/TestInfoViewModel.cs index 3edd6dc..ecbad93 100644 --- a/TestTINKLib/Fixtures/ObjectTests/ViewModel/Info/TestInfoViewModel.cs +++ b/TestTINKLib/Fixtures/ObjectTests/ViewModel/Info/TestInfoViewModel.cs @@ -1,4 +1,4 @@ -using NUnit.Framework; +using NUnit.Framework; using TINK.ViewModel.Info; namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Info @@ -9,7 +9,15 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Info [Test] public void TestOnAppearing() { - var viewModel = new InfoPageViewModel("Hosti", "agbResourcePath", "privacyResourcePath", "impressResourcePath", false, "de", (url) => string.Empty); + var viewModel = new InfoPageViewModel( + "Hosti", + "agbResourcePath", + "privacyResourcePath", + "impressResourcePath", + false, + (url) => string.Empty, + () => null, + (resourceUrls) => { }); } } }