mirror of
https://github.com/LiveFastEatTrashRaccoon/RaccoonForLemmy.git
synced 2025-02-08 16:28:45 +01:00
chore: add ktlint (#854)
This commit is contained in:
parent
1adad36bf9
commit
0703b1573f
2
.editorconfig
Normal file
2
.editorconfig
Normal file
@ -0,0 +1,2 @@
|
||||
[*.{kt,kts}]
|
||||
ktlint_code_style = ktlint_official
|
@ -325,7 +325,7 @@ in `:core:notifications` is used.
|
||||
### 6.2.1 General Kotlin rules
|
||||
|
||||
Please refer to [this page](https://kotlinlang.org/docs/coding-conventions.html) for the conventions
|
||||
to apply to Kotlin code, most of which are already enforced by Android Studio inspections.
|
||||
to apply to Kotlin code.
|
||||
|
||||
### 6.2.2 Compose rules
|
||||
|
||||
@ -334,6 +334,12 @@ As far as Compose code is concerned, we take Google’s indications as a baselin
|
||||
- [general Compose API](https://android.googlesource.com/platform/frameworks/support/+/androidx-main/compose/docs/compose-api-guidelines.md)
|
||||
- [Compose component API](https://android.googlesource.com/platform/frameworks/support/+/androidx-main/compose/docs/compose-component-api-guidelines.md)
|
||||
|
||||
### 6.2.3 Linter
|
||||
|
||||
The recommended lint to use is [Ktlint](https://pinterest.github.io/ktlint/latest/) with the `ktlint_official` code
|
||||
style. There is a plugin for IntelliJ/Android Studio that allows to have distraction-free formatting upon saving, to
|
||||
make sure any new code is compliant with the rules.
|
||||
|
||||
### 6.3 Test structure
|
||||
|
||||
#### 6.3.1 Unit tests
|
||||
|
@ -41,8 +41,8 @@ android {
|
||||
setProguardFiles(
|
||||
listOf(
|
||||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||
"proguard-rules.pro"
|
||||
)
|
||||
"proguard-rules.pro",
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ kotlin {
|
||||
listOf(
|
||||
iosX64(),
|
||||
iosArm64(),
|
||||
iosSimulatorArm64()
|
||||
iosSimulatorArm64(),
|
||||
).forEach {
|
||||
it.binaries.framework {
|
||||
baseName = "api"
|
||||
|
@ -10,5 +10,7 @@ import de.jensklingenberg.ktorfit.http.POST
|
||||
interface AuthService {
|
||||
@POST("user/login")
|
||||
@Headers("Content-Type: application/json")
|
||||
suspend fun login(@Body form: LoginForm): Response<LoginResponse>
|
||||
suspend fun login(
|
||||
@Body form: LoginForm,
|
||||
): Response<LoginResponse>
|
||||
}
|
||||
|
@ -37,7 +37,6 @@ import de.jensklingenberg.ktorfit.http.Url
|
||||
import io.ktor.client.request.forms.*
|
||||
|
||||
interface PostService {
|
||||
|
||||
@GET("post/list")
|
||||
suspend fun getAll(
|
||||
@Header("Authorization") authHeader: String? = null,
|
||||
|
@ -19,7 +19,7 @@ kotlin {
|
||||
listOf(
|
||||
iosX64(),
|
||||
iosArm64(),
|
||||
iosSimulatorArm64()
|
||||
iosSimulatorArm64(),
|
||||
).forEach {
|
||||
it.binaries.framework {
|
||||
baseName = "appearance"
|
||||
|
@ -31,4 +31,4 @@ actual fun getColorSchemeProvider(): ColorSchemeProvider {
|
||||
actual fun getBarColorProvider(): BarColorProvider {
|
||||
val res by inject<BarColorProvider>(BarColorProvider::class.java)
|
||||
return res
|
||||
}
|
||||
}
|
||||
|
@ -114,4 +114,4 @@ class DefaultThemeRepositoryTest {
|
||||
val resAfter = sut.commentBarTheme.value
|
||||
assertEquals(CommentBarTheme.Green, resAfter)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -45,7 +45,6 @@ fun Float.toFontScale(): FontScale = when (this) {
|
||||
else -> FontScale.Normal
|
||||
}
|
||||
|
||||
|
||||
// log(2 + 0.1 * n) / log(2)
|
||||
private object ReferenceValues {
|
||||
const val largest = 1.2f
|
||||
|
@ -56,13 +56,13 @@ fun formatToReadableValue(
|
||||
addStyle(
|
||||
style = SpanStyle(color = upVoteColor),
|
||||
start = 0,
|
||||
end = text.length
|
||||
end = text.length,
|
||||
)
|
||||
} else if (downVoted) {
|
||||
addStyle(
|
||||
style = SpanStyle(color = downVoteColor),
|
||||
start = 0,
|
||||
end = length
|
||||
end = length,
|
||||
)
|
||||
}
|
||||
}
|
||||
@ -74,7 +74,7 @@ fun formatToReadableValue(
|
||||
addStyle(
|
||||
style = SpanStyle(color = upVoteColor),
|
||||
start = 0,
|
||||
end = upvoteText.length
|
||||
end = upvoteText.length,
|
||||
)
|
||||
}
|
||||
append(" / ")
|
||||
@ -84,7 +84,7 @@ fun formatToReadableValue(
|
||||
addStyle(
|
||||
style = SpanStyle(color = downVoteColor),
|
||||
start = upvoteText.length + 3,
|
||||
end = upvoteText.length + 3 + downvoteText.length
|
||||
end = upvoteText.length + 3 + downvoteText.length,
|
||||
)
|
||||
}
|
||||
}
|
||||
@ -96,13 +96,13 @@ fun formatToReadableValue(
|
||||
addStyle(
|
||||
style = SpanStyle(color = upVoteColor),
|
||||
start = 0,
|
||||
end = text.length
|
||||
end = text.length,
|
||||
)
|
||||
} else if (downVoted) {
|
||||
addStyle(
|
||||
style = SpanStyle(color = downVoteColor),
|
||||
start = 0,
|
||||
end = length
|
||||
end = length,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,6 @@ import com.github.diegoberaldin.raccoonforlemmy.core.appearance.data.UiFontFamil
|
||||
import com.github.diegoberaldin.raccoonforlemmy.core.appearance.data.UiTheme
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
|
||||
|
||||
internal class DefaultThemeRepository : ThemeRepository {
|
||||
|
||||
override val uiTheme = MutableStateFlow<UiTheme?>(null)
|
||||
|
@ -80,5 +80,5 @@ val md_theme_black_onSecondaryContainer = Color(0xFFFFFFFF)
|
||||
val md_theme_black_tertiaryContainer = Color(0xFF262626)
|
||||
val md_theme_black_onTertiaryContainer = Color(0xFFFFFFFF)
|
||||
|
||||
//val seed = Color(0xFF6345CB)
|
||||
// val seed = Color(0xFF6345CB)
|
||||
val ic_launcher_background = Color(0xFFBCC5FF)
|
||||
|
@ -19,7 +19,7 @@ kotlin {
|
||||
listOf(
|
||||
iosX64(),
|
||||
iosArm64(),
|
||||
iosSimulatorArm64()
|
||||
iosSimulatorArm64(),
|
||||
).forEach {
|
||||
it.binaries.framework {
|
||||
baseName = "architecture"
|
||||
|
@ -19,7 +19,7 @@ kotlin {
|
||||
listOf(
|
||||
iosX64(),
|
||||
iosArm64(),
|
||||
iosSimulatorArm64()
|
||||
iosSimulatorArm64(),
|
||||
).forEach {
|
||||
it.binaries.framework {
|
||||
baseName = "components"
|
||||
|
@ -62,7 +62,7 @@ actual fun CustomImage(
|
||||
},
|
||||
onSuccess = {
|
||||
painterState = it
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
when (val state = painterState) {
|
||||
@ -95,4 +95,4 @@ actual fun CustomImage(
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ actual fun CustomWebView(
|
||||
WebView(context).apply {
|
||||
layoutParams = ViewGroup.LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
ViewGroup.LayoutParams.MATCH_PARENT
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
)
|
||||
webViewClient = object : WebViewClient() {
|
||||
override fun onPageStarted(view: WebView, url: String?, favicon: Bitmap?) {
|
||||
@ -55,7 +55,8 @@ actual fun CustomWebView(
|
||||
available = Offset(
|
||||
x = (oldScrollX - scrollX) / density,
|
||||
y = (oldScrollY - scrollY) / density,
|
||||
), source = NestedScrollSource.Drag
|
||||
),
|
||||
source = NestedScrollSource.Drag,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ actual fun VideoPlayer(
|
||||
val defaultDataSourceFactory = DefaultDataSource.Factory(context)
|
||||
val dataSourceFactory: DataSource.Factory = DefaultDataSource.Factory(
|
||||
context,
|
||||
defaultDataSourceFactory
|
||||
defaultDataSourceFactory,
|
||||
)
|
||||
val source = ProgressiveMediaSource.Factory(dataSourceFactory)
|
||||
.createMediaSource(MediaItem.fromUri(url))
|
||||
@ -72,7 +72,7 @@ actual fun VideoPlayer(
|
||||
player = exoPlayer
|
||||
layoutParams = FrameLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT)
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
DisposableEffect(Unit) {
|
||||
|
@ -29,7 +29,7 @@ fun rememberWebViewNavigator(): WebViewNavigator {
|
||||
val scope = rememberCoroutineScope()
|
||||
return remember {
|
||||
WebViewNavigator(
|
||||
coroutineScope = scope
|
||||
coroutineScope = scope,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -44,7 +44,6 @@ fun DraggableSideMenu(
|
||||
onDismiss: (() -> Unit)? = null,
|
||||
content: @Composable () -> Unit = {},
|
||||
) {
|
||||
|
||||
val density = LocalDensity.current
|
||||
val maxWidth = if (availableWidth.isSpecified) availableWidth * 0.85f else 500.dp
|
||||
val draggableState = remember(availableWidth) {
|
||||
@ -96,7 +95,7 @@ fun DraggableSideMenu(
|
||||
top = Spacing.xxl,
|
||||
bottom = Spacing.m,
|
||||
end = Spacing.s,
|
||||
start = Spacing.s
|
||||
start = Spacing.s,
|
||||
),
|
||||
) {
|
||||
content()
|
||||
|
@ -66,12 +66,12 @@ fun FloatingActionButtonMenu(
|
||||
val enterTransition = remember {
|
||||
fadeIn(
|
||||
initialAlpha = 0.3f,
|
||||
animationSpec = tween(ANIMATION_DURATION, easing = FastOutSlowInEasing)
|
||||
animationSpec = tween(ANIMATION_DURATION, easing = FastOutSlowInEasing),
|
||||
)
|
||||
}
|
||||
val exitTransition = remember {
|
||||
fadeOut(
|
||||
animationSpec = tween(ANIMATION_DURATION, easing = FastOutSlowInEasing)
|
||||
animationSpec = tween(ANIMATION_DURATION, easing = FastOutSlowInEasing),
|
||||
)
|
||||
}
|
||||
val numberOfItems by animateIntAsState(
|
||||
@ -79,7 +79,7 @@ fun FloatingActionButtonMenu(
|
||||
animationSpec = tween(
|
||||
durationMillis = ANIMATION_DURATION * items.size,
|
||||
easing = LinearEasing,
|
||||
)
|
||||
),
|
||||
)
|
||||
val indices: List<Int> = if (numberOfItems == 0) {
|
||||
emptyList()
|
||||
@ -104,7 +104,7 @@ fun FloatingActionButtonMenu(
|
||||
AnimatedVisibility(
|
||||
visible = idx in indices,
|
||||
enter = enterTransition,
|
||||
exit = exitTransition
|
||||
exit = exitTransition,
|
||||
) {
|
||||
Row(
|
||||
modifier = Modifier.onClick(
|
||||
@ -114,7 +114,7 @@ fun FloatingActionButtonMenu(
|
||||
},
|
||||
).padding(end = 15.dp),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.spacedBy(Spacing.xxs)
|
||||
horizontalArrangement = Arrangement.spacedBy(Spacing.xxs),
|
||||
) {
|
||||
Text(
|
||||
modifier = Modifier
|
||||
@ -124,7 +124,7 @@ fun FloatingActionButtonMenu(
|
||||
shape = RoundedCornerShape(CornerSize.s),
|
||||
).padding(
|
||||
vertical = Spacing.xs,
|
||||
horizontal = Spacing.s
|
||||
horizontal = Spacing.s,
|
||||
),
|
||||
text = item.text,
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
@ -135,7 +135,7 @@ fun FloatingActionButtonMenu(
|
||||
.size(IconSize.m)
|
||||
.background(
|
||||
color = MaterialTheme.colorScheme.primaryContainer,
|
||||
shape = CircleShape
|
||||
shape = CircleShape,
|
||||
).padding(6.dp),
|
||||
imageVector = item.icon,
|
||||
contentDescription = null,
|
||||
@ -147,12 +147,11 @@ fun FloatingActionButtonMenu(
|
||||
Spacer(modifier = Modifier.height(Spacing.xxs))
|
||||
}
|
||||
|
||||
|
||||
val fabContainerColor = when (theme) {
|
||||
UiTheme.Black -> schemeProvider.getColorScheme(
|
||||
theme = UiTheme.Dark,
|
||||
dynamic = dynamicColors,
|
||||
customSeed = seedColor
|
||||
customSeed = seedColor,
|
||||
).primaryContainer
|
||||
|
||||
else -> MaterialTheme.colorScheme.primaryContainer
|
||||
|
@ -25,4 +25,4 @@ fun MultiColorPreview(
|
||||
start += step
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -45,11 +45,11 @@ fun SectionSelector(
|
||||
} else {
|
||||
onSectionSelected((currentSection + 1).coerceAtMost(titles.lastIndex))
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
} else {
|
||||
Modifier
|
||||
}
|
||||
},
|
||||
),
|
||||
selected = i == currentSection,
|
||||
text = {
|
||||
@ -64,6 +64,6 @@ fun SectionSelector(
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
|
@ -61,7 +61,6 @@ fun SwipeActionCard(
|
||||
swipeToEndActions.getOrNull(1)?.onTriggered?.invoke()
|
||||
} else {
|
||||
swipeToEndActions.firstOrNull()?.onTriggered?.invoke()
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -129,9 +128,9 @@ fun SwipeActionCard(
|
||||
val enableSecondAction = actions.size > 1
|
||||
val bgColor by animateColorAsState(
|
||||
targetValue = if (
|
||||
dismissState.progress < SECOND_ACTION_THRESHOLD
|
||||
|| dismissState.targetValue == SwipeToDismissBoxValue.Settled
|
||||
|| !enableSecondAction
|
||||
dismissState.progress < SECOND_ACTION_THRESHOLD ||
|
||||
dismissState.targetValue == SwipeToDismissBoxValue.Settled ||
|
||||
!enableSecondAction
|
||||
) {
|
||||
actions.firstOrNull()?.backgroundColor ?: Color.Transparent
|
||||
} else {
|
||||
@ -184,14 +183,14 @@ private fun rememberNoFlingSwipeToDismissBoxState(
|
||||
saver = SwipeToDismissBoxState.Saver(
|
||||
confirmValueChange = confirmValueChange,
|
||||
density = density,
|
||||
positionalThreshold = positionalThreshold
|
||||
)
|
||||
positionalThreshold = positionalThreshold,
|
||||
),
|
||||
) {
|
||||
SwipeToDismissBoxState(
|
||||
initialValue = initialValue,
|
||||
density = density,
|
||||
confirmValueChange = confirmValueChange,
|
||||
positionalThreshold = positionalThreshold
|
||||
positionalThreshold = positionalThreshold,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -124,8 +124,8 @@ fun ZoomableImage(
|
||||
initialValue = 0f,
|
||||
targetValue = 1f,
|
||||
animationSpec = InfiniteRepeatableSpec(
|
||||
animation = tween(LOADING_ANIMATION_DURATION)
|
||||
)
|
||||
animation = tween(LOADING_ANIMATION_DURATION),
|
||||
),
|
||||
)
|
||||
res
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ actual fun CustomWebView(
|
||||
}
|
||||
WKWebView(
|
||||
frame = CGRectZero.readValue(),
|
||||
configuration = config
|
||||
configuration = config,
|
||||
).apply {
|
||||
userInteractionEnabled = true
|
||||
allowsBackForwardNavigationGestures = true
|
||||
@ -82,7 +82,6 @@ actual fun CustomWebView(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}.also {
|
||||
webView = it
|
||||
}
|
||||
@ -90,6 +89,6 @@ actual fun CustomWebView(
|
||||
modifier = modifier,
|
||||
onRelease = {
|
||||
webView = null
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ kotlin {
|
||||
listOf(
|
||||
iosX64(),
|
||||
iosArm64(),
|
||||
iosSimulatorArm64()
|
||||
iosSimulatorArm64(),
|
||||
).forEach {
|
||||
it.binaries.framework {
|
||||
baseName = "detailopener-api"
|
||||
|
@ -5,4 +5,4 @@ import org.koin.java.KoinJavaComponent.inject
|
||||
actual fun getDetailOpener(): DetailOpener {
|
||||
val res: DetailOpener by inject(DetailOpener::class.java)
|
||||
return res
|
||||
}
|
||||
}
|
||||
|
@ -7,4 +7,4 @@ actual fun getDetailOpener(): DetailOpener = DetailOpenerApiDiHelper.detailOpene
|
||||
|
||||
object DetailOpenerApiDiHelper : KoinComponent {
|
||||
val detailOpener: DetailOpener by inject()
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ kotlin {
|
||||
listOf(
|
||||
iosX64(),
|
||||
iosArm64(),
|
||||
iosSimulatorArm64()
|
||||
iosSimulatorArm64(),
|
||||
).forEach {
|
||||
it.binaries.framework {
|
||||
baseName = "detailopener-impl"
|
||||
|
@ -19,7 +19,7 @@ kotlin {
|
||||
listOf(
|
||||
iosX64(),
|
||||
iosArm64(),
|
||||
iosSimulatorArm64()
|
||||
iosSimulatorArm64(),
|
||||
).forEach {
|
||||
it.binaries.framework {
|
||||
baseName = "lemmyui"
|
||||
|
@ -6,4 +6,4 @@ import org.koin.java.KoinJavaComponent
|
||||
actual fun getFabNestedScrollConnection(): FabNestedScrollConnection {
|
||||
val res: FabNestedScrollConnection by KoinJavaComponent.inject(FabNestedScrollConnection::class.java)
|
||||
return res
|
||||
}
|
||||
}
|
||||
|
@ -60,11 +60,11 @@ fun CollapsedCommentCard(
|
||||
Column(
|
||||
modifier = modifier.onClick(
|
||||
onClick = onClick ?: {},
|
||||
)
|
||||
),
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier.padding(
|
||||
start = (INDENT_AMOUNT * comment.depth).dp
|
||||
start = (INDENT_AMOUNT * comment.depth).dp,
|
||||
),
|
||||
) {
|
||||
Column(
|
||||
@ -76,7 +76,7 @@ fun CollapsedCommentCard(
|
||||
horizontal = Spacing.s,
|
||||
).onGloballyPositioned {
|
||||
commentHeight = it.size.toSize().height
|
||||
}
|
||||
},
|
||||
) {
|
||||
CommunityAndCreatorInfo(
|
||||
iconSize = IconSize.s,
|
||||
@ -120,7 +120,7 @@ fun CollapsedCommentCard(
|
||||
.padding(top = Spacing.xxs)
|
||||
.width(barWidth)
|
||||
.height(commentHeight.toLocalDp())
|
||||
.background(color = barColor)
|
||||
.background(color = barColor),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -89,11 +89,11 @@ fun CommentCard(
|
||||
Box(
|
||||
modifier = Modifier.onClick(
|
||||
onClick = onClick ?: {},
|
||||
onDoubleClick = onDoubleClick ?: {}
|
||||
onDoubleClick = onDoubleClick ?: {},
|
||||
).padding(
|
||||
start = indentAmount.takeIf { it > 0 }?.let {
|
||||
(it * comment.depth).dp + Spacing.xxxs
|
||||
} ?: 0.dp
|
||||
} ?: 0.dp,
|
||||
),
|
||||
) {
|
||||
Column(
|
||||
@ -184,7 +184,7 @@ fun CommentCard(
|
||||
.padding(top = Spacing.xxs)
|
||||
.width(barWidth)
|
||||
.height(commentHeight.toLocalDp())
|
||||
.background(color = barColor, shape = RoundedCornerShape(barWidth / 2))
|
||||
.background(color = barColor, shape = RoundedCornerShape(barWidth / 2)),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -34,12 +34,12 @@ fun CommentCardPlaceholder(
|
||||
if (!hideAuthor) {
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.spacedBy(Spacing.s)
|
||||
horizontalArrangement = Arrangement.spacedBy(Spacing.s),
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier.size(IconSize.s)
|
||||
.clip(CircleShape)
|
||||
.shimmerEffect()
|
||||
.shimmerEffect(),
|
||||
)
|
||||
Column(
|
||||
modifier = Modifier.padding(vertical = Spacing.xxxs),
|
||||
@ -49,13 +49,13 @@ fun CommentCardPlaceholder(
|
||||
modifier = Modifier.height(IconSize.s)
|
||||
.fillMaxWidth()
|
||||
.clip(RoundedCornerShape(CornerSize.m))
|
||||
.shimmerEffect()
|
||||
.shimmerEffect(),
|
||||
)
|
||||
Box(
|
||||
modifier = Modifier.height(IconSize.s)
|
||||
.fillMaxWidth(0.5f)
|
||||
.clip(RoundedCornerShape(CornerSize.m))
|
||||
.shimmerEffect()
|
||||
.shimmerEffect(),
|
||||
)
|
||||
}
|
||||
}
|
||||
@ -65,14 +65,14 @@ fun CommentCardPlaceholder(
|
||||
.height(80.dp)
|
||||
.fillMaxWidth()
|
||||
.clip(RoundedCornerShape(CornerSize.s))
|
||||
.shimmerEffect()
|
||||
.shimmerEffect(),
|
||||
)
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.height(IconSize.l)
|
||||
.fillMaxWidth()
|
||||
.clip(RoundedCornerShape(CornerSize.m))
|
||||
.shimmerEffect()
|
||||
.shimmerEffect(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ fun CommunityAndCreatorInfo(
|
||||
Row(
|
||||
modifier = modifier,
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.spacedBy(Spacing.s)
|
||||
horizontalArrangement = Arrangement.spacedBy(Spacing.s),
|
||||
) {
|
||||
if (communityIcon.isNotEmpty()) {
|
||||
if (autoLoadImages) {
|
||||
|
@ -85,7 +85,7 @@ fun CommunityHeader(
|
||||
Row(
|
||||
modifier = Modifier.fillMaxWidth().padding(Spacing.s).align(Alignment.Center),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.spacedBy(Spacing.m)
|
||||
horizontalArrangement = Arrangement.spacedBy(Spacing.m),
|
||||
) {
|
||||
val communityIcon = community.icon.orEmpty()
|
||||
|
||||
|
@ -74,7 +74,7 @@ fun CommunityItem(
|
||||
Modifier
|
||||
} else {
|
||||
Modifier.padding(Spacing.s)
|
||||
}
|
||||
},
|
||||
),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.spacedBy(Spacing.xs),
|
||||
@ -150,7 +150,7 @@ fun CommunityItem(
|
||||
modifier = Modifier
|
||||
.size(IconSize.m)
|
||||
.onClick(
|
||||
onClick = { onSubscribe?.invoke() }
|
||||
onClick = { onSubscribe?.invoke() },
|
||||
),
|
||||
imageVector = when (community.subscribed) {
|
||||
true -> {
|
||||
|
@ -46,14 +46,14 @@ fun CommunityItemPlaceholder() {
|
||||
.height(40.dp)
|
||||
.fillMaxWidth()
|
||||
.clip(RoundedCornerShape(CornerSize.s))
|
||||
.shimmerEffect()
|
||||
.shimmerEffect(),
|
||||
)
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.height(20.dp)
|
||||
.fillMaxWidth()
|
||||
.clip(RoundedCornerShape(CornerSize.s))
|
||||
.shimmerEffect()
|
||||
.shimmerEffect(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -36,13 +36,13 @@ fun DetailInfoItem(
|
||||
SpanStyle(
|
||||
fontWeight = FontWeight.Bold,
|
||||
color = MaterialTheme.colorScheme.primary,
|
||||
)
|
||||
),
|
||||
) {
|
||||
append(value)
|
||||
}
|
||||
append(" ")
|
||||
append(title)
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -26,10 +26,9 @@ internal class DefaultFabNestedScrollConnection : FabNestedScrollConnection {
|
||||
.stateIn(
|
||||
scope = scope,
|
||||
started = SharingStarted.WhileSubscribed(5_000),
|
||||
initialValue = true
|
||||
initialValue = true,
|
||||
)
|
||||
|
||||
|
||||
override fun onPreScroll(available: Offset, source: NestedScrollSource): Offset {
|
||||
if (available.y < -THRESHOLD) {
|
||||
fabVisible.value = false
|
||||
|
@ -69,7 +69,7 @@ fun InboxCard(
|
||||
.padding(vertical = Spacing.s)
|
||||
} else {
|
||||
Modifier.background(MaterialTheme.colorScheme.background)
|
||||
}
|
||||
},
|
||||
).onClick(
|
||||
onClick = {
|
||||
onOpenPost(mention.post)
|
||||
|
@ -38,7 +38,7 @@ fun InboxCardPlaceholder(
|
||||
.padding(Spacing.s)
|
||||
} else {
|
||||
Modifier
|
||||
}
|
||||
},
|
||||
),
|
||||
verticalArrangement = Arrangement.spacedBy(Spacing.xs),
|
||||
) {
|
||||
@ -47,7 +47,7 @@ fun InboxCardPlaceholder(
|
||||
.height(IconSize.l)
|
||||
.fillMaxWidth()
|
||||
.clip(RoundedCornerShape(CornerSize.m))
|
||||
.shimmerEffect()
|
||||
.shimmerEffect(),
|
||||
)
|
||||
Box(
|
||||
modifier = Modifier
|
||||
@ -55,14 +55,14 @@ fun InboxCardPlaceholder(
|
||||
.height(50.dp)
|
||||
.fillMaxWidth()
|
||||
.clip(RoundedCornerShape(CornerSize.m))
|
||||
.shimmerEffect()
|
||||
.shimmerEffect(),
|
||||
)
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.height(IconSize.l)
|
||||
.fillMaxWidth()
|
||||
.clip(RoundedCornerShape(CornerSize.m))
|
||||
.shimmerEffect()
|
||||
.shimmerEffect(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -45,7 +45,6 @@ fun InboxCardHeader(
|
||||
append(LocalXmlStrings.current.inboxItemReplyComment)
|
||||
} else {
|
||||
append(LocalXmlStrings.current.inboxItemReplyPost)
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -228,7 +228,7 @@ fun InboxReplySubtitle(
|
||||
),
|
||||
imageVector = Icons.Default.MoreHoriz,
|
||||
contentDescription = null,
|
||||
tint = ancillaryColor
|
||||
tint = ancillaryColor,
|
||||
)
|
||||
}
|
||||
Spacer(modifier = Modifier.weight(1f))
|
||||
|
@ -26,7 +26,7 @@ fun IndicatorChip(
|
||||
.border(
|
||||
color = MaterialTheme.colorScheme.onBackground,
|
||||
width = Dp.Hairline,
|
||||
shape = RoundedCornerShape(CornerSize.m)
|
||||
shape = RoundedCornerShape(CornerSize.m),
|
||||
)
|
||||
.padding(
|
||||
vertical = Spacing.xxxs,
|
||||
|
@ -13,7 +13,6 @@ sealed interface ModeratorZoneAction {
|
||||
data object GlobalReports : ModeratorZoneAction
|
||||
|
||||
data object ModeratedContents : ModeratorZoneAction
|
||||
|
||||
}
|
||||
|
||||
fun Int.toModeratorZoneAction(): ModeratorZoneAction = when (this) {
|
||||
|
@ -72,9 +72,8 @@ fun MultiCommunityItem(
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Column(
|
||||
modifier = Modifier.weight(1f).padding(start = Spacing.xs)
|
||||
modifier = Modifier.weight(1f).padding(start = Spacing.xs),
|
||||
) {
|
||||
Text(
|
||||
modifier = Modifier.padding(vertical = Spacing.s),
|
||||
@ -86,7 +85,6 @@ fun MultiCommunityItem(
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
if (options.isNotEmpty()) {
|
||||
Box {
|
||||
Icon(
|
||||
|
@ -96,7 +96,7 @@ fun PostCard(
|
||||
.padding(horizontal = Spacing.xs)
|
||||
.shadow(
|
||||
elevation = 5.dp,
|
||||
shape = RoundedCornerShape(CornerSize.l)
|
||||
shape = RoundedCornerShape(CornerSize.l),
|
||||
)
|
||||
.clip(RoundedCornerShape(CornerSize.l))
|
||||
.background(
|
||||
@ -105,7 +105,7 @@ fun PostCard(
|
||||
.padding(vertical = Spacing.s)
|
||||
} else {
|
||||
Modifier
|
||||
}
|
||||
},
|
||||
).onClick(
|
||||
onClick = onClick ?: {},
|
||||
onDoubleClick = onDoubleClick ?: {},
|
||||
@ -228,7 +228,7 @@ private fun CompactPost(
|
||||
},
|
||||
onTap = {
|
||||
onClick?.invoke()
|
||||
}
|
||||
},
|
||||
)
|
||||
},
|
||||
verticalArrangement = Arrangement.spacedBy(Spacing.xxs),
|
||||
@ -258,7 +258,7 @@ private fun CompactPost(
|
||||
Row(
|
||||
modifier = Modifier.padding(horizontal = Spacing.xs),
|
||||
verticalAlignment = Alignment.Top,
|
||||
horizontalArrangement = Arrangement.spacedBy(Spacing.xs)
|
||||
horizontalArrangement = Arrangement.spacedBy(Spacing.xs),
|
||||
) {
|
||||
CustomizedContent(ContentFontClass.Title) {
|
||||
PostCardTitle(
|
||||
@ -313,7 +313,7 @@ private fun CompactPost(
|
||||
Modifier
|
||||
} else {
|
||||
Modifier.aspectRatio(1f)
|
||||
}
|
||||
},
|
||||
)
|
||||
.padding(vertical = Spacing.xs)
|
||||
.clip(RoundedCornerShape(CornerSize.s)),
|
||||
@ -422,11 +422,11 @@ private fun ExtendedPost(
|
||||
val navigationCoordinator = remember { getNavigationCoordinator() }
|
||||
val optionsMenuOpen = remember { mutableStateOf(false) }
|
||||
val postLinkUrl = post.url.orEmpty().takeIf {
|
||||
it != post.imageUrl
|
||||
&& it != post.videoUrl
|
||||
&& !it.looksLikeAnImage
|
||||
&& !it.looksLikeAVideo
|
||||
&& !it.showInEmbeddedWebView
|
||||
it != post.imageUrl &&
|
||||
it != post.videoUrl &&
|
||||
!it.looksLikeAnImage &&
|
||||
!it.looksLikeAVideo &&
|
||||
!it.showInEmbeddedWebView
|
||||
}.orEmpty()
|
||||
|
||||
Column(
|
||||
@ -439,7 +439,7 @@ private fun ExtendedPost(
|
||||
},
|
||||
onTap = {
|
||||
onClick?.invoke()
|
||||
}
|
||||
},
|
||||
)
|
||||
},
|
||||
verticalArrangement = Arrangement.spacedBy(Spacing.xxs),
|
||||
@ -556,13 +556,13 @@ private fun ExtendedPost(
|
||||
Modifier.clip(RoundedCornerShape(CornerSize.xl))
|
||||
} else {
|
||||
Modifier
|
||||
}
|
||||
},
|
||||
).then(
|
||||
if (fullHeightImage) {
|
||||
Modifier
|
||||
} else {
|
||||
Modifier.heightIn(max = 200.dp)
|
||||
}
|
||||
},
|
||||
),
|
||||
imageUrl = post.imageUrl,
|
||||
blurred = blurNsfw && post.nsfw,
|
||||
|
@ -124,7 +124,7 @@ fun PostCardFooter(
|
||||
.padding(start = Spacing.xxs)
|
||||
.background(
|
||||
color = MaterialTheme.colorScheme.secondary,
|
||||
shape = RoundedCornerShape(CornerSize.s)
|
||||
shape = RoundedCornerShape(CornerSize.s),
|
||||
)
|
||||
.padding(horizontal = Spacing.xxs),
|
||||
text = "+$unreadComments",
|
||||
@ -149,7 +149,7 @@ fun PostCardFooter(
|
||||
Modifier.padding(0.5.dp)
|
||||
} else {
|
||||
Modifier
|
||||
}
|
||||
},
|
||||
),
|
||||
imageVector = if (isShowingUpdateDate) {
|
||||
Icons.Default.Update
|
||||
@ -285,5 +285,3 @@ fun PostCardFooter(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -67,8 +67,8 @@ fun PostCardImage(
|
||||
initialValue = 0f,
|
||||
targetValue = 1f,
|
||||
animationSpec = InfiniteRepeatableSpec(
|
||||
animation = tween(1000)
|
||||
)
|
||||
animation = tween(1000),
|
||||
),
|
||||
)
|
||||
res
|
||||
}
|
||||
|
@ -39,12 +39,12 @@ fun PostCardPlaceholder(
|
||||
) {
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.spacedBy(Spacing.s)
|
||||
horizontalArrangement = Arrangement.spacedBy(Spacing.s),
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier.size(IconSize.s)
|
||||
.clip(CircleShape)
|
||||
.shimmerEffect()
|
||||
.shimmerEffect(),
|
||||
)
|
||||
Column(
|
||||
modifier = Modifier.padding(vertical = Spacing.xxxs),
|
||||
@ -54,33 +54,33 @@ fun PostCardPlaceholder(
|
||||
modifier = Modifier.height(IconSize.s)
|
||||
.fillMaxWidth()
|
||||
.clip(RoundedCornerShape(CornerSize.m))
|
||||
.shimmerEffect()
|
||||
.shimmerEffect(),
|
||||
)
|
||||
Box(
|
||||
modifier = Modifier.height(IconSize.s)
|
||||
.fillMaxWidth(0.5f)
|
||||
.clip(RoundedCornerShape(CornerSize.m))
|
||||
.shimmerEffect()
|
||||
.shimmerEffect(),
|
||||
)
|
||||
}
|
||||
}
|
||||
Row(
|
||||
verticalAlignment = Alignment.Top,
|
||||
horizontalArrangement = Arrangement.spacedBy(Spacing.xs)
|
||||
horizontalArrangement = Arrangement.spacedBy(Spacing.xs),
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.weight(0.2f)
|
||||
.aspectRatio(1.33f)
|
||||
.clip(RoundedCornerShape(CornerSize.s))
|
||||
.shimmerEffect()
|
||||
.shimmerEffect(),
|
||||
)
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.height(40.dp)
|
||||
.weight(1f)
|
||||
.clip(RoundedCornerShape(CornerSize.m))
|
||||
.shimmerEffect()
|
||||
.shimmerEffect(),
|
||||
)
|
||||
}
|
||||
Box(
|
||||
@ -88,7 +88,7 @@ fun PostCardPlaceholder(
|
||||
.height(IconSize.l)
|
||||
.fillMaxWidth()
|
||||
.clip(RoundedCornerShape(CornerSize.s))
|
||||
.shimmerEffect()
|
||||
.shimmerEffect(),
|
||||
)
|
||||
}
|
||||
}
|
||||
@ -106,13 +106,13 @@ fun PostCardPlaceholder(
|
||||
) {
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.spacedBy(Spacing.s)
|
||||
horizontalArrangement = Arrangement.spacedBy(Spacing.s),
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.size(IconSize.l)
|
||||
.clip(CircleShape)
|
||||
.shimmerEffect()
|
||||
.shimmerEffect(),
|
||||
)
|
||||
Column(
|
||||
modifier = Modifier.padding(vertical = Spacing.xxxs),
|
||||
@ -122,13 +122,13 @@ fun PostCardPlaceholder(
|
||||
modifier = Modifier.height(IconSize.s)
|
||||
.fillMaxWidth()
|
||||
.clip(RoundedCornerShape(CornerSize.m))
|
||||
.shimmerEffect()
|
||||
.shimmerEffect(),
|
||||
)
|
||||
Box(
|
||||
modifier = Modifier.height(IconSize.s)
|
||||
.fillMaxWidth(0.5f)
|
||||
.clip(RoundedCornerShape(CornerSize.m))
|
||||
.shimmerEffect()
|
||||
.shimmerEffect(),
|
||||
)
|
||||
}
|
||||
}
|
||||
@ -136,21 +136,21 @@ fun PostCardPlaceholder(
|
||||
modifier = Modifier.height(IconSize.l)
|
||||
.fillMaxWidth()
|
||||
.clip(RoundedCornerShape(CornerSize.m))
|
||||
.shimmerEffect()
|
||||
.shimmerEffect(),
|
||||
)
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.height(200.dp)
|
||||
.fillMaxWidth()
|
||||
.clip(RoundedCornerShape(CornerSize.s))
|
||||
.shimmerEffect()
|
||||
.shimmerEffect(),
|
||||
)
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.height(IconSize.l)
|
||||
.fillMaxWidth()
|
||||
.clip(RoundedCornerShape(CornerSize.m))
|
||||
.shimmerEffect()
|
||||
.shimmerEffect(),
|
||||
)
|
||||
}
|
||||
}
|
||||
@ -162,13 +162,13 @@ fun PostCardPlaceholder(
|
||||
) {
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.spacedBy(Spacing.s)
|
||||
horizontalArrangement = Arrangement.spacedBy(Spacing.s),
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.size(IconSize.l)
|
||||
.clip(CircleShape)
|
||||
.shimmerEffect()
|
||||
.shimmerEffect(),
|
||||
)
|
||||
Column(
|
||||
modifier = Modifier.padding(vertical = Spacing.xxxs),
|
||||
@ -178,13 +178,13 @@ fun PostCardPlaceholder(
|
||||
modifier = Modifier.height(IconSize.s)
|
||||
.fillMaxWidth()
|
||||
.clip(RoundedCornerShape(CornerSize.m))
|
||||
.shimmerEffect()
|
||||
.shimmerEffect(),
|
||||
)
|
||||
Box(
|
||||
modifier = Modifier.height(IconSize.s)
|
||||
.fillMaxWidth(0.5f)
|
||||
.clip(RoundedCornerShape(CornerSize.m))
|
||||
.shimmerEffect()
|
||||
.shimmerEffect(),
|
||||
)
|
||||
}
|
||||
}
|
||||
@ -193,21 +193,21 @@ fun PostCardPlaceholder(
|
||||
.height(IconSize.l)
|
||||
.fillMaxWidth()
|
||||
.clip(RoundedCornerShape(CornerSize.m))
|
||||
.shimmerEffect()
|
||||
.shimmerEffect(),
|
||||
)
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.height(200.dp)
|
||||
.fillMaxWidth()
|
||||
.clip(RoundedCornerShape(CornerSize.s))
|
||||
.shimmerEffect()
|
||||
.shimmerEffect(),
|
||||
)
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.height(IconSize.l)
|
||||
.fillMaxWidth()
|
||||
.clip(RoundedCornerShape(CornerSize.m))
|
||||
.shimmerEffect()
|
||||
.shimmerEffect(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ fun PostCardVideo(
|
||||
url = url,
|
||||
onPlaybackStarted = {
|
||||
loading = false
|
||||
}
|
||||
},
|
||||
)
|
||||
if (loading) {
|
||||
Box(
|
||||
|
@ -40,7 +40,7 @@ fun PostLinkBanner(
|
||||
text = url,
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
style = MaterialTheme.typography.labelMedium
|
||||
style = MaterialTheme.typography.labelMedium,
|
||||
)
|
||||
Icon(
|
||||
imageVector = Icons.Default.Link,
|
||||
|
@ -48,7 +48,7 @@ fun SettingsFormattedInfo(
|
||||
text = value,
|
||||
onClick = {
|
||||
onEdit?.invoke()
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ import com.github.diegoberaldin.raccoonforlemmy.core.utils.compose.onClick
|
||||
fun SettingsImageInfo(
|
||||
modifier: Modifier = Modifier,
|
||||
imageModifier: Modifier = Modifier,
|
||||
contentScale : ContentScale = ContentScale.FillBounds,
|
||||
contentScale: ContentScale = ContentScale.FillBounds,
|
||||
title: String = "",
|
||||
url: String = "",
|
||||
onEdit: (() -> Unit)? = null,
|
||||
|
@ -51,7 +51,7 @@ fun SettingsIntValueRow(
|
||||
}
|
||||
}
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
) {
|
||||
FeedbackButton(
|
||||
imageVector = Icons.Default.RemoveCircleOutline,
|
||||
|
@ -67,7 +67,7 @@ fun SettingsRow(
|
||||
)
|
||||
}
|
||||
Column(
|
||||
modifier = Modifier.weight(1f)
|
||||
modifier = Modifier.weight(1f),
|
||||
) {
|
||||
Text(
|
||||
text = title,
|
||||
|
@ -46,7 +46,7 @@ fun SettingsSwitchRow(
|
||||
checked = value,
|
||||
onCheckedChange = {
|
||||
onValueChanged(it)
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ fun TextFormattingBar(
|
||||
it.text.substring(
|
||||
selection.start,
|
||||
selection.end,
|
||||
)
|
||||
),
|
||||
)
|
||||
}
|
||||
append("**")
|
||||
@ -80,7 +80,7 @@ fun TextFormattingBar(
|
||||
it.text.substring(
|
||||
selection.end,
|
||||
it.text.length,
|
||||
)
|
||||
),
|
||||
)
|
||||
}
|
||||
val newSelection = if (selection.collapsed) {
|
||||
@ -120,7 +120,7 @@ fun TextFormattingBar(
|
||||
it.text.substring(
|
||||
selection.start,
|
||||
selection.end,
|
||||
)
|
||||
),
|
||||
)
|
||||
}
|
||||
append("*")
|
||||
@ -128,7 +128,7 @@ fun TextFormattingBar(
|
||||
it.text.substring(
|
||||
selection.end,
|
||||
it.text.length,
|
||||
)
|
||||
),
|
||||
)
|
||||
}
|
||||
val newSelection = if (selection.collapsed) {
|
||||
@ -168,7 +168,7 @@ fun TextFormattingBar(
|
||||
it.text.substring(
|
||||
selection.start,
|
||||
selection.end,
|
||||
)
|
||||
),
|
||||
)
|
||||
}
|
||||
append("~~")
|
||||
@ -176,7 +176,7 @@ fun TextFormattingBar(
|
||||
it.text.substring(
|
||||
selection.end,
|
||||
it.text.length,
|
||||
)
|
||||
),
|
||||
)
|
||||
}
|
||||
val newSelection = if (selection.collapsed) {
|
||||
@ -232,7 +232,7 @@ fun TextFormattingBar(
|
||||
it.text.substring(
|
||||
selection.start,
|
||||
selection.end,
|
||||
)
|
||||
),
|
||||
)
|
||||
}
|
||||
append("](")
|
||||
@ -242,7 +242,7 @@ fun TextFormattingBar(
|
||||
it.text.substring(
|
||||
selection.end,
|
||||
it.text.length,
|
||||
)
|
||||
),
|
||||
)
|
||||
}
|
||||
val newSelection = if (selection.collapsed) {
|
||||
@ -282,7 +282,7 @@ fun TextFormattingBar(
|
||||
it.text.substring(
|
||||
selection.start,
|
||||
selection.end,
|
||||
)
|
||||
),
|
||||
)
|
||||
}
|
||||
append("`")
|
||||
@ -290,7 +290,7 @@ fun TextFormattingBar(
|
||||
it.text.substring(
|
||||
selection.end,
|
||||
it.text.length,
|
||||
)
|
||||
),
|
||||
)
|
||||
}
|
||||
val newSelection = if (selection.collapsed) {
|
||||
@ -327,7 +327,7 @@ fun TextFormattingBar(
|
||||
it.text.substring(
|
||||
selection.end,
|
||||
it.text.length,
|
||||
)
|
||||
),
|
||||
)
|
||||
}
|
||||
val newSelection = TextRange(index = selection.start + 3)
|
||||
@ -357,7 +357,7 @@ fun TextFormattingBar(
|
||||
it.text.substring(
|
||||
selection.end,
|
||||
it.text.length,
|
||||
)
|
||||
),
|
||||
)
|
||||
}
|
||||
val newSelection = TextRange(index = selection.start + 3)
|
||||
@ -387,7 +387,7 @@ fun TextFormattingBar(
|
||||
it.text.substring(
|
||||
selection.end,
|
||||
it.text.length,
|
||||
)
|
||||
),
|
||||
)
|
||||
}
|
||||
val newSelection = TextRange(index = selection.start + 4)
|
||||
|
@ -86,7 +86,7 @@ fun UserHeader(
|
||||
Row(
|
||||
modifier = Modifier.fillMaxWidth().padding(Spacing.s).align(Alignment.Center),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.spacedBy(Spacing.m)
|
||||
horizontalArrangement = Arrangement.spacedBy(Spacing.m),
|
||||
) {
|
||||
// avatar
|
||||
val userAvatar = user.avatar.orEmpty()
|
||||
@ -142,7 +142,7 @@ fun UserHeader(
|
||||
Icon(
|
||||
modifier = Modifier.size(iconSize),
|
||||
imageVector = Icons.AutoMirrored.Default.Article,
|
||||
contentDescription = null
|
||||
contentDescription = null,
|
||||
)
|
||||
Text(
|
||||
text = postScore.getPrettyNumber(
|
||||
@ -160,7 +160,7 @@ fun UserHeader(
|
||||
Icon(
|
||||
modifier = Modifier.size(iconSize),
|
||||
imageVector = Icons.AutoMirrored.Default.Reply,
|
||||
contentDescription = null
|
||||
contentDescription = null,
|
||||
)
|
||||
Text(
|
||||
text = commentScore.getPrettyNumber(
|
||||
@ -179,7 +179,7 @@ fun UserHeader(
|
||||
Icon(
|
||||
modifier = Modifier.size(iconSize),
|
||||
imageVector = Icons.Default.Cake,
|
||||
contentDescription = null
|
||||
contentDescription = null,
|
||||
)
|
||||
Text(
|
||||
text = user.accountAge.prettifyDate(),
|
||||
|
@ -9,4 +9,4 @@ actual fun getFabNestedScrollConnection(): FabNestedScrollConnection =
|
||||
|
||||
object LemmyUiDiHelper : KoinComponent {
|
||||
val fabNestedScrollConnection: FabNestedScrollConnection by inject()
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ kotlin {
|
||||
listOf(
|
||||
iosX64(),
|
||||
iosArm64(),
|
||||
iosSimulatorArm64()
|
||||
iosSimulatorArm64(),
|
||||
).forEach {
|
||||
it.binaries.framework {
|
||||
baseName = "modals"
|
||||
|
@ -63,7 +63,7 @@ class AppIconBottomSheet : Screen {
|
||||
onTap = {
|
||||
navigationCoordinator.hideBottomSheet()
|
||||
notificationCenter.send(
|
||||
NotificationCenterEvent.AppIconVariantSelected(value.toInt())
|
||||
NotificationCenterEvent.AppIconVariantSelected(value.toInt()),
|
||||
)
|
||||
},
|
||||
)
|
||||
@ -72,4 +72,3 @@ class AppIconBottomSheet : Screen {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ class BarThemeBottomSheet : Screen {
|
||||
),
|
||||
verticalArrangement = Arrangement.spacedBy(Spacing.s),
|
||||
) {
|
||||
BottomSheetHeader(LocalXmlStrings.current.settingsBarTheme,)
|
||||
BottomSheetHeader(LocalXmlStrings.current.settingsBarTheme)
|
||||
val values = listOf(
|
||||
UiBarTheme.Transparent,
|
||||
UiBarTheme.Opaque,
|
||||
@ -62,7 +62,7 @@ class BarThemeBottomSheet : Screen {
|
||||
.onClick(
|
||||
onClick = {
|
||||
notificationCenter.send(
|
||||
NotificationCenterEvent.ChangeSystemBarTheme(value)
|
||||
NotificationCenterEvent.ChangeSystemBarTheme(value),
|
||||
)
|
||||
navigationCoordinator.hideBottomSheet()
|
||||
},
|
||||
|
@ -101,16 +101,16 @@ class BlockBottomSheet(
|
||||
onClick = {
|
||||
val event = when (value.first) {
|
||||
BlockActionType.Community -> NotificationCenterEvent.BlockActionSelected(
|
||||
communityId = value.second
|
||||
communityId = value.second,
|
||||
)
|
||||
|
||||
BlockActionType.Instance ->
|
||||
NotificationCenterEvent.BlockActionSelected(
|
||||
instanceId = value.second
|
||||
instanceId = value.second,
|
||||
)
|
||||
|
||||
BlockActionType.User -> NotificationCenterEvent.BlockActionSelected(
|
||||
userId = value.second
|
||||
userId = value.second,
|
||||
)
|
||||
}
|
||||
notificationCenter.send(event)
|
||||
|
@ -59,7 +59,7 @@ class DurationBottomSheet(
|
||||
),
|
||||
verticalArrangement = Arrangement.spacedBy(Spacing.s),
|
||||
) {
|
||||
val title = when (type) {
|
||||
val title = when (type) {
|
||||
DurationBottomSheetType.ZOMBIE_MODE_INTERVAL -> LocalXmlStrings.current.settingsZombieModeInterval
|
||||
DurationBottomSheetType.INBOX_CHECK_PERIOD -> LocalXmlStrings.current.settingsInboxBackgroundCheckPeriod
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ fun EditFormattedInfoDialog(
|
||||
Spacer(modifier = Modifier.height(Spacing.s))
|
||||
|
||||
Column(
|
||||
verticalArrangement = Arrangement.spacedBy(Spacing.xs)
|
||||
verticalArrangement = Arrangement.spacedBy(Spacing.xs),
|
||||
) {
|
||||
SectionSelector(
|
||||
titles = listOf(
|
||||
@ -96,7 +96,7 @@ fun EditFormattedInfoDialog(
|
||||
else -> CreatePostSection.Edit
|
||||
}
|
||||
currentSection = section
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
if (currentSection == CreatePostSection.Edit) {
|
||||
@ -141,7 +141,7 @@ fun EditFormattedInfoDialog(
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.height(400.dp)
|
||||
.fillMaxWidth()
|
||||
.fillMaxWidth(),
|
||||
) {
|
||||
PostCardBody(
|
||||
modifier = Modifier
|
||||
|
@ -57,7 +57,7 @@ class InboxTypeSheet : Screen {
|
||||
.onClick(
|
||||
onClick = {
|
||||
notificationCenter.send(
|
||||
NotificationCenterEvent.ChangeInboxType(true)
|
||||
NotificationCenterEvent.ChangeInboxType(true),
|
||||
)
|
||||
navigationCoordinator.hideBottomSheet()
|
||||
},
|
||||
@ -79,7 +79,7 @@ class InboxTypeSheet : Screen {
|
||||
).onClick(
|
||||
onClick = {
|
||||
notificationCenter.send(
|
||||
NotificationCenterEvent.ChangeInboxType(false)
|
||||
NotificationCenterEvent.ChangeInboxType(false),
|
||||
)
|
||||
navigationCoordinator.hideBottomSheet()
|
||||
},
|
||||
|
@ -100,7 +100,7 @@ class LanguageBottomSheet : Screen {
|
||||
.onClick(
|
||||
onClick = {
|
||||
notificationCenter.send(
|
||||
NotificationCenterEvent.ChangeLanguage(value)
|
||||
NotificationCenterEvent.ChangeLanguage(value),
|
||||
)
|
||||
navigationCoordinator.hideBottomSheet()
|
||||
},
|
||||
|
@ -57,7 +57,7 @@ class LikedTypeSheet : Screen {
|
||||
.onClick(
|
||||
onClick = {
|
||||
notificationCenter.send(
|
||||
NotificationCenterEvent.ChangedLikedType(true)
|
||||
NotificationCenterEvent.ChangedLikedType(true),
|
||||
)
|
||||
navigationCoordinator.hideBottomSheet()
|
||||
},
|
||||
@ -79,7 +79,7 @@ class LikedTypeSheet : Screen {
|
||||
).onClick(
|
||||
onClick = {
|
||||
notificationCenter.send(
|
||||
NotificationCenterEvent.ChangedLikedType(false)
|
||||
NotificationCenterEvent.ChangedLikedType(false),
|
||||
)
|
||||
navigationCoordinator.hideBottomSheet()
|
||||
},
|
||||
|
@ -76,7 +76,7 @@ class ListingTypeBottomSheet(
|
||||
NotificationCenterEvent.ChangeFeedType(
|
||||
value = value,
|
||||
screenKey = screenKey,
|
||||
)
|
||||
),
|
||||
)
|
||||
navigationCoordinator.hideBottomSheet()
|
||||
},
|
||||
|
@ -63,7 +63,7 @@ class ModeratorZoneBottomSheet : Screen {
|
||||
notificationCenter.send(
|
||||
NotificationCenterEvent.ModeratorZoneActionSelected(
|
||||
value.toInt(),
|
||||
)
|
||||
),
|
||||
)
|
||||
},
|
||||
)
|
||||
|
@ -34,8 +34,8 @@ class PostBodyMaxLinesBottomSheet(
|
||||
10,
|
||||
30,
|
||||
50,
|
||||
-1,// custom number
|
||||
null,// unlimited
|
||||
-1, // custom number
|
||||
null, // unlimited
|
||||
),
|
||||
) : Screen {
|
||||
|
||||
@ -57,7 +57,7 @@ class PostBodyMaxLinesBottomSheet(
|
||||
),
|
||||
verticalArrangement = Arrangement.spacedBy(Spacing.s),
|
||||
) {
|
||||
BottomSheetHeader(LocalXmlStrings.current.settingsPostBodyMaxLines)
|
||||
BottomSheetHeader(LocalXmlStrings.current.settingsPostBodyMaxLines)
|
||||
Column(
|
||||
modifier = Modifier.fillMaxWidth().verticalScroll(rememberScrollState()),
|
||||
verticalArrangement = Arrangement.spacedBy(Spacing.xxs),
|
||||
@ -76,7 +76,7 @@ class PostBodyMaxLinesBottomSheet(
|
||||
customDialogOpened = true
|
||||
} else {
|
||||
notificationCenter.send(
|
||||
NotificationCenterEvent.ChangePostBodyMaxLines(value)
|
||||
NotificationCenterEvent.ChangePostBodyMaxLines(value),
|
||||
)
|
||||
navigationCoordinator.hideBottomSheet()
|
||||
}
|
||||
@ -110,7 +110,7 @@ class PostBodyMaxLinesBottomSheet(
|
||||
onSubmit = { value ->
|
||||
notificationCenter.send(NotificationCenterEvent.ChangePostBodyMaxLines(value))
|
||||
navigationCoordinator.hideBottomSheet()
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ class PostLayoutBottomSheet : Screen {
|
||||
.onClick(
|
||||
onClick = {
|
||||
notificationCenter.send(
|
||||
NotificationCenterEvent.ChangePostLayout(value)
|
||||
NotificationCenterEvent.ChangePostLayout(value),
|
||||
)
|
||||
navigationCoordinator.hideBottomSheet()
|
||||
},
|
||||
|
@ -57,7 +57,7 @@ class ReportListTypeSheet : Screen {
|
||||
.onClick(
|
||||
onClick = {
|
||||
notificationCenter.send(
|
||||
NotificationCenterEvent.ChangeReportListType(true)
|
||||
NotificationCenterEvent.ChangeReportListType(true),
|
||||
)
|
||||
navigationCoordinator.hideBottomSheet()
|
||||
},
|
||||
@ -79,7 +79,7 @@ class ReportListTypeSheet : Screen {
|
||||
).onClick(
|
||||
onClick = {
|
||||
notificationCenter.send(
|
||||
NotificationCenterEvent.ChangeReportListType(false)
|
||||
NotificationCenterEvent.ChangeReportListType(false),
|
||||
)
|
||||
navigationCoordinator.hideBottomSheet()
|
||||
},
|
||||
|
@ -75,7 +75,7 @@ class ResultTypeBottomSheet(
|
||||
NotificationCenterEvent.ChangeSearchResultType(
|
||||
value = value,
|
||||
screenKey = screenKey,
|
||||
)
|
||||
),
|
||||
)
|
||||
navigationCoordinator.hideBottomSheet()
|
||||
},
|
||||
|
@ -50,7 +50,7 @@ fun SelectLanguageDialog(
|
||||
)
|
||||
Spacer(modifier = Modifier.height(Spacing.xs))
|
||||
LazyColumn(
|
||||
modifier = Modifier.fillMaxHeight(0.6f)
|
||||
modifier = Modifier.fillMaxHeight(0.6f),
|
||||
) {
|
||||
items(items = languages, key = { it.id }) { lang ->
|
||||
LanguageItem(
|
||||
|
@ -59,14 +59,14 @@ class SliderBottomSheet(
|
||||
valueRange = min.rangeTo(max),
|
||||
onValueChange = {
|
||||
value = it
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
Spacer(modifier = Modifier.height(Spacing.s))
|
||||
Button(
|
||||
onClick = {
|
||||
notificationCenter.send(
|
||||
NotificationCenterEvent.ChangeZombieScrollAmount(value)
|
||||
NotificationCenterEvent.ChangeZombieScrollAmount(value),
|
||||
)
|
||||
navigationCoordinator.hideBottomSheet()
|
||||
},
|
||||
|
@ -68,7 +68,7 @@ class SortBottomSheet(
|
||||
comments = comments,
|
||||
defaultForCommunity = defaultForCommunity,
|
||||
screenKey = screenKey,
|
||||
)
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
@ -109,7 +109,7 @@ internal class SortBottomSheetMain(
|
||||
comments = comments,
|
||||
defaultForCommunity = defaultForCommunity,
|
||||
screenKey = screenKey,
|
||||
)
|
||||
),
|
||||
)
|
||||
} else {
|
||||
val event = if (comments) {
|
||||
@ -183,7 +183,7 @@ internal class SortBottomSheetTop(
|
||||
) {
|
||||
BottomSheetHeader(SortType.Top.Generic.toReadableName() + "…")
|
||||
Row(
|
||||
modifier = Modifier.padding(start = Spacing.xxs)
|
||||
modifier = Modifier.padding(start = Spacing.xxs),
|
||||
) {
|
||||
Icon(
|
||||
modifier = Modifier
|
||||
|
@ -70,7 +70,7 @@ class ThemeBottomSheet : Screen {
|
||||
.onClick(
|
||||
onClick = {
|
||||
notificationCenter.send(
|
||||
NotificationCenterEvent.ChangeTheme(value)
|
||||
NotificationCenterEvent.ChangeTheme(value),
|
||||
)
|
||||
navigationCoordinator.hideBottomSheet()
|
||||
},
|
||||
|
@ -32,7 +32,7 @@ class UrlOpeningModeBottomSheet(
|
||||
private val values: List<UrlOpeningMode> = listOf(
|
||||
UrlOpeningMode.Internal,
|
||||
UrlOpeningMode.External,
|
||||
)
|
||||
),
|
||||
) : Screen {
|
||||
|
||||
@Composable
|
||||
|
@ -69,7 +69,7 @@ class VoteFormatBottomSheet : Screen {
|
||||
.onClick(
|
||||
onClick = {
|
||||
notificationCenter.send(
|
||||
NotificationCenterEvent.ChangeVoteFormat(value)
|
||||
NotificationCenterEvent.ChangeVoteFormat(value),
|
||||
)
|
||||
navigationCoordinator.hideBottomSheet()
|
||||
},
|
||||
|
@ -23,7 +23,7 @@ kotlin {
|
||||
listOf(
|
||||
iosX64(),
|
||||
iosArm64(),
|
||||
iosSimulatorArm64()
|
||||
iosSimulatorArm64(),
|
||||
).forEach {
|
||||
it.binaries.framework {
|
||||
baseName = "l10n"
|
||||
|
@ -19,7 +19,7 @@ kotlin {
|
||||
listOf(
|
||||
iosX64(),
|
||||
iosArm64(),
|
||||
iosSimulatorArm64()
|
||||
iosSimulatorArm64(),
|
||||
).forEach {
|
||||
it.binaries.framework {
|
||||
baseName = "markdown"
|
||||
|
@ -82,7 +82,7 @@ internal fun CustomMarkdownImage(
|
||||
initialValue = 0f,
|
||||
targetValue = 1f,
|
||||
animationSpec = InfiniteRepeatableSpec(
|
||||
animation = tween(LOADING_ANIMATION_DURATION)
|
||||
animation = tween(LOADING_ANIMATION_DURATION),
|
||||
),
|
||||
)
|
||||
res
|
||||
|
@ -107,7 +107,7 @@ fun CustomMarkdownWrapper(
|
||||
else -> {
|
||||
MarkdownParagraph(
|
||||
content = model.content,
|
||||
node = model.node
|
||||
node = model.node,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,6 @@ private fun String.removeEntities(): String =
|
||||
.replace(" ", " ")
|
||||
.replace("…", "…")
|
||||
|
||||
|
||||
private fun String.spoilerFixUp(): String = run {
|
||||
val finalLines = mutableListOf<String>()
|
||||
var isInsideSpoiler = false
|
||||
|
@ -19,7 +19,7 @@ kotlin {
|
||||
listOf(
|
||||
iosX64(),
|
||||
iosArm64(),
|
||||
iosSimulatorArm64()
|
||||
iosSimulatorArm64(),
|
||||
).forEach {
|
||||
it.binaries.framework {
|
||||
baseName = "navigation"
|
||||
|
@ -4,7 +4,6 @@ import com.github.diegoberaldin.raccoonforlemmy.core.navigation.DrawerCoordinato
|
||||
import com.github.diegoberaldin.raccoonforlemmy.core.navigation.NavigationCoordinator
|
||||
import org.koin.java.KoinJavaComponent.inject
|
||||
|
||||
|
||||
actual fun getNavigationCoordinator(): NavigationCoordinator {
|
||||
val res: NavigationCoordinator by inject(NavigationCoordinator::class.java)
|
||||
return res
|
||||
|
@ -64,4 +64,4 @@ class DefaultDrawerCoordinatorTest {
|
||||
assertEquals(DrawerEvent.OpenCommunity(community), evt)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -205,7 +205,6 @@ class DefaultNavigationCoordinatorTest {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
fun whenShowBottomSheet_thenInteractionsAreAsExpected() = runTest {
|
||||
val screen = object : Screen {
|
||||
@ -282,4 +281,4 @@ class DefaultNavigationCoordinatorTest {
|
||||
assertEquals(message, item)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,4 +13,4 @@ object CoreNavigationHelper : KoinComponent {
|
||||
|
||||
val navigationCoordinator: NavigationCoordinator by inject()
|
||||
val drawerCoordinator: DrawerCoordinator by inject()
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ kotlin {
|
||||
listOf(
|
||||
iosX64(),
|
||||
iosArm64(),
|
||||
iosSimulatorArm64()
|
||||
iosSimulatorArm64(),
|
||||
).forEach {
|
||||
it.binaries.framework {
|
||||
baseName = "notifications"
|
||||
|
@ -21,7 +21,6 @@ class DefaultNotificationCenterTest {
|
||||
sut.send(NotificationCenterEvent.Logout)
|
||||
}
|
||||
|
||||
|
||||
sut.subscribe(NotificationCenterEvent.Logout::class).test {
|
||||
val evt = awaitItem()
|
||||
assertEquals(NotificationCenterEvent.Logout, evt)
|
||||
@ -67,4 +66,4 @@ class DefaultNotificationCenterTest {
|
||||
expectNoEvents()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -59,4 +59,3 @@ private fun <T : NotificationCenterEvent> isReplayable(clazz: KClass<T>): Boolea
|
||||
else -> false
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ sealed interface NotificationCenterEvent {
|
||||
data class ChangeSortType(
|
||||
val value: SortType,
|
||||
val defaultForCommunity: Boolean,
|
||||
val screenKey: String?
|
||||
val screenKey: String?,
|
||||
) :
|
||||
NotificationCenterEvent
|
||||
|
||||
|
@ -3,4 +3,3 @@ package com.github.diegoberaldin.raccoonforlemmy.core.notifications.di
|
||||
import com.github.diegoberaldin.raccoonforlemmy.core.notifications.NotificationCenter
|
||||
|
||||
expect fun getNotificationCenter(): NotificationCenter
|
||||
|
||||
|
@ -8,4 +8,4 @@ actual fun getNotificationCenter(): NotificationCenter = NotificationDiHelper.no
|
||||
|
||||
internal object NotificationDiHelper : KoinComponent {
|
||||
val notificationCenter: NotificationCenter by inject()
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ kotlin {
|
||||
listOf(
|
||||
iosX64(),
|
||||
iosArm64(),
|
||||
iosSimulatorArm64()
|
||||
iosSimulatorArm64(),
|
||||
).forEach {
|
||||
it.binaries.framework {
|
||||
baseName = "persistence"
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user