Exemple #1
0
            public EditorImpl()
            {
                _consent = StringToConsentType(PlayerPrefs.GetString(PLAYER_PREFS_CONSENT_MODE, "UNKNOWN"));
                _age     = PlayerPrefs.GetInt(PLAYER_PREFS_AGE, -1);
#if UNITY_ANDROID
                //string path = System.IO.Path.Combine("jar:file://" + Application.dataPath + "!", "assets");
                //path = System.IO.Path.Combine(path, "ttp");
                string path = System.IO.Path.Combine("ttp", "configurations");
                path = System.IO.Path.Combine(path, "privacySettings.json");
                Debug.Log("shmulik - " + path);
                string privacySettingsJson = TTPUtils.ReadStreamingAssetsFile(path);
#else
                string path = Application.streamingAssetsPath + "/ttp/configurations/privacySettings.json";
                string privacySettingsJson = System.IO.File.ReadAllText(path);
#endif
                //string privacySettingsJson = System.IO.File.ReadAllText(path);

                if (privacySettingsJson != null)
                {
                    PrivacySettingsData privacySettingsData = JsonUtilityWrapper.FromJson <PrivacySettingsData>(privacySettingsJson);
                    if (privacySettingsData != null)
                    {
                        _audienceMode = StringToAudienceMode(privacySettingsData.audienceMode);
                        if (privacySettingsData.usePSDKGDPRPopups && _consent == ConsentType.UNKNOWN && _audienceMode != AudienceMode.MIXED_UNKNOWN)
                        {
                            ShowConsent();
                        }
                    }
                }
            }
Exemple #2
0
            public string GetCurrentConfig()
            {
                string path = TTPUtils.CombinePaths(
                    new List <string> {
                    "Assets", "StreamingAssets", "ttpGameConfig", "keyvalue", "deafults.json"
                });

                if (File.Exists(path))
                {
                    return(System.IO.File.ReadAllText(path));
                }
                return(null);
            }
Exemple #3
0
 public string GetConfigurationJson(string serviceName)
 {
     return(TTPUtils.ReadStreamingAssetsFile("ttp/configurations/" + serviceName + ".json"));
 }
Exemple #4
0
        private static IDictionary <string, int> GetISOValue()
        {
            Debug.Log("TTPAnalyticsHelper::GetISOValue: ");
            IDictionary <string, int> ISO4217 = new Dictionary <string, int>();
            string iso4217_file_to_string     = TTPUtils.ReadStreamingAssetsFile("iso_4217.xml");

            Debug.Log("TTPAnalyticsHelper::GetISOValue: iso4217_file_to_string length=" + iso4217_file_to_string.Length);
            using (XmlReader reader = XmlReader.Create(new StringReader(iso4217_file_to_string)))
            {
                bool   expectingCode  = false;
                bool   expectingValue = false;
                string pulledCode     = null;
                string pulledValue    = null;

                while (reader.Read())
                {
                    switch (reader.NodeType)
                    {
                    case XmlNodeType.Element:
                        if (reader.Name.Equals("Ccy"))
                        {
                            expectingCode = true;
                        }
                        else if (reader.Name.Equals("CcyMnrUnts"))
                        {
                            expectingValue = true;
                        }
                        break;

                    case XmlNodeType.Text:
                        if (expectingCode)
                        {
                            pulledCode = reader.Value;
                        }
                        else if (expectingValue)
                        {
                            pulledValue = reader.Value;
                        }
                        break;

                    case XmlNodeType.EndElement:
                        if (reader.Name.Equals("Ccy"))
                        {
                            expectingCode = false;
                        }
                        else if (reader.Name.Equals("CcyMnrUnts"))
                        {
                            expectingValue = false;
                        }
                        else if (reader.Name.Equals("CcyNtry"))
                        {
                            if (!string.IsNullOrEmpty(pulledCode) &&
                                !string.IsNullOrEmpty(pulledValue))
                            {
                                int value;
                                try
                                {
                                    value = int.Parse(pulledValue);
                                }
                                catch (System.FormatException)
                                {
                                    value = 0;
                                }

                                ISO4217[pulledCode] = value;
                            }

                            expectingCode  = false;
                            expectingValue = false;
                            pulledCode     = null;
                            pulledValue    = null;
                        }
                        break;
                    }
                }
            }

            return(ISO4217);
        }