void ReadyToPrompt() { //Ask the delegate if we can prompt, if there is a delegate. if (ShouldUniRatePromptForRating != null && !ShouldUniRatePromptForRating()) { UniRateDebug.Log("Not display prompt because ShouldUniRatePromptForRating returns false."); return; } ShowPrompt(); }
void UniRateUserWantRemind() { UniRateDebug.Log("User wants to be reminded later"); _promptShowing = false; this.lastReminded = DateTime.Now; if (OnUserWantReminderToRate != null) { OnUserWantReminderToRate(); } }
void UniRateUserDeclinedPrompt() { UniRateDebug.Log("User declined the prompt"); _promptShowing = false; this.declinedThisVersion = true; if (OnUserDeclinedToRate != null) { OnUserDeclinedToRate(); } }
/// <summary> /// Opens the rate page directly without automatically configuration. Do not call this /// if you did not set the AppID for UniRate yourself. You may want to use RateIfNetworkAvailable() /// instead, which can retrive the correct AppiD if the network is available. /// </summary> public void OpenRatePage() { this.ratedThisVersion = true; #if UNITY_IOS UniRateDebug.Log("Open rating page of URL: " + this.RatingIOSURL); Application.OpenURL(this.RatingIOSURL); #elif UNITY_ANDROID UniRateDebug.Log("Open rating page of URL: " + this.RatingAndroidURL); UniRatePlugin.OpenAndroidRatePage(this.RatingAndroidURL); #elif UNITY_WP8 UniRateDebug.Log("Open rating page for WP8"); UniRatePlugin.OpenWPMarket(); #endif }
void UniRateUserWantToRate() { UniRateDebug.Log("User wants to rate"); _promptShowing = false; if (OnUserAttemptToRate != null) { OnUserAttemptToRate(); } if (ShouldUniRateOpenRatePage != null && !ShouldUniRateOpenRatePage()) { UniRateDebug.Log("Not open rate page because ShouldUniRateOpenRatePage() returning false"); } else { OpenRatePage(); } }
/// <summary> /// Shows the prompt, there is no check for conditions or app information getting. /// It depends on <see cref="appStoreID"/>, if you are not set it yourself, do not use this metod (use PromptIfNetworkAvailable instead). /// </summary> public void ShowPrompt() { UniRateDebug.Log("It's time to show prompt"); if (OnPromptedForRating != null) { OnPromptedForRating(); } if (!useCustomizedPromptView) { UniRatePlugin.ShowPrompt(this.MessageTitle, this.Message, this.RateButtonLabel, this.CancelButtonLabel, this.RemindButtonLabel); _promptShowing = true; #if UNITY_WP8 _shouldPoll = true; #endif } }
//This check is only for iOS IEnumerator CheckForConnectivityInBackground(bool showPrompt) { string iTunesServiceURL = ""; if (!string.IsNullOrEmpty(appStoreCountry)) { iTunesServiceURL = string.Format(kUniRateAppLookupURLFormat, appStoreCountry + "/"); } else { iTunesServiceURL = string.Format(kUniRateAppLookupURLFormat, ""); } if (appStoreID != 0) { iTunesServiceURL = iTunesServiceURL + "?id=" + appStoreID; } else { iTunesServiceURL = iTunesServiceURL + "?bundleId=" + applicationBundleID; } UniRateDebug.Log("Checking app info: " + iTunesServiceURL); bool errorHappened = false; WWW www = new WWW(iTunesServiceURL); yield return(www); if (String.IsNullOrEmpty(www.error)) //No error. Try parse app info from the returned text { UniRateAppInfo info = new UniRateAppInfo(www.text); if (info.validAppInfo) { if (info.bundleId.Equals(this.applicationBundleID)) //Everything goes ok { if (appStoreID == 0) { appStoreID = info.appID; UniRateDebug.Log("UniRate found the app, app id: " + appStoreID); } if (this.onlyPromptIfLatestVersion && !this.previewMode) { if (!applicationVersion.Equals(info.version)) { UniRateDebug.Log("No prompt because it is not the version in app store and you set onlyPromptIfLatestVersion."); errorHappened = true; UniRateFailWithError(Error.NotTheLatestVersion); } } } else { Debug.LogWarning("The bundle Id is not the same. Appstore: " + info.bundleId + " vs AppSetting:" + applicationBundleID); errorHappened = true; UniRateFailWithError(Error.BundleIdDoesNotMatchAppStore); } } else { if (appStoreID != 0) //We have a specified app id { Debug.LogWarning("No App info found with this app Id " + appStoreID); errorHappened = true; UniRateFailWithError(Error.AppNotFoundOnAppStore); } else { Debug.Log("No App info found with this bundle Id " + applicationBundleID); Debug.Log("Could not find your app on AppStore. It is normal when your app is not released, don't worry about this message."); } } } else { UniRateDebug.Log("Error happend in loading app information. Maybe due to no internet connection."); errorHappened = true; UniRateFailWithError(Error.NetworkError); } //Every thing goes ok. Prompt to rating now. if (!errorHappened) { _currentChecking = false; if (showPrompt) { ReadyToPrompt(); } else { OpenRatePage(); } } }