@sentiance-react-native/core 6.15.0-rc.4 → 6.15.0-rc.5
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/RNSentianceCore.podspec
CHANGED
package/android/build.gradle
CHANGED
|
@@ -1,14 +1,26 @@
|
|
|
1
1
|
plugins {
|
|
2
|
-
|
|
2
|
+
id "com.android.library"
|
|
3
3
|
}
|
|
4
4
|
|
|
5
5
|
android {
|
|
6
|
-
|
|
6
|
+
namespace "com.sentiance.react.bridge.core"
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
compileOptions {
|
|
9
|
+
sourceCompatibility JavaVersion.VERSION_1_8
|
|
10
|
+
targetCompatibility JavaVersion.VERSION_1_8
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
buildFeatures {
|
|
14
|
+
buildConfig = true
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
def isNewArchEnabled =
|
|
18
|
+
(project.findProperty('newArchEnabled') ?: "false").toBoolean()
|
|
19
|
+
|
|
20
|
+
defaultConfig {
|
|
21
|
+
consumerProguardFiles 'rules-consumer.pro'
|
|
22
|
+
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchEnabled.toString()
|
|
23
|
+
}
|
|
12
24
|
}
|
|
13
25
|
|
|
14
26
|
apply from: "$project.projectDir/package-json-reader.gradle"
|
|
@@ -19,12 +31,12 @@ applyAndroidVersionsFrom(packageJson)
|
|
|
19
31
|
def sentianceSdkVersion = getSentianceSdkVersion()
|
|
20
32
|
|
|
21
33
|
dependencies {
|
|
22
|
-
|
|
23
|
-
|
|
34
|
+
implementation(platform("com.sentiance:sdk-bom:${sentianceSdkVersion}"))
|
|
35
|
+
api("com.sentiance:sdk") { transitive = true }
|
|
24
36
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
37
|
+
if (findProject(':test-common')) {
|
|
38
|
+
testImplementation project(':test-common')
|
|
39
|
+
}
|
|
28
40
|
}
|
|
29
41
|
|
|
30
42
|
applyReactNativeDependency()
|
package/android/src/main/java/com/sentiance/react/bridge/core/common/util/ReactContextProvider.java
CHANGED
|
@@ -8,22 +8,16 @@ import androidx.annotation.Nullable;
|
|
|
8
8
|
import com.facebook.react.ReactApplication;
|
|
9
9
|
import com.facebook.react.ReactNativeHost;
|
|
10
10
|
import com.facebook.react.bridge.ReactContext;
|
|
11
|
+
import com.sentiance.react.bridge.core.BuildConfig;
|
|
11
12
|
|
|
12
13
|
public final class ReactContextProvider {
|
|
13
14
|
|
|
14
15
|
private static final String TAG = "ReactNativeContextProvider";
|
|
15
|
-
private static Boolean isNewArchEnabled = null;
|
|
16
16
|
|
|
17
|
-
private final Context mApplicationContext;
|
|
18
17
|
private final ReactApplication mReactApplication;
|
|
19
18
|
|
|
20
19
|
public ReactContextProvider(Context applicationContext) {
|
|
21
|
-
|
|
22
|
-
mReactApplication = (ReactApplication) mApplicationContext;
|
|
23
|
-
|
|
24
|
-
if (isNewArchEnabled == null) {
|
|
25
|
-
isNewArchEnabled = isNewArchEnabled();
|
|
26
|
-
}
|
|
20
|
+
mReactApplication = (ReactApplication) applicationContext;
|
|
27
21
|
}
|
|
28
22
|
|
|
29
23
|
/**
|
|
@@ -37,7 +31,7 @@ public final class ReactContextProvider {
|
|
|
37
31
|
*/
|
|
38
32
|
@Nullable
|
|
39
33
|
public ReactContext createReactContext() {
|
|
40
|
-
if (
|
|
34
|
+
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
|
|
41
35
|
return createReactContextInNewArchMode();
|
|
42
36
|
} else {
|
|
43
37
|
return createReactContextInLegacyArchMode();
|
|
@@ -75,20 +69,4 @@ public final class ReactContextProvider {
|
|
|
75
69
|
|
|
76
70
|
return reactNativeHost.getReactInstanceManager().getCurrentReactContext();
|
|
77
71
|
}
|
|
78
|
-
|
|
79
|
-
private boolean isNewArchEnabled() {
|
|
80
|
-
try {
|
|
81
|
-
String pkg = mApplicationContext.getPackageName();
|
|
82
|
-
Class<?> cfg = Class.forName(pkg + ".BuildConfig");
|
|
83
|
-
return cfg.getField("IS_NEW_ARCHITECTURE_ENABLED").getBoolean(null);
|
|
84
|
-
} catch (Throwable ignore) { /* app wasn't generated with the flag */ }
|
|
85
|
-
|
|
86
|
-
try {
|
|
87
|
-
Class<?> cfg = Class.forName("com.facebook.react.BuildConfig");
|
|
88
|
-
return cfg.getField("IS_NEW_ARCHITECTURE_ENABLED").getBoolean(null);
|
|
89
|
-
} catch (Throwable ignore) {
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
return false;
|
|
93
|
-
}
|
|
94
72
|
}
|