From b9224bccfccd3cf306b6d3edf7285cffade42194 Mon Sep 17 00:00:00 2001 From: MUEDSA <7676275+muedsa@users.noreply.github.com> Date: Tue, 7 Nov 2023 12:35:42 +0800 Subject: [PATCH] fix: home page fetch --- app/src/main/kotlin/com/muedsa/agetv/MainActivity.kt | 1 + .../com/muedsa/agetv/ui/features/playback/PlaybackScreen.kt | 5 ++++- .../kotlin/com/muedsa/agetv/viewmodel/HomePageViewModel.kt | 6 ------ 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/app/src/main/kotlin/com/muedsa/agetv/MainActivity.kt b/app/src/main/kotlin/com/muedsa/agetv/MainActivity.kt index 6ebd523..85dc7fe 100644 --- a/app/src/main/kotlin/com/muedsa/agetv/MainActivity.kt +++ b/app/src/main/kotlin/com/muedsa/agetv/MainActivity.kt @@ -33,6 +33,7 @@ class MainActivity : ComponentActivity() { splashScreen.setKeepOnScreenCondition { homePageViewModel.homeDataState.value.type == LazyType.LOADING } + homePageViewModel.fetchHome() setContent { TvTheme { diff --git a/app/src/main/kotlin/com/muedsa/agetv/ui/features/playback/PlaybackScreen.kt b/app/src/main/kotlin/com/muedsa/agetv/ui/features/playback/PlaybackScreen.kt index 2aa0708..dc3b7c3 100644 --- a/app/src/main/kotlin/com/muedsa/agetv/ui/features/playback/PlaybackScreen.kt +++ b/app/src/main/kotlin/com/muedsa/agetv/ui/features/playback/PlaybackScreen.kt @@ -23,7 +23,10 @@ import com.muedsa.uitl.LogUtil @Composable @OptIn(UnstableApi::class) fun PlaybackScreen( - mediaUrl: String + aid: Int, + episodeTitle: String, + mediaUrl: String, + danEpisodeId: Long = 0, ) { val context = LocalContext.current val errorMessageBoxState = remember { ErrorMessageBoxState() } diff --git a/app/src/main/kotlin/com/muedsa/agetv/viewmodel/HomePageViewModel.kt b/app/src/main/kotlin/com/muedsa/agetv/viewmodel/HomePageViewModel.kt index 2f9b3f2..3d80dc2 100644 --- a/app/src/main/kotlin/com/muedsa/agetv/viewmodel/HomePageViewModel.kt +++ b/app/src/main/kotlin/com/muedsa/agetv/viewmodel/HomePageViewModel.kt @@ -35,10 +35,4 @@ class HomePageViewModel @Inject constructor( } } } - - init { - viewModelScope.launch(context = Dispatchers.IO) { - fetchHome() - } - } } \ No newline at end of file