Files

45 lines
1.4 KiB
Swift

//
// NotificationsModuleBuilder.swift
// PrivadoVPN
//
// Created by Zhandos Bolatbekov on 11.01.2021.
// Copyright © 2021 Privado LLC. All rights reserved.
//
import Foundation
import UIKit
protocol NotificationsModuleOutput: AnyObject {
func navigate(to route: Route)
}
final class NotificationsModuleBuilder {
static func build(output: NotificationsModuleOutput?) -> UIViewController {
if DeviceInfoProvider.isIPad {
let presenter = NotificationsPresenter(output: output, cellType: .ipad, notificationsStorage: NotificationsStorage.shared)
let navBar = NotificationsNavBarIPAD(with: presenter)
let controller = NotificationsViewIPAD(with: presenter)
presenter.viewInput = controller
controller.navigationBar = navBar
return controller
} else {
let presenter = NotificationsPresenter(output: output, cellType: .iphone, notificationsStorage: NotificationsStorage.shared)
let controller = NotificationsController(output: presenter)
let nbViewBuilder = NavigationBarViewModuleBuilder.build(output: presenter)
controller.navigationBar = nbViewBuilder(controller)
presenter.viewInput = controller
return controller
}
}
}