Skip to content
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

Merged

Conversation

kirylkaveryn
Copy link
Contributor

Results:
Simulator Screen Recording - iPhone 15 Pro - 2024-05-16 at 12 28 28
Simulator Screen Recording - iPhone 15 Pro - 2024-05-16 at 12 28 51
Simulator Screen Recording - iPhone 15 Pro - 2024-05-16 at 12 28 13

Signed-off-by: Kiryl Kaveryn <kirylkaveryn@gmail.com>
@kirylkaveryn kirylkaveryn added iOS iOS development UI User interface issues labels May 16, 2024
Copy link
Member

@biodranik biodranik left a 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)
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Member

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? )

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks a little bit rough...

@biodranik WDYT?

Simulator Screen Recording - iPhone 15 Pro - 2024-05-22 at 11 10 21

Copy link
Member

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.

Copy link
Member

@biodranik biodranik left a 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)
Copy link
Member

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? )

@biodranik biodranik merged commit 64c8703 into master May 22, 2024
5 checks passed
@biodranik biodranik deleted the ios/hide-the-export-all-button-when-bookmarks-are-empty branch May 22, 2024 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
iOS iOS development UI User interface issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants