Skip to content

Commit 91937fe

Browse files
authored
Merge pull request #704 from Iterable/new-arch/master
[SDK-82] New Architecture
2 parents b37eb9f + ca88683 commit 91937fe

39 files changed

+4382
-4461
lines changed

.clang-format

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
BasedOnStyle: LLVM
3+
Language: Cpp
4+
AllowAllArgumentsOnNextLine: false
5+
AllowAllParametersOfDeclarationOnNextLine: false
6+
BinPackArguments: false
7+
BinPackParameters: false
8+
BreakBeforeBinaryOperators: None
9+
BreakBeforeBraces: Attach
10+
BreakBeforeTernaryOperators: true
11+
BreakConstructorInitializers: AfterColon
12+
BreakInheritanceList: AfterColon
13+
ColumnLimit: 80
14+
CompactNamespaces: false
15+
ConstructorInitializerAllOnOneLineOrOnePerLine: true
16+
IndentCaseLabels: true
17+
IndentPPDirectives: BeforeHash
18+
IndentWidth: 2
19+
IndentWrappedFunctionNames: true
20+
KeepEmptyLinesAtTheStartOfBlocks: false
21+
MaxEmptyLinesToKeep: 1
22+
NamespaceIndentation: All
23+
ObjCBinPackProtocolList: Never
24+
ReflowComments: true
25+
SortIncludes: false
26+
SpaceBeforeParens: Never
27+
SpaceInEmptyParentheses: false
28+
UseTab: Never
29+
30+
...

.swift-format

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
{
2+
"fileScopedDeclarationPrivacy" : {
3+
"accessLevel" : "private"
4+
},
5+
"indentConditionalCompilationBlocks" : true,
6+
"indentSwitchCaseLabels" : false,
7+
"indentation" : {
8+
"spaces" : 2
9+
},
10+
"lineBreakAroundMultilineExpressionChainComponents" : false,
11+
"lineBreakBeforeControlFlowKeywords" : false,
12+
"lineBreakBeforeEachArgument" : false,
13+
"lineBreakBeforeEachGenericRequirement" : false,
14+
"lineBreakBetweenDeclarationAttributes" : false,
15+
"lineLength" : 100,
16+
"maximumBlankLines" : 1,
17+
"multiElementCollectionTrailingCommas" : true,
18+
"noAssignmentInExpressions" : {
19+
"allowedFunctions" : [
20+
"XCTAssertNoThrow"
21+
]
22+
},
23+
"prioritizeKeepingFunctionOutputTogether" : false,
24+
"reflowMultilineStringLiterals" : {
25+
"never" : {
26+
27+
}
28+
},
29+
"respectsExistingLineBreaks" : true,
30+
"rules" : {
31+
"AllPublicDeclarationsHaveDocumentation" : false,
32+
"AlwaysUseLiteralForEmptyCollectionInit" : false,
33+
"AlwaysUseLowerCamelCase" : true,
34+
"AmbiguousTrailingClosureOverload" : true,
35+
"AvoidRetroactiveConformances" : true,
36+
"BeginDocumentationCommentWithOneLineSummary" : false,
37+
"DoNotUseSemicolons" : true,
38+
"DontRepeatTypeInStaticProperties" : true,
39+
"FileScopedDeclarationPrivacy" : true,
40+
"FullyIndirectEnum" : true,
41+
"GroupNumericLiterals" : true,
42+
"IdentifiersMustBeASCII" : true,
43+
"NeverForceUnwrap" : false,
44+
"NeverUseForceTry" : false,
45+
"NeverUseImplicitlyUnwrappedOptionals" : false,
46+
"NoAccessLevelOnExtensionDeclaration" : true,
47+
"NoAssignmentInExpressions" : true,
48+
"NoBlockComments" : true,
49+
"NoCasesWithOnlyFallthrough" : true,
50+
"NoEmptyLinesOpeningClosingBraces" : false,
51+
"NoEmptyTrailingClosureParentheses" : true,
52+
"NoLabelsInCasePatterns" : true,
53+
"NoLeadingUnderscores" : false,
54+
"NoParensAroundConditions" : true,
55+
"NoPlaygroundLiterals" : true,
56+
"NoVoidReturnOnFunctionSignature" : true,
57+
"OmitExplicitReturns" : false,
58+
"OneCasePerLine" : true,
59+
"OneVariableDeclarationPerLine" : true,
60+
"OnlyOneTrailingClosureArgument" : true,
61+
"OrderedImports" : true,
62+
"ReplaceForEachWithForLoop" : true,
63+
"ReturnVoidInsteadOfEmptyTuple" : true,
64+
"TypeNamesShouldBeCapitalized" : true,
65+
"UseEarlyExits" : false,
66+
"UseExplicitNilCheckInConditions" : true,
67+
"UseLetInEveryBoundCaseVariable" : true,
68+
"UseShorthandTypeNames" : true,
69+
"UseSingleLinePropertyGetter" : true,
70+
"UseSynthesizedInitializer" : true,
71+
"UseTripleSlashForDocumentationComments" : true,
72+
"UseWhereClausesInForLoops" : false,
73+
"ValidateDocumentationComments" : false
74+
},
75+
"spacesAroundRangeFormationOperators" : false,
76+
"spacesBeforeEndOfLineComments" : 2,
77+
"tabWidth" : 8,
78+
"version" : 1
79+
}

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
## 2.1.0-beta.1
2+
3+
## Fixes
4+
- Add Temporary fix for circular paths, which break expo ([9c09743](https://github.com/Iterable/react-native-sdk/commit/9c09743))
5+
6+
## 2.1.0-beta.0
7+
8+
### Updates
9+
- Update SDK so that it has full support for [React Native New Architecture](https://reactnative.dev/architecture/landing-page)
10+
11+
### Chores
12+
- Update dependencies for React Navigation and related packages ([95053bb](https://github.com/Iterable/react-native-sdk/commit/95053bb))
13+
14+
115
## 2.0.4
216

317
## Updates

Iterable-React-Native-SDK.podspec

Lines changed: 13 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
require "json"
22

33
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4-
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
54

65
Pod::Spec.new do |s|
76
s.name = "Iterable-React-Native-SDK"
@@ -14,31 +13,20 @@ Pod::Spec.new do |s|
1413
s.platforms = { :ios => min_ios_version_supported }
1514
s.source = { :git => "https://github.com/Iterable/react-native-sdk.git", :tag => "#{s.version}" }
1615

17-
s.source_files = "ios/**/*.{h,m,mm,swift}"
18-
19-
# Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
20-
# See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
21-
if respond_to?(:install_modules_dependencies, true)
22-
install_modules_dependencies(s)
23-
else
24-
s.dependency "React-Core"
25-
26-
# Don't install the dependencies when we run `pod install` in the old architecture.
27-
if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
28-
s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
29-
s.pod_target_xcconfig = {
30-
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
31-
"OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
32-
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
33-
}
34-
s.dependency "React-Codegen"
35-
s.dependency "RCT-Folly"
36-
s.dependency "RCTRequired"
37-
s.dependency "RCTTypeSafety"
38-
s.dependency "ReactCommon/turbomodule/core"
39-
end
40-
end
16+
s.source_files = "ios/**/*.{h,m,mm,cpp,swift}"
17+
s.private_header_files = "ios/**/*.h"
4118

19+
# Load Iterables iOS SDK as a dependency
4220
s.dependency "Iterable-iOS-SDK", "6.5.4.1"
4321

22+
# Basic Swift support
23+
s.pod_target_xcconfig = {
24+
'DEFINES_MODULE' => 'YES',
25+
'CLANG_ENABLE_MODULES' => 'YES',
26+
'SWIFT_VERSION' => '5.0',
27+
"CLANG_CXX_LANGUAGE_STANDARD" => rct_cxx_language_standard(),
28+
}
29+
30+
install_modules_dependencies(s)
31+
4432
end

README.md

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Iterable. It supports JavaScript and TypeScript.
2121
- [Installation](#installation)
2222
- [📚 API Documentation](#-api-documentation)
2323
- [Architecture Support](#architecture-support)
24+
- [Beta Versions](#beta-versions)
2425
- [Features](#features)
2526
- [Example project](#example-project)
2627
- [Version mapping](#version-mapping)
@@ -49,6 +50,10 @@ Iterable's React Native SDK relies on:
4950
- Xcode 12+
5051
- [Deployment target 13.4+](https://help.apple.com/xcode/mac/current/#/deve69552ee5)
5152
- [Iterable's iOS SDK](https://github.com/Iterable/iterable-swift-sdk)
53+
- **Podfile Configuration**: The linkage must be set to dynamic in your Podfile to load Swift modules that the SDK depends on. Add the following to your Podfile:
54+
```ruby
55+
use_frameworks! :linkage => :dynamic
56+
```
5257

5358
- **Android**
5459
- [`minSdkVersion` 21+, `compileSdkVersion` 31+](https://medium.com/androiddevelopers/picking-your-compilesdkversion-minsdkversion-targetsdkversion-a098a0341ebd)
@@ -64,11 +69,29 @@ View the [API documentation](https://iterable-react-native-sdk.netlify.app).
6469

6570
## Architecture Support
6671

67-
**Important**: Iterable's React Native SDK has limited support for [React
68-
Native's New Architecture](https://reactnative.dev/architecture/landing-page)
69-
through interop. We are in the process of updating the SDK to fully support the New
70-
Architecture, and suggest using the legacy architecture in the meantime. *TLDR;* Use the New Architecture at your own risk --
71-
you may encounter significant issues.
72+
Iterable's React Native SDK now fully supports [React Native's New Architecture](https://reactnative.dev/architecture/landing-page), including TurboModules and Fabric. You can use the SDK with either the legacy architecture or the New Architecture.
73+
74+
Notes:
75+
76+
- Ensure your app is configured for New Architecture per the React Native docs.
77+
- The example app in this repository is configured with New Architecture enabled.
78+
79+
## Beta Versions
80+
81+
To opt into beta versions of the SDK, you can install the latest beta version by using the `beta` tag:
82+
83+
```bash
84+
# Install the latest beta version
85+
npm install @iterable/react-native-sdk@beta
86+
87+
# Or using yarn
88+
yarn add @iterable/react-native-sdk@beta
89+
```
90+
91+
**Note:** Beta versions may contain experimental features and could have
92+
breaking changes. We recommend testing beta versions in development environments
93+
before using them in production. Please report any issues found in beta
94+
releases to [Customer Support](https://support.iterable.com/hc/en-us/requests/new).
7295

7396
## Features
7497

@@ -96,6 +119,7 @@ For quick reference, the following table lists the versions of the [Android SDK]
96119
97120
| RN SDK Version | Android SDK Version | iOS SDK Version |
98121
| --------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | --------------- |
122+
| [2.1.0-beta.0](https://www.npmjs.com/package/@iterable/react-native-sdk/v/2.1.0-beta.0) | [3.5.2](https://github.com/Iterable/iterable-android-sdk/releases/tag/3.5.2) | [6.5.4](https://github.com/Iterable/swift-sdk/releases/tag/6.5.4)
99123
| [2.0.3](https://www.npmjs.com/package/@iterable/react-native-sdk/v/2.0.3) | [3.5.2](https://github.com/Iterable/iterable-android-sdk/releases/tag/3.5.2) | [6.5.4](https://github.com/Iterable/swift-sdk/releases/tag/6.5.4)
100124
| [2.0.2](https://www.npmjs.com/package/@iterable/react-native-sdk/v/2.0.2) | [3.5.2](https://github.com/Iterable/iterable-android-sdk/releases/tag/3.5.2) | [6.5.4](https://github.com/Iterable/swift-sdk/releases/tag/6.5.4)
101125
| [2.0.1](https://www.npmjs.com/package/@iterable/react-native-sdk/v/2.0.1) | [3.5.2](https://github.com/Iterable/iterable-android-sdk/releases/tag/3.5.2) | [6.5.4](https://github.com/Iterable/swift-sdk/releases/tag/6.5.4)

android/build.gradle

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,20 @@
11
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["RNIterable_kotlinVersion"]
2+
ext.getExtOrDefault = {name ->
3+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['RNIterable_' + name]
4+
}
45

56
repositories {
67
google()
78
mavenCentral()
89
}
910

1011
dependencies {
11-
classpath "com.android.tools.build:gradle:7.2.1"
12+
classpath "com.android.tools.build:gradle:8.7.2"
1213
// noinspection DifferentKotlinGradleVersion
13-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
14+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${getExtOrDefault('kotlinVersion')}"
1415
}
1516
}
1617

17-
def reactNativeArchitectures() {
18-
def value = rootProject.getProperties().get("reactNativeArchitectures")
19-
return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
20-
}
21-
2218
def isNewArchitectureEnabled() {
2319
return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
2420
}
@@ -63,7 +59,11 @@ android {
6359
defaultConfig {
6460
minSdkVersion getExtOrIntegerDefault("minSdkVersion")
6561
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
62+
buildConfigField("boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString())
63+
}
6664

65+
buildFeatures {
66+
buildConfig true
6767
}
6868

6969
buildTypes {
@@ -80,6 +80,19 @@ android {
8080
sourceCompatibility JavaVersion.VERSION_1_8
8181
targetCompatibility JavaVersion.VERSION_1_8
8282
}
83+
84+
sourceSets {
85+
main {
86+
if (isNewArchitectureEnabled()) {
87+
java.srcDirs += ['src/newarch']
88+
} else {
89+
java.srcDirs += ['src/oldarch']
90+
}
91+
}
92+
}
93+
94+
// Add this to match the Iterable SDK group ID
95+
group = "com.iterable"
8396
}
8497

8598
repositories {
@@ -90,10 +103,7 @@ repositories {
90103
def kotlin_version = getExtOrDefault("kotlinVersion")
91104

92105
dependencies {
93-
// For < 0.71, this will be from the local maven repo
94-
// For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
95-
//noinspection GradleDynamicVersion
96-
implementation "com.facebook.react:react-native:+"
106+
implementation "com.facebook.react:react-android"
97107
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
98108
api "com.iterable:iterableapi:3.5.2"
99109
// api project(":iterableapi") // links to local android SDK repo rather than by release

android/gradle.properties

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
RNIterable_kotlinVersion=1.7.0
2-
RNIterable_minSdkVersion=21
3-
RNIterable_targetSdkVersion=31
4-
RNIterable_compileSdkVersion=31
5-
RNIterable_ndkversion=21.4.7075529
1+
RNIterable_kotlinVersion=2.0.21
2+
RNIterable_minSdkVersion=24
3+
RNIterable_targetSdkVersion=35
4+
RNIterable_compileSdkVersion=35
5+
RNIterable_ndkversion=27.1.12297006
66
android.useAndroidX=true
7-
android.enableJetifier=true
7+
android.enableJetifier=true

0 commit comments

Comments
 (0)