Android: Show auto-totp-copy toast on pre-13 devices (#2249)

This commit is contained in:
mp-bw 2022-12-19 12:03:22 -05:00 committed by GitHub
parent 619acfe0fe
commit 4347c2f81d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 2 deletions

View File

@ -149,9 +149,10 @@ namespace Bit.Droid
var clipboardService = new ClipboardService(stateService); var clipboardService = new ClipboardService(stateService);
var deviceActionService = new DeviceActionService(stateService, messagingService); var deviceActionService = new DeviceActionService(stateService, messagingService);
var fileService = new FileService(stateService, broadcasterService); var fileService = new FileService(stateService, broadcasterService);
var autofillHandler = new AutofillHandler(stateService, messagingService, clipboardService, new LazyResolve<IEventService>());
var platformUtilsService = new MobilePlatformUtilsService(deviceActionService, clipboardService, var platformUtilsService = new MobilePlatformUtilsService(deviceActionService, clipboardService,
messagingService, broadcasterService); messagingService, broadcasterService);
var autofillHandler = new AutofillHandler(stateService, messagingService, clipboardService,
platformUtilsService, new LazyResolve<IEventService>());
var biometricService = new BiometricService(); var biometricService = new BiometricService();
var cryptoFunctionService = new PclCryptoFunctionService(cryptoPrimitiveService); var cryptoFunctionService = new PclCryptoFunctionService(cryptoPrimitiveService);
var cryptoService = new CryptoService(stateService, cryptoFunctionService); var cryptoService = new CryptoService(stateService, cryptoFunctionService);

View File

@ -6,6 +6,7 @@ using Android.Content;
using Android.OS; using Android.OS;
using Android.Provider; using Android.Provider;
using Android.Views.Autofill; using Android.Views.Autofill;
using Bit.App.Resources;
using Bit.Core.Abstractions; using Bit.Core.Abstractions;
using Bit.Core.Enums; using Bit.Core.Enums;
using Bit.Core.Models.View; using Bit.Core.Models.View;
@ -20,16 +21,19 @@ namespace Bit.Droid.Services
private readonly IStateService _stateService; private readonly IStateService _stateService;
private readonly IMessagingService _messagingService; private readonly IMessagingService _messagingService;
private readonly IClipboardService _clipboardService; private readonly IClipboardService _clipboardService;
private readonly IPlatformUtilsService _platformUtilsService;
private readonly LazyResolve<IEventService> _eventService; private readonly LazyResolve<IEventService> _eventService;
public AutofillHandler(IStateService stateService, public AutofillHandler(IStateService stateService,
IMessagingService messagingService, IMessagingService messagingService,
IClipboardService clipboardService, IClipboardService clipboardService,
IPlatformUtilsService platformUtilsService,
LazyResolve<IEventService> eventService) LazyResolve<IEventService> eventService)
{ {
_stateService = stateService; _stateService = stateService;
_messagingService = messagingService; _messagingService = messagingService;
_clipboardService = clipboardService; _clipboardService = clipboardService;
_platformUtilsService = platformUtilsService;
_eventService = eventService; _eventService = eventService;
} }
@ -202,6 +206,7 @@ namespace Bit.Droid.Services
if (totp != null) if (totp != null)
{ {
await _clipboardService.CopyTextAsync(totp); await _clipboardService.CopyTextAsync(totp);
_platformUtilsService.ShowToastForCopiedValue(AppResources.VerificationCodeTotp);
} }
} }
} }

View File

@ -376,7 +376,7 @@
</data> </data>
<data name="ValueHasBeenCopied" xml:space="preserve"> <data name="ValueHasBeenCopied" xml:space="preserve">
<value>{0} copied</value> <value>{0} copied</value>
<comment>Confirmation message after suceessfully copying a value to the clipboard.</comment> <comment>Confirmation message after successfully copying a value to the clipboard.</comment>
</data> </data>
<data name="VerifyFingerprint" xml:space="preserve"> <data name="VerifyFingerprint" xml:space="preserve">
<value>Verify fingerprint</value> <value>Verify fingerprint</value>