mirror of
https://gitlab.com/fabinfra/fabaccess/borepin.git
synced 2025-06-11 02:53:23 +02:00
Added: IPlatformInitializer
This commit is contained in:
@ -62,8 +62,11 @@
|
||||
<ItemGroup>
|
||||
<Compile Include="MainActivity.cs" />
|
||||
<Compile Include="MainApplication.cs" />
|
||||
<Compile Include="PlatformInitializer.cs" />
|
||||
<Compile Include="Resources\Resource.designer.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Services\PreferenceService.cs" />
|
||||
<Compile Include="Services\SecretService.cs" />
|
||||
<Compile Include="SplashActivity.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@ -16,7 +16,7 @@ namespace Borepin.Droid
|
||||
base.OnCreate(savedInstanceState);
|
||||
|
||||
global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
|
||||
LoadApplication(new App());
|
||||
LoadApplication(new App(new PlatformInitializer()));
|
||||
}
|
||||
}
|
||||
}
|
16
Borepin/Borepin.Android/PlatformInitializer.cs
Normal file
16
Borepin/Borepin.Android/PlatformInitializer.cs
Normal file
@ -0,0 +1,16 @@
|
||||
using Borepin.Droid.Services;
|
||||
using Borepin.Service;
|
||||
using Prism;
|
||||
using Prism.Ioc;
|
||||
|
||||
namespace Borepin.Droid
|
||||
{
|
||||
public class PlatformInitializer : IPlatformInitializer
|
||||
{
|
||||
public void RegisterTypes(IContainerRegistry containerRegistry)
|
||||
{
|
||||
containerRegistry.Register<IPreferenceService, PreferenceService>();
|
||||
containerRegistry.Register<ISecretService, SecretService>();
|
||||
}
|
||||
}
|
||||
}
|
1900
Borepin/Borepin.Android/Resources/Resource.designer.cs
generated
1900
Borepin/Borepin.Android/Resources/Resource.designer.cs
generated
File diff suppressed because it is too large
Load Diff
33
Borepin/Borepin.Android/Services/PreferenceService.cs
Normal file
33
Borepin/Borepin.Android/Services/PreferenceService.cs
Normal file
@ -0,0 +1,33 @@
|
||||
using Borepin.Service;
|
||||
using Xamarin.Essentials;
|
||||
|
||||
namespace Borepin.Droid.Services
|
||||
{
|
||||
public class PreferenceService : IPreferenceService
|
||||
{
|
||||
public void Clear()
|
||||
{
|
||||
Preferences.Clear();
|
||||
}
|
||||
|
||||
public bool ContainsKey(string key)
|
||||
{
|
||||
return Preferences.ContainsKey(key);
|
||||
}
|
||||
|
||||
public string Get(string key, string defaultValue)
|
||||
{
|
||||
return Preferences.Get(key, defaultValue);
|
||||
}
|
||||
|
||||
public void Remove(string key)
|
||||
{
|
||||
Preferences.Remove(key);
|
||||
}
|
||||
|
||||
public void Set(string key, string value)
|
||||
{
|
||||
Preferences.Set(key, value);
|
||||
}
|
||||
}
|
||||
}
|
29
Borepin/Borepin.Android/Services/SecretService.cs
Normal file
29
Borepin/Borepin.Android/Services/SecretService.cs
Normal file
@ -0,0 +1,29 @@
|
||||
using Borepin.Service;
|
||||
using System.Threading.Tasks;
|
||||
using Xamarin.Essentials;
|
||||
|
||||
namespace Borepin.Droid.Services
|
||||
{
|
||||
public class SecretService : ISecretService
|
||||
{
|
||||
public Task<string> GetAsync(string key)
|
||||
{
|
||||
return SecureStorage.GetAsync(key);
|
||||
}
|
||||
|
||||
public bool Remove(string key)
|
||||
{
|
||||
return SecureStorage.Remove(key);
|
||||
}
|
||||
|
||||
public void RemoveAll()
|
||||
{
|
||||
SecureStorage.RemoveAll();
|
||||
}
|
||||
|
||||
public Task SetAsync(string key, string value)
|
||||
{
|
||||
return SecureStorage.SetAsync(key, value);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user