Skip to content

Commit 8560b98

Browse files
authored
Shipping Labels: Enable done button even when no changes are made in payment settings (#15856)
2 parents eb175d7 + 66bae3c commit 8560b98

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

RELEASE-NOTES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
- [*] Shipping Labels: Improve UI of Split shipments screen. [https://github.com/woocommerce/woocommerce-ios/pull/15838]
77
- [*] POS: icon button with confirmation step used for clearing the cart [https://github.com/woocommerce/woocommerce-ios/pull/15829]
88
- [*] Shipping Labels: Fixed a portion of layout issues caused by bigger accessibility content size categories. [https://github.com/woocommerce/woocommerce-ios/pull/15844]
9+
- [*] Shipping Labels: Enable the confirm button on the payment method sheet even when there are no changes. [https://github.com/woocommerce/woocommerce-ios/pull/15856]
910

1011
22.7
1112
-----

WooCommerce/Classes/ViewRelated/Orders/Order Details/Shipping Labels/Create Shipping Label Form/Payment Methods/ShippingLabelPaymentMethodsViewModel.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ final class ShippingLabelPaymentMethodsViewModel: ObservableObject {
1616

1717
/// Shipping Label account settings from the remote API
1818
///
19-
private var accountSettings: ShippingLabelAccountSettings
19+
private(set) var accountSettings: ShippingLabelAccountSettings
2020

2121
@Published var selectedPaymentMethodID: Int64
2222
@Published var isEmailReceiptsEnabled: Bool

WooCommerce/Classes/ViewRelated/Orders/Order Details/Shipping Labels/WooShipping Create Shipping Labels/WooShippingPaymentMethod/WooShippingPaymentMethodsView.swift

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,15 @@ struct WooShippingPaymentMethodsView: View {
6262
.toggleStyle(.switch)
6363

6464
Button(Localization.confirmButton) {
65-
Task {
66-
await confirmPaymentMethod()
65+
if viewModel.isDoneButtonEnabled() {
66+
Task {
67+
await confirmPaymentMethod()
68+
}
69+
} else {
70+
onAccountSettingsUpdate(viewModel.accountSettings)
6771
}
6872
}
6973
.buttonStyle(PrimaryLoadingButtonStyle(isLoading: viewModel.isUpdating))
70-
.disabled(viewModel.isDoneButtonEnabled() == false)
7174
}
7275
}
7376
}

WooCommerce/WooCommerce.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5707,7 +5707,7 @@
57075707
DE02ABBD2B578D0E008E0AC4 /* CreditCardType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreditCardType.swift; sourceTree = "<group>"; };
57085708
DE02ABBF2B57D333008E0AC4 /* BlazeConfirmPaymentViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BlazeConfirmPaymentViewModelTests.swift; sourceTree = "<group>"; };
57095709
DE02ABC12B5903AB008E0AC4 /* BlazeCampaignCreationErrorView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BlazeCampaignCreationErrorView.swift; sourceTree = "<group>"; };
5710-
DE02B64E2E12766B00B79E0D /* CollapsibleShipmentItemCardViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = CollapsibleShipmentItemCardViewModelTests.swift; path = "WooCommerceTests/ViewRelated/Shipping Label/WooShipping Create Shipping Labels/Split shipments/CollapsibleShipmentItemCardViewModelTests.swift"; sourceTree = "<group>"; };
5710+
DE02B64E2E12766B00B79E0D /* CollapsibleShipmentItemCardViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CollapsibleShipmentItemCardViewModelTests.swift; sourceTree = "<group>"; };
57115711
DE02C65B2D5A0B9F0089850D /* FailedProductImageCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FailedProductImageCollectionViewCell.swift; sourceTree = "<group>"; };
57125712
DE02C65D2D5A0C5D0089850D /* FailedProductImageCollectionViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = FailedProductImageCollectionViewCell.xib; sourceTree = "<group>"; };
57135713
DE06D65F2D64699D00419FFA /* AuthenticatedWebViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthenticatedWebViewModelTests.swift; sourceTree = "<group>"; };
@@ -10557,7 +10557,6 @@
1055710557
B56DB3BD2049BFAA00D4AA8E = {
1055810558
isa = PBXGroup;
1055910559
children = (
10560-
DE02B64E2E12766B00B79E0D /* CollapsibleShipmentItemCardViewModelTests.swift */,
1056110560
3F3689E22DCB1B470065B48F /* Modules */,
1056210561
D8FBFF1622D4CC2F006E3336 /* docs */,
1056310562
8CA4F6DC220B24EB00A47B5D /* config */,
@@ -13980,6 +13979,7 @@
1398013979
EEBB9B3E2D8FE5AC008D6CE5 /* Split shipments */ = {
1398113980
isa = PBXGroup;
1398213981
children = (
13982+
DE02B64E2E12766B00B79E0D /* CollapsibleShipmentItemCardViewModelTests.swift */,
1398313983
EEBB9B3F2D8FE5B4008D6CE5 /* WooShippingSplitShipmentsViewModelTests.swift */,
1398413984
);
1398513985
path = "Split shipments";

0 commit comments

Comments
 (0)