Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 19.4.0 #599

Merged
merged 2 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# React Native Module Changelog

## Version 19.4.0 - October 4, 2024

### Changes
- Updated Airship Android SDK to 18.3.1
rlepinski marked this conversation as resolved.
Show resolved Hide resolved
- Updated Airship iOS SDK to 18.9.2
rlepinski marked this conversation as resolved.
Show resolved Hide resolved
- Added `notificationPermissionStatus` to `PushNotificationStatus`
- Added options to `enableUserNotifications` to specify the `PromptPermissionFallback` when enabling user notifications
- Added new `showMessageCenter(messageId?: string)` to `MessageCenter`
- Added new APIs to manage [iOS Live Activities](https://docs.airship.com/platform/mobile/ios-live-activities/)
- Added new APIs to manage [Android Live Updates](https://docs.airship.com/platform/mobile/android-live-updates/)
- Added a new [iOS plugin extender]() to modify the native Airship SDK after takeOff
- Added new [Android plugin extender]() to modify the native Airship SDK after takeOff.
- 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`

## Version 19.3.2 - September 13, 2024
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.

Expand Down
2 changes: 1 addition & 1 deletion android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ Airship_minSdkVersion=21
Airship_targetSdkVersion=34
Airship_compileSdkVersion=34
Airship_ndkversion=26.1.10909125
Airship_airshipProxyVersion=9.1.3
Airship_airshipProxyVersion=10.0.0
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ class AirshipModule internal constructor(val context: ReactApplicationContext) :
}
}

override fun liveActivityCreate(request: ReadableMap?, promise: Promise) {
override fun liveActivityStart(request: ReadableMap?, promise: Promise) {
promise.resolveResult {
throw IllegalStateException("Not supported on Android")
}
Expand Down Expand Up @@ -759,10 +759,10 @@ class AirshipModule internal constructor(val context: ReactApplicationContext) :
}
}

override fun liveUpdateCreate(request: ReadableMap?, promise: Promise) {
override fun liveUpdateStart(request: ReadableMap?, promise: Promise) {
promise.resolveSuspending(scope) {
proxy.liveUpdateManager.create(
LiveUpdateRequest.Create.fromJson(Utils.convertMap(requireNotNull(request)).toJsonValue())
proxy.liveUpdateManager.start(
LiveUpdateRequest.Start.fromJson(Utils.convertMap(requireNotNull(request)).toJsonValue())
)
}
}
Expand All @@ -783,6 +783,12 @@ class AirshipModule internal constructor(val context: ReactApplicationContext) :
}
}

override fun liveUpdateClearAll(promise: Promise) {
promise.resolveSuspending(scope) {
proxy.liveUpdateManager.clearAll()
}
}

private fun notifyPending() {
if (context.hasActiveReactInstance()) {
val appEventEmitter = context.getJSModule(RCTNativeAppEventEmitter::class.java)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ abstract class AirshipSpec internal constructor(context: ReactApplicationContext

@ReactMethod
@com.facebook.proguard.annotations.DoNotStrip
abstract fun liveActivityCreate(request: ReadableMap?, promise: Promise)
abstract fun liveActivityStart(request: ReadableMap?, promise: Promise)

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

@ReactMethod
@com.facebook.proguard.annotations.DoNotStrip
abstract fun liveUpdateCreate(request: ReadableMap?, promise: Promise)
abstract fun liveUpdateStart(request: ReadableMap?, promise: Promise)

@ReactMethod
@com.facebook.proguard.annotations.DoNotStrip
Expand All @@ -444,4 +444,8 @@ abstract class AirshipSpec internal constructor(context: ReactApplicationContext
@ReactMethod
@com.facebook.proguard.annotations.DoNotStrip
abstract fun liveUpdateEnd(request: ReadableMap?, promise: Promise)

@ReactMethod
@com.facebook.proguard.annotations.DoNotStrip
abstract fun liveUpdateClearAll(promise: Promise)
}
8 changes: 6 additions & 2 deletions example/ios/AirshipPluginExtender.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,22 @@ import ActivityKit

@objc(AirshipPluginExtender)
public class AirshipPluginExtender: NSObject, AirshipPluginExtenderProtocol {

/// Called on the same run loop when Airship takesOff.
@MainActor
public static func onAirshipReady() {

if #available(iOS 16.1, *) {
// Will throw if called more than once
// Throws if setup is called more than once
try? LiveActivityManager.shared.setup { configurator in

// Call per widget
// Register each activity type
await configurator.register(forType: Activity<ExampleWidgetsAttributes>.self) { attributes in
// Track this property as the Airship name for updates
attributes.name
}
}
}
}

}
44 changes: 22 additions & 22 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
PODS:
- Airship (18.9.2):
- Airship/Automation (= 18.9.2)
- Airship/Basement (= 18.9.2)
- Airship/Core (= 18.9.2)
- Airship/FeatureFlags (= 18.9.2)
- Airship/MessageCenter (= 18.9.2)
- Airship/PreferenceCenter (= 18.9.2)
- Airship/Automation (18.9.2):
- Airship (18.10.0):
- Airship/Automation (= 18.10.0)
- Airship/Basement (= 18.10.0)
- Airship/Core (= 18.10.0)
- Airship/FeatureFlags (= 18.10.0)
- Airship/MessageCenter (= 18.10.0)
- Airship/PreferenceCenter (= 18.10.0)
- Airship/Automation (18.10.0):
- Airship/Core
- Airship/Basement (18.9.2)
- Airship/Core (18.9.2):
- Airship/Basement (18.10.0)
- Airship/Core (18.10.0):
- Airship/Basement
- Airship/FeatureFlags (18.9.2):
- Airship/FeatureFlags (18.10.0):
- Airship/Core
- Airship/MessageCenter (18.9.2):
- Airship/MessageCenter (18.10.0):
- Airship/Core
- Airship/PreferenceCenter (18.9.2):
- Airship/PreferenceCenter (18.10.0):
- Airship/Core
- AirshipFrameworkProxy (9.1.3):
- Airship (= 18.9.2)
- AirshipServiceExtension (18.9.2)
- AirshipFrameworkProxy (10.0.0):
- Airship (= 18.10.0)
- AirshipServiceExtension (18.10.0)
- boost (1.83.0)
- DoubleConversion (1.1.6)
- FBLazyVector (0.73.4)
Expand Down Expand Up @@ -907,8 +907,8 @@ PODS:
- React-Mapbuffer (0.73.4):
- glog
- React-debug
- react-native-airship (19.3.2):
- AirshipFrameworkProxy (= 9.1.3)
- react-native-airship (19.4.0):
- AirshipFrameworkProxy (= 10.0.0)
- glog
- RCT-Folly (= 2022.05.16.00)
- React-Core
Expand Down Expand Up @@ -1279,9 +1279,9 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native/ReactCommon/yoga"

SPEC CHECKSUMS:
Airship: 7f891aa9bb142d02f35aaef5ebdb09c2b5730a6d
AirshipFrameworkProxy: 9a983b72a47ce10d8eda32b446ea553ef7bcc8f2
AirshipServiceExtension: 0ed795b521a76f8391e13896fbe1dee6ce9196ca
Airship: f05f63abc90b20274854a7cda3334f383af370cd
AirshipFrameworkProxy: 8bf84e8ca65c3847c63b6851463822f1a3fb2982
AirshipServiceExtension: b62830295737abaadc92572a1ec93175a749ea98
boost: d3f49c53809116a5d38da093a8aa78bf551aed09
DoubleConversion: fea03f2699887d960129cc54bba7e52542b6f953
FBLazyVector: 84f6edbe225f38aebd9deaf1540a4160b1f087d7
Expand Down Expand Up @@ -1311,7 +1311,7 @@ SPEC CHECKSUMS:
React-jsinspector: 9ac353eccf6ab54d1e0a33862ba91221d1e88460
React-logger: 0a57b68dd2aec7ff738195f081f0520724b35dab
React-Mapbuffer: 63913773ed7f96b814a2521e13e6d010282096ad
react-native-airship: 6afeeef72fa57a06a716afaca0ababb8adfaee81
react-native-airship: 4a8f69108b353db26bf57c47a247c819c63889f8
react-native-safe-area-context: b97eb6f9e3b7f437806c2ce5983f479f8eb5de4b
React-nativeconfig: d7af5bae6da70fa15ce44f045621cf99ed24087c
React-NativeModulesApple: 0123905d5699853ac68519607555a9a4f5c7b3ac
Expand Down
5 changes: 3 additions & 2 deletions example/src/Styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ export default StyleSheet.create({
padding: 10,
},
backgroundIcon: {
width: '90%',
width: '50%',
height: undefined,
aspectRatio: 1,
resizeMode: 'contain',
alignItems: 'center',
padding: 20,
},
backgroundContainer: {
flex: 1,
Expand Down
97 changes: 52 additions & 45 deletions example/src/screens/HomeScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -166,16 +166,60 @@ export default function HomeScreen() {
flex: 1,
justifyContent: 'center',
alignItems: 'center',

}}
>
<Image
style={[styles.backgroundIcon, { paddingBottom: 0 }]}
style={styles.backgroundIcon}
source={require('./../img/airship-mark.png')}
/>
</View>
)}

<View style={[styles.roundedView, { marginVertical: 8 }]}>


<View style={{ flexDirection: 'column' }}>
{channelId ? (
<>
<View style={[styles.roundedView, { marginBottom: 8 }]} />
<EnablePushCell
notificationsEnabled={notificationsEnabled}
handleNotificationsEnabled={handleNotificationsEnabled}
/>
<View style={[styles.roundedView, { marginBottom: 8 }]}>
<ChannelCell channelId={channelId} />
</View>
<View style={[styles.roundedView, { marginBottom: 8 }]}>
<NamedUserManagerCell
namedUserText={namedUserText}
handleNamedUserSet={handleNamedUserSet}
handleUpdateNamedUserText={setNamedUserText}
namedUser={namedUser}
/>
</View>
<View style={styles.roundedView}>
<TagManagerCell
tagText={tagText}
tags={tags}
handleTagAdd={handleTagAdd}
handleTagRemove={handleTagRemove}
handleUpdateTagText={setTagText}
/>
</View>
</>
) : (
<View style={styles.warningView}>
<Text style={styles.warningTitleText}>Channel Unavailble</Text>
<Text style={styles.warningBodyText}>
Have you added the takeOff call with the correct app key and
secret?
</Text>
</View>
)}
</View>


<View style={[styles.roundedView, { marginVertical: 8, padding: 8}]}>
{Platform.OS === 'ios' ? (
<Text style={{ fontWeight: 'bold', marginStart: 8 }}>
Live Activities
Expand All @@ -189,7 +233,7 @@ export default function HomeScreen() {
<Button
onPress={async () => {
if (Platform.OS === 'ios') {
Airship.iOS.liveActivityManager.create({
Airship.iOS.liveActivityManager.start({
attributesType: 'ExampleWidgetsAttributes',
content: {
state: {
Expand All @@ -202,7 +246,7 @@ export default function HomeScreen() {
},
});
} else {
Airship.android.liveUpdateManager.create({
Airship.android.liveUpdateManager.start({
type: 'Example',
name: uuid.v4(),
content: {
Expand All @@ -223,6 +267,9 @@ export default function HomeScreen() {
activities.forEach((element) => {
Airship.iOS.liveActivityManager.end({
activityId: element.id,
dismissalPolicy: {
type: "immediate"
}
});
});
} else {
Expand Down Expand Up @@ -268,51 +315,11 @@ export default function HomeScreen() {
});
}
}}
title="Update Alll"
title="Update All"
color="#841584"
/>
</View>

<View style={{ flexDirection: 'column' }}>
{channelId ? (
<>
<View style={[styles.roundedView, { marginBottom: 8 }]} />
<EnablePushCell
notificationsEnabled={notificationsEnabled}
handleNotificationsEnabled={handleNotificationsEnabled}
/>
<View style={[styles.roundedView, { marginBottom: 8 }]}>
<ChannelCell channelId={channelId} />
</View>
<View style={[styles.roundedView, { marginBottom: 8 }]}>
<NamedUserManagerCell
namedUserText={namedUserText}
handleNamedUserSet={handleNamedUserSet}
handleUpdateNamedUserText={setNamedUserText}
namedUser={namedUser}
/>
</View>
<View style={styles.roundedView}>
<TagManagerCell
tagText={tagText}
tags={tags}
handleTagAdd={handleTagAdd}
handleTagRemove={handleTagRemove}
handleUpdateTagText={setTagText}
/>
</View>
</>
) : (
<View style={styles.warningView}>
<Text style={styles.warningTitleText}>Channel Unavailble</Text>
<Text style={styles.warningBodyText}>
Have you added the takeOff call with the correct app key and
secret?
</Text>
</View>
)}
</View>

<View style={{ flexGrow: 0 }} />
</View>
</KeyboardAvoidingView>
Expand Down
Loading
Loading