mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-13 19:37:00 +05:30
refactor(common): tweak visibility of module members
This commit is contained in:
parent
c7b7a786f3
commit
7d324ddb8c
8 changed files with 22 additions and 22 deletions
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
package dev.msfjarvis.claw.common
|
package dev.msfjarvis.claw.common
|
||||||
|
|
||||||
sealed class NetworkState {
|
internal sealed class NetworkState {
|
||||||
class Success<T>(val data: T) : NetworkState()
|
class Success<T>(val data: T) : NetworkState()
|
||||||
class Error(val error: Throwable, val description: String) : NetworkState()
|
class Error(val error: Throwable, val description: String) : NetworkState()
|
||||||
object Loading : NetworkState()
|
object Loading : NetworkState()
|
||||||
|
|
|
@ -47,7 +47,7 @@ import java.time.Instant
|
||||||
import java.time.temporal.TemporalAccessor
|
import java.time.temporal.TemporalAccessor
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun CommentsHeader(
|
internal fun CommentsHeader(
|
||||||
postDetails: LobstersPostDetails,
|
postDetails: LobstersPostDetails,
|
||||||
postActions: PostActions,
|
postActions: PostActions,
|
||||||
htmlConverter: HTMLConverter,
|
htmlConverter: HTMLConverter,
|
||||||
|
@ -98,7 +98,7 @@ fun CommentsHeader(
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun PostLink(
|
private fun PostLink(
|
||||||
linkMetadata: LinkMetadata,
|
linkMetadata: LinkMetadata,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
|
@ -130,7 +130,7 @@ private val CommentEntryPadding = 16f.dp
|
||||||
|
|
||||||
@OptIn(ExperimentalAnimationApi::class)
|
@OptIn(ExperimentalAnimationApi::class)
|
||||||
@Composable
|
@Composable
|
||||||
fun CommentEntry(
|
internal fun CommentEntry(
|
||||||
commentNode: CommentNode,
|
commentNode: CommentNode,
|
||||||
htmlConverter: HTMLConverter,
|
htmlConverter: HTMLConverter,
|
||||||
toggleExpanded: (CommentNode) -> Unit,
|
toggleExpanded: (CommentNode) -> Unit,
|
||||||
|
|
|
@ -10,7 +10,7 @@ import androidx.compose.foundation.lazy.LazyListScope
|
||||||
import androidx.compose.material3.Divider
|
import androidx.compose.material3.Divider
|
||||||
import dev.msfjarvis.claw.model.Comment
|
import dev.msfjarvis.claw.model.Comment
|
||||||
|
|
||||||
data class CommentNode(
|
internal data class CommentNode(
|
||||||
val comment: Comment,
|
val comment: Comment,
|
||||||
var parent: CommentNode? = null,
|
var parent: CommentNode? = null,
|
||||||
val children: MutableList<CommentNode> = mutableListOf(),
|
val children: MutableList<CommentNode> = mutableListOf(),
|
||||||
|
@ -26,7 +26,7 @@ data class CommentNode(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun createListNode(comments: List<Comment>): MutableList<CommentNode> {
|
internal fun createListNode(comments: List<Comment>): MutableList<CommentNode> {
|
||||||
val commentNodes = mutableListOf<CommentNode>()
|
val commentNodes = mutableListOf<CommentNode>()
|
||||||
|
|
||||||
for (i in comments.indices) {
|
for (i in comments.indices) {
|
||||||
|
@ -40,7 +40,7 @@ fun createListNode(comments: List<Comment>): MutableList<CommentNode> {
|
||||||
return commentNodes
|
return commentNodes
|
||||||
}
|
}
|
||||||
|
|
||||||
fun toggleAllExpanded(commentNode: CommentNode): CommentNode {
|
internal fun toggleAllExpanded(commentNode: CommentNode): CommentNode {
|
||||||
commentNode.isExpanded = !commentNode.isExpanded
|
commentNode.isExpanded = !commentNode.isExpanded
|
||||||
|
|
||||||
if (commentNode.children.isNotEmpty()) {
|
if (commentNode.children.isNotEmpty()) {
|
||||||
|
@ -49,7 +49,7 @@ fun toggleAllExpanded(commentNode: CommentNode): CommentNode {
|
||||||
return commentNode
|
return commentNode
|
||||||
}
|
}
|
||||||
|
|
||||||
fun findTopMostParent(node: CommentNode): CommentNode {
|
internal fun findTopMostParent(node: CommentNode): CommentNode {
|
||||||
val parent = node.parent
|
val parent = node.parent
|
||||||
return if (parent != null) {
|
return if (parent != null) {
|
||||||
findTopMostParent(parent)
|
findTopMostParent(parent)
|
||||||
|
@ -58,7 +58,7 @@ fun findTopMostParent(node: CommentNode): CommentNode {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun LazyListScope.nodes(
|
internal fun LazyListScope.nodes(
|
||||||
nodes: List<CommentNode>,
|
nodes: List<CommentNode>,
|
||||||
htmlConverter: HTMLConverter,
|
htmlConverter: HTMLConverter,
|
||||||
toggleExpanded: (CommentNode) -> Unit,
|
toggleExpanded: (CommentNode) -> Unit,
|
||||||
|
@ -72,7 +72,7 @@ fun LazyListScope.nodes(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun LazyListScope.node(
|
private fun LazyListScope.node(
|
||||||
node: CommentNode,
|
node: CommentNode,
|
||||||
htmlConverter: HTMLConverter,
|
htmlConverter: HTMLConverter,
|
||||||
toggleExpanded: (CommentNode) -> Unit,
|
toggleExpanded: (CommentNode) -> Unit,
|
||||||
|
|
|
@ -115,7 +115,7 @@ fun PostDetails(post: SavedPost, modifier: Modifier = Modifier) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun PostTitle(
|
internal fun PostTitle(
|
||||||
title: String,
|
title: String,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
|
@ -128,7 +128,7 @@ fun PostTitle(
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun Submitter(
|
internal fun Submitter(
|
||||||
text: AnnotatedString,
|
text: AnnotatedString,
|
||||||
avatarUrl: String,
|
avatarUrl: String,
|
||||||
contentDescription: String,
|
contentDescription: String,
|
||||||
|
@ -151,7 +151,7 @@ fun Submitter(
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun SaveButton(
|
private fun SaveButton(
|
||||||
isSaved: Boolean,
|
isSaved: Boolean,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
|
@ -169,7 +169,7 @@ fun SaveButton(
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
@OptIn(ExperimentalMaterial3Api::class)
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
fun CommentsButton(
|
private fun CommentsButton(
|
||||||
commentCount: Int?,
|
commentCount: Int?,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
|
@ -200,7 +200,7 @@ fun CommentsButton(
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun TagRow(
|
internal fun TagRow(
|
||||||
tags: List<String>,
|
tags: List<String>,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
|
@ -214,7 +214,7 @@ fun TagRow(
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun TagText(
|
private fun TagText(
|
||||||
tag: String,
|
tag: String,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -19,7 +19,7 @@ import androidx.compose.runtime.ProvidedValue
|
||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
import com.halilibo.richtext.ui.material3.SetupMaterial3RichText
|
import com.halilibo.richtext.ui.material3.SetupMaterial3RichText
|
||||||
|
|
||||||
internal val LightThemeColors =
|
private val LightThemeColors =
|
||||||
lightColorScheme(
|
lightColorScheme(
|
||||||
primary = md_theme_light_primary,
|
primary = md_theme_light_primary,
|
||||||
onPrimary = md_theme_light_onPrimary,
|
onPrimary = md_theme_light_onPrimary,
|
||||||
|
@ -48,7 +48,7 @@ internal val LightThemeColors =
|
||||||
inverseSurface = md_theme_light_inverseSurface,
|
inverseSurface = md_theme_light_inverseSurface,
|
||||||
)
|
)
|
||||||
|
|
||||||
internal val DarkThemeColors =
|
private val DarkThemeColors =
|
||||||
darkColorScheme(
|
darkColorScheme(
|
||||||
primary = md_theme_dark_primary,
|
primary = md_theme_dark_primary,
|
||||||
onPrimary = md_theme_dark_onPrimary,
|
onPrimary = md_theme_dark_onPrimary,
|
||||||
|
|
|
@ -23,7 +23,7 @@ import dev.msfjarvis.claw.common.theme.LobstersTheme
|
||||||
import dev.msfjarvis.claw.common.ui.preview.ThemePreviews
|
import dev.msfjarvis.claw.common.ui.preview.ThemePreviews
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun ThemedRichText(
|
internal fun ThemedRichText(
|
||||||
text: String,
|
text: String,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
|
@ -50,7 +50,7 @@ fun ThemedRichText(
|
||||||
|
|
||||||
@ThemePreviews
|
@ThemePreviews
|
||||||
@Composable
|
@Composable
|
||||||
fun ThemedRichTextPreview() {
|
internal fun ThemedRichTextPreview() {
|
||||||
val text =
|
val text =
|
||||||
"""
|
"""
|
||||||
### Heading
|
### Heading
|
||||||
|
|
|
@ -72,6 +72,6 @@ fun NetworkError(
|
||||||
|
|
||||||
@ThemePreviews
|
@ThemePreviews
|
||||||
@Composable
|
@Composable
|
||||||
fun NetworkErrorPreview() {
|
internal fun NetworkErrorPreview() {
|
||||||
LobstersTheme { NetworkError(label = "Failed to load posts", error = Throwable("Preview")) }
|
LobstersTheme { NetworkError(label = "Failed to load posts", error = Throwable("Preview")) }
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ import androidx.compose.ui.graphics.painter.Painter
|
||||||
import coil.compose.AsyncImage
|
import coil.compose.AsyncImage
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun NetworkImage(
|
internal fun NetworkImage(
|
||||||
url: String?,
|
url: String?,
|
||||||
placeholder: Painter,
|
placeholder: Painter,
|
||||||
contentDescription: String,
|
contentDescription: String,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue