Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions DebugScreen/Common/Models/Modules/ModuleType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ enum ModuleType {
case alert(model: AlertModel)
/// Module to present any view controller by action button tap
case customScreen(_ screen: UIViewController)
/// Module to push any view controller onto the debug screen navigation stack
case pushCustomScreen(_ screen: UIViewController)
Comment thread
chausovSurfStudio marked this conversation as resolved.
Outdated
/// Module to open local file by selected filepath
case fileViewer(model: FileViewerModel)
/// Module to present information table screen.
Expand Down
6 changes: 6 additions & 0 deletions DebugScreen/Flows/DebugScreenCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ final class DebugScreenCoordinator: BaseCoordinator {
showAlert(with: model)
case .customScreen(let screen):
showCustomScreen(screen)
case .pushCustomScreen(let screen):
pushCustomScreen(screen)
case .fileViewer(let model):
showFile(with: model)
case .infoTable(let model):
Expand Down Expand Up @@ -121,6 +123,10 @@ private extension DebugScreenCoordinator {
router.present(view)
}

func pushCustomScreen(_ screen: UIViewController) {
router.push(screen)
}

func configureActionSheetItem(with model: Action) -> UIAlertAction {
let style: UIAlertAction.Style = model.style == .destructive ? .destructive : .default
let action = UIAlertAction(title: model.title, style: style) { _ in
Expand Down
10 changes: 9 additions & 1 deletion DebugScreen/Services/DebugScreenPresenterService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,21 @@ public final class DebugScreenPresenterService {
openModule(.alert(model: model))
}

/// Show custom view controller.
/// Show custom view controller modally.
/// Can be showed only when debug screen is open.
/// - Parameter view: Screen to display.
public func showCustomScreen(_ view: UIViewController) {
openModule(.customScreen(view))
}

/// Push custom view controller onto the debug screen navigation stack.
/// Provides a standard back button to return to the debug menu.
/// Can be used only when debug screen is open.
/// - Parameter view: Screen to display.
public func pushCustomScreen(_ view: UIViewController) {
openModule(.pushCustomScreen(view))
}

/// Open log file.
/// Can be showed only when debug screen is open.
public func openLogFile() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,16 @@ final class ActionsSectionBuilder: SectionBuilder {
let defaultAction = getAction(style: .secondary)
let destructiveAction = getAction(style: .destructive)
let openScreenAction = getOpenScreenAction()
let pushScreenAction = getPushScreenAction()

let actionList = configureActionList()

blocks = [
.actionList(model: actionList),
.action(model: defaultAction),
.action(model: destructiveAction),
.action(model: openScreenAction)
.action(model: openScreenAction),
.action(model: pushScreenAction)
]

return .init(title: L10n.Actions.header, blocks: blocks)
Expand Down Expand Up @@ -56,6 +58,14 @@ private extension ActionsSectionBuilder {
return action
}

func getPushScreenAction() -> DebugScreenAction {
let action: DebugScreenAction = .init(title: L10n.Actions.pushScreenTitle) {
let view = DestinationViewController()
DebugScreenPresenterService.shared.pushCustomScreen(view)
}
return action
}

func configureActionList() -> DebugScreenActionList {
let actions = getActionListModels()
let actionList: DebugScreenActionList = .init(title: L10n.ActionList.title,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ internal enum L10n {
internal static let header = L10n.tr("Localizable", "Actions.header")
/// Открытие экрана
internal static let openScreenTitle = L10n.tr("Localizable", "Actions.openScreenTitle")
/// Пуш экрана
internal static let pushScreenTitle = L10n.tr("Localizable", "Actions.pushScreenTitle")
/// Вспомогательное
internal static let secondaryTitle = L10n.tr("Localizable", "Actions.secondaryTitle")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"Actions.secondaryTitle" = "Secondary";
"Actions.destructiveTitle" = "Destructive";
"Actions.openScreenTitle" = "Open Screen";
"Actions.pushScreenTitle" = "Push Screen";

// MARK: - ActionList

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"Actions.secondaryTitle" = "Вспомогательное";
"Actions.destructiveTitle" = "Удаление";
"Actions.openScreenTitle" = "Открытие экрана";
"Actions.pushScreenTitle" = "Пуш экрана";

// MARK: - ActionList

Expand Down