1
0
mirror of https://github.com/bitwarden/mobile.git synced 2024-11-23 11:45:38 +01:00

PM-3350 Migrated some Device to DeviceInfo and added temporary workaround with some comments to be able to see the Generated Password on iOS

This commit is contained in:
Dinis Vieira 2023-10-20 00:04:19 +01:00
parent 174acbc558
commit 8be8abb8fe
No known key found for this signature in database
GPG Key ID: 9389160FF6C295F3
2 changed files with 14 additions and 20 deletions

View File

@ -1,21 +1,20 @@
using Microsoft.Maui.Controls;
using Microsoft.Maui;
namespace Bit.App.Controls
namespace Bit.App.Controls
{
public class MonoLabel : Label
{
public MonoLabel()
{
// 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)
if (DeviceInfo.Platform == DevicePlatform.iOS)
{
case Device.iOS:
FontFamily = "Menlo-Regular";
break;
case Device.Android:
FontFamily = "RobotoMono_Regular.ttf";
break;
FontFamily = "Menlo-Regular";
//[MAUI-Migration] Temporary Workaround for the Text to appear in iOS.
// A proper solution needs to be found to be able to have html text with different colors or alternatively use Label FormattedString Spans
TextColor = Colors.Black;
}
else if (DeviceInfo.Platform == DevicePlatform.Android)
{
FontFamily = "RobotoMono_Regular.ttf";
}
}
}

View File

@ -1,7 +1,4 @@
using System;
using System.Web;
using Microsoft.Maui.Controls;
using Microsoft.Maui;
using System.Web;
namespace Bit.App.Utilities
{
@ -39,8 +36,7 @@ namespace Bit.App.Utilities
// iOS won't hide the zero-width space char without these div attrs, but Android won't respect
// display:inline-block and adds a newline after the password/username. Hence, only iOS gets the div.
// 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)
{
result += "<div style=\"display:inline-block; align-items:center; justify-content:center; text-align:center; word-break:break-all; white-space:pre-wrap; min-width:0\">";
}
@ -114,8 +110,7 @@ namespace Bit.App.Utilities
}
// Close off iOS div
// 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)
{
result += "</div>";
}