| | 1 | | using DCL.Helpers; |
| | 2 | |
|
| | 3 | | namespace DCL.World.PortableExperiences |
| | 4 | | { |
| | 5 | | public class PlayerPrefsConfirmedExperiencesRepository : IConfirmedExperiencesRepository |
| | 6 | | { |
| | 7 | | private const string KEY_PREFIX = "PortableExperiences.Confirmation."; |
| | 8 | |
|
| | 9 | | private readonly IPlayerPrefs playerPrefs; |
| | 10 | |
|
| 425 | 11 | | public PlayerPrefsConfirmedExperiencesRepository(IPlayerPrefs playerPrefs) |
| | 12 | | { |
| 425 | 13 | | this.playerPrefs = playerPrefs; |
| 425 | 14 | | } |
| | 15 | |
|
| | 16 | | public bool Get(string pxId) => |
| 0 | 17 | | playerPrefs.GetBool(GetKey(pxId), false); |
| | 18 | |
|
| | 19 | | public void Set(string pxId, bool confirmed) => |
| 0 | 20 | | playerPrefs.Set(GetKey(pxId), confirmed); |
| | 21 | |
|
| | 22 | | public bool Contains(string pxId) => |
| 0 | 23 | | playerPrefs.ContainsKey(GetKey(pxId)); |
| | 24 | |
|
| | 25 | | private string GetKey(string pxId) => |
| 0 | 26 | | $"{KEY_PREFIX}{pxId}"; |
| | 27 | | } |
| | 28 | | } |