Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 2 additions & 34 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: CI
on: [pull_request]

jobs:
test-new-arch:
test:
runs-on: macos-15-xlarge
steps:
- uses: actions/checkout@v4
Expand All @@ -29,36 +29,4 @@ jobs:

- run: npm ci
- run: bash ./scripts/run_ci_tasks.sh -i
- run: bash ./scripts/run_ci_tasks.sh -a

test-old-arch:
runs-on: macos-15-xlarge
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0.1'


- name: Select Xcode version
run: sudo xcode-select -s '/Applications/Xcode_16.4.app/Contents/Developer'

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: 'npm'

- run: sed -i '' "s/ENV\['RCT_NEW_ARCH_ENABLED'\] = '1'/ENV\['RCT_NEW_ARCH_ENABLED'\] = '0'/g" example/ios/Podfile
- run: sed -i '' 's/newArchEnabled=true/newArchEnabled=false/' example/android/gradle.properties
- run: npm ci
- run: bash ./scripts/run_ci_tasks.sh -a


- run: bash ./scripts/run_ci_tasks.sh -a
31 changes: 5 additions & 26 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,9 @@ buildscript {
}


def isNewArchitectureEnabled() {
return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
}

apply plugin: "com.android.library"
apply plugin: "kotlin-android"

if (isNewArchitectureEnabled()) {
apply plugin: "com.facebook.react"
}
apply plugin: "com.facebook.react"

def getExtOrIntegerDefault(name) {
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["Airship_" + name]).toInteger()
Expand All @@ -45,7 +38,6 @@ android {
minSdkVersion getExtOrIntegerDefault("minSdkVersion")
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
buildConfigField("String", "AIRSHIP_MODULE_VERSION", "\"${getModuleVersion()}\"")
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
consumerProguardFiles 'proguard-rules.pro'
}

Expand All @@ -70,15 +62,10 @@ android {

sourceSets {
main {
if (isNewArchitectureEnabled()) {
java.srcDirs += [
"src/newarch/java",
"generated/java",
"generated/jni"
]
} else {
java.srcDirs += ["src/oldarch/java"]
}
java.srcDirs += [
"generated/java",
"generated/jni"
]
}
}
}
Expand Down Expand Up @@ -108,11 +95,3 @@ dependencies {
implementation "com.urbanairship.android:airship-framework-proxy-hms:$proxy_version"
}
}

if (isNewArchitectureEnabled()) {
react {
jsRootDir = file("../src/")
libraryName = "Airship"
codegenJavaPackageName = "com.urbanairship.reactnative"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ class AirshipPackage : BaseReactPackage() {
return ReactModuleInfoProvider {
val moduleInfos: MutableMap<String, ReactModuleInfo> = HashMap()
moduleInfos[AirshipModule.NAME] = ReactModuleInfo(
name =AirshipModule.NAME,
name = AirshipModule.NAME,
className = AirshipModule.NAME,
canOverrideExistingModule = false,
needsEagerInit = false,
isCxxModule = false, // isCxxModule
isTurboModule = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED // isTurboModule
isTurboModule = true
)
moduleInfos
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,7 @@ class ReactMessageView(context: Context) : FrameLayout(context), LifecycleEventL
message = null

loadJob = scope.launch {
// Until ReactFeatureFlags.enableFabricPendingEventQueue is enabled by default, we need to avoid
// sending events when the view is unmounted because the events are discarded otherwise
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED && delayLoading) {
if (delayLoading) {
delay(50)
}

Expand Down Expand Up @@ -137,25 +135,25 @@ class ReactMessageView(context: Context) : FrameLayout(context), LifecycleEventL
event.putString(MESSAGE_ID_KEY, messageId)
event.putBoolean(RETRYABLE_KEY, retryable)
event.putString(ERROR_KEY, error)
notify(if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) EVENT_LOAD_ERROR else EVENT_LOAD_ERROR_HANDLER_NAME, event)
notify(EVENT_LOAD_ERROR, event)
}

private fun notifyLoadFinished(messageId: String) {
val event = Arguments.createMap()
event.putString(MESSAGE_ID_KEY, messageId)
notify(if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) EVENT_LOAD_FINISHED else EVENT_LOAD_FINISHED_HANDLER_NAME, event)
notify(EVENT_LOAD_FINISHED, event)
}

private fun notifyLoadStarted(messageId: String) {
val event = Arguments.createMap()
event.putString(MESSAGE_ID_KEY, messageId)
notify(if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) EVENT_LOAD_STARTED else EVENT_LOAD_STARTED_HANDLER_NAME, event)
notify(EVENT_LOAD_STARTED, event)
}

private fun notifyClose(messageId: String) {
val event = Arguments.createMap()
event.putString(MESSAGE_ID_KEY, messageId)
notify(if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) EVENT_CLOSE else EVENT_CLOSE_HANDLER_NAME, event)
notify(EVENT_CLOSE, event)
}

private fun notify(eventName: String, event: WritableMap) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,21 +59,12 @@ class ReactMessageViewManager : SimpleViewManager<ReactMessageView>(),
}

override fun getExportedCustomBubblingEventTypeConstants(): Map<String, Any> {
val events = if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
listOf(
val events = listOf(
ReactMessageView.EVENT_CLOSE_REGISTRATION_NAME to ReactMessageView.EVENT_CLOSE_HANDLER_NAME,
ReactMessageView.EVENT_LOAD_ERROR_REGISTRATION_NAME to ReactMessageView.EVENT_LOAD_ERROR_HANDLER_NAME,
ReactMessageView.EVENT_LOAD_FINISHED_REGISTRATION_NAME to ReactMessageView.EVENT_LOAD_FINISHED_HANDLER_NAME,
ReactMessageView.EVENT_LOAD_STARTED_REGISTRATION_NAME to ReactMessageView.EVENT_LOAD_STARTED_HANDLER_NAME
)
} else {
listOf(
ReactMessageView.EVENT_CLOSE_HANDLER_NAME to ReactMessageView.EVENT_CLOSE_HANDLER_NAME,
ReactMessageView.EVENT_LOAD_ERROR_HANDLER_NAME to ReactMessageView.EVENT_LOAD_ERROR_HANDLER_NAME,
ReactMessageView.EVENT_LOAD_FINISHED_HANDLER_NAME to ReactMessageView.EVENT_LOAD_FINISHED_HANDLER_NAME,
ReactMessageView.EVENT_LOAD_STARTED_HANDLER_NAME to ReactMessageView.EVENT_LOAD_STARTED_HANDLER_NAME
)
}

val builder = MapBuilder.builder<String, Any>()

Expand Down

This file was deleted.

This file was deleted.

Loading