Skip to content

Commit c6e3a06

Browse files
committed
Fix a bug with updating panel state when drilling down into folders / navigating to bookmarks.
1 parent c45d02d commit c6e3a06

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

firefox-ios/Client/Frontend/Library/Bookmarks/BookmarksViewController.swift

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -219,12 +219,16 @@ final class BookmarksViewController: SiteTableViewController,
219219
override func viewWillAppear(_ animated: Bool) {
220220
super.viewWillAppear(animated)
221221

222-
// Update if we've navigated back to the root folder of the bookmarks library either from the bookmark/folder detail
223-
// screen during "Edit" mode, or from drilling deeper into folders and then tapping the `<` back nav button.
222+
// Set this panel's initial state.
224223
if tableView.isEditing {
224+
// This happens if we navigate back to the panel either from the bookmark/folder detail screen during "Edit" mode
225225
updatePanelState(newState: .bookmarks(state: .inFolderEditMode))
226-
} else if viewModel.isRootNode {
227-
updatePanelState(newState: .bookmarks(state: .mainView))
226+
} else {
227+
if viewModel.isRootNode {
228+
updatePanelState(newState: .bookmarks(state: .mainView))
229+
} else {
230+
updatePanelState(newState: .bookmarks(state: .inFolder))
231+
}
228232
}
229233

230234
sendPanelChangeNotification()
@@ -533,16 +537,17 @@ final class BookmarksViewController: SiteTableViewController,
533537

534538
if let itemData = bookmarkCell as? BookmarkItemData,
535539
let url = URL(string: itemData.url) {
540+
// Navigate to a webpage when tapping a bookmark
536541
libraryPanelDelegate?.libraryPanel(didSelectURL: url, visitType: .bookmark)
537542
} else {
543+
// Drill deeper into a bookmark folder
538544
guard let folder = bookmarkCell as? FxBookmarkNode else { return }
539545

540546
// If the user taps on a folder before filtering the bookmarks with a search term, simply exit search
541547
if state == .bookmarks(state: .search) {
542548
exitSearchState()
543549
}
544550

545-
updatePanelState(newState: .bookmarks(state: .inFolder))
546551
bookmarkCoordinatorDelegate?.start(from: folder)
547552
}
548553
}

0 commit comments

Comments
 (0)