@@ -22,7 +22,7 @@ class ApphudSdkModule(reactContext: ReactApplicationContext) : ReactContextBaseJ
22
22
23
23
init {
24
24
HeadersInterceptor .X_SDK = " reactnative"
25
- HeadersInterceptor .X_SDK_VERSION = " 2.0 .0"
25
+ HeadersInterceptor .X_SDK_VERSION = " 2.1 .0"
26
26
listener = ApphudListenerHandler (reactContext)
27
27
listener?.let { Apphud .setListener(it) }
28
28
}
@@ -73,6 +73,22 @@ class ApphudSdkModule(reactContext: ReactApplicationContext) : ReactContextBaseJ
73
73
}
74
74
}
75
75
76
+ @ReactMethod
77
+ fun paywallShown (identifier : String ) {
78
+ val paywall = Apphud .paywalls().firstOrNull { it.identifier == identifier }
79
+ paywall?.let {
80
+ Apphud .paywallShown(it)
81
+ }
82
+ }
83
+
84
+ @ReactMethod
85
+ fun paywallClosed (identifier : String ) {
86
+ val paywall = Apphud .paywalls().firstOrNull { it.identifier == identifier }
87
+ paywall?.let {
88
+ Apphud .paywallClosed(it)
89
+ }
90
+ }
91
+
76
92
@ReactMethod
77
93
fun purchase (args : ReadableMap , promise : Promise ) {
78
94
val productId = args.getString(" productId" )
@@ -96,7 +112,7 @@ class ApphudSdkModule(reactContext: ReactApplicationContext) : ReactContextBaseJ
96
112
97
113
val isSub = product?.productDetails?.productType?.lowercase() == " subs"
98
114
val offerToken = args.getString(" offerToken" )
99
- val isConsumable = args.getBoolean(" isConsumable" )
115
+ val isConsumable = if ( args.hasKey( " isConsumable " )) args. getBoolean(" isConsumable" ) else false
100
116
101
117
if (product == null ) {
102
118
promise.reject(" Error" , " Product not found" )
@@ -270,6 +286,7 @@ class ApphudSdkModule(reactContext: ReactApplicationContext) : ReactContextBaseJ
270
286
Apphud .collectDeviceIdentifiers()
271
287
}
272
288
289
+
273
290
@ReactMethod
274
291
fun enableDebugLogs () {
275
292
Apphud .enableDebugLogs()
0 commit comments