forked from organicmaps/organicmaps
[ios] [mapsme-9315] fix ipad crash when trying to share category
This commit is contained in:
parent
c935f6534d
commit
5a113113bb
4 changed files with 5 additions and 22 deletions
|
@ -76,17 +76,6 @@ class DownloadedBookmarksViewController: MWMViewController {
|
|||
}
|
||||
}
|
||||
|
||||
private func shareCategory(at index: Int) {
|
||||
let category = dataSource.category(at: index)
|
||||
guard let url = MWMBookmarksManager.shared().sharingUrl(forCategoryId: category.categoryId) else {
|
||||
assertionFailure()
|
||||
return
|
||||
}
|
||||
let message = L("share_bookmarks_email_body")
|
||||
let shareController = MWMActivityViewController.share(for: url, message: message)
|
||||
shareController?.present(inParentViewController: self, anchorView: nil)
|
||||
}
|
||||
|
||||
private func deleteCategory(at index: Int) {
|
||||
guard index >= 0 && index < dataSource.categoriesCount else {
|
||||
assertionFailure()
|
||||
|
@ -160,12 +149,6 @@ extension DownloadedBookmarksViewController: CatalogCategoryCellDelegate {
|
|||
self.tableView.reloadRows(at: [indexPath], with: .none)
|
||||
}))
|
||||
|
||||
// TODO: uncomment once the correct deeplink generation is implemented
|
||||
// let share = L("share").capitalized
|
||||
// actionSheet.addAction(UIAlertAction(title: share, style: .default, handler: { _ in
|
||||
// self.shareCategory(at: indexPath.row)
|
||||
// }))
|
||||
|
||||
let delete = L("delete").capitalized
|
||||
let deleteAction = UIAlertAction(title: delete, style: .destructive, handler: { _ in
|
||||
self.deleteCategory(at: indexPath.row)
|
||||
|
|
|
@ -299,7 +299,7 @@ extension BookmarksSharingViewController: UITextViewDelegate {
|
|||
}
|
||||
|
||||
extension BookmarksSharingViewController: UploadActionCellDelegate {
|
||||
func cellDidPressShareButton(_ cell: UploadActionCell) {
|
||||
func cellDidPressShareButton(_ cell: UploadActionCell, senderView: UIView) {
|
||||
guard let url = categoryUrl else {
|
||||
assert(false, "must provide guide url")
|
||||
return
|
||||
|
@ -313,7 +313,7 @@ extension BookmarksSharingViewController: UploadActionCellDelegate {
|
|||
Statistics.logEvent(kStatSharingLinkSuccess, withParameters: [kStatFrom : kStatSharingOptions])
|
||||
}
|
||||
}
|
||||
shareController?.present(inParentViewController: self, anchorView: nil)
|
||||
shareController?.present(inParentViewController: self, anchorView: senderView)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ final class EditOnWebViewController: MWMViewController {
|
|||
self.delegate?.editOnWebViewControllerDidFinish(self)
|
||||
}
|
||||
}
|
||||
shareController?.present(inParentViewController: self, anchorView: nil)
|
||||
shareController?.present(inParentViewController: self, anchorView: sendMeLinkButton)
|
||||
}
|
||||
|
||||
@IBAction func cancelButtonPressed(_ sender: Any) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
protocol UploadActionCellDelegate: AnyObject {
|
||||
func cellDidPressShareButton(_ cell: UploadActionCell)
|
||||
func cellDidPressShareButton(_ cell: UploadActionCell, senderView: UIView)
|
||||
}
|
||||
|
||||
enum UploadActionCellState: String {
|
||||
|
@ -60,6 +60,6 @@ final class UploadActionCell: MWMTableViewCell {
|
|||
|
||||
@IBAction func shareButtonPressed(_ sender: Any) {
|
||||
assert(cellState == .completed, "Share button can only be pressed while the cell is in .completed state")
|
||||
delegate?.cellDidPressShareButton(self)
|
||||
delegate?.cellDidPressShareButton(self, senderView: shareButton)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue