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

Issue #7978: Part 6 - Rename addPinnedSite to addTopSite in TopSitesStorage

parent ae5a3bfc
......@@ -40,13 +40,13 @@ class DefaultTopSitesStorage(
if (defaultTopSites.isNotEmpty()) {
scope.launch {
defaultTopSites.forEach { (title, url) ->
addPinnedSite(title, url, isDefault = true)
addTopSite(title, url, isDefault = true)
}
}
}
}
override fun addPinnedSite(title: String, url: String, isDefault: Boolean) {
override fun addTopSite(title: String, url: String, isDefault: Boolean) {
scope.launch {
pinnedSitesStorage.addPinnedSite(title, url, isDefault)
notifyObservers { onStorageUpdated() }
......
......@@ -11,14 +11,14 @@ import mozilla.components.support.base.observer.Observable
*/
interface TopSitesStorage : Observable<TopSitesStorage.Observer> {
/**
* Adds a new pinned site.
* Adds a new top site.
*
* @param title The title string.
* @param url The URL string.
* @param isDefault Whether or not the pinned site added should be a default pinned site. This
* is used to identify pinned sites that are added by the application.
*/
fun addPinnedSite(title: String, url: String, isDefault: Boolean = false)
fun addTopSite(title: String, url: String, isDefault: Boolean = false)
/**
* Removes the given [TopSite].
......
......@@ -19,7 +19,7 @@ class TopSitesUseCases(topSitesStorage: TopSitesStorage) {
* @param url The URL string.
*/
operator fun invoke(title: String, url: String, isDefault: Boolean = false) {
storage.addPinnedSite(title, url, isDefault)
storage.addTopSite(title, url, isDefault)
}
}
......
......@@ -61,7 +61,7 @@ class DefaultTopSitesStorageTest {
listOf(),
coroutineContext
)
defaultTopSitesStorage.addPinnedSite("Mozilla", "https://mozilla.com", isDefault = false)
defaultTopSitesStorage.addTopSite("Mozilla", "https://mozilla.com", isDefault = false)
verify(pinnedSitesStorage).addPinnedSite(
"Mozilla",
......
......@@ -20,7 +20,7 @@ class TopSitesUseCasesTest {
val useCases = TopSitesUseCases(topSitesStorage)
useCases.addPinnedSites("Mozilla", "https://www.mozilla.org", isDefault = true)
verify(topSitesStorage).addPinnedSite(
verify(topSitesStorage).addTopSite(
"Mozilla",
"https://www.mozilla.org",
isDefault = true
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment