From 261bf5fcc60d7b1afdb4b7e9fe5ea3b22da2bf99 Mon Sep 17 00:00:00 2001 From: Ryan Lepinski Date: Fri, 4 Oct 2024 11:07:45 -0700 Subject: [PATCH] Release 19.4.0 (#599) * Release 19.4.0 * Update --- CHANGELOG.md | 14 +++ android/gradle.properties | 2 +- .../urbanairship/reactnative/AirshipModule.kt | 14 ++- .../urbanairship/reactnative/AirshipSpec.kt | 8 +- example/ios/AirshipPluginExtender.swift | 8 +- example/ios/Podfile.lock | 44 ++++----- example/src/Styles.ts | 5 +- example/src/screens/HomeScreen.tsx | 97 ++++++++++--------- ios/AirshipReactNative.swift | 42 +++----- ios/RTNAirship.mm | 19 ++-- package.json | 2 +- react-native-airship.podspec | 2 +- src/AirshipLiveActivityManager.ts | 9 +- src/AirshipLiveUpdateManager.ts | 16 ++- src/NativeRTNAirship.ts | 5 +- src/types.ts | 8 +- 16 files changed, 167 insertions(+), 128 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b70bb48..96e88a07 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # React Native Module Changelog +## Version 19.4.0 - October 4, 2024 + +### Changes +- Updated Airship Android SDK to [18.3.2](https://github.com/urbanairship/android-library/releases/tag/18.3.2) +- Updated Airship iOS SDK to [18.10.0](https://github.com/urbanairship/ios-library/releases/tag/18.10.0) +- Added `notificationPermissionStatus` to `PushNotificationStatus` +- Added options to `enableUserNotifications` to specify the `PromptPermissionFallback` when enabling user notifications +- Added new `showMessageCenter(messageId?: string)` and `showMessageView(messageId: string)` to `MessageCenter` to display the OOTB UI even if `autoLaunchDefaultMessageCenter` is disabled +- 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. diff --git a/android/gradle.properties b/android/gradle.properties index db3db310..b1ee31eb 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -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 \ No newline at end of file diff --git a/android/src/main/java/com/urbanairship/reactnative/AirshipModule.kt b/android/src/main/java/com/urbanairship/reactnative/AirshipModule.kt index 117951ed..78db1c7d 100644 --- a/android/src/main/java/com/urbanairship/reactnative/AirshipModule.kt +++ b/android/src/main/java/com/urbanairship/reactnative/AirshipModule.kt @@ -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") } @@ -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()) ) } } @@ -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) diff --git a/android/src/oldarch/java/com/urbanairship/reactnative/AirshipSpec.kt b/android/src/oldarch/java/com/urbanairship/reactnative/AirshipSpec.kt index 27a0fd42..e2e2b8df 100644 --- a/android/src/oldarch/java/com/urbanairship/reactnative/AirshipSpec.kt +++ b/android/src/oldarch/java/com/urbanairship/reactnative/AirshipSpec.kt @@ -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 @@ -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 @@ -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) } diff --git a/example/ios/AirshipPluginExtender.swift b/example/ios/AirshipPluginExtender.swift index 95f9c5f2..5143f286 100644 --- a/example/ios/AirshipPluginExtender.swift +++ b/example/ios/AirshipPluginExtender.swift @@ -5,13 +5,16 @@ 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.self) { attributes in // Track this property as the Airship name for updates attributes.name @@ -19,4 +22,5 @@ public class AirshipPluginExtender: NSObject, AirshipPluginExtenderProtocol { } } } + } diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index aba700cc..09fe476f 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -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) @@ -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 @@ -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 @@ -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 diff --git a/example/src/Styles.ts b/example/src/Styles.ts index d2738d64..17a7f167 100644 --- a/example/src/Styles.ts +++ b/example/src/Styles.ts @@ -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, diff --git a/example/src/screens/HomeScreen.tsx b/example/src/screens/HomeScreen.tsx index d0ae546d..eae23fd8 100644 --- a/example/src/screens/HomeScreen.tsx +++ b/example/src/screens/HomeScreen.tsx @@ -166,16 +166,60 @@ export default function HomeScreen() { flex: 1, justifyContent: 'center', alignItems: 'center', + }} > )} - + + + + {channelId ? ( + <> + + + + + + + + + + + + + ) : ( + + Channel Unavailble + + Have you added the takeOff call with the correct app key and + secret? + + + )} + + + + {Platform.OS === 'ios' ? ( Live Activities @@ -189,7 +233,7 @@ export default function HomeScreen() {