Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(ui): remove reading dark theme preference #890

Merged
merged 1 commit into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ fun Preferences.toSettings(): Settings {
readingRenderer = ReadingRendererPreference.fromPreferences(this),
readingBionicReading = ReadingBionicReadingPreference.fromPreferences(this),
readingTheme = ReadingThemePreference.fromPreferences(this),
readingDarkTheme = ReadingDarkThemePreference.fromPreferences(this),
readingPageTonalElevation = ReadingPageTonalElevationPreference.fromPreferences(this),
readingAutoHideToolbar = ReadingAutoHideToolbarPreference.fromPreferences(this),
readingTextFontSize = ReadingTextFontSizePreference.fromPreferences(this),
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ data class Settings(
val readingRenderer: ReadingRendererPreference = ReadingRendererPreference.default,
val readingBionicReading: ReadingBionicReadingPreference = ReadingBionicReadingPreference.default,
val readingTheme: ReadingThemePreference = ReadingThemePreference.default,
val readingDarkTheme: ReadingDarkThemePreference = ReadingDarkThemePreference.default,
val readingPageTonalElevation: ReadingPageTonalElevationPreference = ReadingPageTonalElevationPreference.default,
val readingAutoHideToolbar: ReadingAutoHideToolbarPreference = ReadingAutoHideToolbarPreference.default,
val readingTextFontSize: Int = ReadingTextFontSizePreference.default,
Expand Down Expand Up @@ -146,7 +145,6 @@ fun SettingsProvider(
LocalReadingRenderer provides settings.readingRenderer,
LocalReadingBionicReading provides settings.readingBionicReading,
LocalReadingTheme provides settings.readingTheme,
LocalReadingDarkTheme provides settings.readingDarkTheme,
LocalReadingPageTonalElevation provides settings.readingPageTonalElevation,
LocalReadingAutoHideToolbar provides settings.readingAutoHideToolbar,
LocalReadingTextFontSize provides settings.readingTextFontSize,
Expand Down
2 changes: 0 additions & 2 deletions app/src/main/java/me/ash/reader/ui/ext/DataStoreExt.kt
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ data class DataStoreKey<T>(
// Reading page
const val readingRenderer = "readingRender"
const val readingBionicReading = "readingBionicReading"
const val readingDarkTheme = "readingDarkTheme"
const val readingPageTonalElevation = "readingPageTonalElevation"
const val readingTextFontSize = "readingTextFontSize"
const val readingTextLineHeight = "readingTextLineHeight"
Expand Down Expand Up @@ -212,7 +211,6 @@ data class DataStoreKey<T>(
// Reading page
readingRenderer to DataStoreKey(intPreferencesKey(readingRenderer), Int::class.java),
readingBionicReading to DataStoreKey(booleanPreferencesKey(readingBionicReading), Boolean::class.java),
readingDarkTheme to DataStoreKey(intPreferencesKey(readingDarkTheme), Int::class.java),
readingPageTonalElevation to DataStoreKey(intPreferencesKey(readingPageTonalElevation), Int::class.java),
readingTextFontSize to DataStoreKey(intPreferencesKey(readingTextFontSize), Int::class.java),
readingTextLineHeight to DataStoreKey(floatPreferencesKey(readingTextLineHeight), Float::class.java),
Expand Down
14 changes: 1 addition & 13 deletions app/src/main/java/me/ash/reader/ui/page/common/HomeEntry.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.collectLatest
import me.ash.reader.domain.model.general.Filter
import me.ash.reader.infrastructure.preference.LocalDarkTheme
import me.ash.reader.infrastructure.preference.LocalReadingDarkTheme
import me.ash.reader.ui.ext.animatedComposable
import me.ash.reader.ui.ext.collectAsStateValue
import me.ash.reader.ui.ext.findActivity
Expand All @@ -41,7 +40,6 @@ import me.ash.reader.ui.page.settings.color.DarkThemePage
import me.ash.reader.ui.page.settings.color.feeds.FeedsPageStylePage
import me.ash.reader.ui.page.settings.color.flow.FlowPageStylePage
import me.ash.reader.ui.page.settings.color.reading.BionicReadingPage
import me.ash.reader.ui.page.settings.color.reading.ReadingDarkThemePage
import me.ash.reader.ui.page.settings.color.reading.ReadingImagePage
import me.ash.reader.ui.page.settings.color.reading.ReadingStylePage
import me.ash.reader.ui.page.settings.color.reading.ReadingTextPage
Expand Down Expand Up @@ -132,15 +130,8 @@ fun HomeEntry(
}
}

val useDarkTheme = if (isReadingPage) {
LocalReadingDarkTheme.current.isDarkTheme()
} else {
LocalDarkTheme.current.isDarkTheme()
}

AppTheme(
useDarkTheme = if (isReadingPage) LocalReadingDarkTheme.current.isDarkTheme()
else LocalDarkTheme.current.isDarkTheme()
useDarkTheme = LocalDarkTheme.current.isDarkTheme()
) {

NavHost(
Expand Down Expand Up @@ -210,9 +201,6 @@ fun HomeEntry(
animatedComposable(route = RouteName.READING_BIONIC_READING) {
BionicReadingPage(navController)
}
animatedComposable(route = RouteName.READING_DARK_THEME) {
ReadingDarkThemePage(navController)
}
animatedComposable(route = RouteName.READING_PAGE_TITLE) {
ReadingTitlePage(navController)
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,11 @@ import me.ash.reader.R
import me.ash.reader.infrastructure.preference.LocalPullToSwitchArticle
import me.ash.reader.infrastructure.preference.LocalReadingAutoHideToolbar
import me.ash.reader.infrastructure.preference.LocalReadingBionicReading
import me.ash.reader.infrastructure.preference.LocalReadingDarkTheme
import me.ash.reader.infrastructure.preference.LocalReadingFonts
import me.ash.reader.infrastructure.preference.LocalReadingPageTonalElevation
import me.ash.reader.infrastructure.preference.LocalReadingRenderer
import me.ash.reader.infrastructure.preference.LocalReadingTheme
import me.ash.reader.infrastructure.preference.ReadingFontsPreference
import me.ash.reader.infrastructure.preference.ReadingPageTonalElevationPreference
import me.ash.reader.infrastructure.preference.ReadingRendererPreference
import me.ash.reader.infrastructure.preference.ReadingThemePreference
import me.ash.reader.infrastructure.preference.not
Expand All @@ -76,8 +74,6 @@ fun ReadingStylePage(
val scope = rememberCoroutineScope()

val readingTheme = LocalReadingTheme.current
val darkTheme = LocalReadingDarkTheme.current
val darkThemeNot = !darkTheme
val tonalElevation = LocalReadingPageTonalElevation.current
val fonts = LocalReadingFonts.current
val autoHideToolbar = LocalReadingAutoHideToolbar.current
Expand Down Expand Up @@ -187,22 +183,6 @@ fun ReadingStylePage(
desc = fonts.toDesc(context),
onClick = { fontsDialogVisible = true },
) {}
SettingItem(
title = stringResource(R.string.dark_reading_theme),
desc = darkTheme.toDesc(context),
separatedActions = true,
onClick = {
navController.navigate(RouteName.READING_DARK_THEME) {
launchSingleTop = true
}
},
) {
RYSwitch(
activated = darkTheme.isDarkTheme()
) {
darkThemeNot.put(context, scope)
}
}
SettingItem(
title = stringResource(R.string.auto_hide_toolbars),
onClick = {
Expand Down
Loading