@@ -22,7 +22,7 @@ class ApphudSdkModule(reactContext: ReactApplicationContext) : ReactContextBaseJ
2222
2323 init {
2424 HeadersInterceptor .X_SDK = " reactnative"
25- HeadersInterceptor .X_SDK_VERSION = " 2.0 .0"
25+ HeadersInterceptor .X_SDK_VERSION = " 2.1 .0"
2626 listener = ApphudListenerHandler (reactContext)
2727 listener?.let { Apphud .setListener(it) }
2828 }
@@ -73,6 +73,22 @@ class ApphudSdkModule(reactContext: ReactApplicationContext) : ReactContextBaseJ
7373 }
7474 }
7575
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+
7692 @ReactMethod
7793 fun purchase (args : ReadableMap , promise : Promise ) {
7894 val productId = args.getString(" productId" )
@@ -96,7 +112,7 @@ class ApphudSdkModule(reactContext: ReactApplicationContext) : ReactContextBaseJ
96112
97113 val isSub = product?.productDetails?.productType?.lowercase() == " subs"
98114 val offerToken = args.getString(" offerToken" )
99- val isConsumable = args.getBoolean(" isConsumable" )
115+ val isConsumable = if ( args.hasKey( " isConsumable " )) args. getBoolean(" isConsumable" ) else false
100116
101117 if (product == null ) {
102118 promise.reject(" Error" , " Product not found" )
@@ -270,6 +286,7 @@ class ApphudSdkModule(reactContext: ReactApplicationContext) : ReactContextBaseJ
270286 Apphud .collectDeviceIdentifiers()
271287 }
272288
289+
273290 @ReactMethod
274291 fun enableDebugLogs () {
275292 Apphud .enableDebugLogs()
0 commit comments