diff --git a/CHANGELOG.md b/CHANGELOG.md index 4fbae4b..83a8ec4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +## 2.1.0 (2025-11-27) + + +### Features + +* **braze:** add support for platform-specific app keys ([#48](https://github.com/rudderlabs/rudder-integration-braze-android/issues/48)) ([92cbd53](https://github.com/rudderlabs/rudder-integration-braze-android/commit/92cbd535c73bad3abfba71b9c2d0a21b11f66826)) + ## 2.0.0 (2025-04-24) diff --git a/braze/src/main/java/com/rudderstack/android/integration/braze/BrazeIntegrationFactory.java b/braze/src/main/java/com/rudderstack/android/integration/braze/BrazeIntegrationFactory.java index a1c43f0..a4e7828 100644 --- a/braze/src/main/java/com/rudderstack/android/integration/braze/BrazeIntegrationFactory.java +++ b/braze/src/main/java/com/rudderstack/android/integration/braze/BrazeIntegrationFactory.java @@ -108,7 +108,9 @@ enum ConnectionMode { private static final String CURRENCY_KEY = "currency"; private static final String PRODUCTS_KEY = "products"; private static final String DATA_CENTER_KEY = "dataCenter"; + private static final String ANDROID_API_KEY = "androidApiKey"; private static final String API_KEY = "appKey"; + private static final String USE_PLATFORM_SPECIFIC_API_KEYS = "usePlatformSpecificApiKeys"; private static final String SUPPORT_DEDUP = "supportDedup"; private static final String PRODUCT_ID_KEY = "product_id"; private static final String QUANTITY_KEY = "quantity"; @@ -167,12 +169,25 @@ private BrazeIntegrationFactory(Object config, RudderClient client, RudderConfig } else if (RudderClient.getApplication() == null) { RudderLogger.logError("RudderClient is not initialized correctly. Application is null. Aborting Braze initialization."); } else { - // get apiKey and return if null or blank + // Start with default API key if (destinationConfig.containsKey(API_KEY)) { apiKey = (String) destinationConfig.get(API_KEY); } + + // Override with platform-specific key if configured + if (getBoolean(destinationConfig.get(USE_PLATFORM_SPECIFIC_API_KEYS))) { + String androidApiKey = destinationConfig.containsKey(ANDROID_API_KEY) + ? (String) destinationConfig.get(ANDROID_API_KEY) + : ""; + + if (!TextUtils.isEmpty(androidApiKey)) { + apiKey = androidApiKey; + } else { + RudderLogger.logWarn("BrazeIntegration: Configured to use platform-specific API keys but Android API key is not valid. Falling back to the default API key."); + } + } if (TextUtils.isEmpty(apiKey)) { - RudderLogger.logError("Invalid api key. Aborting Braze initialization."); + RudderLogger.logError("Invalid API key. Aborting Braze initialization."); return; } diff --git a/gradle.properties b/gradle.properties index 998076a..439ccec 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,10 +7,10 @@ POM_LICENCE_URL=http://opensource.org/licenses/MIT org.gradle.jvmargs=-Xmx1536m POM_DEVELOPER_ID=Rudderstack POM_LICENCE_NAME=The MIT License (MIT) -VERSION_CODE=5 +VERSION_CODE=6 POM_DEVELOPER_NAME=Rudderstack, Inc. POM_LICENCE_DIST=repo -VERSION_NAME=2.0.0 +VERSION_NAME=2.1.0 POM_URL=https://github.com/rudderlabs/rudder-integration-braze-android POM_SCM_URL=https://github.com/rudderlabs/rudder-integration-braze-android/tree/master POM_SCM_CONNECTION=scm:git:git://github.com/rudderlabs/rudder-integration-braze-android.git diff --git a/package-lock.json b/package-lock.json index d260278..f62e630 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { "name": "rudder-integration-braze-android", - "version": "2.0.0", + "version": "2.1.0", "lockfileVersion": 2, "requires": true, "packages": { "": { - "version": "2.0.0", + "version": "2.1.0", "dependencies": { "properties-reader": "^2.2.0" } diff --git a/package.json b/package.json index 27674f1..0d94687 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "version": "2.0.0", + "version": "2.1.0", "dependencies": { "properties-reader": "^2.2.0" }