1
0
mirror of https://github.com/bitwarden/mobile synced 2026-01-04 01:23:15 +00:00

[EC-1002] [BEEEP] Add ability to change language in app (#2299)

* EC-1002 BEEEP Added ability to change language in app

* EC-1002 fix format

* EC-1002 Renamed IPreferencesStorageService to ISynchronousStorageService

* EC-1002 Moved get/set Locale to the StateService and added the StorageMediatorService to a new way to interact with the storage. Later the StateService will only interact with this mediator instead of directly with the storage services, with this we have more control inside the mediator and we can have both sync and async methods to interact with storages handled by the mediator
This commit is contained in:
Federico Maccaroni
2023-03-01 13:28:28 -03:00
committed by GitHub
parent 5164762f2e
commit 470e08f165
18 changed files with 298 additions and 29 deletions

View File

@@ -9,6 +9,7 @@ namespace Bit.Core.Abstractions
CultureInfo Culture { get; set; }
StringComparer StringComparer { get; }
Dictionary<string, string> LocaleNames { get; }
void SetCurrentCulture(CultureInfo culture);
string T(string id, string p1 = null, string p2 = null, string p3 = null);
string Translate(string id, string p1 = null, string p2 = null, string p3 = null);
}

View File

@@ -6,6 +6,7 @@ using Bit.Core.Models.Data;
using Bit.Core.Models.Domain;
using Bit.Core.Models.Response;
using Bit.Core.Models.View;
using Bit.Core.Services;
namespace Bit.Core.Abstractions
{
@@ -165,5 +166,7 @@ namespace Bit.Core.Abstractions
Task<string> GetAvatarColorAsync(string userId = null);
Task<string> GetPreLoginEmailAsync();
Task SetPreLoginEmailAsync(string value);
string GetLocale();
void SetLocale(string locale);
}
}

View File

@@ -0,0 +1,16 @@
using System.Threading.Tasks;
using Bit.Core.Services;
namespace Bit.Core.Abstractions
{
public interface IStorageMediatorService
{
T Get<T>(string key);
void Save<T>(string key, T obj);
void Remove(string key);
Task<T> GetAsync<T>(string key, StorageMediatorOptions options = default);
Task SaveAsync<T>(string key, T obj, StorageMediatorOptions options = default);
Task RemoveAsync(string key, StorageMediatorOptions options = default);
}
}

View File

@@ -0,0 +1,9 @@
namespace Bit.Core.Abstractions
{
public interface ISynchronousStorageService
{
T Get<T>(string key);
void Save<T>(string key, T obj);
void Remove(string key);
}
}