Skip to content

Commit e5070b8

Browse files
authored
sort vowels to the end of the trackers animation to avoid dodgy words (#852)
1 parent 9bef16b commit e5070b8

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

app/src/main/java/com/duckduckgo/app/browser/BrowserTrackersAnimatorHelper.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ class BrowserTrackersAnimatorHelper {
234234
.asSequence()
235235
.distinct()
236236
.take(MAX_LOGOS_SHOWN + 1)
237+
.sortedWithDisplayNamesStartingWithVowelsToTheEnd()
237238
.map {
238239
val resId = TrackersRenderer().networkLogoIcon(activity, it.name)
239240
if (resId == null) {
@@ -417,6 +418,10 @@ class BrowserTrackersAnimatorHelper {
417418
}
418419
}
419420

421+
private fun Sequence<Entity>.sortedWithDisplayNamesStartingWithVowelsToTheEnd(): Sequence<Entity> {
422+
return sortedWith(compareBy { "AEIOU".contains(it.displayName.take(1)) })
423+
}
424+
420425
companion object {
421426
private const val TRACKER_LOGOS_DELAY_ON_SCREEN = 2400L
422427
private const val DEFAULT_ANIMATION_DURATION = 150L

0 commit comments

Comments
 (0)