-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathPushTokenStorageService.cs
39 lines (32 loc) · 1.51 KB
/
PushTokenStorageService.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Developed by Softeq Development Corporation
// http://www.softeq.com
using Softeq.XToolkit.Common.Interfaces;
namespace Softeq.XToolkit.PushNotifications
{
public class PushTokenStorageService : IPushTokenStorageService
{
private readonly string _pushTokenKey = $"{nameof(IPushTokenStorageService)}_push_token_key";
private readonly string _isTokenRegisteredInSystemKey = $"{nameof(IPushTokenStorageService)}_token_registered_in_system_key";
private readonly string _isTokenSavedOnServerKey = $"{nameof(IPushTokenStorageService)}_token_saved_on_server_key";
private readonly IInternalSettings _internalSettings;
public PushTokenStorageService(IInternalSettings internalSettings)
{
_internalSettings = internalSettings;
}
public string PushToken
{
get => _internalSettings.GetValueOrDefault(_pushTokenKey, default(string));
set => _internalSettings.AddOrUpdateValue(_pushTokenKey, value);
}
public bool IsTokenRegisteredInSystem
{
get => _internalSettings.GetValueOrDefault(_isTokenRegisteredInSystemKey, default(bool));
set => _internalSettings.AddOrUpdateValue(_isTokenRegisteredInSystemKey, value);
}
public bool IsTokenSavedOnServer
{
get => _internalSettings.GetValueOrDefault(_isTokenSavedOnServerKey, default(bool));
set => _internalSettings.AddOrUpdateValue(_isTokenSavedOnServerKey, value);
}
}
}