For #15211: Make sure bookmarks are moved to the end of folders

pull/149/head
Grisha Kruglov 4 years ago committed by Grisha Kruglov
parent 027c1f9ea7
commit 078843675b

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

Loading…
Cancel
Save