@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.
@@ -5,7 +5,7 @@ sentiance_sdk_env_var_version = ENV["SENTIANCE_RN_IOS_SDK_VERSION"]
5
5
 
6
6
  Pod::Spec.new do |s|
7
7
  s.name = "RNSentianceCore"
8
- s.version = "6.15.0-rc.4"
8
+ s.version = "6.15.0-rc.5"
9
9
  s.summary = "RNSentianceCore"
10
10
  s.description = <<-DESC
11
11
  RNSentianceCore
@@ -1,14 +1,26 @@
1
1
  plugins {
2
- id "com.android.library"
2
+ id "com.android.library"
3
3
  }
4
4
 
5
5
  android {
6
- namespace "com.sentiance.react.bridge.core"
6
+ namespace "com.sentiance.react.bridge.core"
7
7
 
8
- compileOptions {
9
- sourceCompatibility JavaVersion.VERSION_1_8
10
- targetCompatibility JavaVersion.VERSION_1_8
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
- implementation(platform("com.sentiance:sdk-bom:${sentianceSdkVersion}"))
23
- api("com.sentiance:sdk") { transitive = true }
34
+ implementation(platform("com.sentiance:sdk-bom:${sentianceSdkVersion}"))
35
+ api("com.sentiance:sdk") { transitive = true }
24
36
 
25
- if (findProject(':test-common')) {
26
- testImplementation project(':test-common')
27
- }
37
+ if (findProject(':test-common')) {
38
+ testImplementation project(':test-common')
39
+ }
28
40
  }
29
41
 
30
42
  applyReactNativeDependency()
@@ -0,0 +1,4 @@
1
+ -keepclassmembers class com.sentiance.react.bridge.core.BuildConfig {
2
+ public static final boolean IS_NEW_ARCHITECTURE_ENABLED;
3
+ }
4
+ -keep class com.sentiance.react.bridge.core.BuildConfig
@@ -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
- mApplicationContext = applicationContext;
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 (isNewArchEnabled) {
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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentiance-react-native/core",
3
- "version": "6.15.0-rc.4",
3
+ "version": "6.15.0-rc.5",
4
4
  "description": "The Sentiance Core library",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",