Beispiel #1
0
    void ShowReloadPopup()
    {
        if (Application.isEditor)
        {
            print("Restart alert popped");
        }

        EasyMobile.NativeUI.AlertPopup alert = EasyMobile.NativeUI.Alert("Update available!", "Please download the latest version.");
        if (alert != null)
        {
            alert.OnComplete += RestartApp;
        }
    }
Beispiel #2
0
    void ShowReloadPopup()
    {
        if (isPopped)
        {
            return;
        }

        if (Application.isEditor)
        {
            print("Restart alert popped");
        }

        EasyMobile.NativeUI.AlertPopup alert = EasyMobile.NativeUI.Alert("Time out", "Disconnected from the server. Reload ");
        if (alert != null)
        {
            alert.OnComplete += RestartApp;
        }
    }
Beispiel #3
0
        private static void DoRequestRating(RatingDialogContent content, Action <UserAction> callback)
        {
            //!Remove Constrains check since from version 2.8.0 EM Pro use native review popup on both platform.
            // if (!CanRequestRating())
            // {
            //     Debug.Log("Could not display the rating request popup because it was disabled, " +
            //         "or one or more display constraints are not satisfied.");
            //     return;
            // }

            // If no custom content was provided, use the default one.
            if (content == null)
            {
                content = EM_Settings.RatingRequest.DefaultRatingDialogContent;
            }

            // Callback register
            customBehaviour = callback;

#if UNITY_EDITOR
            Debug.Log("Request review is only available on iOS and Android devices.");
#elif UNITY_IOS
            if (iOSNativeUtility.CanUseBuiltinRequestReview())
            {
                // iOS 10.3+.
                iOSNativeUtility.RequestReview();
            }
            else
            {
                // iOS before 10.3.
                NativeUI.AlertPopup alert = NativeUI.ShowThreeButtonAlert(
                    content.Title.Replace(RatingDialogContent.PRODUCT_NAME_PLACEHOLDER, Application.productName),
                    content.Message.Replace(RatingDialogContent.PRODUCT_NAME_PLACEHOLDER, Application.productName),
                    content.RefuseButtonText,
                    content.PostponeButtonText,
                    content.RateButtonText
                    );

                if (alert != null)
                {
                    alert.OnComplete += OnIosRatingDialogCallback;
                }
            }

            // if (!IsDisplayConstraintIgnored())
            // {
            //     // Increment the number of requests used this year.
            //     SetAnnualUsedRequests(DateTime.Now.Year, GetAnnualUsedRequests(DateTime.Now.Year) + 1);

            //     // Store the request timestamp
            //     StorageUtil.SetTime(LAST_REQUEST_TIMESTAMP_PPKEY, DateTime.Now);
            // }
#elif UNITY_ANDROID
            if (Instance != null)
            {
                return;    // only allow one alert at a time
            }
            // Create a Unity game object to receive messages from native side
            Instance = new GameObject(RATING_DIALOG_GAMEOBJECT).AddComponent <StoreReview>();
            #region native_review_popup

            // // Replace placeholder texts if any.
            // var texts = new RatingDialogContent(
            //                 content.Title.Replace(RatingDialogContent.PRODUCT_NAME_PLACEHOLDER, Application.productName),
            //                 content.Message.Replace(RatingDialogContent.PRODUCT_NAME_PLACEHOLDER, Application.productName),
            //                 content.LowRatingMessage.Replace(RatingDialogContent.PRODUCT_NAME_PLACEHOLDER, Application.productName),
            //                 content.HighRatingMessage.Replace(RatingDialogContent.PRODUCT_NAME_PLACEHOLDER, Application.productName),
            //                 content.PostponeButtonText,
            //                 content.RefuseButtonText,
            //                 content.RateButtonText,
            //                 content.CancelButtonText,
            //                 content.FeedbackButtonText
            //             );

            // // Show the Android rating request
            // AndroidNativeUtility.RequestRating(texts, EM_Settings.RatingRequest);
            #endregion
            #region store_review
            AndroidNativeUtility.RequestStoreReview(Instance.name, "OnAndroidRatingDialogCallback");
            #endregion
            // if (!IsDisplayConstraintIgnored())
            // {
            //     // Increment the number of requests used this year.
            //     SetAnnualUsedRequests(DateTime.Now.Year, GetAnnualUsedRequests(DateTime.Now.Year) + 1);

            //     // Store the request timestamp
            //     StorageUtil.SetTime(LAST_REQUEST_TIMESTAMP_PPKEY, DateTime.Now);
            // }
#else
            Debug.Log("Request review is not supported on this platform.");
#endif
        }