Skip to content

Commit 5e13f7f

Browse files
committed
Merge branch 'trunk' into issue/WOOMOB-887-cache-carrier-packages-data
# Conflicts: # libs/fluxc-plugin/schemas/org.wordpress.android.fluxc.persistence.WCAndroidDatabase/60.json
2 parents 2b4d5c5 + 303cdcc commit 5e13f7f

File tree

115 files changed

+7959
-1654
lines changed

Some content is hidden

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

115 files changed

+7959
-1654
lines changed

RELEASE-NOTES.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
- [***] POS: A new settings to customize the POS [https://github.com/woocommerce/woocommerce-android/pull/14527]
1414
- [*] [Login] Improved the detection of WooCommerce API version during login flow [https://github.com/woocommerce/woocommerce-android/pull/14524]
1515
- [*] Shipping Labels: Adds caching to the "Select a Package" screen [https://github.com/woocommerce/woocommerce-android/pull/14541]
16+
- [*] Add more filter options to orders filters sales channel [https://github.com/woocommerce/woocommerce-android/pull/14546]
17+
- [*] Automatically populate the weight field in the create shipment flow [https://github.com/woocommerce/woocommerce-android/pull/14525]
1618

1719
23.1
1820
-----

WooCommerce/src/androidTest/assets/mocks/mappings/jetpack-blogs/rest_api.json

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
"json": {
77
"equalTo": "true"
88
},
9-
"query": {
10-
"matches": "(.*)fields(.*)authentication,namespaces(.*)"
9+
"path": {
10+
"equalTo": "/&_method=get"
1111
},
1212
"locale": {
1313
"matches": "(.*)"
@@ -19,13 +19,6 @@
1919
"jsonBody": {
2020
"data": {
2121
"namespaces": ["oembed\/1.0", "wpcomsh\/v1", "akismet\/v1", "jetpack\/v4", "wc\/v1", "wc\/v2", "amp\/v1", "wc-admin", "wc-analytics", "wc-product-add-ons\/v1", "wpcom\/v2", "wc\/v3", "wc\/store", "wccom-site\/v1", "wc-calypso-bridge\/v1", "wp\/v2", "wp-site-health\/v1"],
22-
"authentication": {
23-
"application-passwords": {
24-
"endpoints": {
25-
"authorization": "https:\/\/automatticwidgets.wpcomstaging.com\/wp-admin\/authorize-application.php"
26-
}
27-
}
28-
},
2922
"_links": {
3023
"help": [{
3124
"href": "https:\/\/developer.wordpress.org\/rest-api\/"

WooCommerce/src/main/kotlin/com/woocommerce/android/AppPrefs.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ object AppPrefs {
7878
LOGIN_SITE_ADDRESS,
7979
DATABASE_DOWNGRADED,
8080
ORDER_SUMMARY_MIGRATED,
81+
GATEWAY_MIGRATED,
8182
IS_PRODUCTS_FEATURE_ENABLED,
8283
IS_PRODUCT_ADDONS_ENABLED,
8384
LOGIN_USER_BYPASSED_JETPACK_REQUIRED,
@@ -296,6 +297,10 @@ object AppPrefs {
296297
get() = getBoolean(DeletablePrefKey.ORDER_SUMMARY_MIGRATED, false)
297298
set(value) = setBoolean(DeletablePrefKey.ORDER_SUMMARY_MIGRATED, value)
298299

300+
var gatewayMigrated: Boolean
301+
get() = getBoolean(DeletablePrefKey.GATEWAY_MIGRATED, false)
302+
set(value) = setBoolean(DeletablePrefKey.GATEWAY_MIGRATED, value)
303+
299304
fun getProductSortingChoice(currentSiteId: Int) = getString(getProductSortingKey(currentSiteId)).orNullIfEmpty()
300305

301306
fun setProductSortingChoice(currentSiteId: Int, value: String) {

WooCommerce/src/main/kotlin/com/woocommerce/android/AppPrefsWrapper.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ open class AppPrefsWrapper @Inject constructor() {
4040
var isSiteWPComSuspended by AppPrefs::isSiteWPComSuspended
4141

4242
open var orderSummaryMigrated by AppPrefs::orderSummaryMigrated
43+
open var gatewayMigrated by AppPrefs::gatewayMigrated
4344

4445
fun getAppInstallationDate() = AppPrefs.installationDate
4546

WooCommerce/src/main/kotlin/com/woocommerce/android/ui/login/jetpack/JetpackActivationRepository.kt

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -165,12 +165,9 @@ class JetpackActivationRepository @Inject constructor(
165165
WooLog.d(WooLog.T.LOGIN, "Jetpack Activation: Site $siteUrl is missing from account sites")
166166
Result.failure(IllegalStateException("Site missing"))
167167
} else {
168-
if (!site.hasWooCommerce) {
169-
// If the site doesn't have WooCommerce, let's do one additional fetch using `fetchSite`,
170-
// this function will make sure to fetch data from the remote site, which might result in more
171-
// accurate result
172-
siteStore.fetchSite(site)
173-
}
168+
// Fetch full site details from the remote site, this will also allow us to fetch the
169+
// Applications Passwords support on the site
170+
siteStore.fetchSite(site)
174171
Result.success(site)
175172
}
176173
}

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

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import com.woocommerce.android.ui.orders.filters.data.OrderListFilterCategory.DA
1616
import com.woocommerce.android.ui.orders.filters.data.OrderListFilterCategory.ORDER_STATUS
1717
import com.woocommerce.android.ui.orders.filters.data.OrderListFilterCategory.PRODUCT
1818
import com.woocommerce.android.ui.orders.filters.data.OrderListFilterCategory.SALES_CHANNEL
19+
import com.woocommerce.android.ui.orders.filters.data.SalesChannel
1920
import com.woocommerce.android.ui.orders.filters.domain.GetDateRangeFilterOptions
2021
import com.woocommerce.android.ui.orders.filters.domain.GetOrderStatusFilterOptions
2122
import com.woocommerce.android.ui.orders.filters.domain.GetTrackingForFilterSelection
@@ -390,9 +391,19 @@ class OrderFilterCategoriesViewModel @Inject constructor(
390391

391392
return mutableListOf(
392393
OrderFilterOptionUiModel(
393-
key = "pos",
394+
key = SalesChannel.POS.key,
394395
displayName = resourceProvider.getString(R.string.point_of_sale),
395-
isSelected = currentSelection.contains("pos")
396+
isSelected = currentSelection.contains(SalesChannel.POS.key)
397+
),
398+
OrderFilterOptionUiModel(
399+
key = SalesChannel.WEB_CHECKOUT.key,
400+
displayName = resourceProvider.getString(R.string.orderfilters_sales_channel_filter_web_checkout),
401+
isSelected = currentSelection.contains(SalesChannel.WEB_CHECKOUT.key)
402+
),
403+
OrderFilterOptionUiModel(
404+
key = SalesChannel.WP_ADMIN.key,
405+
displayName = resourceProvider.getString(R.string.orderfilters_sales_channel_filter_wp_admin),
406+
isSelected = currentSelection.contains(SalesChannel.WP_ADMIN.key)
396407
)
397408
).apply {
398409
addFilterOptionAll(resourceProvider)

WooCommerce/src/main/kotlin/com/woocommerce/android/ui/orders/filters/data/OrderFilterDataModels.kt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,16 @@ enum class OrderListFilterCategory {
88
SALES_CHANNEL
99
}
1010

11+
enum class SalesChannel(val key: String, val apiValue: String) {
12+
POS("pos", "pos-rest-api"),
13+
WEB_CHECKOUT("checkout", "checkout"),
14+
WP_ADMIN("admin", "admin");
15+
16+
companion object {
17+
fun fromKey(key: String): SalesChannel? = entries.find { it.key == key }
18+
}
19+
}
20+
1121
enum class DateRange(val filterKey: String) {
1222
TODAY("Today"),
1323
LAST_2_DAYS("Last2Days"),

WooCommerce/src/main/kotlin/com/woocommerce/android/ui/orders/filters/domain/GetWCOrderListDescriptorWithFilters.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import com.woocommerce.android.ui.orders.filters.data.OrderFiltersRepository
1111
import com.woocommerce.android.ui.orders.filters.data.OrderListFilterCategory
1212
import com.woocommerce.android.ui.orders.filters.data.OrderListFilterCategory.DATE_RANGE
1313
import com.woocommerce.android.ui.orders.filters.data.OrderListFilterCategory.SALES_CHANNEL
14+
import com.woocommerce.android.ui.orders.filters.data.SalesChannel
1415
import com.woocommerce.android.util.DateUtils
1516
import org.wordpress.android.fluxc.model.WCOrderListDescriptor
1617
import javax.inject.Inject
@@ -30,7 +31,10 @@ class GetWCOrderListDescriptorWithFilters @Inject constructor(
3031
.joinToString(separator = ",")
3132

3233
val salesChannelFilters = orderFiltersRepository.getCurrentFilterSelection(SALES_CHANNEL)
33-
val createdViaFilter = if (salesChannelFilters.contains("pos")) "pos-rest-api" else null
34+
val createdViaFilter = salesChannelFilters
35+
.firstNotNullOfOrNull { key ->
36+
SalesChannel.fromKey(key)?.apiValue
37+
}
3438

3539
return WCOrderListDescriptor(
3640
site = selectedSite.get(),

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ class OrderListRepository @Inject constructor(
109109
}
110110
}
111111

112-
fun getAllPaymentGateways(site: SiteModel): List<WCGatewayModel> {
112+
suspend fun getAllPaymentGateways(site: SiteModel): List<WCGatewayModel> {
113113
return gatewayStore.getAllGateways(site)
114114
}
115115

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,20 @@ class ShouldUpdateOrdersList @Inject constructor(
1313
private val listStore: ListStore,
1414
private val appPrefs: AppPrefsWrapper
1515
) {
16+
@Suppress("ReturnCount")
1617
suspend operator fun invoke(listDescriptor: ListDescriptor): Boolean {
1718
// 23-07-2025: Consider removing this in the future
1819
// AINFRA-986
1920
if (!appPrefs.orderSummaryMigrated) {
2021
appPrefs.orderSummaryMigrated = true
2122
return true
2223
}
24+
// 26-08-2025: Consider removing this in the future
25+
// AINFRA-1190
26+
if (!appPrefs.gatewayMigrated) {
27+
appPrefs.gatewayMigrated = true
28+
return true
29+
}
2330

2431
val listId = listDescriptor.uniqueIdentifier.value
2532
val shouldUpdateByState = listStore.getListState(listDescriptor) == ListState.NEEDS_REFRESH

0 commit comments

Comments
 (0)