Exemplo n.º 1
0
        public static void GoToRateUrl(this RateConfig settings)
        {
            Debug.Log("Opening store URL for review!");
#if UNITY_IOS
            if (settings.IosNativeRating && NativeRate())
            {
                return;
            }
#endif
            settings.Review();
        }
Exemplo n.º 2
0
        public static RateReadiness CheckConditions(this RateConfig settings)
        {
            var firstCheck = FirstCheck ?? DateTime.UtcNow;

            FirstCheck = firstCheck;

            Debug.Log("Check Rate Conditions");
            if (IsRejected)
            {
                Debug.Log("Reject: User rejected rating");
                return(RateReadiness.FailRejected);
            }

            if (IsRated)
            {
                Debug.Log("Reject: User already rated");
                return(RateReadiness.FailRated);
            }

            if (settings.RequireInternetConnection &&
                Application.internetReachability == NetworkReachability.NotReachable)
            {
                Debug.Log("Reject: No internet");
                return(RateReadiness.FailNetwork);
            }

            var afterLaunch = settings.HoursAfterLaunch;

            if (afterLaunch > 0f)
            {
                var hoursRuntime = Time.time / 60f / 60f;
                if (afterLaunch > hoursRuntime)
                {
                    Debug.Log("Reject: Hours after launch");
                    return(RateReadiness.FailLaunchTime);
                }
            }

            var now  = DateTime.UtcNow;
            var last = LastShow;

            if (last != null)
            {
                var postpone = settings.HoursAfterPostpone;
                if (postpone > 0f && now < last.Value.AddHours(postpone))
                {
                    Debug.Log("Reject: Postponed.");
                    return(RateReadiness.FailPostponed);
                }
            }

            var afterInstall = settings.HoursAfterInstall;

            if (afterInstall > 0f && now < firstCheck.AddHours(afterInstall))
            {
                Debug.Log("Reject: Hours after install");
                return(RateReadiness.FailInstallTime);
            }

            var minSessions = settings.MinSessionCount;

            if (minSessions > 0 && SessionCount < minSessions)
            {
                Debug.Log("Reject: Session Count");
                return(RateReadiness.FailSessionCount);
            }

            Debug.Log("Accept Rating!");
            return(RateReadiness.Ready);
        }
Exemplo n.º 3
0
 public static void Review(this RateConfig settings)
 {
     Tracking.Instance.Track("review").SetUserProperty("has_reviewed", true);
     RecordRating();
     Application.OpenURL(settings.RateUrl);
 }
Exemplo n.º 4
0
 public static void Rate(this RateConfig settings)
 {
     Tracking.Instance.Track("rate").SetUserProperty("has_rated", true);
     RecordRating();
     settings.GoToRateUrl();
 }