diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f5ee01d..ce41a4e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # React Native Module Changelog +## Version 19.3.0 - August 30, 2024 +Minor release that adds early access support for Embedded Content. + +### Changes +- Adds AirshipEmbeddedView and listener methods to Airship.inApp for Embedded Content. +- Exposes the Airship session ID on Airship.analytics. + + ## Version 19.2.1 - August 23, 2024 Patch release that fixes an issue with extras parsing on notifications diff --git a/android/src/main/java/com/urbanairship/reactnative/AirshipModule.kt b/android/src/main/java/com/urbanairship/reactnative/AirshipModule.kt index 44b447c9..d140ca04 100644 --- a/android/src/main/java/com/urbanairship/reactnative/AirshipModule.kt +++ b/android/src/main/java/com/urbanairship/reactnative/AirshipModule.kt @@ -461,6 +461,15 @@ class AirshipModule internal constructor(val context: ReactApplicationContext) : } } + @ReactMethod + override fun analyticsGetSessionId( + promise: Promise + ) { + promise.resolveResult { + proxy.analytics.getSessionId() + } + } + @ReactMethod override fun actionRun(action: ReadableMap, promise: Promise) { promise.resolveDeferred { callback -> diff --git a/android/src/oldarch/java/com/urbanairship/reactnative/AirshipSpec.kt b/android/src/oldarch/java/com/urbanairship/reactnative/AirshipSpec.kt index be2a7518..988e074e 100644 --- a/android/src/oldarch/java/com/urbanairship/reactnative/AirshipSpec.kt +++ b/android/src/oldarch/java/com/urbanairship/reactnative/AirshipSpec.kt @@ -237,6 +237,12 @@ abstract class AirshipSpec internal constructor(context: ReactApplicationContext promise: Promise ) + @ReactMethod + @com.facebook.proguard.annotations.DoNotStrip + abstract fun analyticsGetSessionId( + promise: Promise + ) + @ReactMethod @com.facebook.proguard.annotations.DoNotStrip abstract fun addCustomEvent( diff --git a/ios/AirshipReactNative.swift b/ios/AirshipReactNative.swift index 8e71d4e4..e67ae90b 100644 --- a/ios/AirshipReactNative.swift +++ b/ios/AirshipReactNative.swift @@ -38,7 +38,7 @@ public class AirshipReactNative: NSObject { AirshipProxy.shared } - public static let version: String = "19.2.1" + public static let version: String = "19.3.0" private let eventNotifier = EventNotifier() @@ -362,6 +362,12 @@ public extension AirshipReactNative { func addCustomEvent(_ json: Any) throws { try AirshipProxy.shared.analytics.addEvent(json) } + + @objc + @MainActor + func analyticsGetSessionId() throws -> String { + try AirshipProxy.shared.analytics.getSessionID().lowercased() + } } // Contact diff --git a/ios/RTNAirship.mm b/ios/RTNAirship.mm index 0832d0c1..5bdb6b77 100644 --- a/ios/RTNAirship.mm +++ b/ios/RTNAirship.mm @@ -390,6 +390,19 @@ + (BOOL)requiresMainQueueSetup { [self handleResult:nil error:error resolve:resolve reject:reject]; } +RCT_REMAP_METHOD(analyticsGetSessionId, + analyticsGetSessionId:(RCTPromiseResolveBlock)resolve + reject:(RCTPromiseRejectBlock)reject) { + NSError *error; + NSString *result = [AirshipReactNative.shared analyticsGetSessionIdAndReturnError:&error]; + + [self handleResult:result + error:error + resolve:resolve + reject:reject]; +} + + RCT_REMAP_METHOD(contactEditAttributes, contactEditAttributes:(NSArray *)operations resolve:(RCTPromiseResolveBlock)resolve diff --git a/src/AirshipAnalytics.ts b/src/AirshipAnalytics.ts index 5a46c315..d85c6abd 100644 --- a/src/AirshipAnalytics.ts +++ b/src/AirshipAnalytics.ts @@ -35,4 +35,12 @@ export class AirshipAnalytics { public addCustomEvent(event: CustomEvent): Promise { return this.module.addCustomEvent(event); } + + /** + * Gets the Airship session ID. The session ID is a UUID that updates on foreground and background. + * @returns A promise. + */ + public getSessionId(): Promise { + return this.module.analyticsGetSessionId(); + } } diff --git a/src/NativeRTNAirship.ts b/src/NativeRTNAirship.ts index 67b56f50..76720391 100644 --- a/src/NativeRTNAirship.ts +++ b/src/NativeRTNAirship.ts @@ -67,6 +67,8 @@ export interface Spec extends TurboModule { analyticsTrackScreen(screen?: string): Promise; analyticsAssociateIdentifier(key: string, identifier?: string): Promise; addCustomEvent(event: Object): Promise; + analyticsGetSessionId(): Promise; + // Action actionRun(action: Object): Promise;