Пример #1
0
        private void FinishSwrveSDKInit()
        {
            SwrveComponent.Instance.Init(int.Parse(this.AnalyticsId), this.AnalyticsKey);
            SwrveConfig config = SwrveComponent.Instance.Config;

            if (config.AndroidPushProvider == AndroidPushProvider.GOOGLE_GCM && config.PushNotificationEnabled && !string.IsNullOrEmpty(config.GCMSenderId))
            {
                SwrveManagerUtils.RegisterGCMDevice(SwrveComponent.Instance.name, config.GCMSenderId, config.GCMPushNotificationTitle, config.GCMPushNotificationIconId, config.GCMPushNotificationMaterialIconId, config.GCMPushNotificationLargeIconId, config.GCMPushNotificationAccentColor, config.GCMSenderId.ToLower() + "Group");
            }
            Dictionary <string, string> deviceInfo = SwrveComponent.Instance.SDK.GetDeviceInfo();
            string text   = deviceInfo["swrve.device_name"];
            string value  = deviceInfo["swrve.os"];
            string value2 = deviceInfo["swrve.device_dpi"];
            string value3 = deviceInfo["swrve.device_width"];
            string value4 = deviceInfo["swrve.device_height"];
            Dictionary <string, string> dictionary = new Dictionary <string, string>();

            dictionary.Add("device_name", text);
            dictionary.Add("os", value);
            dictionary.Add("device_dpi", value2);
            dictionary.Add("device_width", value3);
            dictionary.Add("device_height", value4);
            if (!string.IsNullOrEmpty(SwrveComponent.Instance.Config.UserId))
            {
                dictionary.Add("swrve_user_id", SwrveComponent.Instance.Config.UserId);
            }
            else
            {
                SwrveManager.Log("### !!! unable to add userId to the userProps");
            }
            dictionary.Add("jailbroken.is_jailbroken", SwrveManagerUtils.GetIsJailBroken());
            dictionary.Add("lat.is_lat", SwrveManagerUtils.GetIsLat().ToString());
            string text2 = string.Empty;

            if (Application.platform == RuntimePlatform.Android)
            {
                text2 = "gida";
            }
            else if (Application.platform == RuntimePlatform.IPhonePlayer)
            {
                text2 = "idfa";
            }
            if (SwrveManagerUtils.IsAndiAvailable() && SwrveManagerUtils.IsAndiInitialized())
            {
                string text3 = (string)SwrveManagerUtils.ANDIType.GetMethod("GetAndiu").Invoke(null, null);
                SwrveManager.Log("### Let's send Swrve the andiu: " + text3);
                dictionary.Add("andiu", text3);
            }
            string text4 = SwrveManagerUtils.AESEncrypt(text, SwrveManagerUtils.GetAdvertiserID());

            SwrveManager.Log("### encryptedAdvertiserId: " + text4);
            if (!string.IsNullOrEmpty(text2))
            {
                dictionary.Add(text2, text4);
            }
            string rSAEncryptedKey = SwrveManagerUtils.GetRSAEncryptedKey();

            SwrveManager.Log("### eskKey: " + rSAEncryptedKey);
            if (!string.IsNullOrEmpty(rSAEncryptedKey))
            {
                dictionary.Add("esk", rSAEncryptedKey);
            }
            if (this.customUserData != null)
            {
                foreach (KeyValuePair <string, string> current in this.customUserData)
                {
                    if (!dictionary.ContainsKey(current.Key))
                    {
                        dictionary.Add(current.Key, current.Value);
                    }
                    else
                    {
                        SwrveManager.Log("###Duplicate KEY!! unable to add " + current.Key + " - " + current.Value);
                    }
                }
            }
            SwrveComponent.Instance.SDK.UserUpdate(dictionary);
            this.resourceManager = SwrveComponent.Instance.SDK.ResourceManager;
        }
Пример #2
0
        private void FinishSwrveSDKInit()
        {
            SwrveConfig swrveConfig = customSwrveConfig;

            SwrveComponent.Instance.Init(int.Parse(AnalyticsId), AnalyticsKey, customSwrveConfig);
            Dictionary <string, string> deviceInfo = SwrveComponent.Instance.SDK.GetDeviceInfo();
            Dictionary <string, string> dictionary = new Dictionary <string, string>();

            if (deviceInfo != null && deviceInfo.Count > 0)
            {
                string text   = deviceInfo["swrve.device_name"];
                string value  = deviceInfo["swrve.os"];
                string value2 = deviceInfo["swrve.device_dpi"];
                string value3 = deviceInfo["swrve.device_width"];
                string value4 = deviceInfo["swrve.device_height"];
                dictionary.Add("device_name", text);
                dictionary.Add("os", value);
                dictionary.Add("device_dpi", value2);
                dictionary.Add("device_width", value3);
                dictionary.Add("device_height", value4);
                if (!string.IsNullOrEmpty(swrveConfig.UserId))
                {
                    dictionary.Add("swrve_user_id", swrveConfig.UserId);
                }
                else
                {
                    Log("### !!! unable to add userId to the userProps");
                }
                dictionary.Add("jailbroken.is_jailbroken", SwrveManagerUtils.GetIsJailBroken());
                dictionary.Add("lat.is_lat", SwrveManagerUtils.GetIsLat().ToString());
                string text2 = string.Empty;
                if (Application.platform == RuntimePlatform.Android)
                {
                    text2 = "gida";
                }
                else if (Application.platform == RuntimePlatform.IPhonePlayer)
                {
                    text2 = "idfa";
                }
                if (SwrveManagerUtils.IsAndiAvailable() && SwrveManagerUtils.IsAndiInitialized())
                {
                    string text3 = (string)SwrveManagerUtils.ANDIType.GetMethod("GetAndiu").Invoke(null, null);
                    Log("### Let's send Swrve the andiu: " + text3);
                    dictionary.Add("andiu", text3);
                }
                string text4 = SwrveManagerUtils.AESEncrypt(text, SwrveManagerUtils.GetAdvertiserID());
                Log("### encryptedAdvertiserId: " + text4);
                if (!string.IsNullOrEmpty(text2))
                {
                    dictionary.Add(text2, text4);
                }
                string rSAEncryptedKey = SwrveManagerUtils.GetRSAEncryptedKey();
                Log("### eskKey: " + rSAEncryptedKey);
                if (!string.IsNullOrEmpty(rSAEncryptedKey))
                {
                    dictionary.Add("esk", rSAEncryptedKey);
                }
            }
            else
            {
                Log("### !! Unable to get deviceInfo and therefore unable to get and set the userProperties information.");
            }
            if (customUserData != null)
            {
                foreach (KeyValuePair <string, string> customUserDatum in customUserData)
                {
                    if (!dictionary.ContainsKey(customUserDatum.Key))
                    {
                        dictionary.Add(customUserDatum.Key, customUserDatum.Value);
                    }
                    else
                    {
                        Log("###Duplicate KEY!! unable to add " + customUserDatum.Key + " - " + customUserDatum.Value);
                    }
                }
            }
            SwrveComponent.Instance.SDK.UserUpdate(dictionary);
            resourceManager = SwrveComponent.Instance.SDK.ResourceManager;
        }