Ejemplo n.º 1
0
        public static void SaveDiffs()
        {
            if (Constants.isNoop)
            {
                return;
            }
            if (String.IsNullOrEmpty(LeanplumRequest.Token))
            {
                return;
            }

            string variablesCipher     = Json.Serialize(diffs);
            string fileAttributeCipher = Json.Serialize(fileAttributes);

            string messagesCipher = Json.Serialize(Messages);

            LeanplumNative.CompatibilityLayer.StoreSavedString(Constants.Defaults.MESSAGES_KEY,
                                                               AESCrypt.Encrypt(messagesCipher, LeanplumRequest.Token));

            LeanplumNative.CompatibilityLayer.StoreSavedString(Constants.Defaults.VARIABLES_KEY,
                                                               AESCrypt.Encrypt(variablesCipher, LeanplumRequest.Token));
            LeanplumNative.CompatibilityLayer.StoreSavedString(Constants.Defaults.FILE_ATTRIBUTES_KEY,
                                                               AESCrypt.Encrypt(fileAttributeCipher, LeanplumRequest.Token));
            if (!String.IsNullOrEmpty(LeanplumRequest.UserId))
            {
                LeanplumNative.CompatibilityLayer.StoreSavedString(Constants.Defaults.USERID_KEY,
                                                                   AESCrypt.Encrypt(LeanplumRequest.UserId, LeanplumRequest.Token));
            }
            LeanplumNative.CompatibilityLayer.StoreSavedString(Constants.Defaults.TOKEN_KEY, LeanplumRequest.Token);
            LeanplumNative.CompatibilityLayer.FlushSavedSettings();
        }
Ejemplo n.º 2
0
        private static void StoreEncrypted(string key, string serializedData)
        {
            string encrypted = AESCrypt.Encrypt(serializedData, Leanplum.ApiConfig.Token);

            LeanplumNative.CompatibilityLayer.StoreSavedString(key, encrypted);
        }