1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-25 20:53:25 +00:00

EC-297 Fix possible crash when copying password on cipher item view. Also improved a bit the code of copying commands (#1974)

This commit is contained in:
Federico Maccaroni
2022-07-05 18:14:46 -03:00
committed by GitHub
parent e2502e2e0c
commit d246d1dece
2 changed files with 28 additions and 26 deletions

View File

@@ -28,17 +28,25 @@ namespace Bit.Droid.Services
public async Task CopyTextAsync(string text, int expiresInMs = -1, bool isSensitive = true)
{
// Xamarin.Essentials.Clipboard currently doesn't support the IS_SENSITIVE flag for API 33+
if ((int)Build.VERSION.SdkInt < 33)
try
{
await Clipboard.SetTextAsync(text);
}
else
{
CopyToClipboard(text, isSensitive);
}
// Xamarin.Essentials.Clipboard currently doesn't support the IS_SENSITIVE flag for API 33+
if ((int)Build.VERSION.SdkInt < 33)
{
await Clipboard.SetTextAsync(text);
}
else
{
CopyToClipboard(text, isSensitive);
}
await ClearClipboardAlarmAsync(expiresInMs);
await ClearClipboardAlarmAsync(expiresInMs);
}
catch (Java.Lang.SecurityException ex) when (ex.Message.Contains("does not belong to"))
{
// #1962 Just ignore, the content is copied either way but there is some app interfiering in the process
// that the OS catches and just throws this exception.
}
}
public bool IsCopyNotificationHandledByPlatform()