HeadRepository

abstract class HeadRepository

Module repository, it contains all the methods required for the Main app to get data from the Module, abstract functions infoPage and sourceData are required, all other functions are optional.

Sample usage

class Repository : HeadRepository(){

override fun infoPage(link: String, bypassModel: BypassModel): Flow<InfoModel?> {
return flow {
emit(null)
}
}

override fun sourceData(link: String, bypassModel: BypassModel): Flow<SourceData?> {
return flow { emit(null) }
}

override suspend fun recentsPager(bypassModel: BypassModel): Flow<PagingData<RecentModel>> {
return Pager(
config = PagingConfig(
pageSize = 20,
enablePlaceholders = false
),
pagingSourceFactory = { RecentsSource() }
).flow
}
}

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard
open suspend fun analyticsRecommended(bypassModel: BypassModel, events: List<Analytics.Event>): Flow<List<DirectoryModel>>?

This function is called only if HeadConfig.analyticsSettings is declared, it's used to load a list of recommendations based on the user behaviour and the module configuration.

Link copied to clipboard
open suspend fun calendarByDayData(bypassModel: BypassModel, day: CalendarDay): PagerData<*, DirectoryModel>?

This function is called only if HeadConfig.isCalendarEnabled is enabled, it's used to create a daily calendar.

Link copied to clipboard
open suspend fun customHomeSections(bypassModel: BypassModel): List<SectionData>

Declare custom Home sections

Link copied to clipboard
open suspend fun directoryFilters(bypassModel: BypassModel): List<FilterData>?

This function is used to declare the custom filters to be used in directoryPagerData.

Link copied to clipboard
open suspend fun directoryPagerData(bypassModel: BypassModel, filters: FilterRequest?): PagerData<*, DirectoryModel>?

This function is called only if HeadConfig.isDirectoryAvailable is enabled, it's used to load the directory of items.

Link copied to clipboard

Load a filtered list of the directory based on the payload from ClickAction.ExtraDirectory or Tag.payload

Link copied to clipboard
abstract fun infoPage(link: String, bypassModel: BypassModel): Flow<InfoModel?>

This function is called when loading the information page for any of this items:

Link copied to clipboard

This function is called only if HeadConfig.isRecentsAvailable and HeadConfig.isNotifyRecentsEnabled are enabled, it's used to get the latest sublist of recents.

Link copied to clipboard
open suspend fun recentsPagerData(bypassModel: BypassModel): PagerData<*, RecentModel>?

This function is called only if HeadConfig.isRecentsAvailable is enabled, it's used for loading the recents section in Home.

Link copied to clipboard
open suspend fun searchFilters(bypassModel: BypassModel): List<FilterData>?

This function is used to declare the custom filters to be used in searchPagerData.

Link copied to clipboard
open suspend fun searchPagerData(query: String?, bypassModel: BypassModel, filters: FilterRequest?): PagerData<*, DirectoryModel>?

This function is called only if HeadConfig.isSearchAvailable is enabled, it's used to search items in the module.

Link copied to clipboard
open suspend fun searchSuggestions(query: String, bypassModel: BypassModel): List<String>?

This function is called only if HeadConfig.isSearchSuggestionsAvailable is enabled, it's used for search autocompletion.

Link copied to clipboard
open suspend fun sendReview(bypassModel: BypassModel, id: Int, reviewResult: ReviewResult): Boolean?

This function is called only if HeadConfig.reviewConfig is declared, it's called whe the user sends a review.

Link copied to clipboard
abstract suspend fun sourceData(content: ContentItemMin, bypassModel: BypassModel): SourceData<*>?

This function is called when loading the sources for a ContentItemModel it can be a VideoSource, GallerySource or a WebSource.

Link copied to clipboard
open suspend fun userProfile(bypassModel: BypassModel, profileData: InfoModel.ProfileData): Flow<ProfileModel?>?

Load a profile with custom sections declared in the ProfileModel.