DB caching. #33
@ -40,6 +40,7 @@ import bou.amine.apps.readerforselfossv2.dao.ACTION
|
||||
import bou.amine.apps.readerforselfossv2.repository.Repository
|
||||
import bou.amine.apps.readerforselfossv2.model.SelfossModel
|
||||
import bou.amine.apps.readerforselfossv2.utils.ItemType
|
||||
import bou.amine.apps.readerforselfossv2.utils.getHtmlDecoded
|
||||
import bou.amine.apps.readerforselfossv2.utils.longHash
|
||||
import bou.amine.apps.readerforselfossv2.utils.toView
|
||||
import com.ashokvarma.bottomnavigation.BottomNavigationBar
|
||||
@ -473,7 +474,7 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener, DIAwar
|
||||
|
||||
val drawerItem = PrimaryDrawerItem()
|
||||
.apply {
|
||||
nameText = it.getTitleDecoded()
|
||||
nameText = it.tag.getHtmlDecoded()
|
||||
identifier = it.tag.longHash()
|
||||
iconDrawable = gd
|
||||
badgeStyle = BadgeStyle().apply {
|
||||
|
@ -3,14 +3,6 @@ package bou.amine.apps.readerforselfossv2.utils
|
||||
import android.text.Html
|
||||
import bou.amine.apps.readerforselfossv2.model.SelfossModel
|
||||
|
||||
actual fun SelfossModel.Item.getTitleDecoded(): String {
|
||||
return Html.fromHtml(title).toString()
|
||||
}
|
||||
|
||||
actual fun SelfossModel.Item.getSourceTitle(): String {
|
||||
return Html.fromHtml(sourcetitle).toString()
|
||||
}
|
||||
|
||||
actual fun SelfossModel.Source.getTitleDecoded(): String {
|
||||
return Html.fromHtml(title).toString()
|
||||
actual fun String.getHtmlDecoded(): String {
|
||||
return Html.fromHtml(this).toString()
|
||||
}
|
@ -416,7 +416,7 @@ class Repository(private val api: SelfossApi, private val apiDetails: ApiDetails
|
||||
db.actionsQueries.insertAction(articleid, read, unread, starred, unstarred)
|
||||
|
||||
private fun updateDBItem(item: SelfossModel.Item) =
|
||||
db.itemsQueries.updateItem(item.datetime, item.getTitleDecoded(), item.content, item.unread, item.starred, item.thumbnail, item.icon, item.link, item.sourcetitle, item.tags.joinToString(","), item.id.toString())
|
||||
db.itemsQueries.updateItem(item.datetime, item.title.getHtmlDecoded(), item.content, item.unread, item.starred, item.thumbnail, item.icon, item.link, item.sourcetitle, item.tags.joinToString(","), item.id.toString())
|
||||
|
||||
|
||||
suspend fun tryToCacheItemsAndGetNewOnes(): List<SelfossModel.Item>? {
|
||||
|
@ -25,7 +25,7 @@ fun SOURCE.toView(): SelfossModel.Source =
|
||||
fun SelfossModel.Source.toEntity(): SOURCE =
|
||||
SOURCE(
|
||||
this.id.toString(),
|
||||
this.getTitleDecoded(),
|
||||
this.title.getHtmlDecoded(),
|
||||
this.tags.joinToString(","),
|
||||
this.spout,
|
||||
this.error,
|
||||
@ -58,13 +58,13 @@ fun SelfossModel.Item.toEntity(): ITEM =
|
||||
ITEM(
|
||||
this.id.toString(),
|
||||
this.datetime,
|
||||
this.getTitleDecoded(),
|
||||
this.title.getHtmlDecoded(),
|
||||
this.content,
|
||||
this.unread,
|
||||
this.starred,
|
||||
this.thumbnail,
|
||||
this.icon,
|
||||
this.link,
|
||||
this.getSourceTitle(),
|
||||
this.title.getHtmlDecoded(),
|
||||
this.tags.joinToString(",")
|
||||
)
|
@ -1,7 +1,3 @@
|
||||
package bou.amine.apps.readerforselfossv2.utils
|
||||
|
||||
import bou.amine.apps.readerforselfossv2.model.SelfossModel
|
||||
|
||||
expect fun SelfossModel.Source.getTitleDecoded(): String
|
||||
expect fun SelfossModel.Item.getTitleDecoded(): String
|
||||
expect fun SelfossModel.Item.getSourceTitle(): String
|
||||
expect fun String.getHtmlDecoded(): String
|
@ -1,15 +1,5 @@
|
||||
package bou.amine.apps.readerforselfossv2.utils
|
||||
|
||||
import bou.amine.apps.readerforselfossv2.model.SelfossModel
|
||||
|
||||
actual fun SelfossModel.Item.getTitleDecoded(): String {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
actual fun SelfossModel.Item.getSourceTitle(): String {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
actual fun SelfossModel.Source.getTitleDecoded(): String {
|
||||
actual fun String.getHtmlDecoded(): String {
|
||||
TODO("Not yet implemented")
|
||||
}
|
@ -1,15 +1,5 @@
|
||||
package bou.amine.apps.readerforselfossv2.utils
|
||||
|
||||
import bou.amine.apps.readerforselfossv2.model.SelfossModel
|
||||
|
||||
actual fun SelfossModel.Item.getTitleDecoded(): String {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
actual fun SelfossModel.Item.getSourceTitle(): String {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
actual fun SelfossModel.Source.getTitleDecoded(): String {
|
||||
actual fun String.getHtmlDecoded(): String {
|
||||
TODO("Not yet implemented")
|
||||
}
|
Loading…
Reference in New Issue
Block a user