feat(client): 对接详情/播放/进度续看/收藏(K1 看剧闭环)+ 三态 UI
后端接口从 6 个扩到 13 个,全部走真数据:
- 新增 api:playback_api(/app/episodes/{id}/play)、watch_api(/app/watch/*)、
library_api(/app/favorites*);票据从 CatalogApi 搬到 PlaybackApi
- 新增 repository:PlaybackRepository(含票据 TTL 缓存,默认 10 分钟,时钟可注入)、
FavoriteRepository、WatchHistoryRepository 换成服务端模型(每剧一条续看记录,删掉 demoProfileId)
- PlayerLogic:起播前取票(拿不到给三态 UI,失败可重试);accessType 驱动锁定文案,
不在前端猜;签名地址原样交给播放器(只补 host,不动 path/query);
进度上报节流 5s → 10s,切集/退出/切后台各补一次,播完带 finished
- 续看定位:服务端记录里的那一集才 seek(其它集从头播),续看位置进详情/播放页时读一次
- FavoriteController:收藏以服务端为准,乐观更新 + 失败回滚;退出登录清空
- UI 三态:详情页(加载/失败可重试/空剧集 + 续看进度条 + 收藏按钮)、
播放页(票据加载中/失败可重试/后端判定不可播)、我的页(续看失败可重试、收藏三态、最近观看)
- l10n 新增 8 个键(en/zh/id 三份):网络/进度/收藏失败、锁定提示、续看文案等
测试:flutter test 188 全过(存量 27 个测试文件未跑红);新增票据过期重取、进度节流、
续看定位、收藏回滚、签名 query 原样保留、真实后端端到端联调(live_watch_flow)
This commit is contained in:
1 parent
94ff9f1177
commit
d7eff4ca59
48 files changed
+2411
-377
No files matched your search
+67
-8
@@ -34,7 +34,13 @@
|
||||
"localDemoProfile": "Local demo profile",
|
||||
"continueWatching": "Continue Watching",
|
||||
"watchedPercent": "Watched {percent}%",
|
||||
"@watchedPercent": {"placeholders": {"percent": {"type": "int"}}},
|
||||
"@watchedPercent": {
|
||||
"placeholders": {
|
||||
"percent": {
|
||||
"type": "int"
|
||||
}
|
||||
}
|
||||
},
|
||||
"resume": "Resume",
|
||||
"history": "History",
|
||||
"watchlist": "Watchlist",
|
||||
@@ -72,16 +78,40 @@
|
||||
"originalTag": "Original",
|
||||
"dramaTag": "Short drama",
|
||||
"episodeLabel": "Episode {number}",
|
||||
"@episodeLabel": {"placeholders": {"number": {"type": "int"}}},
|
||||
"@episodeLabel": {
|
||||
"placeholders": {
|
||||
"number": {
|
||||
"type": "int"
|
||||
}
|
||||
}
|
||||
},
|
||||
"exploreSeries": "Explore series",
|
||||
"episodeCount": "{count} EPISODES",
|
||||
"@episodeCount": {"placeholders": {"count": {"type": "int"}}},
|
||||
"@episodeCount": {
|
||||
"placeholders": {
|
||||
"count": {
|
||||
"type": "int"
|
||||
}
|
||||
}
|
||||
},
|
||||
"technicalDemoCount": "FREE PREVIEW · {count} EPISODES",
|
||||
"@technicalDemoCount": {"placeholders": {"count": {"type": "int"}}},
|
||||
"@technicalDemoCount": {
|
||||
"placeholders": {
|
||||
"count": {
|
||||
"type": "int"
|
||||
}
|
||||
}
|
||||
},
|
||||
"episodes": "Episodes",
|
||||
"watchEpisodeOne": "Watch episode 1",
|
||||
"continueEpisode": "Continue episode {number}",
|
||||
"@continueEpisode": {"placeholders": {"number": {"type": "int"}}},
|
||||
"@continueEpisode": {
|
||||
"placeholders": {
|
||||
"number": {
|
||||
"type": "int"
|
||||
}
|
||||
}
|
||||
},
|
||||
"freeTestMedia": "Same demo clip · free",
|
||||
"lockedStoreUnavailable": "Locked · store unavailable",
|
||||
"freeTestClip": "Free test clip",
|
||||
@@ -89,10 +119,25 @@
|
||||
"freeSamplesNotice": "Two free samples · store setup pending",
|
||||
"demoTestMedia": "FREE · SAME DEMO CLIP",
|
||||
"episodeProgress": "EPISODE {number} / {total}",
|
||||
"@episodeProgress": {"placeholders": {"number": {"type": "int"}, "total": {"type": "int"}}},
|
||||
"@episodeProgress": {
|
||||
"placeholders": {
|
||||
"number": {
|
||||
"type": "int"
|
||||
},
|
||||
"total": {
|
||||
"type": "int"
|
||||
}
|
||||
}
|
||||
},
|
||||
"testVideoNotice": "Self-generated technical test video",
|
||||
"lockedTitle": "Episode {number} is locked",
|
||||
"@lockedTitle": {"placeholders": {"number": {"type": "int"}}},
|
||||
"@lockedTitle": {
|
||||
"placeholders": {
|
||||
"number": {
|
||||
"type": "int"
|
||||
}
|
||||
}
|
||||
},
|
||||
"lockedBody": "Unlocking will be available after store and verification setup. This demo does not process payments.",
|
||||
"playbackError": "This clip could not be played.",
|
||||
"catalogError": "The catalog could not be loaded.",
|
||||
@@ -180,5 +225,19 @@
|
||||
"authGateTitle": "Sign in to continue",
|
||||
"authGateMessage": "Favorites and comments need an account.",
|
||||
"authGateAction": "Sign In",
|
||||
"cancel": "Not now"
|
||||
"cancel": "Not now",
|
||||
"noEpisodesYet": "No playable episodes yet.",
|
||||
"networkError": "Network is unreachable. Please check your connection and retry.",
|
||||
"progressError": "Your watch position could not be loaded.",
|
||||
"favoritesError": "Your favorites could not be loaded.",
|
||||
"favoriteToggleFailed": "Could not update favorites. Please retry.",
|
||||
"remove": "Remove",
|
||||
"unlockComingSoon": "Unlocking with coins is coming soon.",
|
||||
"resumeProgress": "Resume at {position} / {total}",
|
||||
"@resumeProgress": {
|
||||
"placeholders": {
|
||||
"position": {},
|
||||
"total": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
+67
-8
@@ -34,7 +34,13 @@
|
||||
"localDemoProfile": "Profil demo lokal",
|
||||
"continueWatching": "Lanjut Tonton",
|
||||
"watchedPercent": "Sudah ditonton {percent}%",
|
||||
"@watchedPercent": {"placeholders": {"percent": {"type": "int"}}},
|
||||
"@watchedPercent": {
|
||||
"placeholders": {
|
||||
"percent": {
|
||||
"type": "int"
|
||||
}
|
||||
}
|
||||
},
|
||||
"resume": "Lanjutkan",
|
||||
"history": "Riwayat",
|
||||
"watchlist": "Daftar Tonton",
|
||||
@@ -72,16 +78,40 @@
|
||||
"originalTag": "Original",
|
||||
"dramaTag": "Drama pendek",
|
||||
"episodeLabel": "Episode {number}",
|
||||
"@episodeLabel": {"placeholders": {"number": {"type": "int"}}},
|
||||
"@episodeLabel": {
|
||||
"placeholders": {
|
||||
"number": {
|
||||
"type": "int"
|
||||
}
|
||||
}
|
||||
},
|
||||
"exploreSeries": "Lihat serial",
|
||||
"episodeCount": "{count} EPISODE",
|
||||
"@episodeCount": {"placeholders": {"count": {"type": "int"}}},
|
||||
"@episodeCount": {
|
||||
"placeholders": {
|
||||
"count": {
|
||||
"type": "int"
|
||||
}
|
||||
}
|
||||
},
|
||||
"technicalDemoCount": "PRATINJAU GRATIS · {count} EPISODE",
|
||||
"@technicalDemoCount": {"placeholders": {"count": {"type": "int"}}},
|
||||
"@technicalDemoCount": {
|
||||
"placeholders": {
|
||||
"count": {
|
||||
"type": "int"
|
||||
}
|
||||
}
|
||||
},
|
||||
"episodes": "Episode",
|
||||
"watchEpisodeOne": "Tonton episode 1",
|
||||
"continueEpisode": "Lanjut episode {number}",
|
||||
"@continueEpisode": {"placeholders": {"number": {"type": "int"}}},
|
||||
"@continueEpisode": {
|
||||
"placeholders": {
|
||||
"number": {
|
||||
"type": "int"
|
||||
}
|
||||
}
|
||||
},
|
||||
"freeTestMedia": "Klip demo sama · gratis",
|
||||
"lockedStoreUnavailable": "Terkunci · toko belum tersedia",
|
||||
"freeTestClip": "Klip uji gratis",
|
||||
@@ -89,10 +119,25 @@
|
||||
"freeSamplesNotice": "Dua sampel gratis · pengaturan toko belum selesai",
|
||||
"demoTestMedia": "GRATIS · KLIP DEMO SAMA",
|
||||
"episodeProgress": "EPISODE {number} / {total}",
|
||||
"@episodeProgress": {"placeholders": {"number": {"type": "int"}, "total": {"type": "int"}}},
|
||||
"@episodeProgress": {
|
||||
"placeholders": {
|
||||
"number": {
|
||||
"type": "int"
|
||||
},
|
||||
"total": {
|
||||
"type": "int"
|
||||
}
|
||||
}
|
||||
},
|
||||
"testVideoNotice": "Video uji teknis buatan sendiri",
|
||||
"lockedTitle": "Episode {number} terkunci",
|
||||
"@lockedTitle": {"placeholders": {"number": {"type": "int"}}},
|
||||
"@lockedTitle": {
|
||||
"placeholders": {
|
||||
"number": {
|
||||
"type": "int"
|
||||
}
|
||||
}
|
||||
},
|
||||
"lockedBody": "Pembukaan kunci tersedia setelah toko dan verifikasi disiapkan. Demo ini tidak memproses pembayaran.",
|
||||
"playbackError": "Klip ini tidak bisa diputar.",
|
||||
"catalogError": "Katalog gagal dimuat.",
|
||||
@@ -180,5 +225,19 @@
|
||||
"authGateTitle": "Masuk untuk melanjutkan",
|
||||
"authGateMessage": "Favorit dan komentar perlu akun.",
|
||||
"authGateAction": "Masuk",
|
||||
"cancel": "Nanti saja"
|
||||
"cancel": "Nanti saja",
|
||||
"noEpisodesYet": "Belum ada episode yang bisa diputar.",
|
||||
"networkError": "Jaringan tidak tersedia. Periksa koneksi lalu coba lagi.",
|
||||
"progressError": "Posisi tonton gagal dimuat.",
|
||||
"favoritesError": "Daftar favorit gagal dimuat.",
|
||||
"favoriteToggleFailed": "Gagal memperbarui favorit. Coba lagi.",
|
||||
"remove": "Hapus",
|
||||
"unlockComingSoon": "Pembukaan dengan koin segera hadir.",
|
||||
"resumeProgress": "Lanjut di {position} / {total}",
|
||||
"@resumeProgress": {
|
||||
"placeholders": {
|
||||
"position": {},
|
||||
"total": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1143,6 +1143,54 @@ abstract class AppLocalizations {
|
||||
/// In en, this message translates to:
|
||||
/// **'Not now'**
|
||||
String get cancel;
|
||||
|
||||
/// No description provided for @noEpisodesYet.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'No playable episodes yet.'**
|
||||
String get noEpisodesYet;
|
||||
|
||||
/// No description provided for @networkError.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Network is unreachable. Please check your connection and retry.'**
|
||||
String get networkError;
|
||||
|
||||
/// No description provided for @progressError.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Your watch position could not be loaded.'**
|
||||
String get progressError;
|
||||
|
||||
/// No description provided for @favoritesError.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Your favorites could not be loaded.'**
|
||||
String get favoritesError;
|
||||
|
||||
/// No description provided for @favoriteToggleFailed.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Could not update favorites. Please retry.'**
|
||||
String get favoriteToggleFailed;
|
||||
|
||||
/// No description provided for @remove.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Remove'**
|
||||
String get remove;
|
||||
|
||||
/// No description provided for @unlockComingSoon.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Unlocking with coins is coming soon.'**
|
||||
String get unlockComingSoon;
|
||||
|
||||
/// No description provided for @resumeProgress.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Resume at {position} / {total}'**
|
||||
String resumeProgress(Object position, Object total);
|
||||
}
|
||||
|
||||
class _AppLocalizationsDelegate
|
||||
|
||||
@@ -551,4 +551,32 @@ class AppLocalizationsEn extends AppLocalizations {
|
||||
|
||||
@override
|
||||
String get cancel => 'Not now';
|
||||
|
||||
@override
|
||||
String get noEpisodesYet => 'No playable episodes yet.';
|
||||
|
||||
@override
|
||||
String get networkError =>
|
||||
'Network is unreachable. Please check your connection and retry.';
|
||||
|
||||
@override
|
||||
String get progressError => 'Your watch position could not be loaded.';
|
||||
|
||||
@override
|
||||
String get favoritesError => 'Your favorites could not be loaded.';
|
||||
|
||||
@override
|
||||
String get favoriteToggleFailed =>
|
||||
'Could not update favorites. Please retry.';
|
||||
|
||||
@override
|
||||
String get remove => 'Remove';
|
||||
|
||||
@override
|
||||
String get unlockComingSoon => 'Unlocking with coins is coming soon.';
|
||||
|
||||
@override
|
||||
String resumeProgress(Object position, Object total) {
|
||||
return 'Resume at $position / $total';
|
||||
}
|
||||
}
|
||||
@@ -553,4 +553,31 @@ class AppLocalizationsId extends AppLocalizations {
|
||||
|
||||
@override
|
||||
String get cancel => 'Nanti saja';
|
||||
|
||||
@override
|
||||
String get noEpisodesYet => 'Belum ada episode yang bisa diputar.';
|
||||
|
||||
@override
|
||||
String get networkError =>
|
||||
'Jaringan tidak tersedia. Periksa koneksi lalu coba lagi.';
|
||||
|
||||
@override
|
||||
String get progressError => 'Posisi tonton gagal dimuat.';
|
||||
|
||||
@override
|
||||
String get favoritesError => 'Daftar favorit gagal dimuat.';
|
||||
|
||||
@override
|
||||
String get favoriteToggleFailed => 'Gagal memperbarui favorit. Coba lagi.';
|
||||
|
||||
@override
|
||||
String get remove => 'Hapus';
|
||||
|
||||
@override
|
||||
String get unlockComingSoon => 'Pembukaan dengan koin segera hadir.';
|
||||
|
||||
@override
|
||||
String resumeProgress(Object position, Object total) {
|
||||
return 'Lanjut di $position / $total';
|
||||
}
|
||||
}
|
||||
@@ -543,4 +543,30 @@ class AppLocalizationsZh extends AppLocalizations {
|
||||
|
||||
@override
|
||||
String get cancel => '暂不';
|
||||
|
||||
@override
|
||||
String get noEpisodesYet => '还没有可播放的剧集。';
|
||||
|
||||
@override
|
||||
String get networkError => '网络异常,请检查网络后重试。';
|
||||
|
||||
@override
|
||||
String get progressError => '续看进度加载失败。';
|
||||
|
||||
@override
|
||||
String get favoritesError => '收藏列表加载失败。';
|
||||
|
||||
@override
|
||||
String get favoriteToggleFailed => '收藏操作失败,请重试。';
|
||||
|
||||
@override
|
||||
String get remove => '移除';
|
||||
|
||||
@override
|
||||
String get unlockComingSoon => '金币解锁功能即将开放。';
|
||||
|
||||
@override
|
||||
String resumeProgress(Object position, Object total) {
|
||||
return '续看至 $position / $total';
|
||||
}
|
||||
}
|
||||
+29
-3
@@ -34,7 +34,13 @@
|
||||
"localDemoProfile": "本地演示档案",
|
||||
"continueWatching": "继续观看",
|
||||
"watchedPercent": "已观看 {percent}%",
|
||||
"@watchedPercent": {"placeholders": {"percent": {"type": "int"}}},
|
||||
"@watchedPercent": {
|
||||
"placeholders": {
|
||||
"percent": {
|
||||
"type": "int"
|
||||
}
|
||||
}
|
||||
},
|
||||
"resume": "继续播放",
|
||||
"history": "历史",
|
||||
"watchlist": "追剧",
|
||||
@@ -72,7 +78,13 @@
|
||||
"originalTag": "原创",
|
||||
"dramaTag": "短剧",
|
||||
"episodeLabel": "第 {number} 集",
|
||||
"@episodeLabel": {"placeholders": {"number": {"type": "int"}}},
|
||||
"@episodeLabel": {
|
||||
"placeholders": {
|
||||
"number": {
|
||||
"type": "int"
|
||||
}
|
||||
}
|
||||
},
|
||||
"exploreSeries": "查看剧集",
|
||||
"episodeCount": "{count} 集",
|
||||
"technicalDemoCount": "免费试看 · {count} 集",
|
||||
@@ -175,5 +187,19 @@
|
||||
"authGateTitle": "登录后可继续",
|
||||
"authGateMessage": "收藏、评论等操作需要登录。",
|
||||
"authGateAction": "去登录",
|
||||
"cancel": "暂不"
|
||||
"cancel": "暂不",
|
||||
"noEpisodesYet": "还没有可播放的剧集。",
|
||||
"networkError": "网络异常,请检查网络后重试。",
|
||||
"progressError": "续看进度加载失败。",
|
||||
"favoritesError": "收藏列表加载失败。",
|
||||
"favoriteToggleFailed": "收藏操作失败,请重试。",
|
||||
"remove": "移除",
|
||||
"unlockComingSoon": "金币解锁功能即将开放。",
|
||||
"resumeProgress": "续看至 {position} / {total}",
|
||||
"@resumeProgress": {
|
||||
"placeholders": {
|
||||
"position": {},
|
||||
"total": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user