Skip to content

Commit 23a8c8f

Browse files
committed
Merge branch 'trunk' into woomob-1128-woo-possettings-implement-analytics-events
# Conflicts: # WooCommerce/src/main/kotlin/com/woocommerce/android/ui/woopos/home/cart/WooPosCartViewModel.kt # WooCommerce/src/main/kotlin/com/woocommerce/android/ui/woopos/settings/WooPosSettingsScreen.kt
2 parents 040e5ff + 78062de commit 23a8c8f

File tree

132 files changed

+15398
-4817
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

132 files changed

+15398
-4817
lines changed
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Dependabot POS Reminder
2+
3+
on:
4+
pull_request:
5+
types: [opened, reopened]
6+
7+
jobs:
8+
add-pos-reminder:
9+
runs-on: ubuntu-latest
10+
if: github.actor == 'dependabot[bot]'
11+
12+
steps:
13+
# Check if PR contains the constraintlayout dependency
14+
- name: Check for ConstraintLayout Compose dependency
15+
id: check-dependency
16+
uses: actions/github-script@v7
17+
with:
18+
script: |
19+
const title = context.payload.pull_request.title;
20+
const body = context.payload.pull_request.body;
21+
const searchTerm = 'androidx.constraintlayout:constraintlayout-compose';
22+
23+
const containsDependency =
24+
title.includes(searchTerm) ||
25+
body.includes(searchTerm);
26+
27+
console.log(`PR contains ${searchTerm}: ${containsDependency}`);
28+
return containsDependency;
29+
result-encoding: string
30+
31+
# Add comment if dependency is found
32+
- name: Comment on PR
33+
if: steps.check-dependency.outputs.result == 'true'
34+
uses: actions/github-script@v7
35+
with:
36+
script: |
37+
// Check if comment already exists to avoid duplicates
38+
const comments = await github.rest.issues.listComments({
39+
issue_number: context.issue.number,
40+
owner: context.repo.owner,
41+
repo: context.repo.repo
42+
});
43+
44+
const botComment = comments.data.find(comment =>
45+
comment.user.type === 'Bot' &&
46+
comment.body.includes('POS testing')
47+
);
48+
49+
if (!botComment) {
50+
const commentBody = `## ⚠️ POS Testing Required
51+
52+
This PR updates \`androidx.constraintlayout:constraintlayout-compose\`, which affects the Point of Sale system.
53+
54+
**Required Testing:**
55+
- [ ] Cart items remain visible during checkout
56+
- [ ] Layout constraints work correctly on all screen sizes
57+
- [ ] No UI elements disappear unexpectedly
58+
59+
Please complete POS testing before merging this PR.`;
60+
61+
await github.rest.issues.createComment({
62+
issue_number: context.issue.number,
63+
owner: context.repo.owner,
64+
repo: context.repo.repo,
65+
body: commentBody
66+
});
67+
}

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
<!--
22
Contains editorialized release notes. Raw release notes should go into `RELEASE-NOTES.txt`.
33
-->
4+
## 23.1
5+
Enhanced your store management experience with exciting new features! Remove backgrounds from product images instantly with our new one-tap tool. Improved shipping labels with better address validation, cleaner layouts, and smarter split shipment handling. Fixed order selection issues and enhanced login error handling for smoother operations.
6+
47
## 23.0
5-
Psst... Excuse me, do you have a moment to talk about Woo Point of Sale? 💰 It now takes center stage with a shiny new POS tab in the main navigation—one tap and you’re selling in the UK and US, with improved external barcode scanner support 📦 for smoother checkouts. We’ve also refreshed the UI with sleek Material 3 touches and packed in small improvements and fixes you’ll want to explore.
8+
Psst... Excuse me, do you have a moment to talk about Woo Point of Sale? It now takes center stage with a shiny new POS tab in the main navigation—one tap and you’re selling in the UK and US, with improved external barcode scanner support for smoother checkouts. We’ve also refreshed the UI with sleek Material 3 touches and packed in small improvements and fixes you’ll want to explore.
69

710
## 22.9
811
We’ve enhanced your WooCommerce experience with exciting Point of Sale improvements! Now filter orders by POS sales channel, set up barcode readers seamlessly, and spot POS orders with new badges on your dashboard. We’ve also fixed loading issues in order details, resolved payment screen crashes, restored search functionality, and improved shipping label address validation. Plus better plugin detection and currency handling after app restarts.

RELEASE-NOTES.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
*** PLEASE FOLLOW THIS FORMAT: [<priority indicator, more stars = higher priority>] <description> [<PR URL>]
22
*** Use [*****] to indicate smoke tests of all critical flows should be run on the final APK before release (e.g. major library or targetSdk updates).
33
*** For entries which are touching the Android Wear app's, start entry with `[WEAR]` too.
4+
23.2
5+
-----
6+
- [*] Shipping Labels: Add error message for invalid dimensions errors to custom package creation screen [https://github.com/woocommerce/woocommerce-android/pull/14499]
7+
48
23.1
59
-----
610
- [*] You can now remove background from product images in the app. Just open the product image and click "Remove background" button. [https://github.com/woocommerce/woocommerce-android/pull/14445]
@@ -14,6 +18,12 @@
1418
- [Internal] Migrate the cache of the `/config` endpoint to Room instead of DataStore [https://github.com/woocommerce/woocommerce-android/pull/14462]
1519
- [*] Improved error handling in login flow when the WP API is not reachable [https://github.com/woocommerce/woocommerce-android/pull/14472]
1620
- [*] Shipping Labels: Autofill the country field in the customs form and improve the form validation [https://github.com/woocommerce/woocommerce-android/pull/14469]
21+
- [*] Shipping Labels: Fix UI issues on edit address screen [https://github.com/woocommerce/woocommerce-android/pull/14476]
22+
- [Internal] Updated UserAgent of API requests to use `http.agent` System Property to fix performance issues related to WebView usage on app launch [https://github.com/woocommerce/woocommerce-android/pull/14431]
23+
- [*] Shipping Labels: Improved handling of address validation errors [https://github.com/woocommerce/woocommerce-android/pull/14468]
24+
- [*] Shipping Labels: Update UI of the shipping labels details in Order Details screen [https://github.com/woocommerce/woocommerce-android/pull/14485]
25+
- [*] Shipping Labels: Improved the error message for empty shipping rates list [https://github.com/woocommerce/woocommerce-android/pull/14433]
26+
- [*] Shipping Labels: Update button logic on the Hazardous Materials screen [https://github.com/woocommerce/woocommerce-android/pull/14488]
1727

1828
23.0
1929
-----

WooCommerce/proguard-rules.pro

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,18 @@
7979
}
8080
###### SavedStateHandleExt - end
8181

82+
###### Google Crypto Tink dependencies - begin
83+
-dontwarn com.google.api.client.http.GenericUrl
84+
-dontwarn com.google.api.client.http.HttpHeaders
85+
-dontwarn com.google.api.client.http.HttpRequest
86+
-dontwarn com.google.api.client.http.HttpRequestFactory
87+
-dontwarn com.google.api.client.http.HttpResponse
88+
-dontwarn com.google.api.client.http.HttpTransport
89+
-dontwarn com.google.api.client.http.javanet.NetHttpTransport$Builder
90+
-dontwarn com.google.api.client.http.javanet.NetHttpTransport
91+
-dontwarn org.joda.time.Instant
92+
###### Google Crypto Tink dependencies - end
93+
8294
# This is generated automatically by the Android Gradle plugin.
8395
-dontwarn java.beans.ConstructorProperties
8496
-dontwarn java.beans.Transient

WooCommerce/src/main/kotlin/com/woocommerce/android/ui/compose/component/web/WCWebView.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ fun WCWebView(
7474
onPageFinished(it.url)
7575
canGoBack = webView?.canGoBack() == true
7676
}
77+
7778
is WCWebViewEvent.UrlFailed -> onUrlFailed(it.url, it.errorCode)
7879
}
7980
}
@@ -137,7 +138,7 @@ fun WCWebView(
137138
onProgressChanged = { newProgress -> progress = newProgress }
138139
}
139140

140-
this.settings.userAgentString = userAgent.userAgent
141+
this.settings.userAgentString = userAgent.webViewUserAgent
141142
}.also { webView = it }
142143
},
143144
modifier = Modifier

WooCommerce/src/main/kotlin/com/woocommerce/android/ui/compose/theme/WooColors.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,9 @@ val Material3DarkColorScheme
111111
inverseSurface = colorResource(R.color.color_on_surface),
112112
inversePrimary = colorResource(R.color.color_on_primary),
113113
surfaceBright = colorResource(R.color.color_surface),
114-
surfaceContainer = colorResource(R.color.color_surface_elevated),
114+
surfaceContainer = colorResource(R.color.color_surface_elevated_04),
115115
surfaceContainerHigh = colorResource(R.color.color_surface_elevated),
116116
surfaceContainerHighest = colorResource(R.color.color_surface_elevated),
117-
surfaceContainerLow = colorResource(R.color.color_surface_elevated),
118-
surfaceContainerLowest = colorResource(R.color.color_surface_elevated),
117+
surfaceContainerLow = colorResource(R.color.color_elevation_overlay_01),
118+
surfaceContainerLowest = colorResource(R.color.color_elevation_overlay_01),
119119
)

WooCommerce/src/main/kotlin/com/woocommerce/android/ui/orders/OrderShipmentTrackingHelper.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import com.woocommerce.android.widgets.AppRatingDialog
1313
import org.wordpress.android.util.ToastUtils
1414

1515
object OrderShipmentTrackingHelper {
16-
private fun copyTrackingNumber(
16+
fun copyTrackingNumber(
1717
context: Context,
1818
trackingNumber: String
1919
) {

WooCommerce/src/main/kotlin/com/woocommerce/android/ui/orders/details/OrderDetailFragment.kt

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,14 @@ import com.woocommerce.android.ui.orders.details.adapter.OrderDetailShippingLabe
7878
import com.woocommerce.android.ui.orders.details.editing.OrderEditingViewModel
7979
import com.woocommerce.android.ui.orders.details.views.OrderDetailAttributionInfoView
8080
import com.woocommerce.android.ui.orders.details.views.OrderDetailOrderStatusView.Mode
81+
import com.woocommerce.android.ui.orders.details.views.OrderDetailWooShippingShipmentListView
8182
import com.woocommerce.android.ui.orders.fulfill.OrderFulfillViewModel
8283
import com.woocommerce.android.ui.orders.list.OrderListFragment
8384
import com.woocommerce.android.ui.orders.notes.AddOrderNoteFragment
8485
import com.woocommerce.android.ui.orders.shippinglabels.PrintShippingLabelFragment
8586
import com.woocommerce.android.ui.orders.shippinglabels.ShippingLabelRefundFragment
8687
import com.woocommerce.android.ui.orders.tracking.AddOrderShipmentTrackingFragment
88+
import com.woocommerce.android.ui.orders.wooshippinglabels.models.ShipmentUIModel
8789
import com.woocommerce.android.ui.orders.wooshippinglabels.models.ShippingLabelModel
8890
import com.woocommerce.android.ui.orders.wooshippinglabels.refund.WooShippingLabelRefundFragment
8991
import com.woocommerce.android.ui.payments.cardreader.payment.CardReaderPaymentDialogFragment
@@ -450,9 +452,12 @@ class OrderDetailFragment :
450452
viewModel.shipmentTrackings.observe(viewLifecycleOwner) {
451453
showShipmentTrackings(it)
452454
}
455+
viewModel.wooShippingShipments.observe(viewLifecycleOwner) {
456+
updateWooShippingShipments(it)
457+
}
453458
viewModel.shippingLabels.observe(viewLifecycleOwner) {
454459
lifecycleScope.launch {
455-
showShippingLabels(it, viewModel.awaitOrder().currency, viewModel.isRevampWooShippingEnabled)
460+
showShippingLabels(it, viewModel.awaitOrder().currency)
456461
}
457462
}
458463
viewModel.subscriptions.observe(viewLifecycleOwner) {
@@ -808,10 +813,29 @@ class OrderDetailFragment :
808813
)
809814
}
810815

816+
private fun updateWooShippingShipments(
817+
shipments: List<ShipmentUIModel>
818+
) {
819+
with(binding.orderDetailWooShippingShipmentList) {
820+
isVisible = shipments.isNotEmpty()
821+
setViewCompositionStrategy(ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed)
822+
823+
setContent {
824+
WooThemeWithBackground {
825+
OrderDetailWooShippingShipmentListView(
826+
shipments = shipments,
827+
onCreateShippingLabelClicked = viewModel::onCreateShippingLabelButtonTapped,
828+
onViewShippingLabelClicked = viewModel::onViewShippingLabelClicked,
829+
onRequestRefundClicked = viewModel::onRefundShippingLabelClick
830+
)
831+
}
832+
}
833+
}
834+
}
835+
811836
private fun showShippingLabels(
812837
shippingLabels: List<ShippingLabelModel>,
813-
currency: String,
814-
isRevampWooShippingEnabled: Boolean
838+
currency: String
815839
) {
816840
shippingLabels.whenNotNullNorEmpty {
817841
with(binding.orderDetailShippingLabelList) {
@@ -820,7 +844,6 @@ class OrderDetailFragment :
820844
shippingLabels = shippingLabels,
821845
productImageMap = productImageMap,
822846
formatCurrencyForDisplay = currencyFormatter.buildBigDecimalFormatter(currency),
823-
isRevampWooShippingEnabled = isRevampWooShippingEnabled,
824847
productClickListener = this@OrderDetailFragment,
825848
shippingLabelClickListener = object : OnShippingLabelClickListener {
826849
override fun onRefundRequested(shippingLabel: ShippingLabelModel) {

WooCommerce/src/main/kotlin/com/woocommerce/android/ui/orders/details/OrderDetailViewModel.kt

Lines changed: 38 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ import com.woocommerce.android.ui.orders.creation.shipping.GetShippingMethodsWit
5757
import com.woocommerce.android.ui.orders.creation.shipping.RefreshShippingMethods
5858
import com.woocommerce.android.ui.orders.creation.shipping.ShippingLineDetails
5959
import com.woocommerce.android.ui.orders.creation.shipping.ShippingMethodsRepository
60+
import com.woocommerce.android.ui.orders.wooshippinglabels.GetShipments
6061
import com.woocommerce.android.ui.orders.wooshippinglabels.datasource.WooShippingEligibilityDataStore
62+
import com.woocommerce.android.ui.orders.wooshippinglabels.models.ShipmentUIModel
6163
import com.woocommerce.android.ui.orders.wooshippinglabels.models.ShippingLabelModel
6264
import com.woocommerce.android.ui.orders.wooshippinglabels.models.fillProducts
6365
import com.woocommerce.android.ui.orders.wooshippinglabels.networking.WooShippingLabelRepository
@@ -113,6 +115,7 @@ class OrderDetailViewModel @Inject constructor(
113115
private val shippingLabelOnboardingRepository: ShippingLabelOnboardingRepository,
114116
private val shippingLabelRepository: WooShippingLabelRepository,
115117
private val eligibilityDataStore: WooShippingEligibilityDataStore,
118+
private val getWooShippingShipments: GetShipments,
116119
private val orderDetailsTransactionLauncher: OrderDetailsTransactionLauncher,
117120
private val getOrderSubscriptions: GetOrderSubscriptions,
118121
private val giftCardRepository: GiftCardRepository,
@@ -154,6 +157,10 @@ class OrderDetailViewModel @Inject constructor(
154157
private val _shipmentTrackings = MutableLiveData<List<OrderShipmentTracking>>()
155158
val shipmentTrackings: LiveData<List<OrderShipmentTracking>> = _shipmentTrackings
156159

160+
private val _wooShippingShipments = MutableLiveData<List<ShipmentUIModel>>()
161+
val wooShippingShipments: LiveData<List<ShipmentUIModel>> = _wooShippingShipments
162+
163+
// Legacy Woo Tax shipping labels
157164
private val _shippingLabels = MutableLiveData<List<ShippingLabelModel>>()
158165
val shippingLabels: LiveData<List<ShippingLabelModel>> = _shippingLabels
159166

@@ -212,7 +219,7 @@ class OrderDetailViewModel @Inject constructor(
212219

213220
private var pluginsInformation: Map<String, WooPlugin> = HashMap()
214221

215-
val isRevampWooShippingEnabled: Boolean
222+
private val isRevampWooShippingEnabled: Boolean
216223
get() = FeatureFlag.REVAMP_WOO_SHIPPING.isEnabled() &&
217224
shippingLabelOnboardingRepository.shippingPluginSupport.isWooShippingSupported()
218225

@@ -703,11 +710,11 @@ class OrderDetailViewModel @Inject constructor(
703710
triggerEvent(ViewCreateShippingLabelInfo)
704711
}
705712

706-
fun onCreateShippingLabelButtonTapped() {
713+
fun onCreateShippingLabelButtonTapped(shipmentId: Int? = null) {
707714
tracker.trackShippingLabelTapped()
708715
launch {
709716
if (isRevampWooShippingEnabled) {
710-
triggerEvent(StartWooShippingLabelCreationFlow(awaitOrder().id))
717+
triggerEvent(StartWooShippingLabelCreationFlow(awaitOrder().id, shipmentId))
711718
} else {
712719
triggerEvent(StartShippingLabelCreationFlow(awaitOrder().id))
713720
}
@@ -904,26 +911,37 @@ class OrderDetailViewModel @Inject constructor(
904911
orderDetailsTransactionLauncher.onGiftCardsFetched()
905912
}
906913

914+
private suspend fun loadWooShippingShipments(): ListInfo<ShipmentUIModel> {
915+
if (!isRevampWooShippingEnabled ||
916+
eligibilityDataStore.observeEligibility(navArgs.orderId).first() != true
917+
) {
918+
return ListInfo(isVisible = false)
919+
}
920+
921+
return ListInfo(isVisible = true, list = getWooShippingShipments(awaitOrder()))
922+
}
923+
924+
@Suppress("ReturnCount")
907925
private suspend fun loadOrderShippingLabels(): ListInfo<ShippingLabelModel> {
908-
if (isRevampWooShippingEnabled) {
909-
shippingLabelRepository.getPurchasedLabels(navArgs.orderId)
910-
} else {
911-
orderDetailRepository.getOrderShippingLabels(navArgs.orderId)
912-
.map { it.toShippingLabelModel() }
913-
}.fillProducts(awaitOrder().items)
926+
if (isRevampWooShippingEnabled) return ListInfo(isVisible = false)
927+
orderDetailRepository.getOrderShippingLabels(navArgs.orderId)
928+
.map { it.toShippingLabelModel() }
929+
.fillProducts(awaitOrder().items)
914930
.whenNotNullNorEmpty { return ListInfo(list = it) }
931+
915932
return ListInfo(isVisible = false)
916933
}
917934

918935
private suspend fun displayProductAndShippingDetails() {
936+
val wooShippingShipments = loadWooShippingShipments()
919937
val shippingLabels = loadOrderShippingLabels()
920938
val shipmentTracking = loadShipmentTracking(shippingLabels)
921939
val orderRefunds = loadOrderRefunds()
922940
val orderProducts = loadOrderProducts(orderRefunds)
923941

924-
if (shippingLabels.isVisible) {
925-
_shippingLabels.value = shippingLabels.list
926-
}
942+
_wooShippingShipments.value = wooShippingShipments.let { if (it.isVisible) it.list else emptyList() }
943+
944+
_shippingLabels.value = shippingLabels.let { if (it.isVisible) it.list else emptyList() }
927945

928946
if (orderProducts.isVisible) {
929947
_productList.value = orderProducts.list
@@ -943,9 +961,9 @@ class OrderDetailViewModel @Inject constructor(
943961

944962
val orderEligibleForInPersonPayments = viewState.orderInfo?.isPaymentCollectableWithCardReader == true
945963

946-
val isOrderEligibleForSLCreation = isOrderEligibleForSLCreation(orderEligibleForInPersonPayments)
964+
val isOrderEligibleForLegacySLCreation = isOrderEligibleForLegacySLCreation(orderEligibleForInPersonPayments)
947965

948-
if (isOrderEligibleForSLCreation &&
966+
if (isOrderEligibleForLegacySLCreation &&
949967
viewState.isCreateShippingLabelButtonVisible != true &&
950968
viewState.isProductListMenuVisible != true
951969
) {
@@ -955,11 +973,10 @@ class OrderDetailViewModel @Inject constructor(
955973
}
956974

957975
viewState = viewState.copy(
958-
isCreateShippingLabelButtonVisible = isOrderEligibleForSLCreation,
959-
isProductListMenuVisible = isOrderEligibleForSLCreation && shippingLabels.isVisible,
976+
isCreateShippingLabelButtonVisible = isOrderEligibleForLegacySLCreation,
977+
isProductListMenuVisible = isOrderEligibleForLegacySLCreation && shippingLabels.isVisible,
960978
isShipmentTrackingAvailable = shipmentTracking.isVisible,
961979
isProductListVisible = orderProducts.isVisible,
962-
areShippingLabelsVisible = shippingLabels.isVisible,
963980
wcShippingBannerVisible = shippingLabelOnboardingRepository.shouldShowWcShippingBanner(
964981
awaitOrder(),
965982
orderEligibleForInPersonPayments
@@ -968,13 +985,11 @@ class OrderDetailViewModel @Inject constructor(
968985
)
969986
}
970987

971-
private suspend fun isOrderEligibleForSLCreation(orderEligibleForInPersonPayments: Boolean) =
972-
if (isRevampWooShippingEnabled) {
973-
eligibilityDataStore.observeEligibility(awaitOrder().id).first() == true
974-
} else {
988+
private suspend fun isOrderEligibleForLegacySLCreation(orderEligibleForInPersonPayments: Boolean) =
989+
!isRevampWooShippingEnabled &&
975990
shippingLabelOnboardingRepository.shippingPluginSupport.isSupported() &&
976-
orderDetailRepository.isOrderEligibleForSLCreation(awaitOrder().id)
977-
} && !orderEligibleForInPersonPayments
991+
orderDetailRepository.isOrderEligibleForSLCreation(awaitOrder().id) &&
992+
!orderEligibleForInPersonPayments
978993

979994
private suspend fun shouldShowThankYouNoteButton() =
980995
selectedSite.getIfExists()?.isWPComAtomic == true &&

0 commit comments

Comments
 (0)