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

support for appconfig settings (#727)

This commit is contained in:
Kyle Spearrin
2020-02-10 14:07:06 -05:00
committed by GitHub
parent 89f26bbc6b
commit 1fb3698ba2
11 changed files with 377 additions and 249 deletions

View File

@@ -282,7 +282,7 @@ namespace Bit.iOS
_nfcDelegate = new NFCReaderDelegate((success, message) =>
_messagingService.Send("gotYubiKeyOTP", message));
iOSCoreHelpers.Bootstrap();
iOSCoreHelpers.Bootstrap(async () => await ApplyManagedSettingsAsync());
}
private void RegisterPush()
@@ -475,5 +475,20 @@ namespace Bit.iOS
UIApplication.SharedApplication.EndBackgroundTask(_eventBackgroundTaskId);
_eventBackgroundTaskId = 0;
}
private async Task ApplyManagedSettingsAsync()
{
var userDefaults = NSUserDefaults.StandardUserDefaults;
var managedSettings = userDefaults.DictionaryForKey("com.apple.configuration.managed");
if(managedSettings != null && managedSettings.Count > 0)
{
var dict = new Dictionary<string, string>();
foreach(var setting in managedSettings)
{
dict.Add(setting.Key.ToString(), setting.Value?.ToString());
}
await AppHelpers.SetPreconfiguredSettingsAsync(dict);
}
}
}
}