Skip to content

Commit d569a5e

Browse files
committed
chore: remove backward compatibility with old architecture
1 parent 317683f commit d569a5e

File tree

4 files changed

+22
-17
lines changed

4 files changed

+22
-17
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ Line SDK wrapper for React Native 🚀
1414
- iOS `deploymentTarget` needs to be at least version `15.1`.
1515
- [LINE developer account](https://developers.line.biz/console/) with a channel created.
1616

17+
> [!IMPORTANT]
18+
> @xmartlabs/react-native-line v5 is now a TurboModule and **requires the new architecture to be enabled**.
19+
> - If you want to use @xmartlabs/react-native-line v5, you need to enable the new architecture in your app (see how to [enable the new architecture for apps](https://github.com/reactwg/react-native-new-architecture/blob/main/docs/enable-apps.md))
20+
> - If you cannot enable the new architecture yet, downgrade to @xmartlabs/react-native-line v4 for now.
21+
1722
## Installation
1823

1924
### With Expo

android/build.gradle

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,8 @@ def safeExtGet(prop, fallback) {
2121
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
2222
}
2323

24-
if (isNewArchitectureEnabled()) {
25-
apply plugin: "com.facebook.react"
26-
}
27-
2824
apply plugin: "com.android.library"
25+
apply plugin: "com.facebook.react"
2926
apply plugin: "kotlin-android"
3027

3128
android {
@@ -36,17 +33,11 @@ android {
3633
targetSdkVersion safeExtGet("targetSdkVersion", 35)
3734
versionCode 1
3835
versionName "4.1.0"
39-
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
4036
}
4137

4238
sourceSets {
4339
main {
44-
if (isNewArchitectureEnabled()) {
45-
java.srcDirs += [
46-
// This is needed to build Kotlin project with NewArch enabled
47-
"${project.buildDir}/generated/source/codegen/java"
48-
]
49-
}
40+
java.srcDirs += ["${project.buildDir}/generated/source/codegen/java"]
5041
}
5142
}
5243
}
@@ -56,3 +47,13 @@ dependencies {
5647
implementation "com.linecorp.linesdk:linesdk:5.11.0"
5748
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3"
5849
}
50+
51+
tasks.register("checkNativeLineLoginSpec") {
52+
doLast {
53+
if (!isNewArchitectureEnabled()) {
54+
throw new GradleException("@xmartlabs/react-native-line v5 requires your project to have New Architecture enabled.")
55+
}
56+
}
57+
}
58+
59+
preBuild.dependsOn checkNativeLineLoginSpec

android/src/main/java/com/xmartlabs/line/LineLoginPackage.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class LineLoginPackage : TurboReactPackage() {
2323
needsEagerInit = false,
2424
hasConstants = true,
2525
isCxxModule = false,
26-
isTurboModule = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
26+
isTurboModule = true
2727
)
2828
)
2929
}

ios/LineLoginModule.mm

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
1+
#ifndef RCT_NEW_ARCH_ENABLED
2+
#error "@xmartlabs/react-native-line v5 requires your project to have New Architecture enabled."
3+
#endif
4+
15
#import <Foundation/Foundation.h>
26
#import <React/RCTBridgeModule.h>
3-
4-
#ifdef RCT_NEW_ARCH_ENABLED
57
#import "RTNLineSpec.h"
6-
#endif
78

89
@interface RCT_EXTERN_MODULE(LineLogin, NSObject)
910

1011
+ (BOOL)requiresMainQueueSetup {
1112
return NO;
1213
}
1314

14-
#ifdef RCT_NEW_ARCH_ENABLED
1515
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:(const facebook::react::ObjCTurboModule::InitParams &)params {
1616
return std::make_shared<facebook::react::NativeLineLoginSpecJSI>(params);
1717
}
18-
#endif
1918

2019
RCT_EXTERN_METHOD(setup: (NSDictionary *)arguments resolver: (RCTPromiseResolveBlock)resolve rejecter: (RCTPromiseRejectBlock)reject)
2120
RCT_EXTERN_METHOD(login: (NSDictionary *)arguments resolver: (RCTPromiseResolveBlock)resolve rejecter: (RCTPromiseRejectBlock)reject)

0 commit comments

Comments
 (0)