tapjoy-react-native-sdk 14.5.0 → 14.7.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.
- package/android/build.gradle +6 -13
- package/android/src/main/java/com/tapjoyreactnativesdk/TJOfferwallDiscoverNativeViewManager.kt +21 -16
- package/android/src/main/java/com/tapjoyreactnativesdk/TapjoyReactNativeSdkModule.kt +112 -74
- package/android/src/main/java/com/tapjoyreactnativesdk/TapjoyReactNativeSdkPackage.kt +29 -5
- package/example/android/app/build.gradle +1 -1
- package/example/ios/Podfile +2 -1
- package/example/ios/TapjoyReactNativeSdkExample/Info.plist +2 -0
- package/example/package.json +4 -2
- package/example/scripts/set-arch.sh +25 -0
- package/example/src/MainScreen.tsx +1 -0
- package/example/src/UserProperties.tsx +20 -1
- package/ios/TJOfferwallDiscoverNativeViewManager.m +11 -1
- package/ios/TJOfferwallDiscoverNativeViewManager.swift +2 -2
- package/ios/TapjoyReactNativeSdk.m +36 -15
- package/ios/TapjoyReactNativeSdk.swift +24 -4
- package/lib/commonjs/NativeTapjoyReactNativeSdk.js +2 -0
- package/lib/commonjs/TJOfferwallDiscoverView.js +43 -16
- package/lib/commonjs/TJOfferwallDiscoverViewNativeComponent.js +6 -0
- package/lib/commonjs/TJPlacement.js +17 -13
- package/lib/commonjs/TJPrivacyPolicy.js +81 -11
- package/lib/commonjs/TJVersion.js +1 -1
- package/lib/commonjs/Tapjoy.js +16 -10
- package/lib/commonjs/index.js +2 -1
- package/lib/commonjs/utils/ArchitectureDetection.js +7 -0
- package/lib/typescript/NativeTapjoyReactNativeSdk.d.ts +53 -0
- package/lib/typescript/TJOfferwallDiscoverView.d.ts +3 -12
- package/lib/typescript/TJOfferwallDiscoverViewNativeComponent.d.ts +21 -0
- package/lib/typescript/TJPrivacyPolicy.d.ts +29 -1
- package/lib/typescript/Tapjoy.d.ts +1 -1
- package/lib/typescript/index.d.ts +5 -3
- package/lib/typescript/utils/ArchitectureDetection.d.ts +5 -0
- package/package.json +7 -2
- package/src/NativeTapjoyReactNativeSdk.ts +117 -0
- package/src/TJOfferwallDiscoverView.tsx +56 -39
- package/src/TJOfferwallDiscoverViewNativeComponent.ts +37 -0
- package/src/TJPlacement.ts +17 -13
- package/src/TJPrivacyPolicy.ts +84 -12
- package/src/TJVersion.ts +1 -1
- package/src/Tapjoy.ts +20 -13
- package/src/index.ts +13 -3
- package/src/utils/ArchitectureDetection.ts +14 -0
- package/tapjoy-react-native-sdk.podspec +1 -1
package/android/build.gradle
CHANGED
|
@@ -21,12 +21,7 @@ def isNewArchitectureEnabled() {
|
|
|
21
21
|
|
|
22
22
|
apply plugin: "com.android.library"
|
|
23
23
|
apply plugin: "kotlin-android"
|
|
24
|
-
|
|
25
|
-
def appProject = rootProject.allprojects.find { it.plugins.hasPlugin('com.android.application') }
|
|
26
|
-
|
|
27
|
-
if (isNewArchitectureEnabled()) {
|
|
28
|
-
apply plugin: "com.facebook.react"
|
|
29
|
-
}
|
|
24
|
+
apply plugin: "com.facebook.react"
|
|
30
25
|
|
|
31
26
|
def getExtOrDefault(name) {
|
|
32
27
|
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["TapjoyReactNativeSdk_" + name]
|
|
@@ -81,14 +76,12 @@ dependencies {
|
|
|
81
76
|
//noinspection GradleDynamicVersion
|
|
82
77
|
implementation 'com.facebook.react:react-native:0.81.0'
|
|
83
78
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
84
|
-
implementation 'com.tapjoy:tapjoy-android-sdk:14.
|
|
79
|
+
implementation 'com.tapjoy:tapjoy-android-sdk:14.7.0'
|
|
85
80
|
implementation "com.google.android.gms:play-services-ads-identifier:18.0.1"
|
|
86
81
|
}
|
|
87
82
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
codegenJavaPackageName = "com.tapjoyreactnativesdk"
|
|
93
|
-
}
|
|
83
|
+
react {
|
|
84
|
+
jsRootDir = file("../src/")
|
|
85
|
+
libraryName = "TapjoyReactNativeSdk"
|
|
86
|
+
codegenJavaPackageName = "com.tapjoyreactnativesdk"
|
|
94
87
|
}
|
package/android/src/main/java/com/tapjoyreactnativesdk/TJOfferwallDiscoverNativeViewManager.kt
CHANGED
|
@@ -3,23 +3,16 @@ package com.tapjoyreactnativesdk
|
|
|
3
3
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
4
4
|
import com.facebook.react.bridge.ReadableArray
|
|
5
5
|
import com.facebook.react.common.MapBuilder
|
|
6
|
+
import com.facebook.react.module.annotations.ReactModule
|
|
6
7
|
import com.facebook.react.uimanager.SimpleViewManager
|
|
7
8
|
import com.facebook.react.uimanager.ThemedReactContext
|
|
9
|
+
import com.facebook.react.uimanager.annotations.ReactProp
|
|
8
10
|
|
|
9
|
-
|
|
10
|
-
REQUEST_CONTENT("requestContent"),
|
|
11
|
-
CLEAR_CONTENT("clearContent");
|
|
12
|
-
|
|
13
|
-
fun getValue(): String {
|
|
14
|
-
return value
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
11
|
+
@ReactModule(name = TJOfferwallDiscoverNativeViewManager.REACT_CLASS)
|
|
18
12
|
class TJOfferwallDiscoverNativeViewManager(
|
|
19
13
|
private val callerContext: ReactApplicationContext
|
|
20
14
|
) : SimpleViewManager<TJOfferwallDiscoverNativeView>() {
|
|
21
15
|
|
|
22
|
-
var view: TJOfferwallDiscoverNativeView? = null;
|
|
23
16
|
override fun getName() = REACT_CLASS
|
|
24
17
|
|
|
25
18
|
companion object {
|
|
@@ -32,15 +25,27 @@ class TJOfferwallDiscoverNativeViewManager(
|
|
|
32
25
|
|
|
33
26
|
override fun receiveCommand(view: TJOfferwallDiscoverNativeView, commandId: String, args: ReadableArray?) {
|
|
34
27
|
super.receiveCommand(view, commandId, args)
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
28
|
+
when (commandId) {
|
|
29
|
+
"requestContent" -> {
|
|
30
|
+
args?.getString(0)?.let { placement ->
|
|
31
|
+
view.requestContent(placement)
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
"clearContent" -> {
|
|
35
|
+
view.clearContent()
|
|
36
|
+
}
|
|
39
37
|
}
|
|
40
38
|
}
|
|
41
39
|
|
|
42
|
-
override fun
|
|
43
|
-
return MapBuilder.of
|
|
40
|
+
override fun getCommandsMap(): Map<String, Int>? {
|
|
41
|
+
return MapBuilder.of(
|
|
42
|
+
"requestContent", 1,
|
|
43
|
+
"clearContent", 2
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
override fun getExportedCustomDirectEventTypeConstants(): Map<String, Any>? {
|
|
48
|
+
return MapBuilder.of(
|
|
44
49
|
"onRequestSuccess", MapBuilder.of("registrationName", "onRequestSuccess"),
|
|
45
50
|
"onRequestFailure", MapBuilder.of("registrationName", "onRequestFailure"),
|
|
46
51
|
"onContentReady", MapBuilder.of("registrationName", "onContentReady"),
|
|
@@ -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
|
-
|
|
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():
|
|
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:
|
|
62
|
-
listenerCount -= count
|
|
61
|
+
override fun removeListeners(count: Double) {
|
|
62
|
+
listenerCount -= count.toInt()
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
/**
|
|
@@ -70,7 +70,7 @@ 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
76
|
Tapjoy.connect(this.getCurrentActivity()?.applicationContext, sdkKey, connectFlags.toHashtable(), object : TJConnectListener() {
|
|
@@ -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:
|
|
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:
|
|
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:
|
|
186
|
-
|
|
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()[
|
|
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:
|
|
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:
|
|
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
|
-
|
|
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:
|
|
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 {
|
|
@@ -417,7 +418,7 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
|
|
|
417
418
|
* @param placementName Case-sensitive placement name string. Must not be empty or null.
|
|
418
419
|
*/
|
|
419
420
|
@ReactMethod
|
|
420
|
-
fun requestPlacement(placementName: String) {
|
|
421
|
+
override fun requestPlacement(placementName: String) {
|
|
421
422
|
val placement = placements[placementName]
|
|
422
423
|
placement?.requestContent()
|
|
423
424
|
}
|
|
@@ -428,7 +429,7 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
|
|
|
428
429
|
* @param placementName Case-sensitive placement name string. Must not be empty or null.
|
|
429
430
|
*/
|
|
430
431
|
@ReactMethod
|
|
431
|
-
fun showPlacement(placementName: String) {
|
|
432
|
+
override fun showPlacement(placementName: String) {
|
|
432
433
|
placements[placementName]?.showContent()
|
|
433
434
|
}
|
|
434
435
|
|
|
@@ -440,7 +441,7 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
|
|
|
440
441
|
* @return true if content has been cached and ready to show.
|
|
441
442
|
*/
|
|
442
443
|
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
443
|
-
fun isContentReady(placementName: String): Boolean {
|
|
444
|
+
override fun isContentReady(placementName: String): Boolean {
|
|
444
445
|
return placements[placementName]?.isContentReady ?: false
|
|
445
446
|
}
|
|
446
447
|
|
|
@@ -452,7 +453,7 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
|
|
|
452
453
|
* @return true if content is available to cache or stream.
|
|
453
454
|
*/
|
|
454
455
|
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
455
|
-
fun isContentAvailable(placementName: String): Boolean {
|
|
456
|
+
override fun isContentAvailable(placementName: String): Boolean {
|
|
456
457
|
return placements[placementName]?.isContentAvailable ?: false
|
|
457
458
|
}
|
|
458
459
|
|
|
@@ -465,8 +466,8 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
|
|
|
465
466
|
* @param {Promise} promise - The promise to fulfill after setting the balance.
|
|
466
467
|
*/
|
|
467
468
|
@ReactMethod
|
|
468
|
-
fun setCurrencyBalance(currencyAmount:
|
|
469
|
-
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 {
|
|
470
471
|
override fun onSetCurrencyBalanceSuccess() {
|
|
471
472
|
promise.resolve(true)
|
|
472
473
|
}
|
|
@@ -485,7 +486,7 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
|
|
|
485
486
|
* @return {Promise} amount - The promise to fulfill after getting the balance.
|
|
486
487
|
*/
|
|
487
488
|
@ReactMethod
|
|
488
|
-
fun getPlacementCurrencyBalance(currencyId: String, placementName: String, promise: Promise) {
|
|
489
|
+
override fun getPlacementCurrencyBalance(currencyId: String, placementName: String, promise: Promise) {
|
|
489
490
|
promise.resolve(placements[placementName]?.getCurrencyBalance(currencyId))
|
|
490
491
|
}
|
|
491
492
|
|
|
@@ -498,13 +499,13 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
|
|
|
498
499
|
* @return The promise to fulfill after getting the balance.
|
|
499
500
|
*/
|
|
500
501
|
@ReactMethod
|
|
501
|
-
fun setRequiredAmount(currencyAmount:
|
|
502
|
+
override fun setRequiredAmount(currencyAmount: Double, currencyId: String, placementName: String, promise: Promise) {
|
|
502
503
|
val placement = placements[placementName]
|
|
503
504
|
if (placement == null) {
|
|
504
505
|
promise.reject("Placement not found", "Placement does not exist.", Exception("Placement not found"))
|
|
505
506
|
return
|
|
506
507
|
}
|
|
507
|
-
placement
|
|
508
|
+
placement.setCurrencyAmountRequired(currencyId, currencyAmount.toInt(), object : TJSetCurrencyAmountRequiredListener {
|
|
508
509
|
override fun onSetCurrencyAmountRequiredSuccess() {
|
|
509
510
|
promise.resolve(true)
|
|
510
511
|
}
|
|
@@ -522,7 +523,7 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
|
|
|
522
523
|
* @return The amount of the required currency, -1 if not available.
|
|
523
524
|
*/
|
|
524
525
|
@ReactMethod
|
|
525
|
-
fun getRequiredAmount(currencyId: String, placementName: String, promise: Promise) {
|
|
526
|
+
override fun getRequiredAmount(currencyId: String, placementName: String, promise: Promise) {
|
|
526
527
|
val placement = placements[placementName]
|
|
527
528
|
if (placement == null) {
|
|
528
529
|
promise.resolve(-1)
|
|
@@ -538,8 +539,8 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
|
|
|
538
539
|
* @see TJEntryPoint
|
|
539
540
|
*/
|
|
540
541
|
@ReactMethod
|
|
541
|
-
fun setEntryPoint(placementName: String, entryPoint:
|
|
542
|
-
placements[placementName]?.setEntryPoint(TJEntryPoint.fromOrdinal(entryPoint))
|
|
542
|
+
override fun setEntryPoint(placementName: String, entryPoint: Double) {
|
|
543
|
+
placements[placementName]?.setEntryPoint(TJEntryPoint.fromOrdinal(entryPoint.toInt()))
|
|
543
544
|
}
|
|
544
545
|
|
|
545
546
|
/**
|
|
@@ -549,7 +550,7 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
|
|
|
549
550
|
* @see TJEntryPoint
|
|
550
551
|
*/
|
|
551
552
|
@ReactMethod
|
|
552
|
-
fun getEntryPoint(placementName: String, promise: Promise) {
|
|
553
|
+
override fun getEntryPoint(placementName: String, promise: Promise) {
|
|
553
554
|
promise.resolve(placements[placementName]?.getEntryPoint()?.ordinal)
|
|
554
555
|
}
|
|
555
556
|
|
|
@@ -563,7 +564,7 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
|
|
|
563
564
|
* the price of product
|
|
564
565
|
*/
|
|
565
566
|
@ReactMethod
|
|
566
|
-
fun trackPurchase(currencyCode: String, price: Double) {
|
|
567
|
+
override fun trackPurchase(currencyCode: String, price: Double) {
|
|
567
568
|
Tapjoy.trackPurchase(currencyCode, price)
|
|
568
569
|
}
|
|
569
570
|
|
|
@@ -573,8 +574,8 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
|
|
|
573
574
|
* @param gdprApplicable true (1) if GDPR applies to this user, false (0) otherwise
|
|
574
575
|
*/
|
|
575
576
|
@ReactMethod
|
|
576
|
-
fun setSubjectToGDPRStatus(gdprApplicableStatus:
|
|
577
|
-
val status = TJStatus.values()[gdprApplicableStatus]
|
|
577
|
+
override fun setSubjectToGDPRStatus(gdprApplicableStatus: Double) {
|
|
578
|
+
val status = TJStatus.values()[gdprApplicableStatus.toInt()]
|
|
578
579
|
Tapjoy.getPrivacyPolicy().setSubjectToGDPR(status)
|
|
579
580
|
}
|
|
580
581
|
|
|
@@ -584,7 +585,7 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
|
|
|
584
585
|
* @return TJStatus.TRUE (1) if below consent age (COPPA) applies to this user, TJStatus.FALSE (0) otherwise
|
|
585
586
|
*/
|
|
586
587
|
@ReactMethod
|
|
587
|
-
fun getBelowConsentAge(promise: Promise) {
|
|
588
|
+
override fun getBelowConsentAge(promise: Promise) {
|
|
588
589
|
val getPrivacyPolicy = Tapjoy.getPrivacyPolicy()
|
|
589
590
|
if (getPrivacyPolicy == null) {
|
|
590
591
|
promise.reject("Get Below Consent Age Error", Exception("error"))
|
|
@@ -602,7 +603,7 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
|
|
|
602
603
|
* @return TJStatus.TRUE (1) if GDPR applies to this user, TJStatus.FALSE (0) otherwise
|
|
603
604
|
*/
|
|
604
605
|
@ReactMethod
|
|
605
|
-
fun getSubjectToGDPR(promise: Promise) {
|
|
606
|
+
override fun getSubjectToGDPR(promise: Promise) {
|
|
606
607
|
val getPrivacyPolicy = Tapjoy.getPrivacyPolicy()
|
|
607
608
|
if (getPrivacyPolicy == null) {
|
|
608
609
|
promise.reject("Get Subject To GDPR Error", Exception("error"))
|
|
@@ -619,7 +620,7 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
|
|
|
619
620
|
* @return The user consent value
|
|
620
621
|
*/
|
|
621
622
|
@ReactMethod
|
|
622
|
-
fun getUserConsent(promise: Promise) {
|
|
623
|
+
override fun getUserConsent(promise: Promise) {
|
|
623
624
|
val getPrivacyPolicy = Tapjoy.getPrivacyPolicy()
|
|
624
625
|
if (getPrivacyPolicy == null) {
|
|
625
626
|
promise.reject("Get User Consent Error", Exception("error"))
|
|
@@ -635,7 +636,7 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
|
|
|
635
636
|
* @return The us privacy value string
|
|
636
637
|
*/
|
|
637
638
|
@ReactMethod
|
|
638
|
-
fun getUSPrivacy(promise: Promise) {
|
|
639
|
+
override fun getUSPrivacy(promise: Promise) {
|
|
639
640
|
val privacyPolicy = Tapjoy.getPrivacyPolicy()
|
|
640
641
|
if (privacyPolicy != null) {
|
|
641
642
|
promise.resolve(privacyPolicy.getUSPrivacy() ?: "")
|
|
@@ -650,8 +651,8 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
|
|
|
650
651
|
* @param isBelowConsentAge true (1) if below consent age (COPPA) applies to this user, false (0) otherwise
|
|
651
652
|
*/
|
|
652
653
|
@ReactMethod
|
|
653
|
-
fun setBelowConsentAgeStatus(isBelowConsentAgeStatus:
|
|
654
|
-
val status = TJStatus.values()[isBelowConsentAgeStatus]
|
|
654
|
+
override fun setBelowConsentAgeStatus(isBelowConsentAgeStatus: Double) {
|
|
655
|
+
val status = TJStatus.values()[isBelowConsentAgeStatus.toInt()]
|
|
655
656
|
Tapjoy.getPrivacyPolicy().setBelowConsentAge(status)
|
|
656
657
|
}
|
|
657
658
|
/**
|
|
@@ -660,7 +661,7 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
|
|
|
660
661
|
* @param privacyValue The privacy value string eg. "1YNN" where 1 is char in string for the version, Y = YES, N = No, - = Not Applicable
|
|
661
662
|
*/
|
|
662
663
|
@ReactMethod
|
|
663
|
-
fun setUSPrivacy(isUsPrivacy: String){
|
|
664
|
+
override fun setUSPrivacy(isUsPrivacy: String){
|
|
664
665
|
Tapjoy.getPrivacyPolicy().setUSPrivacy(isUsPrivacy)
|
|
665
666
|
}
|
|
666
667
|
|
|
@@ -670,18 +671,55 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
|
|
|
670
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
|
|
671
672
|
*/
|
|
672
673
|
@ReactMethod
|
|
673
|
-
fun setUserConsentStatus(userConsentStatus:
|
|
674
|
-
val status = TJStatus.values()[userConsentStatus]
|
|
674
|
+
override fun setUserConsentStatus(userConsentStatus: Double) {
|
|
675
|
+
val status = TJStatus.values()[userConsentStatus.toInt()]
|
|
675
676
|
Tapjoy.getPrivacyPolicy().setUserConsent(status)
|
|
676
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
|
+
}
|
|
677
715
|
|
|
678
716
|
@ReactMethod
|
|
679
|
-
fun optOutAdvertisingID(optOut: Boolean) {
|
|
717
|
+
override fun optOutAdvertisingID(optOut: Boolean) {
|
|
680
718
|
Tapjoy.optOutAdvertisingID(this.getCurrentActivity()?.applicationContext, optOut)
|
|
681
719
|
}
|
|
682
720
|
|
|
683
721
|
@ReactMethod
|
|
684
|
-
fun getOptOutAdvertisingID(promise: Promise) {
|
|
722
|
+
override fun getOptOutAdvertisingID(promise: Promise) {
|
|
685
723
|
val optOutStatus = Tapjoy.getOptOutAdvertisingID(this.getCurrentActivity()?.applicationContext)
|
|
686
724
|
if (optOutStatus != null) {
|
|
687
725
|
promise.resolve(optOutStatus)
|
|
@@ -1,14 +1,38 @@
|
|
|
1
1
|
package com.tapjoyreactnativesdk
|
|
2
2
|
|
|
3
|
-
import com.facebook.react.
|
|
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 :
|
|
9
|
-
override fun
|
|
10
|
-
return
|
|
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
|
|
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
|
}
|
package/example/ios/Podfile
CHANGED
|
@@ -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
|
|
@@ -35,6 +35,8 @@
|
|
|
35
35
|
<string></string>
|
|
36
36
|
<key>NSUserTrackingUsageDescription</key>
|
|
37
37
|
<string>This allows us to deliver personalized ads for you.</string>
|
|
38
|
+
<key>RCTNewArchEnabled</key>
|
|
39
|
+
<true/>
|
|
38
40
|
<key>UILaunchStoryboardName</key>
|
|
39
41
|
<string>LaunchScreen</string>
|
|
40
42
|
<key>UIRequiredDeviceCapabilities</key>
|