diff --git a/core/commonui/lemmyui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/lemmyui/InboxCard.kt b/core/commonui/lemmyui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/lemmyui/InboxCard.kt index d6d370c9a..69a85e894 100644 --- a/core/commonui/lemmyui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/lemmyui/InboxCard.kt +++ b/core/commonui/lemmyui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/lemmyui/InboxCard.kt @@ -50,17 +50,19 @@ fun InboxCard( onOptionSelected: ((OptionId) -> Unit)? = null, ) { Box( - modifier = Modifier.let { + modifier = Modifier.then( if (postLayout == PostLayout.Card) { - it.padding(horizontal = Spacing.xs) + Modifier + .padding(horizontal = Spacing.xs) .background( color = MaterialTheme.colorScheme.surfaceColorAtElevation(5.dp), shape = RoundedCornerShape(CornerSize.l), - ).padding(Spacing.s) + ) + .padding(Spacing.s) } else { - it.background(MaterialTheme.colorScheme.background) + Modifier.background(MaterialTheme.colorScheme.background) } - }.onClick( + ).onClick( onClick = rememberCallback { onOpenPost(mention.post) }, diff --git a/core/commonui/lemmyui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/lemmyui/InboxCardPlaceholder.kt b/core/commonui/lemmyui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/lemmyui/InboxCardPlaceholder.kt index 8183d862c..fa6243fa8 100644 --- a/core/commonui/lemmyui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/lemmyui/InboxCardPlaceholder.kt +++ b/core/commonui/lemmyui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/lemmyui/InboxCardPlaceholder.kt @@ -25,16 +25,19 @@ fun InboxCardPlaceholder( postLayout: PostLayout = PostLayout.Card, ) { Column( - modifier = Modifier.let { + modifier = Modifier.then( if (postLayout == PostLayout.Card) { - it.padding(horizontal = Spacing.xs).background( - color = MaterialTheme.colorScheme.surfaceColorAtElevation(5.dp), - shape = RoundedCornerShape(CornerSize.l), - ).padding(Spacing.s) + Modifier + .padding(horizontal = Spacing.xs) + .background( + color = MaterialTheme.colorScheme.surfaceColorAtElevation(5.dp), + shape = RoundedCornerShape(CornerSize.l), + ) + .padding(Spacing.s) } else { - it + Modifier } - }, + ), verticalArrangement = Arrangement.spacedBy(Spacing.xs), ) { Box( diff --git a/core/utils/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/utils/compose/OnClick.kt b/core/utils/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/utils/compose/OnClick.kt index b99b6e78d..b25330052 100644 --- a/core/utils/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/utils/compose/OnClick.kt +++ b/core/utils/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/utils/compose/OnClick.kt @@ -3,27 +3,26 @@ package com.github.diegoberaldin.raccoonforlemmy.core.utils.compose import androidx.compose.foundation.ExperimentalFoundationApi import androidx.compose.foundation.combinedClickable import androidx.compose.foundation.interaction.MutableInteractionSource +import androidx.compose.runtime.Composable import androidx.compose.runtime.remember import androidx.compose.ui.Modifier -import androidx.compose.ui.composed @OptIn(ExperimentalFoundationApi::class) +@Composable fun Modifier.onClick( onClick: () -> Unit = {}, onDoubleClick: () -> Unit = {}, onLongClick: () -> Unit = {}, -): Modifier = composed { - combinedClickable( - indication = null, - interactionSource = remember { MutableInteractionSource() }, - onClick = rememberCallback { - onClick() - }, - onDoubleClick = rememberCallback { - onDoubleClick() - }, - onLongClick = rememberCallback { - onLongClick() - } - ) -} \ No newline at end of file +): Modifier = combinedClickable( + indication = null, + interactionSource = remember { MutableInteractionSource() }, + onClick = rememberCallback { + onClick() + }, + onDoubleClick = rememberCallback { + onDoubleClick() + }, + onLongClick = rememberCallback { + onLongClick() + } +) \ No newline at end of file diff --git a/core/utils/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/utils/compose/ShimmerEffect.kt b/core/utils/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/utils/compose/ShimmerEffect.kt index c56cc0066..d1fcb9d2e 100644 --- a/core/utils/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/utils/compose/ShimmerEffect.kt +++ b/core/utils/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/utils/compose/ShimmerEffect.kt @@ -6,21 +6,22 @@ import androidx.compose.animation.core.rememberInfiniteTransition import androidx.compose.animation.core.tween import androidx.compose.foundation.background import androidx.compose.material3.MaterialTheme +import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier -import androidx.compose.ui.composed import androidx.compose.ui.draw.alpha import androidx.compose.ui.geometry.Offset import androidx.compose.ui.graphics.Brush import androidx.compose.ui.layout.onGloballyPositioned import androidx.compose.ui.unit.IntSize +@Composable fun Modifier.shimmerEffect( duration: Int = 1000, -): Modifier = composed { +): Modifier { val c1 = MaterialTheme.colorScheme.onBackground.copy(alpha = 0.1f) val c2 = MaterialTheme.colorScheme.onBackground.copy(alpha = 0.3f) val colors = listOf(c1, c2, c1) @@ -36,7 +37,7 @@ fun Modifier.shimmerEffect( ) ) - background( + return this then background( brush = Brush.linearGradient( colors = colors, start = Offset(startOffsetX, 0f), diff --git a/feature/inbox/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/feature/inbox/main/InboxScreen.kt b/feature/inbox/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/feature/inbox/main/InboxScreen.kt index 5971f35a6..0d660a938 100644 --- a/feature/inbox/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/feature/inbox/main/InboxScreen.kt +++ b/feature/inbox/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/feature/inbox/main/InboxScreen.kt @@ -153,13 +153,13 @@ object InboxScreen : Tab { Column( modifier = Modifier .padding(paddingValues) - .let { + .then( if (settings.hideNavigationBarWhileScrolling) { - it.nestedScroll(scrollBehavior.nestedScrollConnection) + Modifier.nestedScroll(scrollBehavior.nestedScrollConnection) } else { - it + Modifier } - }, + ), verticalArrangement = Arrangement.spacedBy(Spacing.s), ) { SectionSelector( diff --git a/feature/profile/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/feature/profile/main/ProfileMainScreen.kt b/feature/profile/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/feature/profile/main/ProfileMainScreen.kt index 34a2e83c4..b8c4a9f14 100644 --- a/feature/profile/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/feature/profile/main/ProfileMainScreen.kt +++ b/feature/profile/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/feature/profile/main/ProfileMainScreen.kt @@ -149,17 +149,17 @@ internal object ProfileMainScreen : Tab { }, ) }, - ) { paddinValues -> + ) { paddingValues -> Box( modifier = Modifier - .padding(paddinValues) - .let { + .padding(paddingValues) + .then( if (settings.hideNavigationBarWhileScrolling) { - it.nestedScroll(scrollBehavior.nestedScrollConnection) + Modifier.nestedScroll(scrollBehavior.nestedScrollConnection) } else { - it + Modifier } - }, + ), contentAlignment = Alignment.Center, ) { // wait until logging status is determined diff --git a/feature/search/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/feature/search/main/ExploreScreen.kt b/feature/search/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/feature/search/main/ExploreScreen.kt index c696b0933..8474b12c1 100644 --- a/feature/search/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/feature/search/main/ExploreScreen.kt +++ b/feature/search/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/feature/search/main/ExploreScreen.kt @@ -275,13 +275,13 @@ class ExploreScreen : Screen { { model.reduce(ExploreMviModel.Intent.Refresh) }, ) Box( - modifier = Modifier.padding(Spacing.xxs).let { + modifier = Modifier.padding(Spacing.xxs).then( if (settings.hideNavigationBarWhileScrolling) { - it.nestedScroll(scrollBehavior.nestedScrollConnection) + Modifier.nestedScroll(scrollBehavior.nestedScrollConnection) } else { - it + Modifier } - }.nestedScroll(keyboardScrollConnection).pullRefresh(pullRefreshState), + ).nestedScroll(keyboardScrollConnection).pullRefresh(pullRefreshState), ) { LazyColumn( state = lazyListState, diff --git a/unit/accountsettings/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/accountsettings/AccountSettingsScreen.kt b/unit/accountsettings/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/accountsettings/AccountSettingsScreen.kt index a78d684c8..2bdd7cb72 100644 --- a/unit/accountsettings/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/accountsettings/AccountSettingsScreen.kt +++ b/unit/accountsettings/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/accountsettings/AccountSettingsScreen.kt @@ -185,13 +185,13 @@ class AccountSettingsScreen : Screen { Box( modifier = Modifier .padding(paddingValues) - .let { + .then( if (settings.hideNavigationBarWhileScrolling) { - it.nestedScroll(scrollBehavior.nestedScrollConnection) + Modifier.nestedScroll(scrollBehavior.nestedScrollConnection) } else { - it + Modifier } - }, + ) ) { Column( modifier = Modifier.fillMaxSize().verticalScroll(scrollState), diff --git a/unit/chat/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/chat/components/MessageCard.kt b/unit/chat/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/chat/components/MessageCard.kt index 376da30c3..ed7c2564e 100644 --- a/unit/chat/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/chat/components/MessageCard.kt +++ b/unit/chat/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/chat/components/MessageCard.kt @@ -67,13 +67,13 @@ internal fun MessageCard( Box { Canvas( - modifier = Modifier.size(mediumDistance).let { + modifier = Modifier.size(mediumDistance).then( if (isMyMessage) { - it.align(Alignment.TopEnd) + Modifier.align(Alignment.TopEnd) } else { - it.align(Alignment.TopStart) + Modifier.align(Alignment.TopStart) } - } + ) ) { if (isMyMessage) { val path = Path().apply { @@ -94,13 +94,13 @@ internal fun MessageCard( } } Box( - modifier = Modifier.let { + modifier = Modifier.then( if (isMyMessage) { - it.padding(start = longDistance, end = mediumDistance) + Modifier.padding(start = longDistance, end = mediumDistance) } else { - it.padding(end = longDistance, start = mediumDistance) + Modifier.padding(end = longDistance, start = mediumDistance) } - }.background( + ).background( color = color, shape = RoundedCornerShape( topStart = if (isMyMessage) CornerSize.m else 0.dp, topEnd = if (isMyMessage) 0.dp else CornerSize.m, diff --git a/unit/communitydetail/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/communitydetail/CommunityDetailScreen.kt b/unit/communitydetail/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/communitydetail/CommunityDetailScreen.kt index 2c26d2843..9c2209fcb 100644 --- a/unit/communitydetail/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/communitydetail/CommunityDetailScreen.kt +++ b/unit/communitydetail/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/communitydetail/CommunityDetailScreen.kt @@ -497,13 +497,13 @@ class CommunityDetailScreen( Box( modifier = Modifier .padding(padding) - .let { + .then( if (settings.hideNavigationBarWhileScrolling) { - it.nestedScroll(scrollBehavior.nestedScrollConnection) + Modifier.nestedScroll(scrollBehavior.nestedScrollConnection) } else { - it + Modifier } - } + ) .nestedScroll(fabNestedScrollConnection) .pullRefresh(pullRefreshState), ) { diff --git a/unit/instanceinfo/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/instanceinfo/InstanceInfoScreen.kt b/unit/instanceinfo/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/instanceinfo/InstanceInfoScreen.kt index 24bd1f2ad..6338978db 100644 --- a/unit/instanceinfo/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/instanceinfo/InstanceInfoScreen.kt +++ b/unit/instanceinfo/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/instanceinfo/InstanceInfoScreen.kt @@ -159,13 +159,13 @@ class InstanceInfoScreen( ) Box( modifier = Modifier - .let { + .then( if (settings.hideNavigationBarWhileScrolling) { - it.nestedScroll(scrollBehavior.nestedScrollConnection) + Modifier.nestedScroll(scrollBehavior.nestedScrollConnection) } else { - it + Modifier } - } + ) .padding(paddingValues) .pullRefresh(pullRefreshState), ) { diff --git a/unit/manageban/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/manageban/ManageBanScreen.kt b/unit/manageban/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/manageban/ManageBanScreen.kt index bb7401d12..0d332d15a 100644 --- a/unit/manageban/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/manageban/ManageBanScreen.kt +++ b/unit/manageban/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/manageban/ManageBanScreen.kt @@ -113,13 +113,15 @@ class ManageBanScreen : Screen { }, ) Column( - modifier = Modifier.padding(paddingValues).let { - if (settings.hideNavigationBarWhileScrolling) { - it.nestedScroll(scrollBehavior.nestedScrollConnection) - } else { - it - } - }, + modifier = Modifier + .padding(paddingValues) + .then( + if (settings.hideNavigationBarWhileScrolling) { + Modifier.nestedScroll(scrollBehavior.nestedScrollConnection) + } else { + Modifier + } + ), verticalArrangement = Arrangement.spacedBy(Spacing.s), ) { SectionSelector( @@ -146,13 +148,14 @@ class ManageBanScreen : Screen { Box( modifier = Modifier - .let { + .then( if (settings.hideNavigationBarWhileScrolling) { - it.nestedScroll(scrollBehavior.nestedScrollConnection) + Modifier.nestedScroll(scrollBehavior.nestedScrollConnection) } else { - it + Modifier } - }.pullRefresh(pullRefreshState), + ) + .pullRefresh(pullRefreshState), ) { LazyColumn( state = lazyListState, diff --git a/unit/managesubscriptions/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/managesubscriptions/ManageSubscriptionsScreen.kt b/unit/managesubscriptions/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/managesubscriptions/ManageSubscriptionsScreen.kt index 960a7098b..3b4c55fe3 100644 --- a/unit/managesubscriptions/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/managesubscriptions/ManageSubscriptionsScreen.kt +++ b/unit/managesubscriptions/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/managesubscriptions/ManageSubscriptionsScreen.kt @@ -145,13 +145,13 @@ class ManageSubscriptionsScreen : Screen { Box( modifier = Modifier .padding(paddingValues) - .let { + .then( if (settings.hideNavigationBarWhileScrolling) { - it.nestedScroll(scrollBehavior.nestedScrollConnection) + Modifier.nestedScroll(scrollBehavior.nestedScrollConnection) } else { - it + Modifier } - } + ) .nestedScroll(fabNestedScrollConnection) .pullRefresh(pullRefreshState), ) { diff --git a/unit/modlog/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/modlog/ModlogScreen.kt b/unit/modlog/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/modlog/ModlogScreen.kt index 4274df98a..4e2b4e190 100644 --- a/unit/modlog/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/modlog/ModlogScreen.kt +++ b/unit/modlog/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/modlog/ModlogScreen.kt @@ -124,24 +124,26 @@ class ModlogScreen( }, ) { paddingValues -> Column( - modifier = Modifier.padding(paddingValues).let { - if (settings.hideNavigationBarWhileScrolling) { - it.nestedScroll(scrollBehavior.nestedScrollConnection) - } else { - it - } - }, + modifier = Modifier + .padding(paddingValues) + .then( + if (settings.hideNavigationBarWhileScrolling) { + Modifier.nestedScroll(scrollBehavior.nestedScrollConnection) + } else { + Modifier + } + ), verticalArrangement = Arrangement.spacedBy(Spacing.s), ) { Box( modifier = Modifier - .let { + .then( if (settings.hideNavigationBarWhileScrolling) { - it.nestedScroll(scrollBehavior.nestedScrollConnection) + Modifier.nestedScroll(scrollBehavior.nestedScrollConnection) } else { - it + Modifier } - } + ) .pullRefresh(pullRefreshState), ) { LazyColumn( diff --git a/unit/multicommunity/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/multicommunity/detail/MultiCommunityScreen.kt b/unit/multicommunity/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/multicommunity/detail/MultiCommunityScreen.kt index 3231ea692..b70716fd7 100644 --- a/unit/multicommunity/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/multicommunity/detail/MultiCommunityScreen.kt +++ b/unit/multicommunity/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/multicommunity/detail/MultiCommunityScreen.kt @@ -241,13 +241,13 @@ class MultiCommunityScreen( modifier = Modifier .padding(padding) .fillMaxWidth() - .let { + .then( if (settings.hideNavigationBarWhileScrolling) { - it.nestedScroll(scrollBehavior.nestedScrollConnection) + Modifier.nestedScroll(scrollBehavior.nestedScrollConnection) } else { - it + Modifier } - } + ) .nestedScroll(fabNestedScrollConnection) .pullRefresh(pullRefreshState), ) { diff --git a/unit/postdetail/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/postdetail/PostDetailScreen.kt b/unit/postdetail/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/postdetail/PostDetailScreen.kt index 7a956941b..012e0c490 100644 --- a/unit/postdetail/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/postdetail/PostDetailScreen.kt +++ b/unit/postdetail/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/postdetail/PostDetailScreen.kt @@ -281,13 +281,13 @@ class PostDetailScreen( }, ) Box( - modifier = Modifier.padding(padding).let { + modifier = Modifier.padding(padding).then( if (settings.hideNavigationBarWhileScrolling) { - it.nestedScroll(scrollBehavior.nestedScrollConnection) + Modifier.nestedScroll(scrollBehavior.nestedScrollConnection) } else { - it + Modifier } - }.nestedScroll(fabNestedScrollConnection).pullRefresh(pullRefreshState), + ).nestedScroll(fabNestedScrollConnection).pullRefresh(pullRefreshState), ) { LazyColumn( state = lazyListState @@ -660,20 +660,19 @@ class PostDetailScreen( }, content = { CommentCard( - modifier = Modifier.background(MaterialTheme.colorScheme.background) - .let { + modifier = Modifier + .background(MaterialTheme.colorScheme.background) + .then( if (comment.id == commentIdToHighlight) { - it.background( + Modifier.background( MaterialTheme.colorScheme.surfaceColorAtElevation( 5.dp - ).copy( - alpha = 0.75f - ) + ).copy(alpha = 0.75f) ) } else { - it + Modifier } - }, + ), comment = comment, isOp = comment.creator?.id == uiState.post.creator?.id, voteFormat = uiState.voteFormat, diff --git a/unit/postlist/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/postlist/PostListScreen.kt b/unit/postlist/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/postlist/PostListScreen.kt index c01842fe6..9ea58dfd0 100644 --- a/unit/postlist/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/postlist/PostListScreen.kt +++ b/unit/postlist/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/postlist/PostListScreen.kt @@ -121,6 +121,7 @@ class PostListScreen : Screen { val settings by settingsRepository.currentSettings.collectAsState() val keepScreenOn = rememberKeepScreenOn() val detailOpener = remember { getDetailOpener() } + val connection = navigationCoordinator.getBottomBarScrollConnection() LaunchedEffect(navigationCoordinator) { navigationCoordinator.onDoubleTabSelection.onEach { section -> @@ -263,21 +264,19 @@ class PostListScreen : Screen { modifier = Modifier .padding(padding) .fillMaxWidth() - .let { - val connection = navigationCoordinator.getBottomBarScrollConnection() + .then( if (connection != null && settings.hideNavigationBarWhileScrolling) { - it.nestedScroll(connection) + Modifier.nestedScroll(connection) } else { - it + Modifier } - } - .let { + ).then( if (settings.hideNavigationBarWhileScrolling) { - it.nestedScroll(scrollBehavior.nestedScrollConnection) + Modifier.nestedScroll(scrollBehavior.nestedScrollConnection) } else { - it + Modifier } - } + ) .nestedScroll(fabNestedScrollConnection) .pullRefresh(pullRefreshState), ) { diff --git a/unit/reportlist/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/reportlist/ReportListScreen.kt b/unit/reportlist/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/reportlist/ReportListScreen.kt index 16890205e..b1db6e337 100644 --- a/unit/reportlist/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/reportlist/ReportListScreen.kt +++ b/unit/reportlist/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/reportlist/ReportListScreen.kt @@ -156,13 +156,13 @@ class ReportListScreen( }, ) { paddingValues -> Column( - modifier = Modifier.padding(paddingValues).let { + modifier = Modifier.padding(paddingValues).then( if (settings.hideNavigationBarWhileScrolling) { - it.nestedScroll(scrollBehavior.nestedScrollConnection) + Modifier.nestedScroll(scrollBehavior.nestedScrollConnection) } else { - it + Modifier } - }, + ), verticalArrangement = Arrangement.spacedBy(Spacing.s), ) { SectionSelector( @@ -186,13 +186,13 @@ class ReportListScreen( Box( modifier = Modifier - .let { + .then( if (settings.hideNavigationBarWhileScrolling) { - it.nestedScroll(scrollBehavior.nestedScrollConnection) + Modifier.nestedScroll(scrollBehavior.nestedScrollConnection) } else { - it + Modifier } - } + ) .pullRefresh(pullRefreshState), ) { LazyColumn( diff --git a/unit/reportlist/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/reportlist/components/InnerReportCard.kt b/unit/reportlist/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/reportlist/components/InnerReportCard.kt index 1b638ade1..38f77b578 100644 --- a/unit/reportlist/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/reportlist/components/InnerReportCard.kt +++ b/unit/reportlist/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/reportlist/components/InnerReportCard.kt @@ -69,17 +69,19 @@ internal fun InnerReportCard( onOptionSelected: ((OptionId) -> Unit)? = null, ) { Box( - modifier = modifier.let { + modifier = modifier.then( if (postLayout == PostLayout.Card) { - it.padding(horizontal = Spacing.xs) + Modifier + .padding(horizontal = Spacing.xs) .background( color = MaterialTheme.colorScheme.surfaceColorAtElevation(5.dp), shape = RoundedCornerShape(CornerSize.l), - ).padding(Spacing.s) + ) + .padding(Spacing.s) } else { - it.background(MaterialTheme.colorScheme.background) + Modifier.background(MaterialTheme.colorScheme.background) } - }, + ), ) { Column( verticalArrangement = Arrangement.spacedBy(Spacing.xs), diff --git a/unit/reportlist/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/reportlist/components/ReportCardPlaceHolder.kt b/unit/reportlist/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/reportlist/components/ReportCardPlaceHolder.kt index e7a7bb70b..ec4fad4ca 100644 --- a/unit/reportlist/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/reportlist/components/ReportCardPlaceHolder.kt +++ b/unit/reportlist/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/reportlist/components/ReportCardPlaceHolder.kt @@ -25,16 +25,19 @@ internal fun ReportCardPlaceHolder( postLayout: PostLayout = PostLayout.Card, ) { Column( - modifier = Modifier.let { + modifier = Modifier.then( if (postLayout == PostLayout.Card) { - it.padding(horizontal = Spacing.xs).background( - color = MaterialTheme.colorScheme.surfaceColorAtElevation(5.dp), - shape = RoundedCornerShape(CornerSize.l), - ).padding(Spacing.s) + Modifier + .padding(horizontal = Spacing.xs) + .background( + color = MaterialTheme.colorScheme.surfaceColorAtElevation(5.dp), + shape = RoundedCornerShape(CornerSize.l), + ) + .padding(Spacing.s) } else { - it + Modifier } - }, + ), verticalArrangement = Arrangement.spacedBy(Spacing.xs), ) { Box( diff --git a/unit/saveditems/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/saveditems/SavedItemsScreen.kt b/unit/saveditems/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/saveditems/SavedItemsScreen.kt index 1b99ec0ef..b03e93a11 100644 --- a/unit/saveditems/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/saveditems/SavedItemsScreen.kt +++ b/unit/saveditems/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/saveditems/SavedItemsScreen.kt @@ -166,13 +166,13 @@ class SavedItemsScreen : Screen { }, ) { paddingValues -> Column( - modifier = Modifier.padding(paddingValues).let { + modifier = Modifier.padding(paddingValues).then( if (settings.hideNavigationBarWhileScrolling) { - it.nestedScroll(scrollBehavior.nestedScrollConnection) + Modifier.nestedScroll(scrollBehavior.nestedScrollConnection) } else { - it + Modifier } - }.nestedScroll(fabNestedScrollConnection), + ).nestedScroll(fabNestedScrollConnection), verticalArrangement = Arrangement.spacedBy(Spacing.s), ) { SectionSelector( diff --git a/unit/userdetail/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/userdetail/UserDetailScreen.kt b/unit/userdetail/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/userdetail/UserDetailScreen.kt index e5b699884..1362216e2 100644 --- a/unit/userdetail/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/userdetail/UserDetailScreen.kt +++ b/unit/userdetail/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/userdetail/UserDetailScreen.kt @@ -365,13 +365,13 @@ class UserDetailScreen( }, ) Box( - modifier = Modifier.padding(padding).let { + modifier = Modifier.padding(padding).then( if (settings.hideNavigationBarWhileScrolling) { - it.nestedScroll(scrollBehavior.nestedScrollConnection) + Modifier.nestedScroll(scrollBehavior.nestedScrollConnection) } else { - it + Modifier } - }.nestedScroll(fabNestedScrollConnection).pullRefresh(pullRefreshState), + ).nestedScroll(fabNestedScrollConnection).pullRefresh(pullRefreshState), ) { LazyColumn( state = lazyListState, @@ -385,7 +385,11 @@ class UserDetailScreen( user = uiState.user, autoLoadImages = uiState.autoLoadImages, onOpenImage = rememberCallbackArgs { url -> - navigationCoordinator.pushScreen(ZoomableImageScreen(url)) + navigationCoordinator.pushScreen( + ZoomableImageScreen( + url + ) + ) }, ) SectionSelector( @@ -402,7 +406,11 @@ class UserDetailScreen( 1 -> UserDetailSection.Comments else -> UserDetailSection.Posts } - model.reduce(UserDetailMviModel.Intent.ChangeSection(section)) + model.reduce( + UserDetailMviModel.Intent.ChangeSection( + section + ) + ) }, ) Spacer(modifier = Modifier.height(Spacing.m)) @@ -421,7 +429,9 @@ class UserDetailScreen( } } } - items(uiState.posts, { it.id.toString() + it.updateDate }) { post -> + items( + uiState.posts, + { it.id.toString() + it.updateDate }) { post -> SwipeableCard( modifier = Modifier.fillMaxWidth(), enabled = uiState.swipeActionsEnabled, @@ -559,7 +569,10 @@ class UserDetailScreen( } }, onOpenCommunity = rememberCallbackArgs { community, instance -> - detailOpener.openCommunityDetail(community, instance) + detailOpener.openCommunityDetail( + community, + instance + ) }, onOpenCreator = rememberCallbackArgs { user, instance -> detailOpener.openUserDetail(user, instance) @@ -623,7 +636,9 @@ class UserDetailScreen( } OptionId.CrossPost -> { - detailOpener.openCreatePost(crossPost = post) + detailOpener.openCreatePost( + crossPost = post + ) } OptionId.SeeRaw -> { @@ -642,8 +657,11 @@ class UserDetailScreen( ) ) } else { - val screen = ShareBottomSheet(urls = urls) - navigationCoordinator.showBottomSheet(screen) + val screen = + ShareBottomSheet(urls = urls) + navigationCoordinator.showBottomSheet( + screen + ) } } @@ -662,7 +680,8 @@ class UserDetailScreen( if (uiState.posts.isEmpty() && !uiState.loading) { item { Text( - modifier = Modifier.fillMaxWidth().padding(top = Spacing.xs), + modifier = Modifier.fillMaxWidth() + .padding(top = Spacing.xs), textAlign = TextAlign.Center, text = stringResource(MR.strings.message_empty_list), style = MaterialTheme.typography.bodyLarge, @@ -680,7 +699,9 @@ class UserDetailScreen( ) } } - items(uiState.comments, { it.id.toString() + it.updateDate }) { comment -> + items( + uiState.comments, + { it.id.toString() + it.updateDate }) { comment -> SwipeableCard( modifier = Modifier.fillMaxWidth(), enabled = uiState.swipeActionsEnabled, @@ -756,7 +777,9 @@ class UserDetailScreen( }, onDismissToEnd = rememberCallback(model) { model.reduce( - UserDetailMviModel.Intent.DownVoteComment(comment.id), + UserDetailMviModel.Intent.DownVoteComment( + comment.id + ), ) }, content = { @@ -776,7 +799,9 @@ class UserDetailScreen( ) }, onImageClick = rememberCallbackArgs { url -> - navigationCoordinator.pushScreen(ZoomableImageScreen(url)) + navigationCoordinator.pushScreen( + ZoomableImageScreen(url) + ) }, onDoubleClick = if (!uiState.doubleTapActionEnabled) { null @@ -834,7 +859,10 @@ class UserDetailScreen( } }, onOpenCommunity = rememberCallbackArgs { community, instance -> - detailOpener.openCommunityDetail(community, instance) + detailOpener.openCommunityDetail( + community, + instance + ) }, onOpenCreator = rememberCallbackArgs { user, instance -> detailOpener.openUserDetail(user, instance) @@ -892,7 +920,8 @@ class UserDetailScreen( if (uiState.comments.isEmpty() && !uiState.loading) { item { Text( - modifier = Modifier.fillMaxWidth().padding(top = Spacing.xs), + modifier = Modifier.fillMaxWidth() + .padding(top = Spacing.xs), textAlign = TextAlign.Center, text = stringResource(MR.strings.message_empty_list), style = MaterialTheme.typography.bodyLarge, @@ -907,7 +936,8 @@ class UserDetailScreen( model.reduce(UserDetailMviModel.Intent.LoadNextPage) } else { Row( - modifier = Modifier.fillMaxWidth().padding(top = Spacing.s), + modifier = Modifier.fillMaxWidth() + .padding(top = Spacing.s), horizontalArrangement = Arrangement.Center, ) { Button(