| | 1 | | using System; |
| | 2 | | using System.Text.RegularExpressions; |
| | 3 | | using UnityEngine; |
| | 4 | |
|
| | 5 | | namespace DCLServices.EnvironmentProvider |
| | 6 | | { |
| | 7 | | public class UnityEnvironmentProviderService : IEnvironmentProviderService |
| | 8 | | { |
| | 9 | | private readonly KernelConfig kernelConfig; |
| | 10 | |
|
| 425 | 11 | | public UnityEnvironmentProviderService(KernelConfig kernelConfig) |
| | 12 | | { |
| 425 | 13 | | this.kernelConfig = kernelConfig; |
| 425 | 14 | | } |
| | 15 | |
|
| | 16 | | public void Dispose() |
| | 17 | | { |
| 425 | 18 | | } |
| | 19 | |
|
| | 20 | | public void Initialize() |
| | 21 | | { |
| 425 | 22 | | } |
| | 23 | |
|
| | 24 | | public bool IsProd() |
| | 25 | | { |
| 850 | 26 | | string url = Application.absoluteURL; |
| | 27 | |
|
| 850 | 28 | | if (string.IsNullOrEmpty(url)) |
| 850 | 29 | | return !Application.isEditor && !Debug.isDebugBuild && kernelConfig.Get().network == "mainnet"; |
| | 30 | |
|
| | 31 | | const string PATTERN = @"play\.decentraland\.([a-z0-9]+)\/"; |
| 0 | 32 | | Match match = Regex.Match(url, PATTERN); |
| | 33 | |
|
| 0 | 34 | | if (match.Success) |
| 0 | 35 | | return match.Groups[1].Value.Equals("org"); |
| | 36 | |
|
| 0 | 37 | | return !Application.isEditor && !Debug.isDebugBuild && kernelConfig.Get().network == "mainnet"; |
| | 38 | | } |
| | 39 | | } |
| | 40 | | } |