diff --git a/iphone/Maps/Bookmarks/BookmarksVC.mm b/iphone/Maps/Bookmarks/BookmarksVC.mm
index d2ceef907a..1a43f1d4bf 100644
--- a/iphone/Maps/Bookmarks/BookmarksVC.mm
+++ b/iphone/Maps/Bookmarks/BookmarksVC.mm
@@ -357,10 +357,9 @@ using namespace std;
}
- (void)openCategorySettings {
- auto storyboard = [UIStoryboard instance:MWMStoryboardCategorySettings];
- auto settingsController = (CategorySettingsViewController *)[storyboard instantiateInitialViewController];
+ auto settingsController = [[CategorySettingsViewController alloc]
+ initWithBookmarkGroup:[[MWMBookmarksManager sharedManager] categoryWithId:self.categoryId]];
settingsController.delegate = self;
- settingsController.category = [[MWMBookmarksManager sharedManager] categoryWithId:self.categoryId];
[self.navigationController pushViewController:settingsController animated:YES];
}
diff --git a/iphone/Maps/Bookmarks/Categories/BMCView/BMCViewController.swift b/iphone/Maps/Bookmarks/Categories/BMCView/BMCViewController.swift
index 595adba9e3..37504c0d4c 100644
--- a/iphone/Maps/Bookmarks/Categories/BMCView/BMCViewController.swift
+++ b/iphone/Maps/Bookmarks/Categories/BMCView/BMCViewController.swift
@@ -96,11 +96,7 @@ final class BMCViewController: MWMViewController {
}
private func openCategorySettings(category: BookmarkGroup) {
- let storyboard = UIStoryboard.instance(.categorySettings)
- let settingsController = storyboard.instantiateInitialViewController() as! CategorySettingsViewController
- settingsController.category = BookmarksManager.shared().category(withId: category.categoryId)
- settingsController.maxCategoryNameLength = viewModel.maxCategoryNameLength
- settingsController.minCategoryNameLength = viewModel.minCategoryNameLength
+ let settingsController = CategorySettingsViewController(bookmarkGroup: BookmarksManager.shared().category(withId: category.categoryId))
settingsController.delegate = self
MapViewController.topViewController().navigationController?.pushViewController(settingsController,
diff --git a/iphone/Maps/Bookmarks/Categories/Category settings/CategorySettings.storyboard b/iphone/Maps/Bookmarks/Categories/Category settings/CategorySettings.storyboard
deleted file mode 100644
index 316ba26ef6..0000000000
--- a/iphone/Maps/Bookmarks/Categories/Category settings/CategorySettings.storyboard
+++ /dev/null
@@ -1,196 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/iphone/Maps/Bookmarks/Categories/Category settings/CategorySettingsViewController.swift b/iphone/Maps/Bookmarks/Categories/Category settings/CategorySettingsViewController.swift
index b88219321d..5c599d7e70 100644
--- a/iphone/Maps/Bookmarks/Categories/Category settings/CategorySettingsViewController.swift
+++ b/iphone/Maps/Bookmarks/Categories/Category settings/CategorySettingsViewController.swift
@@ -1,39 +1,51 @@
-@objc
-protocol CategorySettingsViewControllerDelegate: AnyObject {
+@objc protocol CategorySettingsViewControllerDelegate: AnyObject {
func categorySettingsController(_ viewController: CategorySettingsViewController,
didEndEditing categoryId: MWMMarkGroupID)
func categorySettingsController(_ viewController: CategorySettingsViewController,
didDelete categoryId: MWMMarkGroupID)
}
-class CategorySettingsViewController: MWMTableViewController {
-
- @objc var category: BookmarkGroup!
- @objc var maxCategoryNameLength: UInt = 60
- @objc var minCategoryNameLength: UInt = 0
+final class CategorySettingsViewController: MWMTableViewController {
+ private enum Sections: Int {
+ case info
+ case description
+ case delete
+ case count
+ }
+
+ private enum InfoSectionRows: Int {
+ case title
+ case sharingOptions
+ }
+
+ private let bookmarkGroup: BookmarkGroup
+ private var noteCell: MWMNoteCell?
private var changesMade = false
-
- private let manager = BookmarksManager.shared()
-
+ private var newName: String?
+ private var newAnnotation: String?
+
@objc weak var delegate: CategorySettingsViewControllerDelegate?
- @IBOutlet private weak var nameTextField: UITextField!
- @IBOutlet private weak var descriptionTextView: UITextView!
- @IBOutlet private weak var descriptionCell: UITableViewCell!
- @IBOutlet private weak var saveButton: UIBarButtonItem!
- @IBOutlet private weak var deleteListButton: UIButton!
-
+ @objc init(bookmarkGroup: BookmarkGroup) {
+ self.bookmarkGroup = bookmarkGroup
+ super.init(style: .grouped)
+ }
+
+ required init?(coder: NSCoder) {
+ fatalError("init(coder:) has not been implemented")
+ }
+
override func viewDidLoad() {
super.viewDidLoad()
-
- assert(category != nil, "must provide category info")
title = L("list_settings")
- deleteListButton.isEnabled = (manager.userCategories().count > 1)
- nameTextField.text = category.title
- descriptionTextView.text = category.detailedAnnotation
-
- navigationItem.rightBarButtonItem = saveButton
+ navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .save,
+ target: self,
+ action: #selector(onSave))
+
+ tableView.registerNib(cell: BookmarkTitleCell.self)
+ tableView.registerNib(cell: MWMButtonCell.self)
+ tableView.registerNib(cell: MWMNoteCell.self)
}
override func viewDidDisappear(_ animated: Bool) {
@@ -42,88 +54,114 @@ class CategorySettingsViewController: MWMTableViewController {
Statistics.logEvent(kStatBookmarkSettingsCancel)
}
}
-
- override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
- switch section {
- case 0:
- // if there are no bookmarks in category, hide 'sharing options' row
- return category.isEmpty ? 1 : 2
- default:
- return 1
- }
+
+ override func numberOfSections(in tableView: UITableView) -> Int {
+ Sections.count.rawValue
}
- @IBAction func deleteListButtonPressed(_ sender: Any) {
- manager.deleteCategory(category.categoryId)
- delegate?.categorySettingsController(self, didDelete: category.categoryId)
+ override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
+ switch Sections(rawValue: section) {
+ case .info:
+ return bookmarkGroup.isEmpty ? 1 : 2
+ case .description, .delete:
+ return 1
+ default:
+ fatalError()
+ }
+ }
+
+ override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
+ switch Sections(rawValue: indexPath.section) {
+ case .info:
+ switch InfoSectionRows(rawValue: indexPath.row) {
+ case .title:
+ let cell = tableView.dequeueReusableCell(cell: BookmarkTitleCell.self, indexPath: indexPath)
+ cell.configure(name: bookmarkGroup.title, delegate: self)
+ return cell
+ case .sharingOptions:
+ let cell = tableView.dequeueDefaultCell(for: indexPath)
+ cell.accessoryType = .disclosureIndicator
+ cell.textLabel?.text = L("sharing_options")
+ return cell
+ default:
+ fatalError()
+ }
+ case .description:
+ if let noteCell = noteCell {
+ return noteCell
+ } else {
+ let cell = tableView.dequeueReusableCell(cell: MWMNoteCell.self, indexPath: indexPath)
+ cell.config(with: self, noteText: bookmarkGroup.detailedAnnotation,
+ placeholder: L("ugc_route_edit_description_hint"))
+ noteCell = cell
+ return cell
+ }
+ case .delete:
+ let cell = tableView.dequeueReusableCell(cell: MWMButtonCell.self, indexPath: indexPath)
+ cell.configure(with: self, title: L("delete_list"))
+ return cell
+ default:
+ fatalError()
+ }
+ }
+
+ override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
+ switch InfoSectionRows(rawValue: indexPath.row) {
+ case .sharingOptions:
+ let sharingViewController = UIStoryboard.instance(.sharing).instantiateInitialViewController()
+ as! BookmarksSharingViewController
+ sharingViewController.category = bookmarkGroup
+ navigationController?.pushViewController(sharingViewController, animated: true)
+ Statistics.logEvent(kStatBookmarkSettingsClick, withParameters: [kStatOption : kStatSharingOptions])
+ break
+ default:
+ break
+ }
+ }
+
+ @objc func onSave() {
+ view.endEditing(true)
+ if let newName = newName, !newName.isEmpty {
+ bookmarkGroup.title = newName
+ changesMade = true
+ }
+
+ if let newAnnotation = newAnnotation, !newAnnotation.isEmpty {
+ bookmarkGroup.detailedAnnotation = newAnnotation
+ changesMade = true
+ }
+
+ delegate?.categorySettingsController(self, didEndEditing: bookmarkGroup.categoryId)
+ Statistics.logEvent(kStatBookmarkSettingsConfirm)
+ }
+}
+
+extension CategorySettingsViewController: BookmarkTitleCellDelegate {
+ func didFinishEditingTitle(_ title: String) {
+ newName = title
+ }
+}
+
+extension CategorySettingsViewController: MWMNoteCellDelegate {
+ func cell(_ cell: MWMNoteCell, didChangeSizeAndText text: String) {
+ UIView.setAnimationsEnabled(false)
+ tableView.refresh()
+ UIView.setAnimationsEnabled(true)
+ tableView.scrollToRow(at: IndexPath(item: 0, section: Sections.description.rawValue),
+ at: .bottom,
+ animated: true)
+ }
+
+ func cell(_ cell: MWMNoteCell, didFinishEditingWithText text: String) {
+ newAnnotation = text
+ }
+}
+
+extension CategorySettingsViewController: MWMButtonCellDelegate {
+ func cellDidPressButton(_ cell: UITableViewCell) {
+ BookmarksManager.shared().deleteCategory(bookmarkGroup.categoryId)
+ delegate?.categorySettingsController(self, didDelete: bookmarkGroup.categoryId)
Statistics.logEvent(kStatBookmarkSettingsClick,
withParameters: [kStatOption : kStatDelete])
}
-
- override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
- if let destinationVC = segue.destination as? BookmarksSharingViewController {
- destinationVC.category = category
- Statistics.logEvent(kStatBookmarkSettingsClick,
- withParameters: [kStatOption : kStatSharingOptions])
- }
- }
-
- @IBAction func onSave(_ sender: Any) {
- guard let newName = nameTextField.text, !newName.isEmpty else {
- assert(false)
- return
- }
-
- category.title = newName
- category.detailedAnnotation = descriptionTextView.text
- changesMade = true
- delegate?.categorySettingsController(self, didEndEditing: category.categoryId)
- Statistics.logEvent(kStatBookmarkSettingsConfirm)
- }
-
- override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
- return UITableView.automaticDimension
- }
-}
-
-extension CategorySettingsViewController: UITextViewDelegate {
- func textViewDidChange(_ textView: UITextView) {
- let size = textView.bounds.size
- let newSize = textView.sizeThatFits(CGSize(width: size.width,
- height: CGFloat.greatestFiniteMagnitude))
-
- // Resize the cell only when cell's size is changed
- if abs(size.height - newSize.height) >= 1 {
- UIView.setAnimationsEnabled(false)
- tableView.beginUpdates()
- tableView.endUpdates()
- UIView.setAnimationsEnabled(true)
-
- if let thisIndexPath = tableView.indexPath(for: descriptionCell) {
- tableView?.scrollToRow(at: thisIndexPath, at: .bottom, animated: false)
- }
- }
- }
-
- func textViewDidBeginEditing(_ textView: UITextView) {
- Statistics.logEvent(kStatBookmarkSettingsClick,
- withParameters: [kStatOption : kStatAddDescription])
- }
-}
-
-extension CategorySettingsViewController: UITextFieldDelegate {
- func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange,
- replacementString string: String) -> Bool {
- let currentText = textField.text ?? ""
- guard let stringRange = Range(range, in: currentText) else { return false }
- let updatedText = currentText.replacingCharacters(in: stringRange, with: string)
- saveButton.isEnabled = updatedText.count > minCategoryNameLength
- if updatedText.count > maxCategoryNameLength { return false }
- return true
- }
-
- func textFieldShouldClear(_ textField: UITextField) -> Bool {
- saveButton.isEnabled = false
- return true
- }
}
diff --git a/iphone/Maps/Maps.xcodeproj/project.pbxproj b/iphone/Maps/Maps.xcodeproj/project.pbxproj
index f6115b3a6f..54826c455b 100644
--- a/iphone/Maps/Maps.xcodeproj/project.pbxproj
+++ b/iphone/Maps/Maps.xcodeproj/project.pbxproj
@@ -11,7 +11,6 @@
1DFA2F6A20D3B57400FB2C66 /* UIColor+PartnerColor.m in Sources */ = {isa = PBXBuildFile; fileRef = 1DFA2F6920D3B57400FB2C66 /* UIColor+PartnerColor.m */; };
3304306D21D4EAFB00317CA3 /* SearchCategoryCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3304306C21D4EAFB00317CA3 /* SearchCategoryCell.swift */; };
33046832219C57180041F3A8 /* CategorySettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33046831219C57180041F3A8 /* CategorySettingsViewController.swift */; };
- 33046836219C5A4E0041F3A8 /* CategorySettings.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 33046835219C5A4E0041F3A8 /* CategorySettings.storyboard */; };
330473EA21F7440C00DC4AEA /* MWMHotelParams.mm in Sources */ = {isa = PBXBuildFile; fileRef = 330473E921F7440C00DC4AEA /* MWMHotelParams.mm */; };
331630D12191D74B00BB91A9 /* TagSectionHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331630D02191D74B00BB91A9 /* TagSectionHeaderView.swift */; };
3358607E217632A2006D11F2 /* BookmarksSharingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3358607D217632A2006D11F2 /* BookmarksSharingViewController.swift */; };
@@ -324,7 +323,7 @@
470F5A7D2189BB2F00754295 /* PaidRoutePurchase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 470F5A7C2189BB2F00754295 /* PaidRoutePurchase.swift */; };
470F5A7F2189C30800754295 /* InAppPurchase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 470F5A7E2189C30800754295 /* InAppPurchase.swift */; };
4715273524907F8200E91BBA /* BookmarkColorViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4715273424907F8200E91BBA /* BookmarkColorViewController.swift */; };
- 471527372491C20500E91BBA /* BookmarkGroupViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 471527362491C20500E91BBA /* BookmarkGroupViewController.swift */; };
+ 471527372491C20500E91BBA /* SelectBookmarkGroupViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 471527362491C20500E91BBA /* SelectBookmarkGroupViewController.swift */; };
4716EABA21A325310029B886 /* IPaidRouteStatistics.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4716EAB921A325310029B886 /* IPaidRouteStatistics.swift */; };
4716EAC121A6E0570029B886 /* BookmarksVC.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4716EAC021A6E0570029B886 /* BookmarksVC.xib */; };
4719A643219CB61D009F9AA7 /* BillingPendingTransaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4719A642219CB61D009F9AA7 /* BillingPendingTransaction.swift */; };
@@ -933,7 +932,6 @@
29B97316FDCFA39411CA2CEA /* main.mm */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; path = main.mm; sourceTree = ""; };
3304306C21D4EAFB00317CA3 /* SearchCategoryCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchCategoryCell.swift; sourceTree = ""; };
33046831219C57180041F3A8 /* CategorySettingsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CategorySettingsViewController.swift; sourceTree = ""; };
- 33046835219C5A4E0041F3A8 /* CategorySettings.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = CategorySettings.storyboard; sourceTree = ""; };
330473E821F7440C00DC4AEA /* MWMHotelParams.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MWMHotelParams.h; sourceTree = ""; };
330473E921F7440C00DC4AEA /* MWMHotelParams.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMHotelParams.mm; sourceTree = ""; };
331630D02191D74B00BB91A9 /* TagSectionHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TagSectionHeaderView.swift; sourceTree = ""; };
@@ -1440,7 +1438,7 @@
470F5A7C2189BB2F00754295 /* PaidRoutePurchase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PaidRoutePurchase.swift; sourceTree = ""; };
470F5A7E2189C30800754295 /* InAppPurchase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InAppPurchase.swift; sourceTree = ""; };
4715273424907F8200E91BBA /* BookmarkColorViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BookmarkColorViewController.swift; sourceTree = ""; };
- 471527362491C20500E91BBA /* BookmarkGroupViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BookmarkGroupViewController.swift; sourceTree = ""; };
+ 471527362491C20500E91BBA /* SelectBookmarkGroupViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectBookmarkGroupViewController.swift; sourceTree = ""; };
4716EAB921A325310029B886 /* IPaidRouteStatistics.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IPaidRouteStatistics.swift; sourceTree = ""; };
4716EAC021A6E0570029B886 /* BookmarksVC.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = BookmarksVC.xib; sourceTree = ""; };
4716EACA21B01C270029B886 /* MWMUGCReviewSource.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MWMUGCReviewSource.h; sourceTree = ""; };
@@ -2425,7 +2423,6 @@
isa = PBXGroup;
children = (
33046831219C57180041F3A8 /* CategorySettingsViewController.swift */,
- 33046835219C5A4E0041F3A8 /* CategorySettings.storyboard */,
);
path = "Category settings";
sourceTree = "";
@@ -4491,6 +4488,7 @@
471A7BBD2481A3D000A0D4C1 /* EditBookmarkViewController.swift */,
471A7BC3248471BE00A0D4C1 /* BookmarkUIUtils.swift */,
4715273424907F8200E91BBA /* BookmarkColorViewController.swift */,
+ 471527362491C20500E91BBA /* SelectBookmarkGroupViewController.swift */,
);
path = EditBookmark;
sourceTree = "";
@@ -4928,7 +4926,6 @@
BB87BF8922FAF1CA008A8A72 /* TracksSection.mm */,
BB87BF8B22FAF3B8008A8A72 /* InfoSection.h */,
BB87BF8C22FAF435008A8A72 /* InfoSection.mm */,
- 471527362491C20500E91BBA /* BookmarkGroupViewController.swift */,
);
path = Bookmarks;
sourceTree = "";
@@ -5167,7 +5164,6 @@
F6E407D41FC4722F001F7821 /* MWMDiscoveryController.xib in Resources */,
F6E2FE7F1E097BA00083EBEC /* MWMPlacePageOpeningHoursCell.xib in Resources */,
34AB66711FC5AA330078E451 /* TransportTransitTrain.xib in Resources */,
- 33046836219C5A4E0041F3A8 /* CategorySettings.storyboard in Resources */,
34BBD6471F82649D0070CA50 /* GoogleSignIn.bundle in Resources */,
47C8789A22DF622400A772DA /* SubscriptionFailViewController.xib in Resources */,
47DF72BB225356BF0004AB10 /* DrivingOptions.storyboard in Resources */,
@@ -5493,7 +5489,7 @@
99A906DE23F6F7030005872B /* PlacePageBookmarkViewController.swift in Sources */,
F6791B141C43DF0B007A8A6E /* MWMStartButton.m in Sources */,
9977E6A12480E1EE0073780C /* BottomMenuLayerButton.swift in Sources */,
- 471527372491C20500E91BBA /* BookmarkGroupViewController.swift in Sources */,
+ 471527372491C20500E91BBA /* SelectBookmarkGroupViewController.swift in Sources */,
479D306522C664CE00D18278 /* MWMDownloadBannerViewController.m in Sources */,
F6E2FEDF1E097BA00083EBEC /* MWMSearchManager+Layout.m in Sources */,
F64D9CA01C899C350063FA30 /* MWMEditorViralAlert.mm in Sources */,
diff --git a/iphone/Maps/UI/EditBookmark/BookmarkUIUtils.swift b/iphone/Maps/UI/EditBookmark/BookmarkUIUtils.swift
index 1a28d83fa9..0a5c263ae3 100644
--- a/iphone/Maps/UI/EditBookmark/BookmarkUIUtils.swift
+++ b/iphone/Maps/UI/EditBookmark/BookmarkUIUtils.swift
@@ -42,7 +42,7 @@ fileprivate func titleForBookmarkColor(_ color: BookmarkColor) -> String {
}
}
-func localizedTitleForBookmarkColor(_ color: BookmarkColor) -> String {
+fileprivate func localizedTitleForBookmarkColor(_ color: BookmarkColor) -> String {
L(titleForBookmarkColor(color))
}
@@ -50,7 +50,7 @@ fileprivate func rgbColor(_ r: CGFloat, _ g: CGFloat, _ b: CGFloat) -> UIColor {
UIColor(red: r / 255, green: g / 255, blue: b / 255, alpha: 0.8)
}
-func uiColorForBookmarkColor(_ color: BookmarkColor) -> UIColor {
+fileprivate func uiColorForBookmarkColor(_ color: BookmarkColor) -> UIColor {
switch color {
case .red: return rgbColor(229, 27, 35);
case .pink: return rgbColor(255, 65, 130);
diff --git a/iphone/Maps/UI/EditBookmark/EditBookmarkViewController.swift b/iphone/Maps/UI/EditBookmark/EditBookmarkViewController.swift
index 6d658baa9e..4849b06aa4 100644
--- a/iphone/Maps/UI/EditBookmark/EditBookmarkViewController.swift
+++ b/iphone/Maps/UI/EditBookmark/EditBookmarkViewController.swift
@@ -117,7 +117,7 @@ final class EditBookmarkViewController: MWMTableViewController {
colorViewController.delegate = self
navigationController?.pushViewController(colorViewController, animated: true)
case .bookmarkGroup:
- let groupViewController = BookmarkGroupViewController(groupName: bookmarkGroupTitle ?? "", groupId: bookmarkGroupId)
+ let groupViewController = SelectBookmarkGroupViewController(groupName: bookmarkGroupTitle ?? "", groupId: bookmarkGroupId)
groupViewController.delegate = self
navigationController?.pushViewController(groupViewController, animated: true)
default:
@@ -144,8 +144,6 @@ final class EditBookmarkViewController: MWMTableViewController {
extension EditBookmarkViewController: BookmarkTitleCellDelegate {
func didFinishEditingTitle(_ title: String) {
bookmarkTitle = title
- tableView.reloadRows(at: [IndexPath(row: InfoSectionRows.title.rawValue, section: Sections.info.rawValue)],
- with: .none)
}
}
@@ -182,8 +180,8 @@ extension EditBookmarkViewController: BookmarkColorViewControllerDelegate {
}
}
-extension EditBookmarkViewController: BookmarkGroupViewControllerDelegate {
- func bookmarkGroupViewController(_ viewController: BookmarkGroupViewController,
+extension EditBookmarkViewController: SelectBookmarkGroupViewControllerDelegate {
+ func bookmarkGroupViewController(_ viewController: SelectBookmarkGroupViewController,
didSelect groupTitle: String,
groupId: MWMMarkGroupID) {
goBack()
diff --git a/iphone/Maps/Bookmarks/BookmarkGroupViewController.swift b/iphone/Maps/UI/EditBookmark/SelectBookmarkGroupViewController.swift
similarity index 90%
rename from iphone/Maps/Bookmarks/BookmarkGroupViewController.swift
rename to iphone/Maps/UI/EditBookmark/SelectBookmarkGroupViewController.swift
index 6c84557e97..b07f99df01 100644
--- a/iphone/Maps/Bookmarks/BookmarkGroupViewController.swift
+++ b/iphone/Maps/UI/EditBookmark/SelectBookmarkGroupViewController.swift
@@ -1,19 +1,19 @@
import UIKit
-protocol BookmarkGroupViewControllerDelegate: AnyObject {
- func bookmarkGroupViewController(_ viewController: BookmarkGroupViewController,
+protocol SelectBookmarkGroupViewControllerDelegate: AnyObject {
+ func bookmarkGroupViewController(_ viewController: SelectBookmarkGroupViewController,
didSelect groupTitle: String,
groupId: MWMMarkGroupID)
}
-final class BookmarkGroupViewController: MWMTableViewController {
+final class SelectBookmarkGroupViewController: MWMTableViewController {
private enum Sections: Int {
case addGroup
case groups
case count
}
- weak var delegate: BookmarkGroupViewControllerDelegate?
+ weak var delegate: SelectBookmarkGroupViewControllerDelegate?
private let groupName: String
private let groupId: MWMMarkGroupID
private let bookmarkGroups = BookmarksManager.shared().userCategories()