Loading components/feature/top-sites/src/androidTest/java/mozilla/components/feature/top/sites/db/TopSiteDaoTest.kt +3 −3 Original line number Diff line number Diff line Loading @@ -43,7 +43,7 @@ class TopSiteDaoTest { @Test fun testAddingTopSite() { val topSite = TopSiteEntity( val topSite = PinnedSiteEntity( title = "Mozilla", url = "https://www.mozilla.org", isDefault = false, Loading @@ -65,7 +65,7 @@ class TopSiteDaoTest { @Test fun testRemovingTopSite() { val topSite1 = TopSiteEntity( val topSite1 = PinnedSiteEntity( title = "Mozilla", url = "https://www.mozilla.org", isDefault = false, Loading @@ -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, Loading components/feature/top-sites/src/main/java/mozilla/components/feature/top/sites/PinnedSiteStorage.kt +2 −2 Original line number Diff line number Diff line Loading @@ -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. Loading @@ -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, Loading components/feature/top-sites/src/main/java/mozilla/components/feature/top/sites/adapter/TopSiteAdapter.kt +2 −2 Original line number Diff line number Diff line Loading @@ -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!! Loading components/feature/top-sites/src/main/java/mozilla/components/feature/top/sites/db/TopSiteEntity.kt→components/feature/top-sites/src/main/java/mozilla/components/feature/top/sites/db/PinnedSiteEntity.kt +1 −1 Original line number Diff line number Diff line Loading @@ -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, Loading components/feature/top-sites/src/main/java/mozilla/components/feature/top/sites/db/TopSiteDao.kt +5 −5 Original line number Diff line number Diff line Loading @@ -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
components/feature/top-sites/src/androidTest/java/mozilla/components/feature/top/sites/db/TopSiteDaoTest.kt +3 −3 Original line number Diff line number Diff line Loading @@ -43,7 +43,7 @@ class TopSiteDaoTest { @Test fun testAddingTopSite() { val topSite = TopSiteEntity( val topSite = PinnedSiteEntity( title = "Mozilla", url = "https://www.mozilla.org", isDefault = false, Loading @@ -65,7 +65,7 @@ class TopSiteDaoTest { @Test fun testRemovingTopSite() { val topSite1 = TopSiteEntity( val topSite1 = PinnedSiteEntity( title = "Mozilla", url = "https://www.mozilla.org", isDefault = false, Loading @@ -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, Loading
components/feature/top-sites/src/main/java/mozilla/components/feature/top/sites/PinnedSiteStorage.kt +2 −2 Original line number Diff line number Diff line Loading @@ -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. Loading @@ -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, Loading
components/feature/top-sites/src/main/java/mozilla/components/feature/top/sites/adapter/TopSiteAdapter.kt +2 −2 Original line number Diff line number Diff line Loading @@ -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!! Loading
components/feature/top-sites/src/main/java/mozilla/components/feature/top/sites/db/TopSiteEntity.kt→components/feature/top-sites/src/main/java/mozilla/components/feature/top/sites/db/PinnedSiteEntity.kt +1 −1 Original line number Diff line number Diff line Loading @@ -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, Loading
components/feature/top-sites/src/main/java/mozilla/components/feature/top/sites/db/TopSiteDao.kt +5 −5 Original line number Diff line number Diff line Loading @@ -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> }