From 6da1875ab690aeebcbb12f6604df852ce5c76989 Mon Sep 17 00:00:00 2001 From: mp-bw <59324545+mp-bw@users.noreply.github.com> Date: Tue, 21 Feb 2023 10:49:24 -0500 Subject: [PATCH] [PS-2520] Restore copy confirmation toast on Android 13+ (#2388) * Restore copy notification toast on Android 13+ * fixed space --- src/Android/Services/ClipboardService.cs | 6 ------ src/App/Services/MobilePlatformUtilsService.cs | 6 +----- src/Core/Abstractions/IClipboardService.cs | 5 ----- src/iOS.Core/Services/ClipboardService.cs | 6 ------ 4 files changed, 1 insertion(+), 22 deletions(-) diff --git a/src/Android/Services/ClipboardService.cs b/src/Android/Services/ClipboardService.cs index fbb7a1ffb..e6a1ac1c5 100644 --- a/src/Android/Services/ClipboardService.cs +++ b/src/Android/Services/ClipboardService.cs @@ -49,12 +49,6 @@ namespace Bit.Droid.Services } } - public bool IsCopyNotificationHandledByPlatform() - { - // Android 13+ provides built-in notification when text is copied to the clipboard - return (int)Build.VERSION.SdkInt >= 33; - } - private void CopyToClipboard(string text, bool isSensitive = true) { var clipboardManager = Application.Context.GetSystemService(Context.ClipboardService) as ClipboardManager; diff --git a/src/App/Services/MobilePlatformUtilsService.cs b/src/App/Services/MobilePlatformUtilsService.cs index bea6e52f1..5e9768381 100644 --- a/src/App/Services/MobilePlatformUtilsService.cs +++ b/src/App/Services/MobilePlatformUtilsService.cs @@ -134,11 +134,7 @@ namespace Bit.App.Services public void ShowToastForCopiedValue(string valueNameCopied) { - if (!_clipboardService.IsCopyNotificationHandledByPlatform()) - { - ShowToast("info", null, - string.Format(AppResources.ValueHasBeenCopied, valueNameCopied)); - } + ShowToast("info", null, string.Format(AppResources.ValueHasBeenCopied, valueNameCopied)); } public bool SupportsFido2() diff --git a/src/Core/Abstractions/IClipboardService.cs b/src/Core/Abstractions/IClipboardService.cs index f5a7e4699..ebbe2d975 100644 --- a/src/Core/Abstractions/IClipboardService.cs +++ b/src/Core/Abstractions/IClipboardService.cs @@ -15,10 +15,5 @@ namespace Bit.Core.Abstractions /// Expiration time in milliseconds of the copied text /// Flag to mark copied text as sensitive Task CopyTextAsync(string text, int expiresInMs = -1, bool isSensitive = true); - - /// - /// Returns true if the platform provides its own notification when text is copied to the clipboard - /// - bool IsCopyNotificationHandledByPlatform(); } } diff --git a/src/iOS.Core/Services/ClipboardService.cs b/src/iOS.Core/Services/ClipboardService.cs index 1b68b7f1c..abe1e23b2 100644 --- a/src/iOS.Core/Services/ClipboardService.cs +++ b/src/iOS.Core/Services/ClipboardService.cs @@ -38,11 +38,5 @@ namespace Bit.iOS.Core.Services ExpirationDate = clearSeconds > 0 ? NSDate.FromTimeIntervalSinceNow(clearSeconds) : null })); } - - public bool IsCopyNotificationHandledByPlatform() - { - // return true for any future versions of iOS that notify the user when text is copied to the clipboard - return false; - } } }