mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
minor bug fix
This commit is contained in:
parent
49a91328d8
commit
6291933533
4 changed files with 7 additions and 7 deletions
|
@ -47,7 +47,7 @@ class APIRepository(val api: MainAPI) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun getMainPage(): Resource<HomePageResponse> {
|
suspend fun getMainPage(): Resource<HomePageResponse?> {
|
||||||
return safeApiCall {
|
return safeApiCall {
|
||||||
api.getMainPage() ?: throw ErrorLoadingException()
|
api.getMainPage() ?: throw ErrorLoadingException()
|
||||||
}
|
}
|
||||||
|
|
|
@ -254,14 +254,14 @@ class HomeFragment : Fragment() {
|
||||||
|
|
||||||
currentHomePage = d
|
currentHomePage = d
|
||||||
(home_master_recycler?.adapter as ParentItemAdapter?)?.items =
|
(home_master_recycler?.adapter as ParentItemAdapter?)?.items =
|
||||||
d.items.mapNotNull {
|
d?.items?.mapNotNull {
|
||||||
try {
|
try {
|
||||||
HomePageList(it.name, it.list.filterSearchResponse())
|
HomePageList(it.name, it.list.filterSearchResponse())
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
logError(e)
|
logError(e)
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
}
|
} ?: listOf()
|
||||||
|
|
||||||
home_master_recycler?.adapter?.notifyDataSetChanged()
|
home_master_recycler?.adapter?.notifyDataSetChanged()
|
||||||
|
|
||||||
|
|
|
@ -37,8 +37,8 @@ class HomeViewModel : ViewModel() {
|
||||||
private val _apiName = MutableLiveData<String>()
|
private val _apiName = MutableLiveData<String>()
|
||||||
val apiName: LiveData<String> = _apiName
|
val apiName: LiveData<String> = _apiName
|
||||||
|
|
||||||
private val _page = MutableLiveData<Resource<HomePageResponse>>()
|
private val _page = MutableLiveData<Resource<HomePageResponse?>>()
|
||||||
val page: LiveData<Resource<HomePageResponse>> = _page
|
val page: LiveData<Resource<HomePageResponse?>> = _page
|
||||||
|
|
||||||
private val _randomItems = MutableLiveData<List<SearchResponse>?>(null)
|
private val _randomItems = MutableLiveData<List<SearchResponse>?>(null)
|
||||||
val randomItems: LiveData<List<SearchResponse>?> = _randomItems
|
val randomItems: LiveData<List<SearchResponse>?> = _randomItems
|
||||||
|
@ -154,7 +154,7 @@ class HomeViewModel : ViewModel() {
|
||||||
when (data) {
|
when (data) {
|
||||||
is Resource.Success -> {
|
is Resource.Success -> {
|
||||||
val home = data.value
|
val home = data.value
|
||||||
if (home.items.isNotEmpty()) {
|
if (home?.items?.isNullOrEmpty() == false) {
|
||||||
val currentList =
|
val currentList =
|
||||||
home.items.shuffled().filter { !it.list.isNullOrEmpty() }.flatMap { it.list }
|
home.items.shuffled().filter { !it.list.isNullOrEmpty() }.flatMap { it.list }
|
||||||
.distinctBy { it.url }
|
.distinctBy { it.url }
|
||||||
|
|
|
@ -357,7 +357,7 @@ class ResultFragment : Fragment() {
|
||||||
var currentSubs: HashMap<String, SubtitleFile>? = null
|
var currentSubs: HashMap<String, SubtitleFile>? = null
|
||||||
|
|
||||||
val showTitle =
|
val showTitle =
|
||||||
episodeClick.data.name ?: getString(R.string.episode_name_format).format(
|
episodeClick.data.name ?: context?.getString(R.string.episode_name_format)?.format(
|
||||||
getString(R.string.episode),
|
getString(R.string.episode),
|
||||||
episodeClick.data.episode
|
episodeClick.data.episode
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue