diff --git a/src/MauiSettings/MauiSettingsGeneric.cs b/src/MauiSettings/MauiSettingsGeneric.cs index d844f73..fbdf92b 100644 --- a/src/MauiSettings/MauiSettingsGeneric.cs +++ b/src/MauiSettings/MauiSettingsGeneric.cs @@ -71,13 +71,18 @@ public MauiSettingsGeneric(SO settingsObject, string key) public static void LoadSetting(Expression> value) => LoadObjectSetting(SettingsObject, value); - public static async Task LoadSettingAsync(Expression> value, string? key = null) - { - await Task.Run(async delegate + public static Task LoadSettingAsync(Expression> value, string? key = null) + => Task.Run(async delegate { await LoadObjectSettingAsync(SettingsObject, value, key: key); }); - } + + public static Task LoadSecureSettingAsync(Expression> value, string? key = null) + => Task.Run(async delegate + { + await LoadSecureObjectSettingAsync(SettingsObject, value, key: key); + }); + public void LoadObjectSettings() => LoadSettings(this); @@ -89,6 +94,11 @@ public static Task LoadObjectSettingAsync(object settingsObject, Expression(object settingsObject, Expression> value, string? key = null) + => Task.Run(async delegate + { + await GetExpressionMetaAsync(settings: settingsObject, value, MauiSettingsActions.Load, secureOnly: true, key: key); + }); public static void LoadSettings(object settings) => GetClassMeta(settings: settings, mode: MauiSettingsActions.Load, key: null); @@ -307,7 +317,7 @@ public static Task ExhangeKeyAsync(string? newKey = null, string? oldKey = null) #endregion #region Private - static List GetClassMetaAsList(object settings) + static List? GetClassMetaAsList(object settings) { lock (lockObject) { @@ -415,7 +425,7 @@ static void GetExpressionMeta(object settings, Expression> value, } } - static async Task GetExpressionMetaAsync(object settings, Expression> value, MauiSettingsActions mode, MauiSettingsTarget target = MauiSettingsTarget.Local, string? key = null) + static async Task GetExpressionMetaAsync(object settings, Expression> value, MauiSettingsActions mode, MauiSettingsTarget target = MauiSettingsTarget.Local, bool secureOnly = false, string? key = null) { if (value.Body is MemberExpression memberExpression) @@ -425,7 +435,7 @@ static async Task GetExpressionMetaAsync(object settings, Expression