tapjoy-react-native-sdk 13.2.1 → 13.4.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/CODEOWNERS +1 -0
- package/android/build.gradle +5 -6
- package/android/gradle.properties +5 -5
- package/android/src/main/java/com/tapjoyreactnativesdk/TJOfferwallDiscoverNativeView.kt +90 -0
- package/android/src/main/java/com/tapjoyreactnativesdk/TJOfferwallDiscoverNativeViewManager.kt +50 -0
- package/android/src/main/java/com/tapjoyreactnativesdk/TapjoyReactNativeSdkModule.kt +73 -2
- package/android/src/main/java/com/tapjoyreactnativesdk/TapjoyReactNativeSdkPackage.kt +1 -3
- package/example/Gemfile +7 -0
- package/example/android/app/build.gradle +10 -61
- package/example/android/app/src/debug/AndroidManifest.xml +1 -5
- package/example/android/app/src/main/AndroidManifest.xml +2 -2
- package/example/android/app/src/main/java/com/tapjoyreactnativesdkexample/MainActivity.kt +22 -0
- package/example/android/app/src/main/java/com/tapjoyreactnativesdkexample/MainApplication.kt +45 -0
- package/example/android/app/src/main/res/xml/network_security_config.xml +2 -0
- package/example/android/build.gradle +9 -9
- package/example/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/example/android/gradle/wrapper/gradle-wrapper.properties +4 -2
- package/example/android/gradle.properties +0 -3
- package/example/android/gradlew +24 -9
- package/example/babel.config.js +1 -1
- package/example/ios/Podfile +0 -9
- package/example/ios/TapjoyReactNativeSdkExample/AppDelegate.mm +6 -11
- package/example/ios/TapjoyReactNativeSdkExample/Info.plist +9 -13
- package/example/ios/TapjoyReactNativeSdkExample.xcodeproj/project.pbxproj +18 -8
- package/example/package.json +21 -18
- package/example/src/App.tsx +2 -0
- package/example/src/MainScreen.tsx +26 -7
- package/example/src/OfferwallDiscoverScreen.tsx +193 -0
- package/example/src/OfferwallScreen.tsx +1 -1
- package/example/src/Styles.ts +23 -1
- package/example/src/UserProperties.tsx +43 -0
- package/ios/TJOfferwallDiscoverNativeViewManager.m +10 -0
- package/ios/TJOfferwallDiscoverNativeViewManager.swift +81 -0
- package/ios/TapjoyOfferwallDiscoverNativeView.swift +23 -0
- package/ios/TapjoyReactNativeSdk-Bridging-Header.h +1 -0
- package/ios/TapjoyReactNativeSdk.m +5 -0
- package/ios/TapjoyReactNativeSdk.swift +65 -1
- package/ios/TapjoyReactNativeSdk.xcodeproj/project.pbxproj +10 -4
- package/package.json +24 -24
- package/src/TJConnect.ts +5 -0
- package/src/TJOfferwallDiscoverView.tsx +57 -0
- package/src/TJUtil.ts +14 -0
- package/src/TJVersion.ts +1 -1
- package/src/index.ts +12 -1
- package/tapjoy-react-native-sdk.podspec +1 -1
- package/example/android/app/src/debug/java/com/tapjoyreactnativesdkexample/ReactNativeFlipper.java +0 -75
- package/example/android/app/src/main/java/com/tapjoyreactnativesdkexample/MainActivity.java +0 -35
- package/example/android/app/src/main/java/com/tapjoyreactnativesdkexample/MainApplication.java +0 -62
- package/example/android/app/src/release/java/com/tapjoyreactnativesdkexample/ReactNativeFlipper.java +0 -20
- package/lib/commonjs/TJEntryPoint.js +0 -22
- package/lib/commonjs/TJEntryPoint.js.map +0 -1
- package/lib/commonjs/TJPlacement.js +0 -149
- package/lib/commonjs/TJPlacement.js.map +0 -1
- package/lib/commonjs/TJPrivacyPolicy.js +0 -77
- package/lib/commonjs/TJPrivacyPolicy.js.map +0 -1
- package/lib/commonjs/TJSegment.js +0 -16
- package/lib/commonjs/TJSegment.js.map +0 -1
- package/lib/commonjs/TJStatus.js +0 -15
- package/lib/commonjs/TJStatus.js.map +0 -1
- package/lib/commonjs/TJVersion.js +0 -22
- package/lib/commonjs/TJVersion.js.map +0 -1
- package/lib/commonjs/index.js +0 -56
- package/lib/commonjs/index.js.map +0 -1
- package/lib/module/TJEntryPoint.js +0 -15
- package/lib/module/TJEntryPoint.js.map +0 -1
- package/lib/module/TJPlacement.js +0 -141
- package/lib/module/TJPlacement.js.map +0 -1
- package/lib/module/TJPrivacyPolicy.js +0 -70
- package/lib/module/TJPrivacyPolicy.js.map +0 -1
- package/lib/module/TJSegment.js +0 -9
- package/lib/module/TJSegment.js.map +0 -1
- package/lib/module/TJStatus.js +0 -8
- package/lib/module/TJStatus.js.map +0 -1
- package/lib/module/TJVersion.js +0 -14
- package/lib/module/TJVersion.js.map +0 -1
- package/lib/module/index.js +0 -18
- package/lib/module/index.js.map +0 -1
- package/lib/typescript/TJEntryPoint.d.ts +0 -14
- package/lib/typescript/TJEntryPoint.d.ts.map +0 -1
- package/lib/typescript/TJPlacement.d.ts +0 -76
- package/lib/typescript/TJPlacement.d.ts.map +0 -1
- package/lib/typescript/TJPrivacyPolicy.d.ts +0 -17
- package/lib/typescript/TJPrivacyPolicy.d.ts.map +0 -1
- package/lib/typescript/TJSegment.d.ts +0 -8
- package/lib/typescript/TJSegment.d.ts.map +0 -1
- package/lib/typescript/TJStatus.d.ts +0 -7
- package/lib/typescript/TJStatus.d.ts.map +0 -1
- package/lib/typescript/TJVersion.d.ts +0 -5
- package/lib/typescript/TJVersion.d.ts.map +0 -1
- package/lib/typescript/index.d.ts +0 -9
- package/lib/typescript/index.d.ts.map +0 -1
package/CODEOWNERS
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
* @Tapjoy/sdk
|
package/android/build.gradle
CHANGED
|
@@ -8,7 +8,7 @@ buildscript {
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
dependencies {
|
|
11
|
-
classpath "com.android.tools.build:gradle:
|
|
11
|
+
classpath "com.android.tools.build:gradle:8.1.2"
|
|
12
12
|
// noinspection DifferentKotlinGradleVersion
|
|
13
13
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
|
14
14
|
classpath "com.facebook.react:react-native-gradle-plugin"
|
|
@@ -22,7 +22,6 @@ def isNewArchitectureEnabled() {
|
|
|
22
22
|
apply plugin: "com.android.library"
|
|
23
23
|
apply plugin: "kotlin-android"
|
|
24
24
|
|
|
25
|
-
|
|
26
25
|
def appProject = rootProject.allprojects.find { it.plugins.hasPlugin('com.android.application') }
|
|
27
26
|
|
|
28
27
|
if (isNewArchitectureEnabled()) {
|
|
@@ -59,8 +58,8 @@ android {
|
|
|
59
58
|
}
|
|
60
59
|
|
|
61
60
|
compileOptions {
|
|
62
|
-
sourceCompatibility JavaVersion.
|
|
63
|
-
targetCompatibility JavaVersion.
|
|
61
|
+
sourceCompatibility JavaVersion.VERSION_17
|
|
62
|
+
targetCompatibility JavaVersion.VERSION_17
|
|
64
63
|
}
|
|
65
64
|
|
|
66
65
|
}
|
|
@@ -80,9 +79,9 @@ dependencies {
|
|
|
80
79
|
// For < 0.71, this will be from the local maven repo
|
|
81
80
|
// For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
|
|
82
81
|
//noinspection GradleDynamicVersion
|
|
83
|
-
implementation 'com.facebook.react:react-native:0.
|
|
82
|
+
implementation 'com.facebook.react:react-native:0.73.2'
|
|
84
83
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
85
|
-
implementation 'com.tapjoy:tapjoy-android-sdk:13.
|
|
84
|
+
implementation 'com.tapjoy:tapjoy-android-sdk:13.4.0'
|
|
86
85
|
implementation "com.google.android.gms:play-services-ads-identifier:18.0.1"
|
|
87
86
|
}
|
|
88
87
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
TapjoyReactNativeSdk_kotlinVersion=1.
|
|
1
|
+
TapjoyReactNativeSdk_kotlinVersion=1.8.0
|
|
2
2
|
TapjoyReactNativeSdk_minSdkVersion=21
|
|
3
|
-
TapjoyReactNativeSdk_targetSdkVersion=
|
|
4
|
-
TapjoyReactNativeSdk_compileSdkVersion=
|
|
5
|
-
TapjoyReactNativeSdk_ndkversion=
|
|
6
|
-
android.useAndroidX=true
|
|
3
|
+
TapjoyReactNativeSdk_targetSdkVersion=34
|
|
4
|
+
TapjoyReactNativeSdk_compileSdkVersion=34
|
|
5
|
+
TapjoyReactNativeSdk_ndkversion=25.1.8937393
|
|
6
|
+
android.useAndroidX=true
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
package com.tapjoyreactnativesdk
|
|
2
|
+
|
|
3
|
+
import android.content.Context
|
|
4
|
+
import android.util.AttributeSet
|
|
5
|
+
import com.facebook.react.bridge.Arguments
|
|
6
|
+
import com.facebook.react.bridge.ReactContext
|
|
7
|
+
import com.facebook.react.bridge.WritableMap
|
|
8
|
+
import com.facebook.react.uimanager.UIManagerHelper
|
|
9
|
+
import com.tapjoy.TJError
|
|
10
|
+
import com.tapjoy.TJOfferwallDiscoverListener
|
|
11
|
+
import com.tapjoy.TJOfferwallDiscoverView
|
|
12
|
+
import com.facebook.react.uimanager.events.Event
|
|
13
|
+
|
|
14
|
+
class TJOfferwallDiscoverNativeView : TJOfferwallDiscoverView, TJOfferwallDiscoverListener {
|
|
15
|
+
|
|
16
|
+
constructor(context: Context) : super(context)
|
|
17
|
+
|
|
18
|
+
constructor(context: Context, attrs: AttributeSet) : super(context, attrs)
|
|
19
|
+
|
|
20
|
+
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr)
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Request OfferwallDiscover content.
|
|
24
|
+
*
|
|
25
|
+
* @Param placement: Placement name.
|
|
26
|
+
*/
|
|
27
|
+
fun requestContent(placement: String) {
|
|
28
|
+
super.setListener(this)
|
|
29
|
+
super.requestContent(context, placement)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// TJOfferwallDiscoverListener implementation.
|
|
33
|
+
private fun sendEvent(event: Event<*>) {
|
|
34
|
+
val reactContext = context as ReactContext
|
|
35
|
+
UIManagerHelper
|
|
36
|
+
.getEventDispatcherForReactTag(reactContext, id)
|
|
37
|
+
?.dispatchEvent(event)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
override fun requestSuccess() {
|
|
41
|
+
val data = Arguments.createMap().apply {
|
|
42
|
+
putString("result", "requestSuccess")
|
|
43
|
+
}
|
|
44
|
+
sendEvent(OfferwallDiscoverEvent(UIManagerHelper.getSurfaceId(this), id, "onRequestSuccess", data))
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
override fun requestFailure(error: TJError) {
|
|
48
|
+
val data = Arguments.createMap().apply {
|
|
49
|
+
putInt("errorCode", error.code)
|
|
50
|
+
putString("errorMessage", error.message)
|
|
51
|
+
}
|
|
52
|
+
sendEvent(OfferwallDiscoverEvent(UIManagerHelper.getSurfaceId(this), id, "onRequestFailure", data))
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
override fun contentReady() {
|
|
56
|
+
val data = Arguments.createMap().apply {
|
|
57
|
+
putString("result", "contentReady")
|
|
58
|
+
}
|
|
59
|
+
sendEvent(OfferwallDiscoverEvent(UIManagerHelper.getSurfaceId(this), id, "onContentReady", data))
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
override fun contentError(error: TJError) {
|
|
63
|
+
val data = Arguments.createMap().apply {
|
|
64
|
+
putInt("errorCode", error.code)
|
|
65
|
+
putString("errorMessage", error.message)
|
|
66
|
+
}
|
|
67
|
+
sendEvent(OfferwallDiscoverEvent(UIManagerHelper.getSurfaceId(this), id, "onContentError", data))
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
override fun requestLayout() {
|
|
71
|
+
super.requestLayout()
|
|
72
|
+
post(measureAndLayout)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
private val measureAndLayout = Runnable {
|
|
76
|
+
measure(MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY),
|
|
77
|
+
MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY))
|
|
78
|
+
layout(left, top, right, bottom)
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
class OfferwallDiscoverEvent(surfaceId: Int, viewId: Int, private val eventName: String, private val data: WritableMap) : Event<OfferwallDiscoverEvent>(surfaceId, viewId) {
|
|
83
|
+
override fun getEventName() = eventName
|
|
84
|
+
|
|
85
|
+
// All events for a given view can be coalesced.
|
|
86
|
+
override fun getCoalescingKey(): Short = 0
|
|
87
|
+
|
|
88
|
+
override fun getEventData(): WritableMap? = data
|
|
89
|
+
|
|
90
|
+
}
|
package/android/src/main/java/com/tapjoyreactnativesdk/TJOfferwallDiscoverNativeViewManager.kt
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
package com.tapjoyreactnativesdk
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
4
|
+
import com.facebook.react.bridge.ReadableArray
|
|
5
|
+
import com.facebook.react.common.MapBuilder
|
|
6
|
+
import com.facebook.react.uimanager.SimpleViewManager
|
|
7
|
+
import com.facebook.react.uimanager.ThemedReactContext
|
|
8
|
+
|
|
9
|
+
enum class Command(private val value:String) {
|
|
10
|
+
REQUEST_CONTENT("requestContent"),
|
|
11
|
+
CLEAR_CONTENT("clearContent");
|
|
12
|
+
|
|
13
|
+
fun getValue(): String {
|
|
14
|
+
return value
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
class TJOfferwallDiscoverNativeViewManager(
|
|
19
|
+
private val callerContext: ReactApplicationContext
|
|
20
|
+
) : SimpleViewManager<TJOfferwallDiscoverNativeView>() {
|
|
21
|
+
|
|
22
|
+
var view: TJOfferwallDiscoverNativeView? = null;
|
|
23
|
+
override fun getName() = REACT_CLASS
|
|
24
|
+
|
|
25
|
+
companion object {
|
|
26
|
+
const val REACT_CLASS = "TJOfferwallDiscoverNativeView"
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
override fun createViewInstance(context: ThemedReactContext): TJOfferwallDiscoverNativeView {
|
|
30
|
+
return TJOfferwallDiscoverNativeView(context)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
override fun receiveCommand(view: TJOfferwallDiscoverNativeView, commandId: String, args: ReadableArray?) {
|
|
34
|
+
super.receiveCommand(view, commandId, args)
|
|
35
|
+
if (commandId == Command.REQUEST_CONTENT.getValue()) {
|
|
36
|
+
view.requestContent(args!!.getString(0))
|
|
37
|
+
} else if (commandId == Command.CLEAR_CONTENT.getValue()) {
|
|
38
|
+
view.clearContent()
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
override fun getExportedCustomDirectEventTypeConstants(): Map<String, Any?>? {
|
|
43
|
+
return MapBuilder.of<String, Any?>(
|
|
44
|
+
"onRequestSuccess", MapBuilder.of("registrationName", "onRequestSuccess"),
|
|
45
|
+
"onRequestFailure", MapBuilder.of("registrationName", "onRequestFailure"),
|
|
46
|
+
"onContentReady", MapBuilder.of("registrationName", "onContentReady"),
|
|
47
|
+
"onContentError", MapBuilder.of("registrationName", "onContentError")
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -7,7 +7,6 @@ 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.TapjoyConnectCore
|
|
11
10
|
import com.tapjoy.TJError;
|
|
12
11
|
import com.tapjoy.TJPlacement;
|
|
13
12
|
import com.tapjoy.TJActionRequest;
|
|
@@ -17,6 +16,7 @@ import com.tapjoy.TJSetCurrencyAmountRequiredListener;
|
|
|
17
16
|
import com.tapjoy.TJStatus;
|
|
18
17
|
import com.tapjoy.TJPrivacyPolicy;
|
|
19
18
|
import com.tapjoy.TJSegment;
|
|
19
|
+
import com.tapjoy.TapjoyPluginAPI;
|
|
20
20
|
import com.tapjoy.TJEntryPoint
|
|
21
21
|
import java.util.Hashtable
|
|
22
22
|
import kotlin.collections.HashMap
|
|
@@ -70,7 +70,7 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
|
|
|
70
70
|
*/
|
|
71
71
|
@ReactMethod
|
|
72
72
|
fun connect(sdkKey: String, connectFlags: ReadableMap, promise: Promise) {
|
|
73
|
-
|
|
73
|
+
TapjoyPluginAPI.setPlugin("ReactNative");
|
|
74
74
|
|
|
75
75
|
Tapjoy.connect(this.currentActivity?.applicationContext, sdkKey, connectFlags.toHashtable(), object : TJConnectListener() {
|
|
76
76
|
override fun onConnectSuccess() {
|
|
@@ -81,6 +81,15 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
|
|
|
81
81
|
override fun onConnectFailure(code: Int, message: String) {
|
|
82
82
|
promise.reject(code.toString(), message, Exception(message))
|
|
83
83
|
}
|
|
84
|
+
|
|
85
|
+
override fun onConnectWarning(code: Int, message: String) {
|
|
86
|
+
val parameters = Arguments.createMap().apply {
|
|
87
|
+
putString("name", "onConnectWarning")
|
|
88
|
+
putString("code", code.toString())
|
|
89
|
+
putString("message", message)
|
|
90
|
+
}
|
|
91
|
+
sendEvent("Tapjoy", parameters)
|
|
92
|
+
}
|
|
84
93
|
})
|
|
85
94
|
}
|
|
86
95
|
|
|
@@ -187,6 +196,67 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
|
|
|
187
196
|
Tapjoy.setMaxLevel(maxLevel);
|
|
188
197
|
}
|
|
189
198
|
|
|
199
|
+
/**
|
|
200
|
+
* Returns a String set which contains tags on the user.
|
|
201
|
+
*
|
|
202
|
+
* @return list of user tags
|
|
203
|
+
*/
|
|
204
|
+
@ReactMethod
|
|
205
|
+
fun getUserTags(promise: Promise) {
|
|
206
|
+
val tags = Tapjoy.getUserTags()
|
|
207
|
+
val tagsArray: WritableArray = Arguments.createArray()
|
|
208
|
+
|
|
209
|
+
tags.forEach { tag ->
|
|
210
|
+
tagsArray.pushString(tag.toString())
|
|
211
|
+
}
|
|
212
|
+
promise.resolve(tagsArray)
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Sets tags for the user.
|
|
217
|
+
*
|
|
218
|
+
* @param tags
|
|
219
|
+
* the tags to be set
|
|
220
|
+
*/
|
|
221
|
+
@ReactMethod
|
|
222
|
+
fun setUserTags(tags: ReadableArray) {
|
|
223
|
+
val tagsSet: Set<String> = (0 until tags.size())
|
|
224
|
+
.mapNotNull { tags.getString(it) }
|
|
225
|
+
.toSet()
|
|
226
|
+
Tapjoy.setUserTags(tagsSet)
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Removes all tags from the user.
|
|
231
|
+
*/
|
|
232
|
+
@ReactMethod
|
|
233
|
+
fun clearUserTags() {
|
|
234
|
+
Tapjoy.clearUserTags()
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Adds the given tag to the user if it is not already present.
|
|
239
|
+
*
|
|
240
|
+
* @param tag
|
|
241
|
+
* the tag to be added
|
|
242
|
+
*/
|
|
243
|
+
@ReactMethod
|
|
244
|
+
fun addUserTag(tag: String) {
|
|
245
|
+
Tapjoy.addUserTag(tag)
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* Removes the given tag from the user if it is present.
|
|
250
|
+
*
|
|
251
|
+
* @param tag
|
|
252
|
+
* the tag to be removed
|
|
253
|
+
*/
|
|
254
|
+
@ReactMethod
|
|
255
|
+
fun removeUserTag(tag: String) {
|
|
256
|
+
Tapjoy.removeUserTag(tag)
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
|
|
190
260
|
@ReactMethod
|
|
191
261
|
fun setDebugEnabled(enabled: Boolean) {
|
|
192
262
|
Tapjoy.setDebugEnabled(enabled)
|
|
@@ -260,6 +330,7 @@ class TapjoyReactNativeSdkModule(reactContext: ReactApplicationContext) :
|
|
|
260
330
|
|
|
261
331
|
}
|
|
262
332
|
}
|
|
333
|
+
Tapjoy.setActivity(this.currentActivity)
|
|
263
334
|
val placement = Tapjoy.getPlacement(placementName, listener)
|
|
264
335
|
placements[placementName] = placement
|
|
265
336
|
}
|
|
@@ -10,7 +10,5 @@ class TapjoyReactNativeSdkPackage : ReactPackage {
|
|
|
10
10
|
return listOf(TapjoyReactNativeSdkModule(reactContext))
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>>
|
|
14
|
-
return emptyList()
|
|
15
|
-
}
|
|
13
|
+
override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> = listOf(TJOfferwallDiscoverNativeViewManager(reactContext))
|
|
16
14
|
}
|
package/example/Gemfile
ADDED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
apply plugin: "com.android.application"
|
|
2
2
|
apply plugin: "com.facebook.react"
|
|
3
|
-
|
|
4
|
-
import com.android.build.OutputFile
|
|
3
|
+
apply plugin: "org.jetbrains.kotlin.android"
|
|
5
4
|
|
|
6
5
|
/**
|
|
7
6
|
* This is the configuration block to customize your React Native Android app.
|
|
@@ -13,8 +12,8 @@ react {
|
|
|
13
12
|
// root = file("../")
|
|
14
13
|
// The folder where the react-native NPM package is. Default is ../node_modules/react-native
|
|
15
14
|
// reactNativeDir = file("../node_modules/react-native")
|
|
16
|
-
// The folder where the react-native Codegen package is. Default is ../node_modules
|
|
17
|
-
// codegenDir = file("../node_modules
|
|
15
|
+
// The folder where the react-native Codegen package is. Default is ../node_modules/@react-native/codegen
|
|
16
|
+
// codegenDir = file("../node_modules/@react-native/codegen")
|
|
18
17
|
// The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js
|
|
19
18
|
// cliFile = file("../node_modules/react-native/cli.js")
|
|
20
19
|
|
|
@@ -52,14 +51,6 @@ react {
|
|
|
52
51
|
// hermesFlags = ["-O", "-output-source-map"]
|
|
53
52
|
}
|
|
54
53
|
|
|
55
|
-
/**
|
|
56
|
-
* Set this to true to create four separate APKs instead of one,
|
|
57
|
-
* one for each native architecture. This is useful if you don't
|
|
58
|
-
* use App Bundles (https://developer.android.com/guide/app-bundle/)
|
|
59
|
-
* and want to have separate APKs to upload to the Play Store.
|
|
60
|
-
*/
|
|
61
|
-
def enableSeparateBuildPerCPUArchitecture = false
|
|
62
|
-
|
|
63
54
|
/**
|
|
64
55
|
* Set this to true to Run Proguard on Release builds to minify the Java bytecode.
|
|
65
56
|
*/
|
|
@@ -78,20 +69,10 @@ def enableProguardInReleaseBuilds = false
|
|
|
78
69
|
*/
|
|
79
70
|
def jscFlavor = 'org.webkit:android-jsc:+'
|
|
80
71
|
|
|
81
|
-
/**
|
|
82
|
-
* Private function to get the list of Native Architectures you want to build.
|
|
83
|
-
* This reads the value from reactNativeArchitectures in your gradle.properties
|
|
84
|
-
* file and works together with the --active-arch-only flag of react-native run-android.
|
|
85
|
-
*/
|
|
86
|
-
def reactNativeArchitectures() {
|
|
87
|
-
def value = project.getProperties().get("reactNativeArchitectures")
|
|
88
|
-
return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
|
|
89
|
-
}
|
|
90
|
-
|
|
91
72
|
android {
|
|
92
73
|
ndkVersion rootProject.ext.ndkVersion
|
|
93
|
-
|
|
94
|
-
|
|
74
|
+
buildToolsVersion rootProject.ext.buildToolsVersion
|
|
75
|
+
compileSdk rootProject.ext.compileSdkVersion
|
|
95
76
|
|
|
96
77
|
namespace "com.tapjoyreactnativesdkexample"
|
|
97
78
|
defaultConfig {
|
|
@@ -101,15 +82,6 @@ android {
|
|
|
101
82
|
versionCode 1
|
|
102
83
|
versionName "1.0"
|
|
103
84
|
}
|
|
104
|
-
|
|
105
|
-
splits {
|
|
106
|
-
abi {
|
|
107
|
-
reset()
|
|
108
|
-
enable enableSeparateBuildPerCPUArchitecture
|
|
109
|
-
universalApk false // If true, also generate a universal APK
|
|
110
|
-
include (*reactNativeArchitectures())
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
85
|
signingConfigs {
|
|
114
86
|
debug {
|
|
115
87
|
storeFile file('debug.keystore')
|
|
@@ -130,36 +102,13 @@ android {
|
|
|
130
102
|
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
|
|
131
103
|
}
|
|
132
104
|
}
|
|
133
|
-
|
|
134
|
-
// applicationVariants are e.g. debug, release
|
|
135
|
-
applicationVariants.all { variant ->
|
|
136
|
-
variant.outputs.each { output ->
|
|
137
|
-
// For each separate APK per architecture, set a unique version code as described here:
|
|
138
|
-
// https://developer.android.com/studio/build/configure-apk-splits.html
|
|
139
|
-
// Example: versionCode 1 will generate 1001 for armeabi-v7a, 1002 for x86, etc.
|
|
140
|
-
def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
|
|
141
|
-
def abi = output.getFilter(OutputFile.ABI)
|
|
142
|
-
if (abi != null) { // null for the universal-debug, universal-release variants
|
|
143
|
-
output.versionCodeOverride =
|
|
144
|
-
defaultConfig.versionCode * 1000 + versionCodes.get(abi)
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
105
|
}
|
|
150
106
|
|
|
151
107
|
dependencies {
|
|
152
108
|
// The version of react-native is set by the React Native Gradle Plugin
|
|
153
|
-
implementation("com.facebook.react:react-android")
|
|
154
|
-
|
|
155
|
-
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.0.0")
|
|
109
|
+
implementation("com.facebook.react:react-android:")
|
|
110
|
+
implementation("com.facebook.react:flipper-integration")
|
|
156
111
|
|
|
157
|
-
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}")
|
|
158
|
-
debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
|
|
159
|
-
exclude group:'com.squareup.okhttp3', module:'okhttp'
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}")
|
|
163
112
|
if (hermesEnabled.toBoolean()) {
|
|
164
113
|
implementation("com.facebook.react:hermes-android")
|
|
165
114
|
} else {
|
|
@@ -167,8 +116,8 @@ dependencies {
|
|
|
167
116
|
}
|
|
168
117
|
|
|
169
118
|
implementation 'com.google.android.gms:play-services-appset:16.0.2'
|
|
170
|
-
implementation 'com.tapjoy:tapjoy-android-sdk:13.
|
|
171
|
-
|
|
119
|
+
implementation 'com.tapjoy:tapjoy-android-sdk:13.4.0'
|
|
120
|
+
|
|
172
121
|
}
|
|
173
122
|
|
|
174
|
-
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
|
|
123
|
+
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
|
|
@@ -2,12 +2,8 @@
|
|
|
2
2
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
|
3
3
|
xmlns:tools="http://schemas.android.com/tools">
|
|
4
4
|
|
|
5
|
-
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
|
|
6
|
-
|
|
7
5
|
<application
|
|
8
6
|
android:usesCleartextTraffic="true"
|
|
9
7
|
tools:targetApi="28"
|
|
10
|
-
tools:ignore="GoogleAppIndexingWarning"
|
|
11
|
-
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" android:exported="false" />
|
|
12
|
-
</application>
|
|
8
|
+
tools:ignore="GoogleAppIndexingWarning"/>
|
|
13
9
|
</manifest>
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
android:label="@string/app_name"
|
|
8
8
|
android:icon="@mipmap/ic_launcher"
|
|
9
9
|
android:allowBackup="false"
|
|
10
|
-
android:
|
|
11
|
-
android:
|
|
10
|
+
android:networkSecurityConfig="@xml/network_security_config"
|
|
11
|
+
android:theme="@style/AppTheme">
|
|
12
12
|
<activity
|
|
13
13
|
android:name=".MainActivity"
|
|
14
14
|
android:label="@string/app_name"
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
package com.tapjoyreactnativesdkexample
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.ReactActivity
|
|
4
|
+
import com.facebook.react.ReactActivityDelegate
|
|
5
|
+
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled
|
|
6
|
+
import com.facebook.react.defaults.DefaultReactActivityDelegate
|
|
7
|
+
|
|
8
|
+
class MainActivity : ReactActivity() {
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Returns the name of the main component registered from JavaScript. This is used to schedule
|
|
12
|
+
* rendering of the component.
|
|
13
|
+
*/
|
|
14
|
+
override fun getMainComponentName(): String = "TapjoyReactNativeSdkExample"
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate]
|
|
18
|
+
* which allows you to enable New Architecture with a single boolean flags [fabricEnabled]
|
|
19
|
+
*/
|
|
20
|
+
override fun createReactActivityDelegate(): ReactActivityDelegate =
|
|
21
|
+
DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled)
|
|
22
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
package com.tapjoyreactnativesdkexample
|
|
2
|
+
|
|
3
|
+
import android.app.Application
|
|
4
|
+
import com.facebook.react.PackageList
|
|
5
|
+
import com.facebook.react.ReactApplication
|
|
6
|
+
import com.facebook.react.ReactHost
|
|
7
|
+
import com.facebook.react.ReactNativeHost
|
|
8
|
+
import com.facebook.react.ReactPackage
|
|
9
|
+
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load
|
|
10
|
+
import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost
|
|
11
|
+
import com.facebook.react.defaults.DefaultReactNativeHost
|
|
12
|
+
import com.facebook.react.flipper.ReactNativeFlipper
|
|
13
|
+
import com.facebook.soloader.SoLoader
|
|
14
|
+
|
|
15
|
+
class MainApplication : Application(), ReactApplication {
|
|
16
|
+
|
|
17
|
+
override val reactNativeHost: ReactNativeHost =
|
|
18
|
+
object : DefaultReactNativeHost(this) {
|
|
19
|
+
override fun getPackages(): List<ReactPackage> =
|
|
20
|
+
PackageList(this).packages.apply {
|
|
21
|
+
// Packages that cannot be autolinked yet can be added manually here, for example:
|
|
22
|
+
// add(MyReactNativePackage())
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
override fun getJSMainModuleName(): String = "index"
|
|
26
|
+
|
|
27
|
+
override fun getUseDeveloperSupport(): Boolean = BuildConfig.DEBUG
|
|
28
|
+
|
|
29
|
+
override val isNewArchEnabled: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
|
|
30
|
+
override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
override val reactHost: ReactHost
|
|
34
|
+
get() = getDefaultReactHost(this.applicationContext, reactNativeHost)
|
|
35
|
+
|
|
36
|
+
override fun onCreate() {
|
|
37
|
+
super.onCreate()
|
|
38
|
+
SoLoader.init(this, false)
|
|
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
|
+
}
|
|
43
|
+
ReactNativeFlipper.initializeFlipper(this, reactNativeHost.reactInstanceManager)
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -8,5 +8,7 @@
|
|
|
8
8
|
<domain-config cleartextTrafficPermitted="true">
|
|
9
9
|
<domain includeSubdomains="true">127.0.0.1</domain>
|
|
10
10
|
<domain includeSubdomains="true">localhost</domain>
|
|
11
|
+
<domain includeSubdomains="true">10.0.2.2</domain>
|
|
12
|
+
<domain includeSubdomains="true">10.0.3.2</domain>
|
|
11
13
|
</domain-config>
|
|
12
14
|
</network-security-config>
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
|
2
|
-
|
|
3
1
|
buildscript {
|
|
4
2
|
ext {
|
|
5
|
-
buildToolsVersion = "
|
|
3
|
+
buildToolsVersion = "34.0.0"
|
|
6
4
|
minSdkVersion = 21
|
|
7
|
-
compileSdkVersion =
|
|
8
|
-
targetSdkVersion =
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
ndkVersion = "23.1.7779620"
|
|
5
|
+
compileSdkVersion = 34
|
|
6
|
+
targetSdkVersion = 34
|
|
7
|
+
ndkVersion = "25.1.8937393"
|
|
8
|
+
kotlinVersion = "1.8.0"
|
|
12
9
|
}
|
|
13
10
|
repositories {
|
|
14
11
|
google()
|
|
15
12
|
mavenCentral()
|
|
16
13
|
}
|
|
17
14
|
dependencies {
|
|
18
|
-
classpath("com.android.tools.build:gradle
|
|
15
|
+
classpath("com.android.tools.build:gradle")
|
|
19
16
|
classpath("com.facebook.react:react-native-gradle-plugin")
|
|
17
|
+
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin")
|
|
20
18
|
}
|
|
21
19
|
}
|
|
22
20
|
|
|
21
|
+
apply plugin: "com.facebook.react.rootproject"
|
|
22
|
+
|
|
23
23
|
allprojects {
|
|
24
24
|
repositories {
|
|
25
25
|
maven {
|
|
Binary file
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
distributionBase=GRADLE_USER_HOME
|
|
2
2
|
distributionPath=wrapper/dists
|
|
3
|
-
distributionUrl=https\://services.gradle.org/distributions/gradle-
|
|
3
|
+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip
|
|
4
|
+
networkTimeout=10000
|
|
5
|
+
validateDistributionUrl=true
|
|
4
6
|
zipStoreBase=GRADLE_USER_HOME
|
|
5
|
-
zipStorePath=wrapper/dists
|
|
7
|
+
zipStorePath=wrapper/dists
|
|
@@ -24,9 +24,6 @@ android.useAndroidX=true
|
|
|
24
24
|
# Automatically convert third-party libraries to use AndroidX
|
|
25
25
|
android.enableJetifier=true
|
|
26
26
|
|
|
27
|
-
# Version of flipper SDK to use with React Native
|
|
28
|
-
FLIPPER_VERSION=0.125.0
|
|
29
|
-
|
|
30
27
|
# Use this property to specify which architecture you want to build.
|
|
31
28
|
# You can also override it from the CLI using
|
|
32
29
|
# ./gradlew <task> -PreactNativeArchitectures=x86_64
|