private void DrawFeedbackRequestForProduct(ProductLookup product)
        {
            EditorGUI.LabelField(new Rect(10, 10, position.width - 20f, 20), "Leave feedback for " + product.name + " (your rating: " + product.rating + "/5)");
            EditorGUI.LabelField(new Rect(10, 30, position.width - 20f, 20), "Email:");

            if (_triedToSubmit && string.IsNullOrEmpty(product.email))
            {
                GUI.color = Color.red;
            }

            product.email = EditorGUI.TextField(new Rect(10, 50, position.width - 20f, EditorGUIUtility.singleLineHeight), product.email);
            GUI.color     = Color.white;

            EditorGUI.LabelField(new Rect(10, 70, position.width - 20f, 20), "Message:");
            product.feedback = EditorGUI.TextArea(new Rect(10, 90, position.width - 20f, 40), product.feedback);

            _subscribeToNewsletter = EditorGUI.Toggle(new Rect(position.width - 173f, 135f, 163f, EditorGUIUtility.singleLineHeight), "Subscribe to newsletter", _subscribeToNewsletter);

            var btnRect = new Rect(10f, 135f, 100f, EditorGUIUtility.singleLineHeight);

            if (GUI.Button(btnRect, "Cancel"))
            {
                _requestingFeedbackOnProduct = null;
            }

            btnRect.x += 110f;
            if (GUI.Button(btnRect, "Submit"))
            {
                _triedToSubmit = true;
                if (string.IsNullOrEmpty(product.email) == false)
                {
                    _requestingFeedbackOnProduct = null;
                    _requestMailSignupForProduct = null;
                    _forceShowVotingPage         = false;

                    // Send data
                    ProductRatingUtility.SubmitProduct(product);

                    if (_subscribeToNewsletter)
                    {
                        string result;
                        NewsletterEditorUtility.SubscribeToMailingList(product.email, out result);
                    }
                }
            }
        }
Пример #2
0
        protected void SubscribeToMailingList(string email)
        {
            string result;
            var    success = NewsletterEditorUtility.SubscribeToMailingList(email, out result);

            if (success)
            {
                DevdogLogger.Log("Successfully subscribed to mailing list :)");
                Repaint();
            }
            else
            {
                DevdogLogger.Log("Whoops something went wrong while subscribing");
                DevdogLogger.Log(result);
            }

            GetImages();
        }
        private void DrawMailSignupRequestForProduct(ProductLookup product)
        {
            EditorGUI.LabelField(new Rect(10, 10, position.width - 20f, 40f), "Subscribe to the newsletter for new product\nannouncements, discounts, giveaways and more.");
            EditorGUI.LabelField(new Rect(10, 50, position.width - 20f, 20), "Email:");
            if (_triedToSubmit && string.IsNullOrEmpty(product.email))
            {
                GUI.color = Color.red;
            }

            product.email = EditorGUI.TextField(new Rect(10, 70, position.width - 20f, EditorGUIUtility.singleLineHeight), product.email);
            GUI.color     = Color.white;

            var btnRect = new Rect(10f, 100f, 100f, EditorGUIUtility.singleLineHeight);

            if (GUI.Button(btnRect, "No thank you"))
            {
                _requestingFeedbackOnProduct = null;
                _requestMailSignupForProduct = null;
            }

            btnRect.x += 110f;
            if (GUI.Button(btnRect, "Subscribe"))
            {
                _triedToSubmit = true;
                if (string.IsNullOrEmpty(product.email) == false)
                {
                    _requestingFeedbackOnProduct = null;
                    _requestMailSignupForProduct = null;
                    _forceShowVotingPage         = false;

                    if (_subscribeToNewsletter)
                    {
                        string result;
                        NewsletterEditorUtility.SubscribeToMailingList(product.email, out result);
                    }
                }
            }
        }