Create unique preference storage for each feature. (#434)

* Create unique preference storage for each feature.

* update storage per @redth
This commit is contained in:
James Montemagno 2018-07-30 12:01:55 -07:00 коммит произвёл Jonathan Dick
Родитель 1806eb9f75
Коммит bca973aae7
4 изменённых файлов: 6 добавлений и 4 удалений

Просмотреть файл

@ -4,8 +4,8 @@ namespace Xamarin.Essentials
{
public static partial class Preferences
{
internal static string PrivatePreferencesSharedName =>
$"{AppInfo.PackageName}.xamarinessentials";
internal static string GetPrivatePreferencesSharedName(string feature) =>
$"{AppInfo.PackageName}.xamarinessentials.{feature}";
// overloads

Просмотреть файл

@ -5,7 +5,8 @@ namespace Xamarin.Essentials
{
public static partial class SecureStorage
{
internal static readonly string Alias = Preferences.PrivatePreferencesSharedName;
// Special Alias that is only used for Secure Storage. All others should use: Preferences.GetPrivatePreferencesSharedName
internal static readonly string Alias = $"{AppInfo.PackageName}.xamarinessentials";
public static Task<string> GetAsync(string key)
{

Просмотреть файл

@ -11,7 +11,7 @@ namespace Xamarin.Essentials
const string versionsKey = "VersionTracking.Versions";
const string buildsKey = "VersionTracking.Builds";
static readonly string sharedName = Preferences.PrivatePreferencesSharedName;
static readonly string sharedName = Preferences.GetPrivatePreferencesSharedName("versiontracking");
static Dictionary<string, List<string>> versionTrail;

Просмотреть файл

@ -15,6 +15,7 @@ http://aka.ms/essentials-getstarted
If you are upgrading from an earlier version there are a few changes to the API that may affect your code:
* Android: VersionTracking has been reset
* SensorSpeed.Ui is now SensorSpeed.UI
* BatteryPowerSource.Ac is now BatteryPowerSource.AC
* Change to generic EventHandlers for Accelerometer, Battery, Compass, Connectivity, Display Metrics, Magnetometer, OrientationSensor, Gyroscope, and Power.