From 9735f1c8f0c6cf5e50525388748065f026b330ed Mon Sep 17 00:00:00 2001 From: Gaurav Goel Date: Mon, 25 Nov 2024 15:59:22 +0530 Subject: [PATCH] Use contextWrapper to use context everywhere. Signed-off-by: Gaurav Goel --- .../java/com/web3auth/app/MainActivity.kt | 18 ++--- .../main/java/com/web3auth/core/Web3Auth.kt | 65 +++++++++---------- 2 files changed, 41 insertions(+), 42 deletions(-) diff --git a/app/src/main/java/com/web3auth/app/MainActivity.kt b/app/src/main/java/com/web3auth/app/MainActivity.kt index 1e1d1ce..b6f1b85 100644 --- a/app/src/main/java/com/web3auth/app/MainActivity.kt +++ b/app/src/main/java/com/web3auth/app/MainActivity.kt @@ -91,7 +91,7 @@ class MainActivity : AppCompatActivity(), AdapterView.OnItemClickListener { selectedLoginProvider, extraLoginOptions = extraLoginOptions, mfaLevel = MFALevel.OPTIONAL - ), this + ) ) loginCompletableFuture.whenComplete { _, error -> if (error == null) { @@ -106,7 +106,7 @@ class MainActivity : AppCompatActivity(), AdapterView.OnItemClickListener { } private fun signOut() { - val logoutCompletableFuture = web3Auth.logout(this) + val logoutCompletableFuture = web3Auth.logout() logoutCompletableFuture.whenComplete { _, error -> if (error == null) { reRender() @@ -195,10 +195,10 @@ class MainActivity : AppCompatActivity(), AdapterView.OnItemClickListener { options, this ) - web3Auth.setResultUrl(intent.data, this) + web3Auth.setResultUrl(intent.data) // for session response - val sessionResponse: CompletableFuture = web3Auth.initialize(this) + val sessionResponse: CompletableFuture = web3Auth.initialize() sessionResponse.whenComplete { _, error -> if (error == null) { reRender() @@ -224,7 +224,7 @@ class MainActivity : AppCompatActivity(), AdapterView.OnItemClickListener { chainId = "0x89", rpcTarget = "https://1rpc.io/matic", chainNamespace = ChainNamespace.EIP155 - ), context = this + ) ) launchWalletCompletableFuture.whenComplete { _, error -> if (error == null) { @@ -248,7 +248,7 @@ class MainActivity : AppCompatActivity(), AdapterView.OnItemClickListener { chainId = "0x89", rpcTarget = "https://polygon-rpc.com/", chainNamespace = ChainNamespace.EIP155 - ), "personal_sign", requestParams = params, appState = "web3Auth", context = this + ), "personal_sign", requestParams = params, appState = "web3Auth" ) signMsgCompletableFuture.whenComplete { signResult, error -> if (error == null) { @@ -261,7 +261,7 @@ class MainActivity : AppCompatActivity(), AdapterView.OnItemClickListener { val btnSetUpMfa = findViewById