Skip to content

Commit

Permalink
Merge pull request #58 from TreasureProject/develop
Browse files Browse the repository at this point in the history
v0.3.2
  • Loading branch information
alecananian authored May 15, 2024
2 parents f18920c + ab78d22 commit 9fdcb74
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
17 changes: 12 additions & 5 deletions Assets/Treasure/TDK/Runtime/Connect/UI/TDKConnectUIManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,22 @@ 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;

private bool _isActive = false;

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()
Expand All @@ -63,6 +64,11 @@ private void Start()
});
}

public bool IsSilentLogin
{
get { return _isSilentLogin; }
}

#region test code
IEnumerator SwitchScene()
{
Expand Down Expand Up @@ -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()
Expand All @@ -157,9 +163,10 @@ private void Activate()
#endregion

#region Connecting
public async Task<bool> ConnectEmail(string email)
public async Task<bool> ConnectEmail(string email, bool isSilentLogin = false)
{
_email = email;
_isSilentLogin = isSilentLogin;
var wc = useSmartWallets
? new WalletConnection(
provider: WalletProvider.SmartWallet,
Expand Down
8 changes: 8 additions & 0 deletions Assets/Treasure/TDK/Runtime/Connect/UI/TDKEmbeddedWalletUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

namespace Treasure
{
public class TDKSilentLoginException : Exception { }

public class TDKEmbeddedWalletUI : InAppWalletUI
{
[Space]
Expand Down Expand Up @@ -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}");
}

Expand Down
2 changes: 1 addition & 1 deletion Assets/Treasure/TDK/Runtime/TDKVersion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
public static class TDKVersion
{
public static string name = "tdk-unity";
public static string version = "0.3.1";
public static string version = "0.3.2";
}
}

0 comments on commit 9fdcb74

Please sign in to comment.