Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Home Page Picker] Mark Theme Selection as Completed as part of the Site Creation Flow #13502

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import org.greenrobot.eventbus.Subscribe
import org.greenrobot.eventbus.ThreadMode
import org.wordpress.android.R
import org.wordpress.android.fluxc.Dispatcher
import org.wordpress.android.fluxc.store.QuickStartStore
import org.wordpress.android.fluxc.store.QuickStartStore.QuickStartTask.CHOOSE_THEME
import org.wordpress.android.fluxc.store.SiteStore
import org.wordpress.android.modules.BG_THREAD
import org.wordpress.android.modules.UI_THREAD
Expand All @@ -35,6 +37,7 @@ import org.wordpress.android.ui.sitecreation.services.SiteCreationServiceState.S
import org.wordpress.android.ui.sitecreation.services.SiteCreationServiceState.SiteCreationStep.FAILURE
import org.wordpress.android.ui.sitecreation.services.SiteCreationServiceState.SiteCreationStep.IDLE
import org.wordpress.android.ui.sitecreation.services.SiteCreationServiceState.SiteCreationStep.SUCCESS
import org.wordpress.android.ui.sitecreation.theme.defaultTemplateSlug
import org.wordpress.android.ui.sitecreation.usecases.isWordPressComSubDomain
import org.wordpress.android.ui.utils.UiString
import org.wordpress.android.ui.utils.UiString.UiStringRes
Expand Down Expand Up @@ -62,6 +65,7 @@ private val loadingTexts = listOf(
class SitePreviewViewModel @Inject constructor(
private val dispatcher: Dispatcher,
private val siteStore: SiteStore,
private val quickStartStore: QuickStartStore,
private val fetchWpComSiteUseCase: FetchWpComSiteUseCase,
private val networkUtils: NetworkUtilsWrapper,
private val urlUtils: UrlUtilsWrapper,
Expand Down Expand Up @@ -216,6 +220,8 @@ class SitePreviewViewModel @Inject constructor(
val siteBySiteId = requireNotNull(siteStore.getSiteBySiteId(remoteSiteId)) {
"Site successfully fetched but has not been found in the local db."
}
val userHasSelectedDesign = siteCreationState.siteDesign != defaultTemplateSlug
quickStartStore.setDoneTask(siteBySiteId.id.toLong(), CHOOSE_THEME, userHasSelectedDesign)
CreateSiteState.SiteCreationCompleted(siteBySiteId.id)
} else {
SiteNotInLocalDb(remoteSiteId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import org.mockito.Mock
import org.mockito.junit.MockitoJUnitRunner
import org.wordpress.android.fluxc.Dispatcher
import org.wordpress.android.fluxc.model.SiteModel
import org.wordpress.android.fluxc.store.QuickStartStore
import org.wordpress.android.fluxc.store.SiteStore
import org.wordpress.android.fluxc.store.SiteStore.OnSiteChanged
import org.wordpress.android.fluxc.store.SiteStore.SiteError
Expand Down Expand Up @@ -60,6 +61,7 @@ class SitePreviewViewModelTest {

@Mock private lateinit var dispatcher: Dispatcher
@Mock private lateinit var siteStore: SiteStore
@Mock private lateinit var quickStartStore: QuickStartStore
@Mock private lateinit var fetchWpComUseCase: FetchWpComSiteUseCase
@Mock private lateinit var networkUtils: NetworkUtilsWrapper
@Mock private lateinit var urlUtils: UrlUtilsWrapper
Expand All @@ -80,6 +82,7 @@ class SitePreviewViewModelTest {
viewModel = SitePreviewViewModel(
dispatcher,
siteStore,
quickStartStore,
fetchWpComUseCase,
networkUtils,
urlUtils,
Expand Down