mirror of
https://github.com/bitwarden/mobile
synced 2025-12-13 06:43:17 +00:00
support for appconfig settings (#727)
This commit is contained in:
@@ -1,10 +1,15 @@
|
||||
using Android.Content;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Android.Content;
|
||||
using Android.Provider;
|
||||
using Bit.App.Utilities;
|
||||
|
||||
namespace Bit.Droid.Utilities
|
||||
{
|
||||
public static class AndroidHelpers
|
||||
{
|
||||
private static string BaseEnvironmentUrlRestrictionKey = "baseEnvironmentUrl";
|
||||
|
||||
public static string GetFileName(Context context, Android.Net.Uri uri)
|
||||
{
|
||||
string name = null;
|
||||
@@ -26,5 +31,21 @@ namespace Bit.Droid.Utilities
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
public static async Task SetPreconfiguredRestrictionSettingsAsync(Context context)
|
||||
{
|
||||
var restrictionsManager = (RestrictionsManager)context.GetSystemService(Context.RestrictionsService);
|
||||
var restrictions = restrictionsManager.ApplicationRestrictions;
|
||||
var dict = new Dictionary<string, string>();
|
||||
if(restrictions.ContainsKey(BaseEnvironmentUrlRestrictionKey))
|
||||
{
|
||||
dict.Add(BaseEnvironmentUrlRestrictionKey, restrictions.GetString(BaseEnvironmentUrlRestrictionKey));
|
||||
}
|
||||
|
||||
if(dict.Count > 0)
|
||||
{
|
||||
await AppHelpers.SetPreconfiguredSettingsAsync(dict);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user