-
Notifications
You must be signed in to change notification settings - Fork 375
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add UI for creating and editing a custom list
- Loading branch information
Jon Petersson
committed
Feb 20, 2024
1 parent
ef86758
commit 6fbcbf8
Showing
19 changed files
with
914 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
ios/MullvadVPN/Coordinators/CustomLists/AddCustomListCoordinator.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
// | ||
// AddCustomListCoordinator.swift | ||
// MullvadVPN | ||
// | ||
// Created by Jon Petersson on 2024-02-14. | ||
// Copyright © 2024 Mullvad VPN AB. All rights reserved. | ||
// | ||
|
||
import Combine | ||
import MullvadSettings | ||
import Routing | ||
import UIKit | ||
|
||
class AddCustomListCoordinator: Coordinator, Presentable, Presenting { | ||
let navigationController: UINavigationController | ||
let customListInteractor: CustomListInteractorProtocol | ||
|
||
var presentedViewController: UIViewController { | ||
navigationController | ||
} | ||
|
||
var didFinish: (() -> Void)? | ||
|
||
init( | ||
navigationController: UINavigationController, | ||
customListInteractor: CustomListInteractorProtocol | ||
) { | ||
self.navigationController = navigationController | ||
self.customListInteractor = customListInteractor | ||
} | ||
|
||
func start() { | ||
let subject = CurrentValueSubject<CustomListViewModel, Never>( | ||
CustomListViewModel(id: UUID(), name: "", locations: [], tableSections: [.name, .addLocations]) | ||
) | ||
|
||
let controller = CustomListViewController( | ||
interactor: customListInteractor, | ||
subject: subject, | ||
alertPresenter: AlertPresenter(context: self) | ||
) | ||
controller.delegate = self | ||
|
||
controller.navigationItem.title = NSLocalizedString( | ||
"CUSTOM_LIST_NAVIGATION_EDIT_TITLE", | ||
tableName: "CustomLists", | ||
value: "New custom list", | ||
comment: "" | ||
) | ||
|
||
controller.saveBarButton.title = NSLocalizedString( | ||
"CUSTOM_LIST_NAVIGATION_CREATE_BUTTON", | ||
tableName: "CustomLists", | ||
value: "Create", | ||
comment: "" | ||
) | ||
|
||
navigationController.pushViewController(controller, animated: false) | ||
} | ||
} | ||
|
||
extension AddCustomListCoordinator: CustomListViewControllerDelegate { | ||
func customListDidSave() { | ||
didFinish?() | ||
} | ||
|
||
func customListDidDelete() { | ||
// No op. | ||
} | ||
|
||
func showLocations() { | ||
// TODO: Show view controller for locations. | ||
} | ||
} |
Oops, something went wrong.