diff --git a/Assets/Treasure/TDK/Runtime/Connect/UI/TDKConnectUIManager.cs b/Assets/Treasure/TDK/Runtime/Connect/UI/TDKConnectUIManager.cs index 46e1570a..4de76381 100644 --- a/Assets/Treasure/TDK/Runtime/Connect/UI/TDKConnectUIManager.cs +++ b/Assets/Treasure/TDK/Runtime/Connect/UI/TDKConnectUIManager.cs @@ -23,7 +23,7 @@ public class TDKConnectUIManager : MonoBehaviour [Header("Test buttons")] [SerializeField] private Button switchThemeButton; [SerializeField] private Button switchSceneButton; - [SerializeField] private ScreenOrientation currentOriantation; + [SerializeField] private ScreenOrientation currentOriantation; private ModalBase currentModalOpended; @@ -31,13 +31,14 @@ public class TDKConnectUIManager : MonoBehaviour private string _address; private string _email; + private bool _isSilentLogin = false; private bool useSmartWallets = true; private ChainData _currentChainData; private void Awake() { if (Instance == null) - Instance = this; + Instance = this; } private void Start() @@ -63,6 +64,11 @@ private void Start() }); } + public bool IsSilentLogin + { + get { return _isSilentLogin; } + } + #region test code IEnumerator SwitchScene() { @@ -134,9 +140,9 @@ public void ShowAccountModal() currentModalOpended.Hide(); currentModalOpended = logedInHolder; - logedInHolder.Show(); + logedInHolder.Show(); - TDK.Analytics.TrackCustomEvent(AnalyticsConstants.EVT_TREASURECONNECT_UI_ACCOUNT); + TDK.Analytics.TrackCustomEvent(AnalyticsConstants.EVT_TREASURECONNECT_UI_ACCOUNT); } public void LogOut() @@ -157,9 +163,10 @@ private void Activate() #endregion #region Connecting - public async Task ConnectEmail(string email) + public async Task ConnectEmail(string email, bool isSilentLogin = false) { _email = email; + _isSilentLogin = isSilentLogin; var wc = useSmartWallets ? new WalletConnection( provider: WalletProvider.SmartWallet, diff --git a/Assets/Treasure/TDK/Runtime/Connect/UI/TDKEmbeddedWalletUI.cs b/Assets/Treasure/TDK/Runtime/Connect/UI/TDKEmbeddedWalletUI.cs index 79db33aa..2e9f043f 100644 --- a/Assets/Treasure/TDK/Runtime/Connect/UI/TDKEmbeddedWalletUI.cs +++ b/Assets/Treasure/TDK/Runtime/Connect/UI/TDKEmbeddedWalletUI.cs @@ -10,6 +10,8 @@ namespace Treasure { + public class TDKSilentLoginException : Exception { } + public class TDKEmbeddedWalletUI : InAppWalletUI { [Space] @@ -79,6 +81,12 @@ public override async Task LoginWithOTP() } catch (Exception e) { + if (TDKConnectUIManager.Instance.IsSilentLogin) + { + ThirdwebDebug.Log($"Could not recreate user automatically, skipping silent login"); + throw new TDKSilentLoginException(); + } + ThirdwebDebug.Log($"Could not recreate user automatically, proceeding with auth: {e.Message}"); }