From 579a69b477cbc2aa6e642cd23582b0b96c9a4d69 Mon Sep 17 00:00:00 2001 From: Antti Vainikka Date: Mon, 27 Jul 2020 18:24:33 +0300 Subject: [PATCH] Closes #12692: Remove www. prefix in tab tray urls Use separate imports instead of a wildcard import Use toShortUrl String extension instead of removing prefix from url host Add missing import --- .../java/org/mozilla/fenix/tabtray/TabTrayViewHolder.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/mozilla/fenix/tabtray/TabTrayViewHolder.kt b/app/src/main/java/org/mozilla/fenix/tabtray/TabTrayViewHolder.kt index 106041472..b2aba6fef 100644 --- a/app/src/main/java/org/mozilla/fenix/tabtray/TabTrayViewHolder.kt +++ b/app/src/main/java/org/mozilla/fenix/tabtray/TabTrayViewHolder.kt @@ -26,7 +26,6 @@ import mozilla.components.feature.media.ext.playIfPaused import mozilla.components.support.base.observer.Observable import mozilla.components.support.images.ImageLoadRequest import mozilla.components.support.images.loader.ImageLoader -import mozilla.components.support.ktx.kotlin.tryGetHostFromUrl import org.mozilla.fenix.R import org.mozilla.fenix.components.metrics.Event import org.mozilla.fenix.components.metrics.MetricController @@ -36,6 +35,7 @@ import org.mozilla.fenix.ext.increaseTapArea import org.mozilla.fenix.ext.removeAndDisable import org.mozilla.fenix.ext.removeTouchDelegate import org.mozilla.fenix.ext.showAndEnable +import org.mozilla.fenix.ext.toShortUrl import org.mozilla.fenix.utils.Do import kotlin.math.max @@ -160,7 +160,9 @@ class TabTrayViewHolder( // is done in the toolbar and awesomebar: // https://github.com/mozilla-mobile/fenix/issues/1824 // https://github.com/mozilla-mobile/android-components/issues/6985 - urlView?.text = tab.url.tryGetHostFromUrl().take(MAX_URI_LENGTH) + urlView?.text = tab.url + .toShortUrl(itemView.context.components.publicSuffixList) + .take(MAX_URI_LENGTH) } @VisibleForTesting