|
@@ -13,8 +13,6 @@ final class MainCoordinator: BaseCoordinator {
|
|
|
@Published
|
|
@Published
|
|
|
var presentation: Route?
|
|
var presentation: Route?
|
|
|
|
|
|
|
|
- var alertPresenter = AlertPresenter()
|
|
|
|
|
-
|
|
|
|
|
func run() -> some View {
|
|
func run() -> some View {
|
|
|
showMainModule()
|
|
showMainModule()
|
|
|
}
|
|
}
|
|
@@ -73,6 +71,19 @@ final class MainCoordinator: BaseCoordinator {
|
|
|
},
|
|
},
|
|
|
onModalCart: { [weak self] in
|
|
onModalCart: { [weak self] in
|
|
|
self?.presentation = .cart
|
|
self?.presentation = .cart
|
|
|
|
|
+ },
|
|
|
|
|
+ onConfirmationDialog: { [weak self] in
|
|
|
|
|
+ self?.confirmationDialogPresenter.showDialog(
|
|
|
|
|
+ "Are you sure?",
|
|
|
|
|
+ buttons: [
|
|
|
|
|
+ .init(title: "Yes", action: {
|
|
|
|
|
+ print("OnYES")
|
|
|
|
|
+ }),
|
|
|
|
|
+ .init(title: "No", role: .cancel, action: {
|
|
|
|
|
+ print("OnNO")
|
|
|
|
|
+ })
|
|
|
|
|
+ ]
|
|
|
|
|
+ )
|
|
|
}
|
|
}
|
|
|
)
|
|
)
|
|
|
)
|
|
)
|
|
@@ -137,11 +148,13 @@ struct MainNavigationView: View {
|
|
|
@StateObject private var coordinator: MainCoordinator
|
|
@StateObject private var coordinator: MainCoordinator
|
|
|
@StateObject private var router: Router
|
|
@StateObject private var router: Router
|
|
|
@StateObject private var alertPresenter: AlertPresenter
|
|
@StateObject private var alertPresenter: AlertPresenter
|
|
|
|
|
+ @StateObject private var confirmationDialogPresenter: ConfirmationDialogPresenter
|
|
|
|
|
|
|
|
init(_ coordinator: MainCoordinator) {
|
|
init(_ coordinator: MainCoordinator) {
|
|
|
_coordinator = StateObject(wrappedValue: coordinator)
|
|
_coordinator = StateObject(wrappedValue: coordinator)
|
|
|
_router = StateObject(wrappedValue: coordinator.currentRouter)
|
|
_router = StateObject(wrappedValue: coordinator.currentRouter)
|
|
|
_alertPresenter = StateObject(wrappedValue: coordinator.alertPresenter)
|
|
_alertPresenter = StateObject(wrappedValue: coordinator.alertPresenter)
|
|
|
|
|
+ _confirmationDialogPresenter = StateObject(wrappedValue: coordinator.confirmationDialogPresenter)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
var body: some View {
|
|
var body: some View {
|
|
@@ -159,6 +172,10 @@ struct MainNavigationView: View {
|
|
|
alertPresenter.title,
|
|
alertPresenter.title,
|
|
|
isPresented: $alertPresenter.isPresenting,
|
|
isPresented: $alertPresenter.isPresenting,
|
|
|
actions: alertPresenter.buildButtons
|
|
actions: alertPresenter.buildButtons
|
|
|
|
|
+ ).confirmationDialog(
|
|
|
|
|
+ confirmationDialogPresenter.title,
|
|
|
|
|
+ isPresented: $confirmationDialogPresenter.isPresenting,
|
|
|
|
|
+ actions: confirmationDialogPresenter.buildButtons
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|