diff --git a/WordPress/src/main/java/org/wordpress/android/ui/mysite/cards/dashboard/CardViewModelSlice.kt b/WordPress/src/main/java/org/wordpress/android/ui/mysite/cards/dashboard/CardViewModelSlice.kt index 37b39f4e2479..7e303986d344 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/mysite/cards/dashboard/CardViewModelSlice.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/mysite/cards/dashboard/CardViewModelSlice.kt @@ -153,6 +153,7 @@ class CardViewModelSlice @Inject constructor( identifier = buildConfigWrapper.getApplicationId(), marketingVersion = buildConfigWrapper.getAppVersionName(), platform = FEATURE_FLAG_PLATFORM_PARAMETER, + osVersion = buildConfigWrapper.androidVersion ) val result = cardsStore.fetchCards(payload) val error = result.error diff --git a/WordPress/src/main/java/org/wordpress/android/util/BuildConfigWrapper.kt b/WordPress/src/main/java/org/wordpress/android/util/BuildConfigWrapper.kt index b7bd6a2a1c9d..5911cf39ca0b 100644 --- a/WordPress/src/main/java/org/wordpress/android/util/BuildConfigWrapper.kt +++ b/WordPress/src/main/java/org/wordpress/android/util/BuildConfigWrapper.kt @@ -1,5 +1,6 @@ package org.wordpress.android.util +import android.os.Build import org.wordpress.android.BuildConfig import javax.inject.Inject @@ -33,4 +34,6 @@ class BuildConfigWrapper @Inject constructor() { val isFollowedSitesSettingsEnabled = BuildConfig.ENABLE_FOLLOWED_SITES_SETTINGS val isWhatsNewFeatureEnabled = BuildConfig.ENABLE_WHATS_NEW_FEATURE + + val androidVersion: String = Build.VERSION.RELEASE } diff --git a/WordPress/src/main/java/org/wordpress/android/util/config/FeatureFlagConfig.kt b/WordPress/src/main/java/org/wordpress/android/util/config/FeatureFlagConfig.kt index dbb843b6fb90..0d0d08723354 100644 --- a/WordPress/src/main/java/org/wordpress/android/util/config/FeatureFlagConfig.kt +++ b/WordPress/src/main/java/org/wordpress/android/util/config/FeatureFlagConfig.kt @@ -6,6 +6,7 @@ import kotlinx.coroutines.launch import org.wordpress.android.BuildConfig import org.wordpress.android.analytics.AnalyticsTracker import org.wordpress.android.analytics.AnalyticsTracker.Stat +import org.wordpress.android.fluxc.network.rest.wpcom.mobile.FeatureFlagsRestClient import org.wordpress.android.fluxc.persistence.FeatureFlagConfigDao.FeatureFlag import org.wordpress.android.fluxc.store.NotificationStore.Companion.WPCOM_PUSH_DEVICE_UUID import org.wordpress.android.fluxc.store.mobile.FeatureFlagsStore @@ -72,12 +73,15 @@ class FeatureFlagConfig private suspend fun fetchRemoteFlags() { val response = featureFlagStore.fetchFeatureFlags( - buildNumber = BuildConfig.VERSION_CODE.toString(), - deviceId = preferences.getString(WPCOM_PUSH_DEVICE_UUID, null) - ?: generateAndStoreUUID(), - identifier = BuildConfig.APPLICATION_ID, - marketingVersion = BuildConfig.VERSION_NAME, - platform = FEATURE_FLAG_PLATFORM_PARAMETER + FeatureFlagsRestClient.FeatureFlagsPayload( + buildNumber = BuildConfig.VERSION_CODE.toString(), + deviceId = preferences.getString(WPCOM_PUSH_DEVICE_UUID, null) + ?: generateAndStoreUUID(), + identifier = BuildConfig.APPLICATION_ID, + marketingVersion = BuildConfig.VERSION_NAME, + platform = FEATURE_FLAG_PLATFORM_PARAMETER, + osVersion = android.os.Build.VERSION.RELEASE + ) ) response.featureFlags?.let { configValues -> AppLog.e(UTILS, "Feature flag values synced") diff --git a/WordPress/src/test/java/org/wordpress/android/ui/mysite/cards/dashboard/CardsViewModelSliceTest.kt b/WordPress/src/test/java/org/wordpress/android/ui/mysite/cards/dashboard/CardsViewModelSliceTest.kt index 90daaad5caaa..a53d61c8df06 100644 --- a/WordPress/src/test/java/org/wordpress/android/ui/mysite/cards/dashboard/CardsViewModelSliceTest.kt +++ b/WordPress/src/test/java/org/wordpress/android/ui/mysite/cards/dashboard/CardsViewModelSliceTest.kt @@ -106,6 +106,7 @@ private const val DEVICE_ID_PARAM = "device_id_param" private const val IDENTIFIER_PARAM = "identifier_param" private const val MARKETING_VERSION_PARAM = "marketing_version_param" private const val PLATFORM_PARAM = "android" +private const val ANDROID_VERSION_PARAM = "14.0" /* MODEL */ @@ -296,7 +297,8 @@ class CardsViewModelSliceTest : BaseUnitTest() { DEVICE_ID_PARAM, IDENTIFIER_PARAM, MARKETING_VERSION_PARAM, - PLATFORM_PARAM + PLATFORM_PARAM, + ANDROID_VERSION_PARAM, ) viewModelSlice.initialize(testScope()) @@ -330,6 +332,7 @@ class CardsViewModelSliceTest : BaseUnitTest() { whenever(buildConfigWrapper.getAppVersionCode()).thenReturn(BUILD_NUMBER_PARAM.toInt()) whenever(buildConfigWrapper.getApplicationId()).thenReturn(IDENTIFIER_PARAM) whenever(buildConfigWrapper.getAppVersionName()).thenReturn(MARKETING_VERSION_PARAM) + whenever(buildConfigWrapper.androidVersion).thenReturn(ANDROID_VERSION_PARAM) whenever(preferenceUtilsWrapper.getFluxCPreferences()).thenReturn(sharedPreferences) whenever(sharedPreferences.getString(any(), anyOrNull())).thenReturn(DEVICE_ID_PARAM) } @@ -500,7 +503,8 @@ class CardsViewModelSliceTest : BaseUnitTest() { DEVICE_ID_PARAM, IDENTIFIER_PARAM, MARKETING_VERSION_PARAM, - PLATFORM_PARAM + PLATFORM_PARAM, + ANDROID_VERSION_PARAM, ) whenever(cardsStore.getCards(siteModel)).thenReturn(flowOf(CardsResult())) whenever(cardsStore.fetchCards(fetchCardsPayload)).thenReturn(apiError) @@ -522,7 +526,8 @@ class CardsViewModelSliceTest : BaseUnitTest() { DEVICE_ID_PARAM, IDENTIFIER_PARAM, MARKETING_VERSION_PARAM, - PLATFORM_PARAM + PLATFORM_PARAM, + ANDROID_VERSION_PARAM, ) whenever(cardsStore.getCards(siteModel)).thenReturn(flowOf(data)) whenever(cardsStore.fetchCards(fetchCardsPayload)).thenReturn(success) @@ -558,7 +563,8 @@ class CardsViewModelSliceTest : BaseUnitTest() { DEVICE_ID_PARAM, IDENTIFIER_PARAM, MARKETING_VERSION_PARAM, - PLATFORM_PARAM + PLATFORM_PARAM, + ANDROID_VERSION_PARAM, ) whenever(cardsStore.getCards(siteModel)).thenReturn(flowOf(data)) whenever(cardsStore.fetchCards(fetchCardsPayload)).thenReturn(success) @@ -581,7 +587,8 @@ class CardsViewModelSliceTest : BaseUnitTest() { DEVICE_ID_PARAM, IDENTIFIER_PARAM, MARKETING_VERSION_PARAM, - PLATFORM_PARAM + PLATFORM_PARAM, + ANDROID_VERSION_PARAM, ) whenever(cardsStore.getCards(siteModel)).thenReturn(flowOf(data)) whenever(cardsStore.fetchCards(fetchCardsPayload)).thenReturn(success) @@ -638,7 +645,8 @@ class CardsViewModelSliceTest : BaseUnitTest() { DEVICE_ID_PARAM, IDENTIFIER_PARAM, MARKETING_VERSION_PARAM, - PLATFORM_PARAM + PLATFORM_PARAM, + ANDROID_VERSION_PARAM, ) ) } diff --git a/build.gradle b/build.gradle index 7241fef5a8e5..ebbc2036d83a 100644 --- a/build.gradle +++ b/build.gradle @@ -25,7 +25,7 @@ ext { automatticTracksVersion = '5.1.0' gutenbergMobileVersion = 'v1.120.0' wordPressAztecVersion = 'v2.1.3' - wordPressFluxCVersion = '2.84.0' + wordPressFluxCVersion = 'trunk-b5d95fda4257bd1b3c94b33088f5e2a3f48ff1c2' wordPressLoginVersion = '1.15.0' wordPressPersistentEditTextVersion = '1.0.2' wordPressUtilsVersion = '3.14.0' diff --git a/libs/mocks/src/main/assets/mocks/mappings/wpcom/mobile/feature-flags.json b/libs/mocks/src/main/assets/mocks/mappings/wpcom/mobile/feature-flags.json index fceb98ec7b9f..10183cd805b5 100644 --- a/libs/mocks/src/main/assets/mocks/mappings/wpcom/mobile/feature-flags.json +++ b/libs/mocks/src/main/assets/mocks/mappings/wpcom/mobile/feature-flags.json @@ -15,6 +15,9 @@ "marketing_version": { "matches": "(.*)" }, + "os_version": { + "matches": "(.*)" + }, "platform": { "matches": "android" },