From 854c14db070fb71753be6f946cab7b3cf719d74d Mon Sep 17 00:00:00 2001 From: Ryan Morales Date: Mon, 10 Feb 2025 11:21:30 -0800 Subject: [PATCH 1/2] move version to NotificationBuilderConstants --- .github/workflows/update-version.yml | 2 +- .../NotificationBuilder.kt | 6 +++--- .../NotificationBuilderConstants.kt | 20 +++++++++++++++++++ 3 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 code/notificationbuilder/src/main/java/com/adobe/marketing/mobile/notificationbuilder/NotificationBuilderConstants.kt diff --git a/.github/workflows/update-version.yml b/.github/workflows/update-version.yml index b77f0d78..ffa3d7b0 100644 --- a/.github/workflows/update-version.yml +++ b/.github/workflows/update-version.yml @@ -43,5 +43,5 @@ jobs: version: ${{ github.event.inputs.version }} branch: ${{ github.event.inputs.branch }} dependencies: Core ${{ github.event.inputs.core-dependency }} - paths: code/gradle.properties, code/notificationbuilder/src/main/java/com/adobe/marketing/mobile/notificationbuilder/NotificationBuilder.kt + paths: code/gradle.properties, code/notificationbuilder/src/main/java/com/adobe/marketing/mobile/notificationbuilder/NotificationBuilderConstants.kt update: true \ No newline at end of file diff --git a/code/notificationbuilder/src/main/java/com/adobe/marketing/mobile/notificationbuilder/NotificationBuilder.kt b/code/notificationbuilder/src/main/java/com/adobe/marketing/mobile/notificationbuilder/NotificationBuilder.kt index 339b65a8..dd574ccd 100644 --- a/code/notificationbuilder/src/main/java/com/adobe/marketing/mobile/notificationbuilder/NotificationBuilder.kt +++ b/code/notificationbuilder/src/main/java/com/adobe/marketing/mobile/notificationbuilder/NotificationBuilder.kt @@ -17,6 +17,8 @@ import android.content.Context import android.content.Intent import androidx.core.app.NotificationCompat import com.adobe.marketing.mobile.notificationbuilder.NotificationBuilder.constructNotificationBuilder +import com.adobe.marketing.mobile.notificationbuilder.NotificationBuilderConstants.TAG +import com.adobe.marketing.mobile.notificationbuilder.NotificationBuilderConstants.VERSION import com.adobe.marketing.mobile.notificationbuilder.PushTemplateConstants.LOG_TAG import com.adobe.marketing.mobile.notificationbuilder.internal.PushTemplateType import com.adobe.marketing.mobile.notificationbuilder.internal.builders.AutoCarouselNotificationBuilder @@ -52,8 +54,6 @@ import com.adobe.marketing.mobile.services.ServiceProvider * [AEPPushTemplate] or [Intent]. */ object NotificationBuilder { - private const val SELF_TAG = "NotificationBuilder" - private const val VERSION = "3.0.3" @JvmStatic fun version(): String { @@ -157,7 +157,7 @@ object NotificationBuilder { else -> { Log.warning( LOG_TAG, - SELF_TAG, + TAG, "Unknown carousel push template type, creating a legacy style notification." ) return LegacyNotificationBuilder.construct( diff --git a/code/notificationbuilder/src/main/java/com/adobe/marketing/mobile/notificationbuilder/NotificationBuilderConstants.kt b/code/notificationbuilder/src/main/java/com/adobe/marketing/mobile/notificationbuilder/NotificationBuilderConstants.kt new file mode 100644 index 00000000..60221a90 --- /dev/null +++ b/code/notificationbuilder/src/main/java/com/adobe/marketing/mobile/notificationbuilder/NotificationBuilderConstants.kt @@ -0,0 +1,20 @@ +/* + Copyright 2025 Adobe. All rights reserved. + This file is licensed to you under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. You may obtain a copy + of the License at http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software distributed under + the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS + OF ANY KIND, either express or implied. See the License for the specific language + governing permissions and limitations under the License. +*/ + +package com.adobe.marketing.mobile.notificationbuilder + +/** + * This object holds all constant values for the NotificationBuilder object. + */ +internal object NotificationBuilderConstants { + internal const val TAG = "NotificationBuilder" + internal const val VERSION = "3.0.3" +} From 7d5fd9ac83bc8a2b116e09a423f748553667de70 Mon Sep 17 00:00:00 2001 From: Ryan Morales Date: Mon, 10 Feb 2025 11:31:06 -0800 Subject: [PATCH 2/2] update test to use version constant --- .../mobile/notificationbuilder/NotificationBuilderTests.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/notificationbuilder/src/test/java/com/adobe/marketing/mobile/notificationbuilder/NotificationBuilderTests.kt b/code/notificationbuilder/src/test/java/com/adobe/marketing/mobile/notificationbuilder/NotificationBuilderTests.kt index 2ddafbf6..99b180dd 100644 --- a/code/notificationbuilder/src/test/java/com/adobe/marketing/mobile/notificationbuilder/NotificationBuilderTests.kt +++ b/code/notificationbuilder/src/test/java/com/adobe/marketing/mobile/notificationbuilder/NotificationBuilderTests.kt @@ -118,7 +118,7 @@ class NotificationBuilderTests { fun `NotificationBuilder version values matches the expected version`() { val version = NotificationBuilder.version() - assertEquals("3.0.3", version) + assertEquals(NotificationBuilderConstants.VERSION, version) } @Test