diff --git a/android/src/main/kotlin/ca/gosyer/jui/android/data/update/UpdateCheckWorker.kt b/android/src/main/kotlin/ca/gosyer/jui/android/data/update/UpdateCheckWorker.kt index 9033f163..fc70aeaa 100644 --- a/android/src/main/kotlin/ca/gosyer/jui/android/data/update/UpdateCheckWorker.kt +++ b/android/src/main/kotlin/ca/gosyer/jui/android/data/update/UpdateCheckWorker.kt @@ -30,7 +30,9 @@ class UpdateCheckWorker(private val context: Context, workerParams: WorkerParame .let { if (it.updatePreferences.enabled().get()) { it.updateChecker.await(false) - } else null + } else { + null + } } if (update is Update.UpdateFound) { diff --git a/core/src/commonMain/kotlin/ca/gosyer/jui/core/lang/String.kt b/core/src/commonMain/kotlin/ca/gosyer/jui/core/lang/String.kt index 4fcd96ef..13008f92 100644 --- a/core/src/commonMain/kotlin/ca/gosyer/jui/core/lang/String.kt +++ b/core/src/commonMain/kotlin/ca/gosyer/jui/core/lang/String.kt @@ -21,5 +21,7 @@ fun String.chop(count: Int, replacement: String = "…"): String { fun String.addSuffix(char: Char): String { return if (endsWith(char)) { this - } else this + char + } else { + this + char + } } diff --git a/core/src/commonMain/kotlin/ca/gosyer/jui/core/prefs/Preference.kt b/core/src/commonMain/kotlin/ca/gosyer/jui/core/prefs/Preference.kt index 01f915c8..232b4518 100644 --- a/core/src/commonMain/kotlin/ca/gosyer/jui/core/prefs/Preference.kt +++ b/core/src/commonMain/kotlin/ca/gosyer/jui/core/prefs/Preference.kt @@ -65,5 +65,7 @@ fun Preference.getAsFlow(action: (suspend (T) -> Unit)? = null): Flow .onStart { emit(get()) } return if (action != null) { flow.onEach(action = action) - } else flow + } else { + flow + } } diff --git a/desktop/src/main/kotlin/ca/gosyer/jui/desktop/main.kt b/desktop/src/main/kotlin/ca/gosyer/jui/desktop/main.kt index 249c5475..ecf5f870 100644 --- a/desktop/src/main/kotlin/ca/gosyer/jui/desktop/main.kt +++ b/desktop/src/main/kotlin/ca/gosyer/jui/desktop/main.kt @@ -173,7 +173,9 @@ suspend fun main() { } else -> false } - } else false + } else { + false + } } ) { AppTheme { diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/category/interactor/GetCategories.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/category/interactor/GetCategories.kt index 485ca8a8..5020741d 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/category/interactor/GetCategories.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/category/interactor/GetCategories.kt @@ -23,7 +23,9 @@ class GetCategories @Inject constructor(private val categoryRepository: Category .map { categories -> if (dropDefault) { categories.filterNot { it.name.equals("default", true) } - } else categories + } else { + categories + } } companion object { diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/download/model/DownloadState.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/download/model/DownloadState.kt index 61e48663..687b6645 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/download/model/DownloadState.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/download/model/DownloadState.kt @@ -13,5 +13,5 @@ enum class DownloadState(val state: Int) { Queued(0), Downloading(1), Finished(2), - Error(3), + Error(3) } diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/reader/model/ImageScale.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/reader/model/ImageScale.kt index 2e6f0e7d..f2ccd228 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/reader/model/ImageScale.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/reader/model/ImageScale.kt @@ -18,5 +18,5 @@ enum class ImageScale(@Transient val res: StringResource) { FitWidth(MR.strings.scale_fit_width), FitHeight(MR.strings.scale_fit_height), OriginalSize(MR.strings.scale_original), - SmartFit(MR.strings.scale_smart), + SmartFit(MR.strings.scale_smart) } diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/reader/model/NavigationMode.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/reader/model/NavigationMode.kt index 6a80d0a7..440ff3a5 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/reader/model/NavigationMode.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/reader/model/NavigationMode.kt @@ -16,5 +16,5 @@ enum class NavigationMode(@Transient val res: StringResource) { LNavigation(MR.strings.nav_l_shaped), KindlishNavigation(MR.strings.nav_kindle_ish), EdgeNavigation(MR.strings.nav_edge), - RightAndLeftNavigation(MR.strings.nav_left_right), + RightAndLeftNavigation(MR.strings.nav_left_right) } diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/reader/service/ReaderModePreferences.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/reader/service/ReaderModePreferences.kt index 1fa59871..db7cae17 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/reader/service/ReaderModePreferences.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/reader/service/ReaderModePreferences.kt @@ -52,7 +52,9 @@ class ReaderModePreferences(private val mode: String, private val preferenceStor } else { 700 } - } else 0 + } else { + 0 + } ) } diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/SourceFilterChange.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/SourceFilterChange.kt index 31d9e742..15d3ac4c 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/SourceFilterChange.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/SourceFilterChange.kt @@ -16,6 +16,8 @@ data class SourceFilterChange(val position: Int, val state: String) { position, if (state is SortFilter.Selection) { Json.encodeToString(state) - } else state.toString() + } else { + state.toString() + } ) } diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcepreference/SourcePreferenceChange.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcepreference/SourcePreferenceChange.kt index 99411cf2..d78821a7 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcepreference/SourcePreferenceChange.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcepreference/SourcePreferenceChange.kt @@ -17,6 +17,8 @@ data class SourcePreferenceChange(val position: Int, val value: String) { if (value is List<*>) { @Suppress("UNCHECKED_CAST") Json.encodeToString(value as List) - } else value.toString() + } else { + value.toString() + } ) } diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/ui/model/ThemeMode.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/ui/model/ThemeMode.kt index 6d0508a0..2861ba32 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/ui/model/ThemeMode.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/ui/model/ThemeMode.kt @@ -12,5 +12,5 @@ import kotlinx.serialization.Serializable enum class ThemeMode { System, Light, - Dark, + Dark } diff --git a/domain/src/desktopMain/kotlin/ca/gosyer/jui/domain/server/service/ServerService.kt b/domain/src/desktopMain/kotlin/ca/gosyer/jui/domain/server/service/ServerService.kt index 26fbfc43..95008364 100644 --- a/domain/src/desktopMain/kotlin/ca/gosyer/jui/domain/server/service/ServerService.kt +++ b/domain/src/desktopMain/kotlin/ca/gosyer/jui/domain/server/service/ServerService.kt @@ -89,8 +89,12 @@ class ServerService @Inject constructor( if (file.toString().contains("java") || file.toString().contains("jdk")) { if (file.name.equals("bin", true)) { file - } else file.resolve("bin") - } else null + } else { + file.resolve("bin") + } + } else { + null + } } .mapNotNull { getJavaFromPath(it) } .firstOrNull() diff --git a/domain/src/desktopMain/kotlin/ca/gosyer/jui/domain/server/service/host/ServerHostPreference.kt b/domain/src/desktopMain/kotlin/ca/gosyer/jui/domain/server/service/host/ServerHostPreference.kt index 2889861c..d56f9d29 100644 --- a/domain/src/desktopMain/kotlin/ca/gosyer/jui/domain/server/service/host/ServerHostPreference.kt +++ b/domain/src/desktopMain/kotlin/ca/gosyer/jui/domain/server/service/host/ServerHostPreference.kt @@ -24,7 +24,9 @@ sealed class ServerHostPreference { val preference = preference().get().takeIf(::validate) return if (preference != null) { propertyPrefix + preference.toString() - } else null + } else { + null + } } protected abstract val preferenceStore: PreferenceStore diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/downloads/DownloadsScreenViewModel.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/downloads/DownloadsScreenViewModel.kt index f78b4f2a..cd0fa97a 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/downloads/DownloadsScreenViewModel.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/downloads/DownloadsScreenViewModel.kt @@ -42,7 +42,9 @@ class DownloadsScreenViewModel @Inject constructor( ) : ViewModel(contextWrapper) { private val uiScope = if (standalone) { MainScope() - } else null + } else { + null + } override val scope: CoroutineScope get() = uiScope ?: super.scope diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/downloads/components/DownloadsScreenContent.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/downloads/components/DownloadsScreenContent.kt index 100d5287..7c7b67e3 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/downloads/components/DownloadsScreenContent.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/downloads/components/DownloadsScreenContent.kt @@ -173,7 +173,9 @@ fun DownloadsItem( ) val progress = if (item.chapter.pageCount != null && item.chapter.pageCount != -1) { " - " + "${(item.chapter.pageCount!! * item.progress).toInt()}/${item.chapter.pageCount}" - } else "" + } else { + "" + } MangaListItemSubtitle( text = item.chapter.name + progress ) diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/extensions/ExtensionsScreenViewModel.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/extensions/ExtensionsScreenViewModel.kt index 65d69b47..775179a6 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/extensions/ExtensionsScreenViewModel.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/extensions/ExtensionsScreenViewModel.kt @@ -143,7 +143,9 @@ class ExtensionsScreenViewModel @Inject constructor( .let { if (it.isNotEmpty()) { listOf(ExtensionUI.Header(MR.strings.installed.toPlatformString())) + it - } else it + } else { + it + } }.plus( filterNot(Extension::installed) .groupBy(Extension::lang) diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/components/DownloadsExtraInfo.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/components/DownloadsExtraInfo.kt index 2436d106..b5cfc897 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/components/DownloadsExtraInfo.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/components/DownloadsExtraInfo.kt @@ -47,7 +47,9 @@ fun DownloadsExtraInfo() { } else { remainingDownloads } - } else null + } else { + null + } } WebsocketService.Status.STOPPED -> null } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/manga/components/MangaScreenContent.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/manga/components/MangaScreenContent.kt index c693bd43..e77989b7 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/manga/components/MangaScreenContent.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/manga/components/MangaScreenContent.kt @@ -213,7 +213,9 @@ private fun getActionItems( icon = Icons.Rounded.Label, doAction = setCategories ) - } else null, + } else { + null + }, ActionItem( name = stringResource(if (inLibrary) MR.strings.action_remove_favorite else MR.strings.action_favorite), icon = if (inLibrary) { diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/ReaderSideMenu.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/ReaderSideMenu.kt index 33a4991c..8b71401b 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/ReaderSideMenu.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/ReaderSideMenu.kt @@ -277,7 +277,9 @@ private fun ReaderProgressSlider( modifier = modifier.let { if (isRtL) { it then Modifier.rotate(180F) - } else it + } else { + it + } } ) } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/loader/TachideskPageLoader.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/loader/TachideskPageLoader.kt index 5aff7285..a132e14b 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/loader/TachideskPageLoader.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/loader/TachideskPageLoader.kt @@ -113,7 +113,9 @@ class TachideskPageLoader( .getOrElse { ReaderPage.ImageDecodeState.FailedToDecode(it) } - } else ReaderPage.ImageDecodeState.UnknownDecoder + } else { + ReaderPage.ImageDecodeState.UnknownDecoder + } } ?: ReaderPage.ImageDecodeState.FailedToGetSnapShot } page.status.value = ReaderPage.Status.READY @@ -156,7 +158,9 @@ class TachideskPageLoader( channel.send(it) } } - } else null + } else { + null + } } } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/viewer/Continuous.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/viewer/Continuous.kt index e99888f1..b0fb29ef 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/viewer/Continuous.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/viewer/Continuous.kt @@ -114,7 +114,9 @@ fun ContinuousReader( Direction.Up, Direction.Down -> Modifier.width(maxSize.dp) Direction.Left, Direction.Right -> Modifier.height(maxSize.dp) } - } else Modifier + } else { + Modifier + } val contentPadding = when (direction) { Direction.Right -> PaddingValues(end = padding.dp) Direction.Left -> PaddingValues(start = padding.dp) diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/components/SourceScreenContent.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/components/SourceScreenContent.kt index 5f3968cf..7478d9fe 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/components/SourceScreenContent.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/components/SourceScreenContent.kt @@ -547,7 +547,9 @@ private fun getActionItems( doAction = onToggleFiltersClick, enabled = !isLatest ) - } else null, + } else { + null + }, if (showLatestButton) { ActionItem( name = stringResource( @@ -564,7 +566,9 @@ private fun getActionItems( }, doAction = onClickMode ) - } else null, + } else { + null + }, ActionItem( name = stringResource(MR.strings.display_mode), icon = Icons.Rounded.ViewModule, @@ -576,6 +580,8 @@ private fun getActionItems( icon = Icons.Rounded.Settings, doAction = onSourceSettingsClick ) - } else null + } else { + null + } ).toImmutableList() } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/filter/SourceFiltersMenu.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/filter/SourceFiltersMenu.kt index d5983f5e..ba32ab01 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/filter/SourceFiltersMenu.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/filter/SourceFiltersMenu.kt @@ -301,7 +301,9 @@ fun SortView(sortHolder: StableHolder, startExpanded: Bo index, if (state?.index == index) { state?.ascending?.not() ?: false - } else false + } else { + false + } ) ) } @@ -319,7 +321,9 @@ fun TextView(textHolder: StableHolder) { mutableStateOf( if (state == placeholderText) { "" - } else state + } else { + state + } ) } val interactionSource = remember { MutableInteractionSource() } diff --git a/ui-core/src/androidMain/kotlin/ca/gosyer/jui/uicore/components/AndroidScrollbar.kt b/ui-core/src/androidMain/kotlin/ca/gosyer/jui/uicore/components/AndroidScrollbar.kt index 3bc1e666..8c0fa779 100644 --- a/ui-core/src/androidMain/kotlin/ca/gosyer/jui/uicore/components/AndroidScrollbar.kt +++ b/ui-core/src/androidMain/kotlin/ca/gosyer/jui/uicore/components/AndroidScrollbar.kt @@ -198,11 +198,15 @@ private fun Modifier.drawScrollbar( val totalSize = estimatedItemSize * layoutInfo.totalItemsCount val canvasSize = if (orientation == Orientation.Horizontal) size.width else size.height val thumbSize = viewportSize / totalSize * canvasSize - val startOffset = if (items.isEmpty()) 0f else items - .first() - .run { - (estimatedItemSize * index - offset) / totalSize * canvasSize - } + val startOffset = if (items.isEmpty()) { + 0f + } else { + items + .first() + .run { + (estimatedItemSize * index - offset) / totalSize * canvasSize + } + } val drawScrollbar = onDrawScrollbar( orientation = orientation, reverseDirection = reverseDirection, @@ -245,11 +249,15 @@ private fun Modifier.drawScrollbar( val totalSize = estimatedItemSize * layoutInfo.totalItemsCount val canvasSize = if (orientation == Orientation.Horizontal) size.width else size.height val thumbSize = viewportSize / totalSize * canvasSize - val startOffset = if (items.isEmpty()) 0f else items - .first() - .run { - (estimatedItemSize * index - if (orientation == Orientation.Vertical) offset.y else offset.x) / totalSize * canvasSize - } + val startOffset = if (items.isEmpty()) { + 0f + } else { + items + .first() + .run { + (estimatedItemSize * index - if (orientation == Orientation.Vertical) offset.y else offset.x) / totalSize * canvasSize + } + } val drawScrollbar = onDrawScrollbar( orientation = orientation, reverseDirection = reverseDirection, @@ -332,7 +340,9 @@ private fun Modifier.drawScrollbar( val isLtr = LocalLayoutDirection.current == LayoutDirection.Ltr val reverseDirection = if (orientation == Orientation.Horizontal) { if (isLtr) reverseScrolling else !reverseScrolling - } else reverseScrolling + } else { + reverseScrolling + } val atEnd = if (orientation == Orientation.Vertical) isLtr else true // Calculate thickness here to workaround https://issuetracker.google.com/issues/206972664 diff --git a/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/components/KeyboardHandler.kt b/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/components/KeyboardHandler.kt index c6172657..5a2f9be4 100644 --- a/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/components/KeyboardHandler.kt +++ b/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/components/KeyboardHandler.kt @@ -30,7 +30,11 @@ fun Modifier.keyboardHandler( } else if (it.key == Key.Tab) { action(focusManager) true - } else false - } else false + } else { + false + } + } else { + false + } } } diff --git a/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/image/ImageLoaderImage.kt b/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/image/ImageLoaderImage.kt index e163d351..a706325d 100644 --- a/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/image/ImageLoaderImage.kt +++ b/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/image/ImageLoaderImage.kt @@ -44,7 +44,7 @@ private val log = logging() private enum class ImageLoaderImageState { Loading, Success, - Failure, + Failure } @Composable