From e7f57f5f2b725a1d33d1a0076ec2bcf86be90cfb Mon Sep 17 00:00:00 2001 From: jorgemucientesfayos Date: Fri, 1 Mar 2024 11:42:56 +0100 Subject: [PATCH 01/19] Refactor blaze campaigns fetching to use the new API exposed from FluxC --- .../campaignlisting/CampaignListUseCases.kt | 4 ++-- .../campaignlisting/CampaignListingViewModel.kt | 12 ++++++------ .../android/ui/mysite/cards/blaze/BlazeCardSource.kt | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/blaze/blazecampaigns/campaignlisting/CampaignListUseCases.kt b/WordPress/src/main/java/org/wordpress/android/ui/blaze/blazecampaigns/campaignlisting/CampaignListUseCases.kt index 18b43200e49b..57c68e259c50 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/blaze/blazecampaigns/campaignlisting/CampaignListUseCases.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/blaze/blazecampaigns/campaignlisting/CampaignListUseCases.kt @@ -10,8 +10,8 @@ class FetchCampaignListUseCase @Inject constructor( private val mapper: CampaignListingUIModelMapper ) { @Suppress("ReturnCount") - suspend fun execute(site: SiteModel, page: Int): Result> { - val result = store.fetchBlazeCampaigns(site, page) + suspend fun execute(site: SiteModel, skip: Int): Result> { + val result = store.fetchBlazeCampaigns(site, skip) if (result.isError || result.model == null) return Result.Failure(GenericError) val campaigns = result.model!!.campaigns if (campaigns.isEmpty()) return Result.Failure(NoCampaigns) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/blaze/blazecampaigns/campaignlisting/CampaignListingViewModel.kt b/WordPress/src/main/java/org/wordpress/android/ui/blaze/blazecampaigns/campaignlisting/CampaignListingViewModel.kt index 182a29884a17..588673a430a5 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/blaze/blazecampaigns/campaignlisting/CampaignListingViewModel.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/blaze/blazecampaigns/campaignlisting/CampaignListingViewModel.kt @@ -50,7 +50,7 @@ class CampaignListingViewModel @Inject constructor( private val _onSelectedSiteMissing = MutableLiveData() val onSelectedSiteMissing = _onSelectedSiteMissing as LiveData - private var page = 1 + private var skip = 0 private var limitPerPage: Int = 10 private var isLastPage: Boolean = false @@ -79,7 +79,7 @@ class CampaignListingViewModel @Inject constructor( if (networkUtilsWrapper.isNetworkAvailable().not()) { showNoNetworkError() } else { - when (val campaignResult = fetchCampaignListUseCase.execute(site, page)) { + when (val campaignResult = fetchCampaignListUseCase.execute(site, skip)) { is Result.Success -> showCampaigns(campaignResult.value) is Result.Failure -> { when (campaignResult.value) { @@ -119,7 +119,7 @@ class CampaignListingViewModel @Inject constructor( (_uiState.value as CampaignListingUiState.Success).pagingDetails.loadingNext.not() && isLastPage.not() ) { - page++ + skip += limitPerPage showLoadingMore() fetchMoreCampaigns() } @@ -131,7 +131,7 @@ class CampaignListingViewModel @Inject constructor( disableLoadingMore() showSnackBar(R.string.campaign_listing_page_error_refresh_no_network_available) } else { - when (val campaignResult = fetchCampaignListUseCase.execute(site, page)) { + when (val campaignResult = fetchCampaignListUseCase.execute(site, skip)) { is Result.Success -> { val currentUiState = _uiState.value as CampaignListingUiState.Success isLastPage = campaignResult.value.isEmpty() || campaignResult.value.size < limitPerPage @@ -180,14 +180,14 @@ class CampaignListingViewModel @Inject constructor( } fun refreshCampaigns() { - page = 1 + skip = 0 launch { _refresh.postValue(true) if (!networkUtilsWrapper.isNetworkAvailable()) { _refresh.postValue(false) showSnackBar(R.string.campaign_listing_page_error_refresh_no_network_available) } else { - when (val campaignResult = fetchCampaignListUseCase.execute(site, page)) { + when (val campaignResult = fetchCampaignListUseCase.execute(site, skip)) { is Result.Success -> { _refresh.postValue(false) isLastPage = false diff --git a/WordPress/src/main/java/org/wordpress/android/ui/mysite/cards/blaze/BlazeCardSource.kt b/WordPress/src/main/java/org/wordpress/android/ui/mysite/cards/blaze/BlazeCardSource.kt index f5f87c2fe689..fddec0e27091 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/mysite/cards/blaze/BlazeCardSource.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/mysite/cards/blaze/BlazeCardSource.kt @@ -56,7 +56,7 @@ class BlazeCardSource @Inject constructor( if (networkUtilsWrapper.isNetworkAvailable().not()) { getMostRecentCampaignFromDb(site) } else { - when (fetchCampaignListUseCase.execute(site = site, page = 1)) { + when (fetchCampaignListUseCase.execute(site = site, skip = 0)) { is Result.Success -> getMostRecentCampaignFromDb(site) // there are no campaigns or if there is an error , show blaze promo card is Result.Failure -> showPromoteWithBlazeCard() From f495b865d451aa661bb5b561b993e66ea27e64e2 Mon Sep 17 00:00:00 2001 From: jorgemucientesfayos Date: Fri, 1 Mar 2024 11:51:42 +0100 Subject: [PATCH 02/19] Fix unit tests for new blaze campaigns paging system --- .../blaze/blazecampaigns/CampaignListingViewModelTest.kt | 4 ++-- .../campaignlisting/FetchCampaignListUseCaseTest.kt | 4 ++-- .../mysite/cards/dashboard/blaze/BlazeCardSourceTest.kt | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/WordPress/src/test/java/org/wordpress/android/ui/blaze/blazecampaigns/CampaignListingViewModelTest.kt b/WordPress/src/test/java/org/wordpress/android/ui/blaze/blazecampaigns/CampaignListingViewModelTest.kt index e432ebf539d1..4b99f8c27cce 100644 --- a/WordPress/src/test/java/org/wordpress/android/ui/blaze/blazecampaigns/CampaignListingViewModelTest.kt +++ b/WordPress/src/test/java/org/wordpress/android/ui/blaze/blazecampaigns/CampaignListingViewModelTest.kt @@ -118,7 +118,7 @@ class CampaignListingViewModelTest : BaseUnitTest() { whenever(networkUtilsWrapper.isNetworkAvailable()).thenReturn(true) whenever(selectedSiteRepository.getSelectedSite()).thenReturn(siteModel) whenever(getCampaignListFromDbUseCase.execute(siteModel)).thenReturn(noCampaigns) - whenever(fetchCampaignListUseCase.execute(siteModel, 1)).thenReturn(noCampaigns) + whenever(fetchCampaignListUseCase.execute(siteModel, 0)).thenReturn(noCampaigns) viewModel.start(CampaignListingPageSource.DASHBOARD_CARD) advanceUntilIdle() @@ -132,7 +132,7 @@ class CampaignListingViewModelTest : BaseUnitTest() { val noCampaigns: Result> = Result.Failure(NoCampaigns) whenever(networkUtilsWrapper.isNetworkAvailable()).thenReturn(true) whenever(getCampaignListFromDbUseCase.execute(siteModel)).thenReturn(noCampaigns) - whenever(fetchCampaignListUseCase.execute(siteModel, 1)).thenReturn(noCampaigns) + whenever(fetchCampaignListUseCase.execute(siteModel, o)).thenReturn(noCampaigns) viewModel.start(CampaignListingPageSource.DASHBOARD_CARD) advanceUntilIdle() diff --git a/WordPress/src/test/java/org/wordpress/android/ui/blaze/blazecampaigns/campaignlisting/FetchCampaignListUseCaseTest.kt b/WordPress/src/test/java/org/wordpress/android/ui/blaze/blazecampaigns/campaignlisting/FetchCampaignListUseCaseTest.kt index 07cc6dee86a6..00761af312e8 100644 --- a/WordPress/src/test/java/org/wordpress/android/ui/blaze/blazecampaigns/campaignlisting/FetchCampaignListUseCaseTest.kt +++ b/WordPress/src/test/java/org/wordpress/android/ui/blaze/blazecampaigns/campaignlisting/FetchCampaignListUseCaseTest.kt @@ -54,7 +54,7 @@ class FetchCampaignListUseCaseTest: BaseUnitTest() { val siteModel = mock() val page = 1 whenever(store.fetchBlazeCampaigns(siteModel, page)).thenReturn(BlazeCampaignsStore.BlazeCampaignsResult( - BlazeCampaignsModel(emptyList(),1,0,1) + BlazeCampaignsModel(campaigns = emptyList(), skipped = 0, totalItems = 1,) )) val actualResult = fetchCampaignListUseCase.execute(siteModel, page) @@ -68,7 +68,7 @@ class FetchCampaignListUseCaseTest: BaseUnitTest() { val siteModel = mock() val page = 1 whenever(store.fetchBlazeCampaigns(siteModel, page)).thenReturn(BlazeCampaignsStore.BlazeCampaignsResult( - BlazeCampaignsModel(mock(),1,0,1) + BlazeCampaignsModel(campaigns = emptyList(), skipped = 0, totalItems = 1,) )) whenever(mapper.mapToCampaignModels(any())).thenReturn(mock()) diff --git a/WordPress/src/test/java/org/wordpress/android/ui/mysite/cards/dashboard/blaze/BlazeCardSourceTest.kt b/WordPress/src/test/java/org/wordpress/android/ui/mysite/cards/dashboard/blaze/BlazeCardSourceTest.kt index 4fe2e5de37bb..29a436b8b9b4 100644 --- a/WordPress/src/test/java/org/wordpress/android/ui/mysite/cards/dashboard/blaze/BlazeCardSourceTest.kt +++ b/WordPress/src/test/java/org/wordpress/android/ui/mysite/cards/dashboard/blaze/BlazeCardSourceTest.kt @@ -129,7 +129,7 @@ class BlazeCardSourceTest : BaseUnitTest() { blazeCardSource.build(testScope(), SITE_LOCAL_ID) .observeForever { it?.let { result.add(it) } } - verify(fetchCampaignListUseCase, never()).execute(siteModel,1) + verify(fetchCampaignListUseCase, never()).execute(siteModel,skip = 0) assertThat(result.last()).isEqualTo(BlazeCardUpdate(true, null)) } @@ -145,7 +145,7 @@ class BlazeCardSourceTest : BaseUnitTest() { blazeCardSource.build(testScope(), SITE_LOCAL_ID) .observeForever { it?.let { result.add(it) } } - verify(fetchCampaignListUseCase, never()).execute(siteModel,1) + verify(fetchCampaignListUseCase, never()).execute(siteModel,skip = 0) assertThat(result.last()).isEqualTo(BlazeCardUpdate(true, campaignInDb)) } @@ -155,7 +155,7 @@ class BlazeCardSourceTest : BaseUnitTest() { val result = mutableListOf() whenever(blazeFeatureUtils.shouldShowBlazeCampaigns()).thenReturn(true) whenever(networkUtilsWrapper.isNetworkAvailable()).thenReturn(true) - whenever(fetchCampaignListUseCase.execute(siteModel,1)).thenReturn(Result.Failure(GenericError)) + whenever(fetchCampaignListUseCase.execute(siteModel,skip = 0)).thenReturn(Result.Failure(GenericError)) blazeCardSource.build(testScope(), SITE_LOCAL_ID) .observeForever { it?.let { result.add(it) } } @@ -171,7 +171,7 @@ class BlazeCardSourceTest : BaseUnitTest() { val campaignInDb = mock() whenever(blazeFeatureUtils.shouldShowBlazeCampaigns()).thenReturn(true) whenever(networkUtilsWrapper.isNetworkAvailable()).thenReturn(true) - whenever(fetchCampaignListUseCase.execute(siteModel,1)).thenReturn(Result.Success(mock())) + whenever(fetchCampaignListUseCase.execute(siteModel,skip = 0)).thenReturn(Result.Success(mock())) whenever(mostRecentCampaignUseCase.execute(siteModel)).thenReturn(Result.Success(campaignInDb)) blazeCardSource.build(testScope(), SITE_LOCAL_ID) From c01634dbe4c4c820cc1e940a6f59197962d7650a Mon Sep 17 00:00:00 2001 From: jorgemucientesfayos Date: Fri, 1 Mar 2024 11:58:10 +0100 Subject: [PATCH 03/19] Replace usages of budgetCents for new field totalBudget --- .../campaignlisting/CampaignListingUIModelMapper.kt | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/blaze/blazecampaigns/campaignlisting/CampaignListingUIModelMapper.kt b/WordPress/src/main/java/org/wordpress/android/ui/blaze/blazecampaigns/campaignlisting/CampaignListingUIModelMapper.kt index e0543e72162f..c35123a8a8d2 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/blaze/blazecampaigns/campaignlisting/CampaignListingUIModelMapper.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/blaze/blazecampaigns/campaignlisting/CampaignListingUIModelMapper.kt @@ -7,8 +7,6 @@ import org.wordpress.android.ui.stats.refresh.utils.StatsUtils import org.wordpress.android.ui.utils.UiString import javax.inject.Inject -const val CENTS_IN_DOLLARS = 100 - class CampaignListingUIModelMapper @Inject constructor( private val statsUtils: StatsUtils ){ @@ -24,7 +22,7 @@ class CampaignListingUIModelMapper @Inject constructor( featureImageUrl = campaignModel.imageUrl, impressions = mapToStatsStringIfNeeded(campaignModel.impressions), clicks = mapToStatsStringIfNeeded(campaignModel.clicks), - budget = convertToDollars(campaignModel.budgetCents) + budget = UiString.UiStringText("$${campaignModel.totalBudget}") ) } @@ -36,8 +34,4 @@ class CampaignListingUIModelMapper @Inject constructor( null } } - - private fun convertToDollars(budgetCents: Long): UiString { - return UiString.UiStringText("$" + (budgetCents / CENTS_IN_DOLLARS).toString()) - } } From b055cce25f4c9f36cd1fb2926abeb60c17b3d117 Mon Sep 17 00:00:00 2001 From: jorgemucientesfayos Date: Fri, 1 Mar 2024 11:58:30 +0100 Subject: [PATCH 04/19] Update FluxC changeset --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 74233b3d1819..0df46f87e2ee 100644 --- a/build.gradle +++ b/build.gradle @@ -25,7 +25,7 @@ ext { automatticTracksVersion = '3.4.0' gutenbergMobileVersion = 'v1.114.0' wordPressAztecVersion = 'v2.0' - wordPressFluxCVersion = 'trunk-8b930418a49b0d0846ed56ebf8fd8adad5011901' + wordPressFluxCVersion = '2963-148343ac68c8ec51b7d0c1d7f11166ee02ecaeda' wordPressLoginVersion = '1.14.0' wordPressPersistentEditTextVersion = '1.0.2' wordPressUtilsVersion = '3.13.0' From 9795ba93e4436cd3a275b8f0ca032e6c0ec38588 Mon Sep 17 00:00:00 2001 From: jorgemucientesfayos Date: Fri, 1 Mar 2024 14:32:29 +0100 Subject: [PATCH 05/19] Round to it total budget as it only contains whole numbers --- .../campaignlisting/CampaignListingUIModelMapper.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/blaze/blazecampaigns/campaignlisting/CampaignListingUIModelMapper.kt b/WordPress/src/main/java/org/wordpress/android/ui/blaze/blazecampaigns/campaignlisting/CampaignListingUIModelMapper.kt index c35123a8a8d2..920c8f180de7 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/blaze/blazecampaigns/campaignlisting/CampaignListingUIModelMapper.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/blaze/blazecampaigns/campaignlisting/CampaignListingUIModelMapper.kt @@ -6,6 +6,7 @@ import org.wordpress.android.ui.stats.refresh.utils.ONE_THOUSAND import org.wordpress.android.ui.stats.refresh.utils.StatsUtils import org.wordpress.android.ui.utils.UiString import javax.inject.Inject +import kotlin.math.roundToInt class CampaignListingUIModelMapper @Inject constructor( private val statsUtils: StatsUtils @@ -22,7 +23,7 @@ class CampaignListingUIModelMapper @Inject constructor( featureImageUrl = campaignModel.imageUrl, impressions = mapToStatsStringIfNeeded(campaignModel.impressions), clicks = mapToStatsStringIfNeeded(campaignModel.clicks), - budget = UiString.UiStringText("$${campaignModel.totalBudget}") + budget = UiString.UiStringText("$${campaignModel.totalBudget.roundToInt()}") ) } From c1eac902fd903536c3cadc833a031524d12d188f Mon Sep 17 00:00:00 2001 From: jorgemucientesfayos Date: Mon, 4 Mar 2024 10:39:30 +0100 Subject: [PATCH 06/19] Rename "skip" parameter to "offset" and set default page_size to 10 for fetching campaigns --- .../campaignlisting/CampaignListUseCases.kt | 12 ++++++++++-- .../campaignlisting/CampaignListingViewModel.kt | 13 ++++++------- .../ui/mysite/cards/blaze/BlazeCardSource.kt | 2 +- .../blazecampaigns/CampaignListingViewModelTest.kt | 2 +- .../cards/dashboard/blaze/BlazeCardSourceTest.kt | 8 ++++---- 5 files changed, 22 insertions(+), 15 deletions(-) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/blaze/blazecampaigns/campaignlisting/CampaignListUseCases.kt b/WordPress/src/main/java/org/wordpress/android/ui/blaze/blazecampaigns/campaignlisting/CampaignListUseCases.kt index 57c68e259c50..2e81e096512a 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/blaze/blazecampaigns/campaignlisting/CampaignListUseCases.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/blaze/blazecampaigns/campaignlisting/CampaignListUseCases.kt @@ -9,9 +9,17 @@ class FetchCampaignListUseCase @Inject constructor( private val store: BlazeCampaignsStore, private val mapper: CampaignListingUIModelMapper ) { + companion object { + const val PAGE_SIZE = 10 + } + @Suppress("ReturnCount") - suspend fun execute(site: SiteModel, skip: Int): Result> { - val result = store.fetchBlazeCampaigns(site, skip) + suspend fun execute( + site: SiteModel, + offset: Int, + pageSize: Int = PAGE_SIZE + ): Result> { + val result = store.fetchBlazeCampaigns(site = site, offset = offset, perPage = pageSize) if (result.isError || result.model == null) return Result.Failure(GenericError) val campaigns = result.model!!.campaigns if (campaigns.isEmpty()) return Result.Failure(NoCampaigns) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/blaze/blazecampaigns/campaignlisting/CampaignListingViewModel.kt b/WordPress/src/main/java/org/wordpress/android/ui/blaze/blazecampaigns/campaignlisting/CampaignListingViewModel.kt index 588673a430a5..094b731e81d8 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/blaze/blazecampaigns/campaignlisting/CampaignListingViewModel.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/blaze/blazecampaigns/campaignlisting/CampaignListingViewModel.kt @@ -50,8 +50,7 @@ class CampaignListingViewModel @Inject constructor( private val _onSelectedSiteMissing = MutableLiveData() val onSelectedSiteMissing = _onSelectedSiteMissing as LiveData - private var skip = 0 - private var limitPerPage: Int = 10 + private var offset = 0 private var isLastPage: Boolean = false fun start(campaignListingPageSource: CampaignListingPageSource) { @@ -79,7 +78,7 @@ class CampaignListingViewModel @Inject constructor( if (networkUtilsWrapper.isNetworkAvailable().not()) { showNoNetworkError() } else { - when (val campaignResult = fetchCampaignListUseCase.execute(site, skip)) { + when (val campaignResult = fetchCampaignListUseCase.execute(site, offset)) { is Result.Success -> showCampaigns(campaignResult.value) is Result.Failure -> { when (campaignResult.value) { @@ -119,7 +118,7 @@ class CampaignListingViewModel @Inject constructor( (_uiState.value as CampaignListingUiState.Success).pagingDetails.loadingNext.not() && isLastPage.not() ) { - skip += limitPerPage + offset += limitPerPage showLoadingMore() fetchMoreCampaigns() } @@ -131,7 +130,7 @@ class CampaignListingViewModel @Inject constructor( disableLoadingMore() showSnackBar(R.string.campaign_listing_page_error_refresh_no_network_available) } else { - when (val campaignResult = fetchCampaignListUseCase.execute(site, skip)) { + when (val campaignResult = fetchCampaignListUseCase.execute(site, offset)) { is Result.Success -> { val currentUiState = _uiState.value as CampaignListingUiState.Success isLastPage = campaignResult.value.isEmpty() || campaignResult.value.size < limitPerPage @@ -180,14 +179,14 @@ class CampaignListingViewModel @Inject constructor( } fun refreshCampaigns() { - skip = 0 + offset = 0 launch { _refresh.postValue(true) if (!networkUtilsWrapper.isNetworkAvailable()) { _refresh.postValue(false) showSnackBar(R.string.campaign_listing_page_error_refresh_no_network_available) } else { - when (val campaignResult = fetchCampaignListUseCase.execute(site, skip)) { + when (val campaignResult = fetchCampaignListUseCase.execute(site, offset)) { is Result.Success -> { _refresh.postValue(false) isLastPage = false diff --git a/WordPress/src/main/java/org/wordpress/android/ui/mysite/cards/blaze/BlazeCardSource.kt b/WordPress/src/main/java/org/wordpress/android/ui/mysite/cards/blaze/BlazeCardSource.kt index fddec0e27091..fcfb2c1c20f0 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/mysite/cards/blaze/BlazeCardSource.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/mysite/cards/blaze/BlazeCardSource.kt @@ -56,7 +56,7 @@ class BlazeCardSource @Inject constructor( if (networkUtilsWrapper.isNetworkAvailable().not()) { getMostRecentCampaignFromDb(site) } else { - when (fetchCampaignListUseCase.execute(site = site, skip = 0)) { + when (fetchCampaignListUseCase.execute(site = site, offset = 0)) { is Result.Success -> getMostRecentCampaignFromDb(site) // there are no campaigns or if there is an error , show blaze promo card is Result.Failure -> showPromoteWithBlazeCard() diff --git a/WordPress/src/test/java/org/wordpress/android/ui/blaze/blazecampaigns/CampaignListingViewModelTest.kt b/WordPress/src/test/java/org/wordpress/android/ui/blaze/blazecampaigns/CampaignListingViewModelTest.kt index 4b99f8c27cce..2ea7fa488f1c 100644 --- a/WordPress/src/test/java/org/wordpress/android/ui/blaze/blazecampaigns/CampaignListingViewModelTest.kt +++ b/WordPress/src/test/java/org/wordpress/android/ui/blaze/blazecampaigns/CampaignListingViewModelTest.kt @@ -132,7 +132,7 @@ class CampaignListingViewModelTest : BaseUnitTest() { val noCampaigns: Result> = Result.Failure(NoCampaigns) whenever(networkUtilsWrapper.isNetworkAvailable()).thenReturn(true) whenever(getCampaignListFromDbUseCase.execute(siteModel)).thenReturn(noCampaigns) - whenever(fetchCampaignListUseCase.execute(siteModel, o)).thenReturn(noCampaigns) + whenever(fetchCampaignListUseCase.execute(siteModel, offset = 0)).thenReturn(noCampaigns) viewModel.start(CampaignListingPageSource.DASHBOARD_CARD) advanceUntilIdle() diff --git a/WordPress/src/test/java/org/wordpress/android/ui/mysite/cards/dashboard/blaze/BlazeCardSourceTest.kt b/WordPress/src/test/java/org/wordpress/android/ui/mysite/cards/dashboard/blaze/BlazeCardSourceTest.kt index 29a436b8b9b4..333953be63d7 100644 --- a/WordPress/src/test/java/org/wordpress/android/ui/mysite/cards/dashboard/blaze/BlazeCardSourceTest.kt +++ b/WordPress/src/test/java/org/wordpress/android/ui/mysite/cards/dashboard/blaze/BlazeCardSourceTest.kt @@ -129,7 +129,7 @@ class BlazeCardSourceTest : BaseUnitTest() { blazeCardSource.build(testScope(), SITE_LOCAL_ID) .observeForever { it?.let { result.add(it) } } - verify(fetchCampaignListUseCase, never()).execute(siteModel,skip = 0) + verify(fetchCampaignListUseCase, never()).execute(siteModel,offset = 0) assertThat(result.last()).isEqualTo(BlazeCardUpdate(true, null)) } @@ -145,7 +145,7 @@ class BlazeCardSourceTest : BaseUnitTest() { blazeCardSource.build(testScope(), SITE_LOCAL_ID) .observeForever { it?.let { result.add(it) } } - verify(fetchCampaignListUseCase, never()).execute(siteModel,skip = 0) + verify(fetchCampaignListUseCase, never()).execute(siteModel,offset = 0) assertThat(result.last()).isEqualTo(BlazeCardUpdate(true, campaignInDb)) } @@ -155,7 +155,7 @@ class BlazeCardSourceTest : BaseUnitTest() { val result = mutableListOf() whenever(blazeFeatureUtils.shouldShowBlazeCampaigns()).thenReturn(true) whenever(networkUtilsWrapper.isNetworkAvailable()).thenReturn(true) - whenever(fetchCampaignListUseCase.execute(siteModel,skip = 0)).thenReturn(Result.Failure(GenericError)) + whenever(fetchCampaignListUseCase.execute(siteModel,offset = 0)).thenReturn(Result.Failure(GenericError)) blazeCardSource.build(testScope(), SITE_LOCAL_ID) .observeForever { it?.let { result.add(it) } } @@ -171,7 +171,7 @@ class BlazeCardSourceTest : BaseUnitTest() { val campaignInDb = mock() whenever(blazeFeatureUtils.shouldShowBlazeCampaigns()).thenReturn(true) whenever(networkUtilsWrapper.isNetworkAvailable()).thenReturn(true) - whenever(fetchCampaignListUseCase.execute(siteModel,skip = 0)).thenReturn(Result.Success(mock())) + whenever(fetchCampaignListUseCase.execute(siteModel,offset = 0)).thenReturn(Result.Success(mock())) whenever(mostRecentCampaignUseCase.execute(siteModel)).thenReturn(Result.Success(campaignInDb)) blazeCardSource.build(testScope(), SITE_LOCAL_ID) From f08fd67a5d578f7ec4495e0518a0e4003d3cc5d3 Mon Sep 17 00:00:00 2001 From: jorgemucientesfayos Date: Mon, 4 Mar 2024 11:36:13 +0100 Subject: [PATCH 07/19] Refactor how pagination is handled for Blaze campaigns --- .../campaignlisting/CampaignListUseCases.kt | 22 ++++++++++++++----- .../CampaignListingViewModel.kt | 19 ++++++++-------- 2 files changed, 26 insertions(+), 15 deletions(-) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/blaze/blazecampaigns/campaignlisting/CampaignListUseCases.kt b/WordPress/src/main/java/org/wordpress/android/ui/blaze/blazecampaigns/campaignlisting/CampaignListUseCases.kt index 2e81e096512a..b70f24f2008e 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/blaze/blazecampaigns/campaignlisting/CampaignListUseCases.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/blaze/blazecampaigns/campaignlisting/CampaignListUseCases.kt @@ -18,12 +18,17 @@ class FetchCampaignListUseCase @Inject constructor( site: SiteModel, offset: Int, pageSize: Int = PAGE_SIZE - ): Result> { + ): Result { val result = store.fetchBlazeCampaigns(site = site, offset = offset, perPage = pageSize) - if (result.isError || result.model == null) return Result.Failure(GenericError) + if (result.isError || result.model == null) return Result.Failure(GenericResult) val campaigns = result.model!!.campaigns if (campaigns.isEmpty()) return Result.Failure(NoCampaigns) - return Result.Success(mapper.mapToCampaignModels(campaigns)) + return Result.Success( + FetchedCampaignsResult( + campaigns = mapper.mapToCampaignModels(campaigns), + totalItems = result.model!!.totalItems + ) + ) } } @@ -38,8 +43,13 @@ class GetCampaignListFromDbUseCase @Inject constructor( } } -sealed interface NetworkError +data class FetchedCampaignsResult( + val campaigns: List, + val totalItems: Int +) -object GenericError : NetworkError +sealed interface NetworkResult -object NoCampaigns : NetworkError +object GenericResult : NetworkResult + +object NoCampaigns : NetworkResult diff --git a/WordPress/src/main/java/org/wordpress/android/ui/blaze/blazecampaigns/campaignlisting/CampaignListingViewModel.kt b/WordPress/src/main/java/org/wordpress/android/ui/blaze/blazecampaigns/campaignlisting/CampaignListingViewModel.kt index 094b731e81d8..2814101443a9 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/blaze/blazecampaigns/campaignlisting/CampaignListingViewModel.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/blaze/blazecampaigns/campaignlisting/CampaignListingViewModel.kt @@ -79,10 +79,10 @@ class CampaignListingViewModel @Inject constructor( showNoNetworkError() } else { when (val campaignResult = fetchCampaignListUseCase.execute(site, offset)) { - is Result.Success -> showCampaigns(campaignResult.value) + is Result.Success -> showCampaigns(campaignResult.value.campaigns) is Result.Failure -> { when (campaignResult.value) { - is GenericError -> showGenericError() + is GenericResult -> showGenericError() is NoCampaigns -> showNoCampaigns() } } @@ -118,7 +118,6 @@ class CampaignListingViewModel @Inject constructor( (_uiState.value as CampaignListingUiState.Success).pagingDetails.loadingNext.not() && isLastPage.not() ) { - offset += limitPerPage showLoadingMore() fetchMoreCampaigns() } @@ -133,13 +132,15 @@ class CampaignListingViewModel @Inject constructor( when (val campaignResult = fetchCampaignListUseCase.execute(site, offset)) { is Result.Success -> { val currentUiState = _uiState.value as CampaignListingUiState.Success - isLastPage = campaignResult.value.isEmpty() || campaignResult.value.size < limitPerPage - showCampaigns(currentUiState.campaigns + campaignResult.value) + val allCampaigns = currentUiState.campaigns + campaignResult.value.campaigns + isLastPage = allCampaigns.size >= campaignResult.value.totalItems + offset += allCampaigns.size + showCampaigns(allCampaigns) } is Result.Failure -> { when (campaignResult.value) { - is GenericError -> { + is GenericResult -> { disableLoadingMore() showSnackBar(R.string.campaign_listing_page_error_refresh_could_not_fetch_campaigns) } @@ -179,23 +180,23 @@ class CampaignListingViewModel @Inject constructor( } fun refreshCampaigns() { - offset = 0 launch { _refresh.postValue(true) if (!networkUtilsWrapper.isNetworkAvailable()) { _refresh.postValue(false) showSnackBar(R.string.campaign_listing_page_error_refresh_no_network_available) } else { + offset = 0 when (val campaignResult = fetchCampaignListUseCase.execute(site, offset)) { is Result.Success -> { _refresh.postValue(false) isLastPage = false - showCampaigns(campaignResult.value) + showCampaigns(campaignResult.value.campaigns) } is Result.Failure -> { when (campaignResult.value) { - is GenericError -> { + is GenericResult -> { _refresh.postValue(false) showSnackBar(R.string.campaign_listing_page_error_refresh_could_not_fetch_campaigns) } From b115f531990fd49a71402991f23d43990bff33f5 Mon Sep 17 00:00:00 2001 From: jorgemucientesfayos Date: Mon, 4 Mar 2024 12:39:56 +0100 Subject: [PATCH 08/19] Fix compile issues after converting campaign Id from Int to String --- .../main/java/org/wordpress/android/ui/ActivityNavigator.kt | 2 +- .../android/ui/blaze/blazecampaigns/BlazeCampaignPage.kt | 2 +- .../blazecampaigns/campaigndetail/CampaignDetailFragment.kt | 6 +++--- .../campaigndetail/CampaignDetailViewModel.kt | 6 +++--- .../campaignlisting/CampaignListingViewModel.kt | 4 ++-- .../wordpress/android/ui/mysite/BlazeCardViewModelSlice.kt | 2 +- .../org/wordpress/android/ui/mysite/MySiteCardAndItem.kt | 4 ++-- .../android/ui/mysite/MySiteCardAndItemBuilderParams.kt | 2 +- .../org/wordpress/android/ui/mysite/SiteNavigationAction.kt | 2 +- .../campaignlisting/FetchCampaignListUseCaseTest.kt | 2 +- .../ui/mysite/cards/dashboard/blaze/BlazeCardSourceTest.kt | 4 ++-- 11 files changed, 18 insertions(+), 18 deletions(-) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/ActivityNavigator.kt b/WordPress/src/main/java/org/wordpress/android/ui/ActivityNavigator.kt index 9378e0842f6f..f5a2ee3a87cf 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/ActivityNavigator.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/ActivityNavigator.kt @@ -49,7 +49,7 @@ class ActivityNavigator @Inject constructor() { fun navigateToCampaignDetailPage( context: Context, - campaignId: Int, + campaignId: String, campaignDetailPageSource: CampaignDetailPageSource ) { context.startActivity( diff --git a/WordPress/src/main/java/org/wordpress/android/ui/blaze/blazecampaigns/BlazeCampaignPage.kt b/WordPress/src/main/java/org/wordpress/android/ui/blaze/blazecampaigns/BlazeCampaignPage.kt index 58f41f95e207..bbd081cc570b 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/blaze/blazecampaigns/BlazeCampaignPage.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/blaze/blazecampaigns/BlazeCampaignPage.kt @@ -10,6 +10,6 @@ import org.wordpress.android.ui.blaze.blazecampaigns.campaignlisting.CampaignLis @SuppressLint("ParcelCreator") sealed class BlazeCampaignPage : Parcelable { data class CampaignListingPage(val source: CampaignListingPageSource) : BlazeCampaignPage() - data class CampaignDetailsPage(val campaignId: Int, val source: CampaignDetailPageSource) : BlazeCampaignPage() + data class CampaignDetailsPage(val campaignId: String, val source: CampaignDetailPageSource) : BlazeCampaignPage() object Done: BlazeCampaignPage() } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/blaze/blazecampaigns/campaigndetail/CampaignDetailFragment.kt b/WordPress/src/main/java/org/wordpress/android/ui/blaze/blazecampaigns/campaigndetail/CampaignDetailFragment.kt index de7cc0bf6afa..5e5a81df9e06 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/blaze/blazecampaigns/campaigndetail/CampaignDetailFragment.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/blaze/blazecampaigns/campaigndetail/CampaignDetailFragment.kt @@ -54,10 +54,10 @@ private const val CAMPAIGN_DETAIL_CAMPAIGN_ID = "campaign_detail_campaign_id" @AndroidEntryPoint class CampaignDetailFragment : Fragment(), CampaignDetailWebViewClient.CampaignDetailWebViewClientListener { companion object { - fun newInstance(campaignId: Int, source: CampaignDetailPageSource) = CampaignDetailFragment().apply { + fun newInstance(campaignId: String, source: CampaignDetailPageSource) = CampaignDetailFragment().apply { arguments = Bundle().apply { putSerializable(CAMPAIGN_DETAIL_PAGE_SOURCE, source) - putInt(CAMPAIGN_DETAIL_CAMPAIGN_ID, campaignId) + putString(CAMPAIGN_DETAIL_CAMPAIGN_ID, campaignId) } } } @@ -110,7 +110,7 @@ class CampaignDetailFragment : Fragment(), CampaignDetailWebViewClient.CampaignD ?: CampaignDetailPageSource.UNKNOWN } - private fun getCampaignId() = requireArguments().getInt(CAMPAIGN_DETAIL_CAMPAIGN_ID) + private fun getCampaignId() = requireArguments().getString(CAMPAIGN_DETAIL_CAMPAIGN_ID) ?: "" override fun onRedirectToExternalBrowser(url: String) = viewModel.onRedirectToExternalBrowser(url) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/blaze/blazecampaigns/campaigndetail/CampaignDetailViewModel.kt b/WordPress/src/main/java/org/wordpress/android/ui/blaze/blazecampaigns/campaigndetail/CampaignDetailViewModel.kt index a7230da28acc..b50e151d2a81 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/blaze/blazecampaigns/campaigndetail/CampaignDetailViewModel.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/blaze/blazecampaigns/campaigndetail/CampaignDetailViewModel.kt @@ -30,7 +30,7 @@ class CampaignDetailViewModel @Inject constructor( @Named(BG_THREAD) private val bgDispatcher: CoroutineDispatcher ) : ScopedViewModel(bgDispatcher) { private lateinit var pageSource: CampaignDetailPageSource - private var campaignId: Int = 0 + private var campaignId: String = "" private val _actionEvents = Channel(Channel.BUFFERED) val actionEvents = _actionEvents.receiveAsFlow() @@ -38,7 +38,7 @@ class CampaignDetailViewModel @Inject constructor( private val _uiState = MutableStateFlow(CampaignDetailUiState.Preparing) val uiState = _uiState as StateFlow - fun start(campaignId: Int, campaignDetailPageSource: CampaignDetailPageSource) { + fun start(campaignId: String, campaignDetailPageSource: CampaignDetailPageSource) { this.campaignId = campaignId this.pageSource = campaignDetailPageSource @@ -76,7 +76,7 @@ class CampaignDetailViewModel @Inject constructor( pathComponents = arrayOf( ADVERTISING_PATH, CAMPAIGNS_PATH, - campaignId.toString(), + campaignId, extractAndSanitizeSiteUrl() ), source = pageSource.trackingName diff --git a/WordPress/src/main/java/org/wordpress/android/ui/blaze/blazecampaigns/campaignlisting/CampaignListingViewModel.kt b/WordPress/src/main/java/org/wordpress/android/ui/blaze/blazecampaigns/campaignlisting/CampaignListingViewModel.kt index 2814101443a9..b92dbd672800 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/blaze/blazecampaigns/campaignlisting/CampaignListingViewModel.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/blaze/blazecampaigns/campaignlisting/CampaignListingViewModel.kt @@ -168,7 +168,7 @@ class CampaignListingViewModel @Inject constructor( } private fun onCampaignClicked(campaignModel: CampaignModel) { - _navigation.postValue(Event(CampaignListingNavigation.CampaignDetailPage(campaignModel.id.toInt()))) + _navigation.postValue(Event(CampaignListingNavigation.CampaignDetailPage(campaignModel.id))) } private fun showNoCampaigns() { @@ -223,7 +223,7 @@ enum class CampaignListingPageSource(val trackingName: String) { sealed class CampaignListingNavigation { data class CampaignDetailPage( - val campaignId: Int, + val campaignId: String, val campaignDetailPageSource: CampaignDetailPageSource = CampaignDetailPageSource.CAMPAIGN_LISTING_PAGE ) : CampaignListingNavigation() diff --git a/WordPress/src/main/java/org/wordpress/android/ui/mysite/BlazeCardViewModelSlice.kt b/WordPress/src/main/java/org/wordpress/android/ui/mysite/BlazeCardViewModelSlice.kt index 2686d691ecb7..8b118c4bd1e8 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/mysite/BlazeCardViewModelSlice.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/mysite/BlazeCardViewModelSlice.kt @@ -155,7 +155,7 @@ class BlazeCardViewModelSlice @Inject constructor( Event(SiteNavigationAction.OpenPromoteWithBlazeOverlay(source = BlazeFlowSource.DASHBOARD_CARD)) } - private fun onCampaignClick(campaignId: Int) { + private fun onCampaignClick(campaignId: String) { _onNavigation.value = Event(SiteNavigationAction.OpenCampaignDetailPage(campaignId, CampaignDetailPageSource.DASHBOARD_CARD)) } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/mysite/MySiteCardAndItem.kt b/WordPress/src/main/java/org/wordpress/android/ui/mysite/MySiteCardAndItem.kt index 9c5f226eda9c..60dfe33e0b65 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/mysite/MySiteCardAndItem.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/mysite/MySiteCardAndItem.kt @@ -326,12 +326,12 @@ sealed class MySiteCardAndItem(open val type: Type, open val activeQuickStartIte val moreMenuOptions: MoreMenuOptions ) : BlazeCard(type = Type.BLAZE_CAMPAIGNS_CARD) { data class BlazeCampaignsCardItem( - val id: Int, + val id: String, val title: UiString, val status: CampaignStatus?, val featuredImageUrl: String?, val stats: BlazeCampaignStats?, - val onClick: (campaignId: Int) -> Unit, + val onClick: (campaignId: String) -> Unit, ) { data class BlazeCampaignStats( val impressions: UiString, diff --git a/WordPress/src/main/java/org/wordpress/android/ui/mysite/MySiteCardAndItemBuilderParams.kt b/WordPress/src/main/java/org/wordpress/android/ui/mysite/MySiteCardAndItemBuilderParams.kt index f5b256074321..d84d8b574504 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/mysite/MySiteCardAndItemBuilderParams.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/mysite/MySiteCardAndItemBuilderParams.kt @@ -188,7 +188,7 @@ sealed class MySiteCardAndItemBuilderParams { data class CampaignWithBlazeCardBuilderParams( val campaign: BlazeCampaignModel, val onCreateCampaignClick: () -> Unit, - val onCampaignClick: (campaignId: Int) -> Unit, + val onCampaignClick: (campaignId: String) -> Unit, val onCardClick: () -> Unit, val moreMenuParams: MoreMenuParams ) : BlazeCardBuilderParams() { diff --git a/WordPress/src/main/java/org/wordpress/android/ui/mysite/SiteNavigationAction.kt b/WordPress/src/main/java/org/wordpress/android/ui/mysite/SiteNavigationAction.kt index 95fe3002cd46..ecb3f0463855 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/mysite/SiteNavigationAction.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/mysite/SiteNavigationAction.kt @@ -104,7 +104,7 @@ sealed class SiteNavigationAction { data class OpenCampaignListingPage(val campaignListingPageSource: CampaignListingPageSource) : SiteNavigationAction() - data class OpenCampaignDetailPage(val campaignId: Int, val campaignDetailPageSource: CampaignDetailPageSource) : + data class OpenCampaignDetailPage(val campaignId: String, val campaignDetailPageSource: CampaignDetailPageSource) : SiteNavigationAction() object OpenDashboardPersonalization : SiteNavigationAction() diff --git a/WordPress/src/test/java/org/wordpress/android/ui/blaze/blazecampaigns/campaignlisting/FetchCampaignListUseCaseTest.kt b/WordPress/src/test/java/org/wordpress/android/ui/blaze/blazecampaigns/campaignlisting/FetchCampaignListUseCaseTest.kt index 00761af312e8..c905cffebcdd 100644 --- a/WordPress/src/test/java/org/wordpress/android/ui/blaze/blazecampaigns/campaignlisting/FetchCampaignListUseCaseTest.kt +++ b/WordPress/src/test/java/org/wordpress/android/ui/blaze/blazecampaigns/campaignlisting/FetchCampaignListUseCaseTest.kt @@ -46,7 +46,7 @@ class FetchCampaignListUseCaseTest: BaseUnitTest() { val actualResult = fetchCampaignListUseCase.execute(siteModel, page) assertThat(actualResult is Result.Failure).isTrue - assertThat((actualResult as Result.Failure).value).isEqualTo(GenericError) + assertThat((actualResult as Result.Failure).value).isEqualTo(GenericResult) } @Test diff --git a/WordPress/src/test/java/org/wordpress/android/ui/mysite/cards/dashboard/blaze/BlazeCardSourceTest.kt b/WordPress/src/test/java/org/wordpress/android/ui/mysite/cards/dashboard/blaze/BlazeCardSourceTest.kt index 333953be63d7..964ec64f5a3c 100644 --- a/WordPress/src/test/java/org/wordpress/android/ui/mysite/cards/dashboard/blaze/BlazeCardSourceTest.kt +++ b/WordPress/src/test/java/org/wordpress/android/ui/mysite/cards/dashboard/blaze/BlazeCardSourceTest.kt @@ -16,7 +16,7 @@ import org.wordpress.android.fluxc.model.SiteModel import org.wordpress.android.fluxc.model.blaze.BlazeCampaignModel import org.wordpress.android.ui.blaze.BlazeFeatureUtils import org.wordpress.android.ui.blaze.blazecampaigns.campaignlisting.FetchCampaignListUseCase -import org.wordpress.android.ui.blaze.blazecampaigns.campaignlisting.GenericError +import org.wordpress.android.ui.blaze.blazecampaigns.campaignlisting.GenericResult import org.wordpress.android.ui.mysite.MySiteUiState.PartialState.BlazeCardUpdate import org.wordpress.android.ui.mysite.SelectedSiteRepository import org.wordpress.android.ui.mysite.cards.blaze.BlazeCardSource @@ -155,7 +155,7 @@ class BlazeCardSourceTest : BaseUnitTest() { val result = mutableListOf() whenever(blazeFeatureUtils.shouldShowBlazeCampaigns()).thenReturn(true) whenever(networkUtilsWrapper.isNetworkAvailable()).thenReturn(true) - whenever(fetchCampaignListUseCase.execute(siteModel,offset = 0)).thenReturn(Result.Failure(GenericError)) + whenever(fetchCampaignListUseCase.execute(siteModel,offset = 0)).thenReturn(Result.Failure(GenericResult)) blazeCardSource.build(testScope(), SITE_LOCAL_ID) .observeForever { it?.let { result.add(it) } } From 0f13a1075f11b34d1febf16ca2819f877287aaf3 Mon Sep 17 00:00:00 2001 From: jorgemucientesfayos Date: Mon, 4 Mar 2024 12:44:17 +0100 Subject: [PATCH 09/19] Update FluxC changeset --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 0df46f87e2ee..3ff3caf8ab9b 100644 --- a/build.gradle +++ b/build.gradle @@ -25,7 +25,7 @@ ext { automatticTracksVersion = '3.4.0' gutenbergMobileVersion = 'v1.114.0' wordPressAztecVersion = 'v2.0' - wordPressFluxCVersion = '2963-148343ac68c8ec51b7d0c1d7f11166ee02ecaeda' + wordPressFluxCVersion = '2963-10a3516429ac8c0c41863e25270c6073431c6cad' wordPressLoginVersion = '1.14.0' wordPressPersistentEditTextVersion = '1.0.2' wordPressUtilsVersion = '3.13.0' From 7260e9e1f49515e06589cc81d22c9ca8db109f27 Mon Sep 17 00:00:00 2001 From: jorgemucientesfayos Date: Mon, 4 Mar 2024 17:29:32 +0100 Subject: [PATCH 10/19] Update campaign statuses to match new endpoint values --- .../android/ui/mysite/cards/blaze/CampaignStatus.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/mysite/cards/blaze/CampaignStatus.kt b/WordPress/src/main/java/org/wordpress/android/ui/mysite/cards/blaze/CampaignStatus.kt index b5f3cca85278..651a877063ba 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/mysite/cards/blaze/CampaignStatus.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/mysite/cards/blaze/CampaignStatus.kt @@ -8,12 +8,12 @@ import org.wordpress.android.util.AppLog @Suppress("MagicNumber") enum class CampaignStatus(val status: String, @StringRes val stringResource: Int) { + InModeration("pending", R.string.campaign_status_in_moderation), + Scheduled("scheduled", R.string.campaign_status_scheduled), Active("active", R.string.campaign_status_active), - Completed("finished", R.string.campaign_status_completed), Rejected("rejected", R.string.campaign_status_rejected), Canceled("canceled", R.string.campaign_status_canceled), - Scheduled("scheduled", R.string.campaign_status_scheduled), - InModeration("created", R.string.campaign_status_in_moderation); + Completed("finished", R.string.campaign_status_completed); companion object { fun fromString(status: String): CampaignStatus? { From 28be551dd4af791905e57e50c18013fbcaca56ef Mon Sep 17 00:00:00 2001 From: jorgemucientesfayos Date: Tue, 5 Mar 2024 17:05:15 +0100 Subject: [PATCH 11/19] Fix unit tests compile issues after changing BlazeCampaignModel --- .../CampaignDetailViewModelTest.kt | 12 ++++----- .../CampaignListingViewModelTest.kt | 4 +-- .../CampaignListingUIModelMapperTest.kt | 26 ++++++++++--------- .../dashboard/blaze/BlazeCardBuilderTest.kt | 11 ++++---- 4 files changed, 28 insertions(+), 25 deletions(-) diff --git a/WordPress/src/test/java/org/wordpress/android/ui/blaze/blazecampaigns/CampaignDetailViewModelTest.kt b/WordPress/src/test/java/org/wordpress/android/ui/blaze/blazecampaigns/CampaignDetailViewModelTest.kt index c36097d3e3c7..bdf50491b4b4 100644 --- a/WordPress/src/test/java/org/wordpress/android/ui/blaze/blazecampaigns/CampaignDetailViewModelTest.kt +++ b/WordPress/src/test/java/org/wordpress/android/ui/blaze/blazecampaigns/CampaignDetailViewModelTest.kt @@ -77,7 +77,7 @@ class CampaignDetailViewModelTest : BaseUnitTest() { } @Test fun `given valid campaignId and pageSource, when start is called, then trackCampaignDetailsOpened is called`() { - viewModel.start(1, CampaignDetailPageSource.DASHBOARD_CARD) + viewModel.start(campaignId = "1", CampaignDetailPageSource.DASHBOARD_CARD) verify(blazeFeatureUtils).trackCampaignDetailsOpened(any()) } @@ -89,7 +89,7 @@ class CampaignDetailViewModelTest : BaseUnitTest() { val uiState = mutableListOf() val actionEvents = mutableListOf() testWithData(actionEvents, uiState) { - viewModel.start(1, CampaignDetailPageSource.DASHBOARD_CARD) + viewModel.start(campaignId = "1", CampaignDetailPageSource.DASHBOARD_CARD) assertThat(uiState.last()).isInstanceOf(CampaignDetailUiState.GenericError::class.java) } @@ -102,7 +102,7 @@ class CampaignDetailViewModelTest : BaseUnitTest() { val uiState = mutableListOf() val actionEvents = mutableListOf() testWithData(actionEvents, uiState) { - viewModel.start(1, CampaignDetailPageSource.DASHBOARD_CARD) + viewModel.start(campaignId = "1", CampaignDetailPageSource.DASHBOARD_CARD) assertThat(uiState.last()).isInstanceOf(CampaignDetailUiState.GenericError::class.java) } @@ -122,7 +122,7 @@ class CampaignDetailViewModelTest : BaseUnitTest() { val uiStates = mutableListOf() val actionEvents = mutableListOf() testWithData(actionEvents, uiStates) { - viewModel.start(1, CampaignDetailPageSource.DASHBOARD_CARD) + viewModel.start(campaignId = "1", CampaignDetailPageSource.DASHBOARD_CARD) assertThat(uiStates.last()).isInstanceOf(CampaignDetailUiState.Prepared::class.java) } @@ -135,7 +135,7 @@ class CampaignDetailViewModelTest : BaseUnitTest() { val uiStates = mutableListOf() val actionEvents = mutableListOf() testWithData(actionEvents, uiStates) { - viewModel.start(1, CampaignDetailPageSource.DASHBOARD_CARD) + viewModel.start(campaignId = "1", CampaignDetailPageSource.DASHBOARD_CARD) assertThat(uiStates.first()).isInstanceOf(CampaignDetailUiState.Preparing::class.java) } @@ -177,7 +177,7 @@ class CampaignDetailViewModelTest : BaseUnitTest() { whenever(networkUtilsWrapper.isNetworkAvailable()).thenReturn(false) testWithData(actionEvents, uiStates) { - viewModel.start(1, CampaignDetailPageSource.DASHBOARD_CARD) + viewModel.start(campaignId = "1", CampaignDetailPageSource.DASHBOARD_CARD) val uiState = uiStates.last() assertThat(uiState).isInstanceOf(CampaignDetailUiState.NoNetworkError::class.java) diff --git a/WordPress/src/test/java/org/wordpress/android/ui/blaze/blazecampaigns/CampaignListingViewModelTest.kt b/WordPress/src/test/java/org/wordpress/android/ui/blaze/blazecampaigns/CampaignListingViewModelTest.kt index 2ea7fa488f1c..7b191cad43c4 100644 --- a/WordPress/src/test/java/org/wordpress/android/ui/blaze/blazecampaigns/CampaignListingViewModelTest.kt +++ b/WordPress/src/test/java/org/wordpress/android/ui/blaze/blazecampaigns/CampaignListingViewModelTest.kt @@ -114,7 +114,7 @@ class CampaignListingViewModelTest : BaseUnitTest() { @Test fun `given no campaigns in db + api, when viewmodel start, then should show no campaigns error`() = runTest { - val noCampaigns: Result> = Result.Failure(NoCampaigns) + val noCampaigns = Result.Failure(NoCampaigns) whenever(networkUtilsWrapper.isNetworkAvailable()).thenReturn(true) whenever(selectedSiteRepository.getSelectedSite()).thenReturn(siteModel) whenever(getCampaignListFromDbUseCase.execute(siteModel)).thenReturn(noCampaigns) @@ -129,7 +129,7 @@ class CampaignListingViewModelTest : BaseUnitTest() { @Test fun `given no campaigns in db + api, when click is invoked on create, then navigate to blaze flow`() = runTest { - val noCampaigns: Result> = Result.Failure(NoCampaigns) + val noCampaigns = Result.Failure(NoCampaigns) whenever(networkUtilsWrapper.isNetworkAvailable()).thenReturn(true) whenever(getCampaignListFromDbUseCase.execute(siteModel)).thenReturn(noCampaigns) whenever(fetchCampaignListUseCase.execute(siteModel, offset = 0)).thenReturn(noCampaigns) diff --git a/WordPress/src/test/java/org/wordpress/android/ui/blaze/blazecampaigns/campaignlisting/CampaignListingUIModelMapperTest.kt b/WordPress/src/test/java/org/wordpress/android/ui/blaze/blazecampaigns/campaignlisting/CampaignListingUIModelMapperTest.kt index 67a3718fd0b0..821d321bbcd0 100644 --- a/WordPress/src/test/java/org/wordpress/android/ui/blaze/blazecampaigns/campaignlisting/CampaignListingUIModelMapperTest.kt +++ b/WordPress/src/test/java/org/wordpress/android/ui/blaze/blazecampaigns/campaignlisting/CampaignListingUIModelMapperTest.kt @@ -30,16 +30,17 @@ class CampaignListingUIModelMapperTest : BaseUnitTest() { } private val activeCampaign = BlazeCampaignModel( - campaignId = 1, + campaignId = "1", title = "title", - uiStatus = "active", imageUrl = "imageUrl", - impressions = 1L, - clicks = 1L, - budgetCents = 100, - createdAt = mock(), - endDate = mock(), + startTime = mock(), + durationInDays = 1, + uiStatus = "active", + impressions = 1, + clicks = 1, targetUrn = null, + totalBudget = 0.0, + spentBudget = 0.0, ) @Test @@ -59,16 +60,17 @@ class CampaignListingUIModelMapperTest : BaseUnitTest() { } private val inActiveCampaign = BlazeCampaignModel( - campaignId = 1, + campaignId = "1", title = "title", - uiStatus = "canceled", imageUrl = "imageUrl", + startTime = mock(), + durationInDays = 1, + uiStatus = "canceled", impressions = 0, clicks = 0, - budgetCents = 100, - createdAt = mock(), - endDate = mock(), targetUrn = null, + totalBudget = 0.0, + spentBudget = 0.0, ) @Test diff --git a/WordPress/src/test/java/org/wordpress/android/ui/mysite/cards/dashboard/blaze/BlazeCardBuilderTest.kt b/WordPress/src/test/java/org/wordpress/android/ui/mysite/cards/dashboard/blaze/BlazeCardBuilderTest.kt index 5a3a24657ec1..9d13daeb6516 100644 --- a/WordPress/src/test/java/org/wordpress/android/ui/mysite/cards/dashboard/blaze/BlazeCardBuilderTest.kt +++ b/WordPress/src/test/java/org/wordpress/android/ui/mysite/cards/dashboard/blaze/BlazeCardBuilderTest.kt @@ -24,16 +24,17 @@ import org.wordpress.android.ui.utils.ListItemInteraction import org.wordpress.android.ui.utils.UiString val campaign = BlazeCampaignModel( - campaignId = 1, + campaignId = "1234", title = "title", imageUrl = "imageUrl", - createdAt = mock(), - endDate = mock(), + startTime = mock(), + durationInDays = 1, uiStatus = "active", - budgetCents = 20L, impressions = 1, clicks = 1, targetUrn = null, + totalBudget = 0.0, + spentBudget = 0.0, ) val onCreateCampaignClick = { } @@ -44,7 +45,7 @@ val onMoreMenuClick = { } val onLearnMoreItemClick = { } val viewAllCampaignsClick = { } -private var onCampaignClick: ((campaignId: Int) -> Unit) = { } +private var onCampaignClick: ((campaignId: String) -> Unit) = { } val campaignWithBlazeBuilderParams = CampaignWithBlazeCardBuilderParams( campaign = campaign, onCardClick = onCardClick, From a92438644456b18d94edd13b891e06ee32d92a93 Mon Sep 17 00:00:00 2001 From: jorgemucientesfayos Date: Tue, 5 Mar 2024 18:14:43 +0100 Subject: [PATCH 12/19] Use campaign list directly when fetching cached campaigns --- .../blazecampaigns/campaignlisting/CampaignListUseCases.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/blaze/blazecampaigns/campaignlisting/CampaignListUseCases.kt b/WordPress/src/main/java/org/wordpress/android/ui/blaze/blazecampaigns/campaignlisting/CampaignListUseCases.kt index b70f24f2008e..bc5502271a59 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/blaze/blazecampaigns/campaignlisting/CampaignListUseCases.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/blaze/blazecampaigns/campaignlisting/CampaignListUseCases.kt @@ -37,9 +37,9 @@ class GetCampaignListFromDbUseCase @Inject constructor( private val mapper: CampaignListingUIModelMapper ) { suspend fun execute(site: SiteModel): Result> { - val result = store.getBlazeCampaigns(site) - if (result.campaigns.isEmpty()) return Result.Failure(NoCampaigns) - return Result.Success(mapper.mapToCampaignModels(result.campaigns)) + val campaigns = store.getBlazeCampaigns(site) + if (campaigns.isEmpty()) return Result.Failure(NoCampaigns) + return Result.Success(mapper.mapToCampaignModels(campaigns)) } } From a9043bf093dc3e4372937eb84b77673ef22dc88a Mon Sep 17 00:00:00 2001 From: jorgemucientesfayos Date: Tue, 5 Mar 2024 18:22:00 +0100 Subject: [PATCH 13/19] Fix unit tests compile issues --- .../campaignlisting/GetCampaignListFromDbUseCaseTest.kt | 6 ++---- .../android/ui/mysite/BlazeCardViewModelSliceTest.kt | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/WordPress/src/test/java/org/wordpress/android/ui/blaze/blazecampaigns/campaignlisting/GetCampaignListFromDbUseCaseTest.kt b/WordPress/src/test/java/org/wordpress/android/ui/blaze/blazecampaigns/campaignlisting/GetCampaignListFromDbUseCaseTest.kt index fba85dfa6ea2..2fcbbab635a4 100644 --- a/WordPress/src/test/java/org/wordpress/android/ui/blaze/blazecampaigns/campaignlisting/GetCampaignListFromDbUseCaseTest.kt +++ b/WordPress/src/test/java/org/wordpress/android/ui/blaze/blazecampaigns/campaignlisting/GetCampaignListFromDbUseCaseTest.kt @@ -36,9 +36,7 @@ class GetCampaignListFromDbUseCaseTest: BaseUnitTest() { @Test fun `given store returns empty campaigns, when usecase execute, returns no campaigns error`() = runTest { val siteModel = mock() - whenever(store.getBlazeCampaigns(siteModel)).thenReturn( - BlazeCampaignsModel(emptyList(), 1, 0, 1) - ) + whenever(store.getBlazeCampaigns(siteModel)).thenReturn(emptyList()) val actualResult = getCampaignListFromDbUseCase.execute(siteModel) @@ -49,7 +47,7 @@ class GetCampaignListFromDbUseCaseTest: BaseUnitTest() { @Test fun `given store returns campaigns, when usecase execute, returns campaigns `() = runTest { val siteModel = mock() - whenever(store.getBlazeCampaigns(siteModel)).thenReturn(BlazeCampaignsModel(mock(),1,0,1)) + whenever(store.getBlazeCampaigns(siteModel)).thenReturn(mock()) whenever(mapper.mapToCampaignModels(any())).thenReturn(mock()) val actualResult = getCampaignListFromDbUseCase.execute(siteModel) diff --git a/WordPress/src/test/java/org/wordpress/android/ui/mysite/BlazeCardViewModelSliceTest.kt b/WordPress/src/test/java/org/wordpress/android/ui/mysite/BlazeCardViewModelSliceTest.kt index 99cac4cd4914..f6a9f5e3b71a 100644 --- a/WordPress/src/test/java/org/wordpress/android/ui/mysite/BlazeCardViewModelSliceTest.kt +++ b/WordPress/src/test/java/org/wordpress/android/ui/mysite/BlazeCardViewModelSliceTest.kt @@ -39,7 +39,7 @@ class BlazeCardViewModelSliceTest : BaseUnitTest() { private lateinit var refreshActions: MutableList - private val campaignId = 1 + private val campaignId = "1" @Before fun setup() { From 77f58c59b2aca26c2af7409bad6b73ea2225ac54 Mon Sep 17 00:00:00 2001 From: jorgemucientesfayos Date: Tue, 5 Mar 2024 18:23:26 +0100 Subject: [PATCH 14/19] Update FluxC changeset --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 3ff3caf8ab9b..8f240820f88f 100644 --- a/build.gradle +++ b/build.gradle @@ -25,7 +25,7 @@ ext { automatticTracksVersion = '3.4.0' gutenbergMobileVersion = 'v1.114.0' wordPressAztecVersion = 'v2.0' - wordPressFluxCVersion = '2963-10a3516429ac8c0c41863e25270c6073431c6cad' + wordPressFluxCVersion = '2963-f0a572e82e5349b71b676609d232783a9e88c72f' wordPressLoginVersion = '1.14.0' wordPressPersistentEditTextVersion = '1.0.2' wordPressUtilsVersion = '3.13.0' From 2a3c4bf13c676e913245113b58e280c496da6c77 Mon Sep 17 00:00:00 2001 From: jorgemucientesfayos Date: Tue, 5 Mar 2024 18:31:20 +0100 Subject: [PATCH 15/19] Update FluxC changeset --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 8f240820f88f..cab676a49c91 100644 --- a/build.gradle +++ b/build.gradle @@ -25,7 +25,7 @@ ext { automatticTracksVersion = '3.4.0' gutenbergMobileVersion = 'v1.114.0' wordPressAztecVersion = 'v2.0' - wordPressFluxCVersion = '2963-f0a572e82e5349b71b676609d232783a9e88c72f' + wordPressFluxCVersion = '2963-fdd983e141cff910d95b242118eafd6700f72d57' wordPressLoginVersion = '1.14.0' wordPressPersistentEditTextVersion = '1.0.2' wordPressUtilsVersion = '3.13.0' From 7252c185170edb7acbccef44576a90f948410831 Mon Sep 17 00:00:00 2001 From: jorgemucientesfayos Date: Wed, 6 Mar 2024 08:24:50 +0100 Subject: [PATCH 16/19] Fix detekt --- .../campaignlisting/GetCampaignListFromDbUseCaseTest.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/WordPress/src/test/java/org/wordpress/android/ui/blaze/blazecampaigns/campaignlisting/GetCampaignListFromDbUseCaseTest.kt b/WordPress/src/test/java/org/wordpress/android/ui/blaze/blazecampaigns/campaignlisting/GetCampaignListFromDbUseCaseTest.kt index 2fcbbab635a4..35b77997ae84 100644 --- a/WordPress/src/test/java/org/wordpress/android/ui/blaze/blazecampaigns/campaignlisting/GetCampaignListFromDbUseCaseTest.kt +++ b/WordPress/src/test/java/org/wordpress/android/ui/blaze/blazecampaigns/campaignlisting/GetCampaignListFromDbUseCaseTest.kt @@ -14,7 +14,6 @@ import org.mockito.kotlin.whenever import org.wordpress.android.BaseUnitTest import org.wordpress.android.Result import org.wordpress.android.fluxc.model.SiteModel -import org.wordpress.android.fluxc.model.blaze.BlazeCampaignsModel import org.wordpress.android.fluxc.store.blaze.BlazeCampaignsStore @ExperimentalCoroutinesApi From 10d4ad84d34b04672543b662bbd4b01477fea52b Mon Sep 17 00:00:00 2001 From: jorgemucientesfayos Date: Wed, 6 Mar 2024 08:37:14 +0100 Subject: [PATCH 17/19] Fix FetchCampaignListUseCaseTest --- .../FetchCampaignListUseCaseTest.kt | 36 +++++++++++-------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/WordPress/src/test/java/org/wordpress/android/ui/blaze/blazecampaigns/campaignlisting/FetchCampaignListUseCaseTest.kt b/WordPress/src/test/java/org/wordpress/android/ui/blaze/blazecampaigns/campaignlisting/FetchCampaignListUseCaseTest.kt index c905cffebcdd..11c8164ba162 100644 --- a/WordPress/src/test/java/org/wordpress/android/ui/blaze/blazecampaigns/campaignlisting/FetchCampaignListUseCaseTest.kt +++ b/WordPress/src/test/java/org/wordpress/android/ui/blaze/blazecampaigns/campaignlisting/FetchCampaignListUseCaseTest.kt @@ -21,7 +21,7 @@ import org.wordpress.android.fluxc.store.blaze.BlazeCampaignsStore @ExperimentalCoroutinesApi @RunWith(MockitoJUnitRunner::class) -class FetchCampaignListUseCaseTest: BaseUnitTest() { +class FetchCampaignListUseCaseTest : BaseUnitTest() { @Mock lateinit var store: BlazeCampaignsStore @@ -38,12 +38,12 @@ class FetchCampaignListUseCaseTest: BaseUnitTest() { @Test fun `given store returns error, when usecase execute, returns generic error`() = runTest { val siteModel = mock() - val page = 1 - whenever(store.fetchBlazeCampaigns(siteModel, page)).thenReturn( + val offset = 0 + whenever(store.fetchBlazeCampaigns(siteModel, offset, PER_PAGE)).thenReturn( BlazeCampaignsStore.BlazeCampaignsResult(BlazeCampaignsError(BlazeCampaignsErrorType.INVALID_RESPONSE)) ) - val actualResult = fetchCampaignListUseCase.execute(siteModel, page) + val actualResult = fetchCampaignListUseCase.execute(siteModel, offset) assertThat(actualResult is Result.Failure).isTrue assertThat((actualResult as Result.Failure).value).isEqualTo(GenericResult) @@ -52,12 +52,14 @@ class FetchCampaignListUseCaseTest: BaseUnitTest() { @Test fun `given store returns empty campaigns, when usecase execute, returns no campaigns error`() = runTest { val siteModel = mock() - val page = 1 - whenever(store.fetchBlazeCampaigns(siteModel, page)).thenReturn(BlazeCampaignsStore.BlazeCampaignsResult( - BlazeCampaignsModel(campaigns = emptyList(), skipped = 0, totalItems = 1,) - )) + val offset = 0 + whenever(store.fetchBlazeCampaigns(siteModel, offset, PER_PAGE)).thenReturn( + BlazeCampaignsStore.BlazeCampaignsResult( + BlazeCampaignsModel(campaigns = emptyList(), skipped = 0, totalItems = 1) + ) + ) - val actualResult = fetchCampaignListUseCase.execute(siteModel, page) + val actualResult = fetchCampaignListUseCase.execute(siteModel, offset) assertThat(actualResult is Result.Failure).isTrue assertThat((actualResult as Result.Failure).value).isEqualTo(NoCampaigns) @@ -66,14 +68,20 @@ class FetchCampaignListUseCaseTest: BaseUnitTest() { @Test fun `given store returns campaigns, when usecase execute, returns campaigns`() = runTest { val siteModel = mock() - val page = 1 - whenever(store.fetchBlazeCampaigns(siteModel, page)).thenReturn(BlazeCampaignsStore.BlazeCampaignsResult( - BlazeCampaignsModel(campaigns = emptyList(), skipped = 0, totalItems = 1,) - )) + val offset = 0 + whenever(store.fetchBlazeCampaigns(siteModel, offset, PER_PAGE)).thenReturn( + BlazeCampaignsStore.BlazeCampaignsResult( + BlazeCampaignsModel(campaigns = mock(), skipped = 0, totalItems = 1) + ) + ) whenever(mapper.mapToCampaignModels(any())).thenReturn(mock()) - val actualResult = fetchCampaignListUseCase.execute(siteModel, page) + val actualResult = fetchCampaignListUseCase.execute(siteModel, offset) assertThat(actualResult is Result.Success).isTrue } + + companion object { + const val PER_PAGE = 10 + } } From 3f9edb3960d0f176ef2182142da861e3585bdf6a Mon Sep 17 00:00:00 2001 From: jorgemucientesfayos Date: Wed, 6 Mar 2024 09:18:43 +0100 Subject: [PATCH 18/19] Fix CampaignListingUIModelMapperTest --- .../campaignlisting/CampaignListingUIModelMapperTest.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WordPress/src/test/java/org/wordpress/android/ui/blaze/blazecampaigns/campaignlisting/CampaignListingUIModelMapperTest.kt b/WordPress/src/test/java/org/wordpress/android/ui/blaze/blazecampaigns/campaignlisting/CampaignListingUIModelMapperTest.kt index 821d321bbcd0..50abe4e137ee 100644 --- a/WordPress/src/test/java/org/wordpress/android/ui/blaze/blazecampaigns/campaignlisting/CampaignListingUIModelMapperTest.kt +++ b/WordPress/src/test/java/org/wordpress/android/ui/blaze/blazecampaigns/campaignlisting/CampaignListingUIModelMapperTest.kt @@ -39,7 +39,7 @@ class CampaignListingUIModelMapperTest : BaseUnitTest() { impressions = 1, clicks = 1, targetUrn = null, - totalBudget = 0.0, + totalBudget = 1.0, spentBudget = 0.0, ) From cfe878b1b2fd98da62bd22cefc9f56105d2f5d84 Mon Sep 17 00:00:00 2001 From: jorgemucientesfayos Date: Fri, 8 Mar 2024 09:21:24 +0100 Subject: [PATCH 19/19] Update FluxC changeset to latest trunk --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 7a986807979f..a2ee25248f60 100644 --- a/build.gradle +++ b/build.gradle @@ -24,7 +24,7 @@ ext { automatticTracksVersion = '3.4.0' gutenbergMobileVersion = 'v1.115.0-alpha3' wordPressAztecVersion = 'v2.0' - wordPressFluxCVersion = 'trunk-ae15f6b0b21c0ee9e0f97741ea2e16545358eac3' + wordPressFluxCVersion = 'trunk-b9ecc708dde74d6cc95aeab42e56fb8067640039' wordPressLoginVersion = '1.14.1' wordPressPersistentEditTextVersion = '1.0.2' wordPressUtilsVersion = '3.13.0'