Skip to content

Commit

Permalink
update inApp on response to first entry
Browse files Browse the repository at this point in the history
  • Loading branch information
al-af committed Nov 7, 2024
1 parent 13f79f8 commit 2a5bdfe
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,15 @@ class ConnectorWrapper(
override fun onFailure(result: String, error: Throwable?) {
subsListener.onFailure(result, error)
}
}).setInAppValidationResultListener(object : PurchaseClient.InAppPurchaseValidationResultListener{
}).setInAppValidationResultListener(object : PurchaseClient.InAppPurchaseValidationResultListener {
override fun onResponse(result: Map<String, InAppPurchaseValidationResult>?) {
inAppListener.onResponse(result?.entries?.associate { (k, v) -> k to v.toJsonMap() })
val firstEntry = result?.values?.firstOrNull()?.toJsonMap()
if (firstEntry != null) {
inAppListener.onResponse(firstEntry)
} else {
inAppListener.onResponse(emptyMap())
}
}

override fun onFailure(result: String, error: Throwable?) {
inAppListener.onFailure(result, error)
}
Expand Down

0 comments on commit 2a5bdfe

Please sign in to comment.