diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt index cbbf110dcde..902dd14890f 100644 --- a/RELEASE-NOTES.txt +++ b/RELEASE-NOTES.txt @@ -11,6 +11,7 @@ - [*] Fixed incorrect instructions on "What is Tap to Pay" screen in the Payments section [https://github.com/woocommerce/woocommerce-android/pull/12709] - [***] Merchants can now view and edit custom fields of their products and orders from the app [https://github.com/woocommerce/woocommerce-android/issues/12207] - [*] Fix size of the whats new announcement dialog [https://github.com/woocommerce/woocommerce-android/pull/12692] +- [*] Enables Blaze survey [https://github.com/woocommerce/woocommerce-android/pull/12761] 20.6 ----- diff --git a/WooCommerce/src/main/kotlin/com/woocommerce/android/AppUrls.kt b/WooCommerce/src/main/kotlin/com/woocommerce/android/AppUrls.kt index 12eb82081dc..224a9effb7f 100644 --- a/WooCommerce/src/main/kotlin/com/woocommerce/android/AppUrls.kt +++ b/WooCommerce/src/main/kotlin/com/woocommerce/android/AppUrls.kt @@ -143,4 +143,7 @@ object AppUrls { const val GOOGLE_ADMIN_DASHBOARD = "admin.php?page=wc-admin&path=%2Fgoogle%2Fdashboard" + + const val BLAZE_CAMPAIGN_CREATION_SURVEY_URL_I1 = + "https://wordpressdotcom.survey.fm/blaze-on-woo-mobile-survey-sept-2024-i1" } diff --git a/WooCommerce/src/main/kotlin/com/woocommerce/android/analytics/AnalyticsEvent.kt b/WooCommerce/src/main/kotlin/com/woocommerce/android/analytics/AnalyticsEvent.kt index 0867dde4c7c..797df1e45c6 100644 --- a/WooCommerce/src/main/kotlin/com/woocommerce/android/analytics/AnalyticsEvent.kt +++ b/WooCommerce/src/main/kotlin/com/woocommerce/android/analytics/AnalyticsEvent.kt @@ -1030,6 +1030,7 @@ enum class AnalyticsEvent(override val siteless: Boolean = false) : IAnalyticsEv BLAZE_CREATION_EDIT_INTEREST_SAVE_TAPPED, BLAZE_CREATION_EDIT_LOCATION_SAVE_TAPPED, BLAZE_CREATION_EDIT_DESTINATION_SAVE_TAPPED, + BLAZE_CAMPAIGN_CREATION_FEEDBACK, // Hazmat Shipping Declaration CONTAINS_HAZMAT_CHECKED, diff --git a/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/blaze/BlazeRepository.kt b/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/blaze/BlazeRepository.kt index e1f4b3f3064..d6852a5523c 100644 --- a/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/blaze/BlazeRepository.kt +++ b/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/blaze/BlazeRepository.kt @@ -322,7 +322,7 @@ class BlazeRepository @Inject constructor( ) }, isEndlessCampaign = campaignDetails.budget.isEndlessCampaign, - objectiveId = campaignDetails.objectiveId + objectiveId = if (FeatureFlag.OBJECTIVE_SECTION.isEnabled()) campaignDetails.objectiveId else null ) ) diff --git a/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/blaze/creation/success/BlazeCampaignSuccessBottomSheet.kt b/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/blaze/creation/success/BlazeCampaignSuccessBottomSheet.kt index 7c28e360b0d..877d5608794 100644 --- a/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/blaze/creation/success/BlazeCampaignSuccessBottomSheet.kt +++ b/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/blaze/creation/success/BlazeCampaignSuccessBottomSheet.kt @@ -11,6 +11,11 @@ import androidx.compose.material.MaterialTheme import androidx.compose.material.Surface import androidx.compose.material.Text import androidx.compose.runtime.Composable +import androidx.compose.runtime.LaunchedEffect +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.res.dimensionResource @@ -18,16 +23,38 @@ import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp +import com.woocommerce.android.R import com.woocommerce.android.R.dimen import com.woocommerce.android.R.drawable import com.woocommerce.android.R.string import com.woocommerce.android.ui.compose.component.BottomSheetHandle +import com.woocommerce.android.ui.compose.component.FeedbackRequest import com.woocommerce.android.ui.compose.component.WCColoredButton import com.woocommerce.android.ui.compose.preview.LightDarkThemePreviews @Composable fun BlazeCampaignSuccessBottomSheet( onDoneTapped: () -> Unit, + onFeedbackTapped: (Boolean) -> Unit, + shouldShowFeedbackRequest: ShouldShowFeedbackRequest, +) { + var showFeedbackRequest by remember { mutableStateOf(false) } + LaunchedEffect(shouldShowFeedbackRequest) { + showFeedbackRequest = shouldShowFeedbackRequest() + } + + BlazeCampaignSuccessBottomSheet( + onDoneTapped = onDoneTapped, + onFeedbackTapped = onFeedbackTapped, + showFeedbackRequest = showFeedbackRequest, + ) +} + +@Composable +fun BlazeCampaignSuccessBottomSheet( + onDoneTapped: () -> Unit, + onFeedbackTapped: (Boolean) -> Unit, + showFeedbackRequest: Boolean, modifier: Modifier = Modifier ) { Surface( @@ -71,6 +98,14 @@ fun BlazeCampaignSuccessBottomSheet( Text(text = stringResource(id = string.blaze_campaign_created_success_done_button)) } Spacer(modifier = Modifier.height(16.dp)) + if (showFeedbackRequest) { + FeedbackRequest( + onFeedbackReceived = onFeedbackTapped, + feedbackRequestText = R.string.blaze_campaign_created_success_feedback_request, + modifier = Modifier.fillMaxWidth() + ) + Spacer(modifier = Modifier.height(16.dp)) + } } } } @@ -78,5 +113,9 @@ fun BlazeCampaignSuccessBottomSheet( @LightDarkThemePreviews @Composable private fun BlazeCampaignSuccessBottomSheetPreview() { - BlazeCampaignSuccessBottomSheet(onDoneTapped = {}) + BlazeCampaignSuccessBottomSheet( + onDoneTapped = {}, + onFeedbackTapped = {}, + showFeedbackRequest = true + ) } diff --git a/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/blaze/creation/success/BlazeCampaignSuccessBottomSheetFragment.kt b/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/blaze/creation/success/BlazeCampaignSuccessBottomSheetFragment.kt index 552e2c308a1..0d7cfd37c10 100644 --- a/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/blaze/creation/success/BlazeCampaignSuccessBottomSheetFragment.kt +++ b/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/blaze/creation/success/BlazeCampaignSuccessBottomSheetFragment.kt @@ -4,19 +4,43 @@ import android.os.Bundle import android.view.LayoutInflater import android.view.View import android.view.ViewGroup +import com.woocommerce.android.AppUrls.BLAZE_CAMPAIGN_CREATION_SURVEY_URL_I1 +import com.woocommerce.android.analytics.AnalyticsEvent +import com.woocommerce.android.analytics.AnalyticsTrackerWrapper import com.woocommerce.android.ui.compose.composeView +import com.woocommerce.android.util.ChromeCustomTabUtils import com.woocommerce.android.widgets.WCBottomSheetDialogFragment import dagger.hilt.android.AndroidEntryPoint +import javax.inject.Inject @AndroidEntryPoint class BlazeCampaignSuccessBottomSheetFragment : WCBottomSheetDialogFragment() { + @Inject + lateinit var analyticsTracker: AnalyticsTrackerWrapper + + @Inject + lateinit var shouldShowFeedbackRequest: ShouldShowFeedbackRequest + override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View { return composeView { - BlazeCampaignSuccessBottomSheet(::onDoneClicked) + BlazeCampaignSuccessBottomSheet( + ::onDoneClicked, + ::onFeedbackRequestTapped, + shouldShowFeedbackRequest + ) } } private fun onDoneClicked() { dismiss() } + + private fun onFeedbackRequestTapped(isPositive: Boolean) { + analyticsTracker.track( + stat = AnalyticsEvent.BLAZE_CAMPAIGN_CREATION_FEEDBACK, + properties = mapOf("satisfied" to isPositive) + ) + ChromeCustomTabUtils.launchUrl(requireContext(), BLAZE_CAMPAIGN_CREATION_SURVEY_URL_I1) + dismiss() + } } diff --git a/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/blaze/creation/success/ShouldShowFeedbackRequest.kt b/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/blaze/creation/success/ShouldShowFeedbackRequest.kt new file mode 100644 index 00000000000..c9e073f58bb --- /dev/null +++ b/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/blaze/creation/success/ShouldShowFeedbackRequest.kt @@ -0,0 +1,17 @@ +package com.woocommerce.android.ui.blaze.creation.success + +import com.woocommerce.android.tools.SelectedSite +import org.wordpress.android.fluxc.store.blaze.BlazeCampaignsStore +import javax.inject.Inject + +class ShouldShowFeedbackRequest @Inject constructor( + private val selectedSite: SelectedSite, + private val blazeCampaignsStore: BlazeCampaignsStore +) { + companion object { + private const val MINIMUM_CAMPAIGNS_FOR_FEEDBACK_REQUEST = 2 + } + + suspend operator fun invoke(): Boolean = + blazeCampaignsStore.getBlazeCampaigns(selectedSite.get()).size >= MINIMUM_CAMPAIGNS_FOR_FEEDBACK_REQUEST +} diff --git a/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/products/ai/AiFeedbackForm.kt b/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/compose/component/Feedback.kt similarity index 91% rename from WooCommerce/src/main/kotlin/com/woocommerce/android/ui/products/ai/AiFeedbackForm.kt rename to WooCommerce/src/main/kotlin/com/woocommerce/android/ui/compose/component/Feedback.kt index fd20889529d..ff15fe62a2e 100644 --- a/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/products/ai/AiFeedbackForm.kt +++ b/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/compose/component/Feedback.kt @@ -1,5 +1,6 @@ -package com.woocommerce.android.ui.products.ai +package com.woocommerce.android.ui.compose.component +import androidx.annotation.StringRes import androidx.compose.foundation.background import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer @@ -20,8 +21,9 @@ import androidx.compose.ui.res.stringResource import com.woocommerce.android.R @Composable -fun AiFeedbackForm( +fun FeedbackRequest( onFeedbackReceived: (Boolean) -> Unit, + @StringRes feedbackRequestText: Int, modifier: Modifier = Modifier ) { Row( @@ -34,7 +36,7 @@ fun AiFeedbackForm( .padding(dimensionResource(id = R.dimen.major_100)) ) { Text( - text = stringResource(id = R.string.ai_feedback_form_message), + text = stringResource(id = feedbackRequestText), color = colorResource(id = R.color.color_on_surface_medium), modifier = Modifier.weight(1f) ) diff --git a/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/products/ProductSharingBottomSheet.kt b/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/products/ProductSharingBottomSheet.kt index df5e3c46a9d..af81039343c 100644 --- a/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/products/ProductSharingBottomSheet.kt +++ b/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/products/ProductSharingBottomSheet.kt @@ -35,6 +35,7 @@ import androidx.compose.ui.tooling.preview.Preview import com.woocommerce.android.AppConstants.FADE_ANIMATION_DELAY_MS import com.woocommerce.android.R import com.woocommerce.android.ui.compose.animations.SkeletonView +import com.woocommerce.android.ui.compose.component.FeedbackRequest import com.woocommerce.android.ui.compose.component.WCColoredButton import com.woocommerce.android.ui.compose.component.WCOutlinedButton import com.woocommerce.android.ui.compose.component.WCOutlinedTextField @@ -45,7 +46,6 @@ import com.woocommerce.android.ui.products.ProductSharingViewModel.AIButtonState import com.woocommerce.android.ui.products.ProductSharingViewModel.AIButtonState.Regenerate import com.woocommerce.android.ui.products.ProductSharingViewModel.AIButtonState.WriteWithAI import com.woocommerce.android.ui.products.ProductSharingViewModel.ProductSharingViewState -import com.woocommerce.android.ui.products.ai.AiFeedbackForm @Composable fun ProductSharingBottomSheet(viewModel: ProductSharingViewModel) { @@ -109,7 +109,10 @@ fun ProductShareWithAI( enter = fadeIn(animationSpec = tween(FADE_ANIMATION_DELAY_MS)), exit = fadeOut(animationSpec = tween(FADE_ANIMATION_DELAY_MS)) ) { - AiFeedbackForm(onDescriptionFeedbackReceived) + FeedbackRequest( + feedbackRequestText = R.string.ai_feedback_form_message, + onFeedbackReceived = onDescriptionFeedbackReceived + ) } } diff --git a/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/products/ai/preview/AiProductPreviewScreen.kt b/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/products/ai/preview/AiProductPreviewScreen.kt index 5431b2a05b7..a192ff2ad2b 100644 --- a/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/products/ai/preview/AiProductPreviewScreen.kt +++ b/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/products/ai/preview/AiProductPreviewScreen.kt @@ -58,12 +58,12 @@ import androidx.compose.ui.window.DialogProperties import com.woocommerce.android.R import com.woocommerce.android.ui.compose.animations.SkeletonView import com.woocommerce.android.ui.compose.autoMirror +import com.woocommerce.android.ui.compose.component.FeedbackRequest import com.woocommerce.android.ui.compose.component.Toolbar import com.woocommerce.android.ui.compose.component.WCOutlinedButton import com.woocommerce.android.ui.compose.component.WCTextButton import com.woocommerce.android.ui.compose.theme.WooThemeWithBackground import com.woocommerce.android.ui.products.ai.AIProductModel -import com.woocommerce.android.ui.products.ai.AiFeedbackForm import com.woocommerce.android.ui.products.ai.ProductPropertyCard import com.woocommerce.android.ui.products.ai.components.FullScreenImageViewer import com.woocommerce.android.ui.products.ai.components.ImageAction @@ -283,8 +283,9 @@ private fun ProductPreviewContent( .fillMaxWidth() .padding(top = 16.dp) ) { - AiFeedbackForm( - onFeedbackReceived = onFeedbackReceived, + FeedbackRequest( + feedbackRequestText = R.string.ai_feedback_form_message, + onFeedbackReceived = onFeedbackReceived ) } diff --git a/WooCommerce/src/main/res/values/strings.xml b/WooCommerce/src/main/res/values/strings.xml index d8ec1060293..297279af88a 100644 --- a/WooCommerce/src/main/res/values/strings.xml +++ b/WooCommerce/src/main/res/values/strings.xml @@ -4014,6 +4014,7 @@ Ready to Go! We\'re reviewing your campaign. It\'ll be live within 24 hours. Exciting times ahead for your sales! Done + How was the experience with Blaze Creating your campaign Error creating campaign Error creating campaign diff --git a/build.gradle b/build.gradle index 0ec13e3cdc5..cf6ae22a421 100644 --- a/build.gradle +++ b/build.gradle @@ -100,7 +100,7 @@ tasks.register("installGitHooks", Copy) { } ext { - fluxCVersion = 'trunk-373bc6d30f8d9da6b7750f3ddc38929611b50056' + fluxCVersion = 'trunk-7ad6ce4c250ba435d8d8c7feb898bceb259fb007' glideVersion = '4.16.0' coilVersion = '2.1.0' constraintLayoutVersion = '1.2.0'