From 366e3592b23098781e6fc3b5b7f1371253d7c08e Mon Sep 17 00:00:00 2001 From: Brian Handy Date: Mon, 12 May 2025 23:11:46 -0700 Subject: [PATCH] TMP support added, with ZeroWidthSpace fix --- MailChimpSubscriber.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/MailChimpSubscriber.cs b/MailChimpSubscriber.cs index f8e41fe..97de70c 100644 --- a/MailChimpSubscriber.cs +++ b/MailChimpSubscriber.cs @@ -12,6 +12,7 @@ using System.Net.Mail; using JetBrains.Annotations; using UnityEngine.Networking; +using TMPro; namespace Fiftytwo @@ -19,6 +20,7 @@ namespace Fiftytwo [PublicAPI] public class MailChimpSubscriber : MonoBehaviour { + private const string ZeroWidthSpace = "\u200B"; // was often found at end of our emails private const string UrlFormat = "https://{0}.api.mailchimp.com/3.0/lists/{1}/members"; private const string JsonFormat = "{{\"email_address\":\"{0}\", \"status\":\"subscribed\"}}"; @@ -27,10 +29,16 @@ public class MailChimpSubscriber : MonoBehaviour [SerializeField] private string _apiKey = string.Empty; [SerializeField] private string _listId = string.Empty; - + [SerializeField] private TMP_Text tmpText; public void Subscribe () { + if (tmpText != null) + { + Subscribe(tmpText.text.Replace(ZeroWidthSpace, "")); // TMP input seems to hang onto these + return; + } + var text = GetComponent(); if( text == null )