@adadapted/react-native-sdk 3.5.0 → 3.5.2
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/adadapted-react-native-sdk.podspec +1 -1
- package/lib/commonjs/api/adadaptedApiRequests.js +1 -2
- package/lib/commonjs/api/adadaptedApiRequests.js.map +1 -1
- package/lib/commonjs/api/adadaptedApiTypes.js +57 -0
- package/lib/commonjs/api/adadaptedApiTypes.js.map +1 -1
- package/lib/commonjs/componentTypes/Device.js +6 -0
- package/lib/commonjs/componentTypes/Device.js.map +1 -1
- package/lib/commonjs/componentTypes/Environment.js +27 -0
- package/lib/commonjs/componentTypes/Environment.js.map +1 -1
- package/lib/commonjs/components/AdZone.js +1 -2
- package/lib/commonjs/components/AdZone.js.map +1 -1
- package/lib/commonjs/components/ReportAdButton.js +1 -2
- package/lib/commonjs/components/ReportAdButton.js.map +1 -1
- package/lib/commonjs/index.js +1 -2
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/util.js +0 -1
- package/lib/commonjs/util.js.map +1 -1
- package/lib/module/api/adadaptedApiTypes.js +57 -0
- package/lib/module/api/adadaptedApiTypes.js.map +1 -1
- package/lib/module/componentTypes/Device.js +6 -0
- package/lib/module/componentTypes/Device.js.map +1 -1
- package/lib/module/componentTypes/Environment.js +27 -0
- package/lib/module/componentTypes/Environment.js.map +1 -1
- package/lib/module/components/AdZone.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/util.js +0 -1
- package/lib/module/util.js.map +1 -1
- package/lib/typescript/index.d.ts +2 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/jest.setup.d.ts +6 -0
- package/lib/typescript/jest.setup.d.ts.map +1 -0
- package/lib/typescript/src/componentTypes/AdZone.d.ts +1 -1
- package/lib/typescript/src/componentTypes/AdZone.d.ts.map +1 -1
- package/lib/typescript/src/components/AdZone.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/package.json +43 -34
- package/src/api/adadaptedApiRequests.mock.ts +2 -2
- package/src/api/adadaptedApiRequests.ts +10 -10
- package/src/componentTypes/AdZone.ts +1 -1
- package/src/components/AdZone.tsx +10 -10
- package/src/index.tsx +46 -46
- package/src/types.tsx +6 -5
- package/src/util.ts +6 -7
- package/android/.project +0 -34
- package/android/.settings/org.eclipse.buildship.core.prefs +0 -13
- package/android/bin/.project +0 -34
- package/android/bin/.settings/org.eclipse.buildship.core.prefs +0 -13
- package/android/bin/build.gradle +0 -132
- package/android/bin/gradle.properties +0 -4
- package/android/bin/src/main/AndroidManifest.xml +0 -4
- package/android/bin/src/main/java/com/adadaptedreactnativesdk/AdadaptedReactNativeSdkModule.kt +0 -115
- package/android/bin/src/main/java/com/adadaptedreactnativesdk/AdadaptedReactNativeSdkPackage.kt +0 -20
- package/lib/module/package.json +0 -1
package/android/bin/build.gradle
DELETED
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
buildscript {
|
|
2
|
-
// Buildscript is evaluated before everything else so we can't use getExtOrDefault
|
|
3
|
-
def kotlin_version = rootProject.ext.has('kotlinVersion') ? rootProject.ext.get('kotlinVersion') : project.properties['AdadaptedReactNativeSdk_kotlinVersion']
|
|
4
|
-
|
|
5
|
-
repositories {
|
|
6
|
-
google()
|
|
7
|
-
mavenCentral()
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
dependencies {
|
|
11
|
-
classpath 'com.android.tools.build:gradle:8.7.2'
|
|
12
|
-
// noinspection DifferentKotlinGradleVersion
|
|
13
|
-
classpath("com.facebook.react:react-native-gradle-plugin:0.75.1")
|
|
14
|
-
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version")
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
apply plugin: 'com.android.library'
|
|
19
|
-
apply plugin: 'kotlin-android'
|
|
20
|
-
|
|
21
|
-
def getExtOrDefault(name) {
|
|
22
|
-
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['AdadaptedReactNativeSdk_' + name]
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
def getExtOrIntegerDefault(name) {
|
|
26
|
-
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties['AdadaptedReactNativeSdk_' + name]).toInteger()
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
android {
|
|
30
|
-
namespace "com.adadapted.adadaptedreactnativesdk"
|
|
31
|
-
compileSdkVersion getExtOrIntegerDefault('compileSdkVersion')
|
|
32
|
-
buildToolsVersion getExtOrDefault('buildToolsVersion')
|
|
33
|
-
defaultConfig {
|
|
34
|
-
minSdkVersion 28
|
|
35
|
-
targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
|
|
36
|
-
versionCode 1
|
|
37
|
-
versionName "1.0"
|
|
38
|
-
}
|
|
39
|
-
buildTypes {
|
|
40
|
-
release {
|
|
41
|
-
minifyEnabled false
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
lintOptions {
|
|
45
|
-
disable 'GradleCompatible'
|
|
46
|
-
}
|
|
47
|
-
compileOptions {
|
|
48
|
-
sourceCompatibility JavaVersion.VERSION_17
|
|
49
|
-
targetCompatibility JavaVersion.VERSION_17
|
|
50
|
-
}
|
|
51
|
-
kotlin {
|
|
52
|
-
jvmToolchain(17)
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
repositories {
|
|
57
|
-
mavenCentral()
|
|
58
|
-
google()
|
|
59
|
-
|
|
60
|
-
def found = false
|
|
61
|
-
def defaultDir = null
|
|
62
|
-
def androidSourcesName = 'React Native sources'
|
|
63
|
-
|
|
64
|
-
if (rootProject.ext.has('reactNativeAndroidRoot')) {
|
|
65
|
-
defaultDir = rootProject.ext.get('reactNativeAndroidRoot')
|
|
66
|
-
} else {
|
|
67
|
-
defaultDir = new File(
|
|
68
|
-
projectDir,
|
|
69
|
-
'/../../../node_modules/react-native/android'
|
|
70
|
-
)
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
if (defaultDir.exists()) {
|
|
74
|
-
maven {
|
|
75
|
-
url defaultDir.toString()
|
|
76
|
-
name androidSourcesName
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
logger.info(":${project.name}:reactNativeAndroidRoot ${defaultDir.canonicalPath}")
|
|
80
|
-
found = true
|
|
81
|
-
} else {
|
|
82
|
-
def parentDir = rootProject.projectDir
|
|
83
|
-
|
|
84
|
-
1.upto(5, {
|
|
85
|
-
if (found) return true
|
|
86
|
-
parentDir = parentDir.parentFile
|
|
87
|
-
|
|
88
|
-
def androidSourcesDir = new File(
|
|
89
|
-
parentDir,
|
|
90
|
-
'node_modules/react-native'
|
|
91
|
-
)
|
|
92
|
-
|
|
93
|
-
def androidPrebuiltBinaryDir = new File(
|
|
94
|
-
parentDir,
|
|
95
|
-
'node_modules/react-native/android'
|
|
96
|
-
)
|
|
97
|
-
|
|
98
|
-
if (androidPrebuiltBinaryDir.exists()) {
|
|
99
|
-
maven {
|
|
100
|
-
url androidPrebuiltBinaryDir.toString()
|
|
101
|
-
name androidSourcesName
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
logger.info(":${project.name}:reactNativeAndroidRoot ${androidPrebuiltBinaryDir.canonicalPath}")
|
|
105
|
-
found = true
|
|
106
|
-
} else if (androidSourcesDir.exists()) {
|
|
107
|
-
maven {
|
|
108
|
-
url androidSourcesDir.toString()
|
|
109
|
-
name androidSourcesName
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
logger.info(":${project.name}:reactNativeAndroidRoot ${androidSourcesDir.canonicalPath}")
|
|
113
|
-
found = true
|
|
114
|
-
}
|
|
115
|
-
})
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
if (!found) {
|
|
119
|
-
throw new FileNotFoundException(
|
|
120
|
-
"${project.name}: unable to locate React Native android sources. " +
|
|
121
|
-
"Ensure you have you installed React Native as a dependency in your project and try again."
|
|
122
|
-
)
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
def kotlin_version = getExtOrDefault('kotlinVersion')
|
|
127
|
-
|
|
128
|
-
dependencies {
|
|
129
|
-
// noinspection GradleDynamicVersion
|
|
130
|
-
api 'com.facebook.react:react-native:0.20.1'
|
|
131
|
-
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
132
|
-
}
|
package/android/bin/src/main/java/com/adadaptedreactnativesdk/AdadaptedReactNativeSdkModule.kt
DELETED
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
// See https://facebook.github.io/react-native/docs/native-modules-android
|
|
2
|
-
package com.adadaptedreactnativesdk;
|
|
3
|
-
|
|
4
|
-
import android.content.pm.PackageInfo;
|
|
5
|
-
import android.content.pm.PackageManager;
|
|
6
|
-
import android.util.DisplayMetrics;
|
|
7
|
-
import android.util.Log;
|
|
8
|
-
import org.json.*;
|
|
9
|
-
import java.io.IOException;
|
|
10
|
-
import java.util.Locale;
|
|
11
|
-
import java.util.TimeZone;
|
|
12
|
-
import com.facebook.react.bridge.ReactApplicationContext;
|
|
13
|
-
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
14
|
-
import com.facebook.react.bridge.ReactMethod;
|
|
15
|
-
import com.facebook.react.bridge.Promise;
|
|
16
|
-
import com.google.android.gms.ads.identifier.AdvertisingIdClient;
|
|
17
|
-
import com.google.android.gms.common.GooglePlayServicesNotAvailableException;
|
|
18
|
-
import com.google.android.gms.common.GooglePlayServicesRepairableException;
|
|
19
|
-
import android.telephony.TelephonyManager;
|
|
20
|
-
import android.content.Context;
|
|
21
|
-
|
|
22
|
-
class AdadaptedReactNativeSdkModule(val _reactContext: ReactApplicationContext) : ReactContextBaseJavaModule(_reactContext) {
|
|
23
|
-
val reactContext = _reactContext;
|
|
24
|
-
|
|
25
|
-
val TAG: String = "ReactNative";
|
|
26
|
-
val UNKNOWN_VALUE: String = "Unknown";
|
|
27
|
-
|
|
28
|
-
override fun getName(): String {
|
|
29
|
-
return "AdadaptedReactNativeSdk";
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
@ReactMethod
|
|
33
|
-
fun getDeviceInfo(promise: Promise) {
|
|
34
|
-
val deviceDisplayMetrics: DisplayMetrics = reactContext.getResources().getDisplayMetrics();
|
|
35
|
-
var gaidInfo: AdvertisingIdClient.Info? = null;
|
|
36
|
-
var bundleVersion: String = UNKNOWN_VALUE;
|
|
37
|
-
var deviceCarrier: String = "n/a";
|
|
38
|
-
var deviceWidth: Int = 0;
|
|
39
|
-
var deviceHeight: Int = 0;
|
|
40
|
-
var deviceDensity: String = "";
|
|
41
|
-
var gaid: String = "";
|
|
42
|
-
var adTrackingEnabled: Boolean = false;
|
|
43
|
-
|
|
44
|
-
val mTelephonyMgr: TelephonyManager = reactContext.getSystemService(Context.TELEPHONY_SERVICE) as TelephonyManager;
|
|
45
|
-
|
|
46
|
-
if (mTelephonyMgr != null && mTelephonyMgr.getNetworkOperatorName() != null) {
|
|
47
|
-
deviceCarrier = mTelephonyMgr.getNetworkOperatorName();
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
try {
|
|
51
|
-
gaidInfo = AdvertisingIdClient.getAdvertisingIdInfo(reactContext);
|
|
52
|
-
}
|
|
53
|
-
catch (ex: GooglePlayServicesNotAvailableException) {
|
|
54
|
-
logGaidException();
|
|
55
|
-
}
|
|
56
|
-
catch (ex: GooglePlayServicesRepairableException) {
|
|
57
|
-
logGaidException();
|
|
58
|
-
}
|
|
59
|
-
catch (ex: IOException) {
|
|
60
|
-
logGaidException();
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
try {
|
|
64
|
-
val packageInfo: PackageInfo = reactContext.getPackageManager().getPackageInfo(reactContext.getPackageName(), 0);
|
|
65
|
-
|
|
66
|
-
if (packageInfo != null) {
|
|
67
|
-
bundleVersion = packageInfo.versionName;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
catch(ex: PackageManager.NameNotFoundException) {
|
|
71
|
-
bundleVersion = UNKNOWN_VALUE;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
if (gaidInfo != null) {
|
|
75
|
-
gaid = gaidInfo.getId();
|
|
76
|
-
adTrackingEnabled = !gaidInfo.isLimitAdTrackingEnabled();
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
if (deviceDisplayMetrics != null) {
|
|
80
|
-
deviceWidth = deviceDisplayMetrics.widthPixels;
|
|
81
|
-
deviceHeight = deviceDisplayMetrics.heightPixels;
|
|
82
|
-
deviceDensity = deviceDisplayMetrics.density.toString();
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
// Create the HashMap that will be turned into a final JSON result.
|
|
86
|
-
var finalDeviceData: HashMap<String, Any> = HashMap<String, Any>();
|
|
87
|
-
|
|
88
|
-
finalDeviceData.put("udid", gaid);
|
|
89
|
-
finalDeviceData.put("deviceName", android.os.Build.DEVICE);
|
|
90
|
-
finalDeviceData.put("systemName", "android");
|
|
91
|
-
finalDeviceData.put("systemVersion", android.os.Build.VERSION.RELEASE);
|
|
92
|
-
finalDeviceData.put("deviceCarrier", deviceCarrier);
|
|
93
|
-
finalDeviceData.put("deviceModel", android.os.Build.MODEL);
|
|
94
|
-
finalDeviceData.put("deviceWidth", deviceWidth);
|
|
95
|
-
finalDeviceData.put("deviceHeight", deviceHeight);
|
|
96
|
-
finalDeviceData.put("deviceScreenDensity", deviceDensity);
|
|
97
|
-
finalDeviceData.put("deviceLocale", Locale.getDefault().toString());
|
|
98
|
-
finalDeviceData.put("bundleId", reactContext.getPackageName());
|
|
99
|
-
finalDeviceData.put("bundleVersion", bundleVersion);
|
|
100
|
-
finalDeviceData.put("deviceTimezone", TimeZone.getDefault().getID());
|
|
101
|
-
finalDeviceData.put("isAdTrackingEnabled", adTrackingEnabled);
|
|
102
|
-
|
|
103
|
-
promise.resolve(JSONObject(finalDeviceData as Map<*, *>?).toString());
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
fun logGaidException() {
|
|
107
|
-
Log.w(TAG, "Problem retrieving Google Play Advertiser Info");
|
|
108
|
-
Log.w(TAG, "GAID_UNAVAILABLE");
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
@ReactMethod
|
|
112
|
-
fun storeCurrentSessionId(sessionId: String) {
|
|
113
|
-
// noop
|
|
114
|
-
}
|
|
115
|
-
}
|
package/android/bin/src/main/java/com/adadaptedreactnativesdk/AdadaptedReactNativeSdkPackage.kt
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
package com.adadaptedreactnativesdk
|
|
2
|
-
|
|
3
|
-
import java.util.Arrays
|
|
4
|
-
import java.util.Collections
|
|
5
|
-
|
|
6
|
-
import com.facebook.react.ReactPackage
|
|
7
|
-
import com.facebook.react.bridge.NativeModule
|
|
8
|
-
import com.facebook.react.bridge.ReactApplicationContext
|
|
9
|
-
import com.facebook.react.uimanager.ViewManager
|
|
10
|
-
import com.facebook.react.bridge.JavaScriptModule
|
|
11
|
-
|
|
12
|
-
class AdadaptedReactNativeSdkPackage : ReactPackage {
|
|
13
|
-
override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> {
|
|
14
|
-
return Arrays.asList<NativeModule>(AdadaptedReactNativeSdkModule(reactContext))
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> {
|
|
18
|
-
return emptyList<ViewManager<*, *>>()
|
|
19
|
-
}
|
|
20
|
-
}
|
package/lib/module/package.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"type":"module"}
|