Skip to content

Commit f743388

Browse files
authored
[WebGL] Support google login with EWS (#119)
1 parent 958fea4 commit f743388

File tree

11 files changed

+1711
-332400
lines changed

11 files changed

+1711
-332400
lines changed

Assets/Thirdweb/Core/Plugin/thirdweb.jslib

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ var plugin = {
5858
password,
5959
email,
6060
personalWallet,
61+
useGoogle,
6162
cb
6263
) {
6364
// convert taskId from pointer to str and allocate it to keep in memory
@@ -72,7 +73,8 @@ var plugin = {
7273
UTF8ToString(chainId),
7374
UTF8ToString(password),
7475
UTF8ToString(email),
75-
UTF8ToString(personalWallet)
76+
UTF8ToString(personalWallet),
77+
UTF8ToString(useGoogle)
7678
)
7779
.then((address) => {
7880
if (address) {

Assets/Thirdweb/Core/Scripts/Bridge.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ public static async Task<string> Connect(WalletConnection walletConnection)
9898
string.IsNullOrEmpty(walletConnection.password) ? Utils.GetDeviceIdentifier() : walletConnection.password,
9999
walletConnection.email,
100100
walletConnection.personalWallet.ToString()[..1].ToLower() + walletConnection.personalWallet.ToString()[1..],
101+
walletConnection.useGoogle.ToString(),
101102
jsCallback
102103
);
103104
#endif
@@ -215,7 +216,7 @@ public static async Task<string> ExportWallet(string password)
215216
[DllImport("__Internal")]
216217
private static extern string ThirdwebInitialize(string chainOrRPC, string options);
217218
[DllImport("__Internal")]
218-
private static extern string ThirdwebConnect(string taskId, string wallet, string chainId, string password, string email, string personalWallet, Action<string, string, string> cb);
219+
private static extern string ThirdwebConnect(string taskId, string wallet, string chainId, string password, string email, string personalWallet, string useGoogle, Action<string, string, string> cb);
219220
[DllImport("__Internal")]
220221
private static extern string ThirdwebDisconnect(string taskId, Action<string, string, string> cb);
221222
[DllImport("__Internal")]

Assets/Thirdweb/Core/Scripts/Wallet.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,8 @@ public class WalletConnection
527527

528528
public WalletProvider personalWallet;
529529

530+
public bool useGoogle;
531+
530532
/// <summary>
531533
/// Initializes a new instance of the <see cref="WalletConnection"/> class with the specified parameters.
532534
/// </summary>
@@ -535,13 +537,21 @@ public class WalletConnection
535537
/// <param name="password">The wallet password if using local wallets.</param>
536538
/// <param name="email">The email to login with if using email based providers.</param>
537539
/// <param name="personalWallet">The personal wallet provider if using smart wallets.</param>
538-
public WalletConnection(WalletProvider provider, BigInteger chainId, string password = null, string email = null, WalletProvider personalWallet = WalletProvider.LocalWallet)
540+
public WalletConnection(
541+
WalletProvider provider,
542+
BigInteger chainId,
543+
string password = null,
544+
string email = null,
545+
WalletProvider personalWallet = WalletProvider.LocalWallet,
546+
bool useGoogle = false
547+
)
539548
{
540549
this.provider = provider;
541550
this.chainId = chainId;
542551
this.password = password;
543552
this.email = email;
544553
this.personalWallet = personalWallet;
554+
this.useGoogle = useGoogle;
545555
}
546556
}
547557

0 commit comments

Comments
 (0)