2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-19 09:25:34 +00:00

[fenix] For https://github.com/mozilla-mobile/fenix/issues/15211: Make sure bookmarks are moved to the end of folders

This commit is contained in:
Grisha Kruglov 2020-09-18 20:51:08 -07:00 committed by Grisha Kruglov
parent ba242fb3b9
commit ec18031057

View File

@ -231,15 +231,17 @@ class EditBookmarkFragment : Fragment(R.layout.fragment_edit_bookmark) {
components.analytics.metrics.track(Event.EditedBookmark)
}
val parentGuid = sharedViewModel.selectedFolder?.guid ?: bookmarkNode!!.parentGuid
val parentChanged = initialParentGuid != parentGuid
// Only track the 'moved' event if new parent was selected.
if (initialParentGuid != parentGuid) {
if (parentChanged) {
components.analytics.metrics.track(Event.MovedBookmark)
}
components.core.bookmarksStorage.updateNode(
args.guidToEdit,
BookmarkInfo(
parentGuid,
bookmarkNode?.position,
// Setting position to 'null' is treated as a 'move to the end' by the storage API.
if (parentChanged) null else bookmarkNode?.position,
title,
if (bookmarkNode?.type == BookmarkNodeType.ITEM) url else null
)