fix: 修复 ABTestManager 的解析错误.

deeplink
胡宇飞 2024-02-04 16:40:43 +08:00
parent 0888bc4658
commit 135a0ac23b
1 changed files with 8 additions and 3 deletions

View File

@ -1,10 +1,11 @@
namespace Guru namespace Guru
{ {
using System.Linq;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Firebase.RemoteConfig; using Firebase.RemoteConfig;
using Guru.LitJson; using Newtonsoft.Json;
using UnityEngine; using UnityEngine;
/// <summary> /// <summary>
@ -12,7 +13,7 @@ namespace Guru
/// </summary> /// </summary>
public class ABTestManager : Singleton<ABTestManager> public class ABTestManager : Singleton<ABTestManager>
{ {
public const string Version = "1.0.0"; public const string Version = "1.0.2";
private FirebaseRemoteConfig _remoteConfig; private FirebaseRemoteConfig _remoteConfig;
private List<ABParamData> _params; private List<ABParamData> _params;
@ -51,10 +52,13 @@ namespace Guru
_remoteConfig = FirebaseRemoteConfig.DefaultInstance; _remoteConfig = FirebaseRemoteConfig.DefaultInstance;
Debug.Log($"[AB] --- remoteConfig Counts: {_remoteConfig.Keys.Count()}");
string strValue; string strValue;
foreach (var key in _remoteConfig.Keys) foreach (var key in _remoteConfig.Keys)
{ {
strValue = _remoteConfig.GetValue(key).StringValue; strValue = _remoteConfig.GetValue(key).StringValue;
Debug.Log($"[AB] --- raw config: [{key}] : {strValue}");
AddParam(strValue); AddParam(strValue);
} }
@ -135,7 +139,8 @@ namespace Guru
try try
{ {
// 发现Guru AB测试标志位 // 发现Guru AB测试标志位
var dict = JsonMapper.ToObject<Dictionary<string, JsonData>>(value); // var dict = JsonMapper.ToObject<Dictionary<string, JsonData>>(value);
var dict = JsonConvert.DeserializeObject<Dictionary<string, object>>(value);
if (null != dict) if (null != dict)
{ {
foreach (var k in dict.Keys) foreach (var k in dict.Keys)