Merge branch 'feature/maui-migration' into feature/maui-migration-passkeys

This commit is contained in:
Federico Maccaroni 2024-02-08 12:33:16 -03:00
commit 8f8a5795d3
No known key found for this signature in database
GPG Key ID: 5D233F8F2B034536
14 changed files with 59 additions and 35 deletions

View File

@ -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<HybridWebView, HybridWebViewHandler> PropertyMapper = new PropertyMapper<HybridWebView, HybridWebViewHandler>(ViewHandler.ViewMapper)
{
[nameof(HybridWebView.Uri)] = MapUri
};
public HybridWebViewHandler() : base(PropertyMapper)
{
}
}
}

View File

@ -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

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:versionCode="1" android:versionName="2024.2.0" android:installLocation="internalOnly" package="com.x8bit.bitwarden">
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:versionCode="1" android:versionName="2024.2.1" android:installLocation="internalOnly" package="com.x8bit.bitwarden">
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="34" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.NFC" />

View File

@ -6,10 +6,19 @@ using AWebkit = Android.Webkit;
namespace Bit.App.Handlers
{
public partial class HybridWebViewHandler : ViewHandler<HybridWebView, AWebkit.WebView>
public class HybridWebViewHandler : ViewHandler<HybridWebView, AWebkit.WebView>
{
private const string JSFunction = "function invokeCSharpAction(data){jsBridge.invokeAction(data);}";
public static PropertyMapper<HybridWebView, HybridWebViewHandler> PropertyMapper = new PropertyMapper<HybridWebView, HybridWebViewHandler>(ViewHandler.ViewMapper)
{
[nameof(HybridWebView.Uri)] = MapUri
};
public HybridWebViewHandler() : base(PropertyMapper)
{
}
public HybridWebViewHandler([NotNull] IPropertyMapper mapper, CommandMapper commandMapper = null) : base(mapper, commandMapper)
{
}

View File

@ -11,7 +11,7 @@
<key>CFBundleIdentifier</key>
<string>com.8bit.bitwarden</string>
<key>CFBundleShortVersionString</key>
<string>2024.2.0</string>
<string>2024.2.1</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>CFBundleIconName</key>

View File

@ -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
}

View File

@ -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
}
}
}

View File

@ -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;
}
}

View File

@ -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)
{

View File

@ -11,7 +11,7 @@
<key>CFBundleIdentifier</key>
<string>com.8bit.bitwarden.autofill</string>
<key>CFBundleShortVersionString</key>
<string>2024.2.0</string>
<string>2024.2.1</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>CFBundleLocalizations</key>

View File

@ -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<HybridWebView, WebKit.WKWebView>
public class HybridWebViewHandler : ViewHandler<HybridWebView, WebKit.WKWebView>
{
private const string JSFunction =
"function invokeCSharpAction(data){window.webkit.messageHandlers.invokeAction.postMessage(data);}";
private WKUserContentController _userController;
public static PropertyMapper<HybridWebView, HybridWebViewHandler> PropertyMapper = new PropertyMapper<HybridWebView, HybridWebViewHandler>(ViewHandler.ViewMapper)
{
[nameof(HybridWebView.Uri)] = MapUri
};
public HybridWebViewHandler() : base(PropertyMapper)
{
}
public HybridWebViewHandler([NotNull] IPropertyMapper mapper, CommandMapper commandMapper = null) : base(mapper, commandMapper)
{
}

View File

@ -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));

View File

@ -11,7 +11,7 @@
<key>CFBundleIdentifier</key>
<string>com.8bit.bitwarden.find-login-action-extension</string>
<key>CFBundleShortVersionString</key>
<string>2024.2.0</string>
<string>2024.2.1</string>
<key>CFBundleLocalizations</key>
<array>
<string>en</string>

View File

@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>2024.2.0</string>
<string>2024.2.1</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>MinimumOSVersion</key>