using System; using System.Threading.Tasks; using UnityEngine; using UnityEngine.UI; using TapTap.Login.Internal.Http; using TapTap.Common; using TapTap.Common.Internal.Utils; using UnityEngine.EventSystems; namespace TapTap.Login.Internal { public class QRCodeController { private readonly static string DEMO_IMAGE_CN_HOST = "https://sdk-assets.tds1.tapfiles.cn"; private readonly static string DEMO_IMAGE_URL_IOS_ZH = $"{DEMO_IMAGE_CN_HOST}/scan-guide/ios.png"; private readonly static string DEMO_IMAGE_URL_ANDROID_ZH = $"{DEMO_IMAGE_CN_HOST}/scan-guide/android.png"; private readonly static string DEMO_IMAGE_IO_HOST = "https://sdk-assets.ap-sg.tdsfiles.com"; private readonly static string DEMO_IMAGE_URL_IOS_EN = $"{DEMO_IMAGE_IO_HOST}/scan-guide/ios.png"; private readonly static string DEMO_IMAGE_URL_ANDROID_EN = $"{DEMO_IMAGE_IO_HOST}/scan-guide/android.png"; private readonly static string DEFAULT_IOS_CLIENT = "Sprites/taptap-login-ios-client"; private readonly static string DEFAULT_ANDROID_CLIENT = "Sprites/taptap-login-android-client"; private readonly static string AUTH_PENDING = "authorization_pending"; private readonly static string AUTH_WAITING = "authorization_waiting"; private readonly static string AUTH_DENIED = "access_denied"; private readonly static string AUTH_SUCCESS = ""; private readonly Action onAuth; private readonly Text titleText; private readonly RawImage qrcodeImage; private readonly Text tipsText; private readonly GameObject scanTips; private readonly RawImage demoImage; private readonly Button refreshButton; private bool isRunning; private QRCodeData qrcodeData; private string clientId; private string[] permissions; public QRCodeController(Transform transform, Action onAuth) { this.onAuth = onAuth; titleText = transform.Find("Title").GetComponent(); qrcodeImage = transform.Find("QRCode/Image").GetComponent(); tipsText = transform.Find("Tips").GetComponent(); ClientButtonListener iOSButtonListener = transform.Find("Clients/iOSButton").GetComponent(); iOSButtonListener.GetComponent