Skip to content

Commit

Permalink
Merge branch 'trunk' into trunk
Browse files Browse the repository at this point in the history
  • Loading branch information
Akshaykomar890 authored Jan 10, 2025
2 parents e0599ff + 9230a98 commit 4a6b371
Show file tree
Hide file tree
Showing 40 changed files with 3,400 additions and 2,103 deletions.
3 changes: 3 additions & 0 deletions RELEASE-NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
- [***] Orders: Merchants can now bulk update the status of their orders [https://github.com/woocommerce/woocommerce-android/pull/13245]
- [*] Fixed a crash on the order details [https://github.com/woocommerce/woocommerce-android/pull/13191]
- [**] Introduced fallback logic for the barcode scanner to use the front-facing camera when a back-facing camera is unavailable [https://github.com/woocommerce/woocommerce-android/pull/13230]
- [*] It possible to quickly open plugins page from the plugins list in the up to update an outdated plugin [https://github.com/woocommerce/woocommerce-android/pull/13246]
- [**] Fixed a bug when refunded items were displayed on the refund screen [https://github.com/woocommerce/woocommerce-android/pull/13212]
- [**] Enable hiding and disabling push notification for sites from site picker [https://github.com/woocommerce/woocommerce-android/issues/13107]

21.3
-----
Expand All @@ -27,6 +29,7 @@
- [**] Improved UX of card reader payment flow in Point of Sale, allowing faster payment collection [https://github.com/woocommerce/woocommerce-android/pull/12977]
- [*] Fixed crash when trying to open barcode scanner on device without camera [https://github.com/woocommerce/woocommerce-android/pull/13172]
- [Internal] Woo POS now accepts cash payments and there is a functionality of sending receipts [https://github.com/woocommerce/woocommerce-android/pull/13157]
- [**] Fixed a bug that caused the app to not show the list of refunded products in the order details screen [https://github.com/woocommerce/woocommerce-android/pull/13261]

-----
21.2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ fun WCRefundModel.WCRefundItem.toAppModel(): Refund.Item {
-totalTax, // WCRefundItem.totalTax is NEGATIVE
sku ?: "",
price ?: BigDecimal.ZERO,
metaData?.get(0)?.value?.toString()?.toLongOrNull() ?: -1
metaData?.get(0)?.value?.stringValue?.toLongOrNull() ?: -1
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import com.woocommerce.android.ui.products.ProductHelper
import kotlinx.parcelize.IgnoredOnParcel
import kotlinx.parcelize.Parcelize
import org.wordpress.android.fluxc.model.refunds.WCRefundModel
import org.wordpress.android.fluxc.model.refunds.WCRefundModel.*
import org.wordpress.android.fluxc.model.refunds.WCRefundModel.WCRefundFeeLine
import org.wordpress.android.fluxc.model.refunds.WCRefundModel.WCRefundItem
import org.wordpress.android.fluxc.model.refunds.WCRefundModel.WCRefundShippingLine
import java.math.BigDecimal
import java.math.RoundingMode.HALF_UP
import java.util.Date
Expand Down Expand Up @@ -94,13 +96,13 @@ fun WCRefundItem.toAppModel(): Refund.Item {
-totalTax, // WCRefundItem.totalTax is NEGATIVE
sku ?: "",
price ?: BigDecimal.ZERO,
metaData?.get(0)?.value?.toString()?.toLongOrNull() ?: -1
metaData?.get(0)?.value?.stringValue?.toLongOrNull() ?: -1
)
}

fun WCRefundShippingLine.toAppModel(): Refund.ShippingLine {
return Refund.ShippingLine(
itemId = metaData?.get(0)?.value?.toString()?.toLongOrNull() ?: -1,
itemId = metaData?.get(0)?.value?.stringValue?.toLongOrNull() ?: -1,
methodId = methodId ?: "",
methodTitle = methodTitle ?: "",
totalTax = -totalTax, // WCRefundShippineLine.totalTax is NEGATIVE
Expand All @@ -110,7 +112,7 @@ fun WCRefundShippingLine.toAppModel(): Refund.ShippingLine {

fun WCRefundFeeLine.toAppModel(): Refund.FeeLine {
return Refund.FeeLine(
id = metaData?.get(0)?.value?.toString()?.toLongOrNull() ?: -1,
id = metaData?.get(0)?.value?.stringValue?.toLongOrNull() ?: -1,
name = name,
totalTax = -totalTax, // WCRefundFeeLine.totalTax is NEGATIVE
total = (total), // WCRefundFeeLine.total is NEGATIVE
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.woocommerce.android.ui.orders.wooshippinglabels.address

import android.content.Context
import androidx.compose.animation.animateColorAsState
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Box
Expand All @@ -10,6 +11,8 @@ import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.Divider
import androidx.compose.material.Icon
Expand All @@ -26,6 +29,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.colorResource
import androidx.compose.ui.res.dimensionResource
import androidx.compose.ui.res.painterResource
Expand Down Expand Up @@ -364,20 +368,22 @@ fun AddressSelection(
bottom = dimensionResource(id = R.dimen.minor_100)
)
)
originAddresses.forEach { option ->
val isSelected = option == shipFrom
AddressSelectionItem(
address = option,
isSelected = isSelected,
onClick = {
onShippingFromAddressChange(option)
},
modifier = Modifier.padding(
top = dimensionResource(id = R.dimen.minor_100),
start = dimensionResource(id = R.dimen.major_100),
end = dimensionResource(id = R.dimen.major_100)
LazyColumn {
items(originAddresses) { option ->
val isSelected = option == shipFrom
AddressSelectionItem(
address = option,
isSelected = isSelected,
onClick = {
onShippingFromAddressChange(option)
},
modifier = Modifier.padding(
top = dimensionResource(id = R.dimen.minor_100),
start = dimensionResource(id = R.dimen.major_100),
end = dimensionResource(id = R.dimen.major_100)
)
)
)
}
}
Spacer(modifier = Modifier.height(dimensionResource(id = R.dimen.major_100)))
},
Expand Down Expand Up @@ -422,7 +428,7 @@ fun AddressSelectionItem(
Row {
Column(modifier = Modifier.weight(1f)) {
Text(
text = "Address Name",
text = address.getFormattedName(LocalContext.current),
fontWeight = FontWeight.Bold,
modifier = Modifier
)
Expand Down Expand Up @@ -492,3 +498,18 @@ internal fun getShipTo() = Address(
country = Location("US", "USA"),
state = AmbiguousLocation.Defined(Location("CA", "California", "USA"))
)

fun OriginShippingAddress.getFormattedName(context: Context): String {
val name = when {
!firstName.isNullOrEmpty() && !lastName.isNullOrEmpty() -> "$firstName $lastName"
!firstName.isNullOrEmpty() -> firstName
!lastName.isNullOrEmpty() -> lastName
!company.isNullOrEmpty() -> company
else -> context.getString(R.string.shipping_label_select_origin_address)
}
return if (this.isDefault) {
context.getString(R.string.shipping_label_select_origin_default_address, name)
} else {
name
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.woocommerce.android.ui.prefs.plugins

import com.woocommerce.android.viewmodel.MultiLiveEvent

sealed class PluginsEvent : MultiLiveEvent.Event() {
data class NavigateToPluginsWeb(val url: String) : PluginsEvent()
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import android.view.ViewGroup
import androidx.compose.ui.platform.ComposeView
import androidx.fragment.app.viewModels
import androidx.navigation.fragment.findNavController
import com.woocommerce.android.NavGraphSettingsDirections
import com.woocommerce.android.analytics.AnalyticsTracker
import com.woocommerce.android.ui.base.BaseFragment
import com.woocommerce.android.ui.compose.theme.WooThemeWithBackground
Expand Down Expand Up @@ -46,6 +47,10 @@ class PluginsFragment : BaseFragment() {
viewModel.event.observe(viewLifecycleOwner) { event ->
when (event) {
is MultiLiveEvent.Event.Exit -> findNavController().navigateUp()
is PluginsEvent.NavigateToPluginsWeb -> {
findNavController()
.navigate(NavGraphSettingsDirections.actionGlobalWPComWebViewFragment(event.url))
}
}
}
}
Expand Down
Loading

0 comments on commit 4a6b371

Please sign in to comment.