Commit f3705791 authored by Gabriel Luong's avatar Gabriel Luong
Browse files

Issue #7978: Part 2 - Rename TopSiteEntity to PinnedSiteEntity

parent 348b02c7
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@ class TopSiteDaoTest {

    @Test
    fun testAddingTopSite() {
        val topSite = TopSiteEntity(
        val topSite = PinnedSiteEntity(
            title = "Mozilla",
            url = "https://www.mozilla.org",
            isDefault = false,
@@ -65,7 +65,7 @@ class TopSiteDaoTest {

    @Test
    fun testRemovingTopSite() {
        val topSite1 = TopSiteEntity(
        val topSite1 = PinnedSiteEntity(
            title = "Mozilla",
            url = "https://www.mozilla.org",
            isDefault = false,
@@ -74,7 +74,7 @@ class TopSiteDaoTest {
            it.id = topSiteDao.insertTopSite(it)
        }

        val topSite2 = TopSiteEntity(
        val topSite2 = PinnedSiteEntity(
            title = "Firefox",
            url = "https://www.firefox.com",
            isDefault = false,
+2 −2
Original line number Diff line number Diff line
@@ -10,7 +10,7 @@ import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.map
import mozilla.components.feature.top.sites.adapter.TopSiteAdapter
import mozilla.components.feature.top.sites.db.TopSiteDatabase
import mozilla.components.feature.top.sites.db.TopSiteEntity
import mozilla.components.feature.top.sites.db.PinnedSiteEntity

/**
 * A storage implementation for organizing top sites.
@@ -29,7 +29,7 @@ class PinnedSiteStorage(
     * used to identify top sites that are added by the application.
     */
    fun addTopSite(title: String, url: String, isDefault: Boolean = false) {
        TopSiteEntity(
        PinnedSiteEntity(
            title = title,
            url = url,
            isDefault = isDefault,
+2 −2
Original line number Diff line number Diff line
@@ -5,10 +5,10 @@
package mozilla.components.feature.top.sites.adapter

import mozilla.components.feature.top.sites.TopSite
import mozilla.components.feature.top.sites.db.TopSiteEntity
import mozilla.components.feature.top.sites.db.PinnedSiteEntity

internal class TopSiteAdapter(
    internal val entity: TopSiteEntity
    internal val entity: PinnedSiteEntity
) : TopSite {
    override val id: Long
        get() = entity.id!!
+1 −1
Original line number Diff line number Diff line
@@ -12,7 +12,7 @@ import androidx.room.PrimaryKey
 * Internal entity representing a top site.
 */
@Entity(tableName = "top_sites")
internal data class TopSiteEntity(
internal data class PinnedSiteEntity(
    @PrimaryKey(autoGenerate = true)
    @ColumnInfo(name = "id")
    var id: Long? = null,
+5 −5
Original line number Diff line number Diff line
@@ -13,21 +13,21 @@ import androidx.room.Transaction
import kotlinx.coroutines.flow.Flow

/**
 * Internal DAO for accessing [TopSiteEntity] instances.
 * Internal DAO for accessing [PinnedSiteEntity] instances.
 */
@Dao
internal interface TopSiteDao {
    @Insert
    fun insertTopSite(site: TopSiteEntity): Long
    fun insertTopSite(site: PinnedSiteEntity): Long

    @Delete
    fun deleteTopSite(site: TopSiteEntity)
    fun deleteTopSite(site: PinnedSiteEntity)

    @Transaction
    @Query("SELECT * FROM top_sites")
    fun getTopSites(): Flow<List<TopSiteEntity>>
    fun getTopSites(): Flow<List<PinnedSiteEntity>>

    @Transaction
    @Query("SELECT * FROM top_sites")
    fun getTopSitesPaged(): DataSource.Factory<Int, TopSiteEntity>
    fun getTopSitesPaged(): DataSource.Factory<Int, PinnedSiteEntity>
}
Loading