Beispiel #1
0
        void OnRemoteConfigFetched()
        {
            foreach (var item in SettingsScripts)
            {
                try
                {
                    item.Setup();
                }
                catch (System.Exception ex)
                {
#if UNITY_EDITOR
                    Debug.LogError("Failed to setup settings:" + ex);
#endif
                }
            }

#if VIPERA_CORE
            MainThreadQueue.Enqueue(() =>
            {
                OnFetchComplete?.Invoke();
            });
#else
            OnFetchComplete?.Invoke();
#endif
        }
Beispiel #2
0
        public static void Init()
        {
            if (instance != null)
            {
                return;
            }

            instance = new GameObject("MainThreadQueue").AddComponent <MainThreadQueue>();
            DontDestroyOnLoad(instance.gameObject);
        }
Beispiel #3
0
        public void InitializeFirebase()
        {
#if VIPERA_CORE
            MainThreadQueue.Enqueue(() =>
            {
                analytics.InitializeFirebase();
                remoteConfig.InitializeFirebase();
                FirebaseMessages.Init();
            });
#endif
        }
Beispiel #4
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;
        }