tapjoy-react-native-sdk 13.1.2 → 13.2.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 +4 -1
- package/android/settings.gradle +1 -1
- package/android/src/main/java/com/tapjoyreactnativesdk/TapjoyReactNativeSdkModule.kt +281 -24
- package/example/android/app/build.gradle +3 -1
- package/example/android/app/proguard-rules.pro +19 -0
- package/example/android/app/src/main/AndroidManifest.xml +2 -1
- package/example/android/app/src/main/res/xml/network_security_config.xml +12 -0
- package/example/android/settings.gradle +1 -1
- package/example/ios/TapjoyReactNativeSdkExample.xcodeproj/project.pbxproj +16 -2
- package/example/metro.config.js +10 -2
- package/example/package.json +7 -3
- package/example/src/MainScreen.tsx +52 -46
- package/example/src/OfferwallScreen.tsx +263 -63
- package/example/src/SelectionMenu.tsx +70 -0
- package/example/src/Styles.ts +91 -5
- package/example/src/UserProperties.tsx +246 -8
- package/ios/TapjoyReactNativeSdk.m +17 -1
- package/ios/TapjoyReactNativeSdk.swift +276 -6
- package/lib/commonjs/TJEntryPoint.js +22 -0
- package/lib/commonjs/TJEntryPoint.js.map +1 -0
- package/lib/commonjs/TJPlacement.js +86 -2
- package/lib/commonjs/TJPlacement.js.map +1 -1
- package/lib/commonjs/TJPrivacyPolicy.js +52 -0
- package/lib/commonjs/TJPrivacyPolicy.js.map +1 -1
- package/lib/commonjs/TJSegment.js +16 -0
- package/lib/commonjs/TJSegment.js.map +1 -0
- package/lib/commonjs/TJStatus.js +15 -0
- package/lib/commonjs/TJStatus.js.map +1 -0
- package/lib/commonjs/TJVersion.js +2 -2
- package/lib/commonjs/index.js +14 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/TJEntryPoint.js +15 -0
- package/lib/module/TJEntryPoint.js.map +1 -0
- package/lib/module/TJPlacement.js +86 -3
- package/lib/module/TJPlacement.js.map +1 -1
- package/lib/module/TJPrivacyPolicy.js +53 -1
- package/lib/module/TJPrivacyPolicy.js.map +1 -1
- package/lib/module/TJSegment.js +9 -0
- package/lib/module/TJSegment.js.map +1 -0
- package/lib/module/TJStatus.js +8 -0
- package/lib/module/TJStatus.js.map +1 -0
- package/lib/module/TJVersion.js +2 -2
- package/lib/module/index.js +3 -1
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/TJEntryPoint.d.ts +14 -0
- package/lib/typescript/TJEntryPoint.d.ts.map +1 -0
- package/lib/typescript/TJPlacement.d.ts +59 -0
- package/lib/typescript/TJPlacement.d.ts.map +1 -1
- package/lib/typescript/TJPrivacyPolicy.d.ts +9 -0
- package/lib/typescript/TJPrivacyPolicy.d.ts.map +1 -1
- package/lib/typescript/TJSegment.d.ts +8 -0
- package/lib/typescript/TJSegment.d.ts.map +1 -0
- package/lib/typescript/TJStatus.d.ts +7 -0
- package/lib/typescript/TJStatus.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +3 -1
- package/lib/typescript/index.d.ts.map +1 -1
- package/package.json +3 -2
- package/src/TJEntryPoint.ts +14 -0
- package/src/TJPlacement.ts +86 -3
- package/src/TJPrivacyPolicy.ts +62 -1
- package/src/TJSegment.ts +8 -0
- package/src/TJStatus.ts +7 -0
- package/src/TJVersion.ts +2 -2
- package/src/index.ts +3 -1
- package/tapjoy-react-native-sdk.podspec +1 -1
package/android/build.gradle
CHANGED
|
@@ -46,6 +46,9 @@ android {
|
|
|
46
46
|
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
|
|
47
47
|
}
|
|
48
48
|
buildTypes {
|
|
49
|
+
debug {
|
|
50
|
+
debuggable true
|
|
51
|
+
}
|
|
49
52
|
release {
|
|
50
53
|
minifyEnabled false
|
|
51
54
|
}
|
|
@@ -79,7 +82,7 @@ dependencies {
|
|
|
79
82
|
//noinspection GradleDynamicVersion
|
|
80
83
|
implementation 'com.facebook.react:react-native:0.71.4'
|
|
81
84
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
82
|
-
implementation 'com.tapjoy:tapjoy-android-sdk:13.
|
|
85
|
+
implementation 'com.tapjoy:tapjoy-android-sdk:13.2.0'
|
|
83
86
|
implementation "com.google.android.gms:play-services-ads-identifier:18.0.1"
|
|
84
87
|
}
|
|
85
88
|
|
package/android/settings.gradle
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
rootProject.name = 'TapjoyReactNativeSdk'
|
|
2
2
|
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
|
|
3
|
-
includeBuild('../node_modules
|
|
3
|
+
includeBuild('../node_modules/@react-native/gradle-plugin')
|
|
@@ -12,9 +12,16 @@ import com.tapjoy.TJError;
|
|
|
12
12
|
import com.tapjoy.TJPlacement;
|
|
13
13
|
import com.tapjoy.TJActionRequest;
|
|
14
14
|
import com.tapjoy.TJPlacementListener;
|
|
15
|
+
import com.tapjoy.TJSetCurrencyBalanceListener;
|
|
16
|
+
import com.tapjoy.TJSetCurrencyAmountRequiredListener;
|
|
17
|
+
import com.tapjoy.TJStatus;
|
|
18
|
+
import com.tapjoy.TJPrivacyPolicy;
|
|
19
|
+
import com.tapjoy.TJSegment;
|
|
20
|
+
import com.tapjoy.TJEntryPoint
|
|
15
21
|
import java.util.Hashtable
|
|
16
22
|
import kotlin.collections.HashMap
|
|
17
23
|
import com.facebook.react.modules.core.DeviceEventManagerModule
|
|
24
|
+
import java.lang.Exception
|
|
18
25
|
|
|
19
26
|
class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
|
|
20
27
|
ReactContextBaseJavaModule(reactContext) {
|
|
@@ -64,15 +71,15 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
|
|
|
64
71
|
@ReactMethod
|
|
65
72
|
fun connect(sdkKey: String, connectFlags: ReadableMap, promise: Promise) {
|
|
66
73
|
TapjoyConnectCore.setPlugin("ReactNative");
|
|
67
|
-
|
|
68
|
-
Tapjoy.connect(this.currentActivity?.applicationContext, sdkKey, connectFlags.toHashtable(), object : TJConnectListener {
|
|
74
|
+
|
|
75
|
+
Tapjoy.connect(this.currentActivity?.applicationContext, sdkKey, connectFlags.toHashtable(), object : TJConnectListener() {
|
|
69
76
|
override fun onConnectSuccess() {
|
|
70
77
|
Tapjoy.setActivity(currentActivity)
|
|
71
78
|
promise.resolve(true)
|
|
72
79
|
}
|
|
73
80
|
|
|
74
|
-
override fun onConnectFailure() {
|
|
75
|
-
promise.reject(
|
|
81
|
+
override fun onConnectFailure(code: Int, message: String) {
|
|
82
|
+
promise.reject(code.toString(), message, Exception(message))
|
|
76
83
|
}
|
|
77
84
|
})
|
|
78
85
|
}
|
|
@@ -116,7 +123,7 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
|
|
|
116
123
|
@ReactMethod
|
|
117
124
|
fun awardCurrency(amount: Int, promise: Promise) {
|
|
118
125
|
Tapjoy.awardCurrency(amount, object : TJAwardCurrencyListener {
|
|
119
|
-
|
|
126
|
+
|
|
120
127
|
override fun onAwardCurrencyResponse(currencyName: String, balance: Int) {
|
|
121
128
|
val currencyObj = Arguments.createMap().apply {
|
|
122
129
|
putString("currencyName", currencyName)
|
|
@@ -144,6 +151,42 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
|
|
|
144
151
|
})
|
|
145
152
|
}
|
|
146
153
|
|
|
154
|
+
/**
|
|
155
|
+
* Sets the segment of the user
|
|
156
|
+
*
|
|
157
|
+
* @Param userSegment: NON_PAYER (0), PAYER (1), VIP (2)
|
|
158
|
+
*
|
|
159
|
+
*/
|
|
160
|
+
@ReactMethod
|
|
161
|
+
fun setUserSegment(userSegment: Int) {
|
|
162
|
+
if (userSegment == -1){
|
|
163
|
+
Tapjoy.setUserSegment(TJSegment.UNKNOWN)
|
|
164
|
+
} else {
|
|
165
|
+
Tapjoy.setUserSegment(TJSegment.values()[userSegment])
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Sets the segment of the user
|
|
171
|
+
*
|
|
172
|
+
* @return userSegment NON_PAYER (0), PAYER (1), VIP (2)
|
|
173
|
+
*
|
|
174
|
+
*/
|
|
175
|
+
@ReactMethod
|
|
176
|
+
fun getUserSegment(promise: Promise) {
|
|
177
|
+
val segment = Tapjoy.getUserSegment()
|
|
178
|
+
promise.resolve(segment?.getValue() ?: TJSegment.UNKNOWN.getValue())
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/** Sets the maximum level of the user.
|
|
182
|
+
*
|
|
183
|
+
* @Param maxLevel: the maximum level
|
|
184
|
+
*/
|
|
185
|
+
@ReactMethod
|
|
186
|
+
fun setMaxLevel(maxLevel: Int) {
|
|
187
|
+
Tapjoy.setMaxLevel(maxLevel);
|
|
188
|
+
}
|
|
189
|
+
|
|
147
190
|
@ReactMethod
|
|
148
191
|
fun setDebugEnabled(enabled: Boolean) {
|
|
149
192
|
Tapjoy.setDebugEnabled(enabled)
|
|
@@ -155,12 +198,12 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
|
|
|
155
198
|
}
|
|
156
199
|
|
|
157
200
|
/**
|
|
158
|
-
*
|
|
201
|
+
* Creates a new placement with the specified name.
|
|
159
202
|
*
|
|
160
203
|
* @param placementName Case-sensitive placement name string. Must not be empty or null.
|
|
161
204
|
*/
|
|
162
205
|
@ReactMethod
|
|
163
|
-
fun
|
|
206
|
+
fun createPlacement(placementName: String) {
|
|
164
207
|
val listener = object : TJPlacementListener {
|
|
165
208
|
override fun onRequestSuccess(placement: TJPlacement) {
|
|
166
209
|
val parameters = Arguments.createMap().apply {
|
|
@@ -189,20 +232,20 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
|
|
|
189
232
|
}
|
|
190
233
|
|
|
191
234
|
override fun onContentShow(placement: TJPlacement) {
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
235
|
+
val parameters = Arguments.createMap().apply {
|
|
236
|
+
putString("name", "contentDidAppear")
|
|
237
|
+
putString("placement", placement.name)
|
|
238
|
+
}
|
|
239
|
+
sendEvent("TapjoyPlacement", parameters)
|
|
197
240
|
}
|
|
198
241
|
|
|
199
242
|
override fun onContentDismiss(placement: TJPlacement) {
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
243
|
+
val parameters = Arguments.createMap().apply {
|
|
244
|
+
putString("name", "contentDidDisappear")
|
|
245
|
+
putString("placement", placement.name)
|
|
246
|
+
}
|
|
247
|
+
sendEvent("TapjoyPlacement", parameters)
|
|
248
|
+
placements.remove(placement.name)
|
|
206
249
|
}
|
|
207
250
|
|
|
208
251
|
override fun onPurchaseRequest(placement: TJPlacement, actionRequest: TJActionRequest, name: String) {
|
|
@@ -218,8 +261,18 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
|
|
|
218
261
|
}
|
|
219
262
|
}
|
|
220
263
|
val placement = Tapjoy.getPlacement(placementName, listener)
|
|
221
|
-
placements[
|
|
222
|
-
|
|
264
|
+
placements[placementName] = placement
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* Request content for a given placement.
|
|
269
|
+
*
|
|
270
|
+
* @param placementName Case-sensitive placement name string. Must not be empty or null.
|
|
271
|
+
*/
|
|
272
|
+
@ReactMethod
|
|
273
|
+
fun requestPlacement(placementName: String) {
|
|
274
|
+
val placement = placements[placementName]
|
|
275
|
+
placement?.requestContent()
|
|
223
276
|
}
|
|
224
277
|
|
|
225
278
|
/**
|
|
@@ -253,30 +306,218 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
|
|
|
253
306
|
*/
|
|
254
307
|
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
255
308
|
fun isContentAvailable(placementName: String): Boolean {
|
|
256
|
-
return placements[placementName]?.isContentAvailable ?: false
|
|
309
|
+
return placements[placementName]?.isContentAvailable ?: false
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* Sets the currency balance for a specific placement and currency.
|
|
314
|
+
*
|
|
315
|
+
* @param {Int} currencyAmount - The amount of the currency to set.
|
|
316
|
+
* @param {String} currencyId - The identifier of the currency.
|
|
317
|
+
* @param {String} placementName - The name of the placement.
|
|
318
|
+
* @param {Promise} promise - The promise to fulfill after setting the balance.
|
|
319
|
+
*/
|
|
320
|
+
@ReactMethod
|
|
321
|
+
fun setCurrencyBalance(currencyAmount: Int, currencyId: String, placementName: String, promise: Promise) {
|
|
322
|
+
placements[placementName]?.setCurrencyBalance(currencyId, currencyAmount, object : TJSetCurrencyBalanceListener {
|
|
323
|
+
override fun onSetCurrencyBalanceSuccess() {
|
|
324
|
+
promise.resolve(true)
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
override fun onSetCurrencyBalanceFailure(code: Int, message: String) {
|
|
328
|
+
promise.reject(code.toString(), message, Exception(message))
|
|
329
|
+
}
|
|
330
|
+
})
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* Gets the currency balance for a specific placement and currency.
|
|
335
|
+
*
|
|
336
|
+
* @param {String} currencyId - The identifier of the currency.
|
|
337
|
+
* @param {String} placementName - The name of the placement.
|
|
338
|
+
* @return {Promise} amount - The promise to fulfill after getting the balance.
|
|
339
|
+
*/
|
|
340
|
+
@ReactMethod
|
|
341
|
+
fun getPlacementCurrencyBalance(currencyId: String, placementName: String, promise: Promise) {
|
|
342
|
+
promise.resolve(placements[placementName]?.getCurrencyBalance(currencyId))
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
/**
|
|
346
|
+
* Sets the currency amount required
|
|
347
|
+
*
|
|
348
|
+
* @param currencyAmount The amount of the currency the use needs. Must be greater than 0.
|
|
349
|
+
* @param currencyId The identifier of the currency.
|
|
350
|
+
* @param placementName The name of the placement.
|
|
351
|
+
* @return The promise to fulfill after getting the balance.
|
|
352
|
+
*/
|
|
353
|
+
@ReactMethod
|
|
354
|
+
fun setRequiredAmount(currencyAmount: Int, currencyId: String, placementName: String, promise: Promise) {
|
|
355
|
+
val placement = placements[placementName]
|
|
356
|
+
if (placement == null) {
|
|
357
|
+
promise.reject("Placement not found", "Placement does not exist.", Exception("Placement not found"))
|
|
358
|
+
return
|
|
359
|
+
}
|
|
360
|
+
placement?.setCurrencyAmountRequired(currencyId, currencyAmount, object : TJSetCurrencyAmountRequiredListener {
|
|
361
|
+
override fun onSetCurrencyAmountRequiredSuccess() {
|
|
362
|
+
promise.resolve(true)
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
override fun onSetCurrencyAmountRequiredFailure(code: Int, message: String) {
|
|
366
|
+
promise.reject(code.toString(), message, Exception(message))
|
|
367
|
+
}
|
|
368
|
+
})
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
/**
|
|
372
|
+
* Gets the currency amount required
|
|
373
|
+
*
|
|
374
|
+
* @param currencyId The identifier of the currency.
|
|
375
|
+
* @return The amount of the required currency, -1 if not available.
|
|
376
|
+
*/
|
|
377
|
+
@ReactMethod
|
|
378
|
+
fun getRequiredAmount(currencyId: String, placementName: String, promise: Promise) {
|
|
379
|
+
val placement = placements[placementName]
|
|
380
|
+
if (placement == null) {
|
|
381
|
+
promise.resolve(-1)
|
|
382
|
+
return
|
|
383
|
+
}
|
|
384
|
+
promise.resolve(placements[placementName]?.getCurrencyAmountRequired(currencyId))
|
|
257
385
|
}
|
|
258
|
-
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* Sets the entry point for given placement name.
|
|
389
|
+
*
|
|
390
|
+
* @param {Int} entryPoint The entry point ordinal to set.
|
|
391
|
+
* @see TJEntryPoint
|
|
392
|
+
*/
|
|
393
|
+
@ReactMethod
|
|
394
|
+
fun setEntryPoint(placementName: String, entryPoint: Int) {
|
|
395
|
+
placements[placementName]?.setEntryPoint(TJEntryPoint.fromOrdinal(entryPoint))
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
/**
|
|
399
|
+
* Gets the entry point for given placement name.
|
|
400
|
+
*
|
|
401
|
+
* @return {Int} entryPoint The entry point ordinal to set.
|
|
402
|
+
* @see TJEntryPoint
|
|
403
|
+
*/
|
|
404
|
+
@ReactMethod
|
|
405
|
+
fun getEntryPoint(placementName: String, promise: Promise) {
|
|
406
|
+
promise.resolve(placements[placementName]?.getEntryPoint()?.ordinal)
|
|
407
|
+
}
|
|
408
|
+
|
|
259
409
|
/**
|
|
260
410
|
* Indicate if the user falls in any of the GDPR applicable countries
|
|
261
411
|
*
|
|
262
412
|
* @param gdprApplicable true if GDPR applies to this user, false otherwise
|
|
263
413
|
*/
|
|
414
|
+
@Deprecated("Use setSubjectToGDPRStatus instead", ReplaceWith("setSubjectToGDPR(gdprApplicable)"))
|
|
264
415
|
@ReactMethod
|
|
265
416
|
fun setSubjectToGDPR(gdprApplicable: Boolean){
|
|
266
417
|
Tapjoy.getPrivacyPolicy().setSubjectToGDPR(gdprApplicable)
|
|
267
418
|
}
|
|
419
|
+
|
|
420
|
+
/**
|
|
421
|
+
* Indicate if the user falls in any of the GDPR applicable countries
|
|
422
|
+
*
|
|
423
|
+
* @param gdprApplicable true (1) if GDPR applies to this user, false (0) otherwise
|
|
424
|
+
*/
|
|
425
|
+
@ReactMethod
|
|
426
|
+
fun setSubjectToGDPRStatus(gdprApplicableStatus: Int) {
|
|
427
|
+
val status = TJStatus.values()[gdprApplicableStatus]
|
|
428
|
+
Tapjoy.getPrivacyPolicy().setSubjectToGDPR(status)
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
/**
|
|
432
|
+
* Returns the consent age (COPPA) flag applied to the user.
|
|
433
|
+
*
|
|
434
|
+
* @return TJStatus.TRUE (1) if below consent age (COPPA) applies to this user, TJStatus.FALSE (0) otherwise
|
|
435
|
+
*/
|
|
436
|
+
@ReactMethod
|
|
437
|
+
fun getBelowConsentAge(promise: Promise) {
|
|
438
|
+
val getPrivacyPolicy = Tapjoy.getPrivacyPolicy()
|
|
439
|
+
if (getPrivacyPolicy == null) {
|
|
440
|
+
promise.reject("Get Below Consent Age Error", Exception("error"))
|
|
441
|
+
return
|
|
442
|
+
}
|
|
443
|
+
val belowConsentAge = getPrivacyPolicy.getBelowConsentAge()?.getValue() ?: TJStatus.UNKNOWN.getValue()
|
|
444
|
+
promise.resolve(belowConsentAge)
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
/**
|
|
448
|
+
* Returns configured GDPR value.
|
|
449
|
+
* The value should be returned to TRUE when User (Subject) is applicable to GDPR regulations
|
|
450
|
+
* and FALSE when User is not applicable to GDPR regulations.
|
|
451
|
+
*
|
|
452
|
+
* @return TJStatus.TRUE (1) if GDPR applies to this user, TJStatus.FALSE (0) otherwise
|
|
453
|
+
*/
|
|
454
|
+
@ReactMethod
|
|
455
|
+
fun getSubjectToGDPR(promise: Promise) {
|
|
456
|
+
val getPrivacyPolicy = Tapjoy.getPrivacyPolicy()
|
|
457
|
+
if (getPrivacyPolicy == null) {
|
|
458
|
+
promise.reject("Get Subject To GDPR Error", Exception("error"))
|
|
459
|
+
return
|
|
460
|
+
}
|
|
461
|
+
val isSubjectToGDPR = getPrivacyPolicy.getSubjectToGDPR()?.getValue() ?: TJStatus.UNKNOWN.getValue()
|
|
462
|
+
promise.resolve(isSubjectToGDPR)
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
/**
|
|
466
|
+
* Returns user's consent to behavioral advertising such as in the context of GDPR
|
|
467
|
+
* The consent value can be TJStatus.FALSE (0) (User has not provided consent), TJStatus.TRUE(1) (User has provided consent).
|
|
468
|
+
*
|
|
469
|
+
* @return The user consent value
|
|
470
|
+
*/
|
|
471
|
+
@ReactMethod
|
|
472
|
+
fun getUserConsent(promise: Promise) {
|
|
473
|
+
val getPrivacyPolicy = Tapjoy.getPrivacyPolicy()
|
|
474
|
+
if (getPrivacyPolicy == null) {
|
|
475
|
+
promise.reject("Get User Consent Error", Exception("error"))
|
|
476
|
+
return
|
|
477
|
+
}
|
|
478
|
+
val userConsent = getPrivacyPolicy.getUserConsent()?.getValue() ?: TJStatus.UNKNOWN.getValue()
|
|
479
|
+
promise.resolve(userConsent)
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
/**
|
|
483
|
+
* Returns US Privacy value to behavioral advertising such as in the context of CCPA
|
|
484
|
+
*
|
|
485
|
+
* @return The us privacy value string
|
|
486
|
+
*/
|
|
487
|
+
@ReactMethod
|
|
488
|
+
fun getUSPrivacy(promise: Promise) {
|
|
489
|
+
val privacyPolicy = Tapjoy.getPrivacyPolicy()
|
|
490
|
+
if (privacyPolicy != null) {
|
|
491
|
+
promise.resolve(privacyPolicy.getUSPrivacy() ?: "")
|
|
492
|
+
} else {
|
|
493
|
+
promise.reject("Get US Privacy Error", Exception("error"))
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
|
|
268
497
|
/**
|
|
269
498
|
* This method will set ad_tracking_enabled to false for Tapjoy which only shows the user contextual ads. No ad tracking will be done on this user.
|
|
270
499
|
*
|
|
271
500
|
* @param isBelowConsentAge true if below consent age (COPPA) applies to this user, false otherwise
|
|
272
501
|
*/
|
|
502
|
+
@Deprecated("Use setBelowConsentAgeStatus instead", ReplaceWith("setBelowConsentAgeStatus(isBelowConsentAgeStatus)"))
|
|
273
503
|
@ReactMethod
|
|
274
504
|
fun setBelowConsentAge(isBelowConsentAge: Boolean){
|
|
275
505
|
Tapjoy.getPrivacyPolicy().setBelowConsentAge(isBelowConsentAge)
|
|
276
506
|
}
|
|
507
|
+
|
|
508
|
+
/**
|
|
509
|
+
* This method will set ad_tracking_enabled to false for Tapjoy which only shows the user contextual ads. No ad tracking will be done on this user.
|
|
510
|
+
*
|
|
511
|
+
* @param isBelowConsentAge true (1) if below consent age (COPPA) applies to this user, false (0) otherwise
|
|
512
|
+
*/
|
|
513
|
+
@ReactMethod
|
|
514
|
+
fun setBelowConsentAgeStatus(isBelowConsentAgeStatus: Int) {
|
|
515
|
+
val status = TJStatus.values()[isBelowConsentAgeStatus]
|
|
516
|
+
Tapjoy.getPrivacyPolicy().setBelowConsentAge(status)
|
|
517
|
+
}
|
|
277
518
|
/**
|
|
278
519
|
* This is used for sending US Privacy value to behavioral advertising such as in the context of GDPR
|
|
279
|
-
*
|
|
520
|
+
*
|
|
280
521
|
* @param privacyValue The privacy value string eg. "1YNN" where 1 is char in string for the version, Y = YES, N = No, - = Not Applicable
|
|
281
522
|
*/
|
|
282
523
|
@ReactMethod
|
|
@@ -286,13 +527,29 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
|
|
|
286
527
|
|
|
287
528
|
/**
|
|
288
529
|
* This is used for sending User's consent to behavioral advertising such as in the context of GDPR
|
|
289
|
-
*
|
|
530
|
+
*
|
|
290
531
|
* @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
|
|
291
532
|
*/
|
|
533
|
+
@Deprecated("Use setUserConsentStatus instead", ReplaceWith("setUserConsentStatus(userConsentStatus)"))
|
|
292
534
|
@ReactMethod
|
|
293
535
|
fun setUserConsent(userConsent: String){
|
|
294
536
|
Tapjoy.getPrivacyPolicy().setUserConsent(userConsent)
|
|
295
537
|
}
|
|
538
|
+
/**
|
|
539
|
+
* This is used for sending User's consent to behavioral advertising such as in the context of GDPR
|
|
540
|
+
*
|
|
541
|
+
* @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
|
|
542
|
+
*/
|
|
543
|
+
@ReactMethod
|
|
544
|
+
fun setUserConsentStatus(userConsentStatus: Int) {
|
|
545
|
+
val status = TJStatus.values()[userConsentStatus]
|
|
546
|
+
Tapjoy.getPrivacyPolicy().setUserConsent(status)
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
@ReactMethod
|
|
550
|
+
fun optOutAdvertisingID(optOut: Boolean) {
|
|
551
|
+
Tapjoy.optOutAdvertisingID(this.currentActivity?.applicationContext, optOut)
|
|
552
|
+
}
|
|
296
553
|
|
|
297
554
|
private fun ReadableMap.toHashtable(): Hashtable<String, Any> {
|
|
298
555
|
val hashtable = Hashtable<String, Any>()
|
|
@@ -166,7 +166,9 @@ dependencies {
|
|
|
166
166
|
implementation jscFlavor
|
|
167
167
|
}
|
|
168
168
|
|
|
169
|
-
|
|
169
|
+
implementation 'com.google.android.gms:play-services-appset:16.0.2'
|
|
170
|
+
implementation 'com.tapjoy:tapjoy-android-sdk:13.2.0'
|
|
171
|
+
implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.8.0"))
|
|
170
172
|
}
|
|
171
173
|
|
|
172
174
|
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
|
|
@@ -8,3 +8,22 @@
|
|
|
8
8
|
# http://developer.android.com/guide/developing/tools/proguard.html
|
|
9
9
|
|
|
10
10
|
# Add any project specific keep options here:
|
|
11
|
+
|
|
12
|
+
# React Native
|
|
13
|
+
-keep class com.facebook.react.devsupport.** { *; }
|
|
14
|
+
-dontwarn com.facebook.react.devsupport.**
|
|
15
|
+
|
|
16
|
+
-keep class com.facebook.jni.** { *; }
|
|
17
|
+
-keep class com.facebook.flipper.** { *; }
|
|
18
|
+
|
|
19
|
+
-keep class com.facebook.hermes.unicode.** { *; }
|
|
20
|
+
-keep class com.facebook.jni.** { *; }
|
|
21
|
+
|
|
22
|
+
# Tapjoy
|
|
23
|
+
-keep public class com.tapjoy.* {
|
|
24
|
+
public *;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
-keepclassmembers public enum com.tapjoy.* {
|
|
28
|
+
public static final <fields>;
|
|
29
|
+
}
|
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
android:label="@string/app_name"
|
|
8
8
|
android:icon="@mipmap/ic_launcher"
|
|
9
9
|
android:allowBackup="false"
|
|
10
|
-
android:theme="@style/AppTheme"
|
|
10
|
+
android:theme="@style/AppTheme"
|
|
11
|
+
android:networkSecurityConfig="@xml/network_security_config">
|
|
11
12
|
<activity
|
|
12
13
|
android:name=".MainActivity"
|
|
13
14
|
android:label="@string/app_name"
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<network-security-config>
|
|
2
|
+
<debug-overrides>
|
|
3
|
+
<trust-anchors>
|
|
4
|
+
<!-- Trust user added CAs while debuggable only -->
|
|
5
|
+
<certificates src="user" />
|
|
6
|
+
</trust-anchors>
|
|
7
|
+
</debug-overrides>
|
|
8
|
+
<domain-config cleartextTrafficPermitted="true">
|
|
9
|
+
<domain includeSubdomains="true">127.0.0.1</domain>
|
|
10
|
+
<domain includeSubdomains="true">localhost</domain>
|
|
11
|
+
</domain-config>
|
|
12
|
+
</network-security-config>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
rootProject.name = 'TapjoyReactNativeSdkExample'
|
|
2
2
|
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
|
|
3
3
|
include ':app'
|
|
4
|
-
includeBuild('../node_modules
|
|
4
|
+
includeBuild('../node_modules/@react-native/gradle-plugin')
|
|
@@ -495,6 +495,7 @@
|
|
|
495
495
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
|
496
496
|
CLANG_ENABLE_MODULES = YES;
|
|
497
497
|
CURRENT_PROJECT_VERSION = 1;
|
|
498
|
+
DEVELOPMENT_TEAM = ECPZ2SRF59;
|
|
498
499
|
ENABLE_BITCODE = NO;
|
|
499
500
|
HEADER_SEARCH_PATHS = (
|
|
500
501
|
"$(inherited)",
|
|
@@ -552,7 +553,7 @@
|
|
|
552
553
|
"-ObjC",
|
|
553
554
|
"-lc++",
|
|
554
555
|
);
|
|
555
|
-
PRODUCT_BUNDLE_IDENTIFIER = com.tapjoy.reactnative;
|
|
556
|
+
PRODUCT_BUNDLE_IDENTIFIER = "com.tapjoy.reactnative-LLC";
|
|
556
557
|
PRODUCT_NAME = TapjoyReactNativeSdkExample;
|
|
557
558
|
RCT_NO_LAUNCH_PACKAGER = "";
|
|
558
559
|
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
|
|
@@ -574,6 +575,7 @@
|
|
|
574
575
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
|
575
576
|
CLANG_ENABLE_MODULES = YES;
|
|
576
577
|
CURRENT_PROJECT_VERSION = 1;
|
|
578
|
+
DEVELOPMENT_TEAM = ECPZ2SRF59;
|
|
577
579
|
HEADER_SEARCH_PATHS = (
|
|
578
580
|
"$(inherited)",
|
|
579
581
|
"\"${PODS_ROOT}/Headers/Public\"",
|
|
@@ -630,7 +632,7 @@
|
|
|
630
632
|
"-ObjC",
|
|
631
633
|
"-lc++",
|
|
632
634
|
);
|
|
633
|
-
PRODUCT_BUNDLE_IDENTIFIER = com.tapjoy.reactnative;
|
|
635
|
+
PRODUCT_BUNDLE_IDENTIFIER = "com.tapjoy.reactnative-LLC";
|
|
634
636
|
PRODUCT_NAME = TapjoyReactNativeSdkExample;
|
|
635
637
|
RCT_NO_LAUNCH_PACKAGER = 1;
|
|
636
638
|
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
|
|
@@ -684,6 +686,7 @@
|
|
|
684
686
|
GCC_PREPROCESSOR_DEFINITIONS = (
|
|
685
687
|
"DEBUG=1",
|
|
686
688
|
"$(inherited)",
|
|
689
|
+
_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION,
|
|
687
690
|
);
|
|
688
691
|
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
|
689
692
|
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
|
@@ -704,12 +707,14 @@
|
|
|
704
707
|
);
|
|
705
708
|
MTL_ENABLE_DEBUG_INFO = YES;
|
|
706
709
|
ONLY_ACTIVE_ARCH = YES;
|
|
710
|
+
OTHER_CFLAGS = "$(inherited)";
|
|
707
711
|
OTHER_CPLUSPLUSFLAGS = (
|
|
708
712
|
"$(OTHER_CFLAGS)",
|
|
709
713
|
"-DFOLLY_NO_CONFIG",
|
|
710
714
|
"-DFOLLY_MOBILE=1",
|
|
711
715
|
"-DFOLLY_USE_LIBCPP=1",
|
|
712
716
|
);
|
|
717
|
+
OTHER_LDFLAGS = "$(inherited)";
|
|
713
718
|
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
|
|
714
719
|
SDKROOT = iphoneos;
|
|
715
720
|
TARGETED_DEVICE_FAMILY = "1,2";
|
|
@@ -752,6 +757,10 @@
|
|
|
752
757
|
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = i386;
|
|
753
758
|
GCC_C_LANGUAGE_STANDARD = gnu99;
|
|
754
759
|
GCC_NO_COMMON_BLOCKS = YES;
|
|
760
|
+
GCC_PREPROCESSOR_DEFINITIONS = (
|
|
761
|
+
"$(inherited)",
|
|
762
|
+
_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION,
|
|
763
|
+
);
|
|
755
764
|
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
|
756
765
|
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
|
757
766
|
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
|
@@ -769,12 +778,17 @@
|
|
|
769
778
|
"\"$(inherited)\"",
|
|
770
779
|
);
|
|
771
780
|
MTL_ENABLE_DEBUG_INFO = NO;
|
|
781
|
+
OTHER_CFLAGS = "$(inherited)";
|
|
772
782
|
OTHER_CPLUSPLUSFLAGS = (
|
|
773
783
|
"$(OTHER_CFLAGS)",
|
|
774
784
|
"-DFOLLY_NO_CONFIG",
|
|
775
785
|
"-DFOLLY_MOBILE=1",
|
|
776
786
|
"-DFOLLY_USE_LIBCPP=1",
|
|
777
787
|
);
|
|
788
|
+
OTHER_LDFLAGS = (
|
|
789
|
+
"$(inherited)",
|
|
790
|
+
" ",
|
|
791
|
+
);
|
|
778
792
|
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
|
|
779
793
|
SDKROOT = iphoneos;
|
|
780
794
|
TARGETED_DEVICE_FAMILY = "1,2";
|
package/example/metro.config.js
CHANGED
|
@@ -2,6 +2,7 @@ const path = require('path');
|
|
|
2
2
|
const escape = require('escape-string-regexp');
|
|
3
3
|
const exclusionList = require('metro-config/src/defaults/exclusionList');
|
|
4
4
|
const pak = require('../package.json');
|
|
5
|
+
const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config');
|
|
5
6
|
|
|
6
7
|
const root = path.resolve(__dirname, '..');
|
|
7
8
|
|
|
@@ -9,7 +10,14 @@ const modules = Object.keys({
|
|
|
9
10
|
...pak.peerDependencies,
|
|
10
11
|
});
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Metro configuration
|
|
15
|
+
* https://facebook.github.io/metro/docs/configuration
|
|
16
|
+
*
|
|
17
|
+
* @type {import('metro-config').MetroConfig}
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
module.exports = mergeConfig(getDefaultConfig(__dirname), {
|
|
13
21
|
projectRoot: __dirname,
|
|
14
22
|
watchFolders: [root],
|
|
15
23
|
|
|
@@ -37,4 +45,4 @@ module.exports = {
|
|
|
37
45
|
},
|
|
38
46
|
}),
|
|
39
47
|
},
|
|
40
|
-
};
|
|
48
|
+
});
|
package/example/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "TapjoyReactNativeSdkExample",
|
|
3
|
-
"version": "13.0
|
|
3
|
+
"version": "13.2.0",
|
|
4
4
|
"private": true,
|
|
5
5
|
"scripts": {
|
|
6
6
|
"android": "react-native run-android",
|
|
@@ -11,12 +11,15 @@
|
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@react-native-async-storage/async-storage": "^1.17.12",
|
|
13
13
|
"@react-native-community/masked-view": "^0.1.11",
|
|
14
|
+
"@react-native-picker/picker": "^2.5.0",
|
|
14
15
|
"@react-navigation/bottom-tabs": "^6.5.7",
|
|
15
16
|
"@react-navigation/native": "^6.1.6",
|
|
17
|
+
"dayjs": "^1.11.10",
|
|
16
18
|
"react": "18.2.0",
|
|
17
|
-
"react-native": "0.
|
|
19
|
+
"react-native": "0.72.5",
|
|
18
20
|
"react-native-gesture-handler": "^2.9.0",
|
|
19
|
-
"react-native-
|
|
21
|
+
"react-native-picker-select": "^8.0.4",
|
|
22
|
+
"react-native-reanimated": "^3.4.2",
|
|
20
23
|
"react-native-safe-area-context": "^4.5.0",
|
|
21
24
|
"react-native-screens": "^3.20.0",
|
|
22
25
|
"react-native-tracking-transparency": "^0.1.2",
|
|
@@ -27,6 +30,7 @@
|
|
|
27
30
|
"@babel/preset-env": "^7.20.0",
|
|
28
31
|
"@babel/runtime": "^7.20.0",
|
|
29
32
|
"babel-plugin-module-resolver": "^4.1.0",
|
|
33
|
+
"@react-native/metro-config": "^0.72.11",
|
|
30
34
|
"metro-react-native-babel-preset": "0.73.8"
|
|
31
35
|
}
|
|
32
36
|
}
|