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 17.0.0 #534

Merged
merged 10 commits into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from 3 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
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 17.0.0 - November 21, 2023
Major release that adds support for server side feature flag segmentation, interaction events for feature flags, and Impression billing.

### Changes
- Updated iOS SDK to 17.6.1
- Updated Android SDK to 17.5.0
- Added `Airship.featureFlagManager.trackInteraction(flag)` method to track interaction events
- Added a deprecated method `Airship.channel.enableChannelCreation()` for app that are using delayed channel creation instead of privacy manager
- Added server side segmentation for feature flags
- Added support for Impression billing
- Removed the InboxMessage `isDeleted` property
- Fixed the InboxMessage `listIconUrl` on iOS


## Version 16.1.2 - October 23, 2023
Patch release that fixes an issue with `getActiveNotifications` on Android.

Expand Down
4 changes: 2 additions & 2 deletions android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ Airship_targetSdkVersion=31
Airship_compileSdkVersion=31
Airship_ndkversion=21.4.7075529

Airship_airshipProxyVersion=4.3.0
Airship_airshipProxyVersion=5.0.1

# workaround for now, used for HMS
Airship_airshipVersion=17.2.1
Airship_airshipVersion=17.5.0

Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import com.urbanairship.android.framework.proxy.EventType
import com.urbanairship.android.framework.proxy.ProxyLogger
import com.urbanairship.android.framework.proxy.events.EventEmitter
import com.urbanairship.android.framework.proxy.proxies.AirshipProxy
import com.urbanairship.android.framework.proxy.proxies.FeatureFlagProxy
import com.urbanairship.android.framework.proxy.proxies.SuspendingPredicate
import com.urbanairship.json.JsonMap
import com.urbanairship.json.JsonSerializable
Expand Down Expand Up @@ -654,6 +655,13 @@ class AirshipModule internal constructor(val context: ReactApplicationContext) :
}
}

override fun featureFlagManagerTrackInteraction(flag: ReadableMap?, promise: Promise) {
promise.resolveResult {
val parsedFlag = FeatureFlagProxy(Utils.convertMap(requireNotNull(flag)).toJsonValue())
proxy.featureFlagManager.trackInteraction(parsedFlag)
}
}

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 @@ -380,6 +380,10 @@ abstract class AirshipSpec internal constructor(context: ReactApplicationContext
@ReactMethod
@com.facebook.proguard.annotations.DoNotStrip
abstract fun featureFlagManagerFlag(flagName: String?, promise: Promise)

@ReactMethod
@com.facebook.proguard.annotations.DoNotStrip
abstract fun featureFlagManagerTrackInteraction(flag: ReadableMap?, promise: Promise)
}


42 changes: 21 additions & 21 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
PODS:
- Airship (17.3.1):
- Airship/Automation (= 17.3.1)
- Airship/Basement (= 17.3.1)
- Airship/Core (= 17.3.1)
- Airship/FeatureFlags (= 17.3.1)
- Airship/MessageCenter (= 17.3.1)
- Airship/PreferenceCenter (= 17.3.1)
- Airship/Automation (17.3.1):
- Airship (17.6.1):
- Airship/Automation (= 17.6.1)
- Airship/Basement (= 17.6.1)
- Airship/Core (= 17.6.1)
- Airship/FeatureFlags (= 17.6.1)
- Airship/MessageCenter (= 17.6.1)
- Airship/PreferenceCenter (= 17.6.1)
- Airship/Automation (17.6.1):
- Airship/Core
- Airship/Basement (17.3.1)
- Airship/Core (17.3.1):
- Airship/Basement (17.6.1)
- Airship/Core (17.6.1):
- Airship/Basement
- Airship/FeatureFlags (17.3.1):
- Airship/FeatureFlags (17.6.1):
- Airship/Core
- Airship/MessageCenter (17.3.1):
- Airship/MessageCenter (17.6.1):
- Airship/Core
- Airship/PreferenceCenter (17.3.1):
- Airship/PreferenceCenter (17.6.1):
- Airship/Core
- AirshipFrameworkProxy (4.3.0):
- Airship (= 17.3.1)
- AirshipFrameworkProxy (5.0.1):
- Airship (= 17.6.1)
- boost (1.76.0)
- CocoaAsyncSocket (7.6.5)
- DoubleConversion (1.1.6)
Expand Down Expand Up @@ -317,8 +317,8 @@ PODS:
- React-jsinspector (0.71.1)
- React-logger (0.71.1):
- glog
- react-native-airship (16.1.1):
- AirshipFrameworkProxy (= 4.3.0)
- react-native-airship (17.0.0):
- AirshipFrameworkProxy (= 5.0.1)
- React-Core
- react-native-safe-area-context (4.5.0):
- RCT-Folly
Expand Down Expand Up @@ -581,8 +581,8 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native/ReactCommon/yoga"

SPEC CHECKSUMS:
Airship: a8ec7140cca677696f10f605749c18248d818117
AirshipFrameworkProxy: 581e2ca4c3b2377724d0235117d617df8489097a
Airship: 1031c7817d20066287cad158dcb04a2fea4aa6fd
AirshipFrameworkProxy: 840edb59bd50b0815e0982df3500aa768e839525
boost: 57d2868c099736d80fcd648bf211b4431e51a558
CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99
DoubleConversion: 5189b271737e1565bdce30deb4a08d647e3f5f54
Expand Down Expand Up @@ -616,7 +616,7 @@ SPEC CHECKSUMS:
React-jsiexecutor: 60cf272aababc5212410e4249d17cea14fc36caa
React-jsinspector: ff56004b0c974b688a6548c156d5830ad751ae07
React-logger: 60a0b5f8bed667ecf9e24fecca1f30d125de6d75
react-native-airship: a7222b49a0cfa0bdd9dc3981c15f808a9ae90740
react-native-airship: eeef9f5568f76188c119988dc94f0b920c4f6cde
react-native-safe-area-context: 39c2d8be3328df5d437ac1700f4f3a4f75716acc
React-perflogger: ec8eef2a8f03ecfa6361c2c5fb9197ef4a29cc85
React-RCTActionSheet: a0c023b86cf4c862fa9c4eb0f6f91fbe878fb2de
Expand All @@ -639,4 +639,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: b7a94a3aefc53b758c07410e8e9ddbf2ee273556

COCOAPODS: 1.12.1
COCOAPODS: 1.11.3
13 changes: 10 additions & 3 deletions ios/AirshipReactNative.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class AirshipReactNative: NSObject {
AirshipProxy.shared
}

public static let version: String = "16.1.2"
public static let version: String = "17.0.0"

private let eventNotifier = EventNotifier()

Expand Down Expand Up @@ -445,8 +445,9 @@ public extension AirshipReactNative {
}

@objc
func messageCenterGetMessages() async throws -> [Any] {
return try await AirshipProxy.shared.messageCenter.getMessagesJSON()
func messageCenterGetMessages() async throws -> Any {
let messages = try await AirshipProxy.shared.messageCenter.getMessages()
return try AirshipJSON.wrap(messages).unWrap() as Any
}

@objc
Expand Down Expand Up @@ -554,6 +555,12 @@ public extension AirshipReactNative {
let result = try await AirshipProxy.shared.featureFlagManager.flag(name: flagName)
return try AirshipJSON.wrap(result).unWrap() as Any
}

@objc
func featureFlagManagerTrackInteracted(flag: Any) throws {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trackInteraction?

let flag: FeatureFlagProxy = try AirshipJSON.wrap(flag).decode()
try AirshipProxy.shared.featureFlagManager.trackInteraction(flag: flag)
}
}

extension AirshipReactNative: AirshipProxyDelegate {
Expand Down
12 changes: 11 additions & 1 deletion ios/RTNAirship.mm
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,17 @@ + (BOOL)requiresMainQueueSetup {
// Android only
}

RCT_REMAP_METHOD(featureFlagManagerTrackInteraction,
featureFlagManagerTrackInteraction:(NSDictionary *)flag
resolve:(RCTPromiseResolveBlock)resolve
reject:(RCTPromiseRejectBlock)reject) {


NSError *error;
[AirshipReactNative.shared featureFlagManagerTrackInteractedWithFlag:flag error:&error];
[self handleResult:nil error:error resolve:resolve reject:reject];
}

RCT_REMAP_METHOD(featureFlagManagerFlag,
featureFlagManagerFlag:(NSString *)flagName
featureFlagManagerFlag:(RCTPromiseResolveBlock)resolve
Expand All @@ -718,7 +729,6 @@ + (BOOL)requiresMainQueueSetup {
}];
}


-(void)handleResult:(id)result
error:(NSError *)error
resolve:(RCTPromiseResolveBlock)resolve
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ua/react-native-airship",
"version": "16.1.2",
"version": "17.0.0",
"description": "Airship plugin for React Native apps.",
"main": "lib/commonjs/index",
"module": "lib/module/index",
Expand Down
2 changes: 1 addition & 1 deletion react-native-airship.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ Pod::Spec.new do |s|



s.dependency "AirshipFrameworkProxy", "4.3.0"
s.dependency "AirshipFrameworkProxy", "5.0.1"

end
12 changes: 11 additions & 1 deletion src/AirshipFeatureFlagManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export class AirshipFeatureFlagManager {

/**
* Retrieve a given flag's status and associated data by its name.
* @param {string} flagName the flag name
* @param {string} flagName The flag name
* @return {Promise<FeatureFlag>} A promise resolving to the feature flag
* requested.
* @throws {Error} when failed to fetch
Expand All @@ -18,4 +18,14 @@ export class AirshipFeatureFlagManager {
): Promise<FeatureFlag> {
return this.module.featureFlagManagerFlag(flagName);
}

/**
* Tracks a feature flag interaction event.
* @param {FeatureFlag} flag The flag
* @return {Promise<Void>} A promise with an empty result.
* @throws {Error} when failed to fetch
*/
public trackInteraction(flag: FeatureFlag): Promise<void> {
return this.module.featureFlagManagerTrackInteraction(flag);
}
}
1 change: 1 addition & 0 deletions src/NativeRTNAirship.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ export interface Spec extends TurboModule {

// Feature Flag Manager
featureFlagManagerFlag(flagName: string):Promise<Object>;
featureFlagManagerTrackInteraction(flag: Object): Promise<void>;
}

export default TurboModuleRegistry.getEnforcing<Spec>('RTNAirship');
11 changes: 7 additions & 4 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -567,10 +567,6 @@ export interface InboxMessage {
* The unread / read status of the message.
*/
isRead: boolean;
/**
* The deleted status of the message.
*/
isDeleted: boolean;
/**
* String to String map of any message extras.
*/
Expand Down Expand Up @@ -736,4 +732,11 @@ export interface FeatureFlag {
* flag name.
*/
readonly exists: boolean

/**
* Reporting Metadata, the shape of which is private and not to be relied
* upon. When not provided, an interaction cannot be tracked on the flag.
* @ignore
*/
readonly _internal: unknown
}
Loading