diff --git a/LastenradBayern/TINK.Android/Properties/AndroidManifest.xml b/LastenradBayern/TINK.Android/Properties/AndroidManifest.xml index 6aff9c8..aeec8d1 100644 --- a/LastenradBayern/TINK.Android/Properties/AndroidManifest.xml +++ b/LastenradBayern/TINK.Android/Properties/AndroidManifest.xml @@ -1,5 +1,5 @@  - + diff --git a/LastenradBayern/TINK.Android/Resources/Resource.Designer.cs b/LastenradBayern/TINK.Android/Resources/Resource.Designer.cs index 6db2370..454b10b 100644 --- a/LastenradBayern/TINK.Android/Resources/Resource.Designer.cs +++ b/LastenradBayern/TINK.Android/Resources/Resource.Designer.cs @@ -14,7 +14,7 @@ namespace TINK.Droid { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "13.2.1.111")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "13.2.2.120")] public partial class Resource { diff --git a/LastenradBayern/TINK.iOS/Info.plist b/LastenradBayern/TINK.iOS/Info.plist index cd40ccf..57f6ca8 100644 --- a/LastenradBayern/TINK.iOS/Info.plist +++ b/LastenradBayern/TINK.iOS/Info.plist @@ -56,9 +56,9 @@ CFBundleDisplayName LastenradBayern CFBundleVersion - 375 + 376 CFBundleShortVersionString - 3.0.375 + 3.0.376 ITSAppUsesNonExemptEncryption diff --git a/LastenradBayern/TINK/App.xaml b/LastenradBayern/TINK/App.xaml index a7134bf..e6f4598 100644 --- a/LastenradBayern/TINK/App.xaml +++ b/LastenradBayern/TINK/App.xaml @@ -11,13 +11,13 @@ - + - - + + diff --git a/LastenradBayern/TINK/LastenradBayern.projitems b/LastenradBayern/TINK/LastenradBayern.projitems index 3b060e3..51e3866 100644 --- a/LastenradBayern/TINK/LastenradBayern.projitems +++ b/LastenradBayern/TINK/LastenradBayern.projitems @@ -27,7 +27,6 @@ ILockItBike.xaml Code - SelectStationPage.xaml Code @@ -36,11 +35,10 @@ FeedbackPopup.xaml Code - - FindBikePage.xaml + + SelectBikePage.xaml Code - MiniSurveyPage.xaml Code @@ -61,11 +59,10 @@ AppShell.xaml - - - FeesAndBikesPage.xaml + + HelpPage.xaml Code @@ -80,8 +77,8 @@ PasswordForgottenPage.xaml Code - - AgbPage.xaml + + GtcPage.xaml Code @@ -97,8 +94,8 @@ ContactPage.xaml Code - - InfoTabbedPage.xaml + + LegalInformationPage.xaml Code @@ -161,7 +158,7 @@ - + @@ -174,13 +171,13 @@ - + Designer MSBuild:UpdateDesignTimeXaml - + Designer MSBuild:Compile @@ -192,7 +189,7 @@ - + Designer MSBuild:Compile @@ -246,7 +243,7 @@ - + Designer MSBuild:UpdateDesignTimeXaml diff --git a/LastenradBayern/TINK/View/Bike/BCBike.xaml b/LastenradBayern/TINK/View/Bike/BCBike.xaml index fdd2232..3c30ed7 100644 --- a/LastenradBayern/TINK/View/Bike/BCBike.xaml +++ b/LastenradBayern/TINK/View/Bike/BCBike.xaml @@ -1,6 +1,6 @@  diff --git a/LastenradBayern/TINK/View/Contact/ContactPage.xaml.cs b/LastenradBayern/TINK/View/Contact/ContactPage.xaml.cs index 6884882..562c8f6 100644 --- a/LastenradBayern/TINK/View/Contact/ContactPage.xaml.cs +++ b/LastenradBayern/TINK/View/Contact/ContactPage.xaml.cs @@ -3,7 +3,7 @@ using System; using System.Threading.Tasks; using TINK.Model.Bikes.BikeInfoNS.DriveNS.BatteryNS; using TINK.Model.Device; -using TINK.ViewModel.Info; +using TINK.ViewModel.Contact; using Xamarin.Essentials; using Xamarin.Forms; using Xamarin.Forms.Xaml; diff --git a/LastenradBayern/TINK/View/Help/HelpPage.xaml b/LastenradBayern/TINK/View/Help/HelpPage.xaml new file mode 100644 index 0000000..5b89089 --- /dev/null +++ b/LastenradBayern/TINK/View/Help/HelpPage.xaml @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/LastenradBayern/TINK/View/Help/HelpPage.xaml.cs b/LastenradBayern/TINK/View/Help/HelpPage.xaml.cs new file mode 100644 index 0000000..12f4712 --- /dev/null +++ b/LastenradBayern/TINK/View/Help/HelpPage.xaml.cs @@ -0,0 +1,54 @@ +using System.Globalization; +using Serilog; +using TINK.ViewModel; +using TINK.ViewModel.Help; +using Xamarin.Forms; +using Xamarin.Forms.Xaml; + +namespace TINK.View.Help +{ + [XamlCompilation(XamlCompilationOptions.Compile)] + public partial class HelpPage : TabbedPage + { + public HelpPageViewModel ViewModel { get; } + + public HelpPage() + { + InitializeComponent(); + + + /// Info about renting. + TariffsWebView.Navigating += WebViewHelper.SelectDisplayTarget; + + TariffsWebView.Navigated += (sender, ev) => WebViewHelper.HandleError( + sender, + ev, + "Kann Mietinformationen nicht anzeigen!
Verbindung mit Internet ok?"); + + /// Info about types of bikes. + ManualWebView.Navigating += WebViewHelper.SelectDisplayTarget; + + ManualWebView.Navigated += (sender, ev) => WebViewHelper.HandleError( + sender, + ev, + "Kann Radinformationen nicht anzeigen!
Verbindung mit Internet ok?"); + + ViewModel = new HelpPageViewModel( + App.ModelRoot.NextActiveUri.Host, + App.ModelRoot.ResourceUrls.TariffsResourcePath, + App.ModelRoot.ResourceUrls.ManualResourcePath, + App.ModelRoot.IsSiteCachingOn, + CultureInfo.CurrentUICulture.TwoLetterISOLanguageName, + () => App.ModelRoot.GetConnector(App.ModelRoot.GetIsConnected()).Query, + resourceUrls => App.ModelRoot.ResourceUrls = resourceUrls); + + this.BindingContext = ViewModel; + } + + /// Called when page is shown. + protected override void OnAppearing() + { + ViewModel.OnAppearing(); + } + } +} diff --git a/LastenradBayern/TINK/View/Info/BikeInfo/BikeInfoCarouselPage.xaml b/LastenradBayern/TINK/View/Info/BikeInfo/BikeInfoCarouselPage.xaml deleted file mode 100644 index c507e42..0000000 --- a/LastenradBayern/TINK/View/Info/BikeInfo/BikeInfoCarouselPage.xaml +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Meinkonrad/TINK/View/SelectBike/SelectBikePage.xaml.cs b/Meinkonrad/TINK/View/SelectBike/SelectBikePage.xaml.cs new file mode 100644 index 0000000..7e82a7f --- /dev/null +++ b/Meinkonrad/TINK/View/SelectBike/SelectBikePage.xaml.cs @@ -0,0 +1,179 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using Serilog; +using TINK.Model.Bikes.BikeInfoNS.DriveNS.BatteryNS; +using TINK.Model.Device; +using TINK.MultilingualResources; +using TINK.ViewModel.SelectBike; +using Xamarin.CommunityToolkit.Extensions; +using Xamarin.Forms; +using Xamarin.Forms.Xaml; + +namespace TINK.View.SelectBike +{ + [XamlCompilation(XamlCompilationOptions.Compile)] + public partial class SelectBikePage : ContentPage, IViewService + { + /// Reference to view model. + SelectBikePageViewModel m_oViewModel = null; + + /// + /// Holds a value indicating whether page already subscribed to shell item changes or not. + /// + private bool _IsShellItemChangedReceived = false; + + public SelectBikePage() { } + + /// + /// Invoked when page is shown. + /// Starts update process. + /// + protected async override void OnAppearing() + { + if (m_oViewModel != null) + { + // No need to create view model, set binding context an items source if already done. + // If done twice tap events are fired multiple times (when hiding page using home button). + await m_oViewModel.OnAppearingOrRefresh(); + return; + } + + try + { + var model = App.ModelRoot; + + m_oViewModel = new SelectBikePageViewModel( + model.ActiveUser, + model, + App.PermissionsService, + App.BluetoothService, + Device.RuntimePlatform, + () => model.GetIsConnected(), + (isConnected) => model.GetConnector(isConnected), + App.LocationServicesContainer.Active, + model.LocksServices.Active, + model.Stations, + model.Polling, + model.PostAction, + model.SmartDevice, + this, + (url) => DependencyService.Get().OpenUrl(url)) + { + IsReportLevelVerbose = model.IsReportLevelVerbose + }; + } + catch (Exception exception) + { + Log.ForContext().Error("Displaying bikes at station page failed. {Exception}", exception); + await DisplayAlert( + AppResources.ErrorPageNotLoadedTitle, + $"{AppResources.ErrorPageNotLoaded}\r\n{exception.Message}", + AppResources.MessageAnswerOk); + return; + + } + + InitializeComponent(); + + BindingContext = m_oViewModel; + SelectBikeListView.ItemsSource = m_oViewModel; + + await m_oViewModel.OnAppearingOrRefresh(); + } + + /// + /// Invoked when page is disappearing to + /// - stop the update process + /// - to subscribe to events. + /// + protected async override void OnDisappearing() + { + if (!_IsShellItemChangedReceived && Shell.Current != null) + { + // Subscribe to events. + // Do not do this on startup because Shell.Current is null, if FindeBikePage is startup page. + Shell.Current.Navigated += (sender, e) => + { + if (e.Source != ShellNavigationSource.ShellItemChanged) + { + // Nothing to do. + return; + } + + // Reset previous user input after switch of pages to allow user to select a differnt bike if one has been selected before. + m_oViewModel.BikeIdUserInput = String.Empty; + }; + + } + + _IsShellItemChangedReceived = true; + + await (m_oViewModel?.OnDisappearing() ?? Task.CompletedTask); + } + + /// + /// Displays alert message. + /// + /// Title of message. + /// Message to display. + /// Type of buttons. + public new async Task DisplayAlert(string p_strTitle, string p_strMessage, string p_strCancel) + => await App.Current.MainPage.DisplayAlert(p_strTitle, p_strMessage, p_strCancel); + + /// Displays alert message. + /// Title of message. + /// Message to display. + /// Detailed error description. + /// Type of buttons. + public async Task DisplayAdvancedAlert( + string title, + string message, + string details, + string cancel) + => await App.Current.MainPage.DisplayAlert(title, $"{message}\r\nDetails:\r\n{details}", cancel); + + /// Displays detailed alert message. + /// Title of message. + /// Message to display. + /// Detailed error description. + /// Text of accept button. + /// Text of cancel button. + /// True if user pressed accept. + public async Task DisplayAdvancedAlert(string title, string message, string details, string accept, string cancel) + => await App.Current.MainPage.DisplayAlert(title, !string.IsNullOrEmpty(details) ? $"{message}\r\nDetails:\r\n{details}" : $"{message}", accept, cancel); + + /// + /// Displays alert message. + /// + /// Title of message. + /// Message to display. + /// Text of accept button. + /// Text of button. + /// True if user pressed accept. + public new async Task DisplayAlert(string p_strTitle, string p_strMessage, string p_strAccept, string p_strCancel) + => await App.Current.MainPage.DisplayAlert(p_strTitle, p_strMessage, p_strAccept, p_strCancel); + + /// Shows a page. + /// Route of the page to show. + public async Task ShowPage(string route) => await Shell.Current.GoToAsync(route); + + /// Pushes a page onto the modal stack. + /// Page to display. + public async Task PushModalAsync(ViewTypes typeOfPage) + => await Navigation.PushModalAsync((Page)Activator.CreateInstance(typeOfPage.GetViewType())); + + /// Pops a page from the modal stack. + public Task PopModalAsync() => throw new NotSupportedException(); + + /// Pushes a page onto the stack. + /// Page to display. + public Task PushAsync(ViewTypes p_oTypeOfPage) => throw new NotSupportedException(); + +#if USCSHARP9 + public async Task DisplayUserFeedbackPopup() => await Navigation.ShowPopupAsync(new FeedbackPopup()); +#else + public async Task DisplayUserFeedbackPopup(IBatteryMutable battery = null) => await Navigation.ShowPopupAsync(new FeedbackPopup(battery)); +#endif + } +} diff --git a/Meinkonrad/TINK/View/ViewTypesTypeProvider.cs b/Meinkonrad/TINK/View/ViewTypesTypeProvider.cs index 8614aa8..5078188 100644 --- a/Meinkonrad/TINK/View/ViewTypesTypeProvider.cs +++ b/Meinkonrad/TINK/View/ViewTypesTypeProvider.cs @@ -2,14 +2,16 @@ using System; using TINK.View.BikesAtStation; using TINK.View.Contact; using TINK.View.CopriWebView; -using TINK.View.Info; +using TINK.View.SelectBike; +using TINK.View.LegalInformation; +using TINK.View.Help; using TINK.View.Login; using TINK.View.Map; using TINK.View.MiniSurvey; using TINK.View.MyBikes; using TINK.View.Settings; using TINK.View.WhatsNew; -using TINK.View.WhatsNew.Agb; +using TINK.View.WhatsNew.Gtc; using Xamarin.Forms; namespace TINK.View @@ -38,17 +40,17 @@ namespace TINK.View case ViewTypes.SettingsPage: return typeof(SettingsPage); - case ViewTypes.TabbedPageInfo: - return typeof(InfoPage); + case ViewTypes.LegalInformationPage: + return typeof(LegalInformationPage); - case ViewTypes.FeesAndBikesPage: - return typeof(FeesAndBikesPage); + case ViewTypes.HelpPage: + return typeof(HelpPage); case ViewTypes.ManageAccountPage: return typeof(ManageAccountPage); - case ViewTypes.AgbPage: - return typeof(AgbPage); + case ViewTypes.GtcPage: + return typeof(GtcPage); case ViewTypes.WhatsNewPage: return typeof(WhatsNewPage); @@ -65,6 +67,9 @@ namespace TINK.View case ViewTypes.MiniSurvey: return typeof(MiniSurveyPage); + case ViewTypes.SelectBikePage: + return typeof(SelectBikePage); + default: return typeof(ContentPage); } diff --git a/Meinkonrad/TINK/View/WhatsNew/Gtc/GtcPage.xaml b/Meinkonrad/TINK/View/WhatsNew/Gtc/GtcPage.xaml new file mode 100644 index 0000000..7dd8bde --- /dev/null +++ b/Meinkonrad/TINK/View/WhatsNew/Gtc/GtcPage.xaml @@ -0,0 +1,21 @@ + + + + + + +