Skip to content

Commit 6d2753f

Browse files
committed
Enable done button even when no changes are made in payment settings
1 parent bf9a4c0 commit 6d2753f

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

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
@@ -5704,7 +5704,7 @@
57045704
DE02ABBD2B578D0E008E0AC4 /* CreditCardType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreditCardType.swift; sourceTree = "<group>"; };
57055705
DE02ABBF2B57D333008E0AC4 /* BlazeConfirmPaymentViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BlazeConfirmPaymentViewModelTests.swift; sourceTree = "<group>"; };
57065706
DE02ABC12B5903AB008E0AC4 /* BlazeCampaignCreationErrorView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BlazeCampaignCreationErrorView.swift; sourceTree = "<group>"; };
5707-
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>"; };
5707+
DE02B64E2E12766B00B79E0D /* CollapsibleShipmentItemCardViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CollapsibleShipmentItemCardViewModelTests.swift; sourceTree = "<group>"; };
57085708
DE02C65B2D5A0B9F0089850D /* FailedProductImageCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FailedProductImageCollectionViewCell.swift; sourceTree = "<group>"; };
57095709
DE02C65D2D5A0C5D0089850D /* FailedProductImageCollectionViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = FailedProductImageCollectionViewCell.xib; sourceTree = "<group>"; };
57105710
DE06D65F2D64699D00419FFA /* AuthenticatedWebViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthenticatedWebViewModelTests.swift; sourceTree = "<group>"; };
@@ -10552,7 +10552,6 @@
1055210552
B56DB3BD2049BFAA00D4AA8E = {
1055310553
isa = PBXGroup;
1055410554
children = (
10555-
DE02B64E2E12766B00B79E0D /* CollapsibleShipmentItemCardViewModelTests.swift */,
1055610555
3F3689E22DCB1B470065B48F /* Modules */,
1055710556
D8FBFF1622D4CC2F006E3336 /* docs */,
1055810557
8CA4F6DC220B24EB00A47B5D /* config */,
@@ -13975,6 +13974,7 @@
1397513974
EEBB9B3E2D8FE5AC008D6CE5 /* Split shipments */ = {
1397613975
isa = PBXGroup;
1397713976
children = (
13977+
DE02B64E2E12766B00B79E0D /* CollapsibleShipmentItemCardViewModelTests.swift */,
1397813978
EEBB9B3F2D8FE5B4008D6CE5 /* WooShippingSplitShipmentsViewModelTests.swift */,
1397913979
);
1398013980
path = "Split shipments";

0 commit comments

Comments
 (0)