Skip to content

Commit 67fd990

Browse files
committed
fix(tv): Fix an issue where the TV season list was not displayed
1 parent 14fc50b commit 67fd990

File tree

4 files changed

+33
-19
lines changed

4 files changed

+33
-19
lines changed

composeApp/src/commonMain/kotlin/com/jankinwu/fntv/client/data/model/response/EpisodeListResponse.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ data class EpisodeListResponse(
1212
val lan: String,
1313

1414
@param:JsonProperty("imdb_id")
15-
val imdbId: String,
15+
val imdbId: String?,
1616

1717
@param:JsonProperty("trim_id")
1818
val trimId: String,

composeApp/src/commonMain/kotlin/com/jankinwu/fntv/client/data/model/response/SeasonListResponse.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ data class SeasonListResponse(
3333
val type: String,
3434

3535
@param:JsonProperty("poster")
36-
val poster: String,
36+
val poster: String?,
3737

3838
@param:JsonProperty("poster_width")
3939
val posterWidth: Int,
@@ -63,7 +63,7 @@ data class SeasonListResponse(
6363
val episodeNumber: Int,
6464

6565
@param:JsonProperty("air_date")
66-
val airDate: String,
66+
val airDate: String?,
6767

6868
@param:JsonProperty("number_of_seasons")
6969
val numberOfSeasons: Int,

composeApp/src/commonMain/kotlin/com/jankinwu/fntv/client/data/model/response/StreamResponse.kt

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,71 +40,71 @@ data class CloudStorageInfo(
4040
* DAV用户名
4141
*/
4242
@param:JsonProperty("dav_username")
43-
val davUsername: String,
43+
val davUsername: String?,
4444

4545
/**
4646
* 是否有效
4747
*/
4848
@param:JsonProperty("valid")
49-
val valid: Boolean,
49+
val valid: Boolean?,
5050

5151
/**
5252
* 是否禁用
5353
*/
5454
@param:JsonProperty("disabled")
55-
val disabled: Boolean,
55+
val disabled: Boolean?,
5656

5757
/**
5858
* 云存储类型
5959
*/
6060
@param:JsonProperty("cloud_storage_type")
61-
val cloudStorageType: Int,
61+
val cloudStorageType: Int?,
6262

6363
/**
6464
* 云存储昵称
6565
*/
6666
@param:JsonProperty("cloud_nick_name")
67-
val cloudNickName: String,
67+
val cloudNickName: String?,
6868

6969
/**
7070
* 文件系统大小
7171
*/
7272
@param:JsonProperty("fssize")
73-
val fsSize: Long,
73+
val fsSize: Long?,
7474

7575
/**
7676
* 文件系统剩余大小
7777
*/
7878
@param:JsonProperty("frsize")
79-
val frSize: Long,
79+
val frSize: Long?,
8080

8181
/**
8282
* 文件系统已用大小
8383
*/
8484
@param:JsonProperty("fusize")
85-
val fuSize: Long,
85+
val fuSize: Long?,
8686

8787
/**
8888
* 是否是会员
8989
*/
9090
@param:JsonProperty("is_vip")
91-
val isVip: Boolean,
91+
val isVip: Boolean?,
9292

9393
/**
9494
* 夸克会员类型
9595
*/
9696
@param:JsonProperty("quark_vip_type")
97-
val quarkVipType: String,
97+
val quarkVipType: String?,
9898

9999
/**
100100
* 夸克PC支付链接
101101
*/
102102
@param:JsonProperty("quark_pc_pay_link")
103-
val quarkPcPayLink: String,
103+
val quarkPcPayLink: String?,
104104

105105
/**
106106
* 夸克WAP支付链接
107107
*/
108108
@param:JsonProperty("quark_wap_pay_link")
109-
val quarkWapPayLink: String
109+
val quarkWapPayLink: String?
110110
)

composeApp/src/commonMain/kotlin/com/jankinwu/fntv/client/ui/screen/TvDetailScreen.kt

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,10 @@ fun TvDetailBody(
238238
LaunchedEffect(watchedUiState) {
239239
when (val state = watchedUiState) {
240240
is UiState.Success -> {
241-
toastManager.showToast(state.data.message, if (state.data.success) ToastType.Success else ToastType.Failed)
241+
toastManager.showToast(
242+
state.data.message,
243+
if (state.data.success) ToastType.Success else ToastType.Failed
244+
)
242245
// 调用对应的回调函数
243246
pendingCallbacks[state.data.guid]?.invoke(state.data.success)
244247
// 从 pendingCallbacks 中移除已处理的回调
@@ -271,7 +274,10 @@ fun TvDetailBody(
271274
LaunchedEffect(favoriteUiState) {
272275
when (val state = favoriteUiState) {
273276
is UiState.Success -> {
274-
toastManager.showToast(state.data.message, if (state.data.success) ToastType.Success else ToastType.Failed)
277+
toastManager.showToast(
278+
state.data.message,
279+
if (state.data.success) ToastType.Success else ToastType.Failed
280+
)
275281
itemViewModel.loadData(guid)
276282
}
277283

@@ -439,10 +445,17 @@ fun TvDetailBody(
439445
.width(itemWidth)
440446
.height((253 * scaleFactor).dp)
441447
) {
448+
val episodeNumber = if (season.episodeNumber > 0) {
449+
season.episodeNumber
450+
} else {
451+
season.localNumberOfEpisodes
452+
}
442453
MoviePoster(
443454
modifier = Modifier.fillMaxSize(),
444455
title = season.title,
445-
subtitle = "${season.episodeNumber} 集 · ${season.airDate.take(4)}",
456+
subtitle = if (season.airDate != null) "$episodeNumber 集 · ${
457+
season.airDate.take(4)
458+
}" else "$episodeNumber",
446459
score = FnDataConvertor.formatVoteAverage(season.voteAverage),
447460
posterImg = season.poster,
448461
isFavorite = season.isFavorite == 1,
@@ -518,7 +531,8 @@ private fun TvMediaInfo(
518531
playInfo
519532
)
520533
if (!itemData.overview.isNullOrBlank()) {
521-
MediaDescription(modifier = Modifier.padding(bottom = 32.dp), itemData,
534+
MediaDescription(
535+
modifier = Modifier.padding(bottom = 32.dp), itemData,
522536
onClick = { showDescriptionDialog() })
523537
}
524538
}

0 commit comments

Comments
 (0)