Skip to content

Commit 28ce01b

Browse files
committed
Add tryResumeSession option to Reown wallet flow
Introduces a tryResumeSession boolean to ReownOptions and propagates it through the wallet initialization flow. This allows control over whether to attempt resuming an existing session when initializing the Reown wallet.
1 parent 03e5b67 commit 28ce01b

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

Assets/Thirdweb/Runtime/Unity/ThirdwebManagerBase.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,9 @@ public class ReownOptions
181181
[JsonProperty("singleWalletId")]
182182
public string SingleWalletId;
183183

184+
[JsonProperty("tryResumeSession")]
185+
public bool TryResumeSession;
186+
184187
public ReownOptions(
185188
string projectId = null,
186189
string name = null,
@@ -190,7 +193,8 @@ public ReownOptions(
190193
string[] includedWalletIds = null,
191194
string[] excludedWalletIds = null,
192195
string[] featuredWalletIds = null,
193-
string singleWalletId = null
196+
string singleWalletId = null,
197+
bool tryResumeSession = true
194198
)
195199
{
196200
if (singleWalletId != null && (includedWalletIds != null || excludedWalletIds != null || featuredWalletIds != null))
@@ -206,6 +210,7 @@ public ReownOptions(
206210
this.ExcludedWalletIds = excludedWalletIds;
207211
this.FeaturedWalletIds = featuredWalletIds;
208212
this.SingleWalletId = singleWalletId;
213+
this.TryResumeSession = tryResumeSession;
209214
}
210215
}
211216

@@ -445,7 +450,8 @@ public virtual async Task<IThirdwebWallet> ConnectWallet(WalletOptions walletOpt
445450
includedWalletIds: walletOptions.ReownOptions.IncludedWalletIds,
446451
excludedWalletIds: walletOptions.ReownOptions.ExcludedWalletIds,
447452
featuredWalletIds: walletOptions.ReownOptions.FeaturedWalletIds,
448-
singleWalletId: walletOptions.ReownOptions.SingleWalletId
453+
singleWalletId: walletOptions.ReownOptions.SingleWalletId,
454+
tryResumeSession: walletOptions.ReownOptions.TryResumeSession
449455
);
450456
break;
451457
#else

Assets/Thirdweb/Runtime/Unity/Wallets/Reown/ReownWallet.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ public static async Task<ReownWallet> Create(
3434
string[] includedWalletIds,
3535
string[] excludedWalletIds,
3636
string[] featuredWalletIds,
37-
string singleWalletId
37+
string singleWalletId,
38+
bool tryResumeSession
3839
)
3940
{
4041
_client = client;
@@ -75,7 +76,7 @@ string singleWalletId
7576
ThirdwebDebug.Log("Reown AppKit initialized.");
7677

7778
var connectionTimeout = TimeSpan.FromSeconds(120);
78-
var connected = await TryResumeExistingSessionAsync();
79+
var connected = tryResumeSession && await TryResumeExistingSessionAsync();
7980

8081
if (connected)
8182
{

0 commit comments

Comments
 (0)