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

View File

@ -1,7 +1,4 @@
using System; using System.Web;
using System.Web;
using Microsoft.Maui.Controls;
using Microsoft.Maui;
namespace Bit.App.Utilities 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 // 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. // 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 (DeviceInfo.Platform == DevicePlatform.iOS)
if (Device.RuntimePlatform == Device.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\">"; 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 // 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 (DeviceInfo.Platform == DevicePlatform.iOS)
if (Device.RuntimePlatform == Device.iOS)
{ {
result += "</div>"; result += "</div>";
} }