1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-18 09: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

@@ -6,6 +6,7 @@ using Bit.Core.Abstractions;
using Bit.Core.Models.View;
using Bit.Core.Utilities;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Xamarin.Forms;
@@ -145,5 +146,35 @@ namespace Bit.App.Utilities
}
return false;
}
public static async Task SetPreconfiguredSettingsAsync(IDictionary<string, string> configSettings)
{
if(configSettings?.Any() ?? true)
{
return;
}
foreach(var setting in configSettings)
{
switch(setting.Key)
{
case "baseEnvironmentUrl":
var environmentService = ServiceContainer.Resolve<IEnvironmentService>("environmentService");
if(environmentService.BaseUrl != setting.Value)
{
await environmentService.SetUrlsAsync(new Core.Models.Data.EnvironmentUrlData
{
Base = setting.Value,
Api = environmentService.ApiUrl,
Identity = environmentService.IdentityUrl,
WebVault = environmentService.WebVaultUrl,
Icons = environmentService.IconsUrl
});
}
break;
default:
break;
}
}
}
}
}