mirror of
https://github.com/bitwarden/mobile.git
synced 2024-09-28 03:57:43 +02:00
Merge branch 'feature/maui-migration' into feature/maui-migration-passkeys
This commit is contained in:
commit
8f8a5795d3
@ -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)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -13,7 +13,6 @@
|
|||||||
},
|
},
|
||||||
handlers =>
|
handlers =>
|
||||||
{
|
{
|
||||||
handlers.AddHandler(typeof(Bit.App.Controls.HybridWebView), typeof(Bit.App.Handlers.HybridWebViewHandler));
|
|
||||||
#if ANDROID
|
#if ANDROID
|
||||||
Bit.App.Handlers.EntryHandlerMappings.Setup();
|
Bit.App.Handlers.EntryHandlerMappings.Setup();
|
||||||
Bit.App.Handlers.EditorHandlerMappings.Setup();
|
Bit.App.Handlers.EditorHandlerMappings.Setup();
|
||||||
@ -28,6 +27,7 @@
|
|||||||
Bit.App.Handlers.ButtonHandlerMappings.Setup();
|
Bit.App.Handlers.ButtonHandlerMappings.Setup();
|
||||||
Bit.App.Handlers.ToolbarHandlerMappings.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.Pages.TabsPage), typeof(Bit.App.Handlers.CustomTabbedPageHandler));
|
||||||
handlers.AddHandler(typeof(Bit.App.Controls.ExtendedDatePicker), typeof(Bit.App.Handlers.ExtendedDatePickerHandler));
|
handlers.AddHandler(typeof(Bit.App.Controls.ExtendedDatePicker), typeof(Bit.App.Handlers.ExtendedDatePickerHandler));
|
||||||
#else
|
#else
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?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-sdk android:minSdkVersion="21" android:targetSdkVersion="34" />
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
<uses-permission android:name="android.permission.NFC" />
|
<uses-permission android:name="android.permission.NFC" />
|
||||||
|
@ -6,10 +6,19 @@ using AWebkit = Android.Webkit;
|
|||||||
|
|
||||||
namespace Bit.App.Handlers
|
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);}";
|
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)
|
public HybridWebViewHandler([NotNull] IPropertyMapper mapper, CommandMapper commandMapper = null) : base(mapper, commandMapper)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
<key>CFBundleIdentifier</key>
|
<key>CFBundleIdentifier</key>
|
||||||
<string>com.8bit.bitwarden</string>
|
<string>com.8bit.bitwarden</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>2024.2.0</string>
|
<string>2024.2.1</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>1</string>
|
<string>1</string>
|
||||||
<key>CFBundleIconName</key>
|
<key>CFBundleIconName</key>
|
||||||
|
@ -32,6 +32,11 @@
|
|||||||
get { return (Aspect)GetValue(AspectProperty); }
|
get { return (Aspect)GetValue(AspectProperty); }
|
||||||
set { SetValue(AspectProperty, value); }
|
set { SetValue(AspectProperty, value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool IsLoading { get; set; }
|
||||||
|
|
||||||
|
public event EventHandler Success;
|
||||||
|
public event EventHandler Error;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -47,6 +47,7 @@ namespace Bit.App.Controls
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !UT
|
||||||
public void Icon_Success(object sender, FFImageLoading.Maui.CachedImageEvents.SuccessEventArgs e)
|
public void Icon_Success(object sender, FFImageLoading.Maui.CachedImageEvents.SuccessEventArgs e)
|
||||||
{
|
{
|
||||||
if (BindingContext is CipherItemViewModel cipherItemVM)
|
if (BindingContext is CipherItemViewModel cipherItemVM)
|
||||||
@ -72,6 +73,10 @@ namespace Bit.App.Controls
|
|||||||
IconPlaceholder.IsVisible = true;
|
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
|
public class StubBaseCipherViewCellSoLinkerDoesntRemoveMethods : BaseCipherViewCell
|
||||||
@ -81,6 +86,7 @@ namespace Bit.App.Controls
|
|||||||
|
|
||||||
public static void CallThisSoLinkerDoesntRemoveMethods()
|
public static void CallThisSoLinkerDoesntRemoveMethods()
|
||||||
{
|
{
|
||||||
|
#if !UT
|
||||||
var stub = new StubBaseCipherViewCellSoLinkerDoesntRemoveMethods();
|
var stub = new StubBaseCipherViewCellSoLinkerDoesntRemoveMethods();
|
||||||
|
|
||||||
try
|
try
|
||||||
@ -98,6 +104,7 @@ namespace Bit.App.Controls
|
|||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -181,6 +181,16 @@ namespace Bit.App.Pages
|
|||||||
|
|
||||||
private void OnMaxAccessCountTextChanged(object sender, TextChangedEventArgs e)
|
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))
|
if (string.IsNullOrWhiteSpace(e.NewTextValue))
|
||||||
{
|
{
|
||||||
_vm.MaxAccessCount = null;
|
_vm.MaxAccessCount = null;
|
||||||
@ -190,7 +200,7 @@ namespace Bit.App.Pages
|
|||||||
// accept only digits
|
// accept only digits
|
||||||
if (!int.TryParse(e.NewTextValue, out int _))
|
if (!int.TryParse(e.NewTextValue, out int _))
|
||||||
{
|
{
|
||||||
((Microsoft.Maui.Controls.Entry)sender).Text = e.OldTextValue;
|
maxAccessEntry.Text = e.OldTextValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -268,6 +268,14 @@ namespace Bit.App.Pages
|
|||||||
{
|
{
|
||||||
await Navigation.PopModalAsync();
|
await Navigation.PopModalAsync();
|
||||||
await _vm.UpdateTotpKeyAsync(key);
|
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)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
<key>CFBundleIdentifier</key>
|
<key>CFBundleIdentifier</key>
|
||||||
<string>com.8bit.bitwarden.autofill</string>
|
<string>com.8bit.bitwarden.autofill</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>2024.2.0</string>
|
<string>2024.2.1</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>1</string>
|
<string>1</string>
|
||||||
<key>CFBundleLocalizations</key>
|
<key>CFBundleLocalizations</key>
|
||||||
|
@ -5,15 +5,24 @@ using Foundation;
|
|||||||
using Microsoft.Maui.Handlers;
|
using Microsoft.Maui.Handlers;
|
||||||
using WebKit;
|
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 =
|
private const string JSFunction =
|
||||||
"function invokeCSharpAction(data){window.webkit.messageHandlers.invokeAction.postMessage(data);}";
|
"function invokeCSharpAction(data){window.webkit.messageHandlers.invokeAction.postMessage(data);}";
|
||||||
|
|
||||||
private WKUserContentController _userController;
|
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)
|
public HybridWebViewHandler([NotNull] IPropertyMapper mapper, CommandMapper commandMapper = null) : base(mapper, commandMapper)
|
||||||
{
|
{
|
||||||
}
|
}
|
@ -48,6 +48,7 @@ namespace Bit.iOS.Core.Utilities
|
|||||||
|
|
||||||
public static void ConfigureMAUIHandlers(IMauiHandlersCollection handlers)
|
public static void ConfigureMAUIHandlers(IMauiHandlersCollection handlers)
|
||||||
{
|
{
|
||||||
|
handlers.AddHandler(typeof(HybridWebView), typeof(Handlers.HybridWebViewHandler));
|
||||||
handlers.AddHandler(typeof(TabsPage), typeof(Handlers.CustomTabbedHandler));
|
handlers.AddHandler(typeof(TabsPage), typeof(Handlers.CustomTabbedHandler));
|
||||||
handlers.AddHandler(typeof(NavigationPage), typeof(Handlers.CustomNavigationHandler));
|
handlers.AddHandler(typeof(NavigationPage), typeof(Handlers.CustomNavigationHandler));
|
||||||
handlers.AddHandler(typeof(ViewCell), typeof(Handlers.CustomViewCellHandler));
|
handlers.AddHandler(typeof(ViewCell), typeof(Handlers.CustomViewCellHandler));
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
<key>CFBundleIdentifier</key>
|
<key>CFBundleIdentifier</key>
|
||||||
<string>com.8bit.bitwarden.find-login-action-extension</string>
|
<string>com.8bit.bitwarden.find-login-action-extension</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>2024.2.0</string>
|
<string>2024.2.1</string>
|
||||||
<key>CFBundleLocalizations</key>
|
<key>CFBundleLocalizations</key>
|
||||||
<array>
|
<array>
|
||||||
<string>en</string>
|
<string>en</string>
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
<key>CFBundlePackageType</key>
|
<key>CFBundlePackageType</key>
|
||||||
<string>XPC!</string>
|
<string>XPC!</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>2024.2.0</string>
|
<string>2024.2.1</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>1</string>
|
<string>1</string>
|
||||||
<key>MinimumOSVersion</key>
|
<key>MinimumOSVersion</key>
|
||||||
|
Loading…
Reference in New Issue
Block a user