mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2025-10-06 07:39:27 +00:00
Compare commits
18 Commits
Author | SHA1 | Date | |
---|---|---|---|
e20ab89688 | |||
e557ba8184 | |||
8540e21d5a | |||
76c04a8506 | |||
128632770e | |||
31e0800e81 | |||
00ca96eec8 | |||
077ef2c639 | |||
e3ea7be0e7 | |||
05fd1c2b14 | |||
affcffe270 | |||
62930231e4 | |||
ad651631ec | |||
cf1c8f13db | |||
9acc69b897 | |||
9bc7cbdb50 | |||
2ed8443e28 | |||
94f598c2b4 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -9,6 +9,7 @@ settings.xml
|
|||||||
.gradle/
|
.gradle/
|
||||||
build/
|
build/
|
||||||
out/
|
out/
|
||||||
|
bin/
|
||||||
|
|
||||||
secret.gradle
|
secret.gradle
|
||||||
local.properties
|
local.properties
|
||||||
|
16
CHANGELOG.md
16
CHANGELOG.md
@@ -1,5 +1,21 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 0.25.8
|
||||||
|
|
||||||
|
* `Pagination`:
|
||||||
|
* `Compose`:
|
||||||
|
* New function `rememberInfinityPagedComponentContext` to create `InfinityPagedComponentContext`
|
||||||
|
* New variants of `InfinityPagedComponent` component
|
||||||
|
|
||||||
|
## 0.25.7
|
||||||
|
|
||||||
|
* `Versions`:
|
||||||
|
* `Compose`: `1.8.0` -> `1.8.1`
|
||||||
|
* `Xerial SQLite`: `3.49.1.0` -> `3.50.1.0`
|
||||||
|
* `Okio`: `3.11.0` -> `3.12.0`
|
||||||
|
* `Android AppCompat`: `1.7.0` -> `1.7.1`
|
||||||
|
* `Android Fragment`: `1.8.6` -> `1.8.8`
|
||||||
|
|
||||||
## 0.25.6
|
## 0.25.6
|
||||||
|
|
||||||
* `Versions`:
|
* `Versions`:
|
||||||
|
17
build.gradle
17
build.gradle
@@ -19,15 +19,30 @@ buildscript {
|
|||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
alias(libs.plugins.versions)
|
alias(libs.plugins.versions)
|
||||||
|
alias(libs.plugins.nmcp.aggregation)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ((project.hasProperty('SONATYPE_USER') || System.getenv('SONATYPE_USER') != null) && (project.hasProperty('SONATYPE_PASSWORD') || System.getenv('SONATYPE_PASSWORD') != null)) {
|
||||||
|
nmcpAggregation {
|
||||||
|
centralPortal {
|
||||||
|
username = project.hasProperty('SONATYPE_USER') ? project.property('SONATYPE_USER') : System.getenv('SONATYPE_USER')
|
||||||
|
password = project.hasProperty('SONATYPE_PASSWORD') ? project.property('SONATYPE_PASSWORD') : System.getenv('SONATYPE_PASSWORD')
|
||||||
|
verificationTimeout = Duration.ofHours(4)
|
||||||
|
publishingType = "USER_MANAGED"
|
||||||
|
}
|
||||||
|
|
||||||
|
publishAllProjectsProbablyBreakingProjectIsolation()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
repositories {
|
repositories {
|
||||||
mavenLocal()
|
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
google()
|
google()
|
||||||
maven { url "https://maven.pkg.jetbrains.space/public/p/compose/dev" }
|
maven { url "https://maven.pkg.jetbrains.space/public/p/compose/dev" }
|
||||||
maven { url "https://nexus.inmo.dev/repository/maven-releases/" }
|
maven { url "https://nexus.inmo.dev/repository/maven-releases/" }
|
||||||
|
mavenLocal()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -30,3 +30,13 @@ allprojects {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tasks.register("getPublishableModules") {
|
||||||
|
doLast {
|
||||||
|
rootProject.subprojects.each { project ->
|
||||||
|
if (project.plugins.hasPlugin('maven-publish')) {
|
||||||
|
println(":${project.name}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -15,5 +15,5 @@ crypto_js_version=4.1.1
|
|||||||
# Project data
|
# Project data
|
||||||
|
|
||||||
group=dev.inmo
|
group=dev.inmo
|
||||||
version=0.25.6
|
version=0.25.8
|
||||||
android_code_version=296
|
android_code_version=298
|
||||||
|
@@ -8,11 +8,11 @@ kotlinx-browser = "0.3"
|
|||||||
|
|
||||||
kslog = "1.4.2"
|
kslog = "1.4.2"
|
||||||
|
|
||||||
jb-compose = "1.8.0"
|
jb-compose = "1.8.1"
|
||||||
jb-exposed = "0.61.0"
|
jb-exposed = "0.61.0"
|
||||||
jb-dokka = "2.0.0"
|
jb-dokka = "2.0.0"
|
||||||
|
|
||||||
sqlite = "3.49.1.0"
|
sqlite = "3.50.1.0"
|
||||||
|
|
||||||
korlibs = "5.4.0"
|
korlibs = "5.4.0"
|
||||||
uuid = "0.8.4"
|
uuid = "0.8.4"
|
||||||
@@ -23,20 +23,21 @@ gh-release = "2.5.2"
|
|||||||
|
|
||||||
koin = "4.0.4"
|
koin = "4.0.4"
|
||||||
|
|
||||||
okio = "3.11.0"
|
okio = "3.12.0"
|
||||||
|
|
||||||
ksp = "2.1.20-1.0.31"
|
ksp = "2.1.20-1.0.31"
|
||||||
kotlin-poet = "1.18.1"
|
kotlin-poet = "1.18.1"
|
||||||
|
|
||||||
versions = "0.51.0"
|
versions = "0.51.0"
|
||||||
|
nmcp = "0.1.5"
|
||||||
|
|
||||||
android-gradle = "8.9.+"
|
android-gradle = "8.9.+"
|
||||||
dexcount = "4.0.0"
|
dexcount = "4.0.0"
|
||||||
|
|
||||||
android-coreKtx = "1.16.0"
|
android-coreKtx = "1.16.0"
|
||||||
android-recyclerView = "1.4.0"
|
android-recyclerView = "1.4.0"
|
||||||
android-appCompat = "1.7.0"
|
android-appCompat = "1.7.1"
|
||||||
android-fragment = "1.8.6"
|
android-fragment = "1.8.8"
|
||||||
android-espresso = "3.6.1"
|
android-espresso = "3.6.1"
|
||||||
android-test = "1.2.1"
|
android-test = "1.2.1"
|
||||||
|
|
||||||
@@ -123,3 +124,4 @@ jb-compose = { id = "org.jetbrains.compose", version.ref = "jb-compose" }
|
|||||||
kt-jb-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kt" }
|
kt-jb-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kt" }
|
||||||
|
|
||||||
versions = { id = "com.github.ben-manes.versions", version.ref = "versions" }
|
versions = { id = "com.github.ben-manes.versions", version.ref = "versions" }
|
||||||
|
nmcp-aggregation = { id = "com.gradleup.nmcp.aggregation", version.ref = "nmcp" }
|
||||||
|
@@ -1,51 +1,4 @@
|
|||||||
import java.nio.charset.StandardCharsets
|
|
||||||
import java.net.http.HttpClient
|
|
||||||
import java.net.http.HttpRequest
|
|
||||||
import java.net.http.HttpResponse
|
|
||||||
|
|
||||||
apply plugin: 'maven-publish'
|
apply plugin: 'maven-publish'
|
||||||
// This script work based on https://ossrh-staging-api.central.sonatype.com/swagger-ui/#/default/manual_upload_repository
|
|
||||||
// and getting available open repos and just uploading them
|
|
||||||
if ((project.hasProperty('SONATYPE_USER') || System.getenv('SONATYPE_USER') != null) && (project.hasProperty('SONATYPE_PASSWORD') || System.getenv('SONATYPE_PASSWORD') != null)) {
|
|
||||||
def taskName = "uploadSonatypePublication"
|
|
||||||
if (rootProject.tasks.names.contains(taskName) == false) {
|
|
||||||
rootProject.tasks.register(taskName) {
|
|
||||||
doLast {
|
|
||||||
def username = project.hasProperty('SONATYPE_USER') ? project.property('SONATYPE_USER') : System.getenv('SONATYPE_USER')
|
|
||||||
def password = project.hasProperty('SONATYPE_PASSWORD') ? project.property('SONATYPE_PASSWORD') : System.getenv('SONATYPE_PASSWORD')
|
|
||||||
def bearer = Base64.getEncoder().encodeToString("$username:$password".getBytes(StandardCharsets.UTF_8))
|
|
||||||
|
|
||||||
def client = HttpClient.newHttpClient()
|
|
||||||
def request = HttpRequest.newBuilder()
|
|
||||||
.uri(URI.create("https://ossrh-staging-api.central.sonatype.com/manual/search/repositories?state=open"))
|
|
||||||
.GET()
|
|
||||||
.header("Content-Type", "application/json")
|
|
||||||
.header("Authorization", "Bearer $bearer")
|
|
||||||
.build()
|
|
||||||
|
|
||||||
def response = client.send(request, HttpResponse.BodyHandlers.ofString())
|
|
||||||
def keys = new ArrayList<String>()
|
|
||||||
response.body().findAll("\"key\"[\\s]*:[\\s]*\"[^\"]+\"").forEach {
|
|
||||||
def key = it.find("[^\"]+\"\$").find("[^\"]+")
|
|
||||||
keys.add(key)
|
|
||||||
}
|
|
||||||
keys.forEach {
|
|
||||||
println("Start uploading $it")
|
|
||||||
def uploadRequest = HttpRequest.newBuilder()
|
|
||||||
.uri(URI.create("https://ossrh-staging-api.central.sonatype.com/manual/upload/repository/$it?publishing_type=user_managed"))
|
|
||||||
.POST(HttpRequest.BodyPublishers.ofString(""))
|
|
||||||
.header("Content-Type", "application/json")
|
|
||||||
.header("Authorization", "Bearer $bearer")
|
|
||||||
.build()
|
|
||||||
def uploadResponse = client.send(uploadRequest, HttpResponse.BodyHandlers.ofString())
|
|
||||||
if (uploadResponse.statusCode() != 200) {
|
|
||||||
throw IllegalStateException("Faced error of uploading for repo with key $it. Response: $uploadResponse")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
task javadocsJar(type: Jar) {
|
task javadocsJar(type: Jar) {
|
||||||
archiveClassifier = 'javadoc'
|
archiveClassifier = 'javadoc'
|
||||||
|
@@ -1 +1 @@
|
|||||||
{"licenses":[{"id":"Apache-2.0","title":"Apache Software License 2.0","url":"https://github.com/InsanusMokrassar/MicroUtils/blob/master/LICENSE"}],"mavenConfig":{"name":"${project.name}","description":"It is set of projects with micro tools for avoiding of routines coding","url":"https://github.com/InsanusMokrassar/MicroUtils/","vcsUrl":"https://github.com/InsanusMokrassar/MicroUtils.git","developers":[{"id":"InsanusMokrassar","name":"Aleksei Ovsiannikov","eMail":"ovsyannikov.alexey95@gmail.com"},{"id":"000Sanya","name":"Syrov Aleksandr","eMail":"000sanya.000sanya@gmail.com"}],"repositories":[{"name":"GithubPackages","url":"https://maven.pkg.github.com/InsanusMokrassar/MicroUtils"},{"name":"InmoNexus","url":"https://nexus.inmo.dev/repository/maven-releases/"},{"name":"sonatype","url":"https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/"}],"gpgSigning":{"type":"dev.inmo.kmppscriptbuilder.core.models.GpgSigning.Optional"},"includeCentralSonatypeUploadingScript":true}}
|
{"licenses":[{"id":"Apache-2.0","title":"Apache Software License 2.0","url":"https://github.com/InsanusMokrassar/MicroUtils/blob/master/LICENSE"}],"mavenConfig":{"name":"${project.name}","description":"It is set of projects with micro tools for avoiding of routines coding","url":"https://github.com/InsanusMokrassar/MicroUtils/","vcsUrl":"https://github.com/InsanusMokrassar/MicroUtils.git","developers":[{"id":"InsanusMokrassar","name":"Aleksei Ovsiannikov","eMail":"ovsyannikov.alexey95@gmail.com"},{"id":"000Sanya","name":"Syrov Aleksandr","eMail":"000sanya.000sanya@gmail.com"}],"repositories":[{"name":"GithubPackages","url":"https://maven.pkg.github.com/InsanusMokrassar/MicroUtils"},{"name":"InmoNexus","url":"https://nexus.inmo.dev/repository/maven-releases/"},{"name":"sonatype","url":"https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/"}],"gpgSigning":{"type":"dev.inmo.kmppscriptbuilder.core.models.GpgSigning.Optional"},"includeCentralSonatypeUploadingScript":false}}
|
@@ -1,51 +1,4 @@
|
|||||||
import java.nio.charset.StandardCharsets
|
|
||||||
import java.net.http.HttpClient
|
|
||||||
import java.net.http.HttpRequest
|
|
||||||
import java.net.http.HttpResponse
|
|
||||||
|
|
||||||
apply plugin: 'maven-publish'
|
apply plugin: 'maven-publish'
|
||||||
// This script work based on https://ossrh-staging-api.central.sonatype.com/swagger-ui/#/default/manual_upload_repository
|
|
||||||
// and getting available open repos and just uploading them
|
|
||||||
if ((project.hasProperty('SONATYPE_USER') || System.getenv('SONATYPE_USER') != null) && (project.hasProperty('SONATYPE_PASSWORD') || System.getenv('SONATYPE_PASSWORD') != null)) {
|
|
||||||
def taskName = "uploadSonatypePublication"
|
|
||||||
if (rootProject.tasks.names.contains(taskName) == false) {
|
|
||||||
rootProject.tasks.register(taskName) {
|
|
||||||
doLast {
|
|
||||||
def username = project.hasProperty('SONATYPE_USER') ? project.property('SONATYPE_USER') : System.getenv('SONATYPE_USER')
|
|
||||||
def password = project.hasProperty('SONATYPE_PASSWORD') ? project.property('SONATYPE_PASSWORD') : System.getenv('SONATYPE_PASSWORD')
|
|
||||||
def bearer = Base64.getEncoder().encodeToString("$username:$password".getBytes(StandardCharsets.UTF_8))
|
|
||||||
|
|
||||||
def client = HttpClient.newHttpClient()
|
|
||||||
def request = HttpRequest.newBuilder()
|
|
||||||
.uri(URI.create("https://ossrh-staging-api.central.sonatype.com/manual/search/repositories?state=open"))
|
|
||||||
.GET()
|
|
||||||
.header("Content-Type", "application/json")
|
|
||||||
.header("Authorization", "Bearer $bearer")
|
|
||||||
.build()
|
|
||||||
|
|
||||||
def response = client.send(request, HttpResponse.BodyHandlers.ofString())
|
|
||||||
def keys = new ArrayList<String>()
|
|
||||||
response.body().findAll("\"key\"[\\s]*:[\\s]*\"[^\"]+\"").forEach {
|
|
||||||
def key = it.find("[^\"]+\"\$").find("[^\"]+")
|
|
||||||
keys.add(key)
|
|
||||||
}
|
|
||||||
keys.forEach {
|
|
||||||
println("Start uploading $it")
|
|
||||||
def uploadRequest = HttpRequest.newBuilder()
|
|
||||||
.uri(URI.create("https://ossrh-staging-api.central.sonatype.com/manual/upload/repository/$it?publishing_type=user_managed"))
|
|
||||||
.POST(HttpRequest.BodyPublishers.ofString(""))
|
|
||||||
.header("Content-Type", "application/json")
|
|
||||||
.header("Authorization", "Bearer $bearer")
|
|
||||||
.build()
|
|
||||||
def uploadResponse = client.send(uploadRequest, HttpResponse.BodyHandlers.ofString())
|
|
||||||
if (uploadResponse.statusCode() != 200) {
|
|
||||||
throw IllegalStateException("Faced error of uploading for repo with key $it. Response: $uploadResponse")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
task javadocJar(type: Jar) {
|
task javadocJar(type: Jar) {
|
||||||
|
@@ -1 +1 @@
|
|||||||
{"licenses":[{"id":"Apache-2.0","title":"Apache Software License 2.0","url":"https://github.com/InsanusMokrassar/MicroUtils/blob/master/LICENSE"}],"mavenConfig":{"name":"${project.name}","description":"It is set of projects with micro tools for avoiding of routines coding","url":"https://github.com/InsanusMokrassar/MicroUtils/","vcsUrl":"https://github.com/InsanusMokrassar/MicroUtils.git","developers":[{"id":"InsanusMokrassar","name":"Aleksei Ovsiannikov","eMail":"ovsyannikov.alexey95@gmail.com"},{"id":"000Sanya","name":"Syrov Aleksandr","eMail":"000sanya.000sanya@gmail.com"}],"repositories":[{"name":"GithubPackages","url":"https://maven.pkg.github.com/InsanusMokrassar/MicroUtils"},{"name":"InmoNexus","url":"https://nexus.inmo.dev/repository/maven-releases/"},{"name":"sonatype","url":"https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/"}],"gpgSigning":{"type":"dev.inmo.kmppscriptbuilder.core.models.GpgSigning.Optional"},"includeCentralSonatypeUploadingScript":true},"type":"JVM"}
|
{"licenses":[{"id":"Apache-2.0","title":"Apache Software License 2.0","url":"https://github.com/InsanusMokrassar/MicroUtils/blob/master/LICENSE"}],"mavenConfig":{"name":"${project.name}","description":"It is set of projects with micro tools for avoiding of routines coding","url":"https://github.com/InsanusMokrassar/MicroUtils/","vcsUrl":"https://github.com/InsanusMokrassar/MicroUtils.git","developers":[{"id":"InsanusMokrassar","name":"Aleksei Ovsiannikov","eMail":"ovsyannikov.alexey95@gmail.com"},{"id":"000Sanya","name":"Syrov Aleksandr","eMail":"000sanya.000sanya@gmail.com"}],"repositories":[{"name":"GithubPackages","url":"https://maven.pkg.github.com/InsanusMokrassar/MicroUtils"},{"name":"InmoNexus","url":"https://nexus.inmo.dev/repository/maven-releases/"},{"name":"sonatype","url":"https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/"}],"gpgSigning":{"type":"dev.inmo.kmppscriptbuilder.core.models.GpgSigning.Optional"},"includeCentralSonatypeUploadingScript":false},"type":"JVM"}
|
@@ -65,6 +65,44 @@ class InfinityPagedComponentContext<T> internal constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates and remembers an [InfinityPagedComponentContext] for managing infinite pagination in a Compose UI.
|
||||||
|
* This function is used to create a persistent pagination context that survives recompositions.
|
||||||
|
*
|
||||||
|
* @param size Number of items to load per page.
|
||||||
|
* @param page Initial page number to start pagination from (defaults to 0).
|
||||||
|
* @param scope [CoroutineScope] to launch pagination operations in. If not provided, a new scope will be created
|
||||||
|
* using [rememberCoroutineScope].
|
||||||
|
* @param loader Suspended function that loads paginated data. Receives the current pagination context and
|
||||||
|
* pagination parameters, and returns a [PaginationResult] containing the loaded data.
|
||||||
|
* @return An [InfinityPagedComponentContext] instance that manages the pagination state and operations.
|
||||||
|
*/
|
||||||
|
@Composable
|
||||||
|
fun <T> rememberInfinityPagedComponentContext(
|
||||||
|
size: Int,
|
||||||
|
page: Int = 0,
|
||||||
|
scope: CoroutineScope = rememberCoroutineScope(),
|
||||||
|
loader: suspend InfinityPagedComponentContext<T>.(Pagination) -> PaginationResult<T>
|
||||||
|
) = remember {
|
||||||
|
InfinityPagedComponentContext(page = page, size = size, scope = scope, loader = loader)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Composable function for managing an infinitely paged component.
|
||||||
|
*
|
||||||
|
* @param T The type of the paginated data.
|
||||||
|
* @param block Composable function that renders the UI with the loaded data. When data is in loading state, block will
|
||||||
|
* receive null as `it` parameter
|
||||||
|
*/
|
||||||
|
@Composable
|
||||||
|
internal fun <T> InfinityPagedComponent(
|
||||||
|
context: InfinityPagedComponentContext<T>,
|
||||||
|
block: @Composable InfinityPagedComponentContext<T>.(List<T>?) -> Unit
|
||||||
|
) {
|
||||||
|
val dataState = context.dataState.collectAsState()
|
||||||
|
context.block(dataState.value)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Composable function for managing an infinitely paged component.
|
* Composable function for managing an infinitely paged component.
|
||||||
*
|
*
|
||||||
@@ -84,13 +122,8 @@ internal fun <T> InfinityPagedComponent(
|
|||||||
block: @Composable InfinityPagedComponentContext<T>.(List<T>?) -> Unit
|
block: @Composable InfinityPagedComponentContext<T>.(List<T>?) -> Unit
|
||||||
) {
|
) {
|
||||||
val scope = predefinedScope ?: rememberCoroutineScope()
|
val scope = predefinedScope ?: rememberCoroutineScope()
|
||||||
val context = remember { InfinityPagedComponentContext<T>(page, size, scope, loader) }
|
val context = rememberInfinityPagedComponentContext(page = page, size = size, scope = scope, loader = loader)
|
||||||
remember {
|
InfinityPagedComponent(context, block)
|
||||||
context.reload()
|
|
||||||
}
|
|
||||||
|
|
||||||
val dataState = context.dataState.collectAsState()
|
|
||||||
context.block(dataState.value)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user