From 7c51130d1fbb006085229f5a3036d98c09a5b4a9 Mon Sep 17 00:00:00 2001 From: Ulrich GIBERNE Date: Mon, 15 Jul 2024 13:17:19 -0400 Subject: [PATCH 1/8] prepare patch version --- CHANGELOG.md | 6 ++++++ ios/AirshipReactNative.swift | 2 +- package.json | 2 +- src/types.ts | 7 ++----- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d53382a5..6f18e4ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # React Native Module Changelog +## Version 19.0.1 - July 15, 2024 +Patch release that fixes enabling or disabling all Airship features with `FEATURES_ALL`. + +### Changes +- Fixed enabling or disabling features with `FEATURE_ALL`. + ## Version 19.0.0 - July 9, 2024 Major release that updates the Android Airship SDK to 18. diff --git a/ios/AirshipReactNative.swift b/ios/AirshipReactNative.swift index a57d82b6..d4830a06 100644 --- a/ios/AirshipReactNative.swift +++ b/ios/AirshipReactNative.swift @@ -36,7 +36,7 @@ public class AirshipReactNative: NSObject { AirshipProxy.shared } - public static let version: String = "19.0.0" + public static let version: String = "19.0.1" private let eventNotifier = EventNotifier() diff --git a/package.json b/package.json index 61f8fcff..9a1c88e4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ua/react-native-airship", - "version": "19.0.0", + "version": "19.0.1", "description": "Airship plugin for React Native apps.", "main": "lib/commonjs/index", "module": "lib/module/index", diff --git a/src/types.ts b/src/types.ts index 3c7f93b4..9df762d0 100644 --- a/src/types.ts +++ b/src/types.ts @@ -540,13 +540,10 @@ export enum Feature { InAppAutomation = 'in_app_automation', MessageCenter = 'message_center', Push = 'push', - // No longer used - Chat = 'chat', + FeatureFlags = 'feature_flags', Analytics = 'analytics', TagsAndAttributes = 'tags_and_attributes', - Contacts = 'contacts', - // No longer used - Location = 'location', + Contacts = 'contacts' } /** From 4e29ae3d42f3bddec693d66dcf08fdc41a06b7b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ulrich=20Gibern=C3=A9?= Date: Mon, 15 Jul 2024 13:26:20 -0400 Subject: [PATCH 2/8] Update CHANGELOG.md --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f18e4ee..2dd4a885 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,10 @@ # React Native Module Changelog ## Version 19.0.1 - July 15, 2024 -Patch release that fixes enabling or disabling all Airship features with `FEATURES_ALL`. +Patch release that fixes enabling or disabling all Airship features using `FEATURES_ALL`. ### Changes -- Fixed enabling or disabling features with `FEATURE_ALL`. +- Fixed enabling or disabling features using `FEATURE_ALL`. ## Version 19.0.0 - July 9, 2024 Major release that updates the Android Airship SDK to 18. From 427502b2be7c5bc4996a3e34455d1a89c757fbc8 Mon Sep 17 00:00:00 2001 From: Ulrich GIBERNE Date: Mon, 15 Jul 2024 16:25:55 -0400 Subject: [PATCH 3/8] filter unused features to avoid breaking change --- .../urbanairship/reactnative/AirshipModule.kt | 8 +++--- .../com/urbanairship/reactnative/Utils.kt | 25 +++++++++++++++++++ ios/AirshipReactNative.swift | 5 +++- src/types.ts | 6 +++-- 4 files changed, 37 insertions(+), 7 deletions(-) diff --git a/android/src/main/java/com/urbanairship/reactnative/AirshipModule.kt b/android/src/main/java/com/urbanairship/reactnative/AirshipModule.kt index 1432ed94..b3d8e8f1 100644 --- a/android/src/main/java/com/urbanairship/reactnative/AirshipModule.kt +++ b/android/src/main/java/com/urbanairship/reactnative/AirshipModule.kt @@ -479,7 +479,7 @@ class AirshipModule internal constructor(val context: ReactApplicationContext) : override fun privacyManagerSetEnabledFeatures(features: ReadableArray?, promise: Promise) { promise.resolveResult { proxy.privacyManager.setEnabledFeatures( - Utils.convertArray(requireNotNull(features)) + Utils.convertFeaturesArray(requireNotNull(features)) ) } } @@ -495,7 +495,7 @@ class AirshipModule internal constructor(val context: ReactApplicationContext) : override fun privacyManagerEnableFeature(features: ReadableArray?, promise: Promise) { promise.resolveResult { proxy.privacyManager.enableFeatures( - Utils.convertArray(requireNotNull(features)) + Utils.convertFeaturesArray(requireNotNull(features)) ) } } @@ -504,7 +504,7 @@ class AirshipModule internal constructor(val context: ReactApplicationContext) : override fun privacyManagerDisableFeature(features: ReadableArray?, promise: Promise) { promise.resolveResult { proxy.privacyManager.disableFeatures( - Utils.convertArray(requireNotNull(features)) + Utils.convertFeaturesArray(requireNotNull(features)) ) } } @@ -513,7 +513,7 @@ class AirshipModule internal constructor(val context: ReactApplicationContext) : override fun privacyManagerIsFeatureEnabled(features: ReadableArray?, promise: Promise) { promise.resolveResult { proxy.privacyManager.isFeatureEnabled( - Utils.convertArray(requireNotNull(features)) + Utils.convertFeaturesArray(requireNotNull(features)) ) } } diff --git a/android/src/main/java/com/urbanairship/reactnative/Utils.kt b/android/src/main/java/com/urbanairship/reactnative/Utils.kt index d4ea6da2..1e3bdcf2 100644 --- a/android/src/main/java/com/urbanairship/reactnative/Utils.kt +++ b/android/src/main/java/com/urbanairship/reactnative/Utils.kt @@ -44,6 +44,31 @@ object Utils { } } + /** + * Converts features array into a JsonValue. + * This is filtering Chat and Location features until we remove them. + * To be removed in the version 20.0.0. + */ + fun convertFeaturesArray(array: ReadableArray?): JsonValue { + return if (array == null) { + JsonValue.NULL + } else { + val jsonValues: MutableList = ArrayList() + var i = 0 + while (i < array.size()) { + val value = convertDynamic(array.getDynamic(i)) + // Filter the unused features. + if (value == "chat" || value == "location") { + i++ + continue + } + jsonValues.add(value) + i++ + } + JsonValue.wrapOpt(jsonValues) + } + } + /** * Converts a dynamic object into a [JsonValue]. * diff --git a/ios/AirshipReactNative.swift b/ios/AirshipReactNative.swift index d4830a06..6f979cdd 100644 --- a/ios/AirshipReactNative.swift +++ b/ios/AirshipReactNative.swift @@ -552,7 +552,10 @@ public extension AirshipReactNative { @objc func privacyManagerDisableFeature(features: [String]) throws { - try AirshipProxy.shared.privacyManager.disable(featureNames: features) + let filteredFeatures = features.filter { feature in + return feature != "chat" && feature != "location" + } + try AirshipProxy.shared.privacyManager.disable(featureNames: filteredFeatures) } @objc diff --git a/src/types.ts b/src/types.ts index 9df762d0..3499034f 100644 --- a/src/types.ts +++ b/src/types.ts @@ -540,10 +540,12 @@ export enum Feature { InAppAutomation = 'in_app_automation', MessageCenter = 'message_center', Push = 'push', - FeatureFlags = 'feature_flags', Analytics = 'analytics', TagsAndAttributes = 'tags_and_attributes', - Contacts = 'contacts' + Contacts = 'contacts', + FeatureFlags = 'feature_flags', + Location = 'location', // No longer used. To be removed in version 20.0.0. + Chat = 'chat', // No longer used. To be removed in version 20.0.0. } /** From d421a13c8f443838d71382ed3d2ee3b7d8b0713b Mon Sep 17 00:00:00 2001 From: Ulrich GIBERNE Date: Mon, 15 Jul 2024 16:49:19 -0400 Subject: [PATCH 4/8] fix --- android/src/main/java/com/urbanairship/reactnative/Utils.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/src/main/java/com/urbanairship/reactnative/Utils.kt b/android/src/main/java/com/urbanairship/reactnative/Utils.kt index 1e3bdcf2..47f459b4 100644 --- a/android/src/main/java/com/urbanairship/reactnative/Utils.kt +++ b/android/src/main/java/com/urbanairship/reactnative/Utils.kt @@ -58,7 +58,7 @@ object Utils { while (i < array.size()) { val value = convertDynamic(array.getDynamic(i)) // Filter the unused features. - if (value == "chat" || value == "location") { + if (value.getString() == "chat" || value.getString() == "location") { i++ continue } From 0b9392f3587bc93ef19ad72c2215169e54f10b8a Mon Sep 17 00:00:00 2001 From: Ulrich GIBERNE Date: Wed, 17 Jul 2024 11:32:47 -0400 Subject: [PATCH 5/8] filter at the react level --- .../urbanairship/reactnative/AirshipModule.kt | 8 +++--- .../com/urbanairship/reactnative/Utils.kt | 25 ------------------- ios/AirshipReactNative.swift | 5 +--- src/AirshipPrivacyManager.ts | 24 +++++++++++++++--- src/types.ts | 4 ++- 5 files changed, 28 insertions(+), 38 deletions(-) diff --git a/android/src/main/java/com/urbanairship/reactnative/AirshipModule.kt b/android/src/main/java/com/urbanairship/reactnative/AirshipModule.kt index b3d8e8f1..1432ed94 100644 --- a/android/src/main/java/com/urbanairship/reactnative/AirshipModule.kt +++ b/android/src/main/java/com/urbanairship/reactnative/AirshipModule.kt @@ -479,7 +479,7 @@ class AirshipModule internal constructor(val context: ReactApplicationContext) : override fun privacyManagerSetEnabledFeatures(features: ReadableArray?, promise: Promise) { promise.resolveResult { proxy.privacyManager.setEnabledFeatures( - Utils.convertFeaturesArray(requireNotNull(features)) + Utils.convertArray(requireNotNull(features)) ) } } @@ -495,7 +495,7 @@ class AirshipModule internal constructor(val context: ReactApplicationContext) : override fun privacyManagerEnableFeature(features: ReadableArray?, promise: Promise) { promise.resolveResult { proxy.privacyManager.enableFeatures( - Utils.convertFeaturesArray(requireNotNull(features)) + Utils.convertArray(requireNotNull(features)) ) } } @@ -504,7 +504,7 @@ class AirshipModule internal constructor(val context: ReactApplicationContext) : override fun privacyManagerDisableFeature(features: ReadableArray?, promise: Promise) { promise.resolveResult { proxy.privacyManager.disableFeatures( - Utils.convertFeaturesArray(requireNotNull(features)) + Utils.convertArray(requireNotNull(features)) ) } } @@ -513,7 +513,7 @@ class AirshipModule internal constructor(val context: ReactApplicationContext) : override fun privacyManagerIsFeatureEnabled(features: ReadableArray?, promise: Promise) { promise.resolveResult { proxy.privacyManager.isFeatureEnabled( - Utils.convertFeaturesArray(requireNotNull(features)) + Utils.convertArray(requireNotNull(features)) ) } } diff --git a/android/src/main/java/com/urbanairship/reactnative/Utils.kt b/android/src/main/java/com/urbanairship/reactnative/Utils.kt index 47f459b4..d4ea6da2 100644 --- a/android/src/main/java/com/urbanairship/reactnative/Utils.kt +++ b/android/src/main/java/com/urbanairship/reactnative/Utils.kt @@ -44,31 +44,6 @@ object Utils { } } - /** - * Converts features array into a JsonValue. - * This is filtering Chat and Location features until we remove them. - * To be removed in the version 20.0.0. - */ - fun convertFeaturesArray(array: ReadableArray?): JsonValue { - return if (array == null) { - JsonValue.NULL - } else { - val jsonValues: MutableList = ArrayList() - var i = 0 - while (i < array.size()) { - val value = convertDynamic(array.getDynamic(i)) - // Filter the unused features. - if (value.getString() == "chat" || value.getString() == "location") { - i++ - continue - } - jsonValues.add(value) - i++ - } - JsonValue.wrapOpt(jsonValues) - } - } - /** * Converts a dynamic object into a [JsonValue]. * diff --git a/ios/AirshipReactNative.swift b/ios/AirshipReactNative.swift index 6f979cdd..d4830a06 100644 --- a/ios/AirshipReactNative.swift +++ b/ios/AirshipReactNative.swift @@ -552,10 +552,7 @@ public extension AirshipReactNative { @objc func privacyManagerDisableFeature(features: [String]) throws { - let filteredFeatures = features.filter { feature in - return feature != "chat" && feature != "location" - } - try AirshipProxy.shared.privacyManager.disable(featureNames: filteredFeatures) + try AirshipProxy.shared.privacyManager.disable(featureNames: features) } @objc diff --git a/src/AirshipPrivacyManager.ts b/src/AirshipPrivacyManager.ts index 77d16e2f..00a887bb 100644 --- a/src/AirshipPrivacyManager.ts +++ b/src/AirshipPrivacyManager.ts @@ -12,7 +12,11 @@ export class AirshipPrivacyManager { * @returns A promise. */ public setEnabledFeatures(features: Feature[]): Promise { - return this.module.privacyManagerSetEnabledFeatures(features); + return this.module.privacyManagerSetEnabledFeatures( + features.filter(feature => + feature !== Feature.Location && feature !== Feature.Chat + ) + ); } /** * Gets the current enabled features. @@ -28,7 +32,11 @@ export class AirshipPrivacyManager { * @returns A promise. */ public enableFeatures(features: Feature[]): Promise { - return this.module.privacyManagerEnableFeature(features); + return this.module.privacyManagerEnableFeature( + features.filter(feature => + feature !== Feature.Location && feature !== Feature.Chat + ) + ); } /** @@ -37,7 +45,11 @@ export class AirshipPrivacyManager { * @returns A promise. */ public disableFeatures(features: Feature[]): Promise { - return this.module.privacyManagerDisableFeature(features); + return this.module.privacyManagerDisableFeature( + features.filter(feature => + feature !== Feature.Location && feature !== Feature.Chat + ) + ); } /** @@ -46,6 +58,10 @@ export class AirshipPrivacyManager { * @returns A promise with the result. */ public isFeaturesEnabled(features: Feature[]): Promise { - return this.module.privacyManagerIsFeatureEnabled(features); + return this.module.privacyManagerIsFeatureEnabled( + features.filter(feature => + feature !== Feature.Location && feature !== Feature.Chat + ) + ); } } diff --git a/src/types.ts b/src/types.ts index 3499034f..ae7da1f6 100644 --- a/src/types.ts +++ b/src/types.ts @@ -551,7 +551,9 @@ export enum Feature { /** * All available features. */ -export const FEATURES_ALL = Object.values(Feature); +export const FEATURES_ALL = Object.values(Feature).filter(feature => + feature !== Feature.Location && feature !== Feature.Chat +); /** * Subscription Scope types. From 72e3f2f6df539a18e28a18ae1089708c858831dd Mon Sep 17 00:00:00 2001 From: Ulrich GIBERNE Date: Wed, 17 Jul 2024 12:16:49 -0400 Subject: [PATCH 6/8] changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2dd4a885..dc71baa1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # React Native Module Changelog -## Version 19.0.1 - July 15, 2024 +## Version 19.0.1 - July 17, 2024 Patch release that fixes enabling or disabling all Airship features using `FEATURES_ALL`. ### Changes From 1426782b238ec87cd8bd7d2c53f02114c6687db4 Mon Sep 17 00:00:00 2001 From: Ulrich GIBERNE Date: Wed, 17 Jul 2024 15:41:17 -0400 Subject: [PATCH 7/8] Minor release --- CHANGELOG.md | 5 +++-- ios/AirshipReactNative.swift | 2 +- package.json | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dc71baa1..5048eba9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,11 @@ # React Native Module Changelog -## Version 19.0.1 - July 17, 2024 -Patch release that fixes enabling or disabling all Airship features using `FEATURES_ALL`. +## Version 19.1.0 - July 17, 2024 +Minor release that fixes enabling or disabling all Airship features using `FEATURES_ALL` and adds possibility to enable and disable `Feature.FeatureFlags`. ### Changes - Fixed enabling or disabling features using `FEATURE_ALL`. +- Added possibility to enable and disable `Feature.FeatureFlags` ## Version 19.0.0 - July 9, 2024 Major release that updates the Android Airship SDK to 18. diff --git a/ios/AirshipReactNative.swift b/ios/AirshipReactNative.swift index d4830a06..c6f732ec 100644 --- a/ios/AirshipReactNative.swift +++ b/ios/AirshipReactNative.swift @@ -36,7 +36,7 @@ public class AirshipReactNative: NSObject { AirshipProxy.shared } - public static let version: String = "19.0.1" + public static let version: String = "19.1.0" private let eventNotifier = EventNotifier() diff --git a/package.json b/package.json index 9a1c88e4..3df9b11e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ua/react-native-airship", - "version": "19.0.1", + "version": "19.1.0", "description": "Airship plugin for React Native apps.", "main": "lib/commonjs/index", "module": "lib/module/index", From f53b634d9168749c98793e2f657aed17a43ab6e4 Mon Sep 17 00:00:00 2001 From: Ulrich GIBERNE Date: Wed, 17 Jul 2024 15:51:06 -0400 Subject: [PATCH 8/8] wording --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5048eba9..57010af0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ Minor release that fixes enabling or disabling all Airship features using `FEATU ### Changes - Fixed enabling or disabling features using `FEATURE_ALL`. -- Added possibility to enable and disable `Feature.FeatureFlags` +- Added possibility to enable and disable `Feature.FeatureFlags` using the privacy manager. ## Version 19.0.0 - July 9, 2024 Major release that updates the Android Airship SDK to 18.