Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
nxoim committed Sep 20, 2024
1 parent c2af76a commit b58531a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
3 changes: 2 additions & 1 deletion app/src/main/java/pl/lambada/songsync/ui/Navigator.kt
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ fun Navigator(
}
composable<ScreenAbout> {
AboutScreen(
viewModel = viewModel { AboutViewModel(userSettingsController) },
viewModel = viewModel { AboutViewModel() },
userSettingsController,
navController = navController
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import androidx.compose.ui.res.stringResource
import androidx.navigation.NavController
import pl.lambada.songsync.R
import pl.lambada.songsync.data.remote.UpdateState
import pl.lambada.songsync.data.remote.UserSettingsController
import pl.lambada.songsync.ui.screens.about.components.AboutScreenTopBar
import pl.lambada.songsync.ui.screens.about.components.AppInfoSection
import pl.lambada.songsync.ui.screens.about.components.ContributorsSection
Expand All @@ -38,6 +39,7 @@ import pl.lambada.songsync.util.ext.getVersion
@Composable
fun AboutScreen(
viewModel: AboutViewModel,
userSettingsController: UserSettingsController,
navController: NavController
) {
val context = LocalContext.current
Expand All @@ -60,32 +62,32 @@ fun AboutScreen(
) {
item {
if (isSystemInDarkTheme()) PureBlackThemeSwitch(
selected = viewModel.userSettingsController.pureBlack,
onToggle = { viewModel.userSettingsController.updatePureBlack(it) }
selected = userSettingsController.pureBlack,
onToggle = { userSettingsController.updatePureBlack(it) }
)
}

item {
MarqueeSwitch(
selected = viewModel.userSettingsController.disableMarquee,
onToggle = { viewModel.userSettingsController.updateDisableMarquee(it) }
selected = userSettingsController.disableMarquee,
onToggle = { userSettingsController.updateDisableMarquee(it) }
)
}

item {
TranslationSwitch(
selected = viewModel.userSettingsController.includeTranslation,
onToggle = { viewModel.userSettingsController.updateIncludeTranslation(it) }
selected = userSettingsController.includeTranslation,
onToggle = { userSettingsController.updateIncludeTranslation(it) }
)
}

if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R) {
item {
SdCardPathSetting(
sdPath = viewModel.userSettingsController.sdCardPath,
onClearPath = { viewModel.userSettingsController.updateSdCardPath("") },
sdPath = userSettingsController.sdCardPath,
onClearPath = { userSettingsController.updateSdCardPath("") },
onUpdatePath = { newPath ->
viewModel.userSettingsController.updateSdCardPath(
userSettingsController.updateSdCardPath(
newPath
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,12 @@ import kotlinx.coroutines.withContext
import pl.lambada.songsync.R
import pl.lambada.songsync.data.remote.UpdateService
import pl.lambada.songsync.data.remote.UpdateState
import pl.lambada.songsync.data.remote.UserSettingsController
import pl.lambada.songsync.util.showToast

/**
* ViewModel class for the main functionality of the app.
*/
class AboutViewModel(
val userSettingsController: UserSettingsController,
private val updateService: UpdateService = UpdateService()
) : ViewModel() {
var updateState by mutableStateOf<UpdateState>(UpdateState.Idle)
Expand Down

0 comments on commit b58531a

Please sign in to comment.