Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/trunk' into fix/widget-woo-expre…
Browse files Browse the repository at this point in the history
…ss-stores
  • Loading branch information
Alejo committed Feb 2, 2024
2 parents 502cdcc + 57f48eb commit 0e73991
Show file tree
Hide file tree
Showing 105 changed files with 4,451 additions and 2,160 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<!--
Contains editorialized release notes. Raw release notes should go into `RELEASE-NOTES.txt`.
-->
## 17.1
This release focuses on bug fixes and improvements to help you get your business started. Keep your feedback rolling in; it helps us figure out what to work on next.

## 17.0
Get ready for a smoother experience with our latest update! We've ironed out the pesky bug that kept gift cards from showing up in the 'totals' section during order creation and editing. Managing your sales with our WooCommerce app is now more seamless than ever. Update now and enjoy the hassle-free enhancements!

Expand Down
7 changes: 7 additions & 0 deletions RELEASE-NOTES.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
*** PLEASE FOLLOW THIS FORMAT: [<priority indicator, more stars = higher priority>] <description> [<PR URL>]
17.2
-----
- [**] [Available for users with WooCommerce version of 8.7+, which is not released yet] Every order have a receipt now. The receipts can be shared via many apps installed on the phone [https://github.com/woocommerce/woocommerce-android/pull/10650]

17.1
-----
- [*] [Internal] Fixed crash when going to background from the order creation screen [https://github.com/woocommerce/woocommerce-android/pull/10600]
- [*] [Internal] Improvement to the autofocus logic in the barcode scanning screen [https://github.com/woocommerce/woocommerce-android/pull/10605]
- [*] [Internal] Collapse bottom drawer with totals on the order creation/editing screen when scrolling down [https://github.com/woocommerce/woocommerce-android/pull/10573]

17.0
-----
Expand Down
2 changes: 1 addition & 1 deletion WooCommerce/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ dependencies {
implementation 'com.google.android.play:app-update-ktx:2.1.0'
implementation 'com.google.android.play:review-ktx:2.0.1'

implementation 'com.google.android.gms:play-services-code-scanner:16.0.0-beta3'
implementation 'com.google.android.gms:play-services-code-scanner:16.1.0'

implementation "com.google.mlkit:text-recognition:$mlkitTextRecognitionVersion"
implementation "com.google.mlkit:barcode-scanning:$mlkitBarcodeScanningVersion"
Expand Down
12 changes: 6 additions & 6 deletions WooCommerce/metadata/PlayStoreStrings.pot
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ msgstr ""
"Project-Id-Version: Release Notes & Play Store Descriptions\n"

#. translators: Release notes for this version to be displayed in the Play Store. Limit to 500 characters including spaces and commas!
msgctxt "release_note_170"
msgctxt "release_note_171"
msgid ""
"17.0:\n"
"Get ready for a smoother experience with our latest update! We've ironed out the pesky bug that kept gift cards from showing up in the 'totals' section during order creation and editing. Managing your sales with our WooCommerce app is now more seamless than ever. Update now and enjoy the hassle-free enhancements!\n"
"17.1:\n"
"This release focuses on bug fixes and improvements to help you get your business started. Keep your feedback rolling in; it helps us figure out what to work on next.\n"
msgstr ""

msgctxt "release_note_169"
msgctxt "release_note_170"
msgid ""
"16.9:\n"
"Fresh out of the oven! Our latest WooCommerce app update brings you a sleeker shopping cart experience. We've handily relocated the order creation to the bottom of your screen for easy thumb access, giving you more room to navigate. Plus, we've streamlined your workflow by detaching the order editing from the creation process. Get ready for a tidier, more efficient way to manage your sales. Tap "Update" and feel the difference!\n"
"17.0:\n"
"Get ready for a smoother experience with our latest update! We've ironed out the pesky bug that kept gift cards from showing up in the 'totals' section during order creation and editing. Managing your sales with our WooCommerce app is now more seamless than ever. Update now and enjoy the hassle-free enhancements!\n"
msgstr ""

#. translators: Short description of the app to be displayed in the Play Store. Limit to 80 characters including spaces and commas!
Expand Down
2 changes: 1 addition & 1 deletion WooCommerce/metadata/release_notes.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Get ready for a smoother experience with our latest update! We've ironed out the pesky bug that kept gift cards from showing up in the 'totals' section during order creation and editing. Managing your sales with our WooCommerce app is now more seamless than ever. Update now and enjoy the hassle-free enhancements!
This release focuses on bug fixes and improvements to help you get your business started. Keep your feedback rolling in; it helps us figure out what to work on next.
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ enum class AnalyticsEvent(val siteless: Boolean = false) {
DASHBOARD_SEE_MORE_ANALYTICS_TAPPED,
DASHBOARD_STORE_TIMEZONE_DIFFER_FROM_DEVICE,
USED_ANALYTICS,
STATS_UNEXPECTED_FORMAT,

// -- Analytics Hub
ANALYTICS_HUB_DATE_RANGE_BUTTON_TAPPED,
Expand Down Expand Up @@ -290,6 +291,9 @@ enum class AnalyticsEvent(val siteless: Boolean = false) {
TAX_RATE_AUTO_TAX_RATE_SET_NEW_RATE_FOR_ORDER_TAPPED,
TAX_RATE_AUTO_TAX_RATE_CLEAR_ADDRESS_TAPPED,
ORDER_FORM_TOTALS_PANEL_TOGGLED,
ORDER_FORM_ADD_GIFT_CARD_CTA_SHOWN,
ORDER_FORM_ADD_GIFT_CARD_CTA_TAPPED,
ORDER_FORM_GIFT_CARD_SET,

// -- Custom Amounts
ORDER_CREATION_ADD_CUSTOM_AMOUNT_TAPPED,
Expand Down Expand Up @@ -452,6 +456,7 @@ enum class AnalyticsEvent(val siteless: Boolean = false) {
RECEIPT_PRINT_CANCELED,
RECEIPT_PRINT_SUCCESS,
RECEIPT_VIEW_TAPPED,
RECEIPT_URL_FETCHING_FAILS,

// -- Top-level navigation
MAIN_MENU_SETTINGS_TAPPED,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@ class AnalyticsTracker private constructor(
const val KEY_SOFTWARE_UPDATE_TYPE = "software_update_type"
const val KEY_SUBJECT = "subject"
const val KEY_DATE_RANGE = "date_range"
const val KEY_DATE = "date"
const val KEY_GRANULARITY = "granularity"
const val KEY_SOURCE = "source"
const val KEY_CUSTOM_FIELDS_COUNT = "custom_fields_count"
const val KEY_CUSTOM_FIELDS_SIZE = "custom_fields_size"
Expand Down Expand Up @@ -286,6 +288,8 @@ class AnalyticsTracker private constructor(
const val KEY_TIME_ELAPSED_SINCE_CARD_COLLECT_PAYMENT_IN_MILLIS = "milliseconds_since_card_collect_payment_flow"

const val KEY_COUPONS_COUNT = "coupons_count"
const val KEY_USE_GIFT_CARD = "use_gift_card"
const val KEY_IS_GIFT_CARD_REMOVED = "removed"

const val KEY_WAS_ECOMMERCE_TRIAL = "was_ecommerce_trial"
const val KEY_PLAN_PRODUCT_SLUG = "plan_product_slug"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,30 @@ inline fun <T1, T2, T3, T4, T5, T6, T7, R> combine(
)
}
}

@Suppress("LongParameterList")
inline fun <T1, T2, T3, T4, T5, T6, T7, T8, R> combine(
flow: Flow<T1>,
flow2: Flow<T2>,
flow3: Flow<T3>,
flow4: Flow<T4>,
flow5: Flow<T5>,
flow6: Flow<T6>,
flow7: Flow<T7>,
flow8: Flow<T8>,
crossinline transform: suspend (T1, T2, T3, T4, T5, T6, T7, T8) -> R
): Flow<R> {
return kotlinx.coroutines.flow.combine(flow, flow2, flow3, flow4, flow5, flow6, flow7, flow8) { args: Array<*> ->
@Suppress("UNCHECKED_CAST", "MagicNumber")
transform(
args[0] as T1,
args[1] as T2,
args[2] as T3,
args[3] as T4,
args[4] as T5,
args[5] as T6,
args[6] as T7,
args[7] as T8,
)
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
package com.woocommerce.android.model

import android.os.Parcelable
import kotlinx.parcelize.IgnoredOnParcel
import kotlinx.parcelize.Parcelize

@Parcelize
data class WooPlugin(
val isInstalled: Boolean,
val isActive: Boolean,
val version: String?
) {
) : Parcelable {
@IgnoredOnParcel
val isOperational = isInstalled && isActive
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ package com.woocommerce.android.ui.barcodescanner
import android.content.res.Configuration
import android.util.Size
import androidx.camera.core.CameraSelector
import androidx.camera.core.FocusMeteringAction
import androidx.camera.core.ImageAnalysis
import androidx.camera.core.ImageAnalysis.STRATEGY_KEEP_ONLY_LATEST
import androidx.camera.core.ImageProxy
import androidx.camera.core.SurfaceOrientedMeteringPointFactory
import androidx.camera.lifecycle.ProcessCameraProvider
import androidx.camera.view.PreviewView
import androidx.compose.foundation.background
Expand Down Expand Up @@ -33,6 +35,7 @@ import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleEventObserver
import com.woocommerce.android.R
import com.woocommerce.android.ui.compose.theme.WooThemeWithBackground
import java.util.concurrent.TimeUnit
import androidx.camera.core.Preview as CameraPreview

@Suppress("TooGenericExceptionCaught")
Expand Down Expand Up @@ -75,7 +78,26 @@ fun BarcodeScanner(
}

cameraProvider.unbindAll()
cameraProvider.bindToLifecycle(lifecycleOwner, selector, cameraPreview, imageAnalysisUseCase)
val camera = cameraProvider.bindToLifecycle(
lifecycleOwner,
selector,
cameraPreview,
imageAnalysisUseCase
)

val factory = SurfaceOrientedMeteringPointFactory(
previewView.width.toFloat(),
previewView.height.toFloat()
)
val centerPoint = factory.createPoint(
previewView.width.toFloat() / 2,
previewView.height.toFloat() / 2
)
val action = FocusMeteringAction.Builder(centerPoint, FocusMeteringAction.FLAG_AF).apply {
// Confusing naming - that means focus and metering will reset after 2 seconds
setAutoCancelDuration(2, TimeUnit.SECONDS)
}.build()
camera.cameraControl.startFocusAndMetering(action)
} catch (e: Exception) {
onBindingException(e)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
package com.woocommerce.android.ui.blaze

import android.os.Parcelable
import com.woocommerce.android.tools.SelectedSite
import com.woocommerce.android.ui.products.ProductDetailRepository
import com.woocommerce.android.util.TimezoneProvider
import kotlinx.coroutines.flow.map
import kotlinx.parcelize.Parcelize
import org.wordpress.android.fluxc.persistence.blaze.BlazeCampaignsDao.BlazeAdSuggestionEntity
import org.wordpress.android.fluxc.store.blaze.BlazeCampaignsStore
import java.util.Date
import javax.inject.Inject
Expand All @@ -23,75 +27,92 @@ class BlazeRepository @Inject constructor(
const val ONE_DAY_IN_MILLIS = 1000 * 60 * 60 * 24
}

fun observeLanguages() = blazeCampaignsStore.observeBlazeTargetingLanguages()
.map { it.map { language -> Language(language.id, language.name) } }

suspend fun fetchLanguages() = blazeCampaignsStore.fetchBlazeTargetingLanguages()

fun observeDevices() = blazeCampaignsStore.observeBlazeTargetingDevices()
.map { it.map { device -> Device(device.id, device.name) } }

suspend fun fetchDevices() = blazeCampaignsStore.fetchBlazeTargetingTopics()

fun observeInterests() = blazeCampaignsStore.observeBlazeTargetingTopics()
.map { it.map { interest -> Interest(interest.id, interest.description) } }

suspend fun fetchInterests() = blazeCampaignsStore.fetchBlazeTargetingTopics()

suspend fun getMostRecentCampaign() = blazeCampaignsStore.getMostRecentBlazeCampaign(selectedSite.get())

suspend fun getAdSuggestions(productId: Long): List<AiSuggestionForAd>? {
fun List<BlazeAdSuggestionEntity>.mapToUiModel(): List<AiSuggestionForAd> {
return map { AiSuggestionForAd(it.tagLine, it.description) }
}

val suggestions = blazeCampaignsStore.getBlazeAdSuggestions(selectedSite.get(), productId)
return if (suggestions.isNotEmpty()) {
suggestions.mapToUiModel()
} else {
blazeCampaignsStore.fetchBlazeAdSuggestions(selectedSite.get(), productId).model?.mapToUiModel()
}
}

fun getCampaignPreviewDetails(productId: Long): CampaignPreview {
val product = productDetailRepository.getProduct(productId)
return CampaignPreview(
productId = productId,
aiSuggestions = listOf(),
budget = Budget(
totalBudget = DEFAULT_CAMPAIGN_TOTAL_BUDGET,
spentBudget = 0f,
currencyCode = BLAZE_DEFAULT_CURRENCY_CODE,
durationInDays = DEFAULT_CAMPAIGN_DURATION,
startDate = Date().apply { time += ONE_DAY_IN_MILLIS }, // By default start tomorrow
),
languages = listOf(),
devices = listOf(),
locations = listOf(),
interests = listOf(),
userTimeZone = timezoneProvider.deviceTimezone.displayName,
targetUrl = product?.permalink ?: "",
urlParams = null,
campaignImageUrl = product?.firstImageUrl
)
}

@Parcelize
data class CampaignPreview(
val productId: Long,
val aiSuggestions: List<AiSuggestionForAd>,
val budget: Budget,
val languages: List<Language>,
val devices: List<Device>,
val locations: List<Location>,
val interests: List<Interest>,
val userTimeZone: String,
val targetUrl: String,
val urlParams: Pair<String, String>?,
val campaignImageUrl: String?,
)
) : Parcelable

@Parcelize
data class AiSuggestionForAd(
val title: String,
val tagLine: String,
)
val description: String,
) : Parcelable

@Parcelize
data class Budget(
val totalBudget: Float,
val spentBudget: Float,
val currencyCode: String,
val durationInDays: Int,
val startDate: Date,
)
) : Parcelable

@Parcelize
data class Location(
val id: String,
val name: String,
)
) : Parcelable

@Parcelize
data class Language(
val code: String,
val name: String,
)
) : Parcelable

@Parcelize
data class Device(
val id: String,
val name: String,
)
) : Parcelable

@Parcelize
data class Interest(
val id: String,
val description: String,
)
) : Parcelable
}
Loading

0 comments on commit 0e73991

Please sign in to comment.