1
0
mirror of https://github.com/bitwarden/mobile synced 2026-01-20 01:13:30 +00:00

[EC-519] Refactor Split DeviceActionService (#2081)

* EC-519 Refactored IDeviceActionService to be split into IFileService and IAutofillManager also some cleanups were made

* EC-519 Fix format

* EC-519 Fix merge to use the new AutofillHandler
This commit is contained in:
Federico Maccaroni
2022-10-11 18:19:32 -03:00
committed by GitHub
parent d800e9a43e
commit ba677a96aa
35 changed files with 883 additions and 798 deletions

View File

@@ -0,0 +1,16 @@
using Bit.Core.Models.View;
namespace Bit.Core.Abstractions
{
public interface IAutofillHandler
{
bool AutofillServicesEnabled();
bool SupportsAutofillService();
void Autofill(CipherView cipher);
void CloseAutofill();
bool AutofillAccessibilityServiceRunning();
bool AutofillAccessibilityOverlayPermitted();
bool AutofillServiceEnabled();
void DisableAutofillService();
}
}

View File

@@ -0,0 +1,14 @@
using System;
using System.Threading.Tasks;
namespace Bit.Core.Abstractions
{
public interface IFileService
{
bool CanOpenFile(string fileName);
bool OpenFile(byte[] fileData, string id, string fileName);
bool SaveFile(byte[] fileData, string id, string fileName, string contentUri);
Task ClearCacheAsync();
Task SelectFileAsync();
}
}

View File

@@ -8,15 +8,16 @@ namespace Bit.Core.Abstractions
public interface IPlatformUtilsService
{
string GetApplicationVersion();
/// <summary>
/// Gets the device type on the server enum
/// </summary>
DeviceType GetDevice();
string GetDeviceString();
ClientType GetClientType();
bool IsDev();
bool IsSelfHost();
bool IsViewOpen();
void LaunchUri(string uri, Dictionary<string, object> options = null);
Task<string> ReadFromClipboardAsync(Dictionary<string, object> options = null);
void SaveFile();
Task<bool> ShowDialogAsync(string text, string title = null, string confirmText = null,
string cancelText = null, string type = null);
Task<bool> ShowPasswordDialogAsync(string title, string body, Func<string, Task<bool>> validator);

View File

@@ -2,8 +2,13 @@
namespace Bit.Core.Utilities
{
public class LazyResolve<T> : Lazy<T>
public class LazyResolve<T> : Lazy<T> where T : class
{
public LazyResolve()
: base(() => ServiceContainer.Resolve<T>())
{
}
public LazyResolve(string containerKey)
: base(() => ServiceContainer.Resolve<T>(containerKey))
{