From d7bfa8f1e6e60826ea1c10a5befae10e471b9707 Mon Sep 17 00:00:00 2001 From: MUEDSA <7676275+muedsa@users.noreply.github.com> Date: Mon, 12 Aug 2024 16:20:19 +0800 Subject: [PATCH] remove: upscayl function --- app/src/main/kotlin/com/muedsa/jcytv/Perfs.kt | 4 +--- .../com/muedsa/jcytv/model/AppSettingModel.kt | 3 --- .../ui/features/detail/AnimeDetailScreen.kt | 13 ++---------- .../ui/features/setting/AppSettingScreen.kt | 20 ------------------- .../kotlin/com/muedsa/jcytv/util/Upscayl.kt | 8 -------- .../jcytv/viewmodel/AppSettingViewModel.kt | 9 --------- 6 files changed, 3 insertions(+), 54 deletions(-) delete mode 100644 app/src/main/kotlin/com/muedsa/jcytv/util/Upscayl.kt diff --git a/app/src/main/kotlin/com/muedsa/jcytv/Perfs.kt b/app/src/main/kotlin/com/muedsa/jcytv/Perfs.kt index 8cb1e8c..8c88481 100644 --- a/app/src/main/kotlin/com/muedsa/jcytv/Perfs.kt +++ b/app/src/main/kotlin/com/muedsa/jcytv/Perfs.kt @@ -11,6 +11,4 @@ val KEY_DANMAKU_SIZE_SCALE = intPreferencesKey("danmaku_size_scale") val KEY_DANMAKU_ALPHA = intPreferencesKey("danmaku_alpha") -val KEY_DANMAKU_SCREEN_PART = intPreferencesKey("danmaku_size_part") - -val KEY_UPSCAYL_COVER_IMAGE_ENABLE = booleanPreferencesKey("upscayl_cover_image_enable") \ No newline at end of file +val KEY_DANMAKU_SCREEN_PART = intPreferencesKey("danmaku_size_part") \ No newline at end of file diff --git a/app/src/main/kotlin/com/muedsa/jcytv/model/AppSettingModel.kt b/app/src/main/kotlin/com/muedsa/jcytv/model/AppSettingModel.kt index 7b712db..2cd79ee 100644 --- a/app/src/main/kotlin/com/muedsa/jcytv/model/AppSettingModel.kt +++ b/app/src/main/kotlin/com/muedsa/jcytv/model/AppSettingModel.kt @@ -6,7 +6,6 @@ import com.muedsa.jcytv.KEY_DANMAKU_ENABLE import com.muedsa.jcytv.KEY_DANMAKU_MERGE_ENABLE import com.muedsa.jcytv.KEY_DANMAKU_SCREEN_PART import com.muedsa.jcytv.KEY_DANMAKU_SIZE_SCALE -import com.muedsa.jcytv.KEY_UPSCAYL_COVER_IMAGE_ENABLE data class AppSettingModel( val danmakuEnable: Boolean, @@ -14,7 +13,6 @@ data class AppSettingModel( val danmakuSizeScale: Int, val danmakuAlpha: Int, val danmakuScreenPart: Int, - val upscaylCoverImageEnable: Boolean ) { companion object { @@ -26,7 +24,6 @@ data class AppSettingModel( danmakuSizeScale = prefs[KEY_DANMAKU_SIZE_SCALE] ?: 140, danmakuAlpha = prefs[KEY_DANMAKU_ALPHA] ?: 100, danmakuScreenPart = prefs[KEY_DANMAKU_SCREEN_PART] ?: 100, - upscaylCoverImageEnable = prefs[KEY_UPSCAYL_COVER_IMAGE_ENABLE] ?: false ) } diff --git a/app/src/main/kotlin/com/muedsa/jcytv/ui/features/detail/AnimeDetailScreen.kt b/app/src/main/kotlin/com/muedsa/jcytv/ui/features/detail/AnimeDetailScreen.kt index 8be95d0..1023902 100644 --- a/app/src/main/kotlin/com/muedsa/jcytv/ui/features/detail/AnimeDetailScreen.kt +++ b/app/src/main/kotlin/com/muedsa/jcytv/ui/features/detail/AnimeDetailScreen.kt @@ -69,16 +69,13 @@ import com.muedsa.jcytv.ui.RankFontColor import com.muedsa.jcytv.ui.RankIconColor import com.muedsa.jcytv.ui.nav.NavigationItems import com.muedsa.jcytv.ui.nav.navigate -import com.muedsa.jcytv.util.Upscayl import com.muedsa.jcytv.viewmodel.AnimeDetailViewModel -import com.muedsa.jcytv.viewmodel.AppSettingViewModel import com.muedsa.model.LazyType import com.muedsa.uitl.LogUtil @Composable fun AnimeDetailScreen( - viewModel: AnimeDetailViewModel = hiltViewModel(), - appSettingViewModel: AppSettingViewModel = hiltViewModel() + viewModel: AnimeDetailViewModel = hiltViewModel() ) { val context = LocalContext.current val configuration = LocalConfiguration.current @@ -95,8 +92,6 @@ fun AnimeDetailScreen( val danSearchAnimeListLD by viewModel.danSearchAnimeListLDSF.collectAsState() val danAnimeInfoLD by viewModel.danAnimeInfoLDSF.collectAsState() - val settingLD by appSettingViewModel.settingLDSF.collectAsState() - val episodeRelationMap = remember { mutableStateMapOf() } val backgroundState = rememberScreenBackgroundState( @@ -108,11 +103,7 @@ fun AnimeDetailScreen( errorMsgBoxController.error(animeDetailLD.error) } else if (animeDetailLD.type == LazyType.SUCCESS) { if (animeDetailLD.data != null) { - if (settingLD.data?.upscaylCoverImageEnable == true) { - backgroundState.url = Upscayl.url(animeDetailLD.data!!.imageUrl) - } else { - backgroundState.url = animeDetailLD.data!!.imageUrl - } + backgroundState.url = animeDetailLD.data!!.imageUrl } } } diff --git a/app/src/main/kotlin/com/muedsa/jcytv/ui/features/setting/AppSettingScreen.kt b/app/src/main/kotlin/com/muedsa/jcytv/ui/features/setting/AppSettingScreen.kt index 5e5b60c..7e7dfb7 100644 --- a/app/src/main/kotlin/com/muedsa/jcytv/ui/features/setting/AppSettingScreen.kt +++ b/app/src/main/kotlin/com/muedsa/jcytv/ui/features/setting/AppSettingScreen.kt @@ -227,26 +227,6 @@ fun AppSettingScreen( } } - Row( - modifier = Modifier - .fillMaxWidth() - .padding(bottom = 20.dp), - horizontalArrangement = Arrangement.SpaceBetween, - verticalAlignment = Alignment.CenterVertically - ) { - Text( - text = "UPSCAYL", - color = MaterialTheme.colorScheme.onBackground, - style = MaterialTheme.typography.titleMedium - ) - FocusScaleSwitch( - checked = settingModel.upscaylCoverImageEnable, - onCheckedChange = { - viewModel.changeUpscaylCoverImageEnable(it) - } - ) - } - HorizontalDivider() Row( diff --git a/app/src/main/kotlin/com/muedsa/jcytv/util/Upscayl.kt b/app/src/main/kotlin/com/muedsa/jcytv/util/Upscayl.kt deleted file mode 100644 index 59bcf64..0000000 --- a/app/src/main/kotlin/com/muedsa/jcytv/util/Upscayl.kt +++ /dev/null @@ -1,8 +0,0 @@ -package com.muedsa.jcytv.util - -import android.net.Uri - -object Upscayl { - fun url(url: String): String = - "https://upscayl.muedsa.com/upscayl?model=realesrgan-x4plus-anime&url=${Uri.encode(url)}" -} \ No newline at end of file diff --git a/app/src/main/kotlin/com/muedsa/jcytv/viewmodel/AppSettingViewModel.kt b/app/src/main/kotlin/com/muedsa/jcytv/viewmodel/AppSettingViewModel.kt index 950f3b1..f281c2d 100644 --- a/app/src/main/kotlin/com/muedsa/jcytv/viewmodel/AppSettingViewModel.kt +++ b/app/src/main/kotlin/com/muedsa/jcytv/viewmodel/AppSettingViewModel.kt @@ -8,7 +8,6 @@ import com.muedsa.jcytv.KEY_DANMAKU_ENABLE import com.muedsa.jcytv.KEY_DANMAKU_MERGE_ENABLE import com.muedsa.jcytv.KEY_DANMAKU_SCREEN_PART import com.muedsa.jcytv.KEY_DANMAKU_SIZE_SCALE -import com.muedsa.jcytv.KEY_UPSCAYL_COVER_IMAGE_ENABLE import com.muedsa.jcytv.model.AppSettingModel import com.muedsa.jcytv.repository.DataStoreRepo import com.muedsa.model.LazyData @@ -90,12 +89,4 @@ class AppSettingViewModel @Inject constructor( } } - fun changeUpscaylCoverImageEnable(enable: Boolean) { - viewModelScope.launch(Dispatchers.IO) { - repo.dataStore.edit { - it[KEY_UPSCAYL_COVER_IMAGE_ENABLE] = enable - } - } - } - } \ No newline at end of file