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.3.0 #586

Merged
merged 2 commits into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<ActionValue> { callback ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
8 changes: 7 additions & 1 deletion ios/AirshipReactNative.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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
Expand Down
13 changes: 13 additions & 0 deletions ios/RTNAirship.mm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions src/AirshipAnalytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,12 @@ export class AirshipAnalytics {
public addCustomEvent(event: CustomEvent): Promise<void> {
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<string> {
return this.module.analyticsGetSessionId();
}
}
2 changes: 2 additions & 0 deletions src/NativeRTNAirship.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ export interface Spec extends TurboModule {
analyticsTrackScreen(screen?: string): Promise<void>;
analyticsAssociateIdentifier(key: string, identifier?: string): Promise<void>;
addCustomEvent(event: Object): Promise<void>;
analyticsGetSessionId(): Promise<string>;


// Action
actionRun(action: Object): Promise<Object | Error>;
Expand Down
Loading