/// <summary> /// Disclaimer: Call Init function only if you don't use RateBoxPrefab. /// Otherwise RateBoxPrefab script will call Init for you with arguments from the inspector. /// Call Init after the application is launched, or when it returns from a background state in order to increment /// session counter correctly. /// </summary> /// <param name="rateUrl"> /// http(s) url to open after user press the Rate button. /// </param> /// <param name="conditions"> /// The set of conditions under which a rate dialog should be presented. /// If any requirements are not meet, calling Show will be ignored. /// This is useful when you want to limit number of rate dialog impressions. /// If null, default restrictions will be used. /// Check RateBoxConditions to learn about default values /// </param> /// <param name="textSettings"> /// Holds strings (like title, message etc) to use when call Show() or ForceShow() functions without arguments /// Can be set directly in code, or automatically if using RateBoxPrefab ('TEXT' group) /// If null, you need to call Show and Force show with arguments; default functions will not work /// </param> public void Init(string rateUrl, RateBoxConditions conditions = null, RateBoxTextSettings textSettings = null, RateBoxSettings settings = null) { int time = Time(); if (Statistics.ApplicationVersion == null || Statistics.ApplicationVersion != Application.version) { Statistics = new RateBoxStatistics(); Statistics.ApplicationVersion = Application.version; } if (Statistics.AppInstallAt <= 0) { Statistics.AppInstallAt = time; } Statistics.AppLaunchAt = time; Statistics.SessionsCount++; Conditions = (conditions == null) ? new RateBoxConditions() : conditions; Settings = (settings == null) ? new RateBoxSettings() : settings; DefaultTextSettings = textSettings; RateUrl = rateUrl; SaveStatistics(); }
/// <summary> /// Clears the statistics /// Normally this function is called automatically when new app's version is detected. /// However, it can be handy to use it for test purpose. /// Important: It is not a good idea to clear statistics in release version of the applications /// </summary> public void ClearStatistics() { Statistics = new RateBoxStatistics(); SaveStatistics(); }
//private RateBoxStatistics stat; private RateBox(RateBoxStatistics stat) { Statistics = stat; DebugMode = false; }