| 
									
										
										
										
											2023-12-27 12:24:16 +00:00
										 |  |  | namespace Guru | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2024-02-04 13:10:25 +00:00
										 |  |  |     using System; | 
					
						
							|  |  |  |     using System.Collections.Generic; | 
					
						
							|  |  |  |     using Firebase.RemoteConfig; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-12-27 12:24:16 +00:00
										 |  |  |     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); | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2024-06-06 12:09:03 +00:00
										 |  |  |         public static string GetRemoteString(string key, string defaultValue = "") => RemoteConfigManager.GetString(key, defaultValue); | 
					
						
							|  |  |  |         public static int GetRemoteInt(string key, int defaultValue = 0) => RemoteConfigManager.GetInt(key, defaultValue); | 
					
						
							|  |  |  |         public static long GetRemoteLong(string key, long defaultValue = 0 ) => RemoteConfigManager.GetLong(key, defaultValue); | 
					
						
							|  |  |  |         public static double GetRemoteDouble(string key, double defaultValue = 0) => RemoteConfigManager.GetDouble(key, defaultValue); | 
					
						
							|  |  |  |         public static float GetRemoteFloat(string key, float defaultValue = 0) => RemoteConfigManager.GetFloat(key, defaultValue); | 
					
						
							|  |  |  |         public static bool GetRemoteBool(string key, bool defaultValue = false) => RemoteConfigManager.GetBool(key, defaultValue); | 
					
						
							| 
									
										
										
										
											2023-12-27 12:24:16 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |          | 
					
						
							| 
									
										
										
										
											2024-07-25 03:17:16 +00:00
										 |  |  |         /// <summary> | 
					
						
							|  |  |  |         /// 注册监听某个 Key 的变化 | 
					
						
							|  |  |  |         /// </summary> | 
					
						
							|  |  |  |         /// <param name="key"></param> | 
					
						
							|  |  |  |         /// <param name="onValueChanged"></param> | 
					
						
							| 
									
										
										
										
											2023-12-27 12:24:16 +00:00
										 |  |  |         public static void RegisterOnValueChanged(string key, Action<string,string> onValueChanged) | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             RemoteConfigManager.RegisterOnValueChanged(key, onValueChanged); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |          | 
					
						
							| 
									
										
										
										
											2024-07-25 03:17:16 +00:00
										 |  |  |         /// <summary> | 
					
						
							|  |  |  |         /// 注销监听某个 Key 的变化 | 
					
						
							|  |  |  |         /// </summary> | 
					
						
							|  |  |  |         /// <param name="key"></param> | 
					
						
							|  |  |  |         /// <param name="onValueChanged"></param> | 
					
						
							| 
									
										
										
										
											2023-12-27 12:24:16 +00:00
										 |  |  |         public static void UnRegisterOnValueChanged(string key, Action<string,string> onValueChanged) | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             RemoteConfigManager.UnRegisterOnValueChanged(key, onValueChanged); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |          | 
					
						
							| 
									
										
										
										
											2024-07-25 03:17:16 +00:00
										 |  |  |         /// <summary> | 
					
						
							|  |  |  |         /// 获取所有云控配置 | 
					
						
							|  |  |  |         /// </summary> | 
					
						
							|  |  |  |         /// <returns></returns> | 
					
						
							| 
									
										
										
										
											2023-12-27 12:24:16 +00:00
										 |  |  |         public static Dictionary<string, ConfigValue> GetRemoteAllValues() => RemoteConfigManager.GetAllValues(); | 
					
						
							|  |  |  |          | 
					
						
							| 
									
										
										
										
											2024-07-25 03:17:16 +00:00
										 |  |  |         /// <summary> | 
					
						
							|  |  |  |         ///  | 
					
						
							|  |  |  |         /// </summary> | 
					
						
							|  |  |  |         /// <param name="key"></param> | 
					
						
							|  |  |  |         /// <returns></returns> | 
					
						
							| 
									
										
										
										
											2023-12-27 12:24:16 +00:00
										 |  |  |         public static string GetRemoteStaticValue(string key) => RemoteConfigManager.GetStaticValue(key); | 
					
						
							|  |  |  |          | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } |