Skip to content
This repository was archived by the owner on Feb 4, 2025. It is now read-only.

Commit 4e50386

Browse files
authored
Merge pull request #1419 from wordpress-mobile/wc/has-orders
Add a new `hasCachedOrdersForSite()` method to WCOrderStore
2 parents eccb453 + eb3fb3f commit 4e50386

File tree

1 file changed

+5
-0
lines changed
  • plugins/woocommerce/src/main/kotlin/org/wordpress/android/fluxc/store

1 file changed

+5
-0
lines changed

plugins/woocommerce/src/main/kotlin/org/wordpress/android/fluxc/store/WCOrderStore.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,11 @@ class WCOrderStore @Inject constructor(dispatcher: Dispatcher, private val wcOrd
365365
fun getShipmentProvidersForSite(site: SiteModel): List<WCOrderShipmentProviderModel> =
366366
OrderSqlUtils.getOrderShipmentProvidersForSite(site)
367367

368+
/**
369+
* @return Returns true if orders for the provided site exist in the DB, else false.
370+
*/
371+
fun hasCachedOrdersForSite(site: SiteModel) = OrderSqlUtils.getOrdersForSite(site).isNotEmpty()
372+
368373
@Subscribe(threadMode = ThreadMode.ASYNC)
369374
override fun onAction(action: Action<*>) {
370375
val actionType = action.type as? WCOrderAction ?: return

0 commit comments

Comments
 (0)