[ios] Fixed navigation issues for editing bookmark groups

Resolves #939

Signed-off-by: André <135858315+andre1110@users.noreply.github.com>
This commit is contained in:
André 2023-06-16 14:07:47 +07:00 committed by Alexander Borsuk
parent d01507d7ce
commit 0ac43bbdc4
5 changed files with 6 additions and 51 deletions

View file

@ -340,10 +340,13 @@ extension BookmarksListPresenter: CategorySettingsViewControllerDelegate {
imageUrl: bookmarkGroup.imageUrl,
hasLogo: false)
view.setInfo(info)
viewController.goBack()
}
func categorySettingsController(_ viewController: CategorySettingsViewController, didDelete categoryId: MWMMarkGroupID) {
delegate?.bookmarksListDidDeleteGroup()
if let delegate = delegate as? UIViewController {
viewController.navigationController?.popToViewController(delegate, animated: true)
}
}
}

View file

@ -20,13 +20,13 @@ extension BookmarksListRouter: IBookmarksListRouter {
}
func showDescription(_ bookmarkGroup: BookmarkGroup) {
let description = prepareHtmlDescription(bookmarkGroup)
let description = BookmarksListRouter.prepareHtmlDescription(bookmarkGroup)
let descriptionViewController = WebViewController(html: description, baseUrl: nil, title: bookmarkGroup.title)!
descriptionViewController.openInSafari = true
mapViewController.navigationController?.pushViewController(descriptionViewController, animated: true)
}
func prepareHtmlDescription(_ bookmarkGroup: BookmarkGroup) -> String {
private static func prepareHtmlDescription(_ bookmarkGroup: BookmarkGroup) -> String {
var description = bookmarkGroup.detailedAnnotation
if bookmarkGroup.isHtmlDescription {
if !description.contains("<body>") {

View file

@ -1,43 +0,0 @@
@objc(MWMBookmarksTabViewController)
final class BookmarksTabViewController: TabViewController {
@objc enum ActiveTab: Int {
case user = 0
case catalog
}
private static let selectedIndexKey = "BookmarksTabViewController_selectedIndexKey"
@objc public var activeTab: ActiveTab = ActiveTab(rawValue:
UserDefaults.standard.integer(forKey: BookmarksTabViewController.selectedIndexKey)) ?? .user {
didSet {
UserDefaults.standard.set(activeTab.rawValue, forKey: BookmarksTabViewController.selectedIndexKey)
}
}
private weak var coordinator: BookmarksCoordinator?
@objc init(coordinator: BookmarksCoordinator?) {
super.init(nibName: nil, bundle: nil)
self.coordinator = coordinator
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func viewDidLoad() {
super.viewDidLoad()
let bookmarks = BMCViewController(coordinator: coordinator)
bookmarks.title = L("bookmarks")
viewControllers = [bookmarks]
title = L("bookmarks");
tabView.selectedIndex = activeTab.rawValue
}
override func viewDidDisappear(_ animated: Bool) {
super.viewDidDisappear(animated)
activeTab = ActiveTab(rawValue: tabView.selectedIndex ?? 0) ?? .user
}
}

View file

@ -107,7 +107,6 @@ final class CategorySettingsViewController: MWMTableViewController {
}
delegate?.categorySettingsController(self, didEndEditing: bookmarkGroup.categoryId)
self.navigationController?.popViewController(animated: true)
}
}

View file

@ -436,7 +436,6 @@
A630D1EA207CA95900976DEA /* Localizable.stringsdict in Resources */ = {isa = PBXBuildFile; fileRef = A630D1E8207CA95900976DEA /* Localizable.stringsdict */; };
AA1C7E3E269A2DD600BAADF2 /* EditTrackViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA1C7E3D269A2DD600BAADF2 /* EditTrackViewController.swift */; };
B33D21AF20DAF9F000BAD749 /* Toast.swift in Sources */ = {isa = PBXBuildFile; fileRef = B33D21AE20DAF9F000BAD749 /* Toast.swift */; };
B33D21B820E130D000BAD749 /* BookmarksTabViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B33D21B720E130D000BAD749 /* BookmarksTabViewController.swift */; };
B3E3B4FD20D463B700DA8C13 /* BMCCategoriesHeader.xib in Resources */ = {isa = PBXBuildFile; fileRef = B3E3B4FC20D463B700DA8C13 /* BMCCategoriesHeader.xib */; };
BB25B1A71FB32767007276FA /* transit_colors.txt in Resources */ = {isa = PBXBuildFile; fileRef = BB25B1A51FB32767007276FA /* transit_colors.txt */; };
BB7626B61E85599C0031D71C /* icudt70l.dat in Resources */ = {isa = PBXBuildFile; fileRef = BB7626B41E8559980031D71C /* icudt70l.dat */; };
@ -1284,7 +1283,6 @@
A630D206207CAA5800976DEA /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = "zh-Hans"; path = "zh-Hans.lproj/Localizable.stringsdict"; sourceTree = "<group>"; };
AA1C7E3D269A2DD600BAADF2 /* EditTrackViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditTrackViewController.swift; sourceTree = "<group>"; };
B33D21AE20DAF9F000BAD749 /* Toast.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Toast.swift; sourceTree = "<group>"; };
B33D21B720E130D000BAD749 /* BookmarksTabViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BookmarksTabViewController.swift; sourceTree = "<group>"; };
B3E3B4FC20D463B700DA8C13 /* BMCCategoriesHeader.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = BMCCategoriesHeader.xib; sourceTree = "<group>"; };
BB25B1A51FB32767007276FA /* transit_colors.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = transit_colors.txt; path = ../../data/transit_colors.txt; sourceTree = "<group>"; };
BB7626B41E8559980031D71C /* icudt70l.dat */ = {isa = PBXFileReference; lastKnownFileType = file; name = icudt70l.dat; path = ../../data/icudt70l.dat; sourceTree = "<group>"; };
@ -3544,7 +3542,6 @@
children = (
47CA68CE2500425900671019 /* BookmarksList */,
3404F4A02028A6C00090E401 /* Categories */,
B33D21B720E130D000BAD749 /* BookmarksTabViewController.swift */,
996D108924E3DBF2002DD0E2 /* BookmarksCoordinator.swift */,
);
path = Bookmarks;
@ -4098,7 +4095,6 @@
34AB663E1FC5AA330078E451 /* RouteManagerTransitioning.swift in Sources */,
993DF0CB23F6BD0600AC231A /* ElevationDetailsRouter.swift in Sources */,
47CA68FC250F99E500671019 /* BookmarksListCellStrategy.swift in Sources */,
B33D21B820E130D000BAD749 /* BookmarksTabViewController.swift in Sources */,
34AB662F1FC5AA330078E451 /* RouteManagerPresentationController.swift in Sources */,
993F5508237C622700545511 /* DeepLinkRouteStrategyAdapter.mm in Sources */,
FA85D43D27958BF500B858E9 /* FaqController.swift in Sources */,