-
-
Notifications
You must be signed in to change notification settings - Fork 855
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ios] Hide the Export all bookmarks and tracks
button when there are no bookmarks
#8190
[ios] Hide the Export all bookmarks and tracks
button when there are no bookmarks
#8190
Conversation
Signed-off-by: Kiryl Kaveryn <kirylkaveryn@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Дзякуй!
view?.delete(at: [IndexPath(row: index, section: section)]) | ||
manager.deleteCategory(category.categoryId) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the order here is important?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When the manager.deleteCategory(category.categoryId)
is called the bookmarks manager will trigger the observers that they should update their content. And the
func onBookmarksCategoryDeleted(_ groupId: MWMMarkGroupID) {
reloadData()
}
will trigger the reloading of the table (and remove the row).
BUT
view?.delete(at: [IndexPath(row: index, section: section)])
also removes he row.
And if manager.deleteCategory(category.categoryId)
is called first (and reloads the data), the view?.delete(at: [IndexPath(row: index, section: section)])
will attempt to delete the element that is already deleted ant it crashes the app.
So it is important to reorder this lines to update the local data source in categories.remove(at: index)
, and only after that update the core.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: is view?.delete(at: [IndexPath(row: index, section: section)])
call needed in this case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its needed for the deletion animation with swipe instead of just reloading with fade.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A simpler, faster version without any side effects may be better than some animation, no? )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No big difference, ok, let's use it as is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, дзякуй!
view?.delete(at: [IndexPath(row: index, section: section)]) | ||
manager.deleteCategory(category.categoryId) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A simpler, faster version without any side effects may be better than some animation, no? )
Results: