diff --git a/app/src/main/java/com/pr0gramm/app/services/BookmarkService.kt b/app/src/main/java/com/pr0gramm/app/services/BookmarkService.kt index 355033363..7ba0e430c 100644 --- a/app/src/main/java/com/pr0gramm/app/services/BookmarkService.kt +++ b/app/src/main/java/com/pr0gramm/app/services/BookmarkService.kt @@ -106,7 +106,10 @@ class BookmarkService( */ fun observe(): Flow> { val comparator = compareBy { !it.trending }.thenBy { it.title.lowercase(Locale.getDefault()) } - return bookmarks.map { it.sortedWith(comparator) }.distinctUntilChanged() + return bookmarks + .map { bookmarks -> bookmarks.sortedWith(comparator) } + .map { bookmarks -> bookmarks.distinctBy { it.title.trim() } } + .distinctUntilChanged() } /** @@ -149,7 +152,7 @@ class BookmarkService( val local = bookmarks.value.filter { it._link == null || it.notSyncable } // and merge them together, with the local ones winning. - val merged = (local + update).distinctBy { it.title.lowercase(Locale.getDefault()) } + val merged = (local + update).distinctBy { it.title.lowercase(Locale.getDefault()).trim() } bookmarks.value = merged } @@ -230,7 +233,7 @@ class BookmarkService( val canEdit: Boolean get() = bookmarkSyncService.canChange private fun Bookmark.hasTitle(title: String): Boolean { - return this.title.equals(title, ignoreCase = false) + return this.title.trim().equals(title.trim(), ignoreCase = false) } private val Bookmark.syncable: Boolean diff --git a/app/src/main/java/com/pr0gramm/app/services/BookmarkSyncService.kt b/app/src/main/java/com/pr0gramm/app/services/BookmarkSyncService.kt index 6e3d9f402..68154e60c 100644 --- a/app/src/main/java/com/pr0gramm/app/services/BookmarkSyncService.kt +++ b/app/src/main/java/com/pr0gramm/app/services/BookmarkSyncService.kt @@ -48,7 +48,7 @@ class BookmarkSyncService(private val api: Api, private val userService: UserSer * We might have better handling for those bookmarks in the app */ private fun isAppSpecialCategory(bookmark: Api.Bookmark): Boolean { - val name = bookmark.name.lowercase(Locale.GERMAN) + val name = bookmark.name.lowercase(Locale.GERMAN).trim() return name == "best of" || name == "kontrovers" || name == "wichteln" }