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

Issue/12750 blaze survey #12761

Merged
merged 14 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from 12 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
1 change: 1 addition & 0 deletions RELEASE-NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
-----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
irfano marked this conversation as resolved.
Show resolved Hide resolved
)
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,50 @@ 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
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(
Expand Down Expand Up @@ -71,12 +98,24 @@ 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))
}
}
}
}

@LightDarkThemePreviews
@Composable
private fun BlazeCampaignSuccessBottomSheetPreview() {
BlazeCampaignSuccessBottomSheet(onDoneTapped = {})
BlazeCampaignSuccessBottomSheet(
onDoneTapped = {},
onFeedbackTapped = {},
showFeedbackRequest = true
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,42 @@ 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)
irfano marked this conversation as resolved.
Show resolved Hide resolved
}
}
Original file line number Diff line number Diff line change
@@ -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
}
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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(
Expand All @@ -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)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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) {
Expand Down Expand Up @@ -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
)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
)
}

Expand Down
1 change: 1 addition & 0 deletions WooCommerce/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4014,6 +4014,7 @@
<string name="blaze_campaign_created_success_title">Ready to Go!</string>
<string name="blaze_campaign_created_success_description">We\'re reviewing your campaign. It\'ll be live within 24 hours. Exciting times ahead for your sales!</string>
<string name="blaze_campaign_created_success_done_button">Done</string>
<string name="blaze_campaign_created_success_feedback_request">How was the experience with Blaze</string>
<string name="blaze_campaign_creation_loading">Creating your campaign</string>
<string name="blaze_campaign_creation_error_title">Error creating campaign</string>
<string name="blaze_campaign_creation_error_payment_hint">Error creating campaign</string>
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ tasks.register("installGitHooks", Copy) {
}

ext {
fluxCVersion = 'trunk-373bc6d30f8d9da6b7750f3ddc38929611b50056'
fluxCVersion = '3105-70f34a7279c647424f0be61466abf2c17267ef8b'
glideVersion = '4.16.0'
coilVersion = '2.1.0'
constraintLayoutVersion = '1.2.0'
Expand Down
Loading