Closed hichamboushaba closed 1 week ago
1 Warning | |
---|---|
:warning: | View files have been modified, but no screenshot or video is included in the pull request. Consider adding some for clarity. |
Generated by :no_entry_sign: Danger
App Name | WooCommerce-Wear Android | |
Platform | ⌚️ Wear OS | |
Flavor | Jalapeno | |
Build Type | Debug | |
Commit | aa2a8f7bcdccb86877e8b8b4b444b6b943bf8321 | |
Direct Download | woocommerce-wear-prototype-build-pr12920-aa2a8f7.apk |
📲 You can test the changes from this Pull Request in WooCommerce Android by scanning the QR code below to install the corresponding build.
App Name | WooCommerce Android | |
Platform | 📱 Mobile | |
Flavor | Jalapeno | |
Build Type | Debug | |
Commit | aa2a8f7bcdccb86877e8b8b4b444b6b943bf8321 | |
Direct Download | woocommerce-prototype-build-pr12920-aa2a8f7.apk |
Closes: #12913 Closes: #12919
Description
This PR fixes a crash that can occur in order details screen when tapping on of the buttons of the
OrderDetailCustomerInfoView
, the crash occurs if the user tries to tap on the buttons after the view was detached from the window, this can happen during transition animations, and happens more frequently on tablets given how the navigation works with the dual pane mode.For technical side, this crash happens because when the fragment view is destroyed, the
NavHostFragment
will detach thenavController
, so if a button click listener was to be invoked after this, thefindNavController
will throw the exception.Steps to reproduce
Please repeat the following on both
trunk
and this branch to confirm the fix.trunk
, and shouldn't crash on this branch.Alternatively, if the above wasn't enough to reproduce it, please apply the following patch to simulate it, the patch will trigger manually the click after the view is destroyed, which should cause the crash on
trunk
and would confirm the fix of this branch.Patch
```patch Index: WooCommerce/src/main/kotlin/com/woocommerce/android/ui/orders/details/views/OrderDetailCustomerInfoView.kt IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/orders/details/views/OrderDetailCustomerInfoView.kt b/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/orders/details/views/OrderDetailCustomerInfoView.kt --- a/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/orders/details/views/OrderDetailCustomerInfoView.kt (revision 564631291444e615d443e2bd4f6e00d8252602d8) +++ b/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/orders/details/views/OrderDetailCustomerInfoView.kt (date 1731511463945) @@ -40,7 +40,7 @@ private const val TELEGRAM_PACKAGE_NAME = "org.telegram.messenger" } - private val binding = OrderDetailCustomerInfoBinding.inflate(LayoutInflater.from(ctx), this) + val binding = OrderDetailCustomerInfoBinding.inflate(LayoutInflater.from(ctx), this) private var isCustomerInfoViewExpanded = false override fun onSaveInstanceState(): Parcelable { Index: WooCommerce/src/main/kotlin/com/woocommerce/android/ui/orders/details/OrderDetailFragment.kt IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/orders/details/OrderDetailFragment.kt b/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/orders/details/OrderDetailFragment.kt --- a/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/orders/details/OrderDetailFragment.kt (revision 564631291444e615d443e2bd4f6e00d8252602d8) +++ b/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/orders/details/OrderDetailFragment.kt (date 1731508415600) @@ -311,7 +311,9 @@ override fun onDestroyView() { super.onDestroyView() + val customerInfoBinding = binding.orderDetailCustomerInfo.binding _binding = null + customerInfoBinding.customerInfoShippingAddressSection.callOnClick() } fun onPrepareMenu(menu: Menu) { ```RELEASE-NOTES.txt
if necessary. Use the "[Internal]" label for non-user-facing changes.Reviewer (or Author, in the case of optional code reviews):
Please make sure these conditions are met before approving the PR, or request changes if the PR needs improvement: