Skip to content

Commit 9859dc4

Browse files
committed
feat: add support for new architecture and Fabric in Android and iOS SDKs
1 parent 726aa52 commit 9859dc4

3 files changed

Lines changed: 38 additions & 3 deletions

File tree

Iterable-React-Native-SDK.podspec

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ Pod::Spec.new do |s|
1616

1717
s.source_files = "ios/**/*.{h,m,mm,swift}"
1818

19+
s.dependency "Iterable-iOS-SDK", "6.5.4"
20+
1921
# Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
2022
# See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
2123
if respond_to?(:install_modules_dependencies, true)
@@ -36,9 +38,8 @@ Pod::Spec.new do |s|
3638
s.dependency "RCTRequired"
3739
s.dependency "RCTTypeSafety"
3840
s.dependency "ReactCommon/turbomodule/core"
41+
s.dependency "React-RCTFabric" # This is for Fabric support
3942
end
4043
end
4144

42-
s.dependency "Iterable-iOS-SDK", "6.5.4"
43-
4445
end

android/build.gradle

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ def isNewArchitectureEnabled() {
2323
return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
2424
}
2525

26+
def isFabricEnabled() {
27+
return rootProject.hasProperty("fabricEnabled") && rootProject.getProperty("fabricEnabled") == "true"
28+
}
29+
2630
apply plugin: "com.android.library"
2731
apply plugin: "kotlin-android"
2832

@@ -64,6 +68,17 @@ android {
6468
minSdkVersion getExtOrIntegerDefault("minSdkVersion")
6569
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
6670

71+
if (isNewArchitectureEnabled()) {
72+
buildConfigField("boolean", "IS_NEW_ARCHITECTURE_ENABLED", "true")
73+
if (isFabricEnabled()) {
74+
buildConfigField("boolean", "IS_FABRIC_ENABLED", "true")
75+
} else {
76+
buildConfigField("boolean", "IS_FABRIC_ENABLED", "false")
77+
}
78+
} else {
79+
buildConfigField("boolean", "IS_NEW_ARCHITECTURE_ENABLED", "false")
80+
buildConfigField("boolean", "IS_FABRIC_ENABLED", "false")
81+
}
6782
}
6883

6984
buildTypes {
@@ -80,6 +95,10 @@ android {
8095
sourceCompatibility JavaVersion.VERSION_1_8
8196
targetCompatibility JavaVersion.VERSION_1_8
8297
}
98+
99+
buildFeatures {
100+
buildConfig true
101+
}
83102
}
84103

85104
repositories {
@@ -97,5 +116,16 @@ dependencies {
97116
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
98117
api "com.iterable:iterableapi:3.5.2"
99118
// api project(":iterableapi") // links to local android SDK repo rather than by release
119+
120+
if (isNewArchitectureEnabled()) {
121+
implementation project(":ReactAndroid")
122+
implementation project(":ReactCommon")
123+
implementation project(":ReactCommon:jsi")
124+
implementation project(":ReactCommon:reactnativejni")
125+
implementation project(":ReactCommon:reactnativejni:jsi")
126+
implementation project(":ReactCommon:reactnativejni:jsc")
127+
implementation project(":ReactCommon:reactnativejni:hermes")
128+
implementation project(":ReactCommon:reactnativejni:fabricjni")
129+
}
100130
}
101131

android/gradle.properties

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,8 @@ RNIterable_targetSdkVersion=31
44
RNIterable_compileSdkVersion=31
55
RNIterable_ndkversion=21.4.7075529
66
android.useAndroidX=true
7-
android.enableJetifier=true
7+
android.enableJetifier=true
8+
9+
# New Architecture flags
10+
newArchEnabled=false
11+
fabricEnabled=false

0 commit comments

Comments
 (0)