Skip to content

Commit b758416

Browse files
committed
Inject view model to allowed emails view
1 parent b73682c commit b758416

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

WooCommerce/Classes/ViewRelated/Coupons/Add and Edit Coupons/UsageDetails/CouponRestrictions.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ struct CouponRestrictions: View {
167167
categoryListConfig: categoryListConfig,
168168
viewModel: viewModel.categorySelectorViewModel)
169169
}
170-
LazyNavigationLink(destination: CouponAllowedEmails(emailFormats: $viewModel.allowedEmails), isActive: $showingAllowedEmails) {
170+
LazyNavigationLink(destination: CouponAllowedEmails(viewModel: viewModel.allowedEmailsViewModel), isActive: $showingAllowedEmails) {
171171
EmptyView()
172172
}
173173
}

WooCommerce/Classes/ViewRelated/Coupons/Add and Edit Coupons/UsageDetails/CouponRestrictionsViewModel.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,12 @@ final class CouponRestrictionsViewModel: ObservableObject {
7575
}
7676
}()
7777

78+
lazy var allowedEmailsViewModel = {
79+
CouponAllowedEmailsViewModel(allowedEmails: allowedEmails) { [weak self] updatedEmails in
80+
self?.allowedEmails = updatedEmails
81+
}
82+
}()
83+
7884
private let siteID: Int64
7985
private let stores: StoresManager
8086
private let storageManager: StorageManagerType

0 commit comments

Comments
 (0)