@ua/react-native-airship 25.3.1 → 26.0.0
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.
- package/README.md +150 -21
- package/android/build.gradle +8 -29
- package/android/gradle.properties +2 -2
- package/android/src/main/java/com/urbanairship/reactnative/AirshipModule.kt +5 -3
- package/android/src/main/java/com/urbanairship/reactnative/AirshipPackage.kt +4 -2
- package/android/src/{newarch → main}/java/com/urbanairship/reactnative/AirshipSpec.kt +2 -0
- package/android/src/main/java/com/urbanairship/reactnative/DataMigrator.kt +2 -0
- package/android/src/main/java/com/urbanairship/reactnative/ManifestUtils.kt +0 -10
- package/android/src/main/java/com/urbanairship/reactnative/ReactAutopilot.kt +9 -26
- package/android/src/{newarch → main}/java/com/urbanairship/reactnative/ReactContextExtensions.kt +2 -0
- package/android/src/main/java/com/urbanairship/reactnative/ReactEmbeddedView.kt +0 -4
- package/android/src/main/java/com/urbanairship/reactnative/ReactMessageView.kt +5 -7
- package/android/src/main/java/com/urbanairship/reactnative/ReactMessageViewManager.kt +4 -21
- package/android/src/main/java/com/urbanairship/reactnative/ReactNotificationProvider.kt +1 -1
- package/android/src/main/java/com/urbanairship/reactnative/Utils.kt +1 -3
- package/ios/AirshipPluginLoader.swift +2 -5
- package/ios/AirshipReactNative.swift +6 -13
- package/ios/RNAirship.h +1 -1
- package/ios/RNAirship.mm +9 -6
- package/ios/RNAirshipEmbeddedView.mm +4 -4
- package/ios/RNAirshipMessageView.mm +4 -4
- package/lib/module/NativeRNAirship.js.map +1 -1
- package/lib/module/RNAirshipEmbeddedViewNativeComponent.ts +1 -2
- package/lib/module/RNAirshipMessageViewNativeComponent.ts +1 -2
- package/lib/typescript/src/NativeRNAirship.d.ts +1 -1
- package/lib/typescript/src/NativeRNAirship.d.ts.map +1 -1
- package/lib/typescript/src/RNAirshipEmbeddedViewNativeComponent.d.ts +1 -1
- package/lib/typescript/src/RNAirshipEmbeddedViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/RNAirshipMessageViewNativeComponent.d.ts +1 -1
- package/lib/typescript/src/RNAirshipMessageViewNativeComponent.d.ts.map +1 -1
- package/package.json +23 -34
- package/react-native-airship.podspec +5 -4
- package/src/NativeRNAirship.ts +1 -2
- package/src/RNAirshipEmbeddedViewNativeComponent.ts +1 -2
- package/src/RNAirshipMessageViewNativeComponent.ts +1 -2
- package/android/generated/java/com/facebook/react/viewmanagers/RNAirshipEmbeddedViewManagerDelegate.java +0 -32
- package/android/generated/java/com/facebook/react/viewmanagers/RNAirshipEmbeddedViewManagerInterface.java +0 -18
- package/android/generated/java/com/facebook/react/viewmanagers/RNAirshipMessageViewManagerDelegate.java +0 -32
- package/android/generated/java/com/facebook/react/viewmanagers/RNAirshipMessageViewManagerInterface.java +0 -18
- package/android/generated/java/com/urbanairship/reactnative/NativeRNAirshipSpec.java +0 -413
- package/android/generated/jni/CMakeLists.txt +0 -28
- package/android/generated/jni/RNAirshipSpec-generated.cpp +0 -590
- package/android/generated/jni/RNAirshipSpec.h +0 -31
- package/android/generated/jni/react/renderer/components/RNAirshipSpec/ComponentDescriptors.cpp +0 -23
- package/android/generated/jni/react/renderer/components/RNAirshipSpec/ComponentDescriptors.h +0 -25
- package/android/generated/jni/react/renderer/components/RNAirshipSpec/EventEmitters.cpp +0 -54
- package/android/generated/jni/react/renderer/components/RNAirshipSpec/EventEmitters.h +0 -52
- package/android/generated/jni/react/renderer/components/RNAirshipSpec/Props.cpp +0 -76
- package/android/generated/jni/react/renderer/components/RNAirshipSpec/Props.h +0 -49
- package/android/generated/jni/react/renderer/components/RNAirshipSpec/RNAirshipSpecJSI-generated.cpp +0 -665
- package/android/generated/jni/react/renderer/components/RNAirshipSpec/RNAirshipSpecJSI.h +0 -908
- package/android/generated/jni/react/renderer/components/RNAirshipSpec/ShadowNodes.cpp +0 -18
- package/android/generated/jni/react/renderer/components/RNAirshipSpec/ShadowNodes.h +0 -43
- package/android/generated/jni/react/renderer/components/RNAirshipSpec/States.cpp +0 -16
- package/android/generated/jni/react/renderer/components/RNAirshipSpec/States.h +0 -22
- package/android/src/main/java/com/urbanairship/reactnative/AirshipExtender.kt +0 -16
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/RNAirshipEmbeddedViewManagerInterface.java +0 -17
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/RNAirshipMessageViewManagerInterface.java +0 -17
- package/android/src/oldarch/java/com/urbanairship/reactnative/AirshipSpec.kt +0 -475
- package/android/src/oldarch/java/com/urbanairship/reactnative/ReactContextExtensions.kt +0 -10
- package/ios/generated/RNAirshipSpec/ComponentDescriptors.cpp +0 -23
- package/ios/generated/RNAirshipSpec/ComponentDescriptors.h +0 -25
- package/ios/generated/RNAirshipSpec/EventEmitters.cpp +0 -54
- package/ios/generated/RNAirshipSpec/EventEmitters.h +0 -52
- package/ios/generated/RNAirshipSpec/Props.cpp +0 -76
- package/ios/generated/RNAirshipSpec/Props.h +0 -49
- package/ios/generated/RNAirshipSpec/RCTComponentViewHelpers.h +0 -24
- package/ios/generated/RNAirshipSpec/RNAirshipSpec-generated.mm +0 -690
- package/ios/generated/RNAirshipSpec/RNAirshipSpec.h +0 -293
- package/ios/generated/RNAirshipSpec/ShadowNodes.cpp +0 -18
- package/ios/generated/RNAirshipSpec/ShadowNodes.h +0 -43
- package/ios/generated/RNAirshipSpec/States.cpp +0 -16
- package/ios/generated/RNAirshipSpec/States.h +0 -22
- package/ios/generated/RNAirshipSpecJSI-generated.cpp +0 -665
- package/ios/generated/RNAirshipSpecJSI.h +0 -908
- package/react-native.config.js +0 -12
package/README.md
CHANGED
|
@@ -1,34 +1,163 @@
|
|
|
1
1
|
# Airship React Native
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://badge.fury.io/js/%40ua%2Freact-native-airship)
|
|
4
|
+
[](https://opensource.org/licenses/Apache-2.0)
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
The official Airship React Native module for iOS and Android.
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
| --------------- | -------------------------- | ------------- |
|
|
9
|
-
| 0.81.x | 25.x | Active |
|
|
10
|
-
| 0.80.x | 24.x | Active |
|
|
11
|
-
| 0.79.x | 24.x | End of Cycle |
|
|
12
|
-
| 0.78.x | 23.x | Unsupported |
|
|
13
|
-
| 0.70.x<=0.77.x | 21.x | Unsupported |
|
|
8
|
+
## Features
|
|
14
9
|
|
|
15
|
-
|
|
10
|
+
- **Push Notifications** - Rich, interactive push notifications with deep linking
|
|
11
|
+
- **Live Activities & Live Updates** - Real-time content updates on iOS Lock Screen and Android Live Content
|
|
12
|
+
- **In-App Experiences** - Contextual messaging, automation, and Scenes
|
|
13
|
+
- **Embedded Content** - Render Airship Scenes directly in your React Native app
|
|
14
|
+
- **Custom Views** - Extend Scenes with native content
|
|
15
|
+
- **Message Center** - Persistent inbox for rich messages with HTML, video, and interactive content
|
|
16
|
+
- **Preference Center** - User preference management
|
|
17
|
+
- **Feature Flags** - Dynamic feature toggles and experimentation
|
|
18
|
+
- **Analytics** - Comprehensive user behavior tracking
|
|
19
|
+
- **Contacts** - User identification and contact management
|
|
20
|
+
- **Tags, Attributes & Subscription Lists** - User segmentation, personalization, and subscription management
|
|
21
|
+
- **Privacy Controls** - Granular data collection and feature management
|
|
22
|
+
- **Extensible & Hybrid Compatible** - Works seamlessly in hybrid apps and supports native extensions
|
|
16
23
|
|
|
17
|
-
|
|
18
|
-
and will support at least two major React Native versions at any given time.
|
|
24
|
+
## Quick Start
|
|
19
25
|
|
|
20
|
-
|
|
21
|
-
of Airship may support the same React Native version. When a new major version of Airship is released for an already-supported
|
|
22
|
-
React Native version, the previous version will enter [End of Cycle](https://github.com/reactwg/react-native-releases/blob/main/docs/support.md#what-level-of-support-can-be-expected)
|
|
23
|
-
status.
|
|
26
|
+
### Standard React Native
|
|
24
27
|
|
|
28
|
+
Install the package:
|
|
29
|
+
```bash
|
|
30
|
+
npm install @ua/react-native-airship --save
|
|
31
|
+
```
|
|
32
|
+
or
|
|
33
|
+
```bash
|
|
34
|
+
yarn add @ua/react-native-airship
|
|
35
|
+
```
|
|
25
36
|
|
|
26
|
-
###
|
|
37
|
+
### Expo
|
|
27
38
|
|
|
28
|
-
|
|
29
|
-
* [API docs](http://docs.airship.com/reference/libraries/react-native/latest/index.html)
|
|
39
|
+
Apps using Expo can use the `airship-expo-plugin` to configure the project. You will need to use `expo prebuild` (custom dev client) or `eas build` since this package contains native code.
|
|
30
40
|
|
|
31
|
-
|
|
41
|
+
First, install the plugin and the main package:
|
|
42
|
+
```bash
|
|
43
|
+
expo install airship-expo-plugin
|
|
44
|
+
yarn add @ua/react-native-airship
|
|
45
|
+
```
|
|
32
46
|
|
|
33
|
-
|
|
47
|
+
Then, add the plugin to your `app.json`:
|
|
48
|
+
```json
|
|
49
|
+
"plugins": [
|
|
50
|
+
[
|
|
51
|
+
"airship-expo-plugin",
|
|
52
|
+
{
|
|
53
|
+
"android": {
|
|
54
|
+
"icon": "./path/to/ic_notification.png"
|
|
55
|
+
},
|
|
56
|
+
"ios": {
|
|
57
|
+
"mode": "development"
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
]
|
|
61
|
+
]
|
|
62
|
+
```
|
|
34
63
|
|
|
64
|
+
**Known Issues**
|
|
65
|
+
- **Expo SDK 50+ (Dev Builds):** Tapping a foreground notification may cause the app to reload when running in a dev client. This can be resolved by setting the `launchMode` to `launcher` in your `app.json` for `expo-dev-client`. See [issue #550](https://github.com/urbanairship/react-native-airship/issues/550) for more details.
|
|
66
|
+
```json
|
|
67
|
+
"plugins": [
|
|
68
|
+
[
|
|
69
|
+
"expo-dev-client",
|
|
70
|
+
{
|
|
71
|
+
"ios": { "launchMode": "launcher" },
|
|
72
|
+
"android": { "launchMode": "launcher" }
|
|
73
|
+
}
|
|
74
|
+
]
|
|
75
|
+
]
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Initialization
|
|
79
|
+
|
|
80
|
+
Initialize Airship in your `App.tsx`:
|
|
81
|
+
```typescript
|
|
82
|
+
import { useEffect } from 'react';
|
|
83
|
+
import Airship from '@ua/react-native-airship';
|
|
84
|
+
|
|
85
|
+
export default function App() {
|
|
86
|
+
useEffect(() => {
|
|
87
|
+
const takeOff = async () => {
|
|
88
|
+
try {
|
|
89
|
+
await Airship.takeOff({
|
|
90
|
+
default: {
|
|
91
|
+
appKey: "YOUR_APP_KEY",
|
|
92
|
+
appSecret: "YOUR_APP_SECRET"
|
|
93
|
+
},
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
await Airship.push.enableUserNotifications();
|
|
97
|
+
} catch (error) {
|
|
98
|
+
console.error("Failed to take off:", error);
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
takeOff();
|
|
103
|
+
}, []);
|
|
104
|
+
|
|
105
|
+
// ... your app code
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
For a more detailed setup guide, please see the full [Getting Started Documentation](https://docs.airship.com/developer/sdk-integration/react-native/installation/getting-started).
|
|
110
|
+
|
|
111
|
+
## Supported Versions
|
|
112
|
+
|
|
113
|
+
| Airship RN Version | Airship SDK Version | Supported RN Versions | Support Status |
|
|
114
|
+
| :----------------- | :------------------ | :-------------------- | :------------------------------------ |
|
|
115
|
+
| **26.x** | 20.x | 0.82.x – 0.83.x | **Active** |
|
|
116
|
+
| **25.x** | 19.x | 0.81.x – 0.82.x | **Maintenance** (Until Jun 8, 2026) |
|
|
117
|
+
| **24.x** | 19.x | 0.79.x – 0.80.x | **Maintenance** (Until Feb 21, 2026) |
|
|
118
|
+
| **23.x** | 19.x | 0.78.x | **Unsupported** |
|
|
119
|
+
| **21.x** | 19.x | 0.70.x – 0.77.x | **Unsupported** |
|
|
120
|
+
|
|
121
|
+
*Table last updated: December 8, 2025*
|
|
122
|
+
|
|
123
|
+
### Support Policy Definitions
|
|
124
|
+
|
|
125
|
+
Airship adheres to **Semantic Versioning** and the [React Native Support Policy](https://github.com/reactwg/react-native-releases/blob/main/docs/support.md).
|
|
126
|
+
|
|
127
|
+
- **Version Strategy:** Breaking changes in React Native, Airship’s native SDKs, or the module’s public API may require a new major version.
|
|
128
|
+
- **Compatibility:** Only **Active** versions are evaluated for compatibility when new React Native versions are released. Compatibility with new React Native releases may require a new major Airship version.
|
|
129
|
+
- **Backports:** React Native compatibility updates are **not backported** to older Airship versions.
|
|
130
|
+
|
|
131
|
+
#### Active
|
|
132
|
+
|
|
133
|
+
Active versions are major releases of the Airship React Native Module that are currently in active development. These versions receive new features, bug fixes, and support for the React Native versions listed in the table above.
|
|
134
|
+
|
|
135
|
+
More than one major version may be Active at the same time when each targets a different React Native version range.
|
|
136
|
+
|
|
137
|
+
A new major version of the Airship React Native Module will be released if:
|
|
138
|
+
1. **React Native Upgrades:** A new React Native release requires breaking changes to the module.
|
|
139
|
+
2. **Airship SDK Upgrades:** The underlying native Airship SDKs (iOS/Android) introduce breaking changes or major architecture updates.
|
|
140
|
+
3. **Module API Changes:** Breaking changes are made to the Airship React Native Module’s public API or packaging.
|
|
141
|
+
|
|
142
|
+
#### Maintenance (End of Cycle)
|
|
143
|
+
|
|
144
|
+
A major version enters a **6-month Maintenance window** when either:
|
|
145
|
+
1. It is superseded by a newer major release **targeting the same React Native versions**, or
|
|
146
|
+
2. The React Native versions it supports reach `End of Cycle` or `Unsupported` in the official React Native policy.
|
|
147
|
+
|
|
148
|
+
- **Duration:** The maintenance window lasts for 6 months from the date the trigger occurs.
|
|
149
|
+
- **Includes:** Updates include critical bug fixes and security patches, **provided they can be resolved without breaking changes**.
|
|
150
|
+
- **Excludes:** Updates exclude new features or support for *future* React Native versions (e.g., RN 0.83+ will not be added to Airship 25.x).
|
|
151
|
+
- **Goal:** The goal is to provide a stable transition period for customers to migrate to an Active version.
|
|
152
|
+
|
|
153
|
+
#### Unsupported (End of Life)
|
|
154
|
+
|
|
155
|
+
Unsupported versions are releases that have passed their Maintenance window. No updates or support are provided for these versions.
|
|
156
|
+
|
|
157
|
+
## Resources
|
|
158
|
+
|
|
159
|
+
- **[Documentation](https://docs.airship.com/developer/sdk-integration/react-native)** - Complete SDK integration guides and feature documentation
|
|
160
|
+
- **[API Reference](https://docs.airship.com/reference/libraries/react-native/latest/)** - Detailed TypeScript API documentation
|
|
161
|
+
- **[GitHub Issues](https://github.com/urbanairship/react-native-airship/issues)** - Report bugs and request features
|
|
162
|
+
- **[Changelog](CHANGELOG.md)** - Release notes and version history
|
|
163
|
+
- **[Migration Guide](MIGRATION.md)** - Upgrade guides between major versions
|
package/android/build.gradle
CHANGED
|
@@ -11,23 +11,16 @@ buildscript {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
dependencies {
|
|
14
|
-
classpath "com.android.tools.build:gradle:8.
|
|
14
|
+
classpath "com.android.tools.build:gradle:8.13.0"
|
|
15
15
|
// noinspection DifferentKotlinGradleVersion
|
|
16
16
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${getExtOrDefault('kotlinVersion')}"
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
def isNewArchitectureEnabled() {
|
|
22
|
-
return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
|
|
23
|
-
}
|
|
24
|
-
|
|
25
21
|
apply plugin: "com.android.library"
|
|
26
22
|
apply plugin: "kotlin-android"
|
|
27
|
-
|
|
28
|
-
if (isNewArchitectureEnabled()) {
|
|
29
|
-
apply plugin: "com.facebook.react"
|
|
30
|
-
}
|
|
23
|
+
apply plugin: "com.facebook.react"
|
|
31
24
|
|
|
32
25
|
def getExtOrIntegerDefault(name) {
|
|
33
26
|
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["Airship_" + name]).toInteger()
|
|
@@ -45,7 +38,6 @@ android {
|
|
|
45
38
|
minSdkVersion getExtOrIntegerDefault("minSdkVersion")
|
|
46
39
|
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
|
|
47
40
|
buildConfigField("String", "AIRSHIP_MODULE_VERSION", "\"${getModuleVersion()}\"")
|
|
48
|
-
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
|
|
49
41
|
consumerProguardFiles 'proguard-rules.pro'
|
|
50
42
|
}
|
|
51
43
|
|
|
@@ -64,21 +56,16 @@ android {
|
|
|
64
56
|
}
|
|
65
57
|
|
|
66
58
|
compileOptions {
|
|
67
|
-
sourceCompatibility JavaVersion.
|
|
68
|
-
targetCompatibility JavaVersion.
|
|
59
|
+
sourceCompatibility JavaVersion.VERSION_17
|
|
60
|
+
targetCompatibility JavaVersion.VERSION_17
|
|
69
61
|
}
|
|
70
62
|
|
|
71
63
|
sourceSets {
|
|
72
64
|
main {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
"generated/jni"
|
|
78
|
-
]
|
|
79
|
-
} else {
|
|
80
|
-
java.srcDirs += ["src/oldarch/java"]
|
|
81
|
-
}
|
|
65
|
+
java.srcDirs += [
|
|
66
|
+
"generated/java",
|
|
67
|
+
"generated/jni"
|
|
68
|
+
]
|
|
82
69
|
}
|
|
83
70
|
}
|
|
84
71
|
}
|
|
@@ -108,11 +95,3 @@ dependencies {
|
|
|
108
95
|
implementation "com.urbanairship.android:airship-framework-proxy-hms:$proxy_version"
|
|
109
96
|
}
|
|
110
97
|
}
|
|
111
|
-
|
|
112
|
-
if (isNewArchitectureEnabled()) {
|
|
113
|
-
react {
|
|
114
|
-
jsRootDir = file("../src/")
|
|
115
|
-
libraryName = "Airship"
|
|
116
|
-
codegenJavaPackageName = "com.urbanairship.reactnative"
|
|
117
|
-
}
|
|
118
|
-
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/* Copyright Airship and Contributors */
|
|
2
|
+
|
|
1
3
|
package com.urbanairship.reactnative
|
|
2
4
|
|
|
3
5
|
import android.annotation.SuppressLint
|
|
@@ -5,7 +7,7 @@ import android.os.Build
|
|
|
5
7
|
import com.facebook.react.bridge.*
|
|
6
8
|
import com.facebook.react.modules.core.RCTNativeAppEventEmitter
|
|
7
9
|
import com.urbanairship.actions.ActionResult
|
|
8
|
-
import com.urbanairship.android.framework.proxy.EventType
|
|
10
|
+
import com.urbanairship.android.framework.proxy.events.EventType
|
|
9
11
|
import com.urbanairship.android.framework.proxy.ProxyLogger
|
|
10
12
|
import com.urbanairship.android.framework.proxy.events.EventEmitter
|
|
11
13
|
import com.urbanairship.android.framework.proxy.proxies.AirshipProxy
|
|
@@ -81,7 +83,7 @@ class AirshipModule internal constructor(val context: ReactApplicationContext) :
|
|
|
81
83
|
|
|
82
84
|
context.addLifecycleEventListener(object : LifecycleEventListener {
|
|
83
85
|
override fun onHostResume() {
|
|
84
|
-
val backgroundTypes = EventType.
|
|
86
|
+
val backgroundTypes = EventType.entries.filter { !it.isForeground() }
|
|
85
87
|
if (EventEmitter.shared().hasEvents(backgroundTypes)) {
|
|
86
88
|
AirshipHeadlessEventService.startService(context)
|
|
87
89
|
}
|
|
@@ -500,7 +502,7 @@ class AirshipModule internal constructor(val context: ReactApplicationContext) :
|
|
|
500
502
|
override fun actionRun(action: ReadableMap, promise: Promise) {
|
|
501
503
|
promise.resolve(scope) {
|
|
502
504
|
val result = proxy.actions.runAction(requireNotNull(action.getString("name")), Utils.convertDynamic(action.getDynamic("value")))
|
|
503
|
-
if (result.status == ActionResult.
|
|
505
|
+
if (result.status == ActionResult.Status.COMPLETED) {
|
|
504
506
|
result.value
|
|
505
507
|
} else {
|
|
506
508
|
throw Exception("Action failed ${result.status}")
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/* Copyright Airship and Contributors */
|
|
2
|
+
|
|
1
3
|
package com.urbanairship.reactnative
|
|
2
4
|
|
|
3
5
|
import com.facebook.react.BaseReactPackage
|
|
@@ -20,12 +22,12 @@ class AirshipPackage : BaseReactPackage() {
|
|
|
20
22
|
return ReactModuleInfoProvider {
|
|
21
23
|
val moduleInfos: MutableMap<String, ReactModuleInfo> = HashMap()
|
|
22
24
|
moduleInfos[AirshipModule.NAME] = ReactModuleInfo(
|
|
23
|
-
name =AirshipModule.NAME,
|
|
25
|
+
name = AirshipModule.NAME,
|
|
24
26
|
className = AirshipModule.NAME,
|
|
25
27
|
canOverrideExistingModule = false,
|
|
26
28
|
needsEagerInit = false,
|
|
27
29
|
isCxxModule = false, // isCxxModule
|
|
28
|
-
isTurboModule =
|
|
30
|
+
isTurboModule = true
|
|
29
31
|
)
|
|
30
32
|
moduleInfos
|
|
31
33
|
}
|
|
@@ -6,16 +6,6 @@ import android.content.pm.PackageManager
|
|
|
6
6
|
object ManifestUtils {
|
|
7
7
|
|
|
8
8
|
private const val HEADLESS_JS_TASK_ON_START_MANIFEST_KEY = "com.urbanairship.reactnative.ALLOW_HEADLESS_JS_TASK_BEFORE_MODULE"
|
|
9
|
-
private const val EXTENDER_MANIFEST_KEY = "com.urbanairship.reactnative.AIRSHIP_EXTENDER"
|
|
10
|
-
|
|
11
|
-
fun Context.extenderClassName(): String? {
|
|
12
|
-
return try {
|
|
13
|
-
this.packageManager.getApplicationInfo(this.packageName, PackageManager.GET_META_DATA)
|
|
14
|
-
.metaData.getString(EXTENDER_MANIFEST_KEY)
|
|
15
|
-
} catch (e: PackageManager.NameNotFoundException) {
|
|
16
|
-
null
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
9
|
|
|
20
10
|
fun Context.isHeadlessJSTaskEnabledOnStart(): Boolean {
|
|
21
11
|
return try {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
/* Copyright
|
|
1
|
+
/* Copyright Airship and Contributors */
|
|
2
2
|
|
|
3
3
|
package com.urbanairship.reactnative
|
|
4
4
|
|
|
5
5
|
import android.content.Context
|
|
6
|
-
import com.urbanairship.
|
|
6
|
+
import com.urbanairship.Airship
|
|
7
7
|
import com.urbanairship.analytics.Extension
|
|
8
8
|
import com.urbanairship.android.framework.proxy.BaseAutopilot
|
|
9
|
-
import com.urbanairship.android.framework.proxy.Event
|
|
10
|
-
import com.urbanairship.android.framework.proxy.EventType
|
|
9
|
+
import com.urbanairship.android.framework.proxy.events.Event
|
|
10
|
+
import com.urbanairship.android.framework.proxy.events.EventType
|
|
11
11
|
import com.urbanairship.android.framework.proxy.ProxyLogger
|
|
12
12
|
import com.urbanairship.android.framework.proxy.ProxyStore
|
|
13
13
|
import com.urbanairship.android.framework.proxy.events.EventEmitter
|
|
@@ -15,7 +15,6 @@ import com.urbanairship.embedded.AirshipEmbeddedInfo
|
|
|
15
15
|
import com.urbanairship.embedded.AirshipEmbeddedObserver
|
|
16
16
|
import com.urbanairship.json.JsonMap
|
|
17
17
|
import com.urbanairship.json.jsonMapOf
|
|
18
|
-
import com.urbanairship.reactnative.ManifestUtils.extenderClassName
|
|
19
18
|
import com.urbanairship.reactnative.ManifestUtils.isHeadlessJSTaskEnabledOnStart
|
|
20
19
|
import kotlinx.coroutines.CoroutineScope
|
|
21
20
|
import kotlinx.coroutines.Dispatchers
|
|
@@ -30,8 +29,8 @@ class ReactAutopilot : BaseAutopilot() {
|
|
|
30
29
|
|
|
31
30
|
private val scope = CoroutineScope(Dispatchers.Main + SupervisorJob())
|
|
32
31
|
|
|
33
|
-
override fun onReady(context: Context
|
|
34
|
-
ProxyLogger.info("Airship React Native version:
|
|
32
|
+
override fun onReady(context: Context) {
|
|
33
|
+
ProxyLogger.info("Airship React Native version: ${BuildConfig.AIRSHIP_MODULE_VERSION}, SDK version: ${Airship.version}")
|
|
35
34
|
|
|
36
35
|
val allowHeadlessJsTaskBeforeModule = context.isHeadlessJSTaskEnabledOnStart()
|
|
37
36
|
ProxyLogger.debug("ALLOW_HEADLESS_JS_TASK_BEFORE_MODULE: $allowHeadlessJsTaskBeforeModule")
|
|
@@ -53,31 +52,15 @@ class ReactAutopilot : BaseAutopilot() {
|
|
|
53
52
|
}
|
|
54
53
|
|
|
55
54
|
// Set our custom notification provider
|
|
56
|
-
val notificationProvider = ReactNotificationProvider(context,
|
|
57
|
-
|
|
55
|
+
val notificationProvider = ReactNotificationProvider(context, Airship.airshipConfigOptions)
|
|
56
|
+
Airship.push.notificationProvider = notificationProvider
|
|
58
57
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
// Legacy extender
|
|
62
|
-
val extender = createExtender(context)
|
|
63
|
-
extender?.onAirshipReady(context, airship)
|
|
58
|
+
Airship.analytics.registerSDKExtension(Extension.REACT_NATIVE, BuildConfig.AIRSHIP_MODULE_VERSION)
|
|
64
59
|
}
|
|
65
60
|
|
|
66
61
|
override fun onMigrateData(context: Context, proxyStore: ProxyStore) {
|
|
67
62
|
DataMigrator(context).migrateData(proxyStore)
|
|
68
63
|
}
|
|
69
|
-
|
|
70
|
-
@Suppress("deprecation")
|
|
71
|
-
private fun createExtender(context: Context): AirshipExtender? {
|
|
72
|
-
val className = context.extenderClassName() ?: return null
|
|
73
|
-
try {
|
|
74
|
-
val extenderClass = Class.forName(className)
|
|
75
|
-
return extenderClass.getDeclaredConstructor().newInstance() as AirshipExtender
|
|
76
|
-
} catch (e: Exception) {
|
|
77
|
-
ProxyLogger.error(e, "Unable to create extender: $className")
|
|
78
|
-
}
|
|
79
|
-
return null
|
|
80
|
-
}
|
|
81
64
|
}
|
|
82
65
|
|
|
83
66
|
internal class PendingEmbeddedUpdated(pending: List<AirshipEmbeddedInfo>) : Event {
|
|
@@ -3,11 +3,7 @@
|
|
|
3
3
|
package com.urbanairship.reactnative
|
|
4
4
|
|
|
5
5
|
import android.content.Context
|
|
6
|
-
import android.graphics.Color
|
|
7
|
-
import android.view.View
|
|
8
6
|
import android.widget.FrameLayout
|
|
9
|
-
import androidx.core.view.doOnAttach
|
|
10
|
-
import com.facebook.react.bridge.LifecycleEventListener
|
|
11
7
|
import com.urbanairship.embedded.AirshipEmbeddedView
|
|
12
8
|
|
|
13
9
|
class ReactEmbeddedView(context: Context) : FrameLayout(context) {
|
|
@@ -101,9 +101,7 @@ class ReactMessageView(context: Context) : FrameLayout(context), LifecycleEventL
|
|
|
101
101
|
message = null
|
|
102
102
|
|
|
103
103
|
loadJob = scope.launch {
|
|
104
|
-
|
|
105
|
-
// sending events when the view is unmounted because the events are discarded otherwise
|
|
106
|
-
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED && delayLoading) {
|
|
104
|
+
if (delayLoading) {
|
|
107
105
|
delay(50)
|
|
108
106
|
}
|
|
109
107
|
|
|
@@ -137,25 +135,25 @@ class ReactMessageView(context: Context) : FrameLayout(context), LifecycleEventL
|
|
|
137
135
|
event.putString(MESSAGE_ID_KEY, messageId)
|
|
138
136
|
event.putBoolean(RETRYABLE_KEY, retryable)
|
|
139
137
|
event.putString(ERROR_KEY, error)
|
|
140
|
-
notify(
|
|
138
|
+
notify(EVENT_LOAD_ERROR, event)
|
|
141
139
|
}
|
|
142
140
|
|
|
143
141
|
private fun notifyLoadFinished(messageId: String) {
|
|
144
142
|
val event = Arguments.createMap()
|
|
145
143
|
event.putString(MESSAGE_ID_KEY, messageId)
|
|
146
|
-
notify(
|
|
144
|
+
notify(EVENT_LOAD_FINISHED, event)
|
|
147
145
|
}
|
|
148
146
|
|
|
149
147
|
private fun notifyLoadStarted(messageId: String) {
|
|
150
148
|
val event = Arguments.createMap()
|
|
151
149
|
event.putString(MESSAGE_ID_KEY, messageId)
|
|
152
|
-
notify(
|
|
150
|
+
notify(EVENT_LOAD_STARTED, event)
|
|
153
151
|
}
|
|
154
152
|
|
|
155
153
|
private fun notifyClose(messageId: String) {
|
|
156
154
|
val event = Arguments.createMap()
|
|
157
155
|
event.putString(MESSAGE_ID_KEY, messageId)
|
|
158
|
-
notify(
|
|
156
|
+
notify(EVENT_CLOSE, event)
|
|
159
157
|
}
|
|
160
158
|
|
|
161
159
|
private fun notify(eventName: String, event: WritableMap) {
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
package com.urbanairship.reactnative
|
|
4
4
|
|
|
5
|
-
import com.facebook.react.common.MapBuilder
|
|
6
5
|
import com.facebook.react.uimanager.SimpleViewManager
|
|
7
6
|
import com.facebook.react.uimanager.ThemedReactContext
|
|
8
7
|
import com.facebook.react.uimanager.ViewManagerDelegate
|
|
@@ -59,35 +58,19 @@ class ReactMessageViewManager : SimpleViewManager<ReactMessageView>(),
|
|
|
59
58
|
}
|
|
60
59
|
|
|
61
60
|
override fun getExportedCustomBubblingEventTypeConstants(): Map<String, Any> {
|
|
62
|
-
val events =
|
|
63
|
-
listOf(
|
|
61
|
+
val events = listOf(
|
|
64
62
|
ReactMessageView.EVENT_CLOSE_REGISTRATION_NAME to ReactMessageView.EVENT_CLOSE_HANDLER_NAME,
|
|
65
63
|
ReactMessageView.EVENT_LOAD_ERROR_REGISTRATION_NAME to ReactMessageView.EVENT_LOAD_ERROR_HANDLER_NAME,
|
|
66
64
|
ReactMessageView.EVENT_LOAD_FINISHED_REGISTRATION_NAME to ReactMessageView.EVENT_LOAD_FINISHED_HANDLER_NAME,
|
|
67
65
|
ReactMessageView.EVENT_LOAD_STARTED_REGISTRATION_NAME to ReactMessageView.EVENT_LOAD_STARTED_HANDLER_NAME
|
|
68
66
|
)
|
|
69
|
-
} else {
|
|
70
|
-
listOf(
|
|
71
|
-
ReactMessageView.EVENT_CLOSE_HANDLER_NAME to ReactMessageView.EVENT_CLOSE_HANDLER_NAME,
|
|
72
|
-
ReactMessageView.EVENT_LOAD_ERROR_HANDLER_NAME to ReactMessageView.EVENT_LOAD_ERROR_HANDLER_NAME,
|
|
73
|
-
ReactMessageView.EVENT_LOAD_FINISHED_HANDLER_NAME to ReactMessageView.EVENT_LOAD_FINISHED_HANDLER_NAME,
|
|
74
|
-
ReactMessageView.EVENT_LOAD_STARTED_HANDLER_NAME to ReactMessageView.EVENT_LOAD_STARTED_HANDLER_NAME
|
|
75
|
-
)
|
|
76
|
-
}
|
|
77
67
|
|
|
78
|
-
val builder = MapBuilder.builder<String, Any>()
|
|
79
68
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
MapBuilder.of(
|
|
84
|
-
"phasedRegistrationNames",
|
|
85
|
-
MapBuilder.of("bubbled", handlerName)
|
|
86
|
-
)
|
|
69
|
+
return events.associate { (name, handlerName) ->
|
|
70
|
+
name to mapOf(
|
|
71
|
+
"phasedRegistrationNames" to mapOf("bubbled" to handlerName)
|
|
87
72
|
)
|
|
88
73
|
}
|
|
89
|
-
|
|
90
|
-
return builder.build()
|
|
91
74
|
}
|
|
92
75
|
|
|
93
76
|
companion object {
|
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
package com.urbanairship.reactnative
|
|
4
4
|
|
|
5
5
|
import com.facebook.react.bridge.*
|
|
6
|
-
import com.urbanairship.
|
|
7
|
-
import com.urbanairship.android.framework.proxy.EventType
|
|
6
|
+
import com.urbanairship.android.framework.proxy.events.EventType
|
|
8
7
|
import com.urbanairship.json.JsonMap
|
|
9
8
|
import com.urbanairship.json.JsonValue
|
|
10
9
|
|
|
@@ -68,7 +67,6 @@ object Utils {
|
|
|
68
67
|
val array = obj.asArray()
|
|
69
68
|
convertArray(array)
|
|
70
69
|
}
|
|
71
|
-
else -> JsonValue.NULL
|
|
72
70
|
}
|
|
73
71
|
}
|
|
74
72
|
|
|
@@ -6,12 +6,9 @@ import AirshipFrameworkProxy
|
|
|
6
6
|
public class AirshipPluginLoader: NSObject, AirshipPluginLoaderProtocol {
|
|
7
7
|
@objc
|
|
8
8
|
public static var disabled: Bool = false
|
|
9
|
-
|
|
10
|
-
public static func onApplicationDidFinishLaunching(
|
|
11
|
-
launchOptions: [UIApplication.LaunchOptionsKey : Any]?
|
|
12
|
-
) {
|
|
9
|
+
public static func onLoad() {
|
|
13
10
|
if (!disabled) {
|
|
14
|
-
AirshipReactNative.shared.onLoad(
|
|
11
|
+
AirshipReactNative.shared.onLoad()
|
|
15
12
|
}
|
|
16
13
|
}
|
|
17
14
|
}
|
|
@@ -39,7 +39,7 @@ public class AirshipReactNative: NSObject {
|
|
|
39
39
|
AirshipProxy.shared
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
public static let version: String = "
|
|
42
|
+
public static let version: String = "26.0.0"
|
|
43
43
|
|
|
44
44
|
private let eventNotifier = EventNotifier()
|
|
45
45
|
|
|
@@ -111,11 +111,9 @@ public class AirshipReactNative: NSObject {
|
|
|
111
111
|
|
|
112
112
|
|
|
113
113
|
@MainActor
|
|
114
|
-
func onLoad(
|
|
115
|
-
launchOptions: [UIApplication.LaunchOptionsKey: Any]?
|
|
116
|
-
) {
|
|
114
|
+
func onLoad() {
|
|
117
115
|
AirshipProxy.shared.delegate = self
|
|
118
|
-
try? AirshipProxy.shared.attemptTakeOff(
|
|
116
|
+
try? AirshipProxy.shared.attemptTakeOff()
|
|
119
117
|
|
|
120
118
|
Task {
|
|
121
119
|
let stream = AirshipProxyEventEmitter.shared.pendingEventAdded
|
|
@@ -159,10 +157,8 @@ public class AirshipReactNative: NSObject {
|
|
|
159
157
|
|
|
160
158
|
@objc
|
|
161
159
|
@MainActor
|
|
162
|
-
public func attemptTakeOff(
|
|
163
|
-
|
|
164
|
-
) {
|
|
165
|
-
try? AirshipProxy.shared.attemptTakeOff(launchOptions: launchOptions)
|
|
160
|
+
public func attemptTakeOff() {
|
|
161
|
+
try? AirshipProxy.shared.attemptTakeOff()
|
|
166
162
|
}
|
|
167
163
|
}
|
|
168
164
|
|
|
@@ -172,12 +168,10 @@ public extension AirshipReactNative {
|
|
|
172
168
|
@MainActor
|
|
173
169
|
func takeOff(
|
|
174
170
|
json: Any,
|
|
175
|
-
launchOptions: [UIApplication.LaunchOptionsKey: Any]?
|
|
176
171
|
) throws -> NSNumber {
|
|
177
172
|
return try NSNumber(
|
|
178
173
|
value: AirshipProxy.shared.takeOff(
|
|
179
|
-
json: json
|
|
180
|
-
launchOptions: launchOptions
|
|
174
|
+
json: json
|
|
181
175
|
)
|
|
182
176
|
)
|
|
183
177
|
}
|
|
@@ -783,7 +777,6 @@ private actor EventNotifier {
|
|
|
783
777
|
}
|
|
784
778
|
}
|
|
785
779
|
|
|
786
|
-
|
|
787
780
|
extension AirshipProxyEventType {
|
|
788
781
|
private static let nameMap: [String: AirshipProxyEventType] = [
|
|
789
782
|
"com.airship.deep_link": .deepLinkReceived,
|
package/ios/RNAirship.h
CHANGED