diff --git a/src/App/Handlers/HybridWebViewHandler.cs b/src/App/Handlers/HybridWebViewHandler.cs deleted file mode 100644 index eb8acc495..000000000 --- a/src/App/Handlers/HybridWebViewHandler.cs +++ /dev/null @@ -1,25 +0,0 @@ -#if IOS || MACCATALYST -using PlatformView = WebKit.WKWebView; -#elif ANDROID -using PlatformView = Android.Webkit.WebView; -#elif (NETSTANDARD || !PLATFORM) || (NET6_0_OR_GREATER && !IOS && !ANDROID) -using PlatformView = System.Object; -#endif - -using Bit.App.Controls; -using Microsoft.Maui.Handlers; - -namespace Bit.App.Handlers -{ - public partial class HybridWebViewHandler - { - public static PropertyMapper PropertyMapper = new PropertyMapper(ViewHandler.ViewMapper) - { - [nameof(HybridWebView.Uri)] = MapUri - }; - - public HybridWebViewHandler() : base(PropertyMapper) - { - } - } -} diff --git a/src/App/MauiProgram.cs b/src/App/MauiProgram.cs index 0822e59a7..1157399e5 100644 --- a/src/App/MauiProgram.cs +++ b/src/App/MauiProgram.cs @@ -13,7 +13,6 @@ }, handlers => { - handlers.AddHandler(typeof(Bit.App.Controls.HybridWebView), typeof(Bit.App.Handlers.HybridWebViewHandler)); #if ANDROID Bit.App.Handlers.EntryHandlerMappings.Setup(); Bit.App.Handlers.EditorHandlerMappings.Setup(); @@ -28,6 +27,7 @@ Bit.App.Handlers.ButtonHandlerMappings.Setup(); Bit.App.Handlers.ToolbarHandlerMappings.Setup(); + handlers.AddHandler(typeof(Bit.App.Controls.HybridWebView), typeof(Bit.App.Handlers.HybridWebViewHandler)); handlers.AddHandler(typeof(Bit.App.Pages.TabsPage), typeof(Bit.App.Handlers.CustomTabbedPageHandler)); handlers.AddHandler(typeof(Bit.App.Controls.ExtendedDatePicker), typeof(Bit.App.Handlers.ExtendedDatePickerHandler)); #else diff --git a/src/App/Platforms/Android/AndroidManifest.xml b/src/App/Platforms/Android/AndroidManifest.xml index 2f3d812e2..9f703c01b 100644 --- a/src/App/Platforms/Android/AndroidManifest.xml +++ b/src/App/Platforms/Android/AndroidManifest.xml @@ -1,5 +1,5 @@  - + diff --git a/src/App/Platforms/Android/Handlers/HybridWebViewHandler.cs b/src/App/Platforms/Android/Handlers/HybridWebViewHandler.cs index 7c7bcfbd5..708b72743 100644 --- a/src/App/Platforms/Android/Handlers/HybridWebViewHandler.cs +++ b/src/App/Platforms/Android/Handlers/HybridWebViewHandler.cs @@ -6,10 +6,19 @@ using AWebkit = Android.Webkit; namespace Bit.App.Handlers { - public partial class HybridWebViewHandler : ViewHandler + public class HybridWebViewHandler : ViewHandler { private const string JSFunction = "function invokeCSharpAction(data){jsBridge.invokeAction(data);}"; + public static PropertyMapper PropertyMapper = new PropertyMapper(ViewHandler.ViewMapper) + { + [nameof(HybridWebView.Uri)] = MapUri + }; + + public HybridWebViewHandler() : base(PropertyMapper) + { + } + public HybridWebViewHandler([NotNull] IPropertyMapper mapper, CommandMapper commandMapper = null) : base(mapper, commandMapper) { } diff --git a/src/App/Platforms/iOS/Info.plist b/src/App/Platforms/iOS/Info.plist index 7fcff1107..d82c64a97 100644 --- a/src/App/Platforms/iOS/Info.plist +++ b/src/App/Platforms/iOS/Info.plist @@ -11,7 +11,7 @@ CFBundleIdentifier com.8bit.bitwarden CFBundleShortVersionString - 2024.2.0 + 2024.2.1 CFBundleVersion 1 CFBundleIconName diff --git a/src/Core/Controls/CachedImage.cs b/src/Core/Controls/CachedImage.cs index da4917d81..3f95dc1bf 100644 --- a/src/Core/Controls/CachedImage.cs +++ b/src/Core/Controls/CachedImage.cs @@ -32,6 +32,11 @@ get { return (Aspect)GetValue(AspectProperty); } set { SetValue(AspectProperty, value); } } + + public bool IsLoading { get; set; } + + public event EventHandler Success; + public event EventHandler Error; } #endif } diff --git a/src/Core/Controls/CipherViewCell/BaseCipherViewCell.cs b/src/Core/Controls/CipherViewCell/BaseCipherViewCell.cs index 15bd0dd7f..69fbd75f5 100644 --- a/src/Core/Controls/CipherViewCell/BaseCipherViewCell.cs +++ b/src/Core/Controls/CipherViewCell/BaseCipherViewCell.cs @@ -47,6 +47,7 @@ namespace Bit.App.Controls }); } +#if !UT public void Icon_Success(object sender, FFImageLoading.Maui.CachedImageEvents.SuccessEventArgs e) { if (BindingContext is CipherItemViewModel cipherItemVM) @@ -72,6 +73,10 @@ namespace Bit.App.Controls IconPlaceholder.IsVisible = true; }); } +#else + private void Icon_Success(object sender, EventArgs e) {} + private void Icon_Error(object sender, EventArgs e) {} +#endif } public class StubBaseCipherViewCellSoLinkerDoesntRemoveMethods : BaseCipherViewCell @@ -81,6 +86,7 @@ namespace Bit.App.Controls public static void CallThisSoLinkerDoesntRemoveMethods() { +#if !UT var stub = new StubBaseCipherViewCellSoLinkerDoesntRemoveMethods(); try @@ -98,6 +104,7 @@ namespace Bit.App.Controls catch (Exception) { } +#endif } } } diff --git a/src/Core/Pages/Send/SendAddEditPage.xaml.cs b/src/Core/Pages/Send/SendAddEditPage.xaml.cs index a41efe58c..134d4608a 100644 --- a/src/Core/Pages/Send/SendAddEditPage.xaml.cs +++ b/src/Core/Pages/Send/SendAddEditPage.xaml.cs @@ -181,6 +181,16 @@ namespace Bit.App.Pages private void OnMaxAccessCountTextChanged(object sender, TextChangedEventArgs e) { + var maxAccessEntry = (Microsoft.Maui.Controls.Entry)sender; + +#if IOS + // HACK: To avoid a bug that incorrectly sets the TextColor when changing text + // programatically we need to set it to null and back to the correct color + // MAUI issue https://github.com/dotnet/maui/pull/20100 + maxAccessEntry.TextColor = null; + maxAccessEntry.TextColor = ThemeManager.GetResourceColor("TextColor"); +#endif + if (string.IsNullOrWhiteSpace(e.NewTextValue)) { _vm.MaxAccessCount = null; @@ -190,7 +200,7 @@ namespace Bit.App.Pages // accept only digits if (!int.TryParse(e.NewTextValue, out int _)) { - ((Microsoft.Maui.Controls.Entry)sender).Text = e.OldTextValue; + maxAccessEntry.Text = e.OldTextValue; } } diff --git a/src/Core/Pages/Vault/CipherAddEditPage.xaml.cs b/src/Core/Pages/Vault/CipherAddEditPage.xaml.cs index 1ff0be66c..2aa659d1b 100644 --- a/src/Core/Pages/Vault/CipherAddEditPage.xaml.cs +++ b/src/Core/Pages/Vault/CipherAddEditPage.xaml.cs @@ -268,6 +268,14 @@ namespace Bit.App.Pages { await Navigation.PopModalAsync(); await _vm.UpdateTotpKeyAsync(key); + +#if IOS + // HACK: To avoid a bug that incorrectly sets the TextColor when changing text + // programatically we need to set it to null and back to the correct color + // MAUI issue https://github.com/dotnet/maui/pull/20100 + _loginTotpEntry.TextColor = null; + _loginTotpEntry.TextColor = ThemeManager.GetResourceColor("TextColor"); +#endif } catch (Exception ex) { diff --git a/src/iOS.Autofill/Info.plist b/src/iOS.Autofill/Info.plist index 6f76ab889..71b88905c 100644 --- a/src/iOS.Autofill/Info.plist +++ b/src/iOS.Autofill/Info.plist @@ -11,7 +11,7 @@ CFBundleIdentifier com.8bit.bitwarden.autofill CFBundleShortVersionString - 2024.2.0 + 2024.2.1 CFBundleVersion 1 CFBundleLocalizations diff --git a/src/App/Platforms/iOS/Handlers/HybridWebViewHandler.cs b/src/iOS.Core/Handlers/HybridWebViewHandler.cs similarity index 86% rename from src/App/Platforms/iOS/Handlers/HybridWebViewHandler.cs rename to src/iOS.Core/Handlers/HybridWebViewHandler.cs index 694128f42..537555dec 100644 --- a/src/App/Platforms/iOS/Handlers/HybridWebViewHandler.cs +++ b/src/iOS.Core/Handlers/HybridWebViewHandler.cs @@ -5,15 +5,24 @@ using Foundation; using Microsoft.Maui.Handlers; using WebKit; -namespace Bit.App.Handlers +namespace Bit.iOS.Core.Handlers { - public partial class HybridWebViewHandler : ViewHandler + public class HybridWebViewHandler : ViewHandler { private const string JSFunction = "function invokeCSharpAction(data){window.webkit.messageHandlers.invokeAction.postMessage(data);}"; private WKUserContentController _userController; + public static PropertyMapper PropertyMapper = new PropertyMapper(ViewHandler.ViewMapper) + { + [nameof(HybridWebView.Uri)] = MapUri + }; + + public HybridWebViewHandler() : base(PropertyMapper) + { + } + public HybridWebViewHandler([NotNull] IPropertyMapper mapper, CommandMapper commandMapper = null) : base(mapper, commandMapper) { } diff --git a/src/iOS.Core/Utilities/iOSCoreHelpers.cs b/src/iOS.Core/Utilities/iOSCoreHelpers.cs index cf679e9ab..8e55434f1 100644 --- a/src/iOS.Core/Utilities/iOSCoreHelpers.cs +++ b/src/iOS.Core/Utilities/iOSCoreHelpers.cs @@ -48,6 +48,7 @@ namespace Bit.iOS.Core.Utilities public static void ConfigureMAUIHandlers(IMauiHandlersCollection handlers) { + handlers.AddHandler(typeof(HybridWebView), typeof(Handlers.HybridWebViewHandler)); handlers.AddHandler(typeof(TabsPage), typeof(Handlers.CustomTabbedHandler)); handlers.AddHandler(typeof(NavigationPage), typeof(Handlers.CustomNavigationHandler)); handlers.AddHandler(typeof(ViewCell), typeof(Handlers.CustomViewCellHandler)); diff --git a/src/iOS.Extension/Info.plist b/src/iOS.Extension/Info.plist index 10b2611be..24289c18e 100644 --- a/src/iOS.Extension/Info.plist +++ b/src/iOS.Extension/Info.plist @@ -11,7 +11,7 @@ CFBundleIdentifier com.8bit.bitwarden.find-login-action-extension CFBundleShortVersionString - 2024.2.0 + 2024.2.1 CFBundleLocalizations en diff --git a/src/iOS.ShareExtension/Info.plist b/src/iOS.ShareExtension/Info.plist index 2b274c146..ba68616b6 100644 --- a/src/iOS.ShareExtension/Info.plist +++ b/src/iOS.ShareExtension/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType XPC! CFBundleShortVersionString - 2024.2.0 + 2024.2.1 CFBundleVersion 1 MinimumOSVersion