diff --git a/.editorconfig b/.editorconfig index 3e013bb..cf3a7e8 100644 --- a/.editorconfig +++ b/.editorconfig @@ -4,21 +4,13 @@ root = true # All files [*] -indent_style = space - -# XML project files -[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}] -indent_size = 2 - -# XML config files -[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}] -indent_size = 2 - -# Code files -[*.{cs,csx,vb,vbx}] -indent_size = 4 +indent_style = tab +tab_width = 4 insert_final_newline = true -charset = utf-8-bom +trim_trailing_whitespace = true +charset = utf-8 +end_of_line = crlf + ############################### # .NET Coding Conventions # ############################### @@ -139,4 +131,4 @@ csharp_style_expression_bodied_local_functions = false:silent ############################### [*.vb] # Modifier preferences -visual_basic_preferred_modifier_order = Partial,Default,Private,Protected,Public,Friend,NotOverridable,Overridable,MustOverride,Overloads,Overrides,MustInherit,NotInheritable,Static,Shared,Shadows,ReadOnly,WriteOnly,Dim,Const,WithEvents,Widening,Narrowing,Custom,Async:suggestion \ No newline at end of file +visual_basic_preferred_modifier_order = Partial,Default,Private,Protected,Public,Friend,NotOverridable,Overridable,MustOverride,Overloads,Overrides,MustInherit,NotInheritable,Static,Shared,Shadows,ReadOnly,WriteOnly,Dim,Const,WithEvents,Widening,Narrowing,Custom,Async:suggestion diff --git a/LastenradBayern/TINK.Android/MainActivity.cs b/LastenradBayern/TINK.Android/MainActivity.cs index 033c3dd..1eea213 100644 --- a/LastenradBayern/TINK.Android/MainActivity.cs +++ b/LastenradBayern/TINK.Android/MainActivity.cs @@ -13,96 +13,96 @@ using Xamarin.Forms.Platform.Android.AppLinks; namespace TINK.Droid { - [Activity(Label = "LastenradBayern", Icon = "@drawable/sharee", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)] + [Activity(Label = "LastenradBayern", Icon = "@drawable/sharee", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)] - [IntentFilter(new[] { Intent.ActionView }, - Categories = new[] { Intent.ActionView, Intent.CategoryBrowsable, Intent.CategoryDefault }, - DataScheme = "https", - DataHost = "sharee.bike", - DataPathPrefix = "/lastenrad", - AutoVerify = true)] + [IntentFilter(new[] { Intent.ActionView }, + Categories = new[] { Intent.ActionView, Intent.CategoryBrowsable, Intent.CategoryDefault }, + DataScheme = "https", + DataHost = "sharee.bike", + DataPathPrefix = "/lastenrad", + AutoVerify = true)] - [IntentFilter(new[] { Intent.ActionView }, - Categories = new[] { Intent.ActionView, Intent.CategoryBrowsable, Intent.CategoryDefault }, - DataScheme = "http", - DataHost = "sharee.bike", - DataPathPrefix = "/lastenrad", - AutoVerify = true)] + [IntentFilter(new[] { Intent.ActionView }, + Categories = new[] { Intent.ActionView, Intent.CategoryBrowsable, Intent.CategoryDefault }, + DataScheme = "http", + DataHost = "sharee.bike", + DataPathPrefix = "/lastenrad", + AutoVerify = true)] - public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity - { - private void initFontScale() - { - Configuration configuration = Resources.Configuration; - configuration.FontScale = (float)1; - //0.85 small, 1 standard, 1.15 big,1.3 more bigger ,1.45 supper big - DisplayMetrics metrics = new DisplayMetrics(); - WindowManager.DefaultDisplay.GetMetrics(metrics); - metrics.ScaledDensity = configuration.FontScale * metrics.Density; - BaseContext.Resources.UpdateConfiguration(configuration, metrics); - } - protected override void OnCreate(Bundle bundle) - { - initFontScale(); + public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity + { + private void initFontScale() + { + Configuration configuration = Resources.Configuration; + configuration.FontScale = (float)1; + //0.85 small, 1 standard, 1.15 big,1.3 more bigger ,1.45 supper big + DisplayMetrics metrics = new DisplayMetrics(); + WindowManager.DefaultDisplay.GetMetrics(metrics); + metrics.ScaledDensity = configuration.FontScale * metrics.Density; + BaseContext.Resources.UpdateConfiguration(configuration, metrics); + } + protected override void OnCreate(Bundle bundle) + { + initFontScale(); - TabLayoutResource = Resource.Layout.Tabbar; - ToolbarResource = Resource.Layout.Toolbar; + TabLayoutResource = Resource.Layout.Tabbar; + ToolbarResource = Resource.Layout.Toolbar; - base.OnCreate(bundle); + base.OnCreate(bundle); - global::Xamarin.Forms.Forms.Init(this, bundle); + global::Xamarin.Forms.Forms.Init(this, bundle); - FirebaseApp.InitializeApp(this); - AndroidAppLinks.Init(this); + FirebaseApp.InitializeApp(this); + AndroidAppLinks.Init(this); - // Initialize xamarin.essentials, see https://docs.microsoft.com/en-us/xamarin/essentials/get-started?tabs=macos%2Candroid. - Xamarin.Essentials.Platform.Init(this, bundle); + // Initialize xamarin.essentials, see https://docs.microsoft.com/en-us/xamarin/essentials/get-started?tabs=macos%2Candroid. + Xamarin.Essentials.Platform.Init(this, bundle); - // Required for initialization of Maps, see https://developer.xamarin.com/guides/xamarin-forms/user-interface/map/ - Xamarin.FormsGoogleMaps.Init(this, bundle); + // Required for initialization of Maps, see https://developer.xamarin.com/guides/xamarin-forms/user-interface/map/ + Xamarin.FormsGoogleMaps.Init(this, bundle); - // Required for initialization of binding package, see https://github.com/nuitsjp/Xamarin.Forms.GoogleMaps.Bindings. - Xamarin.FormsGoogleMapsBindings.Init(); + // Required for initialization of binding package, see https://github.com/nuitsjp/Xamarin.Forms.GoogleMaps.Bindings. + Xamarin.FormsGoogleMapsBindings.Init(); - // Get version name of app. - Context context = ApplicationContext; - new Model.Device.AppInfo(context.PackageManager.GetPackageInfo(context.PackageName, 0).VersionName); + // Get version name of app. + Context context = ApplicationContext; + new Model.Device.AppInfo(context.PackageManager.GetPackageInfo(context.PackageName, 0).VersionName); - Xamarin.Forms.Forms.ViewInitialized += (object sender, Xamarin.Forms.ViewInitializedEventArgs e) => - { - if (!string.IsNullOrWhiteSpace(e.View.AutomationId)) - { - e.NativeView.ContentDescription = e.View.AutomationId; - } - }; + Xamarin.Forms.Forms.ViewInitialized += (object sender, Xamarin.Forms.ViewInitializedEventArgs e) => + { + if (!string.IsNullOrWhiteSpace(e.View.AutomationId)) + { + e.NativeView.ContentDescription = e.View.AutomationId; + } + }; - LoadApplication(new App()); - } + LoadApplication(new App()); + } - /// - /// Handles opening the dialog to request for permissions. - /// - public override void OnRequestPermissionsResult(int requestCode, string[] permissions, Android.Content.PM.Permission[] grantResults) - { - if (App.PermissionsService.GetType() == typeof(TINK.Services.Permissions.Essentials.Permissions)) - { - Xamarin.Essentials.Platform.OnRequestPermissionsResult(requestCode, permissions, grantResults); - } - else if (App.PermissionsService.GetType() == typeof(TINK.Services.Permissions.Plugin.Permissions)) - { - // Bug in 3.0.244 and earlier versions of sharee.bike app: Call of PermissionsImplementation.Current.OnRequestedPermission result was missing. - // see https://dev.azure.com/TeilRad/sharee.bike%20Buchungsplattform/_workitems/edit/136 for further details. - PermissionsImplementation.Current.OnRequestPermissionsResult(requestCode, permissions, grantResults); - } + /// + /// Handles opening the dialog to request for permissions. + /// + public override void OnRequestPermissionsResult(int requestCode, string[] permissions, Android.Content.PM.Permission[] grantResults) + { + if (App.PermissionsService.GetType() == typeof(TINK.Services.Permissions.Essentials.Permissions)) + { + Xamarin.Essentials.Platform.OnRequestPermissionsResult(requestCode, permissions, grantResults); + } + else if (App.PermissionsService.GetType() == typeof(TINK.Services.Permissions.Plugin.Permissions)) + { + // Bug in 3.0.244 and earlier versions of sharee.bike app: Call of PermissionsImplementation.Current.OnRequestedPermission result was missing. + // see https://dev.azure.com/TeilRad/sharee.bike%20Buchungsplattform/_workitems/edit/136 for further details. + PermissionsImplementation.Current.OnRequestPermissionsResult(requestCode, permissions, grantResults); + } - base.OnRequestPermissionsResult(requestCode, permissions, grantResults); - } + base.OnRequestPermissionsResult(requestCode, permissions, grantResults); + } - [Export("TapStation")] - public void TapStation(string stationNr) - { - BackdoorMethodHelpers.DoTapPage(stationNr); - } - } + [Export("TapStation")] + public void TapStation(string stationNr) + { + BackdoorMethodHelpers.DoTapPage(stationNr); + } + } } diff --git a/LastenradBayern/TINK.Android/Model/Device/AppInfo.cs b/LastenradBayern/TINK.Android/Model/Device/AppInfo.cs index 58b23f0..8febfc6 100644 --- a/LastenradBayern/TINK.Android/Model/Device/AppInfo.cs +++ b/LastenradBayern/TINK.Android/Model/Device/AppInfo.cs @@ -6,40 +6,40 @@ using Xamarin.Forms; [assembly: Dependency(typeof(AppInfo))] namespace TINK.Droid.Model.Device { - /// Holds information about the TINK- app. - public class AppInfo : IAppInfo - { - /// Holds the the version of the app. - private static Version m_oVersion = null; + /// Holds information about the TINK- app. + public class AppInfo : IAppInfo + { + /// Holds the the version of the app. + private static Version m_oVersion = null; - /// Constructs a app info object. - public AppInfo() - { - } + /// Constructs a app info object. + public AppInfo() + { + } - /// Constructs a app info object for initialization. - /// Version to initializ object with. - internal AppInfo(string p_strVersionText) - { - if (m_oVersion != null) - { - // Set version only once. - return; - } + /// Constructs a app info object for initialization. + /// Version to initializ object with. + internal AppInfo(string p_strVersionText) + { + if (m_oVersion != null) + { + // Set version only once. + return; + } - if (!Version.TryParse(p_strVersionText, out Version l_oVersion)) - { - m_oVersion = new Version(0, 8); - } + if (!Version.TryParse(p_strVersionText, out Version l_oVersion)) + { + m_oVersion = new Version(0, 8); + } - m_oVersion = l_oVersion; - } + m_oVersion = l_oVersion; + } - /// Get the version of the app. - public Version Version => m_oVersion ?? new Version(0, 9); + /// Get the version of the app. + public Version Version => m_oVersion ?? new Version(0, 9); - /// Gets the URL to the app store. - /// The store URL. - public string StoreUrl => $"https://play.google.com/store/apps/details?id={Android.App.Application.Context.PackageName}"; - } + /// Gets the URL to the app store. + /// The store URL. + public string StoreUrl => $"https://play.google.com/store/apps/details?id={Android.App.Application.Context.PackageName}"; + } } \ No newline at end of file diff --git a/LastenradBayern/TINK.Android/Model/Device/Device.cs b/LastenradBayern/TINK.Android/Model/Device/Device.cs index d01840b..d4c162b 100644 --- a/LastenradBayern/TINK.Android/Model/Device/Device.cs +++ b/LastenradBayern/TINK.Android/Model/Device/Device.cs @@ -5,19 +5,19 @@ using Xamarin.Forms; [assembly: Dependency(typeof(TINK.Droid.Model.Device.Device))] namespace TINK.Droid.Model.Device { - public class Device : ISmartDevice - { - public string Manufacturer => DeviceInfo.Manufacturer; + public class Device : ISmartDevice + { + public string Manufacturer => DeviceInfo.Manufacturer; - public string Model => DeviceInfo.Model; + public string Model => DeviceInfo.Model; - public DevicePlatform Platform => DeviceInfo.Platform; + public DevicePlatform Platform => DeviceInfo.Platform; - public string VersionText => DeviceInfo.VersionString; + public string VersionText => DeviceInfo.VersionString; - /// Gets unitque device identifier. - /// Gets the identifies specifying device. - public string Identifier - => Android.Provider.Settings.Secure.GetString(Android.App.Application.Context.ContentResolver, Android.Provider.Settings.Secure.AndroidId); - } + /// Gets unitque device identifier. + /// Gets the identifies specifying device. + public string Identifier + => Android.Provider.Settings.Secure.GetString(Android.App.Application.Context.ContentResolver, Android.Provider.Settings.Secure.AndroidId); + } } \ No newline at end of file diff --git a/LastenradBayern/TINK.Android/Model/Device/ExternalBrowseService.cs b/LastenradBayern/TINK.Android/Model/Device/ExternalBrowseService.cs index a971c11..15bb1e6 100644 --- a/LastenradBayern/TINK.Android/Model/Device/ExternalBrowseService.cs +++ b/LastenradBayern/TINK.Android/Model/Device/ExternalBrowseService.cs @@ -6,18 +6,18 @@ using Xamarin.Forms; [assembly: Dependency(typeof(ExternalBrowseService))] namespace TINK.Droid.Model.Device { - public class ExternalBrowseService : IExternalBrowserService - { - /// Opens an external browser. - /// Url to open. - public void OpenUrl(string p_strUrl) - { - var uri = Android.Net.Uri.Parse(p_strUrl); - var intent = new Intent(Intent.ActionView, uri); + public class ExternalBrowseService : IExternalBrowserService + { + /// Opens an external browser. + /// Url to open. + public void OpenUrl(string p_strUrl) + { + var uri = Android.Net.Uri.Parse(p_strUrl); + var intent = new Intent(Intent.ActionView, uri); - intent.AddFlags(ActivityFlags.NewTask); + intent.AddFlags(ActivityFlags.NewTask); - Android.App.Application.Context.StartActivity(intent); - } - } + Android.App.Application.Context.StartActivity(intent); + } + } } \ No newline at end of file diff --git a/LastenradBayern/TINK.Android/Model/Device/Gps.cs b/LastenradBayern/TINK.Android/Model/Device/Gps.cs index dfa055f..9087413 100644 --- a/LastenradBayern/TINK.Android/Model/Device/Gps.cs +++ b/LastenradBayern/TINK.Android/Model/Device/Gps.cs @@ -16,15 +16,15 @@ using Xamarin.Forms; [assembly: Dependency(typeof(TINK.Droid.Model.Device.Gps))] namespace TINK.Droid.Model.Device { - public class Gps : IGeolodationDependent - { - public bool IsGeolcationEnabled - { - get - { - LocationManager locationManager = (LocationManager)Android.App.Application.Context.GetSystemService(Context.LocationService); - return locationManager.IsProviderEnabled(LocationManager.GpsProvider); - } - } - } + public class Gps : IGeolodationDependent + { + public bool IsGeolcationEnabled + { + get + { + LocationManager locationManager = (LocationManager)Android.App.Application.Context.GetSystemService(Context.LocationService); + return locationManager.IsProviderEnabled(LocationManager.GpsProvider); + } + } + } } \ No newline at end of file diff --git a/LastenradBayern/TINK.Android/Model/Device/SpecialFolder.cs b/LastenradBayern/TINK.Android/Model/Device/SpecialFolder.cs index 3ca8eae..d07b4cb 100644 --- a/LastenradBayern/TINK.Android/Model/Device/SpecialFolder.cs +++ b/LastenradBayern/TINK.Android/Model/Device/SpecialFolder.cs @@ -6,44 +6,44 @@ using Xamarin.Forms; [assembly: Dependency(typeof(TINK.Droid.Model.Device.SpecialFolder))] namespace TINK.Droid.Model.Device { - public class SpecialFolder : ISpecialFolder - { - /// Get the folder name of external folder to write to. - /// Name of the external folder. - public string GetExternalFilesDir() - { - string baseFolderPath = string.Empty; - try - { - var context = Android.App.Application.Context; - Java.IO.File[] dirs = context.GetExternalFilesDirs(null); + public class SpecialFolder : ISpecialFolder + { + /// Get the folder name of external folder to write to. + /// Name of the external folder. + public string GetExternalFilesDir() + { + string baseFolderPath = string.Empty; + try + { + var context = Android.App.Application.Context; + Java.IO.File[] dirs = context.GetExternalFilesDirs(null); - foreach (Java.IO.File folder in dirs) - { - bool IsRemovable = Android.OS.Environment.InvokeIsExternalStorageRemovable(folder); - bool IsEmulated = Android.OS.Environment.InvokeIsExternalStorageEmulated(folder); + foreach (Java.IO.File folder in dirs) + { + bool IsRemovable = Android.OS.Environment.InvokeIsExternalStorageRemovable(folder); + bool IsEmulated = Android.OS.Environment.InvokeIsExternalStorageEmulated(folder); - if (IsRemovable - && !IsEmulated) - { - baseFolderPath = folder.Path; - } - } - } + if (IsRemovable + && !IsEmulated) + { + baseFolderPath = folder.Path; + } + } + } - catch (Exception l_oException) - { - Log.Error("Getting external files directory failed. {@l_oException}", l_oException); - } + catch (Exception l_oException) + { + Log.Error("Getting external files directory failed. {@l_oException}", l_oException); + } - return baseFolderPath; - } + return baseFolderPath; + } - /// Gets the folder name of the personal data folder dir on internal storage. - /// Directory name. - public string GetInternalPersonalDir() - { - return Environment.GetFolderPath(Environment.SpecialFolder.Personal); - } - } + /// Gets the folder name of the personal data folder dir on internal storage. + /// Directory name. + public string GetInternalPersonalDir() + { + return Environment.GetFolderPath(Environment.SpecialFolder.Personal); + } + } } \ No newline at end of file diff --git a/LastenradBayern/TINK.Android/Model/Device/WebView.cs b/LastenradBayern/TINK.Android/Model/Device/WebView.cs index dacf5dd..409c1c9 100644 --- a/LastenradBayern/TINK.Android/Model/Device/WebView.cs +++ b/LastenradBayern/TINK.Android/Model/Device/WebView.cs @@ -4,13 +4,13 @@ using TINK.Model.Device; [assembly: Xamarin.Forms.Dependency(typeof(TINK.Droid.Model.Device.WebView))] namespace TINK.Droid.Model.Device { - public class WebView : IWebView - { - /// Clears the cookie cache for all web views. - public void ClearCookies() - { - var cookieManager = CookieManager.Instance; - cookieManager.RemoveAllCookie(); - } - } + public class WebView : IWebView + { + /// Clears the cookie cache for all web views. + public void ClearCookies() + { + var cookieManager = CookieManager.Instance; + cookieManager.RemoveAllCookie(); + } + } } \ No newline at end of file diff --git a/LastenradBayern/TINK.Android/Properties/AndroidManifest.xml b/LastenradBayern/TINK.Android/Properties/AndroidManifest.xml index d8a024c..3a74495 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/AppDelegate.cs b/LastenradBayern/TINK.iOS/AppDelegate.cs index 03eaae8..6e4119a 100644 --- a/LastenradBayern/TINK.iOS/AppDelegate.cs +++ b/LastenradBayern/TINK.iOS/AppDelegate.cs @@ -4,45 +4,45 @@ using Xamarin.Forms; namespace TINK.iOS { - // The UIApplicationDelegate for the application. This class is responsible for launching the - // User Interface of the application, as well as listening (and optionally responding) to - // application events from iOS. - [Register("AppDelegate")] - public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate - { - // - // This method is invoked when the application has loaded and is ready to run. In this - // method you should instantiate the window, load the UI into it and then make the window - // visible. - // - // You have 17 seconds to return from this method, or iOS will terminate your application. - // - public override bool FinishedLaunching(UIApplication app, NSDictionary options) - { - global::Xamarin.Forms.Forms.Init(); + // The UIApplicationDelegate for the application. This class is responsible for launching the + // User Interface of the application, as well as listening (and optionally responding) to + // application events from iOS. + [Register("AppDelegate")] + public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate + { + // + // This method is invoked when the application has loaded and is ready to run. In this + // method you should instantiate the window, load the UI into it and then make the window + // visible. + // + // You have 17 seconds to return from this method, or iOS will terminate your application. + // + public override bool FinishedLaunching(UIApplication app, NSDictionary options) + { + global::Xamarin.Forms.Forms.Init(); - //Color of Icons in Navigation bar (e.g. burger menu and back arrow) - //UINavigationBar.Appearance.TintColor = Color.White.ToUIColor(); + //Color of Icons in Navigation bar (e.g. burger menu and back arrow) + //UINavigationBar.Appearance.TintColor = Color.White.ToUIColor(); - new iOS.Device.AppInfo(NSBundle.MainBundle.InfoDictionary[new NSString("CFBundleShortVersionString")]?.ToString() ?? string.Empty); + new iOS.Device.AppInfo(NSBundle.MainBundle.InfoDictionary[new NSString("CFBundleShortVersionString")]?.ToString() ?? string.Empty); - Forms.ViewInitialized += (object sender, ViewInitializedEventArgs e) => - { - // http://developer.xamarin.com/recipes/testcloud/set-accessibilityidentifier-ios/ - if (null != e.View.AutomationId) - { - e.NativeView.AccessibilityIdentifier = e.View.AutomationId; - } - }; - LoadApplication(new TINK.App()); + Forms.ViewInitialized += (object sender, ViewInitializedEventArgs e) => + { + // http://developer.xamarin.com/recipes/testcloud/set-accessibilityidentifier-ios/ + if (null != e.View.AutomationId) + { + e.NativeView.AccessibilityIdentifier = e.View.AutomationId; + } + }; + LoadApplication(new TINK.App()); - // Required for initialization of Maps, see https://developer.xamarin.com/guides/xamarin-forms/user-interface/map/ - Xamarin.FormsGoogleMaps.Init("000000000000000000000000000000000000000"); + // Required for initialization of Maps, see https://developer.xamarin.com/guides/xamarin-forms/user-interface/map/ + Xamarin.FormsGoogleMaps.Init("000000000000000000000000000000000000000"); - // Required for initialization of binding package, see https://github.com/nuitsjp/Xamarin.Forms.GoogleMaps.Bindings. - Xamarin.FormsGoogleMapsBindings.Init(); + // Required for initialization of binding package, see https://github.com/nuitsjp/Xamarin.Forms.GoogleMaps.Bindings. + Xamarin.FormsGoogleMapsBindings.Init(); - return base.FinishedLaunching(app, options); - } - } + return base.FinishedLaunching(app, options); + } + } } diff --git a/LastenradBayern/TINK.iOS/Device/AppInfo.cs b/LastenradBayern/TINK.iOS/Device/AppInfo.cs index 22cec2a..8c62628 100644 --- a/LastenradBayern/TINK.iOS/Device/AppInfo.cs +++ b/LastenradBayern/TINK.iOS/Device/AppInfo.cs @@ -7,41 +7,41 @@ using Xamarin.Forms; [assembly: Dependency(typeof(AppInfo))] namespace TINK.iOS.Device { - /// Holds information about the TINK- app. - public class AppInfo : IAppInfo - { - /// Holds the the version of the app. - private static Version m_oVersion = null; + /// Holds information about the TINK- app. + public class AppInfo : IAppInfo + { + /// Holds the the version of the app. + private static Version m_oVersion = null; - /// Constructs a app info object. - public AppInfo() - { - } + /// Constructs a app info object. + public AppInfo() + { + } - /// Constructs a app info object for initialization. - /// Version to initializ object with. - internal AppInfo(string p_strVersionText) - { - if (m_oVersion != null) - { - // Set version only once. - return; - } + /// Constructs a app info object for initialization. + /// Version to initializ object with. + internal AppInfo(string p_strVersionText) + { + if (m_oVersion != null) + { + // Set version only once. + return; + } - if (!Version.TryParse(p_strVersionText, out Version l_oVersion)) - { - m_oVersion = new Version(0, 8); - } + if (!Version.TryParse(p_strVersionText, out Version l_oVersion)) + { + m_oVersion = new Version(0, 8); + } - m_oVersion = l_oVersion; - } + m_oVersion = l_oVersion; + } - /// Get the version of the app. - public Version Version => m_oVersion ?? new Version(0, 9); + /// Get the version of the app. + public Version Version => m_oVersion ?? new Version(0, 9); - /// Gets the URL to the app store. - /// TINK Url was @"http://itunes.apple.com/de/app/tink-konstanz/id1181519270?mt=8" - /// The store URL. - public string StoreUrl => $"https://itunes.apple.com/de/app/apple-store/{NSBundle.MainBundle.BundleIdentifier}?mt=8"; - } + /// Gets the URL to the app store. + /// TINK Url was @"http://itunes.apple.com/de/app/tink-konstanz/id1181519270?mt=8" + /// The store URL. + public string StoreUrl => $"https://itunes.apple.com/de/app/apple-store/{NSBundle.MainBundle.BundleIdentifier}?mt=8"; + } } \ No newline at end of file diff --git a/LastenradBayern/TINK.iOS/Device/Device.cs b/LastenradBayern/TINK.iOS/Device/Device.cs index a715f2b..9fc0b4a 100644 --- a/LastenradBayern/TINK.iOS/Device/Device.cs +++ b/LastenradBayern/TINK.iOS/Device/Device.cs @@ -6,30 +6,30 @@ using Xamarin.Essentials; [assembly: Xamarin.Forms.Dependency(typeof(TINK.iOS.Device.Device))] namespace TINK.iOS.Device { - public class Device : ISmartDevice - { - [DllImport("/System/Library/Frameworks/IOKit.framework/IOKit")] - private static extern uint IOServiceGetMatchingService(uint masterPort, IntPtr matching); + public class Device : ISmartDevice + { + [DllImport("/System/Library/Frameworks/IOKit.framework/IOKit")] + private static extern uint IOServiceGetMatchingService(uint masterPort, IntPtr matching); - [DllImport("/System/Library/Frameworks/IOKit.framework/IOKit")] - private static extern IntPtr IOServiceMatching(string s); + [DllImport("/System/Library/Frameworks/IOKit.framework/IOKit")] + private static extern IntPtr IOServiceMatching(string s); - [DllImport("/System/Library/Frameworks/IOKit.framework/IOKit")] - private static extern IntPtr IORegistryEntryCreateCFProperty(uint entry, IntPtr key, IntPtr allocator, uint options); + [DllImport("/System/Library/Frameworks/IOKit.framework/IOKit")] + private static extern IntPtr IORegistryEntryCreateCFProperty(uint entry, IntPtr key, IntPtr allocator, uint options); - [DllImport("/System/Library/Frameworks/IOKit.framework/IOKit")] - private static extern int IOObjectRelease(uint o); + [DllImport("/System/Library/Frameworks/IOKit.framework/IOKit")] + private static extern int IOObjectRelease(uint o); - public string Manufacturer => DeviceInfo.Manufacturer; + public string Manufacturer => DeviceInfo.Manufacturer; - public string Model => DeviceInfo.Model; + public string Model => DeviceInfo.Model; - public DevicePlatform Platform => DeviceInfo.Platform; + public DevicePlatform Platform => DeviceInfo.Platform; - public string VersionText => DeviceInfo.VersionString; - /// Gets unitque device identifier. - /// Gets the identifies specifying device. - public string Identifier - => UIKit.UIDevice.CurrentDevice?.IdentifierForVendor?.AsString() ?? string.Empty; - } + public string VersionText => DeviceInfo.VersionString; + /// Gets unitque device identifier. + /// Gets the identifies specifying device. + public string Identifier + => UIKit.UIDevice.CurrentDevice?.IdentifierForVendor?.AsString() ?? string.Empty; + } } \ No newline at end of file diff --git a/LastenradBayern/TINK.iOS/Device/ExternalBrowseService.cs b/LastenradBayern/TINK.iOS/Device/ExternalBrowseService.cs index c9a7998..b0ac186 100644 --- a/LastenradBayern/TINK.iOS/Device/ExternalBrowseService.cs +++ b/LastenradBayern/TINK.iOS/Device/ExternalBrowseService.cs @@ -7,17 +7,17 @@ using Xamarin.Forms; [assembly: Dependency(typeof(ExternalBrowseService))] namespace TINK.iOS.Device { - public class ExternalBrowseService : IExternalBrowserService - { - /// Opens an external browser. - /// Url to open. - public void OpenUrl(string p_strUrl) - { - var l_oUrl = NSUrl.FromString(p_strUrl); - if (l_oUrl == null) - return; + public class ExternalBrowseService : IExternalBrowserService + { + /// Opens an external browser. + /// Url to open. + public void OpenUrl(string p_strUrl) + { + var l_oUrl = NSUrl.FromString(p_strUrl); + if (l_oUrl == null) + return; - UIApplication.SharedApplication.OpenUrl(l_oUrl); - } - } + UIApplication.SharedApplication.OpenUrl(l_oUrl); + } + } } diff --git a/LastenradBayern/TINK.iOS/Device/Gps.cs b/LastenradBayern/TINK.iOS/Device/Gps.cs index 6728593..21c425b 100644 --- a/LastenradBayern/TINK.iOS/Device/Gps.cs +++ b/LastenradBayern/TINK.iOS/Device/Gps.cs @@ -3,8 +3,8 @@ [assembly: Xamarin.Forms.Dependency(typeof(TINK.iOS.Device.Gps))] namespace TINK.iOS.Device { - public class Gps : IGeolodationDependent - { - public bool IsGeolcationEnabled => true; - } + public class Gps : IGeolodationDependent + { + public bool IsGeolcationEnabled => true; + } } \ No newline at end of file diff --git a/LastenradBayern/TINK.iOS/Device/SpecialFolder.cs b/LastenradBayern/TINK.iOS/Device/SpecialFolder.cs index 9434b04..5230371 100644 --- a/LastenradBayern/TINK.iOS/Device/SpecialFolder.cs +++ b/LastenradBayern/TINK.iOS/Device/SpecialFolder.cs @@ -5,23 +5,23 @@ using Xamarin.Forms; [assembly: Dependency(typeof(TINK.iOS.Device.SpecialFolder))] namespace TINK.iOS.Device { - public class SpecialFolder : ISpecialFolder - { - /// - /// Get the folder name of external folder to write to. - /// - /// - public string GetExternalFilesDir() - { - return Environment.GetFolderPath(Environment.SpecialFolder.Personal); - } + public class SpecialFolder : ISpecialFolder + { + /// + /// Get the folder name of external folder to write to. + /// + /// + public string GetExternalFilesDir() + { + return Environment.GetFolderPath(Environment.SpecialFolder.Personal); + } - /// Gets the folder name of the personal data folder dir on internal storage. - /// Directory name. - public string GetInternalPersonalDir() - { - return Environment.GetFolderPath(Environment.SpecialFolder.Personal); - } + /// Gets the folder name of the personal data folder dir on internal storage. + /// Directory name. + public string GetInternalPersonalDir() + { + return Environment.GetFolderPath(Environment.SpecialFolder.Personal); + } - } + } } \ No newline at end of file diff --git a/LastenradBayern/TINK.iOS/Device/WebView.cs b/LastenradBayern/TINK.iOS/Device/WebView.cs index 5a5a5cb..f490266 100644 --- a/LastenradBayern/TINK.iOS/Device/WebView.cs +++ b/LastenradBayern/TINK.iOS/Device/WebView.cs @@ -5,14 +5,14 @@ using TINK.Model.Device; [assembly: Xamarin.Forms.Dependency(typeof(TINK.iOS.Device.WebView))] namespace TINK.iOS.Device { - public class WebView : IWebView - { - /// Clears the cookie cache for all web views. - public void ClearCookies() - { - NSHttpCookieStorage CookieStorage = NSHttpCookieStorage.SharedStorage; - foreach (var cookie in CookieStorage.Cookies) - CookieStorage.DeleteCookie(cookie); - } - } + public class WebView : IWebView + { + /// Clears the cookie cache for all web views. + public void ClearCookies() + { + NSHttpCookieStorage CookieStorage = NSHttpCookieStorage.SharedStorage; + foreach (var cookie in CookieStorage.Cookies) + CookieStorage.DeleteCookie(cookie); + } + } } \ No newline at end of file diff --git a/LastenradBayern/TINK.iOS/Device/iOSCipher.cs b/LastenradBayern/TINK.iOS/Device/iOSCipher.cs index 4dc6464..fa4a22e 100644 --- a/LastenradBayern/TINK.iOS/Device/iOSCipher.cs +++ b/LastenradBayern/TINK.iOS/Device/iOSCipher.cs @@ -5,24 +5,24 @@ using Xamarin.Forms; [assembly: Dependency(typeof(TINK.iOS.Device.IOSCipher))] namespace TINK.iOS.Device { - public class IOSCipher : ICipher - { - /// Encrypt data. - /// Key to encrypt data. - /// Data to entrycpt. - /// - public byte[] Encrypt(byte[] key, byte[] clear) - { - throw new NotSupportedException(); - } + public class IOSCipher : ICipher + { + /// Encrypt data. + /// Key to encrypt data. + /// Data to entrycpt. + /// + public byte[] Encrypt(byte[] key, byte[] clear) + { + throw new NotSupportedException(); + } - /// Decrypt data. - /// Key to decrypt data with. - /// Encrpyted data to decrypt. - /// Decrypted data. - public byte[] Decrypt(byte[] key, byte[] encrypted) - { - throw new NotSupportedException(); - } - } + /// Decrypt data. + /// Key to decrypt data with. + /// Encrpyted data to decrypt. + /// Decrypted data. + public byte[] Decrypt(byte[] key, byte[] encrypted) + { + throw new NotSupportedException(); + } + } } \ No newline at end of file diff --git a/LastenradBayern/TINK.iOS/Info.plist b/LastenradBayern/TINK.iOS/Info.plist index ba26e6a..1df5dc7 100644 --- a/LastenradBayern/TINK.iOS/Info.plist +++ b/LastenradBayern/TINK.iOS/Info.plist @@ -1,4 +1,4 @@ - + @@ -6,8 +6,8 @@ bluetooth-peripheral - UIUserInterfaceStyle - Light + UIUserInterfaceStyle + Light UIDeviceFamily 1 @@ -47,7 +47,7 @@ NSLocationAlwaysAndWhenInUseUsageDescription Location access is needed to show map at current position and pass position to server when returning bikes. MinimumOSVersion - 9.0 + 13.0 NSLocationWhenInUseUsageDescription Location access is needed to show map at current position and pass position to server when returning bikes. CFBundleIdentifier @@ -55,8 +55,8 @@ CFBundleDisplayName LastenradBayern CFBundleVersion - 337 + 338 CFBundleShortVersionString - 3.0.337 + 3.0.338 diff --git a/LastenradBayern/TINK.iOS/LastenradBayern.iOS.csproj b/LastenradBayern/TINK.iOS/LastenradBayern.iOS.csproj index 7a335e8..3d6a35d 100644 --- a/LastenradBayern/TINK.iOS/LastenradBayern.iOS.csproj +++ b/LastenradBayern/TINK.iOS/LastenradBayern.iOS.csproj @@ -24,7 +24,7 @@ prompt 4 false - i386, x86_64 + x86_64 None true VS: com.TeilRad.LastenradBayern Development @@ -37,8 +37,8 @@ __IOS__;__MOBILE__;__UNIFIED__ prompt 4 - None - i386, x86_64 + SdkOnly + x86_64 false VS: com.TeilRad.LastenradBayern Development Apple Development: Oliver Hauff (8SZ7J9P24J) @@ -52,11 +52,11 @@ prompt 4 false - ARMv7, ARM64 + ARM64 Apple Development: Oliver Hauff (8SZ7J9P24J) true Entitlements.plist - None + SdkOnly -all VS: com.TeilRad.LastenradBayern Development @@ -67,7 +67,7 @@ __IOS__;__MOBILE__;__UNIFIED__ prompt 4 - ARMv7, ARM64 + ARM64 false Apple Development: Oliver Hauff (8SZ7J9P24J) Entitlements.plist @@ -77,6 +77,7 @@ SdkOnly + 15.5 none @@ -202,10 +203,10 @@ 1.7.3 - 3.3.0 + 5.0.0 - + 0.7.124 diff --git a/LastenradBayern/TINK.iOS/Main.cs b/LastenradBayern/TINK.iOS/Main.cs index c766ee2..7a40150 100644 --- a/LastenradBayern/TINK.iOS/Main.cs +++ b/LastenradBayern/TINK.iOS/Main.cs @@ -2,14 +2,14 @@ namespace TINK.iOS { - public class Application - { - // This is the main entry point of the application. - static void Main(string[] args) - { - // if you want to use a different Application Delegate class from "AppDelegate" - // you can specify it here. - UIApplication.Main(args, null, "AppDelegate"); - } - } + public class Application + { + // This is the main entry point of the application. + static void Main(string[] args) + { + // if you want to use a different Application Delegate class from "AppDelegate" + // you can specify it here. + UIApplication.Main(args, null, "AppDelegate"); + } + } } diff --git a/LastenradBayern/TINK/App.xaml.cs b/LastenradBayern/TINK/App.xaml.cs index 4e05571..b5d306d 100644 --- a/LastenradBayern/TINK/App.xaml.cs +++ b/LastenradBayern/TINK/App.xaml.cs @@ -30,166 +30,166 @@ using Arendi.BleLibrary.Local; [assembly: XamlCompilation(XamlCompilationOptions.Compile)] namespace TINK { - public partial class App : Application - { - /// Title of the attachment file. - private const string ATTACHMENTTITLE = "Diagnostics.txt"; + public partial class App : Application + { + /// Title of the attachment file. + private const string ATTACHMENTTITLE = "Diagnostics.txt"; - /// Model root. - private static TinkApp m_oModelRoot; + /// Model root. + private static TinkApp m_oModelRoot; - /// - /// Gets the model root. - /// - public static TinkApp ModelRoot - { - get - { - if (m_oModelRoot != null) - { - // Root model already exists, nothing to do. - return m_oModelRoot; - } + /// + /// Gets the model root. + /// + public static TinkApp ModelRoot + { + get + { + if (m_oModelRoot != null) + { + // Root model already exists, nothing to do. + return m_oModelRoot; + } - // Get folder where to read settings from - var specialFolders = DependencyService.Get(); - var internalPersonalDir = specialFolders.GetInternalPersonalDir(); + // Get folder where to read settings from + var specialFolders = DependencyService.Get(); + var internalPersonalDir = specialFolders.GetInternalPersonalDir(); - // Delete attachtment from previous session. - DeleteAttachment(internalPersonalDir); + // Delete attachtment from previous session. + DeleteAttachment(internalPersonalDir); - // Setup logger using default settings. - TinkApp.SetupLogging( - new LoggingLevelSwitch(Model.Settings.Settings.DEFAULTLOGGINLEVEL), - internalPersonalDir); + // Setup logger using default settings. + TinkApp.SetupLogging( + new LoggingLevelSwitch(Model.Settings.Settings.DEFAULTLOGGINLEVEL), + internalPersonalDir); - // Subscribe to any unhandled/ unobserved exceptions. - AppDomain.CurrentDomain.UnhandledException += (sender, unobservedTaskExceptionEventArgs) => { Log.Fatal("Unobserved task exception: {Exception}", unobservedTaskExceptionEventArgs.ExceptionObject); }; - TaskScheduler.UnobservedTaskException += (sender, unhandledExceptionEventArgs) => { Log.Fatal("Unhandled exception: {Exception}", unhandledExceptionEventArgs.Exception); }; + // Subscribe to any unhandled/ unobserved exceptions. + AppDomain.CurrentDomain.UnhandledException += (sender, unobservedTaskExceptionEventArgs) => { Log.Fatal("Unobserved task exception: {Exception}", unobservedTaskExceptionEventArgs.ExceptionObject); }; + TaskScheduler.UnobservedTaskException += (sender, unhandledExceptionEventArgs) => { Log.Fatal("Unhandled exception: {Exception}", unhandledExceptionEventArgs.Exception); }; - // Restore last model state from json- file. - Dictionary settingsJSON = new Dictionary(); - try - { - settingsJSON = JsonSettingsDictionary.Deserialize(internalPersonalDir); - } - catch (Exception exception) - { - Log.Error("Reading application settings from file failed.", exception); - } + // Restore last model state from json- file. + Dictionary settingsJSON = new Dictionary(); + try + { + settingsJSON = JsonSettingsDictionary.Deserialize(internalPersonalDir); + } + catch (Exception exception) + { + Log.Error("Reading application settings from file failed.", exception); + } - Model.Settings.Settings settings; - try - { - settings = new Model.Settings.Settings( - null, // Turn off filtering for LastenradBayern- context - null, // Turn off filtering for LastenradBayern- context - JsonSettingsDictionary.GetCopriHostUri(settingsJSON), - JsonSettingsDictionary.GetPollingParameters(settingsJSON), - JsonSettingsDictionary.GetMinimumLoggingLevel(settingsJSON), - JsonSettingsDictionary.GetIsReportLevelVerbose(settingsJSON), - JsonSettingsDictionary.GetExpiresAfter(settingsJSON), - JsonSettingsDictionary.GetActiveLockService(settingsJSON), - JsonSettingsDictionary.GetConnectTimeout(settingsJSON), - JsonSettingsDictionary.GetActiveGeolocationService(settingsJSON), - JsonSettingsDictionary.GetCenterMapToCurrentLocation(settingsJSON), - Xamarin.Forms.GoogleMaps.MapSpan.FromCenterAndRadius(new Xamarin.Forms.GoogleMaps.Position(49.30881083492271, 11.358449625922889), Xamarin.Forms.GoogleMaps.Distance.FromKilometers(2.9)), - JsonSettingsDictionary.GetLogToExternalFolder(settingsJSON), - JsonSettingsDictionary.GetIsSiteCachingOn(settingsJSON), - JsonSettingsDictionary.GetActiveTheme(settingsJSON) ?? typeof(Themes.LastenradBayern).Name); - } - catch (Exception exception) - { - Log.Error("Deserializing application settings from dictionary failed.", exception); - settings = new Model.Settings.Settings(); - } + Model.Settings.Settings settings; + try + { + settings = new Model.Settings.Settings( + null, // Turn off filtering for LastenradBayern- context + null, // Turn off filtering for LastenradBayern- context + JsonSettingsDictionary.GetCopriHostUri(settingsJSON), + JsonSettingsDictionary.GetPollingParameters(settingsJSON), + JsonSettingsDictionary.GetMinimumLoggingLevel(settingsJSON), + JsonSettingsDictionary.GetIsReportLevelVerbose(settingsJSON), + JsonSettingsDictionary.GetExpiresAfter(settingsJSON), + JsonSettingsDictionary.GetActiveLockService(settingsJSON), + JsonSettingsDictionary.GetConnectTimeout(settingsJSON), + JsonSettingsDictionary.GetActiveGeolocationService(settingsJSON), + JsonSettingsDictionary.GetCenterMapToCurrentLocation(settingsJSON), + Xamarin.Forms.GoogleMaps.MapSpan.FromCenterAndRadius(new Xamarin.Forms.GoogleMaps.Position(49.30881083492271, 11.358449625922889), Xamarin.Forms.GoogleMaps.Distance.FromKilometers(2.9)), + JsonSettingsDictionary.GetLogToExternalFolder(settingsJSON), + JsonSettingsDictionary.GetIsSiteCachingOn(settingsJSON), + JsonSettingsDictionary.GetActiveTheme(settingsJSON) ?? typeof(Themes.LastenradBayern).Name); + } + catch (Exception exception) + { + Log.Error("Deserializing application settings from dictionary failed.", exception); + settings = new Model.Settings.Settings(); + } - if (settings.MinimumLogEventLevel != Model.Settings.Settings.DEFAULTLOGGINLEVEL - || settings.LogToExternalFolder) - { - // Eigher - // - logging is not set to default value or - // - logging is performed to external folder. - // Need to reconfigure. - Log.CloseAndFlush(); // Close before modifying logger configuration. Otherwise a sharing vialation occurs. + if (settings.MinimumLogEventLevel != Model.Settings.Settings.DEFAULTLOGGINLEVEL + || settings.LogToExternalFolder) + { + // Eigher + // - logging is not set to default value or + // - logging is performed to external folder. + // Need to reconfigure. + Log.CloseAndFlush(); // Close before modifying logger configuration. Otherwise a sharing vialation occurs. - TinkApp.SetupLogging( - new LoggingLevelSwitch(settings.MinimumLogEventLevel), - !settings.LogToExternalFolder - ? internalPersonalDir - : specialFolders.GetExternalFilesDir()); - } + TinkApp.SetupLogging( + new LoggingLevelSwitch(settings.MinimumLogEventLevel), + !settings.LogToExternalFolder + ? internalPersonalDir + : specialFolders.GetExternalFilesDir()); + } - // Get auth cookie - Log.Debug("Get auth cookie."); - IStore store = null; + // Get auth cookie + Log.Debug("Get auth cookie."); + IStore store = null; - var lastVersion = JsonSettingsDictionary.GetAppVersion(settingsJSON); - if (new Version(3, 0, 290) <= lastVersion) - { - // App versions newer than 3.0.173 stored geolocation service in configuration. - // Version 3.0.290: Geolocation service "GeolocationService" is no more supported. - // For this reasons a swich of geolocation service is forced when loading configurations from ealier versions. - LocationServicesContainer.SetActive(settings.ActiveGeolocationService); - } + var lastVersion = JsonSettingsDictionary.GetAppVersion(settingsJSON); + if (new Version(3, 0, 290) <= lastVersion) + { + // App versions newer than 3.0.173 stored geolocation service in configuration. + // Version 3.0.290: Geolocation service "GeolocationService" is no more supported. + // For this reasons a swich of geolocation service is forced when loading configurations from ealier versions. + LocationServicesContainer.SetActive(settings.ActiveGeolocationService); + } - store = new Store(); + store = new Store(); - Barrel.ApplicationId = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name; + Barrel.ApplicationId = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name; - var context = SynchronizationContext.Current; + var context = SynchronizationContext.Current; - var appInfoService = DependencyService.Get(); + var appInfoService = DependencyService.Get(); - const string MERCHANTID = "0000000000"; + const string MERCHANTID = "0000000000"; - // Create new app instnace. - Log.Debug("Constructing main model..."); - m_oModelRoot = new TinkApp( - settings, - store, // Manages user account - isConnectedFunc: () => CrossConnectivity.Current.IsConnected, - connectorFactory: (isConnected, activeUri, sessionCookie, mail, expiresAfter) => ConnectorFactory.Create( - isConnected, - activeUri, - new Repository.AppContextInfo(MERCHANTID, AppFlavor.LastenradBayern.GetDisplayName().Replace(" ", ""), appInfoService.Version), - CultureInfo.CurrentUICulture.TwoLetterISOLanguageName, - sessionCookie, - mail, - expiresAfter), - merchantId: MERCHANTID, - bluetoothService: BluetoothService, /* locksService */ - locationPermissionsService: PermissionsService, - locationServicesContainer: LocationServicesContainer, - locksService: null, - device: DependencyService.Get(), - specialFolder: specialFolders, - cipher: new Cipher(), - new TINK.Services.ThemeNS.Theme(Application.Current.Resources.MergedDictionaries), - arendiCentral: + // Create new app instnace. + Log.Debug("Constructing main model..."); + m_oModelRoot = new TinkApp( + settings, + store, // Manages user account + isConnectedFunc: () => CrossConnectivity.Current.IsConnected, + connectorFactory: (isConnected, activeUri, sessionCookie, mail, expiresAfter) => ConnectorFactory.Create( + isConnected, + activeUri, + new Repository.AppContextInfo(MERCHANTID, AppFlavor.LastenradBayern.GetDisplayName().Replace(" ", ""), appInfoService.Version), + CultureInfo.CurrentUICulture.TwoLetterISOLanguageName, + sessionCookie, + mail, + expiresAfter), + merchantId: MERCHANTID, + bluetoothService: BluetoothService, /* locksService */ + locationPermissionsService: PermissionsService, + locationServicesContainer: LocationServicesContainer, + locksService: null, + device: DependencyService.Get(), + specialFolder: specialFolders, + cipher: new Cipher(), + new TINK.Services.ThemeNS.Theme(Application.Current.Resources.MergedDictionaries), + arendiCentral: #if ARENDI DependencyService.Get(), #else - null, + null, #endif - postAction: (d, obj) => context.Post(d, obj), - currentVersion: appInfoService.Version, - lastVersion: lastVersion, - whatsNewShownInVersion: JsonSettingsDictionary.GetWhatsNew(settingsJSON) ?? settingsJSON.GetAppVersion(), - appFlavor: AppFlavor.LastenradBayern); + postAction: (d, obj) => context.Post(d, obj), + currentVersion: appInfoService.Version, + lastVersion: lastVersion, + whatsNewShownInVersion: JsonSettingsDictionary.GetWhatsNew(settingsJSON) ?? settingsJSON.GetAppVersion(), + flavor: AppFlavor.LastenradBayern); - Log.Debug("Main model successfully constructed."); - return m_oModelRoot; - } - } + Log.Debug("Main model successfully constructed."); + return m_oModelRoot; + } + } - /// - /// Entry point of application. - /// - public App() - { - InitializeComponent(); + /// + /// Entry point of application. + /// + public App() + { + InitializeComponent(); #if USEFLYOUT // Use flyout page. @@ -197,147 +197,147 @@ namespace TINK ? new View.WhatsNew.WhatsNewPage(() => MainPage = new View.Root.RootPage()) // Show whats new info. : (Page)new View.Root.RootPage(); // Just start sharee- app #else - // Use shell. - MainPage = ModelRoot.WhatsNew.IsShowRequired - ? new View.WhatsNew.WhatsNewPage(() => MainPage = new View.RootShell.AppShell()) // Show whats new info. - : (Page)new View.RootShell.AppShell(); // Just start sharee- app + // Use shell. + MainPage = ModelRoot.WhatsNew.IsShowRequired + ? new View.WhatsNew.WhatsNewPage(() => MainPage = new View.RootShell.AppShell()) // Show whats new info. + : (Page)new View.RootShell.AppShell(); // Just start sharee- app #endif - } + } - /// Concatenates all log files to a single one. - /// Full file name of attachment. - public static string CreateAttachment() - { - var sessionLogFiles = Log.Logger.GetLogFiles().ToArray(); + /// Concatenates all log files to a single one. + /// Full file name of attachment. + public static string CreateAttachment() + { + var sessionLogFiles = Log.Logger.GetLogFiles().ToArray(); - if (sessionLogFiles.Length < 1) - { - // Either - // - there is no logging file - // - an error occurred getting list of log files. - return string.Empty; - } + if (sessionLogFiles.Length < 1) + { + // Either + // - there is no logging file + // - an error occurred getting list of log files. + return string.Empty; + } - var fullLogFileName = System.IO.Path.Combine(ModelRoot.LogFileParentFolder, ATTACHMENTTITLE); + var fullLogFileName = System.IO.Path.Combine(ModelRoot.LogFileParentFolder, ATTACHMENTTITLE); - // Stop logging to avoid file access exception. - Log.CloseAndFlush(); + // Stop logging to avoid file access exception. + Log.CloseAndFlush(); - System.IO.File.WriteAllLines( - fullLogFileName, - sessionLogFiles.SelectMany(name => - (new List { $"{{\"SessionFileName\":\"{name}\"}}" }) - .Concat(System.IO.File.ReadLines(name).ToArray()))); + System.IO.File.WriteAllLines( + fullLogFileName, + sessionLogFiles.SelectMany(name => + (new List { $"{{\"SessionFileName\":\"{name}\"}}" }) + .Concat(System.IO.File.ReadLines(name).ToArray()))); - // Resume logging - TinkApp.SetupLogging( - ModelRoot.Level, - ModelRoot.LogFileParentFolder); + // Resume logging + TinkApp.SetupLogging( + ModelRoot.Level, + ModelRoot.LogFileParentFolder); - return fullLogFileName; - } + return fullLogFileName; + } - /// Deletes an attachment if there is one. - /// Folder to delete, is null folder is queried from model. - private static void DeleteAttachment(string folder = null) - { - var attachment = System.IO.Path.Combine(folder ?? ModelRoot.LogFileParentFolder, ATTACHMENTTITLE); - if (!System.IO.File.Exists(attachment)) - { - // No attachment found. - return; - } + /// Deletes an attachment if there is one. + /// Folder to delete, is null folder is queried from model. + private static void DeleteAttachment(string folder = null) + { + var attachment = System.IO.Path.Combine(folder ?? ModelRoot.LogFileParentFolder, ATTACHMENTTITLE); + if (!System.IO.File.Exists(attachment)) + { + // No attachment found. + return; + } - System.IO.File.Delete(attachment); - } + System.IO.File.Delete(attachment); + } - protected override void OnSleep() - { - // Handle when your app sleeps - Log.CloseAndFlush(); - } + protected override void OnSleep() + { + // Handle when your app sleeps + Log.CloseAndFlush(); + } - protected override void OnResume() - { - DeleteAttachment(); + protected override void OnResume() + { + DeleteAttachment(); - TinkApp.SetupLogging( - ModelRoot.Level, - ModelRoot.LogFileParentFolder); - } + TinkApp.SetupLogging( + ModelRoot.Level, + ModelRoot.LogFileParentFolder); + } - /// The URI for the request. - /// Overriden to respond when the user initiates an app link request. - protected override void OnAppLinkRequestReceived(Uri uri) - { - base.OnAppLinkRequestReceived(uri); - if (uri.Host.ToLower() == "sharee.bike") - { - // Input e.g. sharee.bike/sharee?lat=49.921&long=32.51 - Array segments = Array.ConvertAll(uri.Segments, segment => segment.Replace("/", "")).Skip(1).ToArray(); - if (uri.Query.Length > 0) - { - Dictionary queryDict = uri.Query - .Substring(1) - .Split("&") - .Select(query => query.Split('=')) - .ToDictionary(query => query.FirstOrDefault(), query => query.Skip(1).FirstOrDefault()); - } - // segments == ["sharee"] - // queryDict == [{["lat", "49.921"]}], {["long", "32.51"]}] - // => Navigate and pass params depending on linkinput - // If no custom navigation is configured, the app just opens as if the user opened it - } - } + /// The URI for the request. + /// Overriden to respond when the user initiates an app link request. + protected override void OnAppLinkRequestReceived(Uri uri) + { + base.OnAppLinkRequestReceived(uri); + if (uri.Host.ToLower() == "sharee.bike") + { + // Input e.g. sharee.bike/sharee?lat=49.921&long=32.51 + Array segments = Array.ConvertAll(uri.Segments, segment => segment.Replace("/", "")).Skip(1).ToArray(); + if (uri.Query.Length > 0) + { + Dictionary queryDict = uri.Query + .Substring(1) + .Split("&") + .Select(query => query.Split('=')) + .ToDictionary(query => query.FirstOrDefault(), query => query.Skip(1).FirstOrDefault()); + } + // segments == ["sharee"] + // queryDict == [{["lat", "49.921"]}], {["long", "32.51"]}] + // => Navigate and pass params depending on linkinput + // If no custom navigation is configured, the app just opens as if the user opened it + } + } - /// Gets the current logging level. - /// - private static LogEventLevel GetCurrentLogEventLevel() - { - foreach (LogEventLevel level in Enum.GetValues(typeof(LogEventLevel))) - { - if (Log.IsEnabled(level)) - return level; - } + /// Gets the current logging level. + /// + private static LogEventLevel GetCurrentLogEventLevel() + { + foreach (LogEventLevel level in Enum.GetValues(typeof(LogEventLevel))) + { + if (Log.IsEnabled(level)) + return level; + } - return LogEventLevel.Error; - } + return LogEventLevel.Error; + } - /// - /// Holds the permission service instance. - /// - private static ILocationPermission _PermissionsService = null; + /// + /// Holds the permission service instance. + /// + private static ILocationPermission _PermissionsService = null; - /// - /// Service to manage permissions (location) of the app. - /// - public static ILocationPermission PermissionsService - { - get - { - if (_PermissionsService != null) - return _PermissionsService; + /// + /// Service to manage permissions (location) of the app. + /// + public static ILocationPermission PermissionsService + { + get + { + if (_PermissionsService != null) + return _PermissionsService; - _PermissionsService = new TINK.Services.Permissions.Essentials.Permissions(); - return _PermissionsService; - } - } + _PermissionsService = new TINK.Services.Permissions.Essentials.Permissions(); + return _PermissionsService; + } + } - /// Service to manage bluetooth stack. - public static Plugin.BLE.Abstractions.Contracts.IBluetoothLE BluetoothService => Plugin.BLE.CrossBluetoothLE.Current; + /// Service to manage bluetooth stack. + public static Plugin.BLE.Abstractions.Contracts.IBluetoothLE BluetoothService => Plugin.BLE.CrossBluetoothLE.Current; - /// - /// Service container to manage geolocation services. - /// - public static IServicesContainer LocationServicesContainer { get; } - = new ServicesContainerMutableT( - new HashSet { - new LastKnownGeolocationService(DependencyService.Get()), - new SimulatedGeolocationService(DependencyService.Get()), - new GeolocationAccuracyMediumService(DependencyService.Get()), - new GeolocationAccuracyHighService(DependencyService.Get()), - new GeolocationAccuracyBestService(DependencyService.Get())}, - Model.Settings.Settings.DefaultLocationService.FullName); - } + /// + /// Service container to manage geolocation services. + /// + public static IServicesContainer LocationServicesContainer { get; } + = new ServicesContainerMutableT( + new HashSet { + new LastKnownGeolocationService(DependencyService.Get()), + new SimulatedGeolocationService(DependencyService.Get()), + new GeolocationAccuracyMediumService(DependencyService.Get()), + new GeolocationAccuracyHighService(DependencyService.Get()), + new GeolocationAccuracyBestService(DependencyService.Get())}, + Model.Settings.Settings.DefaultLocationService.FullName); + } } diff --git a/LastenradBayern/TINK/BackdoorMethodHelpers.cs b/LastenradBayern/TINK/BackdoorMethodHelpers.cs index 068f5ac..f8dd015 100644 --- a/LastenradBayern/TINK/BackdoorMethodHelpers.cs +++ b/LastenradBayern/TINK/BackdoorMethodHelpers.cs @@ -5,34 +5,34 @@ using Xamarin.Forms; namespace TINK { - public static class BackdoorMethodHelpers - { - public static void DoTapPage(string stationId) - { - Serilog.Log.Information($"Request via backdoor to tap station {stationId}."); - var currentPage = GetCurrentPage(); - var mapPageViewModel = (currentPage as MapPage)?.BindingContext as MapPageViewModel; - if (mapPageViewModel == null) - { - Serilog.Log.Error($"Request via backdoor to tap station {stationId} aborted because current page is not of expected type {typeof(MapPage).Name}. Type detected is {currentPage.GetType().Name}."); - return; - } + public static class BackdoorMethodHelpers + { + public static void DoTapPage(string stationId) + { + Serilog.Log.Information($"Request via backdoor to tap station {stationId}."); + var currentPage = GetCurrentPage(); + var mapPageViewModel = (currentPage as MapPage)?.BindingContext as MapPageViewModel; + if (mapPageViewModel == null) + { + Serilog.Log.Error($"Request via backdoor to tap station {stationId} aborted because current page is not of expected type {typeof(MapPage).Name}. Type detected is {currentPage.GetType().Name}."); + return; + } - Serilog.Log.Information($"Invoking member to tap."); - mapPageViewModel?.OnStationClicked(stationId); - } + Serilog.Log.Information($"Invoking member to tap."); + mapPageViewModel?.OnStationClicked(stationId); + } - /// Gets the current page assumed that app is master detail page. - /// - static Page GetCurrentPage() - { + /// Gets the current page assumed that app is master detail page. + /// + static Page GetCurrentPage() + { #if USEFLYOUT return (Application.Current.MainPage as FlyoutPage)?.Detail.Navigation.NavigationStack.LastOrDefault(); #else - return Shell.Current.CurrentPage; + return Shell.Current.CurrentPage; #endif - } + } - } + } } diff --git a/LastenradBayern/TINK/Model/Device/SpecialFolder.cs b/LastenradBayern/TINK/Model/Device/SpecialFolder.cs index 811664e..3a90f3f 100644 --- a/LastenradBayern/TINK/Model/Device/SpecialFolder.cs +++ b/LastenradBayern/TINK/Model/Device/SpecialFolder.cs @@ -3,22 +3,22 @@ using Xamarin.Forms; namespace TINK.Model.Device { - public class SpecialFolder : ISpecialFolder - { - /// - /// Get the folder name of external folder to write to. - /// - /// - public string GetExternalFilesDir() - { - return DependencyService.Get().GetExternalFilesDir(); - } + public class SpecialFolder : ISpecialFolder + { + /// + /// Get the folder name of external folder to write to. + /// + /// + public string GetExternalFilesDir() + { + return DependencyService.Get().GetExternalFilesDir(); + } - /// Gets the folder name of the personal data folder dir on internal storage. - /// Directory name. - public string GetInternalPersonalDir() - { - return DependencyService.Get().GetInternalPersonalDir(); - } - } + /// Gets the folder name of the personal data folder dir on internal storage. + /// Directory name. + public string GetInternalPersonalDir() + { + return DependencyService.Get().GetInternalPersonalDir(); + } + } } \ No newline at end of file diff --git a/LastenradBayern/TINK/View/Account/AccountPage.xaml.cs b/LastenradBayern/TINK/View/Account/AccountPage.xaml.cs index 4216b3e..d470451 100644 --- a/LastenradBayern/TINK/View/Account/AccountPage.xaml.cs +++ b/LastenradBayern/TINK/View/Account/AccountPage.xaml.cs @@ -12,80 +12,80 @@ using TINK.Model.Bikes.BikeInfoNS.DriveNS.BatteryNS; namespace TINK.View.Account { - [XamlCompilation(XamlCompilationOptions.Compile)] + [XamlCompilation(XamlCompilationOptions.Compile)] #if USEFLYOUT public partial class AccountPage : ContentPage, IViewService, IDetailPage #else - public partial class AccountPage : ContentPage, IViewService + public partial class AccountPage : ContentPage, IViewService #endif - { - /// Refernce to view model. - AccountPageViewModel m_oViewModel = null; + { + /// Refernce to view model. + AccountPageViewModel m_oViewModel = null; - /// Constructs a account page. - public AccountPage() - { - InitializeComponent(); + /// Constructs a account page. + public AccountPage() + { + InitializeComponent(); - var l_oModel = App.ModelRoot; + var l_oModel = App.ModelRoot; - m_oViewModel = new AccountPageViewModel( - l_oModel, - (url) => DependencyService.Get().OpenUrl(url), - this); + m_oViewModel = new AccountPageViewModel( + l_oModel, + (url) => DependencyService.Get().OpenUrl(url), + this); - BindingContext = m_oViewModel; - } + BindingContext = m_oViewModel; + } - /// Displays alert message. - /// Title of message. - /// Message to display. - /// Type of buttons. - public new async Task DisplayAlert(string title, string message, string cancel) - => await App.Current.MainPage.DisplayAlert(title, message, cancel); + /// Displays alert message. + /// Title of message. + /// Message to display. + /// Type of buttons. + public new async Task DisplayAlert(string title, string message, string cancel) + => await App.Current.MainPage.DisplayAlert(title, message, cancel); - /// 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 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 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 title, string message, string accept, string cancel) - => await App.Current.MainPage.DisplayAlert(title, 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 title, string message, string accept, string cancel) + => await App.Current.MainPage.DisplayAlert(title, message, accept, 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 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 an action sheet. - /// - /// Title of message. - /// Message to display. - /// Text of button. - /// - /// Buttons holding options to select. - /// Text selected - public new async Task DisplayActionSheet(String title, String cancel, String destruction, params String[] p_oButtons) - => await base.DisplayActionSheet(title, cancel, destruction, p_oButtons); + /// + /// Displays an action sheet. + /// + /// Title of message. + /// Message to display. + /// Text of button. + /// + /// Buttons holding options to select. + /// Text selected + public new async Task DisplayActionSheet(String title, String cancel, String destruction, params String[] p_oButtons) + => await base.DisplayActionSheet(title, cancel, destruction, p_oButtons); #if USEFLYOUT /// @@ -95,19 +95,19 @@ namespace TINK.View.Account public void ShowPage(ViewTypes p_oType, string title = null) => m_oNavigation.ShowPage(p_oType.GetViewType(), title); #else - /// Shows a page. - /// Route of the page to show. - public async Task ShowPage(string route) => await Shell.Current.GoToAsync(route); + /// Shows a page. + /// Route of the page to show. + public async Task ShowPage(string route) => await Shell.Current.GoToAsync(route); #endif - /// Pushes a page onto the modal stack. - /// Page to display. - public Task PushModalAsync(ViewTypes typeOfPage) - => Navigation.PushModalAsync((Page)Activator.CreateInstance(typeOfPage.GetViewType())); + /// Pushes a page onto the modal stack. + /// Page to display. + public Task PushModalAsync(ViewTypes typeOfPage) + => Navigation.PushModalAsync((Page)Activator.CreateInstance(typeOfPage.GetViewType())); - /// Pops a page from the modal stack. - public Task PopModalAsync() - => throw new NotSupportedException(); + /// Pops a page from the modal stack. + public Task PopModalAsync() + => throw new NotSupportedException(); #if USEFLYOUT @@ -123,34 +123,34 @@ namespace TINK.View.Account } #endif - /// - /// Invoked when page is shown. - /// Starts update process. - /// - protected async override void OnAppearing() - => await m_oViewModel.OnAppearing(); - /// - /// Invoked when pages is closed/ hidden. - /// Stops update process. - /// - protected async override void OnDisappearing() - { - if (m_oViewModel == null) - { - // View model might be null. - return; - } - await m_oViewModel.OnDisappearing(); - } + /// + /// Invoked when page is shown. + /// Starts update process. + /// + protected async override void OnAppearing() + => await m_oViewModel.OnAppearing(); + /// + /// Invoked when pages is closed/ hidden. + /// Stops update process. + /// + protected async override void OnDisappearing() + { + if (m_oViewModel == null) + { + // View model might be null. + return; + } + await m_oViewModel.OnDisappearing(); + } - /// Pushes a page onto the stack. - /// Page to display. - public async Task PushAsync(ViewTypes p_oTypeOfPage) - => await Navigation.PushAsync((Page)Activator.CreateInstance(p_oTypeOfPage.GetViewType())); + /// Pushes a page onto the stack. + /// Page to display. + public async Task PushAsync(ViewTypes p_oTypeOfPage) + => await Navigation.PushAsync((Page)Activator.CreateInstance(p_oTypeOfPage.GetViewType())); #if USCSHARP9 public Task DisplayUserFeedbackPopup() => throw new NotSupportedException(); #else - public async Task DisplayUserFeedbackPopup(IBattery battery = null, string co2Saving = null) => throw new NotSupportedException(); + public async Task DisplayUserFeedbackPopup(IBattery battery = null, string co2Saving = null) => throw new NotSupportedException(); #endif - } + } } \ No newline at end of file diff --git a/LastenradBayern/TINK/View/Bike/BCBike.xaml.cs b/LastenradBayern/TINK/View/Bike/BCBike.xaml.cs index 99225d0..b3d8cf4 100644 --- a/LastenradBayern/TINK/View/Bike/BCBike.xaml.cs +++ b/LastenradBayern/TINK/View/Bike/BCBike.xaml.cs @@ -9,12 +9,12 @@ using Xamarin.Forms.Xaml; namespace TINK.View.Bike { - [XamlCompilation(XamlCompilationOptions.Compile)] - public partial class BCBike : ViewCell - { - public BCBike() - { - InitializeComponent(); - } - } + [XamlCompilation(XamlCompilationOptions.Compile)] + public partial class BCBike : ViewCell + { + public BCBike() + { + InitializeComponent(); + } + } } \ No newline at end of file diff --git a/LastenradBayern/TINK/View/Bike/BikeViewCellTemplateSelector.cs b/LastenradBayern/TINK/View/Bike/BikeViewCellTemplateSelector.cs index f77e9f5..215d21d 100644 --- a/LastenradBayern/TINK/View/Bike/BikeViewCellTemplateSelector.cs +++ b/LastenradBayern/TINK/View/Bike/BikeViewCellTemplateSelector.cs @@ -2,24 +2,24 @@ namespace TINK.View.Bike { - /// - /// Selects different templates for different bike types (BordComputer bikes, iLockIt bikes). - /// - public class BikeViewCellTemplateSelector : DataTemplateSelector - { - DataTemplate bCBike; - DataTemplate iLockIBike; + /// + /// Selects different templates for different bike types (BordComputer bikes, iLockIt bikes). + /// + public class BikeViewCellTemplateSelector : DataTemplateSelector + { + DataTemplate bCBike; + DataTemplate iLockIBike; - public BikeViewCellTemplateSelector() - { - bCBike = new DataTemplate(typeof(BCBike)); - iLockIBike = new DataTemplate(typeof(ILockItBike)); - } + public BikeViewCellTemplateSelector() + { + bCBike = new DataTemplate(typeof(BCBike)); + iLockIBike = new DataTemplate(typeof(ILockItBike)); + } - protected override DataTemplate OnSelectTemplate(object item, BindableObject container) - => item is TINK.ViewModel.Bikes.Bike.BluetoothLock.BikeViewModel || - item is TINK.ViewModel.Bikes.Bike.CopriLock.BikeViewModel - ? iLockIBike - : bCBike; - } + protected override DataTemplate OnSelectTemplate(object item, BindableObject container) + => item is TINK.ViewModel.Bikes.Bike.BluetoothLock.BikeViewModel || + item is TINK.ViewModel.Bikes.Bike.CopriLock.BikeViewModel + ? iLockIBike + : bCBike; + } } diff --git a/LastenradBayern/TINK/View/Bike/ILockItBike.xaml.cs b/LastenradBayern/TINK/View/Bike/ILockItBike.xaml.cs index bdd09dd..ff2a14f 100644 --- a/LastenradBayern/TINK/View/Bike/ILockItBike.xaml.cs +++ b/LastenradBayern/TINK/View/Bike/ILockItBike.xaml.cs @@ -9,36 +9,36 @@ using Xamarin.Forms.Xaml; namespace TINK.View.Bike { - [XamlCompilation(XamlCompilationOptions.Compile)] - public partial class ILockItBike : ViewCell - { - public ILockItBike() - { - InitializeComponent(); - } + [XamlCompilation(XamlCompilationOptions.Compile)] + public partial class ILockItBike : ViewCell + { + public ILockItBike() + { + InitializeComponent(); + } - protected override void OnBindingContextChanged() - { - base.OnBindingContextChanged(); + protected override void OnBindingContextChanged() + { + base.OnBindingContextChanged(); - if (Device.RuntimePlatform != Device.iOS) - // Update of size is only required for iOS. - return; + if (Device.RuntimePlatform != Device.iOS) + // Update of size is only required for iOS. + return; - var viewModel = BindingContext as TINK.ViewModel.Bikes.Bike.BluetoothLock.BikeViewModel; - if (viewModel == null) - return; + var viewModel = BindingContext as TINK.ViewModel.Bikes.Bike.BluetoothLock.BikeViewModel; + if (viewModel == null) + return; - viewModel.PropertyChanged += (sender, e) => - { - if (e.PropertyName == nameof(TINK.ViewModel.Bikes.Bike.BC.RequestHandler.Base.IsButtonVisible) - || e.PropertyName == nameof(TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler.Base.IsLockitButtonVisible)) - { - // Force update of view cell on iOS. - // https://hausource.visualstudio.com/TINK/_workitems/edit/132 - ForceUpdateSize(); - } - }; - } - } + viewModel.PropertyChanged += (sender, e) => + { + if (e.PropertyName == nameof(TINK.ViewModel.Bikes.Bike.BC.RequestHandler.Base.IsButtonVisible) + || e.PropertyName == nameof(TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler.Base.IsLockitButtonVisible)) + { + // Force update of view cell on iOS. + // https://hausource.visualstudio.com/TINK/_workitems/edit/132 + ForceUpdateSize(); + } + }; + } + } } \ No newline at end of file diff --git a/LastenradBayern/TINK/View/BikesAtStation/BikesAtStationPage.xaml.cs b/LastenradBayern/TINK/View/BikesAtStation/BikesAtStationPage.xaml.cs index 9312d9f..5cf8817 100644 --- a/LastenradBayern/TINK/View/BikesAtStation/BikesAtStationPage.xaml.cs +++ b/LastenradBayern/TINK/View/BikesAtStation/BikesAtStationPage.xaml.cs @@ -5,38 +5,38 @@ using Xamarin.Forms.Xaml; namespace TINK.View.BikesAtStation { - using System; - using System.Linq; - using System.Threading; - using System.Threading.Tasks; - using TINK.Model.Device; + using System; + using System.Linq; + using System.Threading; + using System.Threading.Tasks; + using TINK.Model.Device; #if USEFLYOUT using TINK.View.MasterDetail; #endif - using TINK.ViewModel; - using TINK.Model; - using TINK.Services.BluetoothLock.Tdo; - using System.Collections.Generic; - using Serilog; - using TINK.Services.BluetoothLock; - using Plugin.BLE; - using TINK.ViewModel.BikesAtStation; - using TINK.ViewModel.Bikes; - using Xamarin.CommunityToolkit.Extensions; - using TINK.Model.Bikes.BikeInfoNS.DriveNS.BatteryNS; + using TINK.ViewModel; + using TINK.Model; + using TINK.Services.BluetoothLock.Tdo; + using System.Collections.Generic; + using Serilog; + using TINK.Services.BluetoothLock; + using Plugin.BLE; + using TINK.ViewModel.BikesAtStation; + using TINK.ViewModel.Bikes; + using Xamarin.CommunityToolkit.Extensions; + using TINK.Model.Bikes.BikeInfoNS.DriveNS.BatteryNS; - [XamlCompilation(XamlCompilationOptions.Compile)] + [XamlCompilation(XamlCompilationOptions.Compile)] #if USEFLYOUT public partial class BikesAtStationPage : ContentPage, IViewService, IDetailPage #else - public partial class BikesAtStationPage : ContentPage, IViewService + public partial class BikesAtStationPage : ContentPage, IViewService #endif - { + { - private BikesAtStationPageViewModel m_oViewModel; + private BikesAtStationPageViewModel m_oViewModel; - /// Initialization status to ensure initialization logic is not called multiple times. - private bool isInitializationStarted = false; + /// Initialization status to ensure initialization logic is not called multiple times. + private bool isInitializationStarted = false; #if TRYNOTBACKSTYLE public BikesAtStationPage() { @@ -55,140 +55,140 @@ namespace TINK.View.BikesAtStation } #else - public BikesAtStationPage() - { - } + public BikesAtStationPage() + { + } #endif - /// - /// Invoked when page is shown. - /// Starts update process. - /// - protected async override void OnAppearing() - { - // Don't repeat the initialization if it has been completed already. - if (isInitializationStarted) return; - isInitializationStarted = true; + /// + /// Invoked when page is shown. + /// Starts update process. + /// + protected async override void OnAppearing() + { + // Don't repeat the initialization if it has been completed already. + if (isInitializationStarted) return; + isInitializationStarted = true; - if (m_oViewModel != null) - { + if (m_oViewModel != null) + { #if BACKSTYLE // Hide master- detail menu to force user to navigate using back button. m_oNavigation.IsGestureEnabled = false; #endif - // 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.OnAppearing(); - isInitializationStarted = false; - return; - } + // 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.OnAppearing(); + isInitializationStarted = false; + return; + } - try - { - var model = App.ModelRoot; + try + { + var model = App.ModelRoot; - // Backup synchronization context when called from GUI-thread. - var synchronizationContext = SynchronizationContext.Current; + // Backup synchronization context when called from GUI-thread. + var synchronizationContext = SynchronizationContext.Current; - m_oViewModel = new BikesAtStationPageViewModel( - model.ActiveUser, - App.PermissionsService, - App.BluetoothService, - Device.RuntimePlatform, - model.SelectedStation, - () => model.GetIsConnected(), - (isConnected) => model.GetConnector(isConnected), - App.LocationServicesContainer.Active, - model.LocksServices.Active, - model.Polling, - (url) => DependencyService.Get().OpenUrl(url), - (d, obj) => synchronizationContext.Post(d, obj), - model.SmartDevice, - this) - { - IsReportLevelVerbose = model.IsReportLevelVerbose - }; - } - catch (Exception exception) - { - Log.ForContext().Error("Displaying bikes at station page failed. {Exception}", exception); - await DisplayAlert("Fehler", $"Seite Räder an Station kann nicht angezeigt werden. ${exception.Message}", "OK"); - isInitializationStarted = false; - return; - } + m_oViewModel = new BikesAtStationPageViewModel( + model.ActiveUser, + App.PermissionsService, + App.BluetoothService, + Device.RuntimePlatform, + model.SelectedStation, + () => model.GetIsConnected(), + (isConnected) => model.GetConnector(isConnected), + App.LocationServicesContainer.Active, + model.LocksServices.Active, + model.Polling, + (url) => DependencyService.Get().OpenUrl(url), + (d, obj) => synchronizationContext.Post(d, obj), + model.SmartDevice, + this) + { + IsReportLevelVerbose = model.IsReportLevelVerbose + }; + } + catch (Exception exception) + { + Log.ForContext().Error("Displaying bikes at station page failed. {Exception}", exception); + await DisplayAlert("Fehler", $"Seite Räder an Station kann nicht angezeigt werden. ${exception.Message}", "OK"); + isInitializationStarted = false; + return; + } - InitializeComponent(); + InitializeComponent(); #if BACKSTYLE // Hide master- detail menu to force user to navigate using back button. m_oNavigation.IsGestureEnabled = false; #endif - BindingContext = m_oViewModel; - BikesAtStationListView.ItemsSource = m_oViewModel; + BindingContext = m_oViewModel; + BikesAtStationListView.ItemsSource = m_oViewModel; - await m_oViewModel.OnAppearing(); - isInitializationStarted = false; - } + await m_oViewModel.OnAppearing(); + isInitializationStarted = false; + } - /// - /// Invoked when pages is closed/ hidden. - /// Stops update process. - /// - protected async override void OnDisappearing() - { - if (m_oViewModel != null) - { - // View model might be null. - await m_oViewModel?.OnDisappearing(); - } + /// + /// Invoked when pages is closed/ hidden. + /// Stops update process. + /// + protected async override void OnDisappearing() + { + if (m_oViewModel != null) + { + // View model might be null. + await m_oViewModel?.OnDisappearing(); + } #if BACKSTYLE if (m_oNavigation!= null) m_oNavigation.IsGestureEnabled = true; // Enables master- detail menu navigation again when page is unloaded. #endif - } + } - /// Displays alert message. - /// Title of message. - /// Message to display. - /// Type of buttons. - public new async Task DisplayAlert(string title, string message, string cancel) - => await App.Current.MainPage.DisplayAlert(title, message, cancel); + /// Displays alert message. + /// Title of message. + /// Message to display. + /// Type of buttons. + public new async Task DisplayAlert(string title, string message, string cancel) + => await App.Current.MainPage.DisplayAlert(title, message, cancel); - /// 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 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 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 title, string message, string accept, string cancel) - => await App.Current.MainPage.DisplayAlert(title, 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 title, string message, string accept, string cancel) + => await App.Current.MainPage.DisplayAlert(title, message, accept, 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 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); #if USEFLYOUT @@ -198,27 +198,27 @@ namespace TINK.View.BikesAtStation public void ShowPage(ViewTypes p_oType, string title = null) => m_oNavigation.ShowPage(p_oType.GetViewType(), title); #else - /// Shows a page. - /// Route of the page to show. - public async Task ShowPage(string route) => await Shell.Current.GoToAsync(route); + /// Shows a page. + /// Route of the page to show. + public async Task ShowPage(string route) => await Shell.Current.GoToAsync(route); #endif - /// Pushes a page onto the modal stack. - /// Page to display. - public async Task PushModalAsync(ViewTypes typeOfPage) - => await Navigation.PushModalAsync((Page)Activator.CreateInstance(typeOfPage.GetViewType())); + /// 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(); - } + /// Pops a page from the modal stack. + public Task PopModalAsync() + { + throw new NotSupportedException(); + } - public Task PushAsync(ViewTypes p_oTypeOfPage) - { - throw new NotImplementedException(); - } + public Task PushAsync(ViewTypes p_oTypeOfPage) + { + throw new NotImplementedException(); + } #if USEFLYOUT /// @@ -239,10 +239,10 @@ namespace TINK.View.BikesAtStation #if USCSHARP9 public async Task DisplayUserFeedbackPopup() => await Navigation.ShowPopupAsync(new FeedbackPopup()); #else - /// Displays user feedback popup. - /// Co2 saving information. - /// User feedback. - public async Task DisplayUserFeedbackPopup(IBattery battery = null, string co2Saving = null) => await Navigation.ShowPopupAsync(new FeedbackPopup(battery, co2Saving)); + /// Displays user feedback popup. + /// Co2 saving information. + /// User feedback. + public async Task DisplayUserFeedbackPopup(IBattery battery = null, string co2Saving = null) => await Navigation.ShowPopupAsync(new FeedbackPopup(battery, co2Saving)); #endif - } + } } \ No newline at end of file diff --git a/LastenradBayern/TINK/View/BoolInverterConverter.cs b/LastenradBayern/TINK/View/BoolInverterConverter.cs index bbd7296..9fc95cd 100644 --- a/LastenradBayern/TINK/View/BoolInverterConverter.cs +++ b/LastenradBayern/TINK/View/BoolInverterConverter.cs @@ -4,16 +4,16 @@ using Xamarin.Forms; namespace TINK.View { - /// Inverts a bool. - public class BoolInverterConverter : IValueConverter - { - /// Inverts a bool. - /// Bool to invert. - /// Inverted bool. - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) - => value is bool flag && !flag; + /// Inverts a bool. + public class BoolInverterConverter : IValueConverter + { + /// Inverts a bool. + /// Bool to invert. + /// Inverted bool. + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + => value is bool flag && !flag; - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - => value is bool flag && !flag; - } + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + => value is bool flag && !flag; + } } diff --git a/LastenradBayern/TINK/View/Contact/ContactPage.xaml b/LastenradBayern/TINK/View/Contact/ContactPage.xaml index 04f6a90..eca477a 100644 --- a/LastenradBayern/TINK/View/Contact/ContactPage.xaml +++ b/LastenradBayern/TINK/View/Contact/ContactPage.xaml @@ -50,7 +50,7 @@ IsVisible="{Binding MailAddressText, Converter={StaticResource StringNotNullOrEmpty_Converter}}" Text="{Binding MailAddressText}" IsEnabled="{Binding IsSendMailAvailable}" - Command="{Binding OnMailRequest}"/> + Command="{Binding OnMailToOperatorRequest}"/> - private ContactPageViewModel ViewModel { get; set; } + { + /// View model to notify view model if page appears. + private ContactPageViewModel ViewModel { get; set; } - public ContactPage() - { - InitializeComponent(); + public ContactPage() + { + InitializeComponent(); - ViewModel = new ContactPageViewModel(App.ModelRoot.Uris.ActiveUri, - AppInfo.Name, - () => App.CreateAttachment(), - () => DependencyService.Get().OpenUrl(DependencyService.Get().StoreUrl), - this); + ViewModel = new ContactPageViewModel( + App.ModelRoot.Flavor.GetDisplayName(), + () => App.CreateAttachment(), + () => DependencyService.Get().OpenUrl(DependencyService.Get().StoreUrl), + this); - ContactPageView.BindingContext = ViewModel; - } + ContactPageView.BindingContext = ViewModel; + } - /// Invoked when page is shown. - protected async override void OnAppearing() - { - try - { - Log.ForContext().Verbose("OnAppearing..."); + /// Invoked when page is shown. + protected async override void OnAppearing() + { + try + { + Log.ForContext().Verbose("OnAppearing..."); - await ViewModel.OnAppearing(App.ModelRoot.SelectedStation); - } - catch (Exception exception) - { - Log.ForContext().Error("Invoking OnAppearing on view model failed. {Exception}", exception); - return; - } - } + await ViewModel.OnAppearing(App.ModelRoot.SelectedStation); + } + catch (Exception exception) + { + Log.ForContext().Error("Invoking OnAppearing on view model failed. {Exception}", exception); + return; + } + } - /// 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 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 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); #if USEFLYOUT public void ShowPage(ViewTypes p_oType, string title = null) => NavigationMasterDetail.ShowPage(p_oType.GetViewType(), title); #else - /// Shows a page. - /// Route of the page to show. - public async Task ShowPage(string route) => await Shell.Current.GoToAsync(route); + /// Shows a page. + /// Route of the page to show. + public async Task ShowPage(string route) => await Shell.Current.GoToAsync(route); #endif - /// Pushes a page onto the modal stack. - /// Page to display. - public Task PushModalAsync(ViewTypes p_oTypeOfPage) - { - throw new NotSupportedException(); - } + /// Pushes a page onto the modal stack. + /// Page to display. + public Task PushModalAsync(ViewTypes p_oTypeOfPage) + { + throw new NotSupportedException(); + } - /// Pops a page from the modal stack. - public Task PopModalAsync() - { - throw new NotSupportedException(); - } + /// Pops a page from the modal stack. + public Task PopModalAsync() + { + throw new NotSupportedException(); + } - /// Pushes a page onto the stack. - /// Page to display. - public async Task PushAsync(ViewTypes typeOfPage) - { + /// Pushes a page onto the stack. + /// Page to display. + public async Task PushAsync(ViewTypes typeOfPage) + { #if USEFLYOUT var page = Activator.CreateInstance(typeOfPage.GetViewType()) as IDetailPage; #else - var page = Activator.CreateInstance(typeOfPage.GetViewType()); + var page = Activator.CreateInstance(typeOfPage.GetViewType()); #endif - if (page == null) - { - return; - } + if (page == null) + { + return; + } #if USEFLYOUT page.NavigationMasterDetail = NavigationMasterDetail; #endif - await Navigation.PushAsync((Page)page); - } + await Navigation.PushAsync((Page)page); + } #if USCSHARP9 public Task DisplayUserFeedbackPopup() => throw new NotSupportedException(); #else - public async Task DisplayUserFeedbackPopup(IBattery battery = null, string co2Saving = null) => throw new NotSupportedException(); + public async Task DisplayUserFeedbackPopup(IBattery battery = null, string co2Saving = null) => throw new NotSupportedException(); #endif #if USEFLYOUT @@ -129,5 +130,5 @@ namespace TINK.View.Contact /// public INavigationMasterDetail NavigationMasterDetail { set; private get; } #endif - } + } } \ No newline at end of file diff --git a/LastenradBayern/TINK/View/Contact/SelectStationPage.xaml.cs b/LastenradBayern/TINK/View/Contact/SelectStationPage.xaml.cs index 08f0319..c9a7d51 100644 --- a/LastenradBayern/TINK/View/Contact/SelectStationPage.xaml.cs +++ b/LastenradBayern/TINK/View/Contact/SelectStationPage.xaml.cs @@ -8,67 +8,67 @@ using Xamarin.Forms.Xaml; namespace TINK.View.Contact { - using Serilog; - using TINK.Model; - using TINK.Model.Bikes.BikeInfoNS.DriveNS.BatteryNS; - using TINK.ViewModel.Contact; + using Serilog; + using TINK.Model; + using TINK.Model.Bikes.BikeInfoNS.DriveNS.BatteryNS; + using TINK.ViewModel.Contact; - [XamlCompilation(XamlCompilationOptions.Compile)] + [XamlCompilation(XamlCompilationOptions.Compile)] #if USEFLYOUT public partial class SelectStationPage : ContentPage, IViewService, IDetailPage #else - public partial class SelectStationPage : ContentPage, IViewService + public partial class SelectStationPage : ContentPage, IViewService #endif - { - /// View model to notify about whether page appears or hides. - private SelectStationPageViewModel SelectStationPageViewModel { get; set; } + { + /// View model to notify about whether page appears or hides. + private SelectStationPageViewModel SelectStationPageViewModel { get; set; } - public SelectStationPage() - { - InitializeComponent(); - } + public SelectStationPage() + { + InitializeComponent(); + } - /// - /// Displays alert message. - /// - /// Title of message. - /// Message to display. - /// Type of buttons. - public new async Task DisplayAlert(string title, string message, string cancel) - => await App.Current.MainPage.DisplayAlert(title, message, cancel); + /// + /// Displays alert message. + /// + /// Title of message. + /// Message to display. + /// Type of buttons. + public new async Task DisplayAlert(string title, string message, string cancel) + => await App.Current.MainPage.DisplayAlert(title, message, cancel); - /// 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 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 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 title, string message, string accept, string cancel) - => await App.Current.MainPage.DisplayAlert(title, 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 title, string message, string accept, string cancel) + => await App.Current.MainPage.DisplayAlert(title, message, accept, cancel); #if USEFLYOUT /// @@ -78,45 +78,45 @@ namespace TINK.View.Contact public void ShowPage(ViewTypes type, string title = null) => NavigationMasterDetail.ShowPage(type.GetViewType(), title); #else - /// Shows a page. - /// Route of the page to show. - public async Task ShowPage(string route) => await Shell.Current.GoToAsync(route); + /// Shows a page. + /// Route of the page to show. + public async Task ShowPage(string route) => await Shell.Current.GoToAsync(route); #endif - /// Pushes a page onto the modal stack. - /// Type of page to display. - public async Task PushModalAsync(ViewTypes typeOfPage) - => await Navigation.PushModalAsync((Page)Activator.CreateInstance(typeOfPage.GetViewType())); + /// Pushes a page onto the modal stack. + /// Type of 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 async Task PopModalAsync() - => await Navigation.PopModalAsync(); + /// Pops a page from the modal stack. + public async Task PopModalAsync() + => await Navigation.PopModalAsync(); - /// Pushes a page onto the stack. - /// Page to display. - public async Task PushAsync(ViewTypes typeOfPage) - { + /// Pushes a page onto the stack. + /// Page to display. + public async Task PushAsync(ViewTypes typeOfPage) + { #if USEFLYOUT var page = Activator.CreateInstance(typeOfPage.GetViewType()) as IDetailPage; #else - var page = Activator.CreateInstance(typeOfPage.GetViewType()); + var page = Activator.CreateInstance(typeOfPage.GetViewType()); #endif - if (page == null) - { - return; - } + if (page == null) + { + return; + } #if USEFLYOUT page.NavigationMasterDetail = NavigationMasterDetail; #endif - await Navigation.PushAsync((Page)page); - } + await Navigation.PushAsync((Page)page); + } #if USCSHARP9 public Task DisplayUserFeedbackPopup() => throw new NotSupportedException(); #else - public async Task DisplayUserFeedbackPopup(IBattery battery = null, string co2Saving = null) => throw new NotSupportedException(); + public async Task DisplayUserFeedbackPopup(IBattery battery = null, string co2Saving = null) => throw new NotSupportedException(); #endif #if USEFLYOUT @@ -124,86 +124,86 @@ namespace TINK.View.Contact public INavigationMasterDetail NavigationMasterDetail { private get; set; } #endif - /// - /// Invoked when page is shown. - /// Starts update process. - /// - protected async override void OnAppearing() - { - // Pass reference to member Navigation to show bikes at station x dialog. - try - { - Log.ForContext().Verbose("Constructing select station view model."); + /// + /// Invoked when page is shown. + /// Starts update process. + /// + protected async override void OnAppearing() + { + // Pass reference to member Navigation to show bikes at station x dialog. + try + { + Log.ForContext().Verbose("Constructing select station view model."); #if TRYNOTBACKSTYLE SelectStationPageViewModel = new SelectStationPageViewModel(); #else - SelectStationPageViewModel = new SelectStationPageViewModel( - App.ModelRoot, - App.PermissionsService, - App.BluetoothService, - App.LocationServicesContainer.Active, - (mapspan) => MyMap.MoveToRegion(mapspan), - this, - Navigation); + SelectStationPageViewModel = new SelectStationPageViewModel( + App.ModelRoot, + App.PermissionsService, + App.BluetoothService, + App.LocationServicesContainer.Active, + (mapspan) => MyMap.MoveToRegion(mapspan), + this, + Navigation); #endif - } - catch (Exception exception) - { + } + catch (Exception exception) + { - Log.ForContext().Error("Constructing select station view model failed. {Exception}", exception); - return; - } + Log.ForContext().Error("Constructing select station view model failed. {Exception}", exception); + return; + } - try - { - BindingContext = SelectStationPageViewModel; + try + { + BindingContext = SelectStationPageViewModel; #if USEFLYOUT SelectStationPageViewModel.NavigationMasterDetail = NavigationMasterDetail; #endif - } - catch (Exception exception) - { - Log.ForContext().Error("Setting binding/ navigaton on select station failed. {Exception}", exception); - return; - } + } + catch (Exception exception) + { + Log.ForContext().Error("Setting binding/ navigaton on select station failed. {Exception}", exception); + return; + } - try - { - base.OnAppearing(); - } - catch (Exception exception) - { - // Continue because styling is not essential. - Log.ForContext().Error("Invoking OnAppearing of base failed. {Exception}", exception); - return; - } + try + { + base.OnAppearing(); + } + catch (Exception exception) + { + // Continue because styling is not essential. + Log.ForContext().Error("Invoking OnAppearing of base failed. {Exception}", exception); + return; + } - try - { - // Pre move and scanle maps to avoid initial display of map in Rome. - Log.ForContext().Verbose("Moving and scaling map."); - SelectStationPageViewModel.MoveAndScale( - (mapSpan) => MyMap.MoveToRegion(mapSpan), - App.ModelRoot.Uris.ActiveUri); - } - 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); - } + try + { + // Pre move and scanle maps to avoid initial display of map in Rome. + Log.ForContext().Verbose("Moving and scaling map."); + SelectStationPageViewModel.MoveAndScale( + (mapSpan) => MyMap.MoveToRegion(mapSpan), + App.ModelRoot.Uris.ActiveUri); + } + 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); + } - try - { - Log.ForContext().Verbose("Invoking OnAppearing on select station view model."); - await SelectStationPageViewModel.OnAppearing(); - } - catch (Exception exception) - { - Log.ForContext().Error("Invoking OnAppearing on select station view model failed. {Exception}", exception); - return; - } - } - } + try + { + Log.ForContext().Verbose("Invoking OnAppearing on select station view model."); + await SelectStationPageViewModel.OnAppearing(); + } + catch (Exception exception) + { + Log.ForContext().Error("Invoking OnAppearing on select station view model failed. {Exception}", exception); + return; + } + } + } } \ No newline at end of file diff --git a/LastenradBayern/TINK/View/CopriWebView/ManageAccountPage.xaml.cs b/LastenradBayern/TINK/View/CopriWebView/ManageAccountPage.xaml.cs index 7469312..68feb69 100644 --- a/LastenradBayern/TINK/View/CopriWebView/ManageAccountPage.xaml.cs +++ b/LastenradBayern/TINK/View/CopriWebView/ManageAccountPage.xaml.cs @@ -7,53 +7,53 @@ using Xamarin.Forms.Xaml; namespace TINK.View.CopriWebView { - [XamlCompilation(XamlCompilationOptions.Compile)] - public partial class ManageAccountPage : ContentPage - { - public ManageAccountPage() - { - InitializeComponent(); + [XamlCompilation(XamlCompilationOptions.Compile)] + public partial class ManageAccountPage : ContentPage + { + public ManageAccountPage() + { + InitializeComponent(); - ManageAccount.Navigating += (sender, ev) => - { - 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 += (sender, ev) => + { + 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; + } - DependencyService.Get().OpenUrl(ev.Url); - }; + DependencyService.Get().OpenUrl(ev.Url); + }; - ManageAccount.Navigated += (sender, ev) => - { - if (ev.Result == WebNavigationResult.Success) - { - this.IsEnabled = true; - ActivityIndicatorLoading.IsVisible = false; - ActivityIndicatorLoading.IsRunning = false; - return; - } + 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?" - }; + 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; - }; + this.IsEnabled = true; + ActivityIndicatorLoading.IsVisible = false; + ActivityIndicatorLoading.IsRunning = false; + }; - ManageAccount.BindingContext = new ManageAccountViewModel( - App.ModelRoot.ActiveUser.SessionCookie, - Model.TinkApp.MerchantId, - CultureInfo.CurrentUICulture.TwoLetterISOLanguageName, - App.ModelRoot.NextActiveUri.Host); - } - } + ManageAccount.BindingContext = new ManageAccountViewModel( + App.ModelRoot.ActiveUser.SessionCookie, + Model.TinkApp.MerchantId, + CultureInfo.CurrentUICulture.TwoLetterISOLanguageName, + App.ModelRoot.NextActiveUri.Host); + } + } } \ No newline at end of file diff --git a/LastenradBayern/TINK/View/CopriWebView/PasswordForgottenPage.xaml.cs b/LastenradBayern/TINK/View/CopriWebView/PasswordForgottenPage.xaml.cs index 666b74c..c906c33 100644 --- a/LastenradBayern/TINK/View/CopriWebView/PasswordForgottenPage.xaml.cs +++ b/LastenradBayern/TINK/View/CopriWebView/PasswordForgottenPage.xaml.cs @@ -7,45 +7,45 @@ using Xamarin.Forms.Xaml; namespace TINK.View.CopriWebView { - [XamlCompilation(XamlCompilationOptions.Compile)] - public partial class PasswordForgottenPage : ContentPage - { - public PasswordForgottenPage() - { - InitializeComponent(); + [XamlCompilation(XamlCompilationOptions.Compile)] + public partial class PasswordForgottenPage : ContentPage + { + public PasswordForgottenPage() + { + InitializeComponent(); - PasswordForgottenWebView.Navigating += (sender, ev) => - { - this.IsEnabled = false; - ActivityIndicatorLoading.IsVisible = true; - ActivityIndicatorLoading.IsRunning = true; - }; + PasswordForgottenWebView.Navigating += (sender, ev) => + { + this.IsEnabled = false; + ActivityIndicatorLoading.IsVisible = true; + ActivityIndicatorLoading.IsRunning = true; + }; - PasswordForgottenWebView.Navigated += (sender, ev) => - { - if (ev.Result == WebNavigationResult.Success) - { - this.IsEnabled = true; - ActivityIndicatorLoading.IsVisible = false; - ActivityIndicatorLoading.IsRunning = false; - return; - } + PasswordForgottenWebView.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}", ev); - PasswordForgottenWebView.Source = new HtmlWebViewSource - { - Html = "Kann Passwort vergessen Seite nicht anzeigen!
Verbindung mit Internet ok?" - }; + Log.ForContext().Error("Navigation did not succeed. {@Event}", ev); + PasswordForgottenWebView.Source = new HtmlWebViewSource + { + Html = "Kann Passwort vergessen Seite nicht anzeigen!
Verbindung mit Internet ok?" + }; - this.IsEnabled = true; - ActivityIndicatorLoading.IsVisible = false; - ActivityIndicatorLoading.IsRunning = false; - }; + this.IsEnabled = true; + ActivityIndicatorLoading.IsVisible = false; + ActivityIndicatorLoading.IsRunning = false; + }; - PasswordForgottenWebView.BindingContext = new PasswordForgottonViewModel( - Model.TinkApp.MerchantId, - CultureInfo.CurrentUICulture.TwoLetterISOLanguageName, - App.ModelRoot.NextActiveUri.Host); - } - } + PasswordForgottenWebView.BindingContext = new PasswordForgottonViewModel( + Model.TinkApp.MerchantId, + CultureInfo.CurrentUICulture.TwoLetterISOLanguageName, + App.ModelRoot.NextActiveUri.Host); + } + } } \ No newline at end of file diff --git a/LastenradBayern/TINK/View/CopriWebView/RegisterPage.xaml.cs b/LastenradBayern/TINK/View/CopriWebView/RegisterPage.xaml.cs index 6d5fd7b..e69cd6b 100644 --- a/LastenradBayern/TINK/View/CopriWebView/RegisterPage.xaml.cs +++ b/LastenradBayern/TINK/View/CopriWebView/RegisterPage.xaml.cs @@ -8,48 +8,48 @@ using Xamarin.Forms.Xaml; namespace TINK.View.CopriWebView { - [XamlCompilation(XamlCompilationOptions.Compile)] - public partial class RegisterPage : ContentPage - { - public RegisterPage() - { - DependencyService.Get().ClearCookies(); + [XamlCompilation(XamlCompilationOptions.Compile)] + public partial class RegisterPage : ContentPage + { + public RegisterPage() + { + DependencyService.Get().ClearCookies(); - InitializeComponent(); + InitializeComponent(); - RegisterView.Navigating += (sender, ev) => - { - this.IsEnabled = false; - ActivityIndicatorLoading.IsVisible = true; - ActivityIndicatorLoading.IsRunning = true; - }; + RegisterView.Navigating += (sender, ev) => + { + this.IsEnabled = false; + ActivityIndicatorLoading.IsVisible = true; + ActivityIndicatorLoading.IsRunning = true; + }; - RegisterView.Navigated += (sender, ev) => - { - if (ev.Result == WebNavigationResult.Success) - { - this.IsEnabled = true; - ActivityIndicatorLoading.IsVisible = false; - ActivityIndicatorLoading.IsRunning = false; - return; - } + RegisterView.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}", ev); - RegisterView.Source = new HtmlWebViewSource - { - Html = "Kann Anmeldeseite nicht anzeigen!
Verbindung mit Internet ok?" - }; + Log.ForContext().Error("Navigation did not succeed. {@Event}", ev); + RegisterView.Source = new HtmlWebViewSource + { + Html = "Kann Anmeldeseite nicht anzeigen!
Verbindung mit Internet ok?" + }; - this.IsEnabled = true; - ActivityIndicatorLoading.IsVisible = false; - ActivityIndicatorLoading.IsRunning = false; - }; + this.IsEnabled = true; + ActivityIndicatorLoading.IsVisible = false; + ActivityIndicatorLoading.IsRunning = false; + }; - RegisterView.BindingContext = new RegisterPageViewModel( - Model.TinkApp.MerchantId, - CultureInfo.CurrentUICulture.TwoLetterISOLanguageName, - App.ModelRoot.NextActiveUri.Host); + RegisterView.BindingContext = new RegisterPageViewModel( + Model.TinkApp.MerchantId, + CultureInfo.CurrentUICulture.TwoLetterISOLanguageName, + App.ModelRoot.NextActiveUri.Host); - } - } + } + } } \ No newline at end of file diff --git a/LastenradBayern/TINK/View/FeedbackPopup.xaml b/LastenradBayern/TINK/View/FeedbackPopup.xaml index d83d3b7..b1c903b 100644 --- a/LastenradBayern/TINK/View/FeedbackPopup.xaml +++ b/LastenradBayern/TINK/View/FeedbackPopup.xaml @@ -10,105 +10,75 @@ - - - - - - - - - - - - - - + + + - - - - - - - + + + + x:Name="Co2SavingFrame">