mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-03 23:15:31 +00:00
For #1459 - Try more ways to get title for history item
This commit is contained in:
parent
76033f3f20
commit
65235d5cf3
@ -5,6 +5,7 @@
|
||||
package org.mozilla.fenix.library.history
|
||||
|
||||
import android.os.Bundle
|
||||
import android.text.TextUtils
|
||||
import android.view.LayoutInflater
|
||||
import android.view.Menu
|
||||
import android.view.MenuInflater
|
||||
@ -30,6 +31,7 @@ import org.mozilla.fenix.ext.requireComponents
|
||||
import org.mozilla.fenix.mvi.ActionBusFactory
|
||||
import org.mozilla.fenix.mvi.getAutoDisposeObservable
|
||||
import org.mozilla.fenix.mvi.getManagedEmitter
|
||||
import java.net.MalformedURLException
|
||||
import java.net.URL
|
||||
import kotlin.coroutines.CoroutineContext
|
||||
|
||||
@ -154,7 +156,15 @@ class HistoryFragment : Fragment(), CoroutineScope, BackHandler {
|
||||
// See https://github.com/mozilla-mobile/android-components/issues/2643
|
||||
.filter { allowedVisitTypes.contains(it.visitType) }
|
||||
|
||||
.mapIndexed { id, item -> HistoryItem(id, item.title ?: URL(item.url).host, item.url, item.visitTime) }
|
||||
.mapIndexed { id, item ->
|
||||
HistoryItem(
|
||||
id, if (TextUtils.isEmpty(item.title!!)) try {
|
||||
URL(item.url).host
|
||||
} catch (e: MalformedURLException) {
|
||||
item.url
|
||||
} else item.title!!, item.url, item.visitTime
|
||||
)
|
||||
}
|
||||
.toList()
|
||||
|
||||
coroutineScope {
|
||||
|
Loading…
Reference in New Issue
Block a user