Skip to content

Commit

Permalink
Fix redundant qualifiers and wrong imports
Browse files Browse the repository at this point in the history
  • Loading branch information
JorgeMucientes committed Feb 26, 2024
1 parent ae11eef commit 7b5dbb8
Showing 1 changed file with 12 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import androidx.lifecycle.SavedStateHandle
import androidx.lifecycle.asLiveData
import androidx.lifecycle.viewModelScope
import com.woocommerce.android.R
import com.woocommerce.android.R.string
import com.woocommerce.android.analytics.AnalyticsEvent.BLAZE_CREATION_CONFIRM_DETAILS_TAPPED
import com.woocommerce.android.analytics.AnalyticsEvent.BLAZE_CREATION_EDIT_AD_TAPPED
import com.woocommerce.android.analytics.AnalyticsEvent.BLAZE_CREATION_FORM_DISPLAYED
Expand All @@ -15,7 +14,6 @@ import com.woocommerce.android.support.help.HelpOrigin
import com.woocommerce.android.ui.blaze.BlazeRepository
import com.woocommerce.android.ui.blaze.BlazeRepository.AiSuggestionForAd
import com.woocommerce.android.ui.blaze.BlazeRepository.CampaignDetails
import com.woocommerce.android.ui.blaze.BlazeRepository.DestinationParameters
import com.woocommerce.android.ui.blaze.Location
import com.woocommerce.android.ui.blaze.creation.targets.BlazeTargetType
import com.woocommerce.android.ui.blaze.creation.targets.BlazeTargetType.DEVICE
Expand Down Expand Up @@ -158,7 +156,7 @@ class BlazeCampaignCreationPreviewViewModel @Inject constructor(
}
}

fun onDestinationUpdated(destinationParameters: DestinationParameters) {
fun onDestinationUpdated(destinationParameters: BlazeRepository.DestinationParameters) {
campaignDetails.update { it?.copy(destinationParameters = destinationParameters) }
}

Expand Down Expand Up @@ -236,7 +234,7 @@ class BlazeCampaignCreationPreviewViewModel @Inject constructor(

private fun CampaignDetails.getBudgetDetails() =
CampaignDetailItemUi(
displayTitle = resourceProvider.getString(string.blaze_campaign_preview_details_budget),
displayTitle = resourceProvider.getString(R.string.blaze_campaign_preview_details_budget),
displayValue = budget.toDisplayValue(),
onItemSelected = {
triggerEvent(NavigateToBudgetScreen(budget, targetingParameters))
Expand All @@ -245,7 +243,7 @@ class BlazeCampaignCreationPreviewViewModel @Inject constructor(

private fun CampaignDetails.getTargetDestinationDetails() =
CampaignDetailItemUi(
displayTitle = resourceProvider.getString(string.blaze_campaign_preview_details_destination_url),
displayTitle = resourceProvider.getString(R.string.blaze_campaign_preview_details_destination_url),
displayValue = destinationParameters.fullUrl,
maxLinesValue = 1,
onItemSelected = {
Expand All @@ -260,39 +258,39 @@ class BlazeCampaignCreationPreviewViewModel @Inject constructor(

private fun CampaignDetails.getTargetInterestsDetails() =
CampaignDetailItemUi(
displayTitle = resourceProvider.getString(string.blaze_campaign_preview_details_interests),
displayTitle = resourceProvider.getString(R.string.blaze_campaign_preview_details_interests),
displayValue = targetingParameters.interests.joinToString { it.description }
.ifEmpty { resourceProvider.getString(string.blaze_campaign_preview_target_default_value) },
.ifEmpty { resourceProvider.getString(R.string.blaze_campaign_preview_target_default_value) },
onItemSelected = {
triggerEvent(NavigateToTargetSelectionScreen(INTEREST, targetingParameters.interests.map { it.id }))
},
)

private fun CampaignDetails.getTargetLocationsDetails() =
CampaignDetailItemUi(
displayTitle = resourceProvider.getString(string.blaze_campaign_preview_details_location),
displayTitle = resourceProvider.getString(R.string.blaze_campaign_preview_details_location),
displayValue = targetingParameters.locations.joinToString { it.name }
.ifEmpty { resourceProvider.getString(string.blaze_campaign_preview_target_default_value) },
.ifEmpty { resourceProvider.getString(R.string.blaze_campaign_preview_target_default_value) },
onItemSelected = {
triggerEvent(NavigateToTargetLocationSelectionScreen(targetingParameters.locations))
},
)

private fun CampaignDetails.getTargetDevicesDetails() =
CampaignDetailItemUi(
displayTitle = resourceProvider.getString(string.blaze_campaign_preview_details_devices),
displayTitle = resourceProvider.getString(R.string.blaze_campaign_preview_details_devices),
displayValue = targetingParameters.devices.joinToString { it.name }
.ifEmpty { resourceProvider.getString(string.blaze_campaign_preview_target_default_value) },
.ifEmpty { resourceProvider.getString(R.string.blaze_campaign_preview_target_default_value) },
onItemSelected = {
triggerEvent(NavigateToTargetSelectionScreen(DEVICE, targetingParameters.devices.map { it.id }))
},
)

private fun CampaignDetails.getTargetLanguagesDetails() =
CampaignDetailItemUi(
displayTitle = resourceProvider.getString(string.blaze_campaign_preview_details_language),
displayTitle = resourceProvider.getString(R.string.blaze_campaign_preview_details_language),
displayValue = targetingParameters.languages.joinToString { it.name }
.ifEmpty { resourceProvider.getString(string.blaze_campaign_preview_target_default_value) },
.ifEmpty { resourceProvider.getString(R.string.blaze_campaign_preview_target_default_value) },
onItemSelected = {
triggerEvent(
NavigateToTargetSelectionScreen(
Expand All @@ -309,7 +307,7 @@ class BlazeCampaignCreationPreviewViewModel @Inject constructor(
currencyCode
)
val duration = resourceProvider.getString(
string.blaze_campaign_preview_days_duration,
R.string.blaze_campaign_preview_days_duration,
durationInDays,
startDate.formatToMMMdd()
)
Expand Down

0 comments on commit 7b5dbb8

Please sign in to comment.