Skip to content

Commit

Permalink
Merge pull request #13191 from woocommerce/13178-illegalargumentexcep…
Browse files Browse the repository at this point in the history
…tion-required-value-was-null

Fix for the IllegalArgumentException required value was null crash
  • Loading branch information
AnirudhBhat authored Dec 30, 2024
2 parents 128437b + b97b210 commit 6f99cb6
Show file tree
Hide file tree
Showing 4 changed files with 246 additions and 133 deletions.
1 change: 1 addition & 0 deletions RELEASE-NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
-----
- [*] Fix Dashboard card menu sizing to fit bigger font sizes and longer text. [https://github.com/woocommerce/woocommerce-android/pull/13184]
- [*] Fixed overlap issue in Settings > WooCommerce Version [https://github.com/woocommerce/woocommerce-android/pull/13183]
- [*] Fixed a crash on the order details [https://github.com/woocommerce/woocommerce-android/pull/13191]
- [**] Fixed a crash when a shop manager was trying to install or activate plugin in the POS onboarding [https://github.com/woocommerce/woocommerce-android/pull/13203]

21.3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ import android.widget.FrameLayout
import androidx.appcompat.content.res.AppCompatResources
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.padding
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.livedata.observeAsState
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.ViewCompositionStrategy
import androidx.compose.ui.res.stringResource
Expand All @@ -20,6 +23,7 @@ import androidx.core.view.isVisible
import androidx.fragment.app.activityViewModels
import androidx.fragment.app.viewModels
import androidx.lifecycle.LiveData
import androidx.lifecycle.lifecycleScope
import androidx.navigation.fragment.findNavController
import androidx.navigation.fragment.navArgs
import androidx.transition.TransitionManager
Expand Down Expand Up @@ -101,6 +105,7 @@ import com.woocommerce.android.viewmodel.fixedHiltNavGraphViewModels
import com.woocommerce.android.widgets.SkeletonView
import com.woocommerce.android.widgets.WCEmptyView
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.launch
import org.wordpress.android.fluxc.model.OrderAttributionInfo
import org.wordpress.android.util.DisplayUtils
import javax.inject.Inject
Expand Down Expand Up @@ -352,6 +357,7 @@ class OrderDetailFragment :
viewModel.onNextOrderClicked()
true
}

else -> {
false
}
Expand Down Expand Up @@ -434,23 +440,31 @@ class OrderDetailFragment :
showOrderNotes(it)
}
viewModel.orderRefunds.observe(viewLifecycleOwner) {
showOrderRefunds(it, viewModel.order)
lifecycleScope.launch {
showOrderRefunds(it, viewModel.awaitOrder())
}
}
viewModel.productList.observe(viewLifecycleOwner) {
showOrderProducts(it, viewModel.order.currency)
lifecycleScope.launch {
showOrderProducts(it, viewModel.awaitOrder().currency)
}
}
showCustomAmounts(viewModel.feeLineList)
viewModel.shipmentTrackings.observe(viewLifecycleOwner) {
showShipmentTrackings(it)
}
viewModel.shippingLabels.observe(viewLifecycleOwner) {
showShippingLabels(it, viewModel.order.currency)
lifecycleScope.launch {
showShippingLabels(it, viewModel.awaitOrder().currency)
}
}
viewModel.subscriptions.observe(viewLifecycleOwner) {
showSubscriptions(it)
}
viewModel.giftCards.observe(viewLifecycleOwner) {
showGiftCards(it, viewModel.order.currency)
lifecycleScope.launch {
showGiftCards(it, viewModel.awaitOrder().currency)
}
}
showShippingLines(viewModel.shippingLineList)

Expand All @@ -465,9 +479,11 @@ class OrderDetailFragment :
uiMessageResolver.showSnack(event.message)
}
}

is ShowUndoSnackbar -> {
displayUndoSnackbar(event.message, event.undoAction, event.dismissAction)
}

is OrderNavigationTarget -> navigator.navigate(this, event)
is InstallWCShippingViewModel.InstallWcShipping -> navigateToInstallWcShippingFlow()
is OrderDetailViewModel.TrashOrder -> {
Expand All @@ -477,6 +493,7 @@ class OrderDetailFragment :

communicationViewModel.trashOrder(event.orderId)
}

is MultiLiveEvent.Event.ShowDialog -> event.showDialog()
else -> event.isHandled = false
}
Expand All @@ -488,14 +505,19 @@ class OrderDetailFragment :
binding.orderDetailShippingLines.apply {
setViewCompositionStrategy(ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed)
setContent {
val orderCurrency = remember { mutableStateOf<String>("") }
LaunchedEffect(Unit) {
orderCurrency.value = viewModel.awaitOrder().currency
}

shippingLineList.observeAsState().value?.let { shippingLines ->
WooThemeWithBackground {
ShippingLineSection(
shippingLineDetails = shippingLines,
formatCurrency = { amount ->
currencyFormatter.formatCurrency(
amount,
currencyCode = viewModel.order.currency
currencyCode = orderCurrency.value
)
},
modifier = Modifier.padding(bottom = 1.dp)
Expand Down
Loading

0 comments on commit 6f99cb6

Please sign in to comment.