Beispiel #1
0
        void StartFetchData()
        {
            isFetchInProgress = true;
            Task fetchTask = FirebaseRemoteConfig.FetchAsync(GetCacheExpiration());

            fetchTask.ContinueWith(FetchComplete);
        }
    private void ArrangeCollectButtons()
    {
        string a = string.Empty;

        try
        {
            a = FirebaseRemoteConfig.GetValue("daily_double").StringValue;
        }
        catch
        {
        }
        if (a == "1" && reward != 0 && !PlayerPrefsManager.GetPro())
        {
            rewardedButton.gameObject.SetActive(value: true);
            Vector3 v = collectButton.GetComponent <RectTransform>().anchoredPosition;
            v.x = -140f;
            collectButton.GetComponent <RectTransform>().anchoredPosition = v;
            v.x = 140f;
            rewardedButton.GetComponent <RectTransform>().anchoredPosition = v;
        }
        else
        {
            rewardedButton.gameObject.SetActive(value: false);
            Vector3 v2 = collectButton.GetComponent <RectTransform>().anchoredPosition;
            v2.x = 0f;
            collectButton.GetComponent <RectTransform>().anchoredPosition = v2;
        }
        collectButton.GetComponent <Button>().interactable  = true;
        rewardedButton.GetComponent <Button>().interactable = true;
    }
Beispiel #3
0
    public static void Initialize()
    {
                #if remote_config
        ProjectManager config = ProjectManager.staticRef;

        Dictionary <string, object> defaultConfig = new Dictionary <string, object>();

        defaultConfig.Add("useAdMob", config.useAdMob);
        defaultConfig.Add("useIAS", config.useIAS);
        defaultConfig.Add("useFirebaseAnalytics", config.useFirebaseAnalytics);
        //defaultConfig.Add ("useFirebaseRemoteConfig", config.useFirebaseRemoteConfig);

        defaultConfig.Add("useFirebaseAuth", config.useFirebaseAuth);
        defaultConfig.Add("useFirebaseDatabase", config.useFirebaseDatabase);
        defaultConfig.Add("useFirebaseInvites", config.useFirebaseInvites);
        defaultConfig.Add("useFirebaseMessaging", config.useFirebaseMessaging);
        defaultConfig.Add("useFirebaseStorage", config.useFirebaseStorage);

        defaultConfig.Add("isDebugModeActive", config.isDebugModeActive);

        // Add custom developer defined values from the inspector into the defaultConfig dictionary
        foreach (CustomRemoteConfig newDefaultConfig in staticRef.customDefaultConfig)
        {
            defaultConfig.Add(newDefaultConfig.name, newDefaultConfig.defaultValue);
        }

        // Assign all the default values from above
        FirebaseRemoteConfig.SetDefaults(defaultConfig);

        staticRef.FetchRemoteConfig();
                #endif
    }
Beispiel #4
0
        private void fetchComplete(Task fetchTask)
        {
            if (fetchTask.IsCanceled)
            {
                Debug.Log("fetch cancelled");
            }
            else if (fetchTask.IsFaulted)
            {
                Debug.Log("fetch encontered an error.");
            }
            else if (fetchTask.IsCompleted)
            {
                Debug.Log("Fetch completed successfully!");
            }

            var info = FirebaseRemoteConfig.Info;

            switch (info.LastFetchStatus)
            {
            case LastFetchStatus.Success:
                FirebaseRemoteConfig.ActivateFetched();
                break;

            case LastFetchStatus.Failure:
                break;

            case LastFetchStatus.Pending:
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
            setValues();
            loadReward();
        }
Beispiel #5
0
        private static void UpdateRemoteSettings()
        {
            SetUserProperties();
            if (!IsInitialized)
            {
                return;
            }

            Task fetchTask;

            if (Debug.isDebugBuild)
            {
                // Default interval is 12 hours, let's make it zero for the purpose of testing
                fetchTask = FirebaseRemoteConfig.FetchAsync(TimeSpan.Zero);

                var settings = FirebaseRemoteConfig.Settings;
                settings.IsDeveloperMode      = true;
                FirebaseRemoteConfig.Settings = settings;
            }
            else
            {
                fetchTask = FirebaseRemoteConfig.FetchAsync();
            }

            PerformRemoteSettingsFetch(fetchTask);
        }
 private void Awake()
 {
     manager = GetComponent <UIManager>();
     FirebaseApp.CheckAndFixDependenciesAsync().ContinueWithOnMainThread <DependencyStatus>((task) =>
     {
         DependencyStatus status = task.Result;
         if (status == DependencyStatus.Available)
         {
             App               = FirebaseApp.DefaultInstance;
             Auth              = FirebaseAuth.DefaultInstance;
             functions         = FirebaseFunctions.DefaultInstance;
             functionReference = functions.GetHttpsCallable("RequestMessage");
             manager.TurnOff(manager.AuthBlocker);
             manager.TurnOff(manager.AnalyticsBlocker);
             App.SetEditorDatabaseUrl("https://fir-n-ix.firebaseio.com/");
             dbReference = FirebaseDatabase.DefaultInstance.RootReference;
             FirebaseMessaging.TokenReceived   += OnTokenReceived;
             FirebaseMessaging.MessageReceived += OnMessageReceived;
             FirebaseMessaging.TokenRegistrationOnInitEnabled = true;
             defaults.Add("RemoteTest", 25);
             FirebaseRemoteConfig.SetDefaults(defaults);
             FirebaseRemoteConfig.FetchAsync(TimeSpan.Zero).ContinueWithOnMainThread((remoteConfigTask) =>
             {
                 FirebaseRemoteConfig.ActivateFetched();
                 RemoteConfigResult = FirebaseRemoteConfig.GetValue("RemoteTest").StringValue;
                 manager.TurnOff(manager.RemoteConfigBlocker);
             });
             storage = FirebaseStorage.DefaultInstance;
         }
         else
         {
             Debug.Log(string.Format("Can't resolve all Firebase dependencies: {0}", status));
         }
     });
 }
Beispiel #7
0
        private void fetchRemoteConfigDataAsync()
        {
            Task
                fetchTask = FirebaseRemoteConfig.FetchAsync(TimeSpan.Zero);

            fetchTask.ContinueWith(fetchComplete);
            return;
        }
        private Task FetchDataAsync()
        {
            this.Log("[FIREBASE] Fetching own interstitial data...", LogLevel.FrameworkInfo);

            Task fetchTask = FirebaseRemoteConfig.FetchAsync(TimeSpan.Zero);

            return(fetchTask.ContinueWith(FetchComplete));
        }
Beispiel #9
0
    private float GetFloat(string valName)
    {
#if FIREBASE_CONFIGS
        return(float.Parse(FirebaseRemoteConfig.GetValue(valName).StringValue));
#else
        return(0);
#endif
    }
    public Task FetchDataAsync()
    {
        Debug.Log("Fetching data...");
        Task fetchTask = FirebaseRemoteConfig.FetchAsync(
            TimeSpan.Zero);

        return(fetchTask.ContinueWithOnMainThread(FetchComplete));
    }
Beispiel #11
0
        private static Task FetchDataAsync()
        {
            Debug.Log("FazApp: Fetching own interstitial data...");

            Task fetchTask = FirebaseRemoteConfig.FetchAsync(TimeSpan.Zero);

            return(fetchTask.ContinueWith(FetchComplete));
        }
Beispiel #12
0
    // This needs to be called when a value is expected to be different or the GetValue(..) values will be cached
    public static void FlushCache()
    {
                #if remote_config
        FirebaseRemoteConfig.ActivateFetched();

        staticRef.RemoteConfigReady();
                #endif
    }
        private void enableDeveloperModeInDebugModel(FirebaseRemoteConfig remoteConfig)
        {
            var settings = new FirebaseRemoteConfigSettings
                           .Builder()
                           .SetDeveloperModeEnabled(true)
                           .Build();

            remoteConfig.SetConfigSettings(settings);
        }
Beispiel #14
0
 private void Start()
 {
     ExplosionForce = (float)FirebaseRemoteConfig.GetValue(
         StringConstants.RemoteConfigMineTileForce).DoubleValue;
     ExplosionRadius = (float)FirebaseRemoteConfig.GetValue(
         StringConstants.RemoteConfigMineTileRadius).DoubleValue;
     UpwardsModifier = (float)FirebaseRemoteConfig.GetValue(
         StringConstants.RemoteConfigMineTileUpwardsMod).DoubleValue;
 }
Beispiel #15
0
        private void InitRemoteConfig()
        {
            firebaseRemoteConfig = FirebaseRemoteConfig.Instance;
            FirebaseRemoteConfigSettings configSettings = new FirebaseRemoteConfigSettings.Builder()
                                                          .SetDeveloperModeEnabled(true)
                                                          .Build();

            firebaseRemoteConfig.SetConfigSettings(configSettings);
            firebaseRemoteConfig.SetDefaults(Resource.Xml.remote_config_defaults);
        }
Beispiel #16
0
    private static uint GetCRC(string[] keys)
    {
        StringBuilder stringBuilder = new StringBuilder();

        foreach (string key in keys)
        {
            stringBuilder.Append(FirebaseRemoteConfig.GetValue(key).StringValue);
        }
        return(Crc32.Compute(Encoding.ASCII.GetBytes(stringBuilder.ToString())));
    }
 public static string FetchRemoteValue(string key)
 {
     try
     {
         return(FirebaseRemoteConfig.GetValue(key).StringValue);
     }
     catch
     {
         return(string.Empty);
     }
 }
        public async Task FetchAndActivateAsync()
        {
            await FirebaseRemoteConfig.get_Instance().FetchAsync();

            Dictionary <string, string> all1 = this.GetAll();

            FirebaseRemoteConfig.get_Instance().ActivateFetched();
            Dictionary <string, string> all2 = this.GetAll();

            this._remoteConfigurationService.UpdateChangedList(all1, all2);
        }
Beispiel #19
0
        private void Start()
        {
            ExplosionForce = (float)FirebaseRemoteConfig.GetValue(
                StringConstants.RemoteConfigSpikesTileForce).DoubleValue;
            ExplosionRadius = (float)FirebaseRemoteConfig.GetValue(
                StringConstants.RemoteConfigSpikesTileRadius).DoubleValue;
            ExplosionUpwardsModifier = (float)FirebaseRemoteConfig.GetValue(
                StringConstants.RemoteConfigSpikesTileUpwardsMod).DoubleValue;

            ForceState(EnabledAtStart);
        }
        public FirebaseABTestingImplementation()
        {
            CacheTimeout          = 0;
            IsDeveloperModeEnable = true;
            _firebaseRemote       = FirebaseRemoteConfig.Instance;
            FirebaseRemoteConfigSettings configSettings = new FirebaseRemoteConfigSettings.Builder()
                                                          .SetDeveloperModeEnabled(true)
                                                          .Build();

            _firebaseRemote.SetConfigSettings(configSettings);
        }
 static void FetchData()
 {
     if (FirebaseManager.FirebaseReady)
     {
         FetchDataAsync((task) =>
         {
             Debug.Log("Fetch async done");
             FirebaseRemoteConfig.ActivateFetched();
             onFetchComplete?.Invoke(null, true);
         });
     }
 }
Beispiel #22
0
        private void FetchComplete(Task fetchTask)
        {
            if (fetchTask.IsCanceled)
            {
                Debug.Log("Fetch canceled.");
            }
            else if (fetchTask.IsFaulted)
            {
                Debug.Log("Fetch encountered an error.");
            }
            else if (fetchTask.IsCompleted)
            {
                Debug.Log("Fetch completed successfully!");
            }

            var info = FirebaseRemoteConfig.Info;

            switch (info.LastFetchStatus)
            {
            case LastFetchStatus.Success:
                FirebaseRemoteConfig.ActivateFetched();
                OnRemoteConfigFetched();
#if VIPERA_CORE
                MainThreadQueue.Enqueue(SetLastSuccessedFetchDate);
#else
                SetLastSuccessedFetchDate();
#endif
                break;

            case LastFetchStatus.Failure:
#if DEVELOPMENT_BUILD || UNITY_EDITOR
                switch (info.LastFetchFailureReason)
                {
                case FetchFailureReason.Error:
                    Debug.Log("Fetch failed: " + fetchTask.Exception.ToString());

                    break;

                case FetchFailureReason.Throttled:
                    Debug.Log("Fetch throttled until " + info.ThrottledEndTime);
                    break;
                }
#endif
                break;

            case LastFetchStatus.Pending:
#if DEVELOPMENT_BUILD || UNITY_EDITOR
                Debug.Log("Latest Fetch call still pending.");
#endif
                break;
            }
            isFetchInProgress = false;
        }
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
         UnityEngine.Object.DontDestroyOnLoad(base.gameObject);
         string a     = string.Empty;
         string text  = string.Empty;
         string text2 = string.Empty;
         try
         {
             a     = FirebaseRemoteConfig.GetValue("rewarded_status").StringValue;
             text  = FirebaseRemoteConfig.GetValue("interstitial_interval").StringValue;
             text2 = FirebaseRemoteConfig.GetValue("interstitial_firstlevel").StringValue;
         }
         catch (Exception)
         {
         }
         if (a == "1")
         {
             rewardedEnabled = true;
         }
         else
         {
             rewardedEnabled = false;
         }
         if (text != string.Empty)
         {
             float.TryParse(text, out interstitialTime);
         }
         else
         {
             interstitialTime = 300f;
         }
         if (text2 != string.Empty)
         {
             int.TryParse(text2, out firstLevel);
             firstLevel--;
         }
         else
         {
             firstLevel = 13;
         }
         adTimer = interstitialTime;
         lastInterstitialTime = 99999f;
         Init();
     }
     else
     {
         UnityEngine.Object.Destroy(base.gameObject);
     }
 }
Beispiel #24
0
        public static OwnInterstitialData GetOwnInterstitialData()
        {
            var fetchedData = new OwnInterstitialData
            {
                showOwnInterstitial = FirebaseRemoteConfig.GetValue(FrameworkValues.FIREBASE_REMOTE_CONFIG_SHOW_OWN_INTERSTITIAL_KEY_B).BooleanValue,
                imageURL            = FirebaseRemoteConfig.GetValue(FrameworkValues.FIREBASE_REMOTE_CONFIG_OWN_INTERSTITIAL_IMAGE_URL_KEY_S).StringValue,
                storeURL            = FirebaseRemoteConfig.GetValue(FrameworkValues.FIREBASE_REMOTE_CONFIG_OWN_INTERSTITIAL_STORE_URL_KEY_S).StringValue,
                title       = FirebaseRemoteConfig.GetValue(FrameworkValues.FIREBASE_REMOTE_CONFIG_OWN_INTERSTITIAL_TITLE_KEY_S).StringValue,
                description = FirebaseRemoteConfig.GetValue(FrameworkValues.FIREBASE_REMOTE_CONFIG_OWN_INTERSTITIAL_DESCRIPTION_KEY_S).StringValue
            };

            return(fetchedData);
        }
Beispiel #25
0
    // ref: https://stackoverflow.com/questions/48521807/firebase-remote-config-in-unity-get-only-default-values-and-not-real-ones
    private static void RemoteSettingsFetch(Task fetchTask)
    {
        if (fetchTask.IsCanceled)
        {
            Debug.Log("Remote Settings: Fetch canceled.");
        }
        else if (fetchTask.IsFaulted)
        {
            Debug.Log("Remote Settings: Fetch encountered an error.");
        }
        else if (fetchTask.IsCompleted)
        {
            Debug.Log("Remote Settings: Fetch completed!");

            var info = FirebaseRemoteConfig.Info;

            switch (info.LastFetchStatus)
            {
            case LastFetchStatus.Success:
                Debug.Log(string.Format("Remote Settings: Data loaded and ready (last fetch time {0}).", info.FetchTime));
                if (FirebaseRemoteConfig.ActivateFetched())
                {
                    rsActivateFetched = true;
                    SGDebug.Log(string.Format("Remote Settings: Activate Fetched and Data loaded and ready (last fetch time {0}).", info.FetchTime));
                }
                break;

            case LastFetchStatus.Failure:
                switch (info.LastFetchFailureReason)
                {
                case FetchFailureReason.Error:
                    Debug.LogError("Remote Settings: Fetch failed for unknown reason");
                    break;

                case FetchFailureReason.Throttled:
                    Debug.LogError("Remote Settings: Fetch throttled until " + info.ThrottledEndTime);
                    break;
                }
                break;

            case LastFetchStatus.Pending:
                Debug.LogWarning("Remote Settings: Latest Fetch call still pending.");
                break;

            default:
                Debug.LogWarning(string.Format("Remote Settings: Something get wrong. Data: {0}", info));
                break;
            }
        }
    }
        private void FetchComplete(Task fetchTask)
        {
            if (fetchTask.IsCanceled)
            {
                this.Log("[FIREBASE] Own interstitial data fetch canceled.", LogLevel.FrameworkErrorInfo);
            }
            else if (fetchTask.IsFaulted)
            {
                this.Log("[FIREBASE] Own interstitial data fetch encountered an error.", LogLevel.FrameworkErrorInfo);
            }
            else if (fetchTask.IsCompleted)
            {
                this.Log("[FIREBASE] Own interstitial data fetch completed successfully!", LogLevel.FrameworkInfo);
            }

            var info = FirebaseRemoteConfig.Info;

            switch (info.LastFetchStatus)
            {
            case LastFetchStatus.Success:
                FirebaseRemoteConfig.ActivateFetched();
                this.Log($"[FIREBASE] Own interstitial data loaded and ready (last fetch time {info.FetchTime}).", LogLevel.FrameworkInfo);

                LogEvent("own_interstitial_load_status", "status", "success");
                ownInterstitial.PrepareInterstitialData();
                break;

            case LastFetchStatus.Failure:
                LogEvent("own_interstitial_load_status", "status", "failure");
                ownInterstitial.OnFirebaseInitializationFailed();

                switch (info.LastFetchFailureReason)
                {
                case FetchFailureReason.Error:
                    this.Log("[FIREBASE] Own interstitial data fetch failed for unknown reason.", LogLevel.FrameworkErrorInfo);
                    break;

                case FetchFailureReason.Throttled:
                    this.Log("[FIREBASE] Own interstitial data fetch throttled until " +
                             info.ThrottledEndTime, LogLevel.FrameworkErrorInfo);
                    break;
                }

                break;

            case LastFetchStatus.Pending:
                this.Log("[FIREBASE] Latest own interstitial data fetch call still pending.", LogLevel.FrameworkInfo);
                break;
            }
        }
Beispiel #27
0
    private static void RemoteSettingsAsyncUpdate()
    {
        if (!setupReady)
        {
            return;
        }

        // remote settings, async
        rsActivateFetched = false;
        FirebaseRemoteConfig.FetchAsync(TimeSpan.Zero).ContinueWith(RemoteSettingsFetch);
        //Task fetchTask = FirebaseRemoteConfig.FetchAsync(TimeSpan.Zero);
        //fetchTask.ContinueWith(RemoteSettingsFetch);
        Debug.Log("Remote Settings: Start async update.");
    }
Beispiel #28
0
    public void UpdateConfigs()
    {
#if FIREBASE_CONFIGS
        try
        {
            GameConfig =
                JsonUtility.FromJson <GameConfig>(FirebaseRemoteConfig.GetValue(nameof(GameConfig)).StringValue);
        }
        catch (Exception e)
        {
            Debug.LogException(e);
        }
#endif
    }
Beispiel #29
0
        private static void InitializeRemoteConfig()
        {
            var defaults = new Dictionary <string, object>
            {
                { FrameworkValues.FIREBASE_REMOTE_CONFIG_SHOW_OWN_INTERSTITIAL_KEY_B, false },
                { FrameworkValues.FIREBASE_REMOTE_CONFIG_OWN_INTERSTITIAL_IMAGE_URL_KEY_S, "DEFAULT" },
                { FrameworkValues.FIREBASE_REMOTE_CONFIG_OWN_INTERSTITIAL_STORE_URL_KEY_S, "DEFAULT" },
                { FrameworkValues.FIREBASE_REMOTE_CONFIG_OWN_INTERSTITIAL_TITLE_KEY_S, "DEFAULT" },
                { FrameworkValues.FIREBASE_REMOTE_CONFIG_OWN_INTERSTITIAL_DESCRIPTION_KEY_S, "DEFAULT" }
            };


            FirebaseRemoteConfig.SetDefaults(defaults);
        }
Beispiel #30
0
    private static List <KeyValuePair <string, string> > ParseConfigsFromFirebase()
    {
        FirebaseRemoteConfig.ActivateFetched();
        IEnumerable <string> keys = FirebaseRemoteConfig.Keys;

        string[] array = (from key in keys
                          where FirebaseRemoteConfig.GetValue(key).StringValue != string.Empty
                          select key).ToArray();
        m_crc32 = GetCRC(array);
        List <JSONObject> messages = (from key in array
                                      select FirebaseRemoteConfig.GetValue(key).StringValue into raw
                                      select JSONObject.Create(raw)).ToList();

        return(GetConfigs(messages).Concat(GetGameSettings(messages)).ToList());
    }