Skip to content

Commit bc36812

Browse files
committed
feat: update request function return type from SignResponse to generic JsonObject
Signed-off-by: Gaurav Goel <[email protected]>
1 parent af4c2d2 commit bc36812

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

core/src/main/java/com/web3auth/core/Web3Auth.kt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import com.web3auth.core.types.REDIRECT_URL
2323
import com.web3auth.core.types.RequestData
2424
import com.web3auth.core.types.SessionResponse
2525
import com.web3auth.core.types.SignMessage
26-
import com.web3auth.core.types.SignResponse
2726
import com.web3auth.core.types.UnKnownException
2827
import com.web3auth.core.types.UserCancelledException
2928
import com.web3auth.core.types.UserInfo
@@ -46,7 +45,7 @@ class Web3Auth(web3AuthOptions: Web3AuthOptions, context: Context) : WebViewResu
4645

4746
private lateinit var loginCompletableFuture: CompletableFuture<Web3AuthResponse>
4847
private lateinit var enableMfaCompletableFuture: CompletableFuture<Boolean>
49-
private lateinit var signMsgCF: CompletableFuture<SignResponse>
48+
private lateinit var signMsgCF: CompletableFuture<JsonObject>
5049

5150
private var web3AuthResponse: Web3AuthResponse? = null
5251
private var web3AuthOption = web3AuthOptions
@@ -518,7 +517,7 @@ class Web3Auth(web3AuthOptions: Web3AuthOptions, context: Context) : WebViewResu
518517
path: String? = "wallet/request",
519518
appState: String? = null,
520519
context: Context,
521-
): CompletableFuture<SignResponse> {
520+
): CompletableFuture<JsonObject> {
522521
signMsgCF = CompletableFuture()
523522
WebViewActivity.webViewResultCallback = this
524523

@@ -677,7 +676,7 @@ class Web3Auth(web3AuthOptions: Web3AuthOptions, context: Context) : WebViewResu
677676
}
678677
}
679678

680-
override fun onSignResponseReceived(signResponse: SignResponse?) {
679+
override fun onSignResponseReceived(signResponse: JsonObject?) {
681680
if (signResponse != null) {
682681
signMsgCF.complete(signResponse)
683682
}

core/src/main/java/com/web3auth/core/WebViewActivity.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ import android.webkit.WebViewClient
1515
import androidx.appcompat.app.AppCompatActivity
1616
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
1717
import com.google.gson.GsonBuilder
18+
import com.google.gson.JsonObject
1819
import com.web3auth.core.types.REDIRECT_URL
19-
import com.web3auth.core.types.SignResponse
2020
import com.web3auth.core.types.WEBVIEW_URL
2121
import com.web3auth.core.types.WebViewResultCallback
2222

@@ -54,7 +54,7 @@ class WebViewActivity : AppCompatActivity() {
5454
val b64ParamString =
5555
decodeBase64URLString(b64Params!!).toString(Charsets.UTF_8)
5656
val signResponse =
57-
gson.fromJson(b64ParamString, SignResponse::class.java)
57+
gson.fromJson(b64ParamString, JsonObject::class.java)
5858
webViewResultCallback?.onSignResponseReceived(signResponse)
5959
finish()
6060
}
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package com.web3auth.core.types
22

3+
import com.google.gson.JsonObject
4+
35
interface WebViewResultCallback {
4-
fun onSignResponseReceived(signResponse: SignResponse?)
6+
fun onSignResponseReceived(signResponse: JsonObject?)
57
fun onWebViewCancelled()
68
}

0 commit comments

Comments
 (0)