diff --git a/core-commonui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/communitydetail/CommunityDetailScreen.kt b/core-commonui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/communitydetail/CommunityDetailScreen.kt index 31b593bb5..81872c5c7 100644 --- a/core-commonui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/communitydetail/CommunityDetailScreen.kt +++ b/core-commonui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/communitydetail/CommunityDetailScreen.kt @@ -625,12 +625,16 @@ class CommunityDetailScreen( ) } }, - onReply = rememberCallback(model) { + onReply = rememberCallback { if (uiState.isLogged && !isOnOtherInstance) { - val screen = CreateCommentScreen( - originalPost = post, + model.reduce( + CommunityDetailMviModel.Intent.MarkAsRead( + post.id + ) + ) + navigationCoordinator.pushScreen( + PostDetailScreen(post), ) - navigationCoordinator.showBottomSheet(screen) } }, onImageClick = rememberCallbackArgs(model) { url -> diff --git a/core-commonui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/createcomment/CreateCommentMviModel.kt b/core-commonui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/createcomment/CreateCommentMviModel.kt index c11a3cd23..a1f68a433 100644 --- a/core-commonui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/createcomment/CreateCommentMviModel.kt +++ b/core-commonui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/createcomment/CreateCommentMviModel.kt @@ -41,6 +41,8 @@ interface CreateCommentMviModel : val loading: Boolean = false, val section: CreatePostSection = CreatePostSection.Edit, val autoLoadImages: Boolean = true, + val currentInstance: String = "", + val currentUser: String = "", ) sealed interface Effect { diff --git a/core-commonui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/createcomment/CreateCommentScreen.kt b/core-commonui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/createcomment/CreateCommentScreen.kt index 30b1083ea..36e3d3629 100644 --- a/core-commonui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/createcomment/CreateCommentScreen.kt +++ b/core-commonui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/createcomment/CreateCommentScreen.kt @@ -3,6 +3,7 @@ package com.github.diegoberaldin.raccoonforlemmy.core.commonui.createcomment import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.heightIn import androidx.compose.foundation.layout.padding @@ -39,6 +40,7 @@ import androidx.compose.ui.focus.focusRequester import androidx.compose.ui.graphics.Color import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.text.input.TextFieldValue +import androidx.compose.ui.text.style.TextDecoration import androidx.compose.ui.unit.dp import cafe.adriel.voyager.core.model.rememberScreenModel import cafe.adriel.voyager.core.screen.Screen @@ -269,19 +271,43 @@ class CreateCommentScreen( ) } } + + if (uiState.currentUser.isNotEmpty()) { + Row( + modifier = Modifier.padding( + vertical = Spacing.xs, + horizontal = Spacing.l, + ) + ) { + Text( + text = buildString { + append(stringResource(MR.strings.post_reply_source_account)) + append(" ") + append(uiState.currentUser) + if (uiState.currentInstance.isNotEmpty()) { + append("@") + append(uiState.currentInstance) + } + }, + color = MaterialTheme.colorScheme.onBackground, + style = MaterialTheme.typography.labelSmall, + textDecoration = TextDecoration.Underline, + ) + } + } } }, ) { padding -> + val referenceModifier = Modifier.padding( + horizontal = Spacing.s, + vertical = Spacing.xxs, + ) LazyColumn( modifier = Modifier.padding(padding), ) { - val referenceModifier = Modifier.padding( - horizontal = Spacing.s, - vertical = Spacing.xxs, - ) - when { - originalComment != null -> { - item { + item { + when { + originalComment != null -> { CommentCard( modifier = referenceModifier, comment = originalComment, @@ -302,10 +328,8 @@ class CreateCommentScreen( ) Divider() } - } - originalPost != null -> { - item { + originalPost != null -> { PostCard( modifier = referenceModifier, postLayout = uiState.postLayout, diff --git a/core-commonui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/createcomment/CreateCommentViewModel.kt b/core-commonui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/createcomment/CreateCommentViewModel.kt index ec51df6fc..0ae99ee80 100644 --- a/core-commonui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/createcomment/CreateCommentViewModel.kt +++ b/core-commonui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/createcomment/CreateCommentViewModel.kt @@ -9,6 +9,7 @@ import com.github.diegoberaldin.raccoonforlemmy.core.persistence.repository.Sett import com.github.diegoberaldin.raccoonforlemmy.domain.identity.repository.IdentityRepository import com.github.diegoberaldin.raccoonforlemmy.domain.lemmy.repository.CommentRepository import com.github.diegoberaldin.raccoonforlemmy.domain.lemmy.repository.PostRepository +import com.github.diegoberaldin.raccoonforlemmy.domain.lemmy.repository.SiteRepository import com.github.diegoberaldin.raccoonforlemmy.resources.MR.strings.message_missing_field import dev.icerock.moko.resources.desc.desc import kotlinx.coroutines.Dispatchers @@ -25,6 +26,7 @@ class CreateCommentViewModel( private val identityRepository: IdentityRepository, private val commentRepository: CommentRepository, private val postRepository: PostRepository, + private val siteRepository: SiteRepository, private val themeRepository: ThemeRepository, private val settingsRepository: SettingsRepository, private val notificationCenter: NotificationCenter, @@ -37,6 +39,18 @@ class CreateCommentViewModel( themeRepository.postLayout.onEach { layout -> mvi.updateState { it.copy(postLayout = layout) } }.launchIn(this) + if (uiState.value.currentUser.isEmpty()) { + val auth = identityRepository.authToken.value.orEmpty() + val currentUser = siteRepository.getCurrentUser(auth) + if (currentUser != null) { + mvi.updateState { + it.copy( + currentUser = currentUser.name, + currentInstance = currentUser.host, + ) + } + } + } settingsRepository.currentSettings.onEach { settings -> mvi.updateState { it.copy( diff --git a/core-commonui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/createpost/CreatePostMviModel.kt b/core-commonui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/createpost/CreatePostMviModel.kt index 1318895ac..1fb226a79 100644 --- a/core-commonui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/createpost/CreatePostMviModel.kt +++ b/core-commonui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/createpost/CreatePostMviModel.kt @@ -68,6 +68,8 @@ interface CreatePostMviModel : val fullHeightImages: Boolean = true, val voteFormat: VoteFormat = VoteFormat.Aggregated, val autoLoadImages: Boolean = true, + val currentInstance: String = "", + val currentUser: String = "", ) sealed interface Effect { diff --git a/core-commonui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/createpost/CreatePostScreen.kt b/core-commonui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/createpost/CreatePostScreen.kt index f0217a1df..2e328c359 100644 --- a/core-commonui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/createpost/CreatePostScreen.kt +++ b/core-commonui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/createpost/CreatePostScreen.kt @@ -47,6 +47,7 @@ import androidx.compose.ui.text.font.FontFamily import androidx.compose.ui.text.input.ImeAction import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.text.input.TextFieldValue +import androidx.compose.ui.text.style.TextDecoration import androidx.compose.ui.unit.dp import cafe.adriel.voyager.core.model.rememberScreenModel import cafe.adriel.voyager.core.screen.Screen @@ -462,6 +463,30 @@ class CreatePostScreen( autoLoadImages = uiState.autoLoadImages, ) } + + if (uiState.currentUser.isNotEmpty()) { + Row( + modifier = Modifier.padding( + vertical = Spacing.xs, + horizontal = Spacing.l, + ) + ) { + Text( + text = buildString { + append(stringResource(MR.strings.post_reply_source_account)) + append(" ") + append(uiState.currentUser) + if (uiState.currentInstance.isNotEmpty()) { + append("@") + append(uiState.currentInstance) + } + }, + color = MaterialTheme.colorScheme.onBackground, + style = MaterialTheme.typography.labelSmall, + textDecoration = TextDecoration.Underline, + ) + } + } } } diff --git a/core-commonui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/createpost/CreatePostViewModel.kt b/core-commonui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/createpost/CreatePostViewModel.kt index 91cbf8cf3..b4865356c 100644 --- a/core-commonui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/createpost/CreatePostViewModel.kt +++ b/core-commonui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/createpost/CreatePostViewModel.kt @@ -7,6 +7,7 @@ import com.github.diegoberaldin.raccoonforlemmy.core.persistence.repository.Sett import com.github.diegoberaldin.raccoonforlemmy.core.utils.StringUtils.isValidUrl import com.github.diegoberaldin.raccoonforlemmy.domain.identity.repository.IdentityRepository import com.github.diegoberaldin.raccoonforlemmy.domain.lemmy.repository.PostRepository +import com.github.diegoberaldin.raccoonforlemmy.domain.lemmy.repository.SiteRepository import com.github.diegoberaldin.raccoonforlemmy.resources.MR.strings.message_invalid_field import com.github.diegoberaldin.raccoonforlemmy.resources.MR.strings.message_missing_field import dev.icerock.moko.resources.desc.desc @@ -21,6 +22,7 @@ class CreatePostViewModel( private val mvi: DefaultMviModel, private val identityRepository: IdentityRepository, private val postRepository: PostRepository, + private val siteRepository: SiteRepository, private val themeRepository: ThemeRepository, private val settingsRepository: SettingsRepository, ) : CreatePostMviModel, @@ -41,6 +43,18 @@ class CreatePostViewModel( ) } }.launchIn(this) + if (uiState.value.currentUser.isEmpty()) { + val auth = identityRepository.authToken.value.orEmpty() + val currentUser = siteRepository.getCurrentUser(auth) + if (currentUser != null) { + mvi.updateState { + it.copy( + currentUser = currentUser.name, + currentInstance = currentUser.host, + ) + } + } + } } } diff --git a/core-commonui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/di/CommonUiModule.kt b/core-commonui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/di/CommonUiModule.kt index de3d5b34e..d9c4a72dc 100644 --- a/core-commonui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/di/CommonUiModule.kt +++ b/core-commonui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/di/CommonUiModule.kt @@ -129,6 +129,7 @@ val commonUiModule = module { identityRepository = get(), commentRepository = get(), postRepository = get(), + siteRepository = get(), themeRepository = get(), settingsRepository = get(), notificationCenter = get(), @@ -140,6 +141,7 @@ val commonUiModule = module { editedPostId = params[0], identityRepository = get(), postRepository = get(), + siteRepository = get(), themeRepository = get(), settingsRepository = get(), ) diff --git a/core-commonui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/saveditems/SavedItemsScreen.kt b/core-commonui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/saveditems/SavedItemsScreen.kt index 5f7d2c993..1a4b4f9e3 100644 --- a/core-commonui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/saveditems/SavedItemsScreen.kt +++ b/core-commonui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/saveditems/SavedItemsScreen.kt @@ -73,6 +73,7 @@ import com.github.diegoberaldin.raccoonforlemmy.core.notifications.di.getNotific import com.github.diegoberaldin.raccoonforlemmy.core.persistence.di.getSettingsRepository import com.github.diegoberaldin.raccoonforlemmy.core.utils.compose.onClick import com.github.diegoberaldin.raccoonforlemmy.core.utils.compose.rememberCallback +import com.github.diegoberaldin.raccoonforlemmy.core.utils.compose.rememberCallbackArgs import com.github.diegoberaldin.raccoonforlemmy.domain.lemmy.data.CommentModel import com.github.diegoberaldin.raccoonforlemmy.domain.lemmy.data.PostModel import com.github.diegoberaldin.raccoonforlemmy.domain.lemmy.data.SortType @@ -168,34 +169,30 @@ class SavedItemsScreen : Screen { targetOffsetY = { it * 2 }, ), ) { - FloatingActionButtonMenu( - items = buildList { - this += FloatingActionButtonMenuItem( - icon = Icons.Default.ExpandLess, - text = stringResource(MR.strings.action_back_to_top), - onSelected = rememberCallback { - scope.launch { - lazyListState.scrollToItem(0) - topAppBarState.heightOffset = 0f - topAppBarState.contentOffset = 0f - } - }, - ) - } - ) + FloatingActionButtonMenu(items = buildList { + this += FloatingActionButtonMenuItem( + icon = Icons.Default.ExpandLess, + text = stringResource(MR.strings.action_back_to_top), + onSelected = rememberCallback { + scope.launch { + lazyListState.scrollToItem(0) + topAppBarState.heightOffset = 0f + topAppBarState.contentOffset = 0f + } + }, + ) + }) } }, ) { paddingValues -> Column( - modifier = Modifier.padding(paddingValues) - .let { - if (settings.hideNavigationBarWhileScrolling) { - it.nestedScroll(scrollBehavior.nestedScrollConnection) - } else { - it - } + modifier = Modifier.padding(paddingValues).let { + if (settings.hideNavigationBarWhileScrolling) { + it.nestedScroll(scrollBehavior.nestedScrollConnection) + } else { + it } - .nestedScroll(fabNestedScrollConnection), + }.nestedScroll(fabNestedScrollConnection), verticalArrangement = Arrangement.spacedBy(Spacing.s), ) { SectionSelector( @@ -223,8 +220,7 @@ class SavedItemsScreen : Screen { }, ) Box( - modifier = Modifier.fillMaxWidth() - .pullRefresh(pullRefreshState), + modifier = Modifier.fillMaxWidth().pullRefresh(pullRefreshState), ) { LazyColumn( state = lazyListState, @@ -239,22 +235,22 @@ class SavedItemsScreen : Screen { voteFormat = uiState.voteFormat, autoLoadImages = uiState.autoLoadImages, blurNsfw = uiState.blurNsfw, - onClick = { + onClick = rememberCallback { navigatorCoordinator.pushScreen( PostDetailScreen(post), ) }, - onOpenCommunity = { community -> + onOpenCommunity = rememberCallbackArgs { community -> navigatorCoordinator.pushScreen( CommunityDetailScreen(community), ) }, - onOpenCreator = { u -> + onOpenCreator = rememberCallbackArgs { u -> if (u.id != uiState.user?.id) { navigatorCoordinator.pushScreen(UserDetailScreen(u)) } }, - onUpVote = { + onUpVote = rememberCallback(model) { model.reduce( SavedItemsMviModel.Intent.UpVotePost( id = post.id, @@ -262,7 +258,7 @@ class SavedItemsScreen : Screen { ), ) }, - onDownVote = { + onDownVote = rememberCallback(model) { model.reduce( SavedItemsMviModel.Intent.DownVotePost( id = post.id, @@ -270,7 +266,7 @@ class SavedItemsScreen : Screen { ), ) }, - onSave = { + onSave = rememberCallback(model) { model.reduce( SavedItemsMviModel.Intent.SavePost( id = post.id, @@ -278,13 +274,12 @@ class SavedItemsScreen : Screen { ), ) }, - onReply = { - val screen = CreateCommentScreen( - originalPost = post, + onReply = rememberCallback { + navigationCoordinator.pushScreen( + PostDetailScreen(post), ) - navigatorCoordinator.showBottomSheet(screen) }, - onImageClick = { url -> + onImageClick = rememberCallbackArgs { url -> navigatorCoordinator.pushScreen( ZoomableImageScreen(url), ) @@ -483,8 +478,7 @@ class SavedItemsScreen : Screen { if (rawContent != null) { when (val content = rawContent) { is PostModel -> { - RawContentDialog( - title = content.title, + RawContentDialog(title = content.title, date = content.publishDate, url = content.url, text = content.text, @@ -494,44 +488,32 @@ class SavedItemsScreen : Screen { onQuote = { quotation -> rawContent = null if (quotation != null) { - val screen = - CreateCommentScreen( - originalPost = content, - initialText = buildString { - append("> ") - append(quotation) - append("\n\n") - } - ) + val screen = CreateCommentScreen(originalPost = content, + initialText = buildString { + append("> ") + append(quotation) + append("\n\n") + }) navigationCoordinator.showBottomSheet(screen) } - } - ) + }) } is CommentModel -> { - RawContentDialog( - text = content.text, - date = content.publishDate, - onDismiss = { - rawContent = null - }, - onQuote = { quotation -> - rawContent = null - if (quotation != null) { - val screen = - CreateCommentScreen( - originalComment = content, - initialText = buildString { - append("> ") - append(quotation) - append("\n\n") - } - ) - navigationCoordinator.showBottomSheet(screen) - } + RawContentDialog(text = content.text, date = content.publishDate, onDismiss = { + rawContent = null + }, onQuote = { quotation -> + rawContent = null + if (quotation != null) { + val screen = CreateCommentScreen(originalComment = content, + initialText = buildString { + append("> ") + append(quotation) + append("\n\n") + }) + navigationCoordinator.showBottomSheet(screen) } - ) + }) } } } diff --git a/core-commonui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/userdetail/UserDetailScreen.kt b/core-commonui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/userdetail/UserDetailScreen.kt index 094635a6a..22ae44ad9 100644 --- a/core-commonui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/userdetail/UserDetailScreen.kt +++ b/core-commonui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/userdetail/UserDetailScreen.kt @@ -523,10 +523,9 @@ class UserDetailScreen( null } else { rememberCallback { - val screen = CreateCommentScreen( - originalPost = post, + navigationCoordinator.pushScreen( + PostDetailScreen(post), ) - navigationCoordinator.showBottomSheet(screen) } }, onImageClick = rememberCallbackArgs { url -> diff --git a/feature-home/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/feature/home/postlist/PostListScreen.kt b/feature-home/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/feature/home/postlist/PostListScreen.kt index 46289551f..f52974768 100644 --- a/feature-home/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/feature/home/postlist/PostListScreen.kt +++ b/feature-home/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/feature/home/postlist/PostListScreen.kt @@ -421,9 +421,10 @@ class PostListScreen : Screen { }, onReply = rememberCallback(model) { if (uiState.isLogged) { - val screen = - CreateCommentScreen(originalPost = post) - navigationCoordinator.showBottomSheet(screen) + model.reduce(PostListMviModel.Intent.MarkAsRead(post.id)) + navigationCoordinator.pushScreen( + PostDetailScreen(post), + ) } }, onImageClick = rememberCallbackArgs(model, post) { url -> diff --git a/feature-profile/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/feature/profile/logged/ProfileLoggedScreen.kt b/feature-profile/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/feature/profile/logged/ProfileLoggedScreen.kt index 09a45702a..c6f1f7383 100644 --- a/feature-profile/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/feature/profile/logged/ProfileLoggedScreen.kt +++ b/feature-profile/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/feature/profile/logged/ProfileLoggedScreen.kt @@ -217,6 +217,11 @@ internal object ProfileLoggedScreen : Tab { ) ) }, + onReply = rememberCallback { + navigationCoordinator.pushScreen( + PostDetailScreen(post), + ) + }, options = buildList { add( Option( @@ -341,6 +346,14 @@ internal object ProfileLoggedScreen : Tab { ) ) }, + onReply = rememberCallback { + navigationCoordinator.pushScreen( + PostDetailScreen( + post = PostModel(id = comment.postId), + highlightCommentId = comment.id, + ), + ) + }, options = buildList { add( Option( 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 f5ac14311..0c2164def 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 @@ -425,10 +425,9 @@ class ExploreScreen : Screen { }, onReply = rememberCallback { if (uiState.isLogged) { - val screen = CreateCommentScreen( - originalPost = result.model, + navigationCoordinator.pushScreen( + PostDetailScreen(result.model), ) - navigationCoordinator.showBottomSheet(screen) } }, onImageClick = rememberCallbackArgs { url -> diff --git a/feature-search/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/feature/search/multicommunity/detail/MultiCommunityScreen.kt b/feature-search/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/feature/search/multicommunity/detail/MultiCommunityScreen.kt index cec60a167..6301ea045 100644 --- a/feature-search/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/feature/search/multicommunity/detail/MultiCommunityScreen.kt +++ b/feature-search/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/feature/search/multicommunity/detail/MultiCommunityScreen.kt @@ -65,7 +65,6 @@ import com.github.diegoberaldin.raccoonforlemmy.core.commonui.components.OptionI import com.github.diegoberaldin.raccoonforlemmy.core.commonui.components.PostCard import com.github.diegoberaldin.raccoonforlemmy.core.commonui.components.PostCardPlaceholder import com.github.diegoberaldin.raccoonforlemmy.core.commonui.components.SwipeableCard -import com.github.diegoberaldin.raccoonforlemmy.core.commonui.createcomment.CreateCommentScreen import com.github.diegoberaldin.raccoonforlemmy.core.commonui.createreport.CreateReportScreen import com.github.diegoberaldin.raccoonforlemmy.core.commonui.di.getFabNestedScrollConnection import com.github.diegoberaldin.raccoonforlemmy.core.commonui.image.ZoomableImageScreen @@ -79,6 +78,7 @@ import com.github.diegoberaldin.raccoonforlemmy.core.persistence.data.MultiCommu import com.github.diegoberaldin.raccoonforlemmy.core.persistence.di.getSettingsRepository import com.github.diegoberaldin.raccoonforlemmy.core.utils.compose.onClick import com.github.diegoberaldin.raccoonforlemmy.core.utils.compose.rememberCallback +import com.github.diegoberaldin.raccoonforlemmy.core.utils.compose.rememberCallbackArgs import com.github.diegoberaldin.raccoonforlemmy.domain.lemmy.data.getAdditionalLabel import com.github.diegoberaldin.raccoonforlemmy.domain.lemmy.data.toIcon import com.github.diegoberaldin.raccoonforlemmy.feature.search.di.getMultiCommunityViewModel @@ -302,7 +302,7 @@ class MultiCommunityScreen( voteFormat = uiState.voteFormat, autoLoadImages = uiState.autoLoadImages, blurNsfw = uiState.blurNsfw, - onClick = { + onClick = rememberCallback { model.reduce(MultiCommunityMviModel.Intent.MarkAsRead(post.id)) navigationCoordinator.pushScreen( PostDetailScreen(post), @@ -320,17 +320,17 @@ class MultiCommunityScreen( ) } }, - onOpenCommunity = { community -> + onOpenCommunity = rememberCallbackArgs { community -> navigationCoordinator.pushScreen( CommunityDetailScreen(community), ) }, - onOpenCreator = { user -> + onOpenCreator = rememberCallbackArgs { user -> navigationCoordinator.pushScreen( UserDetailScreen(user), ) }, - onUpVote = { + onUpVote = rememberCallback(model) { model.reduce( MultiCommunityMviModel.Intent.UpVotePost( id = post.id, @@ -338,7 +338,7 @@ class MultiCommunityScreen( ), ) }, - onDownVote = { + onDownVote = rememberCallback(model) { model.reduce( MultiCommunityMviModel.Intent.DownVotePost( id = post.id, @@ -346,7 +346,7 @@ class MultiCommunityScreen( ), ) }, - onSave = { + onSave = rememberCallback(model) { model.reduce( MultiCommunityMviModel.Intent.SavePost( id = post.id, @@ -354,13 +354,12 @@ class MultiCommunityScreen( ), ) }, - onReply = { - val screen = CreateCommentScreen( - originalPost = post, + onReply = rememberCallback { + navigationCoordinator.pushScreen( + PostDetailScreen(post), ) - navigationCoordinator.showBottomSheet(screen) }, - onImageClick = { url -> + onImageClick = rememberCallbackArgs { url -> model.reduce(MultiCommunityMviModel.Intent.MarkAsRead(post.id)) navigationCoordinator.pushScreen( ZoomableImageScreen(url), diff --git a/resources/src/commonMain/resources/MR/ar/strings.xml b/resources/src/commonMain/resources/MR/ar/strings.xml index 6e06387d3..cd6f5568c 100644 --- a/resources/src/commonMain/resources/MR/ar/strings.xml +++ b/resources/src/commonMain/resources/MR/ar/strings.xml @@ -249,4 +249,5 @@ متفرق نسبة مئوية نظام + بواسطة: \ No newline at end of file diff --git a/resources/src/commonMain/resources/MR/base/strings.xml b/resources/src/commonMain/resources/MR/base/strings.xml index 57d135b86..c07f921e1 100755 --- a/resources/src/commonMain/resources/MR/base/strings.xml +++ b/resources/src/commonMain/resources/MR/base/strings.xml @@ -280,4 +280,5 @@ Separate Percentage System + by: \ No newline at end of file diff --git a/resources/src/commonMain/resources/MR/bg/strings.xml b/resources/src/commonMain/resources/MR/bg/strings.xml index c91233b06..97ce2e0fa 100644 --- a/resources/src/commonMain/resources/MR/bg/strings.xml +++ b/resources/src/commonMain/resources/MR/bg/strings.xml @@ -259,4 +259,5 @@ Отделно Процент Система + от: \ No newline at end of file diff --git a/resources/src/commonMain/resources/MR/cs/strings.xml b/resources/src/commonMain/resources/MR/cs/strings.xml index 94b3f19af..09c049217 100644 --- a/resources/src/commonMain/resources/MR/cs/strings.xml +++ b/resources/src/commonMain/resources/MR/cs/strings.xml @@ -251,4 +251,5 @@ Samostatný Procento Systém + podle: \ No newline at end of file diff --git a/resources/src/commonMain/resources/MR/da/strings.xml b/resources/src/commonMain/resources/MR/da/strings.xml index 3070c183e..6d2c7987b 100644 --- a/resources/src/commonMain/resources/MR/da/strings.xml +++ b/resources/src/commonMain/resources/MR/da/strings.xml @@ -251,4 +251,5 @@ Adskille Procent System + ved: \ No newline at end of file diff --git a/resources/src/commonMain/resources/MR/de/strings.xml b/resources/src/commonMain/resources/MR/de/strings.xml index 700b3fed3..e16c71975 100755 --- a/resources/src/commonMain/resources/MR/de/strings.xml +++ b/resources/src/commonMain/resources/MR/de/strings.xml @@ -257,4 +257,5 @@ Separate Prozentsatz System + von: \ No newline at end of file diff --git a/resources/src/commonMain/resources/MR/el/strings.xml b/resources/src/commonMain/resources/MR/el/strings.xml index bfcbfcadf..c441638d4 100644 --- a/resources/src/commonMain/resources/MR/el/strings.xml +++ b/resources/src/commonMain/resources/MR/el/strings.xml @@ -260,4 +260,5 @@ Ξεχωριστό Ποσοστό Σύστημα + από: \ No newline at end of file diff --git a/resources/src/commonMain/resources/MR/eo/strings.xml b/resources/src/commonMain/resources/MR/eo/strings.xml index 6315a5018..270c33277 100644 --- a/resources/src/commonMain/resources/MR/eo/strings.xml +++ b/resources/src/commonMain/resources/MR/eo/strings.xml @@ -250,4 +250,5 @@ Apartigite Procento Sistemo + de: \ No newline at end of file diff --git a/resources/src/commonMain/resources/MR/es/strings.xml b/resources/src/commonMain/resources/MR/es/strings.xml index fcbc9633c..c8fc6d77b 100755 --- a/resources/src/commonMain/resources/MR/es/strings.xml +++ b/resources/src/commonMain/resources/MR/es/strings.xml @@ -255,4 +255,5 @@ Separado Porcentaje Sistema + por: \ No newline at end of file diff --git a/resources/src/commonMain/resources/MR/et/strings.xml b/resources/src/commonMain/resources/MR/et/strings.xml index 81c8abd87..13f6770a7 100644 --- a/resources/src/commonMain/resources/MR/et/strings.xml +++ b/resources/src/commonMain/resources/MR/et/strings.xml @@ -251,4 +251,5 @@ Eraldi Protsent Süsteem + kõrval: \ No newline at end of file diff --git a/resources/src/commonMain/resources/MR/fi/strings.xml b/resources/src/commonMain/resources/MR/fi/strings.xml index 4d173dc00..5b7c30399 100644 --- a/resources/src/commonMain/resources/MR/fi/strings.xml +++ b/resources/src/commonMain/resources/MR/fi/strings.xml @@ -251,4 +251,5 @@ Erillinen Prosenttiosuus Järjestelmä + kirjoittaja: \ No newline at end of file diff --git a/resources/src/commonMain/resources/MR/fr/strings.xml b/resources/src/commonMain/resources/MR/fr/strings.xml index 7686c8143..bbeed0d46 100755 --- a/resources/src/commonMain/resources/MR/fr/strings.xml +++ b/resources/src/commonMain/resources/MR/fr/strings.xml @@ -254,4 +254,5 @@ Séparé Pourcentage Système + par: \ No newline at end of file diff --git a/resources/src/commonMain/resources/MR/ga/strings.xml b/resources/src/commonMain/resources/MR/ga/strings.xml index 8af25feec..b02187df4 100644 --- a/resources/src/commonMain/resources/MR/ga/strings.xml +++ b/resources/src/commonMain/resources/MR/ga/strings.xml @@ -260,4 +260,5 @@ Scartha Céatadán Córas + le: \ No newline at end of file diff --git a/resources/src/commonMain/resources/MR/hr/strings.xml b/resources/src/commonMain/resources/MR/hr/strings.xml index ed1eeb624..170e8d9e0 100644 --- a/resources/src/commonMain/resources/MR/hr/strings.xml +++ b/resources/src/commonMain/resources/MR/hr/strings.xml @@ -256,4 +256,5 @@ Odvojeni Postotak Sustav + po: \ No newline at end of file diff --git a/resources/src/commonMain/resources/MR/hu/strings.xml b/resources/src/commonMain/resources/MR/hu/strings.xml index 1aa82ca7a..89c0b8769 100644 --- a/resources/src/commonMain/resources/MR/hu/strings.xml +++ b/resources/src/commonMain/resources/MR/hu/strings.xml @@ -255,4 +255,5 @@ Különálló Százalék Rendszer + által: \ No newline at end of file diff --git a/resources/src/commonMain/resources/MR/it/strings.xml b/resources/src/commonMain/resources/MR/it/strings.xml index 3006f7899..e97306632 100755 --- a/resources/src/commonMain/resources/MR/it/strings.xml +++ b/resources/src/commonMain/resources/MR/it/strings.xml @@ -255,4 +255,5 @@ Separato Percentuale Sistema + da: \ No newline at end of file diff --git a/resources/src/commonMain/resources/MR/lt/strings.xml b/resources/src/commonMain/resources/MR/lt/strings.xml index 6e41efb1f..d78878cbd 100644 --- a/resources/src/commonMain/resources/MR/lt/strings.xml +++ b/resources/src/commonMain/resources/MR/lt/strings.xml @@ -253,4 +253,5 @@ Atskirai Procentas Sistema + pateikė: \ No newline at end of file diff --git a/resources/src/commonMain/resources/MR/lv/strings.xml b/resources/src/commonMain/resources/MR/lv/strings.xml index e8dd3dbb8..200f9a77b 100644 --- a/resources/src/commonMain/resources/MR/lv/strings.xml +++ b/resources/src/commonMain/resources/MR/lv/strings.xml @@ -255,4 +255,5 @@ Atsevišķi Procenti Sistēma + autors: \ No newline at end of file diff --git a/resources/src/commonMain/resources/MR/mt/strings.xml b/resources/src/commonMain/resources/MR/mt/strings.xml index e4a9d15f4..c56df377a 100644 --- a/resources/src/commonMain/resources/MR/mt/strings.xml +++ b/resources/src/commonMain/resources/MR/mt/strings.xml @@ -256,4 +256,5 @@ Separati Persentaġġ Sistema + minn: \ No newline at end of file diff --git a/resources/src/commonMain/resources/MR/nl/strings.xml b/resources/src/commonMain/resources/MR/nl/strings.xml index 11372bf30..e6e6b619a 100644 --- a/resources/src/commonMain/resources/MR/nl/strings.xml +++ b/resources/src/commonMain/resources/MR/nl/strings.xml @@ -254,4 +254,5 @@ Verschillend Percentage Systeem + door: \ No newline at end of file diff --git a/resources/src/commonMain/resources/MR/no/strings.xml b/resources/src/commonMain/resources/MR/no/strings.xml index e30786c58..c9e62b37b 100644 --- a/resources/src/commonMain/resources/MR/no/strings.xml +++ b/resources/src/commonMain/resources/MR/no/strings.xml @@ -253,4 +253,5 @@ Skille Prosentdel System + av: \ No newline at end of file diff --git a/resources/src/commonMain/resources/MR/pl/strings.xml b/resources/src/commonMain/resources/MR/pl/strings.xml index 9cfdf4d73..eb7b98bce 100644 --- a/resources/src/commonMain/resources/MR/pl/strings.xml +++ b/resources/src/commonMain/resources/MR/pl/strings.xml @@ -254,4 +254,5 @@ Oddzielny Odsetek System + przez: \ No newline at end of file diff --git a/resources/src/commonMain/resources/MR/pt/strings.xml b/resources/src/commonMain/resources/MR/pt/strings.xml index 417b6e042..2bd3c2f3e 100755 --- a/resources/src/commonMain/resources/MR/pt/strings.xml +++ b/resources/src/commonMain/resources/MR/pt/strings.xml @@ -253,4 +253,5 @@ Separado Percentagem Sistema + por: \ No newline at end of file diff --git a/resources/src/commonMain/resources/MR/ro/strings.xml b/resources/src/commonMain/resources/MR/ro/strings.xml index 4022906e4..613602ae1 100755 --- a/resources/src/commonMain/resources/MR/ro/strings.xml +++ b/resources/src/commonMain/resources/MR/ro/strings.xml @@ -252,4 +252,5 @@ Separat Procent Sistem + de: \ No newline at end of file diff --git a/resources/src/commonMain/resources/MR/ru/strings.xml b/resources/src/commonMain/resources/MR/ru/strings.xml index a40e0c92b..4918aee88 100644 --- a/resources/src/commonMain/resources/MR/ru/strings.xml +++ b/resources/src/commonMain/resources/MR/ru/strings.xml @@ -254,4 +254,5 @@ Отдельно Процент Система + к: \ No newline at end of file diff --git a/resources/src/commonMain/resources/MR/se/strings.xml b/resources/src/commonMain/resources/MR/se/strings.xml index db72df652..ba07c3c62 100644 --- a/resources/src/commonMain/resources/MR/se/strings.xml +++ b/resources/src/commonMain/resources/MR/se/strings.xml @@ -252,4 +252,5 @@ Separat Procentsats Systemet + förbi: \ No newline at end of file diff --git a/resources/src/commonMain/resources/MR/sk/strings.xml b/resources/src/commonMain/resources/MR/sk/strings.xml index 3db691d39..0114d0a10 100644 --- a/resources/src/commonMain/resources/MR/sk/strings.xml +++ b/resources/src/commonMain/resources/MR/sk/strings.xml @@ -253,4 +253,5 @@ Samostatné Percento Systém + od: \ No newline at end of file diff --git a/resources/src/commonMain/resources/MR/sl/strings.xml b/resources/src/commonMain/resources/MR/sl/strings.xml index 5a30fe44c..999e08d57 100644 --- a/resources/src/commonMain/resources/MR/sl/strings.xml +++ b/resources/src/commonMain/resources/MR/sl/strings.xml @@ -251,4 +251,5 @@ Ločeno Odstotek Sistem + avtor: \ No newline at end of file diff --git a/resources/src/commonMain/resources/MR/sq/strings.xml b/resources/src/commonMain/resources/MR/sq/strings.xml index 77d475698..c84508d62 100644 --- a/resources/src/commonMain/resources/MR/sq/strings.xml +++ b/resources/src/commonMain/resources/MR/sq/strings.xml @@ -257,4 +257,5 @@ Të ndara Përqindje Sistemi + nga: \ No newline at end of file diff --git a/resources/src/commonMain/resources/MR/tr/strings.xml b/resources/src/commonMain/resources/MR/tr/strings.xml index 38ec3b295..897029268 100644 --- a/resources/src/commonMain/resources/MR/tr/strings.xml +++ b/resources/src/commonMain/resources/MR/tr/strings.xml @@ -254,4 +254,5 @@ Ayırmak Yüzde Sistem + ile: \ No newline at end of file diff --git a/resources/src/commonMain/resources/MR/uk/strings.xml b/resources/src/commonMain/resources/MR/uk/strings.xml index a6d80c9a0..998b142ee 100644 --- a/resources/src/commonMain/resources/MR/uk/strings.xml +++ b/resources/src/commonMain/resources/MR/uk/strings.xml @@ -253,4 +253,5 @@ Відокремлення Відсотки Система + від: \ No newline at end of file