57 lines
2.2 KiB
C#
57 lines
2.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using Firebase.RemoteConfig;
|
|
|
|
namespace Guru
|
|
{
|
|
public partial class GuruSDK
|
|
{
|
|
|
|
public static void FetchAllRemote(bool immediately = false) => RemoteConfigManager.FetchAll(immediately);
|
|
|
|
/// <summary>
|
|
/// 注册云控配置
|
|
/// </summary>
|
|
/// <param name="key"></param>
|
|
/// <param name="defaultValue"></param>
|
|
/// <returns></returns>
|
|
public static void RegisterRemoteConfig(string key, string defaultValue)
|
|
{
|
|
RemoteConfigManager.RegisterConfig(key, defaultValue);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取运控配置
|
|
/// </summary>
|
|
/// <param name="key"></param>
|
|
/// <typeparam name="T"></typeparam>
|
|
/// <returns></returns>
|
|
public static T GetRemoteConfig<T>(string key) where T : IRemoteConfig<T>
|
|
{
|
|
return RemoteConfigManager.GetConfig<T>(key);
|
|
}
|
|
public static string GetRemoteString(string key) => RemoteConfigManager.GetString(key);
|
|
public static int GetRemoteInt(string key) => RemoteConfigManager.GetInt(key);
|
|
public static long GetRemoteLong(string key) => RemoteConfigManager.GetLong(key);
|
|
public static double GetRemoteDouble(string key) => RemoteConfigManager.GetDouble(key);
|
|
public static float GetRemoteFloat(string key) => RemoteConfigManager.GetFloat(key);
|
|
public static bool GetRemoteBool(string key) => RemoteConfigManager.GetBool(key);
|
|
|
|
|
|
public static void RegisterOnValueChanged(string key, Action<string,string> onValueChanged)
|
|
{
|
|
RemoteConfigManager.RegisterOnValueChanged(key, onValueChanged);
|
|
}
|
|
|
|
public static void UnRegisterOnValueChanged(string key, Action<string,string> onValueChanged)
|
|
{
|
|
RemoteConfigManager.UnRegisterOnValueChanged(key, onValueChanged);
|
|
}
|
|
|
|
public static Dictionary<string, ConfigValue> GetRemoteAllValues() => RemoteConfigManager.GetAllValues();
|
|
|
|
|
|
public static string GetRemoteStaticValue(string key) => RemoteConfigManager.GetStaticValue(key);
|
|
|
|
}
|
|
} |