Exemple #1
0
 private void Start()
 {
     if (!Developers.Enabled && (!UseRemoteConfig || StencilRemote.IsProd()))
     {
         gameObject.SetActive(false);
     }
 }
Exemple #2
0
        private static async UniTask _Init()
        {
            var dependencyStatus = await FirebaseApp.CheckAndFixDependenciesAsync();

            var success = dependencyStatus == DependencyStatus.Available;

            if (!success)
            {
                Debug.LogError($"Could not resolve all Firebase dependencies: {dependencyStatus}");
            }

            await UniTask.SwitchToMainThread();

            Debug.Log($"Firebase Configuration: {success}");
            if (success)
            {
                var prod = StencilRemote.IsProd();
                if (!prod)
                {
                    FirebaseApp.LogLevel = LogLevel.Debug;
                }
                var settings = FirebaseRemoteConfig.Settings;
                settings.IsDeveloperMode      = !prod;
                FirebaseRemoteConfig.Settings = settings;
                var cache = settings.IsDeveloperMode ? TimeSpan.Zero : TimeSpan.FromHours(StencilRemote.CacheHours);
                var _     = OnRemote(cache);
                SetupPush();
            }

            StencilAuth.Init();
            IsReady = success;
            OnReady?.Invoke(null, success);
        }
 private void Validate()
 {
     if (!StencilRemote.IsDeveloper())
     {
         return;
     }
     Debug.Log("IronSrc validating integration...");
     IronSource.Agent.validateIntegration();
 }
Exemple #4
0
 protected virtual void OnTrackPurchase(int count = 1)
 {
     Debug.Log($"StencilProductState: Process Receipt: {productId} {currencyCode} {price} {receipt} {signature}");
     if (!StencilRemote.IsProd())
     {
         return;
     }
     #if STENCIL_TENJIN && !UNITY_EDITOR
     StencilTenjin.Instance.tenjin.Transaction(productId, currencyCode, count, price, transactionId, receipt, signature);
     #endif
 }
Exemple #5
0
 private static void OnPremium(object sender, EventArgs e)
 {
     if (StencilPremium.HasPremium)
     {
         HideBanner();
     }
     else if (!StencilRemote.IsProd())
     {
         ShowBanner();
     }
 }
Exemple #6
0
        private static async UniTask OnRemote(TimeSpan cache)
        {
            try
            {
                await FirebaseRemoteConfig.FetchAsync(cache);

                FirebaseRemoteConfig.ActivateFetched();
                await UniTask.SwitchToMainThread();

                StencilRemote.NotifyRemoteConfig();
            }
            catch (Exception e)
            {
                Debug.LogError($"Firebase Remote Config failed. {e.InnerException?.Message}");
            }
        }
Exemple #7
0
 private static void SetupPush()
 {
     FirebaseMessaging.RequestPermissionAsync();
     if (StencilRemote.IsDeveloper())
     {
         FirebaseMessaging.SubscribeAsync("dev/remote");
     }
     else
     {
         FirebaseMessaging.UnsubscribeAsync("dev/remote");
     }
     FirebaseMessaging.TokenReceived += (sender, args) =>
     {
         Debug.Log($"Firebase/FCM Token: {args.Token}");
     };
 }
        public static bool IsVisible(string key, bool invert = false, bool defaultFieldValue = false, bool enableInDebug = true)
        {
            if (enableInDebug && StencilRemote.IsDeveloper())
            {
                return(true);
            }
#if !STENCIL_FIREBASE
            return(true);
#else
            var retval = StencilRemote.BoolValue(key, defaultFieldValue);
            if (invert)
            {
                retval = !retval;
            }
            return(retval);
#endif
        }
Exemple #9
0
        protected override void OnEnable()
        {
            base.OnEnable();
            if (!Application.isPlaying)
            {
                return;
            }
            this.BindRemoteConfig();
#if STENCIL_ADMOB
            AppConfiguration          = new AppIdConfiguration(AppId.Android, AppId.Ios);
            BannerConfiguration       = new BannerConfiguration(BannerId.Android, BannerId.Ios);
            InterstitialConfiguration = new InterstitialConfiguration(InterstitialId.Android, InterstitialId.Ios);
            RewardConfiguration       = new RewardedConfiguration(RewardedId.Android, RewardedId.Ios);
#endif

#if UNITY_ADS
            Advertisement.Initialize(UnityId, !StencilRemote.IsProd());
#endif
        }