diff --git a/iphone/Maps/Bookmarks/Categories/BMCView/BMCViewController.swift b/iphone/Maps/Bookmarks/Categories/BMCView/BMCViewController.swift index c8e85cf876..b826c5a96c 100644 --- a/iphone/Maps/Bookmarks/Categories/BMCView/BMCViewController.swift +++ b/iphone/Maps/Bookmarks/Categories/BMCView/BMCViewController.swift @@ -53,8 +53,7 @@ final class BMCViewController: MWMViewController { private func createNewCategory() { alertController.presentCreateBookmarkCategoryAlert(withMaxCharacterNum: viewModel.maxCategoryNameLength, - minCharacterNum: viewModel.minCategoryNameLength, - isNewCategory: true) + minCharacterNum: viewModel.minCategoryNameLength) { [weak viewModel] (name: String!) -> Bool in guard let model = viewModel else { return false } if model.checkCategory(name: name) { @@ -67,7 +66,7 @@ final class BMCViewController: MWMViewController { } private func shareCategoryFile(category: BMCCategory, anchor: UIView) { - viewModel.shareCategory(category: category) { + viewModel.shareCategoryFile(category: category) { switch $0 { case let .success(url): let shareController = MWMActivityViewController.share(for: url, diff --git a/iphone/Maps/Bookmarks/Categories/BMCViewModel/BMCDefaultViewModel.swift b/iphone/Maps/Bookmarks/Categories/BMCViewModel/BMCDefaultViewModel.swift index 59d9bf4d2a..1c5cceebdf 100644 --- a/iphone/Maps/Bookmarks/Categories/BMCViewModel/BMCDefaultViewModel.swift +++ b/iphone/Maps/Bookmarks/Categories/BMCViewModel/BMCDefaultViewModel.swift @@ -178,7 +178,7 @@ extension BMCDefaultViewModel: BMCViewModel { return manager.checkCategoryName(name) } - func shareCategory(category: BMCCategory, handler: @escaping onPreparedToShareHandler) { + func shareCategoryFile(category: BMCCategory, handler: @escaping onPreparedToShareHandler) { onPreparedToShareCategory = handler manager.shareCategory(category.identifier) } diff --git a/iphone/Maps/Bookmarks/Categories/BMCViewModel/BMCViewModel.swift b/iphone/Maps/Bookmarks/Categories/BMCViewModel/BMCViewModel.swift index b73d0747bc..7c8a13255c 100644 --- a/iphone/Maps/Bookmarks/Categories/BMCViewModel/BMCViewModel.swift +++ b/iphone/Maps/Bookmarks/Categories/BMCViewModel/BMCViewModel.swift @@ -35,7 +35,7 @@ protocol BMCViewModel: AnyObject { func checkCategory(name: String) -> Bool typealias onPreparedToShareHandler = (BMCShareCategoryStatus) -> Void - func shareCategory(category: BMCCategory, handler: @escaping onPreparedToShareHandler) + func shareCategoryFile(category: BMCCategory, handler: @escaping onPreparedToShareHandler) func finishShareCategory() func pendingPermission(isPending: Bool) diff --git a/iphone/Maps/Bookmarks/Categories/Categories/BMCCategoryCell.swift b/iphone/Maps/Bookmarks/Categories/Categories/BMCCategoryCell.swift index b2aaeb4c4f..343855638e 100644 --- a/iphone/Maps/Bookmarks/Categories/Categories/BMCCategoryCell.swift +++ b/iphone/Maps/Bookmarks/Categories/Categories/BMCCategoryCell.swift @@ -20,10 +20,10 @@ final class BMCCategoryCell: MWMTableViewCell { } } - @IBOutlet private weak var more: UIButton! { + @IBOutlet private weak var moreButton: UIButton! { didSet { - more.tintColor = .blackSecondaryText() - more.setImage(#imageLiteral(resourceName: "ic24PxMore"), for: .normal) + moreButton.tintColor = .blackSecondaryText() + moreButton.setImage(#imageLiteral(resourceName: "ic24PxMore"), for: .normal) } } @@ -52,7 +52,7 @@ final class BMCCategoryCell: MWMTableViewCell { @IBAction private func moreAction() { guard let category = category else { return } - delegate?.moreAction(category: category, anchor: more) + delegate?.moreAction(category: category, anchor: moreButton) } } @@ -75,11 +75,11 @@ extension BMCCategoryCell: BMCCategoryObserver { case .other: assert(false, "We don't expect category with .other status here") accessImageView.image = nil - accessString = L("") + accessString = "" } let placesString = String(format: L("bookmarks_places"), category.count) - subtitleLabel.text = "\(accessString) • \(placesString)" + subtitleLabel.text = accessString.count > 0 ? "\(accessString) • \(placesString)" : placesString if category.isVisible { visibility.tintColor = .linkBlue() diff --git a/iphone/Maps/Bookmarks/Categories/Categories/BMCCategoryCell.xib b/iphone/Maps/Bookmarks/Categories/Categories/BMCCategoryCell.xib index 237ca66ae2..25b3aff065 100644 --- a/iphone/Maps/Bookmarks/Categories/Categories/BMCCategoryCell.xib +++ b/iphone/Maps/Bookmarks/Categories/Categories/BMCCategoryCell.xib @@ -1,10 +1,6 @@ - - - - @@ -78,7 +74,7 @@ - + diff --git a/iphone/Maps/Bookmarks/SelectSetVC.mm b/iphone/Maps/Bookmarks/SelectSetVC.mm index 2569dc88ff..86964a7eb7 100644 --- a/iphone/Maps/Bookmarks/SelectSetVC.mm +++ b/iphone/Maps/Bookmarks/SelectSetVC.mm @@ -99,7 +99,6 @@ { [self.alertController presentCreateBookmarkCategoryAlertWithMaxCharacterNum:60 minCharacterNum:0 - isNewCategory:YES callback:^BOOL (NSString * name) { if (![[MWMBookmarksManager sharedManager] checkCategoryName:name]) diff --git a/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.h b/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.h index 2690afae30..6e7951c7b9 100644 --- a/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.h +++ b/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.h @@ -46,7 +46,6 @@ - (void)presentInfoAlert:(nonnull NSString *)title text:(nonnull NSString *)text; - (void)presentCreateBookmarkCategoryAlertWithMaxCharacterNum:(NSUInteger)max minCharacterNum:(NSUInteger)min - isNewCategory:(BOOL)isNewCategory callback:(nonnull MWMCheckStringBlock)callback; - (void)presentConvertBookmarksAlertWithCount:(NSUInteger)count block:(nonnull MWMVoidBlock)block; diff --git a/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.mm b/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.mm index 2e23de0d50..235e38e1de 100644 --- a/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.mm +++ b/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.mm @@ -218,13 +218,11 @@ static NSString * const kAlertControllerNibIdentifier = @"MWMAlertViewController - (void)presentCreateBookmarkCategoryAlertWithMaxCharacterNum:(NSUInteger)max minCharacterNum:(NSUInteger)min - isNewCategory:(BOOL)isNewCategory callback:(nonnull MWMCheckStringBlock)callback { auto alert = static_cast([MWMAlert createBookmarkCategoryAlertWithMaxCharacterNum:max minCharacterNum:min - isNewCategory:isNewCategory callback:callback]); [self displayAlert:alert]; dispatch_async(dispatch_get_main_queue(), ^{ diff --git a/iphone/Maps/Classes/CustomAlert/BaseAlert/MWMAlert.h b/iphone/Maps/Classes/CustomAlert/BaseAlert/MWMAlert.h index be19d0c195..dfa2baeb75 100644 --- a/iphone/Maps/Classes/CustomAlert/BaseAlert/MWMAlert.h +++ b/iphone/Maps/Classes/CustomAlert/BaseAlert/MWMAlert.h @@ -37,7 +37,6 @@ + (MWMAlert *)infoAlert:(NSString *)title text:(NSString *)text; + (MWMAlert *)createBookmarkCategoryAlertWithMaxCharacterNum:(NSUInteger)max minCharacterNum:(NSUInteger)min - isNewCategory:(BOOL)isNewCategory callback:(MWMCheckStringBlock)callback; + (MWMAlert *)convertBookmarksAlertWithCount:(NSUInteger)count block:(MWMVoidBlock)block; + (MWMAlert *)spinnerAlertWithTitle:(NSString *)title cancel:(MWMVoidBlock)cancel; diff --git a/iphone/Maps/Classes/CustomAlert/BaseAlert/MWMAlert.mm b/iphone/Maps/Classes/CustomAlert/BaseAlert/MWMAlert.mm index 3412604c44..44e00e34c9 100644 --- a/iphone/Maps/Classes/CustomAlert/BaseAlert/MWMAlert.mm +++ b/iphone/Maps/Classes/CustomAlert/BaseAlert/MWMAlert.mm @@ -161,12 +161,10 @@ + (MWMAlert *)createBookmarkCategoryAlertWithMaxCharacterNum:(NSUInteger)max minCharacterNum:(NSUInteger)min - isNewCategory:(BOOL)isNewCategory callback:(MWMCheckStringBlock)callback { return [MWMBCCreateCategoryAlert alertWithMaxCharachersNum:max minCharactersNum:min - isNewCategory:isNewCategory callback:callback]; } diff --git a/iphone/Maps/Classes/CustomAlert/CreateBookmarkCategory/BCCreateCategoryAlert.swift b/iphone/Maps/Classes/CustomAlert/CreateBookmarkCategory/BCCreateCategoryAlert.swift index 7b3ba0b869..b6ad6b981a 100644 --- a/iphone/Maps/Classes/CustomAlert/CreateBookmarkCategory/BCCreateCategoryAlert.swift +++ b/iphone/Maps/Classes/CustomAlert/CreateBookmarkCategory/BCCreateCategoryAlert.swift @@ -25,7 +25,6 @@ final class BCCreateCategoryAlert: MWMAlert { @objc static func alert(maxCharachersNum: UInt, minCharactersNum: UInt, - isNewCategory: Bool, callback: @escaping MWMCheckStringBlock) -> BCCreateCategoryAlert? { guard let alert = Bundle.main.loadNibNamed(className(), owner: nil, options: nil)?.first as? BCCreateCategoryAlert else { @@ -33,8 +32,8 @@ final class BCCreateCategoryAlert: MWMAlert { return nil } - alert.titleLabel.text = L(isNewCategory ? "bookmarks_create_new_group" : "rename") - let text = L(isNewCategory ? "create" : "ok").capitalized + alert.titleLabel.text = L("bookmarks_create_new_group") + let text = L("create").capitalized for s in [.normal, .highlighted, .disabled] as [UIControlState] { alert.rightButton.setTitle(text, for: s) }