diff --git a/LastenradBayern/TINK.Android/Properties/AndroidManifest.xml b/LastenradBayern/TINK.Android/Properties/AndroidManifest.xml index 7b6667f..2b5bfeb 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 ec4f1a0..9165905 100644 --- a/LastenradBayern/TINK.iOS/Info.plist +++ b/LastenradBayern/TINK.iOS/Info.plist @@ -49,8 +49,8 @@ CFBundleDisplayName LastenradBayern CFBundleVersion - 263 + 264 CFBundleShortVersionString - 3.0.263 + 3.0.264 diff --git a/LastenradBayern/TINK/View/Map/MapPage.xaml.cs b/LastenradBayern/TINK/View/Map/MapPage.xaml.cs index 4c6b1bc..5f74ae7 100644 --- a/LastenradBayern/TINK/View/Map/MapPage.xaml.cs +++ b/LastenradBayern/TINK/View/Map/MapPage.xaml.cs @@ -139,18 +139,11 @@ namespace TINK.View.Map #if TRYNOTBACKSTYLE MapPageViewModel = new MapPageViewModel(); #else - MapPageViewModel = new MapPageViewModel( - App.ModelRoot, - App.PermissionsService, - App.BluetoothService, - App.GeolocationServicesContainer.Active, - (mapspan) => MyMap.MoveToRegion(mapspan), - this, - Navigation); + MapPageViewModel = CreateMapPageViewModel(); #endif - } catch (Exception exception) + } + catch (Exception exception) { - Log.ForContext().Error("Constructing map page view model failed. {Exception}", exception); return; } @@ -171,15 +164,7 @@ namespace TINK.View.Map try { - if (Device.RuntimePlatform == Device.iOS) - { - TINKButton.BackgroundColor = Color.LightGray; - TINKButton.BorderColor = Color.Black; - TINKButton.Margin = new Thickness(10, 10, 10, 10); - KonradButton.BackgroundColor = Color.LightGray; - KonradButton.BorderColor = Color.Black; - KonradButton.Margin = new Thickness(10, 10, 10, 10); - } + ApplyCustomiOSStyling(); } catch (Exception exception) { @@ -201,12 +186,9 @@ namespace TINK.View.Map try { // Pre move and scanle maps to avoid initial display of map in Rome. - Log.ForContext().Verbose("Moving and scaling map."); - MapPageViewModel.MoveAndScale( - (mapSpan) => MyMap.MoveToRegion(mapSpan), - App.ModelRoot.MapSpan); + PremoveAndScaleMap(); } - catch(Exception exception) + catch (Exception exception) { // Continue because a map not beeing moved/ scaled is no reason for aborting startup. Log.ForContext().Error("Moving and scaling map failed. {Exception}", exception); @@ -224,6 +206,49 @@ namespace TINK.View.Map } } + /// + /// Premoves the Map to a certain location. + /// + private void PremoveAndScaleMap() + { + Log.ForContext().Verbose("Moving and scaling map."); + MapPageViewModel.MoveAndScale( + (mapSpan) => MyMap.MoveToRegion(mapSpan), + App.ModelRoot.MapSpan); + } + + /// + /// Creates the Map Page's view model. + /// + private MapPageViewModel CreateMapPageViewModel() + { + Log.ForContext().Verbose("Constructing map page view model."); + return new MapPageViewModel( + App.ModelRoot, + App.PermissionsService, + App.BluetoothService, + App.GeolocationServicesContainer.Active, + (mapspan) => MyMap.MoveToRegion(mapspan), + this, + Navigation); + } + + /// + /// Applies iOS specific styling to branded Buttons. + /// + private void ApplyCustomiOSStyling() + { + if (Device.RuntimePlatform == Device.iOS) + { + TINKButton.BackgroundColor = Color.LightGray; + TINKButton.BorderColor = Color.Black; + TINKButton.Margin = new Thickness(10, 10, 10, 10); + KonradButton.BackgroundColor = Color.LightGray; + KonradButton.BorderColor = Color.Black; + KonradButton.Margin = new Thickness(10, 10, 10, 10); + } + } + /// /// Invoked when pages is closed/ hidden. /// Stops update process. diff --git a/Meinkonrad/TINK.Android/Properties/AndroidManifest.xml b/Meinkonrad/TINK.Android/Properties/AndroidManifest.xml index 88ea247..e8d4d82 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 4167c2a..f083eab 100644 --- a/Meinkonrad/TINK.iOS/Info.plist +++ b/Meinkonrad/TINK.iOS/Info.plist @@ -49,8 +49,8 @@ CFBundleDisplayName Mein konrad CFBundleVersion - 263 + 264 CFBundleShortVersionString - 3.0.263 + 3.0.264 diff --git a/Meinkonrad/TINK/View/Map/MapPage.xaml.cs b/Meinkonrad/TINK/View/Map/MapPage.xaml.cs index 4c6b1bc..5f74ae7 100644 --- a/Meinkonrad/TINK/View/Map/MapPage.xaml.cs +++ b/Meinkonrad/TINK/View/Map/MapPage.xaml.cs @@ -139,18 +139,11 @@ namespace TINK.View.Map #if TRYNOTBACKSTYLE MapPageViewModel = new MapPageViewModel(); #else - MapPageViewModel = new MapPageViewModel( - App.ModelRoot, - App.PermissionsService, - App.BluetoothService, - App.GeolocationServicesContainer.Active, - (mapspan) => MyMap.MoveToRegion(mapspan), - this, - Navigation); + MapPageViewModel = CreateMapPageViewModel(); #endif - } catch (Exception exception) + } + catch (Exception exception) { - Log.ForContext().Error("Constructing map page view model failed. {Exception}", exception); return; } @@ -171,15 +164,7 @@ namespace TINK.View.Map try { - if (Device.RuntimePlatform == Device.iOS) - { - TINKButton.BackgroundColor = Color.LightGray; - TINKButton.BorderColor = Color.Black; - TINKButton.Margin = new Thickness(10, 10, 10, 10); - KonradButton.BackgroundColor = Color.LightGray; - KonradButton.BorderColor = Color.Black; - KonradButton.Margin = new Thickness(10, 10, 10, 10); - } + ApplyCustomiOSStyling(); } catch (Exception exception) { @@ -201,12 +186,9 @@ namespace TINK.View.Map try { // Pre move and scanle maps to avoid initial display of map in Rome. - Log.ForContext().Verbose("Moving and scaling map."); - MapPageViewModel.MoveAndScale( - (mapSpan) => MyMap.MoveToRegion(mapSpan), - App.ModelRoot.MapSpan); + PremoveAndScaleMap(); } - catch(Exception exception) + catch (Exception exception) { // Continue because a map not beeing moved/ scaled is no reason for aborting startup. Log.ForContext().Error("Moving and scaling map failed. {Exception}", exception); @@ -224,6 +206,49 @@ namespace TINK.View.Map } } + /// + /// Premoves the Map to a certain location. + /// + private void PremoveAndScaleMap() + { + Log.ForContext().Verbose("Moving and scaling map."); + MapPageViewModel.MoveAndScale( + (mapSpan) => MyMap.MoveToRegion(mapSpan), + App.ModelRoot.MapSpan); + } + + /// + /// Creates the Map Page's view model. + /// + private MapPageViewModel CreateMapPageViewModel() + { + Log.ForContext().Verbose("Constructing map page view model."); + return new MapPageViewModel( + App.ModelRoot, + App.PermissionsService, + App.BluetoothService, + App.GeolocationServicesContainer.Active, + (mapspan) => MyMap.MoveToRegion(mapspan), + this, + Navigation); + } + + /// + /// Applies iOS specific styling to branded Buttons. + /// + private void ApplyCustomiOSStyling() + { + if (Device.RuntimePlatform == Device.iOS) + { + TINKButton.BackgroundColor = Color.LightGray; + TINKButton.BorderColor = Color.Black; + TINKButton.Margin = new Thickness(10, 10, 10, 10); + KonradButton.BackgroundColor = Color.LightGray; + KonradButton.BorderColor = Color.Black; + KonradButton.Margin = new Thickness(10, 10, 10, 10); + } + } + /// /// Invoked when pages is closed/ hidden. /// Stops update process. diff --git a/TINK/TINK.Android/Properties/AndroidManifest.xml b/TINK/TINK.Android/Properties/AndroidManifest.xml index cadaa50..389b3ef 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 33aedb5..820913f 100644 --- a/TINK/TINK.iOS/Info.plist +++ b/TINK/TINK.iOS/Info.plist @@ -49,8 +49,8 @@ CFBundleDisplayName sharee.bike CFBundleVersion - 263 + 264 CFBundleShortVersionString - 3.0.263 + 3.0.264 diff --git a/TINK/TINK/View/Map/MapPage.xaml.cs b/TINK/TINK/View/Map/MapPage.xaml.cs index d5dd31c..5f74ae7 100644 --- a/TINK/TINK/View/Map/MapPage.xaml.cs +++ b/TINK/TINK/View/Map/MapPage.xaml.cs @@ -125,9 +125,8 @@ namespace TINK.View.Map public INavigationMasterDetail NavigationMasterDetail { private get; set; } #endif - /// - /// Invoked when page is shown. + /// Invoked when page is shown. /// Starts update process. /// protected async override void OnAppearing() @@ -140,18 +139,11 @@ namespace TINK.View.Map #if TRYNOTBACKSTYLE MapPageViewModel = new MapPageViewModel(); #else - MapPageViewModel = new MapPageViewModel( - App.ModelRoot, - App.PermissionsService, - App.BluetoothService, - App.GeolocationServicesContainer.Active, - (mapspan) => MyMap.MoveToRegion(mapspan), - this, - Navigation); + MapPageViewModel = CreateMapPageViewModel(); #endif - } catch (Exception exception) + } + catch (Exception exception) { - Log.ForContext().Error("Constructing map page view model failed. {Exception}", exception); return; } @@ -172,15 +164,7 @@ namespace TINK.View.Map try { - if (Device.RuntimePlatform == Device.iOS) - { - TINKButton.BackgroundColor = Color.LightGray; - TINKButton.BorderColor = Color.Black; - TINKButton.Margin = new Thickness(10, 10, 10, 10); - KonradButton.BackgroundColor = Color.LightGray; - KonradButton.BorderColor = Color.Black; - KonradButton.Margin = new Thickness(10, 10, 10, 10); - } + ApplyCustomiOSStyling(); } catch (Exception exception) { @@ -202,12 +186,9 @@ namespace TINK.View.Map try { // Pre move and scanle maps to avoid initial display of map in Rome. - Log.ForContext().Verbose("Moving and scaling map."); - MapPageViewModel.MoveAndScale( - (mapSpan) => MyMap.MoveToRegion(mapSpan), - App.ModelRoot.MapSpan); + PremoveAndScaleMap(); } - catch(Exception exception) + catch (Exception exception) { // Continue because a map not beeing moved/ scaled is no reason for aborting startup. Log.ForContext().Error("Moving and scaling map failed. {Exception}", exception); @@ -226,7 +207,50 @@ namespace TINK.View.Map } /// - /// Invoked when pages is closed/ hidden. + /// Premoves the Map to a certain location. + /// + private void PremoveAndScaleMap() + { + Log.ForContext().Verbose("Moving and scaling map."); + MapPageViewModel.MoveAndScale( + (mapSpan) => MyMap.MoveToRegion(mapSpan), + App.ModelRoot.MapSpan); + } + + /// + /// Creates the Map Page's view model. + /// + private MapPageViewModel CreateMapPageViewModel() + { + Log.ForContext().Verbose("Constructing map page view model."); + return new MapPageViewModel( + App.ModelRoot, + App.PermissionsService, + App.BluetoothService, + App.GeolocationServicesContainer.Active, + (mapspan) => MyMap.MoveToRegion(mapspan), + this, + Navigation); + } + + /// + /// Applies iOS specific styling to branded Buttons. + /// + private void ApplyCustomiOSStyling() + { + if (Device.RuntimePlatform == Device.iOS) + { + TINKButton.BackgroundColor = Color.LightGray; + TINKButton.BorderColor = Color.Black; + TINKButton.Margin = new Thickness(10, 10, 10, 10); + KonradButton.BackgroundColor = Color.LightGray; + KonradButton.BorderColor = Color.Black; + KonradButton.Margin = new Thickness(10, 10, 10, 10); + } + } + + /// + /// Invoked when pages is closed/ hidden. /// Stops update process. /// protected override async void OnDisappearing() @@ -236,6 +260,7 @@ namespace TINK.View.Map // View model might be null. await MapPageViewModel?.OnDisappearing(); } + base.OnDisappearing(); } } diff --git a/TINKLib/Model/WhatsNew.cs b/TINKLib/Model/WhatsNew.cs index 7b45564..90ee57d 100644 --- a/TINKLib/Model/WhatsNew.cs +++ b/TINKLib/Model/WhatsNew.cs @@ -462,6 +462,10 @@ namespace TINK.Model { new Version(3, 0, 263), AppResources.ChangeLog3_0_263 + }, + { + new Version(3, 0, 264), + AppResources.ChangeLog3_0_264 } }; diff --git a/TINKLib/MultilingualResources/AppResources.Designer.cs b/TINKLib/MultilingualResources/AppResources.Designer.cs index 3e7e24e..7466e7c 100644 --- a/TINKLib/MultilingualResources/AppResources.Designer.cs +++ b/TINKLib/MultilingualResources/AppResources.Designer.cs @@ -19,7 +19,7 @@ namespace TINK.MultilingualResources { // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public class AppResources { @@ -880,6 +880,15 @@ namespace TINK.MultilingualResources { } } + /// + /// Looks up a localized string similar to Bug "object reference not set ...." <a href="https://dev.azure.com/TeilRad/sharee.bike%20App/_workitems/edit/186">185</a> fixed.. + /// + public static string ChangeLog3_0_264 { + get { + return ResourceManager.GetString("ChangeLog3_0_264", resourceCulture); + } + } + /// /// Looks up a localized string similar to Lock of rented bike can not be found.. /// diff --git a/TINKLib/MultilingualResources/AppResources.de.resx b/TINKLib/MultilingualResources/AppResources.de.resx index 378dfb4..5531d7f 100644 --- a/TINKLib/MultilingualResources/AppResources.de.resx +++ b/TINKLib/MultilingualResources/AppResources.de.resx @@ -713,4 +713,7 @@ Kleine Verbesserungen. Bei Fahrrädern mit GPS-Schloss wird die CO2-Einsparung nach der Rückgabe des Fahrrads angezeigt. + + Fehler "object reference not set ...." <a href="https://dev.azure.com/TeilRad/sharee.bike%20App/_workitems/edit/186">185</a> behoben. + \ No newline at end of file diff --git a/TINKLib/MultilingualResources/AppResources.resx b/TINKLib/MultilingualResources/AppResources.resx index 4d8c35f..1a78eb4 100644 --- a/TINKLib/MultilingualResources/AppResources.resx +++ b/TINKLib/MultilingualResources/AppResources.resx @@ -808,4 +808,7 @@ Minor improvements. CO2 saving is displayed for bikes with GPS-lock after returning bike. + + Bug "object reference not set ...." <a href="https://dev.azure.com/TeilRad/sharee.bike%20App/_workitems/edit/186">185</a> fixed. + \ No newline at end of file diff --git a/TINKLib/MultilingualResources/TINKLib.de.xlf b/TINKLib/MultilingualResources/TINKLib.de.xlf index f6762ec..4fc4009 100644 --- a/TINKLib/MultilingualResources/TINKLib.de.xlf +++ b/TINKLib/MultilingualResources/TINKLib.de.xlf @@ -956,6 +956,10 @@ Kleine Verbesserungen. CO2 saving is displayed for bikes with GPS-lock after returning bike. Bei Fahrrädern mit GPS-Schloss wird die CO2-Einsparung nach der Rückgabe des Fahrrads angezeigt. + + Bug "object reference not set ...." <a href="https://dev.azure.com/TeilRad/sharee.bike%20App/_workitems/edit/186">185</a> fixed. + Fehler "object reference not set ...." <a href="https://dev.azure.com/TeilRad/sharee.bike%20App/_workitems/edit/186">185</a> behoben. + diff --git a/TINKLib/ViewModel/Contact/SelectStationPageViewModel.cs b/TINKLib/ViewModel/Contact/SelectStationPageViewModel.cs index 6e857fd..d0b5e64 100644 --- a/TINKLib/ViewModel/Contact/SelectStationPageViewModel.cs +++ b/TINKLib/ViewModel/Contact/SelectStationPageViewModel.cs @@ -408,7 +408,7 @@ namespace TINK.ViewModel.Contact } catch (Exception l_oException) { - Log.ForContext().Error($"An error occurred switching view TINK/ Konrad.\r\n{l_oException.Message}"); + Log.ForContext().Error($"An error occurred opening select station page.\r\n{l_oException.Message}"); IsRunning = false; diff --git a/TINKLib/ViewModel/Map/MapPageViewModel.cs b/TINKLib/ViewModel/Map/MapPageViewModel.cs index 8efa9dd..86abe9e 100644 --- a/TINKLib/ViewModel/Map/MapPageViewModel.cs +++ b/TINKLib/ViewModel/Map/MapPageViewModel.cs @@ -97,7 +97,7 @@ namespace TINK.ViewModel.Map /// False if user tabed on station marker to show bikes at a given station. private bool isMapPageEnabled = false; - Model.Services.Geolocation.IGeolocation GeolocationService { get; } + IGeolocation GeolocationService { get; } /// False if user tabed on station marker to show bikes at a given station. public bool IsMapPageEnabled { @@ -431,11 +431,14 @@ namespace TINK.ViewModel.Map Log.ForContext().Error("Getting location failed. {Exception}", ex); } - TinkApp.MapSpan = MapSpan.FromCenterAndRadius( - new Xamarin.Forms.GoogleMaps.Position(currentLocation.Latitude, currentLocation.Longitude), - TinkApp.MapSpan.Radius); + if (currentLocation != null) + { + TinkApp.MapSpan = MapSpan.FromCenterAndRadius( + new Xamarin.Forms.GoogleMaps.Position(currentLocation.Latitude, currentLocation.Longitude), + TinkApp.MapSpan.Radius); - TinkApp.Save(); + TinkApp.Save(); + } } MoveAndScale(m_oMoveToRegionDelegate, TinkApp.MapSpan); @@ -461,7 +464,7 @@ namespace TINK.ViewModel.Map } catch (Exception l_oException) { - Log.ForContext().Error($"An error occurred switching view TINK/ Konrad.\r\n{l_oException.Message}"); + Log.ForContext().Error($"An error occurred showing bike stations page.\r\n{l_oException.Message}"); IsRunning = false; @@ -882,11 +885,14 @@ namespace TINK.ViewModel.Map Log.ForContext().Error("Getting location failed. {Exception}", ex); } - TinkApp.MapSpan = MapSpan.FromCenterAndRadius( + if (currentLocation != null) + { + TinkApp.MapSpan = MapSpan.FromCenterAndRadius( new Xamarin.Forms.GoogleMaps.Position(currentLocation.Latitude, currentLocation.Longitude), TinkApp.MapSpan.Radius); - TinkApp.Save(); + TinkApp.Save(); + } } // Update stations diff --git a/TestShareeLib/Model/MiniSurvey/TestMiniSurveyModel.cs b/TestShareeLib/Model/MiniSurvey/TestMiniSurveyModel.cs index fd4f8bb..4b7ea16 100644 --- a/TestShareeLib/Model/MiniSurvey/TestMiniSurveyModel.cs +++ b/TestShareeLib/Model/MiniSurvey/TestMiniSurveyModel.cs @@ -16,11 +16,6 @@ namespace TestShareeLib.Model.MiniSurvey new MiniSurveyModel().Questions.Count, Is.EqualTo(0), "Question collection must not be null"); - - Assert.That( - new MiniSurveyModel().Questions, - Is.EqualTo(0), - "Question collection must not be null"); } } } diff --git a/TestTINKLib/Fixtures/ObjectTests/ViewModel/Map/TestMapPageViewModel.cs b/TestTINKLib/Fixtures/ObjectTests/ViewModel/Map/TestMapPageViewModel.cs index 5df22f7..314910b 100644 --- a/TestTINKLib/Fixtures/ObjectTests/ViewModel/Map/TestMapPageViewModel.cs +++ b/TestTINKLib/Fixtures/ObjectTests/ViewModel/Map/TestMapPageViewModel.cs @@ -80,7 +80,7 @@ namespace TestShareeLib.UseCases.Startup Assert.AreEqual(21, viewModel.Pins.Count); // Were 8 pins when loading from CopriCallsMemory(SampleSets.Set2, 1, sessionCookie) Assert.That( viewModel.Pins.FirstOrDefault(pin => pin.Icon.Id.Contains("Open_Green")).Tag, - Is.EqualTo("FR105"), + Is.EqualTo("FR103"), "Station FR105 must be marked green because there is are bike."); Assert.That( viewModel.Pins.FirstOrDefault(pin => pin.Icon.Id.Contains("Open_Red")).Tag,