| | 1 | | using System; |
| | 2 | | using DCL; |
| | 3 | | using Newtonsoft.Json; |
| | 4 | | using UnityEngine; |
| | 5 | |
|
| | 6 | | public class FeatureFlagBridge : MonoBehaviour |
| | 7 | | { |
| | 8 | | public void SetFeatureFlagConfiguration(string json) |
| | 9 | | { |
| 0 | 10 | | FeatureFlag config = null; |
| | 11 | | try |
| | 12 | | { |
| 0 | 13 | | config = JsonConvert.DeserializeObject<FeatureFlag>(json); |
| 0 | 14 | | } |
| 0 | 15 | | catch (Exception e) |
| | 16 | | { |
| 0 | 17 | | Debug.LogError("FeatureFlag has been unable to parse the json! Error: " + e); |
| 0 | 18 | | } |
| | 19 | |
|
| 0 | 20 | | SetFeatureFlagConfiguration(config); |
| 0 | 21 | | } |
| | 22 | |
|
| | 23 | | public void SetFeatureFlagConfiguration(FeatureFlag config) |
| | 24 | | { |
| 1 | 25 | | if (config == null) |
| 0 | 26 | | return; |
| | 27 | |
|
| 1 | 28 | | config.SetAsInitialized(); |
| | 29 | |
|
| 1 | 30 | | DataStore.i.featureFlags.flags.Set(config); |
| 1 | 31 | | } |
| | 32 | | } |