From b8f0747dd4e42da612829e56d839d474a80983fb Mon Sep 17 00:00:00 2001 From: Federico Maccaroni Date: Fri, 29 Sep 2023 12:12:01 -0300 Subject: [PATCH] PM-3349 PM-3350 MAUI Migration fix nullable exception bindings and AsyncCommand canExecute null exception --- src/Core/Controls/IconButton.cs | 2 +- src/Core/Controls/IconLabel.cs | 2 +- src/Core/Controls/MiButton.cs | 2 +- src/Core/Controls/MiLabel.cs | 2 +- src/Core/Controls/MonoEntry.cs | 20 ++--- src/Core/Controls/MonoLabel.cs | 2 +- src/Core/Pages/Accounts/HomePage.xaml | 14 ++-- src/Core/Pages/Accounts/HomePage.xaml.cs | 24 +++--- .../Pages/Generator/GeneratorPageViewModel.cs | 57 +++++++------ src/Core/Pages/Send/SendAddEditPage.xaml | 5 +- src/Core/Pages/Vault/CipherAddEditPage.xaml | 80 +++++++++---------- .../Pages/Vault/CipherAddEditPageViewModel.cs | 20 +++-- .../Pages/Vault/CipherDetailsPageViewModel.cs | 11 ++- src/Core/Utilities/AsyncCommand.cs | 14 +++- .../Utilities/LocalizableEnumConverter.cs | 2 +- 15 files changed, 136 insertions(+), 121 deletions(-) diff --git a/src/Core/Controls/IconButton.cs b/src/Core/Controls/IconButton.cs index d27d50626..45ad3c894 100644 --- a/src/Core/Controls/IconButton.cs +++ b/src/Core/Controls/IconButton.cs @@ -16,7 +16,7 @@ namespace Bit.App.Controls FontFamily = "bwi-font"; break; case Device.Android: - FontFamily = "bwi-font.ttf#bwi-font"; + FontFamily = "bwi-font.ttf"; break; } diff --git a/src/Core/Controls/IconLabel.cs b/src/Core/Controls/IconLabel.cs index 6b5e72308..1b4771f80 100644 --- a/src/Core/Controls/IconLabel.cs +++ b/src/Core/Controls/IconLabel.cs @@ -17,7 +17,7 @@ namespace Bit.App.Controls FontFamily = "bwi-font"; break; case Device.Android: - FontFamily = "bwi-font.ttf#bwi-font"; + FontFamily = "bwi-font.ttf"; break; } diff --git a/src/Core/Controls/MiButton.cs b/src/Core/Controls/MiButton.cs index 99309351b..f345af882 100644 --- a/src/Core/Controls/MiButton.cs +++ b/src/Core/Controls/MiButton.cs @@ -15,7 +15,7 @@ namespace Bit.App.Controls FontFamily = "Material Icons"; break; case Device.Android: - FontFamily = "MaterialIcons_Regular.ttf#Material Icons"; + FontFamily = "MaterialIcons_Regular.ttf"; break; } } diff --git a/src/Core/Controls/MiLabel.cs b/src/Core/Controls/MiLabel.cs index 4d510899f..86e838771 100644 --- a/src/Core/Controls/MiLabel.cs +++ b/src/Core/Controls/MiLabel.cs @@ -14,7 +14,7 @@ namespace Bit.App.Controls FontFamily = "Material Icons"; break; case Device.Android: - FontFamily = "MaterialIcons_Regular.ttf#Material Icons"; + FontFamily = "MaterialIcons_Regular.ttf"; break; } } diff --git a/src/Core/Controls/MonoEntry.cs b/src/Core/Controls/MonoEntry.cs index dfa85d849..a43890492 100644 --- a/src/Core/Controls/MonoEntry.cs +++ b/src/Core/Controls/MonoEntry.cs @@ -1,22 +1,14 @@ -using Microsoft.Maui.Controls; -using Microsoft.Maui; - -namespace Bit.App.Controls +namespace Bit.App.Controls { public class MonoEntry : Entry { public MonoEntry() { - // TODO Xamarin.Forms.Device.RuntimePlatform is no longer supported. Use Microsoft.Maui.Devices.DeviceInfo.Platform instead. For more details see https://learn.microsoft.com/en-us/dotnet/maui/migration/forms-projects#device-changes - switch (Device.RuntimePlatform) - { - case Device.iOS: - FontFamily = "Menlo-Regular"; - break; - case Device.Android: - FontFamily = "RobotoMono_Regular.ttf#Roboto Mono"; - break; - } +#if ANDROID + FontFamily = "RobotoMono_Regular"; +#elif IOS + FontFamily = "Menlo-Regular"; +#endif } } } diff --git a/src/Core/Controls/MonoLabel.cs b/src/Core/Controls/MonoLabel.cs index 6baaf399e..09c760b53 100644 --- a/src/Core/Controls/MonoLabel.cs +++ b/src/Core/Controls/MonoLabel.cs @@ -14,7 +14,7 @@ namespace Bit.App.Controls FontFamily = "Menlo-Regular"; break; case Device.Android: - FontFamily = "RobotoMono_Regular.ttf#Roboto Mono"; + FontFamily = "RobotoMono_Regular.ttf"; break; } } diff --git a/src/Core/Pages/Accounts/HomePage.xaml b/src/Core/Pages/Accounts/HomePage.xaml index 1bace759a..c419ccd15 100644 --- a/src/Core/Pages/Accounts/HomePage.xaml +++ b/src/Core/Pages/Accounts/HomePage.xaml @@ -14,7 +14,7 @@ - + AutomationId="AccountIconButton" /> - + -