From 4347c2f81d8f9384b2d6fff1b9aa551b202331af Mon Sep 17 00:00:00 2001 From: mp-bw <59324545+mp-bw@users.noreply.github.com> Date: Mon, 19 Dec 2022 12:03:22 -0500 Subject: [PATCH] Android: Show auto-totp-copy toast on pre-13 devices (#2249) --- src/Android/MainApplication.cs | 3 ++- src/Android/Services/AutofillHandler.cs | 5 +++++ src/App/Resources/AppResources.resx | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Android/MainApplication.cs b/src/Android/MainApplication.cs index 56aafe4e5..db042bcf7 100644 --- a/src/Android/MainApplication.cs +++ b/src/Android/MainApplication.cs @@ -149,9 +149,10 @@ namespace Bit.Droid var clipboardService = new ClipboardService(stateService); var deviceActionService = new DeviceActionService(stateService, messagingService); var fileService = new FileService(stateService, broadcasterService); - var autofillHandler = new AutofillHandler(stateService, messagingService, clipboardService, new LazyResolve()); var platformUtilsService = new MobilePlatformUtilsService(deviceActionService, clipboardService, messagingService, broadcasterService); + var autofillHandler = new AutofillHandler(stateService, messagingService, clipboardService, + platformUtilsService, new LazyResolve()); var biometricService = new BiometricService(); var cryptoFunctionService = new PclCryptoFunctionService(cryptoPrimitiveService); var cryptoService = new CryptoService(stateService, cryptoFunctionService); diff --git a/src/Android/Services/AutofillHandler.cs b/src/Android/Services/AutofillHandler.cs index ad1a0ad5d..6b91f3488 100644 --- a/src/Android/Services/AutofillHandler.cs +++ b/src/Android/Services/AutofillHandler.cs @@ -6,6 +6,7 @@ using Android.Content; using Android.OS; using Android.Provider; using Android.Views.Autofill; +using Bit.App.Resources; using Bit.Core.Abstractions; using Bit.Core.Enums; using Bit.Core.Models.View; @@ -20,16 +21,19 @@ namespace Bit.Droid.Services private readonly IStateService _stateService; private readonly IMessagingService _messagingService; private readonly IClipboardService _clipboardService; + private readonly IPlatformUtilsService _platformUtilsService; private readonly LazyResolve _eventService; public AutofillHandler(IStateService stateService, IMessagingService messagingService, IClipboardService clipboardService, + IPlatformUtilsService platformUtilsService, LazyResolve eventService) { _stateService = stateService; _messagingService = messagingService; _clipboardService = clipboardService; + _platformUtilsService = platformUtilsService; _eventService = eventService; } @@ -202,6 +206,7 @@ namespace Bit.Droid.Services if (totp != null) { await _clipboardService.CopyTextAsync(totp); + _platformUtilsService.ShowToastForCopiedValue(AppResources.VerificationCodeTotp); } } } diff --git a/src/App/Resources/AppResources.resx b/src/App/Resources/AppResources.resx index 4947d257e..e2ec11eb3 100644 --- a/src/App/Resources/AppResources.resx +++ b/src/App/Resources/AppResources.resx @@ -376,7 +376,7 @@ {0} copied - Confirmation message after suceessfully copying a value to the clipboard. + Confirmation message after successfully copying a value to the clipboard. Verify fingerprint