mirror of
https://github.com/bitwarden/mobile
synced 2026-01-05 18:13:36 +00:00
PM-3349 PM-3350
Added (migrated) CustomNavigationHandler (which should partially fix the AvatarIcon in the NavBar in iOS) Added (migrated) CustomContentPageHandler (which should mostly place the AvatarIcon in the navBar in the correct place for iOS) Added Task.Delay (workaround) to allow the Avatar to load in iOS on the LoginPage Added workaround for iOS bug with the toolbar size (more info in comment in AvatarImageSource.cs) Went through the AccountViewCell MAUI-Migration comments. (and deleted/added more comments as needed) Migrated some Device calls to DeviceInfo and MainThread Added (migrated) CustomTabbedHandler (for managing the iOS TabBar)
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
xmlns:core="clr-namespace:Bit.Core"
|
||||
x:Name="_accountView"
|
||||
x:DataType="controls:AccountViewCellViewModel">
|
||||
<!--TODO: [MAUI-Migration] add long press
|
||||
<!--TODO: [MAUI-Migration] add long press ( https://github.com/CommunityToolkit/Maui/issues/86 )
|
||||
xct:TouchEffect.LongPressCommand="{Binding LongPressAccountCommand, Source={x:Reference _accountView}}"
|
||||
xct:TouchEffect.LongPressCommandParameter="{Binding .}"-->
|
||||
<Grid RowSpacing="0"
|
||||
@@ -144,17 +144,6 @@
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!--TODO: [MAUI-Migration] check that is the same-->
|
||||
<!--<Image
|
||||
Grid.Column="0"
|
||||
VerticalOptions="Center"
|
||||
HorizontalOptions="Center"
|
||||
Margin="14,0"
|
||||
WidthRequest="{OnPlatform 24, iOS=24, Android=26}"
|
||||
HeightRequest="{OnPlatform 24, iOS=24, Android=26}"
|
||||
Source="plus.png"
|
||||
xct:IconTintColorEffect.TintColor="{DynamicResource TextColor}"
|
||||
AutomationProperties.IsInAccessibleTree="False" />-->
|
||||
<controls:IconLabel
|
||||
Grid.Column="0"
|
||||
VerticalOptions="Center"
|
||||
|
||||
@@ -79,6 +79,14 @@ namespace Bit.App.Controls
|
||||
var textColor = CoreHelpers.TextColorFromBgColor(bgColor);
|
||||
var size = 50;
|
||||
|
||||
//Workaround: [MAUI-Migration] There is currently a bug in MAUI where the actual size of the image is used instead of the size it should occupy in the Toolbar.
|
||||
//This causes some issues with the position of the icon. As a workaround we make the icon smaller until this is fixed.
|
||||
//Github issues: https://github.com/dotnet/maui/issues/12359 and https://github.com/dotnet/maui/pull/17120
|
||||
if (DeviceInfo.Platform == DevicePlatform.iOS)
|
||||
{
|
||||
size = 20;
|
||||
}
|
||||
|
||||
using (var bitmap = new SKBitmap(size * 2,
|
||||
size * 2,
|
||||
SKImageInfo.PlatformColorType,
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Bit.App.Models;
|
||||
using Bit.App.Models;
|
||||
using Bit.Core.Resources.Localization;
|
||||
using Bit.App.Utilities;
|
||||
using Bit.Core;
|
||||
using Bit.Core.Abstractions;
|
||||
using Bit.Core.Utilities;
|
||||
using Microsoft.Maui.Controls;
|
||||
using Microsoft.Maui;
|
||||
|
||||
namespace Bit.App.Pages
|
||||
{
|
||||
@@ -30,10 +26,9 @@ namespace Bit.App.Pages
|
||||
_vm = BindingContext as LockPageViewModel;
|
||||
_vm.CheckPendingAuthRequests = checkPendingAuthRequests;
|
||||
_vm.Page = this;
|
||||
_vm.UnlockedAction = () => Device.BeginInvokeOnMainThread(async () => await UnlockedAsync());
|
||||
_vm.UnlockedAction = () => MainThread.BeginInvokeOnMainThread(async () => await UnlockedAsync());
|
||||
|
||||
// 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
|
||||
if (Device.RuntimePlatform == Device.iOS)
|
||||
if (DeviceInfo.Platform == DevicePlatform.iOS)
|
||||
{
|
||||
ToolbarItems.Add(_moreItem);
|
||||
}
|
||||
@@ -75,7 +70,7 @@ namespace Bit.App.Pages
|
||||
{
|
||||
if (message.Command == Constants.ClearSensitiveFields)
|
||||
{
|
||||
Device.BeginInvokeOnMainThread(_vm.ResetPinPasswordFields);
|
||||
MainThread.BeginInvokeOnMainThread(_vm.ResetPinPasswordFields);
|
||||
}
|
||||
});
|
||||
if (_appeared)
|
||||
@@ -86,6 +81,9 @@ namespace Bit.App.Pages
|
||||
_appeared = true;
|
||||
_mainContent.Content = _mainLayout;
|
||||
|
||||
//Workaround: This delay allows the Avatar to correctly load on iOS. The cause of this issue is also likely connected with the race conditions issue when using loading modals in iOS
|
||||
await Task.Delay(50);
|
||||
|
||||
_accountAvatar?.OnAppearing();
|
||||
|
||||
_vm.AvatarImageSource = await GetAvatarImageSourceAsync();
|
||||
@@ -110,7 +108,7 @@ namespace Bit.App.Pages
|
||||
var tasks = Task.Run(async () =>
|
||||
{
|
||||
await Task.Delay(500);
|
||||
Device.BeginInvokeOnMainThread(async () => await _vm.PromptBiometricAsync());
|
||||
MainThread.BeginInvokeOnMainThread(async () => await _vm.PromptBiometricAsync());
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -118,7 +116,7 @@ namespace Bit.App.Pages
|
||||
|
||||
private void PerformFocusSecretEntry(int? cursorPosition)
|
||||
{
|
||||
Device.BeginInvokeOnMainThread(() =>
|
||||
MainThread.BeginInvokeOnMainThread(() =>
|
||||
{
|
||||
SecretEntry.Focus();
|
||||
if (cursorPosition.HasValue)
|
||||
@@ -153,7 +151,7 @@ namespace Bit.App.Pages
|
||||
var tasks = Task.Run(async () =>
|
||||
{
|
||||
await Task.Delay(50);
|
||||
Device.BeginInvokeOnMainThread(async () => await _vm.SubmitAsync());
|
||||
MainThread.BeginInvokeOnMainThread(async () => await _vm.SubmitAsync());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user