android-components / mozilla.components.feature.tab.collections / TabCollectionStorage

TabCollectionStorage

class TabCollectionStorage (source)

A storage implementation that saves snapshots of tabs / sessions in named collections.

Constructors

Name Summary
<init> TabCollectionStorage(context: <ERROR CLASS>, sessionManager: SessionManager, filesDir: File = context.filesDir)
A storage implementation that saves snapshots of tabs / sessions in named collections.

Functions

Name Summary
addTabsToCollection fun addTabsToCollection(collection: TabCollection, sessions: List<Session>): Unit
Adds the state of the given Sessions to the TabCollection.
createCollection fun createCollection(title: String, sessions: List<Session> = emptyList()): Unit
Creates a new TabCollection and save the state of the given Sessions in it.
getCollections fun getCollections(limit: Int = 20): Flow<List<TabCollection>>
Returns the last TabCollection instances (up to limit) as a Flow list.
getCollectionsPaged fun getCollectionsPaged(): Factory<Int, TabCollection>
Returns all TabCollections as a DataSource.Factory.
getTabCollectionsCount fun getTabCollectionsCount(): Int
Returns the number of tab collections.
removeAllCollections fun removeAllCollections(): Unit
Removes all collections and all tabs.
removeCollection fun removeCollection(collection: TabCollection): Unit
Removes a collection and all its tabs.
removeTabFromCollection fun removeTabFromCollection(collection: TabCollection, tab: Tab): Unit
Removes the given Tab from the TabCollection.
renameCollection fun renameCollection(collection: TabCollection, title: String): Unit
Renames a collection.

Extension Functions

Name Summary
loadResourceAsString fun Any.loadResourceAsString(path: String): String
Loads a file from the resources folder and returns its content as a string object.