Update dependencies

This commit is contained in:
Syer10
2023-05-07 20:58:57 -04:00
parent 58fefbcee7
commit 42ef47dbb1
12 changed files with 58 additions and 146 deletions

View File

@@ -114,7 +114,11 @@ android {
}
}
packagingOptions {
buildFeatures {
buildConfig = true
}
packaging {
resources.excludes.addAll(listOf(
"META-INF/DEPENDENCIES",
"LICENSE.txt",

View File

@@ -135,7 +135,7 @@ subprojects {
plugins.withType<JacocoPlugin> {
configure<JacocoPluginExtension> {
toolVersion = "0.8.7"
toolVersion = "0.8.10"
}
}
plugins.withType<ComposePlugin> {

View File

@@ -9,6 +9,7 @@ package ca.gosyer.jui.core.lang
import com.soywiz.kds.PriorityQueue
import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.DelicateCoroutinesApi
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.async
import kotlinx.coroutines.channels.Channel
@@ -28,11 +29,12 @@ internal open class ProcessChannel<T>(
internal val inChannel: Channel<T>,
internal val outChannel: Channel<T>,
) : Channel<T> {
@ExperimentalCoroutinesApi
@DelicateCoroutinesApi
override val isClosedForReceive: Boolean
get() = outChannel.isClosedForReceive
@ExperimentalCoroutinesApi
@DelicateCoroutinesApi
override val isClosedForSend: Boolean
get() = inChannel.isClosedForSend
@@ -97,6 +99,7 @@ internal open class ProcessChannel<T>(
}
}
@OptIn(DelicateCoroutinesApi::class)
@ExperimentalCoroutinesApi
internal class PriorityChannelImpl<T>(
private val maxCapacity: Int,

View File

@@ -1,32 +1,32 @@
[versions]
# Kotlin
kotlin = "1.8.10"
coroutines = "1.6.4"
kotlin = "1.8.20"
coroutines = "1.7.0"
# Serialization
json = "1.5.0"
# Compose
composeGradle = "1.3.1"
composeCompiler = "1.4.2"
composeAndroidRuntime = "1.3.3"
composeAndroidFoundation = "1.3.1"
composeAndroidUI = "1.3.3"
composeAndroidAnimation = "1.3.3"
composeAndroidMaterial = "1.3.1"
composeGradle = "1.4.0"
composeCompiler = "1.4.5"
composeAndroidRuntime = "1.4.3"
composeAndroidFoundation = "1.4.3"
composeAndroidUI = "1.4.3"
composeAndroidAnimation = "1.4.3"
composeAndroidMaterial = "1.4.3"
# Compose Libraries
voyager = "1.0.0-rc07"
accompanist = "0.25.2"
googleAccompanist = "0.28.0"
imageloader = "1.2.8"
materialDialogs = "0.9.2"
voyager = "1.0.0-rc06"
accompanist = "0.30.1"
googleAccompanist = "0.30.1"
imageloader = "1.4.0"
materialDialogs = "0.9.3"
# Android
androidGradle = "7.4.2"
androidGradle = "8.0.1"
core = "1.9.0"
appCompat = "1.7.0-alpha02"
activityCompose = "1.7.0"
activityCompose = "1.7.1"
work = "2.8.1"
# Android Lifecycle
@@ -36,14 +36,14 @@ lifecycle = "2.6.1"
darklaf = "3.0.2"
# Ksp
ksp = "1.8.10-1.0.9"
ksp = "1.8.20-1.0.11"
# Dependency Injection
kotlinInject = "0.6.1"
# Network
ktor = "2.2.4"
ktorfit = "1.0.1"
ktor = "2.3.0"
ktorfit = "1.2.0"
ktorfitCompiler = "1.0.0"
# Logging
@@ -59,17 +59,17 @@ appDirs = "1.2.1"
multiplatformSettings = "1.0.0-alpha01"
# Utility
desugarJdkLibs = "2.0.2"
aboutLibraries = "10.6.1"
desugarJdkLibs = "2.0.3"
aboutLibraries = "10.6.3"
dateTime = "0.4.0"
immutableCollections = "0.3.5"
kds = "3.4.0"
# Localization
moko = "0.21.1"
moko = "0.22.0"
# BuildConfigs
buildconfig = "3.1.0"
buildconfig = "4.0.4"
buildkonfig = "0.13.3"
# Linter
@@ -103,10 +103,10 @@ compose-ui-test-junit4 = { module = "androidx.compose.ui:ui-test-junit4", versio
compose-material-core = { module = "androidx.compose.material:material", version.ref = "composeAndroidMaterial" }
compose-material-icons = { module = "androidx.compose.material:material-icons-extended", version.ref = "composeAndroidMaterial" }
# Compose UI
voyager-core = { module = "ca.gosyer:voyager-core", version.ref = "voyager" }
voyager-navigation = { module = "ca.gosyer:voyager-navigator", version.ref = "voyager" }
voyager-transitions = { module = "ca.gosyer:voyager-transitions", version.ref = "voyager" }
voyager-androidx = { module = "ca.gosyer:voyager-androidx", version.ref = "voyager" }
voyager-core = { module = "cafe.adriel.voyager:voyager-core", version.ref = "voyager" }
voyager-navigation = { module = "cafe.adriel.voyager:voyager-navigator", version.ref = "voyager" }
voyager-transitions = { module = "cafe.adriel.voyager:voyager-transitions", version.ref = "voyager" }
voyager-androidx = { module = "cafe.adriel.voyager:voyager-androidx", version.ref = "voyager" }
accompanist-pager = { module = "ca.gosyer:accompanist-pager", version.ref = "accompanist" }
accompanist-pagerIndicators = { module = "ca.gosyer:accompanist-pager-indicators", version.ref = "accompanist" }
accompanist-flowLayout = { module = "ca.gosyer:accompanist-flowlayout", version.ref = "accompanist" }
@@ -141,7 +141,7 @@ ktor-serialization-json = { module = "io.ktor:ktor-serialization-kotlinx-json",
ktor-logging = { module = "io.ktor:ktor-client-logging", version.ref = "ktor" }
ktor-websockets = { module = "io.ktor:ktor-client-websockets", version.ref = "ktor" }
ktor-auth = { module = "io.ktor:ktor-client-auth", version.ref = "ktor" }
ktorfit-lib = { module = "de.jensklingenberg.ktorfit:ktorfit-lib", version.ref = "ktorfit" }
ktorfit-lib = { module = "de.jensklingenberg.ktorfit:ktorfit-lib-light", version.ref = "ktorfit" }
ktorfit-ksp = { module = "de.jensklingenberg.ktorfit:ktorfit-ksp", version.ref = "ktorfit" }
# Logging
@@ -221,4 +221,4 @@ compose-android = [
"compose-ui-util",
"compose-material-core",
"compose-material-icons"
]
]

Binary file not shown.

View File

@@ -1,5 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

12
gradlew vendored
View File

@@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
@@ -80,10 +80,10 @@ do
esac
done
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
APP_NAME="Gradle"
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
@@ -143,12 +143,16 @@ fi
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac

1
gradlew.bat vendored
View File

@@ -26,6 +26,7 @@ if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

View File

@@ -21,6 +21,7 @@ import ca.gosyer.jui.ui.base.model.StableHolder
import ca.gosyer.jui.ui.sources.browse.SourceScreen
import ca.gosyer.jui.ui.sources.globalsearch.GlobalSearchScreen
import ca.gosyer.jui.ui.sources.home.SourceHomeScreen
import cafe.adriel.voyager.core.annotation.InternalVoyagerApi
import cafe.adriel.voyager.core.lifecycle.DisposableEffectIgnoringConfiguration
import cafe.adriel.voyager.core.screen.Screen
import cafe.adriel.voyager.core.stack.StackEvent
@@ -153,6 +154,7 @@ class SourcesNavigator internal constructor(
navigator.saveableState(key, screen, content)
}
@OptIn(InternalVoyagerApi::class)
fun dispose(screen: Screen) {
navigator.dispose(screen)
}

View File

@@ -99,7 +99,7 @@ fun ImageLoaderImage(
error.value = state.error
ImageLoaderImageState.Failure
}
ImageRequestState.Loading -> {
is ImageRequestState.Loading -> {
progress.value = 0.0F
ImageLoaderImageState.Loading
}

View File

@@ -263,7 +263,7 @@ private fun lazyListSnapLayoutInfoProvider(
return lowerBoundOffset.rangeTo(upperBoundOffset)
}
override fun Density.snapStepSize(): Float = with(layoutInfo) {
override fun Density.calculateSnapStepSize(): Float = with(layoutInfo) {
if (visibleItemsInfo.isNotEmpty()) {
visibleItemsInfo.fastSumBy { it.size } / visibleItemsInfo.size.toFloat()
} else {

View File

@@ -7,7 +7,6 @@
package ca.gosyer.jui.uicore.components
import androidx.compose.foundation.ScrollState
import androidx.compose.foundation.gestures.scrollBy
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.padding
@@ -16,17 +15,10 @@ import androidx.compose.foundation.lazy.grid.GridCells
import androidx.compose.foundation.lazy.grid.LazyGridState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.ProvidableCompositionLocal
import androidx.compose.runtime.derivedStateOf
import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.unit.Density
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import kotlin.math.abs
actual typealias ScrollbarAdapter = androidx.compose.foundation.ScrollbarAdapter
actual typealias ScrollbarAdapter = androidx.compose.foundation.v2.ScrollbarAdapter
actual typealias ScrollbarStyle = androidx.compose.foundation.ScrollbarStyle
@@ -83,10 +75,7 @@ internal actual fun realRememberVerticalScrollbarAdapter(
gridCells: GridCells,
arrangement: Arrangement.Vertical?,
): ScrollbarAdapter {
val density = LocalDensity.current
return remember(scrollState, gridCells, density, arrangement) {
GridScrollbarAdapter(scrollState, gridCells, density, arrangement?.spacing ?: Dp.Hairline)
}
return androidx.compose.foundation.rememberScrollbarAdapter(scrollState)
}
@Composable
@@ -95,99 +84,7 @@ internal actual fun realRememberHorizontalScrollbarAdapter(
gridCells: GridCells,
arrangement: Arrangement.Horizontal?,
): ScrollbarAdapter {
val density = LocalDensity.current
return remember(scrollState, gridCells, density, arrangement) {
GridScrollbarAdapter(scrollState, gridCells, density, arrangement?.spacing ?: Dp.Hairline)
}
}
// TODO deal with item spacing
class GridScrollbarAdapter(
private val scrollState: LazyGridState,
private val gridCells: GridCells,
private val density: Density,
private val spacing: Dp,
) : ScrollbarAdapter {
override val scrollOffset: Float
get() = (scrollState.firstVisibleItemIndex / itemsPerRow).coerceAtLeast(0) * averageItemSize + scrollState.firstVisibleItemScrollOffset
override fun maxScrollOffset(containerSize: Int): Float {
val size = with(gridCells) {
with(density) {
calculateCrossAxisCellSizes(containerSize, spacing.roundToPx()).size
}
}
return (averageItemSize * (itemCount / size) - containerSize).coerceAtLeast(0f)
}
override suspend fun scrollTo(containerSize: Int, scrollOffset: Float) {
val distance = scrollOffset - this@GridScrollbarAdapter.scrollOffset
// if we scroll less than containerSize we need to use scrollBy function to avoid
// undesirable scroll jumps (when an item size is different)
//
// if we scroll more than containerSize we should immediately jump to this position
// without recreating all items between the current and the new position
if (abs(distance) <= containerSize) {
scrollState.scrollBy(distance)
} else {
snapTo(containerSize, scrollOffset)
}
}
private suspend fun snapTo(containerSize: Int, scrollOffset: Float) {
// In case of very big values, we can catch an overflow, so convert values to double and
// coerce them
// val averageItemSize = 26.000002f
// val scrollOffsetCoerced = 2.54490608E8.toFloat()
// val index = (scrollOffsetCoerced / averageItemSize).toInt() // 9788100
// val offset = (scrollOffsetCoerced - index * averageItemSize) // -16.0
// println(offset)
val maximumValue = maxScrollOffset(containerSize).toDouble()
val scrollOffsetCoerced = scrollOffset.toDouble().coerceIn(0.0, maximumValue)
val averageItemSize = averageItemSize.toDouble()
val index = (scrollOffsetCoerced / averageItemSize)
.toInt()
.div(
with(gridCells) {
with(density) {
calculateCrossAxisCellSizes(containerSize, spacing.roundToPx()).size
}
},
)
.coerceAtLeast(0)
.coerceAtMost(itemCount - 1)
val offset = (scrollOffsetCoerced - index * averageItemSize)
.toInt()
.coerceAtLeast(0)
scrollState.scrollToItem(index = index, scrollOffset = offset)
}
private val itemCount get() = scrollState.layoutInfo.totalItemsCount
private val averageItemSize: Float by derivedStateOf {
scrollState
.layoutInfo
.visibleItemsInfo
.asSequence()
.map { it.size.height }
.average()
.toFloat()
}
private val itemsPerRow
get() = with(gridCells) {
with(density) {
calculateCrossAxisCellSizes(
(scrollState.layoutInfo.viewportEndOffset - scrollState.layoutInfo.viewportStartOffset),
spacing.roundToPx(),
).size
}
}
return androidx.compose.foundation.rememberScrollbarAdapter(scrollState)
}
actual fun Modifier.scrollbarPadding() = padding(horizontal = 4.dp, vertical = 8.dp)