Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: log done request for all responses #124

Merged
merged 2 commits into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions metamask-android-sdk/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ android {
targetSdk 33

ext.versionCode = 1
ext.versionName = "0.5.6"
ext.versionName = "0.5.7"

testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
consumerProguardFiles 'consumer-rules.pro'
Expand Down Expand Up @@ -62,7 +62,7 @@ dependencies {

ext {
PUBLISH_GROUP_ID = 'io.metamask.androidsdk'
PUBLISH_VERSION = '0.5.6'
PUBLISH_VERSION = '0.5.7'
PUBLISH_ARTIFACT_ID = 'metamask-android-sdk'
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,13 +208,20 @@ internal class CommunicationClient(context: Context, callback: EthereumEventCall
}

private fun handleResponse(id: String, data: JSONObject) {
val submittedRequest = submittedRequests[id]?.request ?: return

val error = data.optString("error")

val params = mapOf(
"method" to submittedRequest.method,
"from" to "mobile"
)
trackEvent(Event.SDK_RPC_REQUEST_DONE, params)

if (handleError(error, id)) {
return
}

val submittedRequest = submittedRequests[id]?.request ?: return
val isResultMethod = EthereumMethod.isResultMethod(submittedRequest.method)

if (!isResultMethod) {
Expand All @@ -240,12 +247,6 @@ internal class CommunicationClient(context: Context, callback: EthereumEventCall
return
}

val params = mapOf(
"method" to submittedRequest.method,
"from" to "mobile"
)
trackEvent(Event.SDK_RPC_REQUEST_DONE, params)

when(submittedRequest.method) {
EthereumMethod.GET_METAMASK_PROVIDER_STATE.value -> {
val result = data.optString("result")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.metamask.androidsdk

object SDKInfo {
const val VERSION = "0.5.6"
const val VERSION = "0.5.7"
const val PLATFORM = "android"
}