forked from organicmaps/organicmaps
[iOS] reload category list when delete downloaded categories
https://jira.mail.ru/browse/MAPSME-11707
This commit is contained in:
parent
2b4d14f494
commit
7cf58fa198
2 changed files with 9 additions and 3 deletions
|
@ -30,7 +30,11 @@ class DownloadedBookmarksViewController: MWMViewController {
|
|||
tableView.tableHeaderView = bottomView
|
||||
tableView.registerNib(cell: CatalogCategoryCell.self)
|
||||
tableView.registerNibForHeaderFooterView(BMCCategoriesHeader.self)
|
||||
checkInvalidSubscription()
|
||||
checkInvalidSubscription { [weak self] deleted in
|
||||
if deleted {
|
||||
self?.reloadData()
|
||||
}
|
||||
}
|
||||
if #available(iOS 11, *) { return } // workaround for https://jira.mail.ru/browse/MAPSME-8101
|
||||
reloadData()
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
extension UIViewController {
|
||||
func checkInvalidSubscription() {
|
||||
func checkInvalidSubscription(_ completion: ((_ deleted: Bool) -> Void)? = nil) {
|
||||
MWMBookmarksManager.shared().check { [weak self] hasInvalidSubscription in
|
||||
guard hasInvalidSubscription else {
|
||||
return
|
||||
|
@ -13,14 +13,16 @@ extension UIViewController {
|
|||
}
|
||||
subscriptionDialog.onCancel = { [weak self] in
|
||||
self?.dismiss(animated: true) {
|
||||
self?.checkInvalidSubscription()
|
||||
self?.checkInvalidSubscription(completion)
|
||||
}
|
||||
}
|
||||
self?.present(subscriptionDialog, animated: true)
|
||||
completion?(false)
|
||||
}
|
||||
let onDelete = {
|
||||
self?.dismiss(animated: true)
|
||||
MWMBookmarksManager.shared().deleteInvalidCategories()
|
||||
completion?(true)
|
||||
}
|
||||
let subscriptionExpiredDialog = BookmarksSubscriptionExpiredViewController(onSubscribe: onSubscribe, onDelete: onDelete)
|
||||
self?.present(subscriptionExpiredDialog, animated: true)
|
||||
|
|
Loading…
Add table
Reference in a new issue