diff --git a/iphone/Maps/Bookmarks/BookmarksVC.mm b/iphone/Maps/Bookmarks/BookmarksVC.mm index bea0874b8e..c05611dec4 100644 --- a/iphone/Maps/Bookmarks/BookmarksVC.mm +++ b/iphone/Maps/Bookmarks/BookmarksVC.mm @@ -448,7 +448,7 @@ CGFloat const kPinDiameter = 18.0f; auto actionSheet = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet]; - [actionSheet addAction:[UIAlertAction actionWithTitle:L(@"search_show_on_map").capitalizedString + [actionSheet addAction:[UIAlertAction actionWithTitle:L(@"search_show_on_map") style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { @@ -456,7 +456,7 @@ CGFloat const kPinDiameter = 18.0f; [Statistics logEvent:kStatBookmarksListItemMoreClick withParameters:@{kStatOption : kStatViewOnMap}]; }]]; - [actionSheet addAction:[UIAlertAction actionWithTitle:L(@"list_settings").capitalizedString + [actionSheet addAction:[UIAlertAction actionWithTitle:L(@"list_settings") style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { @@ -464,7 +464,7 @@ CGFloat const kPinDiameter = 18.0f; [Statistics logEvent:kStatBookmarksListItemMoreClick withParameters:@{kStatOption : kStatSettings}]; }]]; - [actionSheet addAction:[UIAlertAction actionWithTitle:L(@"export_file").capitalizedString + [actionSheet addAction:[UIAlertAction actionWithTitle:L(@"export_file") style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { @@ -472,7 +472,7 @@ CGFloat const kPinDiameter = 18.0f; [Statistics logEvent:kStatBookmarksListItemMoreClick withParameters:@{kStatOption : kStatSendAsFile}]; }]]; - auto deleteAction = [UIAlertAction actionWithTitle:L(@"delete_list").capitalizedString + auto deleteAction = [UIAlertAction actionWithTitle:L(@"delete_list") style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) { @@ -483,7 +483,7 @@ CGFloat const kPinDiameter = 18.0f; deleteAction.enabled = [[MWMBookmarksManager sharedManager] groupsIdList].count > 1; [actionSheet addAction:deleteAction]; - [actionSheet addAction:[UIAlertAction actionWithTitle:L(@"cancel").capitalizedString + [actionSheet addAction:[UIAlertAction actionWithTitle:L(@"cancel") style:UIAlertActionStyleCancel handler:nil]]; diff --git a/iphone/Maps/Bookmarks/Categories/BMCView/BMCViewController.swift b/iphone/Maps/Bookmarks/Categories/BMCView/BMCViewController.swift index 223884444f..de53c6796a 100644 --- a/iphone/Maps/Bookmarks/Categories/BMCView/BMCViewController.swift +++ b/iphone/Maps/Bookmarks/Categories/BMCView/BMCViewController.swift @@ -123,25 +123,25 @@ final class BMCViewController: MWMViewController { ppc.sourceRect = anchor.bounds } - let settings = L("list_settings").capitalized + let settings = L("list_settings") actionSheet.addAction(UIAlertAction(title: settings, style: .default, handler: { _ in self.openCategorySettings(category: category) Statistics.logEvent(kStatBookmarksListSettingsClick, withParameters: [kStatOption : kStatListSettings]) })) - let showHide = L(category.isVisible ? "hide_from_map" : "zoom_to_country").capitalized + let showHide = L(category.isVisible ? "hide_from_map" : "zoom_to_country") actionSheet.addAction(UIAlertAction(title: showHide, style: .default, handler: { _ in self.visibilityAction(category: category) Statistics.logEvent(kStatBookmarksListSettingsClick, withParameters: [kStatOption : kStatMakeInvisibleOnMap]) })) - let exportFile = L("export_file").capitalized + let exportFile = L("export_file") actionSheet.addAction(UIAlertAction(title: exportFile, style: .default, handler: { _ in self.shareCategoryFile(category: category, anchor: anchor) Statistics.logEvent(kStatBookmarksListSettingsClick, withParameters: [kStatOption : kStatSendAsFile]) })) - let share = L("sharing_options").capitalized + let share = L("sharing_options") let shareAction = UIAlertAction(title: share, style: .default, handler: { _ in self.shareCategory(category: category, anchor: anchor) Statistics.logEvent(kStatBookmarksListSettingsClick, @@ -149,7 +149,7 @@ final class BMCViewController: MWMViewController { }) shareAction.isEnabled = MWMBookmarksManager.shared().isCategoryNotEmpty(category.identifier) actionSheet.addAction(shareAction) - let delete = L("delete_list").capitalized + let delete = L("delete_list") let deleteAction = UIAlertAction(title: delete, style: .destructive, handler: { [viewModel] _ in viewModel!.deleteCategory(category: category) Statistics.logEvent(kStatBookmarksListSettingsClick, @@ -157,7 +157,7 @@ final class BMCViewController: MWMViewController { }) deleteAction.isEnabled = (viewModel.numberOfRows(section: .categories) > 1) actionSheet.addAction(deleteAction) - let cancel = L("cancel").capitalized + let cancel = L("cancel") actionSheet.addAction(UIAlertAction(title: cancel, style: .cancel, handler: nil)) present(actionSheet, animated: true, completion: nil) diff --git a/iphone/Maps/Bookmarks/Categories/Category settings/CategorySettings.storyboard b/iphone/Maps/Bookmarks/Categories/Category settings/CategorySettings.storyboard index 00d8c99b1d..973688e057 100644 --- a/iphone/Maps/Bookmarks/Categories/Category settings/CategorySettings.storyboard +++ b/iphone/Maps/Bookmarks/Categories/Category settings/CategorySettings.storyboard @@ -67,22 +67,11 @@ - - - - + @@ -183,7 +172,6 @@ - diff --git a/iphone/Maps/Bookmarks/Categories/Category settings/CategorySettingsViewController.swift b/iphone/Maps/Bookmarks/Categories/Category settings/CategorySettingsViewController.swift index c63f96fda1..e3f8fad042 100644 --- a/iphone/Maps/Bookmarks/Categories/Category settings/CategorySettingsViewController.swift +++ b/iphone/Maps/Bookmarks/Categories/Category settings/CategorySettingsViewController.swift @@ -19,7 +19,6 @@ class CategorySettingsViewController: MWMTableViewController { @objc weak var delegate: CategorySettingsViewControllerDelegate? - @IBOutlet private weak var accessStatusLabel: UILabel! @IBOutlet private weak var nameTextField: UITextField! @IBOutlet private weak var descriptionTextView: UITextView! @IBOutlet private weak var descriptionCell: UITableViewCell! @@ -29,14 +28,13 @@ class CategorySettingsViewController: MWMTableViewController { override func viewDidLoad() { super.viewDidLoad() - title = L("settings") + title = L("list_settings") assert(categoryId != MWMFrameworkHelper.invalidCategoryId(), "must provide category info") deleteListButton.isEnabled = (manager.groupsIdList().count > 1) nameTextField.text = manager.getCategoryName(categoryId) descriptionTextView.text = manager.getCategoryDescription(categoryId) - configureAccessStatus() navigationItem.rightBarButtonItem = saveButton } @@ -58,19 +56,6 @@ class CategorySettingsViewController: MWMTableViewController { } } - func configureAccessStatus() { - switch MWMBookmarksManager.shared().getCategoryAccessStatus(categoryId) { - case .local: - accessStatusLabel.text = L("not_shared") - case .public: - accessStatusLabel.text = L("bookmarks_public_access") - case .private: - accessStatusLabel.text = L("bookmarks_link_access") - case .other: - assert(false, "it's not ok that this category has such access status") - } - } - @IBAction func deleteListButtonPressed(_ sender: Any) { guard categoryId != MWMFrameworkHelper.invalidCategoryId() else { assert(false) @@ -86,7 +71,6 @@ class CategorySettingsViewController: MWMTableViewController { override func prepare(for segue: UIStoryboardSegue, sender: Any?) { if let destinationVC = segue.destination as? BookmarksSharingViewController { destinationVC.categoryId = categoryId - destinationVC.delegate = self Statistics.logEvent(kStatBookmarkSettingsClick, withParameters: [kStatOption : kStatSharingOptions]) } @@ -112,12 +96,6 @@ class CategorySettingsViewController: MWMTableViewController { } } -extension CategorySettingsViewController: BookmarksSharingViewControllerDelegate { - func didShareCategory() { - configureAccessStatus() - } -} - extension CategorySettingsViewController: UITextViewDelegate { func textViewDidChange(_ textView: UITextView) { let size = textView.bounds.size diff --git a/iphone/Maps/Bookmarks/Categories/Sharing/BookmarksSharingViewController.swift b/iphone/Maps/Bookmarks/Categories/Sharing/BookmarksSharingViewController.swift index 527c516a3f..a4332b5f72 100644 --- a/iphone/Maps/Bookmarks/Categories/Sharing/BookmarksSharingViewController.swift +++ b/iphone/Maps/Bookmarks/Categories/Sharing/BookmarksSharingViewController.swift @@ -301,9 +301,14 @@ extension BookmarksSharingViewController: UITextViewDelegate { extension BookmarksSharingViewController: UploadActionCellDelegate { func cellDidPressShareButton(_ cell: UploadActionCell) { + guard let url = categoryUrl else { + assert(false, "must provide guide url") + return + } + Statistics.logEvent(kStatSharingOptionsClick, withParameters: [kStatItem : kStatCopyLink]) - let message = L("share_bookmarks_email_body") - let shareController = MWMActivityViewController.share(for: categoryUrl, message: message) { + let message = String(coreFormat: L("share_bookmarks_email_body_link"), arguments: [url.absoluteString]) + let shareController = MWMActivityViewController.share(for: nil, message: message) { _, success, _, _ in if success { Statistics.logEvent(kStatSharingLinkSuccess, withParameters: [kStatFrom : kStatSharingOptions]) diff --git a/iphone/Maps/Bookmarks/Categories/Sharing/EditOnWebViewController.swift b/iphone/Maps/Bookmarks/Categories/Sharing/EditOnWebViewController.swift index db2e6de127..28330189dc 100644 --- a/iphone/Maps/Bookmarks/Categories/Sharing/EditOnWebViewController.swift +++ b/iphone/Maps/Bookmarks/Categories/Sharing/EditOnWebViewController.swift @@ -25,8 +25,8 @@ final class EditOnWebViewController: MWMViewController { } Statistics.logEvent(kStatEditOnWebClick, withParameters: [kStatItem : kStatCopyLink]) - let message = L("share_bookmarks_email_body") - let shareController = MWMActivityViewController.share(for: guide, message: message) { + let message = String(coreFormat: L("share_bookmarks_email_body_link"), arguments: [guide.absoluteString]) + let shareController = MWMActivityViewController.share(for: nil, message: message) { [weak self] _, success, _, _ in if success { Statistics.logEvent(kStatSharingLinkSuccess, withParameters: [kStatFrom : kStatEditOnWeb]) diff --git a/iphone/Maps/Classes/Share/MWMActivityViewController.h b/iphone/Maps/Classes/Share/MWMActivityViewController.h index 416896b5da..dda9a0c26a 100644 --- a/iphone/Maps/Classes/Share/MWMActivityViewController.h +++ b/iphone/Maps/Classes/Share/MWMActivityViewController.h @@ -8,7 +8,7 @@ + (instancetype)shareControllerForPlacePageObject:(id)object; -+ (instancetype)shareControllerForURL:(NSURL *)url ++ (instancetype)shareControllerForURL:(NSURL * _Nullable)url message:(NSString *)message completionHandler: (_Nullable UIActivityViewControllerCompletionWithItemsHandler)completionHandler; diff --git a/iphone/Maps/Classes/Share/MWMActivityViewController.mm b/iphone/Maps/Classes/Share/MWMActivityViewController.mm index 128e4dfe7e..feaf47bbf5 100644 --- a/iphone/Maps/Classes/Share/MWMActivityViewController.mm +++ b/iphone/Maps/Classes/Share/MWMActivityViewController.mm @@ -47,7 +47,9 @@ completionHandler: (UIActivityViewControllerCompletionWithItemsHandler)completionHandler { - MWMActivityViewController * shareVC = [[self alloc] initWithActivityItems:@[message, url]]; + NSMutableArray * items = [NSMutableArray arrayWithObject:message]; + if (url) [items addObject:url]; + MWMActivityViewController * shareVC = [[self alloc] initWithActivityItems:items.copy]; shareVC.excludedActivityTypes = [shareVC.excludedActivityTypes arrayByAddingObject:UIActivityTypePostToFacebook]; shareVC.completionWithItemsHandler = completionHandler; return shareVC;