Skip to content

Commit 7e5c1b7

Browse files
committed
fix: Update VLC proxy settings when user info changes
1 parent 9547f97 commit 7e5c1b7

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import com.jankinwu.fntv.client.data.model.ScrollRowItemData
2929
import com.jankinwu.fntv.client.data.model.request.Tags
3030
import com.jankinwu.fntv.client.data.model.response.UserInfoResponse
3131
import com.jankinwu.fntv.client.data.store.AccountDataCache
32+
import com.jankinwu.fntv.client.data.store.UserInfoMemoryCache
3233
import com.jankinwu.fntv.client.enums.FnTvMediaType
3334
import com.jankinwu.fntv.client.manager.HandleFavoriteResult
3435
import com.jankinwu.fntv.client.manager.HandleWatchedResult
@@ -370,6 +371,7 @@ fun FntvProxy(toastManager: ToastManager) {
370371
val store = LocalStore.current
371372
val proxySettingViewModel = koinViewModel<ProxySettingViewModel>()
372373
val proxyUiState by proxySettingViewModel.uiState.collectAsState()
374+
val userInfo by UserInfoMemoryCache.userInfo.collectAsState()
373375
LaunchedEffect(Unit) {
374376
if (!store.proxyInitialized) {
375377
proxySettingViewModel.clearError()
@@ -379,6 +381,14 @@ fun FntvProxy(toastManager: ToastManager) {
379381
)
380382
}
381383
}
384+
// 监听用户信息变化,当切换用户时重新设置 VLC 代理信息
385+
LaunchedEffect(userInfo) {
386+
proxySettingViewModel.clearError()
387+
proxySettingViewModel.setProxyInfo(
388+
url = AccountDataCache.getFnOfficialBaseUrl(),
389+
cookie = AccountDataCache.cookieState
390+
)
391+
}
382392
LaunchedEffect(proxyUiState) {
383393
if (!store.proxyInitialized) {
384394
when (proxyUiState) {

0 commit comments

Comments
 (0)