Skip to content

Commit 261bf5f

Browse files
authoredOct 4, 2024··
Release 19.4.0 (#599)
* Release 19.4.0 * Update
1 parent d583b5f commit 261bf5f

16 files changed

+167
-128
lines changed
 

‎CHANGELOG.md

+14
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
# React Native Module Changelog
22

3+
## Version 19.4.0 - October 4, 2024
4+
5+
### Changes
6+
- Updated Airship Android SDK to [18.3.2](https://github.com/urbanairship/android-library/releases/tag/18.3.2)
7+
- Updated Airship iOS SDK to [18.10.0](https://github.com/urbanairship/ios-library/releases/tag/18.10.0)
8+
- Added `notificationPermissionStatus` to `PushNotificationStatus`
9+
- Added options to `enableUserNotifications` to specify the `PromptPermissionFallback` when enabling user notifications
10+
- Added new `showMessageCenter(messageId?: string)` and `showMessageView(messageId: string)` to `MessageCenter` to display the OOTB UI even if `autoLaunchDefaultMessageCenter` is disabled
11+
- Added new APIs to manage [iOS Live Activities](https://docs.airship.com/platform/mobile/ios-live-activities/)
12+
- Added new APIs to manage [Android Live Updates](https://docs.airship.com/platform/mobile/android-live-updates/)
13+
- Added a new [iOS plugin extender]() to modify the native Airship SDK after takeOff
14+
- Added new [Android plugin extender]() to modify the native Airship SDK after takeOff
15+
- Deprecated `com.urbanairship.reactnative.AirshipExtender` for the common `com.urbanairship.android.framework.proxy.AirshipPluginExtender`. The manifest name also changed from `com.urbanairship.reactnative.AIRSHIP_EXTENDER` to `com.urbanairship.plugin.extender`
16+
317
## Version 19.3.2 - September 13, 2024
418
Patch release to fix a compile issue with the new Architecture on iOS and to fix a potential race condition on the event listeners when refreshing the JS bridge.
519

‎android/gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ Airship_minSdkVersion=21
33
Airship_targetSdkVersion=34
44
Airship_compileSdkVersion=34
55
Airship_ndkversion=26.1.10909125
6-
Airship_airshipProxyVersion=9.1.3
6+
Airship_airshipProxyVersion=10.0.0

‎android/src/main/java/com/urbanairship/reactnative/AirshipModule.kt

+10-4
Original file line numberDiff line numberDiff line change
@@ -723,7 +723,7 @@ class AirshipModule internal constructor(val context: ReactApplicationContext) :
723723
}
724724
}
725725

726-
override fun liveActivityCreate(request: ReadableMap?, promise: Promise) {
726+
override fun liveActivityStart(request: ReadableMap?, promise: Promise) {
727727
promise.resolveResult {
728728
throw IllegalStateException("Not supported on Android")
729729
}
@@ -759,10 +759,10 @@ class AirshipModule internal constructor(val context: ReactApplicationContext) :
759759
}
760760
}
761761

762-
override fun liveUpdateCreate(request: ReadableMap?, promise: Promise) {
762+
override fun liveUpdateStart(request: ReadableMap?, promise: Promise) {
763763
promise.resolveSuspending(scope) {
764-
proxy.liveUpdateManager.create(
765-
LiveUpdateRequest.Create.fromJson(Utils.convertMap(requireNotNull(request)).toJsonValue())
764+
proxy.liveUpdateManager.start(
765+
LiveUpdateRequest.Start.fromJson(Utils.convertMap(requireNotNull(request)).toJsonValue())
766766
)
767767
}
768768
}
@@ -783,6 +783,12 @@ class AirshipModule internal constructor(val context: ReactApplicationContext) :
783783
}
784784
}
785785

786+
override fun liveUpdateClearAll(promise: Promise) {
787+
promise.resolveSuspending(scope) {
788+
proxy.liveUpdateManager.clearAll()
789+
}
790+
}
791+
786792
private fun notifyPending() {
787793
if (context.hasActiveReactInstance()) {
788794
val appEventEmitter = context.getJSModule(RCTNativeAppEventEmitter::class.java)

‎android/src/oldarch/java/com/urbanairship/reactnative/AirshipSpec.kt

+6-2
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ abstract class AirshipSpec internal constructor(context: ReactApplicationContext
415415

416416
@ReactMethod
417417
@com.facebook.proguard.annotations.DoNotStrip
418-
abstract fun liveActivityCreate(request: ReadableMap?, promise: Promise)
418+
abstract fun liveActivityStart(request: ReadableMap?, promise: Promise)
419419

420420
@ReactMethod
421421
@com.facebook.proguard.annotations.DoNotStrip
@@ -435,7 +435,7 @@ abstract class AirshipSpec internal constructor(context: ReactApplicationContext
435435

436436
@ReactMethod
437437
@com.facebook.proguard.annotations.DoNotStrip
438-
abstract fun liveUpdateCreate(request: ReadableMap?, promise: Promise)
438+
abstract fun liveUpdateStart(request: ReadableMap?, promise: Promise)
439439

440440
@ReactMethod
441441
@com.facebook.proguard.annotations.DoNotStrip
@@ -444,4 +444,8 @@ abstract class AirshipSpec internal constructor(context: ReactApplicationContext
444444
@ReactMethod
445445
@com.facebook.proguard.annotations.DoNotStrip
446446
abstract fun liveUpdateEnd(request: ReadableMap?, promise: Promise)
447+
448+
@ReactMethod
449+
@com.facebook.proguard.annotations.DoNotStrip
450+
abstract fun liveUpdateClearAll(promise: Promise)
447451
}

‎example/ios/AirshipPluginExtender.swift

+6-2
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,22 @@ import ActivityKit
55

66
@objc(AirshipPluginExtender)
77
public class AirshipPluginExtender: NSObject, AirshipPluginExtenderProtocol {
8+
9+
/// Called on the same run loop when Airship takesOff.
10+
@MainActor
811
public static func onAirshipReady() {
912

1013
if #available(iOS 16.1, *) {
11-
// Will throw if called more than once
14+
// Throws if setup is called more than once
1215
try? LiveActivityManager.shared.setup { configurator in
1316

14-
// Call per widget
17+
// Register each activity type
1518
await configurator.register(forType: Activity<ExampleWidgetsAttributes>.self) { attributes in
1619
// Track this property as the Airship name for updates
1720
attributes.name
1821
}
1922
}
2023
}
2124
}
25+
2226
}

‎example/ios/Podfile.lock

+22-22
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
PODS:
2-
- Airship (18.9.2):
3-
- Airship/Automation (= 18.9.2)
4-
- Airship/Basement (= 18.9.2)
5-
- Airship/Core (= 18.9.2)
6-
- Airship/FeatureFlags (= 18.9.2)
7-
- Airship/MessageCenter (= 18.9.2)
8-
- Airship/PreferenceCenter (= 18.9.2)
9-
- Airship/Automation (18.9.2):
2+
- Airship (18.10.0):
3+
- Airship/Automation (= 18.10.0)
4+
- Airship/Basement (= 18.10.0)
5+
- Airship/Core (= 18.10.0)
6+
- Airship/FeatureFlags (= 18.10.0)
7+
- Airship/MessageCenter (= 18.10.0)
8+
- Airship/PreferenceCenter (= 18.10.0)
9+
- Airship/Automation (18.10.0):
1010
- Airship/Core
11-
- Airship/Basement (18.9.2)
12-
- Airship/Core (18.9.2):
11+
- Airship/Basement (18.10.0)
12+
- Airship/Core (18.10.0):
1313
- Airship/Basement
14-
- Airship/FeatureFlags (18.9.2):
14+
- Airship/FeatureFlags (18.10.0):
1515
- Airship/Core
16-
- Airship/MessageCenter (18.9.2):
16+
- Airship/MessageCenter (18.10.0):
1717
- Airship/Core
18-
- Airship/PreferenceCenter (18.9.2):
18+
- Airship/PreferenceCenter (18.10.0):
1919
- Airship/Core
20-
- AirshipFrameworkProxy (9.1.3):
21-
- Airship (= 18.9.2)
22-
- AirshipServiceExtension (18.9.2)
20+
- AirshipFrameworkProxy (10.0.0):
21+
- Airship (= 18.10.0)
22+
- AirshipServiceExtension (18.10.0)
2323
- boost (1.83.0)
2424
- DoubleConversion (1.1.6)
2525
- FBLazyVector (0.73.4)
@@ -907,8 +907,8 @@ PODS:
907907
- React-Mapbuffer (0.73.4):
908908
- glog
909909
- React-debug
910-
- react-native-airship (19.3.2):
911-
- AirshipFrameworkProxy (= 9.1.3)
910+
- react-native-airship (19.4.0):
911+
- AirshipFrameworkProxy (= 10.0.0)
912912
- glog
913913
- RCT-Folly (= 2022.05.16.00)
914914
- React-Core
@@ -1279,9 +1279,9 @@ EXTERNAL SOURCES:
12791279
:path: "../node_modules/react-native/ReactCommon/yoga"
12801280

12811281
SPEC CHECKSUMS:
1282-
Airship: 7f891aa9bb142d02f35aaef5ebdb09c2b5730a6d
1283-
AirshipFrameworkProxy: 9a983b72a47ce10d8eda32b446ea553ef7bcc8f2
1284-
AirshipServiceExtension: 0ed795b521a76f8391e13896fbe1dee6ce9196ca
1282+
Airship: f05f63abc90b20274854a7cda3334f383af370cd
1283+
AirshipFrameworkProxy: 8bf84e8ca65c3847c63b6851463822f1a3fb2982
1284+
AirshipServiceExtension: b62830295737abaadc92572a1ec93175a749ea98
12851285
boost: d3f49c53809116a5d38da093a8aa78bf551aed09
12861286
DoubleConversion: fea03f2699887d960129cc54bba7e52542b6f953
12871287
FBLazyVector: 84f6edbe225f38aebd9deaf1540a4160b1f087d7
@@ -1311,7 +1311,7 @@ SPEC CHECKSUMS:
13111311
React-jsinspector: 9ac353eccf6ab54d1e0a33862ba91221d1e88460
13121312
React-logger: 0a57b68dd2aec7ff738195f081f0520724b35dab
13131313
React-Mapbuffer: 63913773ed7f96b814a2521e13e6d010282096ad
1314-
react-native-airship: 6afeeef72fa57a06a716afaca0ababb8adfaee81
1314+
react-native-airship: 4a8f69108b353db26bf57c47a247c819c63889f8
13151315
react-native-safe-area-context: b97eb6f9e3b7f437806c2ce5983f479f8eb5de4b
13161316
React-nativeconfig: d7af5bae6da70fa15ce44f045621cf99ed24087c
13171317
React-NativeModulesApple: 0123905d5699853ac68519607555a9a4f5c7b3ac

‎example/src/Styles.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@ export default StyleSheet.create({
1313
padding: 10,
1414
},
1515
backgroundIcon: {
16-
width: '90%',
16+
width: '50%',
17+
height: undefined,
18+
aspectRatio: 1,
1719
resizeMode: 'contain',
1820
alignItems: 'center',
19-
padding: 20,
2021
},
2122
backgroundContainer: {
2223
flex: 1,

‎example/src/screens/HomeScreen.tsx

+52-45
Original file line numberDiff line numberDiff line change
@@ -166,16 +166,60 @@ export default function HomeScreen() {
166166
flex: 1,
167167
justifyContent: 'center',
168168
alignItems: 'center',
169+
169170
}}
170171
>
171172
<Image
172-
style={[styles.backgroundIcon, { paddingBottom: 0 }]}
173+
style={styles.backgroundIcon}
173174
source={require('./../img/airship-mark.png')}
174175
/>
175176
</View>
176177
)}
177178

178-
<View style={[styles.roundedView, { marginVertical: 8 }]}>
179+
180+
181+
<View style={{ flexDirection: 'column' }}>
182+
{channelId ? (
183+
<>
184+
<View style={[styles.roundedView, { marginBottom: 8 }]} />
185+
<EnablePushCell
186+
notificationsEnabled={notificationsEnabled}
187+
handleNotificationsEnabled={handleNotificationsEnabled}
188+
/>
189+
<View style={[styles.roundedView, { marginBottom: 8 }]}>
190+
<ChannelCell channelId={channelId} />
191+
</View>
192+
<View style={[styles.roundedView, { marginBottom: 8 }]}>
193+
<NamedUserManagerCell
194+
namedUserText={namedUserText}
195+
handleNamedUserSet={handleNamedUserSet}
196+
handleUpdateNamedUserText={setNamedUserText}
197+
namedUser={namedUser}
198+
/>
199+
</View>
200+
<View style={styles.roundedView}>
201+
<TagManagerCell
202+
tagText={tagText}
203+
tags={tags}
204+
handleTagAdd={handleTagAdd}
205+
handleTagRemove={handleTagRemove}
206+
handleUpdateTagText={setTagText}
207+
/>
208+
</View>
209+
</>
210+
) : (
211+
<View style={styles.warningView}>
212+
<Text style={styles.warningTitleText}>Channel Unavailble</Text>
213+
<Text style={styles.warningBodyText}>
214+
Have you added the takeOff call with the correct app key and
215+
secret?
216+
</Text>
217+
</View>
218+
)}
219+
</View>
220+
221+
222+
<View style={[styles.roundedView, { marginVertical: 8, padding: 8}]}>
179223
{Platform.OS === 'ios' ? (
180224
<Text style={{ fontWeight: 'bold', marginStart: 8 }}>
181225
Live Activities
@@ -189,7 +233,7 @@ export default function HomeScreen() {
189233
<Button
190234
onPress={async () => {
191235
if (Platform.OS === 'ios') {
192-
Airship.iOS.liveActivityManager.create({
236+
Airship.iOS.liveActivityManager.start({
193237
attributesType: 'ExampleWidgetsAttributes',
194238
content: {
195239
state: {
@@ -202,7 +246,7 @@ export default function HomeScreen() {
202246
},
203247
});
204248
} else {
205-
Airship.android.liveUpdateManager.create({
249+
Airship.android.liveUpdateManager.start({
206250
type: 'Example',
207251
name: uuid.v4(),
208252
content: {
@@ -223,6 +267,9 @@ export default function HomeScreen() {
223267
activities.forEach((element) => {
224268
Airship.iOS.liveActivityManager.end({
225269
activityId: element.id,
270+
dismissalPolicy: {
271+
type: "immediate"
272+
}
226273
});
227274
});
228275
} else {
@@ -268,51 +315,11 @@ export default function HomeScreen() {
268315
});
269316
}
270317
}}
271-
title="Update Alll"
318+
title="Update All"
272319
color="#841584"
273320
/>
274321
</View>
275322

276-
<View style={{ flexDirection: 'column' }}>
277-
{channelId ? (
278-
<>
279-
<View style={[styles.roundedView, { marginBottom: 8 }]} />
280-
<EnablePushCell
281-
notificationsEnabled={notificationsEnabled}
282-
handleNotificationsEnabled={handleNotificationsEnabled}
283-
/>
284-
<View style={[styles.roundedView, { marginBottom: 8 }]}>
285-
<ChannelCell channelId={channelId} />
286-
</View>
287-
<View style={[styles.roundedView, { marginBottom: 8 }]}>
288-
<NamedUserManagerCell
289-
namedUserText={namedUserText}
290-
handleNamedUserSet={handleNamedUserSet}
291-
handleUpdateNamedUserText={setNamedUserText}
292-
namedUser={namedUser}
293-
/>
294-
</View>
295-
<View style={styles.roundedView}>
296-
<TagManagerCell
297-
tagText={tagText}
298-
tags={tags}
299-
handleTagAdd={handleTagAdd}
300-
handleTagRemove={handleTagRemove}
301-
handleUpdateTagText={setTagText}
302-
/>
303-
</View>
304-
</>
305-
) : (
306-
<View style={styles.warningView}>
307-
<Text style={styles.warningTitleText}>Channel Unavailble</Text>
308-
<Text style={styles.warningBodyText}>
309-
Have you added the takeOff call with the correct app key and
310-
secret?
311-
</Text>
312-
</View>
313-
)}
314-
</View>
315-
316323
<View style={{ flexGrow: 0 }} />
317324
</View>
318325
</KeyboardAvoidingView>

0 commit comments

Comments
 (0)
Please sign in to comment.