Skip to content

Commit 0ff1adc

Browse files
committed
fix(android): correctly migrate the error codes
Resolve #3026
1 parent f3d1548 commit 0ff1adc

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

android/src/main/java/com/margelo/nitro/iap/HybridRnIap.kt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ class HybridRnIap : HybridRnIapSpec() {
126126
openIap.initConnection()
127127
}
128128
} catch (err: Throwable) {
129-
val error = OpenIAPError.InitConnection()
129+
val error = OpenIAPError.InitConnection
130130
RnIapLog.failure("initConnection.native", err)
131131
throw Exception(
132132
toErrorJson(
@@ -137,7 +137,7 @@ class HybridRnIap : HybridRnIapSpec() {
137137
)
138138
}
139139
if (!ok) {
140-
val error = OpenIAPError.InitConnection()
140+
val error = OpenIAPError.InitConnection
141141
RnIapLog.failure("initConnection.native", Exception(error.message))
142142
throw Exception(
143143
toErrorJson(
@@ -279,7 +279,7 @@ class HybridRnIap : HybridRnIapSpec() {
279279
}
280280
fetched.firstOrNull()?.let { productTypeBySku[it.id] = it.type.rawValue }
281281
if (!productTypeBySku.containsKey(sku)) {
282-
sendPurchaseError(toErrorResult(OpenIAPError.SkuNotFound(sku), sku))
282+
sendPurchaseError(toErrorResult(OpenIAPError.SkuNotFound(sku)))
283283
return@async defaultResult
284284
}
285285
}
@@ -363,7 +363,7 @@ class HybridRnIap : HybridRnIapSpec() {
363363
RnIapLog.failure("requestPurchase", e)
364364
sendPurchaseError(
365365
toErrorResult(
366-
error = OpenIAPError.PurchaseFailed(),
366+
error = OpenIAPError.PurchaseFailed,
367367
debugMessage = e.message,
368368
messageOverride = e.message
369369
)
@@ -446,7 +446,7 @@ class HybridRnIap : HybridRnIapSpec() {
446446
try {
447447
initConnection().await()
448448
} catch (e: Exception) {
449-
val err = OpenIAPError.InitConnection()
449+
val err = OpenIAPError.InitConnection
450450
return@async Variant_Boolean_NitroPurchaseResult.Second(
451451
NitroPurchaseResult(
452452
responseCode = -1.0,
@@ -476,7 +476,7 @@ class HybridRnIap : HybridRnIapSpec() {
476476
RnIapLog.result("finishTransaction", mapOf("success" to true))
477477
result
478478
} catch (e: Exception) {
479-
val err = OpenIAPError.BillingError()
479+
val err = OpenIAPError.BillingError
480480
RnIapLog.failure("finishTransaction", e)
481481
Variant_Boolean_NitroPurchaseResult.Second(
482482
NitroPurchaseResult(
@@ -909,7 +909,7 @@ class HybridRnIap : HybridRnIapSpec() {
909909

910910
} catch (e: Exception) {
911911
val debugMessage = e.message
912-
val error = OpenIAPError.InvalidReceipt()
912+
val error = OpenIAPError.InvalidReceipt
913913
throw Exception(
914914
toErrorJson(
915915
error = error,

0 commit comments

Comments
 (0)