tapjoy-react-native-sdk 14.4.0 → 14.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/android/build.gradle +8 -15
  2. package/android/gradle.properties +3 -3
  3. package/android/src/main/java/com/tapjoyreactnativesdk/TJOfferwallDiscoverNativeView.kt +2 -2
  4. package/android/src/main/java/com/tapjoyreactnativesdk/TJOfferwallDiscoverNativeViewManager.kt +21 -16
  5. package/android/src/main/java/com/tapjoyreactnativesdk/TapjoyReactNativeSdkModule.kt +130 -87
  6. package/android/src/main/java/com/tapjoyreactnativesdk/TapjoyReactNativeSdkPackage.kt +29 -5
  7. package/example/android/app/build.gradle +1 -1
  8. package/example/android/app/src/main/java/com/tapjoyreactnativesdkexample/MainApplication.kt +2 -8
  9. package/example/android/build.gradle +4 -4
  10. package/example/android/gradle/wrapper/gradle-wrapper.properties +1 -1
  11. package/example/android/gradle.properties +5 -0
  12. package/example/ios/Podfile +2 -1
  13. package/example/ios/TapjoyReactNativeSdkExample/Info.plist +3 -1
  14. package/example/ios/TapjoyReactNativeSdkExample.xcodeproj/project.pbxproj +0 -45
  15. package/example/metro.config.js +9 -15
  16. package/example/package.json +19 -16
  17. package/example/scripts/set-arch.sh +25 -0
  18. package/example/src/App.tsx +1 -2
  19. package/example/src/MainScreen.tsx +76 -60
  20. package/example/src/OfferwallDiscoverScreen.tsx +105 -91
  21. package/example/src/OfferwallScreen.tsx +170 -156
  22. package/example/src/Styles.ts +3 -2
  23. package/example/src/UserProperties.tsx +170 -136
  24. package/ios/TJOfferwallDiscoverNativeViewManager.m +11 -1
  25. package/ios/TJOfferwallDiscoverNativeViewManager.swift +2 -2
  26. package/ios/TapjoyReactNativeSdk.m +36 -15
  27. package/ios/TapjoyReactNativeSdk.swift +24 -4
  28. package/lib/commonjs/NativeTapjoyReactNativeSdk.js +2 -0
  29. package/lib/commonjs/TJOfferwallDiscoverView.js +43 -16
  30. package/lib/commonjs/TJOfferwallDiscoverViewNativeComponent.js +6 -0
  31. package/lib/commonjs/TJPlacement.js +17 -13
  32. package/lib/commonjs/TJPrivacyPolicy.js +81 -11
  33. package/lib/commonjs/TJVersion.js +1 -1
  34. package/lib/commonjs/Tapjoy.js +16 -10
  35. package/lib/commonjs/index.js +2 -1
  36. package/lib/commonjs/utils/ArchitectureDetection.js +7 -0
  37. package/lib/typescript/NativeTapjoyReactNativeSdk.d.ts +53 -0
  38. package/lib/typescript/TJOfferwallDiscoverView.d.ts +3 -12
  39. package/lib/typescript/TJOfferwallDiscoverViewNativeComponent.d.ts +21 -0
  40. package/lib/typescript/TJPrivacyPolicy.d.ts +29 -1
  41. package/lib/typescript/Tapjoy.d.ts +1 -1
  42. package/lib/typescript/index.d.ts +5 -3
  43. package/lib/typescript/utils/ArchitectureDetection.d.ts +5 -0
  44. package/package.json +14 -16
  45. package/src/NativeTapjoyReactNativeSdk.ts +117 -0
  46. package/src/TJOfferwallDiscoverView.tsx +56 -39
  47. package/src/TJOfferwallDiscoverViewNativeComponent.ts +37 -0
  48. package/src/TJPlacement.ts +17 -13
  49. package/src/TJPrivacyPolicy.ts +84 -12
  50. package/src/TJVersion.ts +1 -1
  51. package/src/Tapjoy.ts +20 -13
  52. package/src/index.ts +13 -3
  53. package/src/utils/ArchitectureDetection.ts +14 -0
  54. package/tapjoy-react-native-sdk.podspec +1 -1
@@ -7,16 +7,16 @@ import com.tapjoy.TJSpendCurrencyListener
7
7
  import com.tapjoy.TJAwardCurrencyListener
8
8
  import com.tapjoy.TJSetUserIDListener
9
9
  import com.tapjoy.Tapjoy
10
- import com.tapjoy.TJError;
11
- import com.tapjoy.TJPlacement;
12
- import com.tapjoy.TJActionRequest;
13
- import com.tapjoy.TJPlacementListener;
14
- import com.tapjoy.TJSetCurrencyBalanceListener;
15
- import com.tapjoy.TJSetCurrencyAmountRequiredListener;
16
- import com.tapjoy.TJStatus;
17
- import com.tapjoy.TJPrivacyPolicy;
18
- import com.tapjoy.TJSegment;
19
- import com.tapjoy.TapjoyPluginAPI;
10
+ import com.tapjoy.TJError
11
+ import com.tapjoy.TJPlacement
12
+ import com.tapjoy.TJActionRequest
13
+ import com.tapjoy.TJPlacementListener
14
+ import com.tapjoy.TJSetCurrencyBalanceListener
15
+ import com.tapjoy.TJSetCurrencyAmountRequiredListener
16
+ import com.tapjoy.TJStatus
17
+ import com.tapjoy.TJPrivacyPolicy
18
+ import com.tapjoy.TJSegment
19
+ import com.tapjoy.TapjoyPluginAPI
20
20
  import com.tapjoy.TJEntryPoint
21
21
  import com.tapjoy.TJLogLevel
22
22
  import java.util.Hashtable
@@ -25,7 +25,7 @@ import com.facebook.react.modules.core.DeviceEventManagerModule
25
25
  import java.lang.Exception
26
26
 
27
27
  class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
28
- ReactContextBaseJavaModule(reactContext) {
28
+ NativeTapjoyReactNativeSdkSpec(reactContext) {
29
29
 
30
30
  val messageConnectionFailed = "connection failed"
31
31
  var placements = HashMap<String, TJPlacement>()
@@ -38,8 +38,8 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
38
38
  return NAME
39
39
  }
40
40
 
41
- override fun getConstants(): Map<String, kotlin.Any> {
42
- return HashMap();
41
+ override fun getConstants(): MutableMap<String, Any> {
42
+ return HashMap()
43
43
  }
44
44
 
45
45
  private var listenerCount = 0
@@ -53,13 +53,13 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
53
53
  }
54
54
 
55
55
  @ReactMethod
56
- fun addListener(eventName: String) {
56
+ override fun addListener(eventName: String) {
57
57
  listenerCount += 1
58
58
  }
59
59
 
60
60
  @ReactMethod
61
- fun removeListeners(count: Int) {
62
- listenerCount -= count
61
+ override fun removeListeners(count: Double) {
62
+ listenerCount -= count.toInt()
63
63
  }
64
64
 
65
65
  /**
@@ -70,10 +70,10 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
70
70
  * @return true to javascript if it is succeeded otherwise throws error
71
71
  */
72
72
  @ReactMethod
73
- fun connect(sdkKey: String, connectFlags: ReadableMap, promise: Promise) {
73
+ override fun connect(sdkKey: String, connectFlags: ReadableMap, promise: Promise) {
74
74
  TapjoyPluginAPI.setPlugin("ReactNative");
75
75
 
76
- Tapjoy.connect(this.currentActivity?.applicationContext, sdkKey, connectFlags.toHashtable(), object : TJConnectListener() {
76
+ Tapjoy.connect(this.getCurrentActivity()?.applicationContext, sdkKey, connectFlags.toHashtable(), object : TJConnectListener() {
77
77
  override fun onConnectSuccess() {
78
78
  promise.resolve(true)
79
79
  }
@@ -94,7 +94,7 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
94
94
  }
95
95
 
96
96
  @ReactMethod
97
- fun getCurrencyBalance(promise: Promise) {
97
+ override fun getCurrencyBalance(promise: Promise) {
98
98
  Tapjoy.getCurrencyBalance(object : TJGetCurrencyBalanceListener {
99
99
 
100
100
  override fun onGetCurrencyBalanceResponse(currencyName: String, balance: Int) {
@@ -112,8 +112,8 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
112
112
  }
113
113
 
114
114
  @ReactMethod
115
- fun spendCurrency(amount: Int, promise: Promise) {
116
- Tapjoy.spendCurrency(amount, object : TJSpendCurrencyListener {
115
+ override fun spendCurrency(amount: Double, promise: Promise) {
116
+ Tapjoy.spendCurrency(amount.toInt(), object : TJSpendCurrencyListener {
117
117
 
118
118
  override fun onSpendCurrencyResponse(currencyName: String, balance: Int) {
119
119
  val currencyObj = Arguments.createMap().apply {
@@ -130,8 +130,8 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
130
130
  }
131
131
 
132
132
  @ReactMethod
133
- fun awardCurrency(amount: Int, promise: Promise) {
134
- Tapjoy.awardCurrency(amount, object : TJAwardCurrencyListener {
133
+ override fun awardCurrency(amount: Double, promise: Promise) {
134
+ Tapjoy.awardCurrency(amount.toInt(), object : TJAwardCurrencyListener {
135
135
 
136
136
  override fun onAwardCurrencyResponse(currencyName: String, balance: Int) {
137
137
  val currencyObj = Arguments.createMap().apply {
@@ -153,7 +153,7 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
153
153
  * @param userId: User ID
154
154
  */
155
155
  @ReactMethod
156
- fun setUserId(userId: String?, promise: Promise) {
156
+ override fun setUserId(userId: String?, promise: Promise) {
157
157
  Tapjoy.setUserID(userId, object: TJSetUserIDListener {
158
158
  override fun onSetUserIDSuccess() {
159
159
  promise.resolve(userId)
@@ -171,7 +171,7 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
171
171
  * @return User ID
172
172
  */
173
173
  @ReactMethod
174
- fun getUserId(promise: Promise) {
174
+ override fun getUserId(promise: Promise) {
175
175
  promise.resolve(Tapjoy.getUserID())
176
176
  }
177
177
 
@@ -182,11 +182,12 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
182
182
  *
183
183
  */
184
184
  @ReactMethod
185
- fun setUserSegment(userSegment: Int) {
186
- if (userSegment == -1){
185
+ override fun setUserSegment(userSegment: Double) {
186
+ val segmentIndex = userSegment.toInt()
187
+ if (segmentIndex == -1){
187
188
  Tapjoy.setUserSegment(TJSegment.UNKNOWN)
188
189
  } else {
189
- Tapjoy.setUserSegment(TJSegment.values()[userSegment])
190
+ Tapjoy.setUserSegment(TJSegment.values()[segmentIndex])
190
191
  }
191
192
  }
192
193
 
@@ -197,7 +198,7 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
197
198
  * The custom parameter to assign to this device
198
199
  */
199
200
  @ReactMethod
200
- fun setCustomParameter(customParameter: String) {
201
+ override fun setCustomParameter(customParameter: String) {
201
202
  Tapjoy.setCustomParameter(customParameter)
202
203
  }
203
204
 
@@ -206,7 +207,7 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
206
207
  * @return the value of the currently set custom parameter.
207
208
  */
208
209
  @ReactMethod
209
- fun getCustomParameter(promise: Promise) {
210
+ override fun getCustomParameter(promise: Promise) {
210
211
  promise.resolve(Tapjoy.getCustomParameter())
211
212
  }
212
213
  /**
@@ -216,7 +217,7 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
216
217
  *
217
218
  */
218
219
  @ReactMethod
219
- fun getUserSegment(promise: Promise) {
220
+ override fun getUserSegment(promise: Promise) {
220
221
  val segment = Tapjoy.getUserSegment()
221
222
  promise.resolve(segment?.getValue() ?: TJSegment.UNKNOWN.getValue())
222
223
  }
@@ -227,8 +228,8 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
227
228
  * @Param maxLevel: the maximum level
228
229
  */
229
230
  @ReactMethod
230
- fun setMaxLevel(maxLevel: Int) {
231
- Tapjoy.setMaxLevel(maxLevel);
231
+ override fun setMaxLevel(maxLevel: Double) {
232
+ Tapjoy.setMaxLevel(maxLevel.toInt());
232
233
  }
233
234
 
234
235
  /**
@@ -237,7 +238,7 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
237
238
  * @return the maximum level
238
239
  */
239
240
  @ReactMethod
240
- fun getMaxLevel(promise: Promise) {
241
+ override fun getMaxLevel(promise: Promise) {
241
242
  promise.resolve(Tapjoy.getMaxLevel())
242
243
  }
243
244
 
@@ -248,8 +249,8 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
248
249
  * the level of the user
249
250
  */
250
251
  @ReactMethod
251
- fun setUserLevel(userLevel: Int) {
252
- Tapjoy.setUserLevel(userLevel)
252
+ override fun setUserLevel(userLevel: Double) {
253
+ Tapjoy.setUserLevel(userLevel.toInt())
253
254
  }
254
255
 
255
256
  /**
@@ -258,7 +259,7 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
258
259
  * @return the level of the user.
259
260
  */
260
261
  @ReactMethod
261
- fun getUserLevel(promise: Promise) {
262
+ override fun getUserLevel(promise: Promise) {
262
263
  promise.resolve(Tapjoy.getUserLevel())
263
264
  }
264
265
 
@@ -268,7 +269,7 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
268
269
  * @return list of user tags
269
270
  */
270
271
  @ReactMethod
271
- fun getUserTags(promise: Promise) {
272
+ override fun getUserTags(promise: Promise) {
272
273
  val tags = Tapjoy.getUserTags()
273
274
  val tagsArray: WritableArray = Arguments.createArray()
274
275
 
@@ -285,7 +286,7 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
285
286
  * the tags to be set
286
287
  */
287
288
  @ReactMethod
288
- fun setUserTags(tags: ReadableArray) {
289
+ override fun setUserTags(tags: ReadableArray) {
289
290
  val tagsSet: Set<String> = (0 until tags.size())
290
291
  .mapNotNull { tags.getString(it) }
291
292
  .toSet()
@@ -296,7 +297,7 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
296
297
  * Removes all tags from the user.
297
298
  */
298
299
  @ReactMethod
299
- fun clearUserTags() {
300
+ override fun clearUserTags() {
300
301
  Tapjoy.clearUserTags()
301
302
  }
302
303
 
@@ -307,7 +308,7 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
307
308
  * the tag to be added
308
309
  */
309
310
  @ReactMethod
310
- fun addUserTag(tag: String) {
311
+ override fun addUserTag(tag: String) {
311
312
  Tapjoy.addUserTag(tag)
312
313
  }
313
314
 
@@ -317,14 +318,14 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
317
318
  * @param tag
318
319
  * the tag to be removed
319
320
  */
320
- @ReactMethod
321
- fun removeUserTag(tag: String) {
321
+ @ReactMethod
322
+ override fun removeUserTag(tag: String) {
322
323
  Tapjoy.removeUserTag(tag)
323
324
  }
324
325
 
325
326
  @ReactMethod
326
- fun setLoggingLevel(level: Int) {
327
- when (level) {
327
+ override fun setLoggingLevel(level: Double) {
328
+ when (level.toInt()) {
328
329
  0 -> Tapjoy.setLoggingLevel(TJLogLevel.ERROR)
329
330
  1 -> Tapjoy.setLoggingLevel(TJLogLevel.WARNING)
330
331
  2 -> Tapjoy.setLoggingLevel(TJLogLevel.INFO)
@@ -333,7 +334,7 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
333
334
  }
334
335
 
335
336
  @ReactMethod
336
- fun getLoggingLevel(promise: Promise) {
337
+ override fun getLoggingLevel(promise: Promise) {
337
338
  when (Tapjoy.getLoggingLevel()) {
338
339
  TJLogLevel.ERROR -> promise.resolve(0)
339
340
  TJLogLevel.WARNING -> promise.resolve(1)
@@ -348,7 +349,7 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
348
349
  }
349
350
 
350
351
  @ReactMethod(isBlockingSynchronousMethod = true)
351
- fun isConnected(): Boolean {
352
+ override fun isConnected(): Boolean {
352
353
  return Tapjoy.isConnected()
353
354
  }
354
355
 
@@ -358,7 +359,7 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
358
359
  * @param placementName Case-sensitive placement name string. Must not be empty or null.
359
360
  */
360
361
  @ReactMethod
361
- fun createPlacement(placementName: String) {
362
+ override fun createPlacement(placementName: String) {
362
363
  val listener = object : TJPlacementListener {
363
364
  override fun onRequestSuccess(placement: TJPlacement) {
364
365
  val parameters = Arguments.createMap().apply {
@@ -403,14 +404,6 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
403
404
  placements.remove(placement.name)
404
405
  }
405
406
 
406
- override fun onPurchaseRequest(placement: TJPlacement, actionRequest: TJActionRequest, name: String) {
407
-
408
- }
409
-
410
- override fun onRewardRequest(placement: TJPlacement, actionRequest: TJActionRequest, currencyName: String, value: Int) {
411
-
412
- }
413
-
414
407
  override fun onClick(placement: TJPlacement) {
415
408
 
416
409
  }
@@ -425,7 +418,7 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
425
418
  * @param placementName Case-sensitive placement name string. Must not be empty or null.
426
419
  */
427
420
  @ReactMethod
428
- fun requestPlacement(placementName: String) {
421
+ override fun requestPlacement(placementName: String) {
429
422
  val placement = placements[placementName]
430
423
  placement?.requestContent()
431
424
  }
@@ -436,7 +429,7 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
436
429
  * @param placementName Case-sensitive placement name string. Must not be empty or null.
437
430
  */
438
431
  @ReactMethod
439
- fun showPlacement(placementName: String) {
432
+ override fun showPlacement(placementName: String) {
440
433
  placements[placementName]?.showContent()
441
434
  }
442
435
 
@@ -448,7 +441,7 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
448
441
  * @return true if content has been cached and ready to show.
449
442
  */
450
443
  @ReactMethod(isBlockingSynchronousMethod = true)
451
- fun isContentReady(placementName: String): Boolean {
444
+ override fun isContentReady(placementName: String): Boolean {
452
445
  return placements[placementName]?.isContentReady ?: false
453
446
  }
454
447
 
@@ -460,7 +453,7 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
460
453
  * @return true if content is available to cache or stream.
461
454
  */
462
455
  @ReactMethod(isBlockingSynchronousMethod = true)
463
- fun isContentAvailable(placementName: String): Boolean {
456
+ override fun isContentAvailable(placementName: String): Boolean {
464
457
  return placements[placementName]?.isContentAvailable ?: false
465
458
  }
466
459
 
@@ -473,8 +466,8 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
473
466
  * @param {Promise} promise - The promise to fulfill after setting the balance.
474
467
  */
475
468
  @ReactMethod
476
- fun setCurrencyBalance(currencyAmount: Int, currencyId: String, placementName: String, promise: Promise) {
477
- placements[placementName]?.setCurrencyBalance(currencyId, currencyAmount, object : TJSetCurrencyBalanceListener {
469
+ override fun setCurrencyBalance(currencyAmount: Double, currencyId: String, placementName: String, promise: Promise) {
470
+ placements[placementName]?.setCurrencyBalance(currencyId, currencyAmount.toInt(), object : TJSetCurrencyBalanceListener {
478
471
  override fun onSetCurrencyBalanceSuccess() {
479
472
  promise.resolve(true)
480
473
  }
@@ -493,7 +486,7 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
493
486
  * @return {Promise} amount - The promise to fulfill after getting the balance.
494
487
  */
495
488
  @ReactMethod
496
- fun getPlacementCurrencyBalance(currencyId: String, placementName: String, promise: Promise) {
489
+ override fun getPlacementCurrencyBalance(currencyId: String, placementName: String, promise: Promise) {
497
490
  promise.resolve(placements[placementName]?.getCurrencyBalance(currencyId))
498
491
  }
499
492
 
@@ -506,13 +499,13 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
506
499
  * @return The promise to fulfill after getting the balance.
507
500
  */
508
501
  @ReactMethod
509
- fun setRequiredAmount(currencyAmount: Int, currencyId: String, placementName: String, promise: Promise) {
502
+ override fun setRequiredAmount(currencyAmount: Double, currencyId: String, placementName: String, promise: Promise) {
510
503
  val placement = placements[placementName]
511
504
  if (placement == null) {
512
505
  promise.reject("Placement not found", "Placement does not exist.", Exception("Placement not found"))
513
506
  return
514
507
  }
515
- placement?.setCurrencyAmountRequired(currencyId, currencyAmount, object : TJSetCurrencyAmountRequiredListener {
508
+ placement.setCurrencyAmountRequired(currencyId, currencyAmount.toInt(), object : TJSetCurrencyAmountRequiredListener {
516
509
  override fun onSetCurrencyAmountRequiredSuccess() {
517
510
  promise.resolve(true)
518
511
  }
@@ -530,7 +523,7 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
530
523
  * @return The amount of the required currency, -1 if not available.
531
524
  */
532
525
  @ReactMethod
533
- fun getRequiredAmount(currencyId: String, placementName: String, promise: Promise) {
526
+ override fun getRequiredAmount(currencyId: String, placementName: String, promise: Promise) {
534
527
  val placement = placements[placementName]
535
528
  if (placement == null) {
536
529
  promise.resolve(-1)
@@ -546,8 +539,8 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
546
539
  * @see TJEntryPoint
547
540
  */
548
541
  @ReactMethod
549
- fun setEntryPoint(placementName: String, entryPoint: Int) {
550
- placements[placementName]?.setEntryPoint(TJEntryPoint.fromOrdinal(entryPoint))
542
+ override fun setEntryPoint(placementName: String, entryPoint: Double) {
543
+ placements[placementName]?.setEntryPoint(TJEntryPoint.fromOrdinal(entryPoint.toInt()))
551
544
  }
552
545
 
553
546
  /**
@@ -557,7 +550,7 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
557
550
  * @see TJEntryPoint
558
551
  */
559
552
  @ReactMethod
560
- fun getEntryPoint(placementName: String, promise: Promise) {
553
+ override fun getEntryPoint(placementName: String, promise: Promise) {
561
554
  promise.resolve(placements[placementName]?.getEntryPoint()?.ordinal)
562
555
  }
563
556
 
@@ -571,7 +564,7 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
571
564
  * the price of product
572
565
  */
573
566
  @ReactMethod
574
- fun trackPurchase(currencyCode: String, price: Double) {
567
+ override fun trackPurchase(currencyCode: String, price: Double) {
575
568
  Tapjoy.trackPurchase(currencyCode, price)
576
569
  }
577
570
 
@@ -581,8 +574,8 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
581
574
  * @param gdprApplicable true (1) if GDPR applies to this user, false (0) otherwise
582
575
  */
583
576
  @ReactMethod
584
- fun setSubjectToGDPRStatus(gdprApplicableStatus: Int) {
585
- val status = TJStatus.values()[gdprApplicableStatus]
577
+ override fun setSubjectToGDPRStatus(gdprApplicableStatus: Double) {
578
+ val status = TJStatus.values()[gdprApplicableStatus.toInt()]
586
579
  Tapjoy.getPrivacyPolicy().setSubjectToGDPR(status)
587
580
  }
588
581
 
@@ -592,7 +585,7 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
592
585
  * @return TJStatus.TRUE (1) if below consent age (COPPA) applies to this user, TJStatus.FALSE (0) otherwise
593
586
  */
594
587
  @ReactMethod
595
- fun getBelowConsentAge(promise: Promise) {
588
+ override fun getBelowConsentAge(promise: Promise) {
596
589
  val getPrivacyPolicy = Tapjoy.getPrivacyPolicy()
597
590
  if (getPrivacyPolicy == null) {
598
591
  promise.reject("Get Below Consent Age Error", Exception("error"))
@@ -610,7 +603,7 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
610
603
  * @return TJStatus.TRUE (1) if GDPR applies to this user, TJStatus.FALSE (0) otherwise
611
604
  */
612
605
  @ReactMethod
613
- fun getSubjectToGDPR(promise: Promise) {
606
+ override fun getSubjectToGDPR(promise: Promise) {
614
607
  val getPrivacyPolicy = Tapjoy.getPrivacyPolicy()
615
608
  if (getPrivacyPolicy == null) {
616
609
  promise.reject("Get Subject To GDPR Error", Exception("error"))
@@ -627,7 +620,7 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
627
620
  * @return The user consent value
628
621
  */
629
622
  @ReactMethod
630
- fun getUserConsent(promise: Promise) {
623
+ override fun getUserConsent(promise: Promise) {
631
624
  val getPrivacyPolicy = Tapjoy.getPrivacyPolicy()
632
625
  if (getPrivacyPolicy == null) {
633
626
  promise.reject("Get User Consent Error", Exception("error"))
@@ -643,7 +636,7 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
643
636
  * @return The us privacy value string
644
637
  */
645
638
  @ReactMethod
646
- fun getUSPrivacy(promise: Promise) {
639
+ override fun getUSPrivacy(promise: Promise) {
647
640
  val privacyPolicy = Tapjoy.getPrivacyPolicy()
648
641
  if (privacyPolicy != null) {
649
642
  promise.resolve(privacyPolicy.getUSPrivacy() ?: "")
@@ -658,8 +651,8 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
658
651
  * @param isBelowConsentAge true (1) if below consent age (COPPA) applies to this user, false (0) otherwise
659
652
  */
660
653
  @ReactMethod
661
- fun setBelowConsentAgeStatus(isBelowConsentAgeStatus: Int) {
662
- val status = TJStatus.values()[isBelowConsentAgeStatus]
654
+ override fun setBelowConsentAgeStatus(isBelowConsentAgeStatus: Double) {
655
+ val status = TJStatus.values()[isBelowConsentAgeStatus.toInt()]
663
656
  Tapjoy.getPrivacyPolicy().setBelowConsentAge(status)
664
657
  }
665
658
  /**
@@ -668,7 +661,7 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
668
661
  * @param privacyValue The privacy value string eg. "1YNN" where 1 is char in string for the version, Y = YES, N = No, - = Not Applicable
669
662
  */
670
663
  @ReactMethod
671
- fun setUSPrivacy(isUsPrivacy: String){
664
+ override fun setUSPrivacy(isUsPrivacy: String){
672
665
  Tapjoy.getPrivacyPolicy().setUSPrivacy(isUsPrivacy)
673
666
  }
674
667
 
@@ -678,19 +671,56 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
678
671
  * @param userConsent The value can be "0" (User has not provided consent), "1" (User has provided consent) or a daisybit string as suggested in IAB's Transparency and Consent Framework
679
672
  */
680
673
  @ReactMethod
681
- fun setUserConsentStatus(userConsentStatus: Int) {
682
- val status = TJStatus.values()[userConsentStatus]
674
+ override fun setUserConsentStatus(userConsentStatus: Double) {
675
+ val status = TJStatus.values()[userConsentStatus.toInt()]
683
676
  Tapjoy.getPrivacyPolicy().setUserConsent(status)
684
677
  }
678
+ /**
679
+ * <strong>WARNING: EXPERIMENTAL API - DO NOT USE IT</strong>
680
+ * <p>
681
+ * This method is experimental and intended for internal purposes only.
682
+ * <p>
683
+ * Returns the user's consent status for accessing Android's Usage Stats API.
684
+ *
685
+ * @return TJStatus.TRUE if the user agrees, TJStatus.FALSE otherwise
686
+ */
687
+ @ReactMethod
688
+ override fun getUsageStatsConsent(promise: Promise) {
689
+ val privacyPolicy = Tapjoy.getPrivacyPolicy()
690
+ if (privacyPolicy != null) {
691
+ promise.resolve(privacyPolicy.getUsageStatsConsent()?.getValue() ?: TJStatus.UNKNOWN.getValue())
692
+ } else {
693
+ promise.reject("Get Usage Stats Consent Error", Exception("error"))
694
+ }
695
+ }
696
+
697
+ /**
698
+ * <strong>WARNING: EXPERIMENTAL API - DO NOT USE IT</strong>
699
+ * <p>
700
+ * This method is experimental and intended for internal purposes only.
701
+ * <p>
702
+ * Sets the user's consent status for accessing Android's Usage Stats API.
703
+ * The Android Usage Stats API (UsageStatsManager) allows apps to access
704
+ * data about app usage on the device.
705
+ *
706
+ * @param usageStatsConsent TJStatus.TRUE if the user has granted permission
707
+ * to access their usage statistics, TJStatus.FALSE
708
+ * if they have denied or not yet granted permission.
709
+ */
710
+ @ReactMethod
711
+ override fun setUsageStatsConsent(usageStatsConsent: Double) {
712
+ val status = TJStatus.values()[usageStatsConsent.toInt()]
713
+ Tapjoy.getPrivacyPolicy().setUsageStatsConsent(status)
714
+ }
685
715
 
686
716
  @ReactMethod
687
- fun optOutAdvertisingID(optOut: Boolean) {
688
- Tapjoy.optOutAdvertisingID(this.currentActivity?.applicationContext, optOut)
717
+ override fun optOutAdvertisingID(optOut: Boolean) {
718
+ Tapjoy.optOutAdvertisingID(this.getCurrentActivity()?.applicationContext, optOut)
689
719
  }
690
720
 
691
721
  @ReactMethod
692
- fun getOptOutAdvertisingID(promise: Promise) {
693
- val optOutStatus = Tapjoy.getOptOutAdvertisingID(this.currentActivity?.applicationContext)
722
+ override fun getOptOutAdvertisingID(promise: Promise) {
723
+ val optOutStatus = Tapjoy.getOptOutAdvertisingID(this.getCurrentActivity()?.applicationContext)
694
724
  if (optOutStatus != null) {
695
725
  promise.resolve(optOutStatus)
696
726
  } else {
@@ -703,8 +733,21 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
703
733
  val iterator = this.keySetIterator()
704
734
  while (iterator.hasNextKey()) {
705
735
  val key = iterator.nextKey()
706
- val value = this.getString(key)
707
- hashtable[key] = value?: continue
736
+ when (this.getType(key)) {
737
+ ReadableType.String -> {
738
+ this.getString(key)?.let { hashtable[key] = it }
739
+ }
740
+ ReadableType.Number -> {
741
+ val numberValue = this.getDouble(key)
742
+ val asInt = numberValue.toInt()
743
+ hashtable[key] = if (numberValue == asInt.toDouble()) asInt else numberValue
744
+ }
745
+ ReadableType.Boolean -> {
746
+ hashtable[key] = this.getBoolean(key)
747
+ }
748
+ ReadableType.Null, ReadableType.Map, ReadableType.Array -> {
749
+ }
750
+ }
708
751
  }
709
752
  return hashtable
710
753
  }
@@ -1,14 +1,38 @@
1
1
  package com.tapjoyreactnativesdk
2
2
 
3
- import com.facebook.react.ReactPackage
3
+ import com.facebook.react.TurboReactPackage
4
4
  import com.facebook.react.bridge.NativeModule
5
5
  import com.facebook.react.bridge.ReactApplicationContext
6
+ import com.facebook.react.module.model.ReactModuleInfo
7
+ import com.facebook.react.module.model.ReactModuleInfoProvider
6
8
  import com.facebook.react.uimanager.ViewManager
7
9
 
8
- class TapjoyReactNativeSdkPackage : ReactPackage {
9
- override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> {
10
- return listOf(TapjoyReactNativeSdkModule(reactContext))
10
+ class TapjoyReactNativeSdkPackage : TurboReactPackage() {
11
+ override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? {
12
+ return if (name == TapjoyReactNativeSdkModule.NAME) {
13
+ TapjoyReactNativeSdkModule(reactContext) as NativeModule
14
+ } else {
15
+ null
16
+ }
11
17
  }
12
18
 
13
- override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> = listOf(TJOfferwallDiscoverNativeViewManager(reactContext))
19
+ override fun getReactModuleInfoProvider(): ReactModuleInfoProvider {
20
+ return ReactModuleInfoProvider {
21
+ val moduleInfos: MutableMap<String, ReactModuleInfo> = HashMap()
22
+ val isTurboModule = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
23
+ moduleInfos[TapjoyReactNativeSdkModule.NAME] = ReactModuleInfo(
24
+ TapjoyReactNativeSdkModule.NAME,
25
+ TapjoyReactNativeSdkModule.NAME,
26
+ false,
27
+ false,
28
+ true,
29
+ false,
30
+ isTurboModule
31
+ )
32
+ moduleInfos
33
+ }
34
+ }
35
+
36
+ override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> =
37
+ listOf(TJOfferwallDiscoverNativeViewManager(reactContext))
14
38
  }
@@ -117,6 +117,6 @@ dependencies {
117
117
  }
118
118
 
119
119
  implementation 'com.google.android.gms:play-services-appset:16.0.2'
120
- implementation 'com.tapjoy:tapjoy-android-sdk:14.4.0'
120
+ implementation 'com.tapjoy:tapjoy-android-sdk:14.6.0'
121
121
 
122
122
  }
@@ -4,13 +4,11 @@ import android.app.Application
4
4
  import com.facebook.react.PackageList
5
5
  import com.facebook.react.ReactApplication
6
6
  import com.facebook.react.ReactHost
7
+ import com.facebook.react.ReactNativeApplicationEntryPoint.loadReactNative
7
8
  import com.facebook.react.ReactNativeHost
8
9
  import com.facebook.react.ReactPackage
9
- import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load
10
10
  import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost
11
11
  import com.facebook.react.defaults.DefaultReactNativeHost
12
- import com.facebook.react.soloader.OpenSourceMergedSoMapping
13
- import com.facebook.soloader.SoLoader
14
12
 
15
13
  class MainApplication : Application(), ReactApplication {
16
14
 
@@ -35,10 +33,6 @@ class MainApplication : Application(), ReactApplication {
35
33
 
36
34
  override fun onCreate() {
37
35
  super.onCreate()
38
- SoLoader.init(this, OpenSourceMergedSoMapping)
39
- if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
40
- // If you opted-in for the New Architecture, we load the native entry point for this app.
41
- load()
42
- }
36
+ loadReactNative(this)
43
37
  }
44
38
  }
@@ -1,11 +1,11 @@
1
1
  buildscript {
2
2
  ext {
3
- buildToolsVersion = "35.0.0"
3
+ buildToolsVersion = "36.0.0"
4
4
  minSdkVersion = 24
5
- compileSdkVersion = 35
6
- targetSdkVersion = 35
5
+ compileSdkVersion = 36
6
+ targetSdkVersion = 36
7
7
  ndkVersion = "27.1.12297006"
8
- kotlinVersion = "2.0.21"
8
+ kotlinVersion = "2.1.20"
9
9
  }
10
10
  repositories {
11
11
  google()
@@ -1,6 +1,6 @@
1
1
  distributionBase=GRADLE_USER_HOME
2
2
  distributionPath=wrapper/dists
3
- distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
3
+ distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
4
4
  networkTimeout=10000
5
5
  validateDistributionUrl=true
6
6
  zipStoreBase=GRADLE_USER_HOME
@@ -37,3 +37,8 @@ newArchEnabled=true
37
37
  # Use this property to enable or disable the Hermes JS engine.
38
38
  # If set to false, you will be using JSC instead.
39
39
  hermesEnabled=true
40
+
41
+ # Use this property to enable edge-to-edge display support.
42
+ # This allows your app to draw behind system bars for an immersive UI.
43
+ # Note: Only works with ReactActivity and should not be used with custom Activity.
44
+ edgeToEdgeEnabled=false
@@ -16,7 +16,8 @@ target 'TapjoyReactNativeSdkExample' do
16
16
  use_react_native!(
17
17
  :path => config[:reactNativePath],
18
18
  # An absolute path to your application root.
19
- :app_path => "#{Pod::Config.instance.installation_root}/.."
19
+ :app_path => "#{Pod::Config.instance.installation_root}/..",
20
+ :new_arch_enabled => true
20
21
  )
21
22
 
22
23
  target 'TapjoyReactNativeSdkExampleTests' do