From 14ffafb0a73c8f25d6a9eb573f92139be90f6fbd Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Wed, 17 Mar 2021 13:43:52 +0600 Subject: [PATCH 1/3] start 0.4.30 --- CHANGELOG.md | 2 ++ gradle.properties | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 68b45fce871..ba4c6e55ed3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Changelog +## 0.4.30 + ## 0.4.29 * `Versions`: diff --git a/gradle.properties b/gradle.properties index d5678b771ac..58636e280a8 100644 --- a/gradle.properties +++ b/gradle.properties @@ -44,5 +44,5 @@ dokka_version=1.4.20 # Project data group=dev.inmo -version=0.4.29 -android_code_version=33 +version=0.4.30 +android_code_version=34 From b4abd564ec164ed382c310dce12b39ffa2fe2840 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Wed, 17 Mar 2021 13:48:58 +0600 Subject: [PATCH 2/3] update paginations --- CHANGELOG.md | 4 ++++ .../dev/inmo/micro_utils/pagination/SimplePagination.kt | 5 ++++- .../inmo/micro_utils/pagination/utils/PaginatedIterable.kt | 2 +- .../dev/inmo/micro_utils/pagination/PaginationInUrl.kt | 2 +- .../inmo/micro_utils/pagination/ServerPaginationHelpers.kt | 2 +- 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ba4c6e55ed3..470f90e6458 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## 0.4.30 +* `Pagination`: + * New variable `defaultPaginationPageSize` has been added to be able to change default pagination size + * Add new value `firstPageWithOneElementPagination` + ## 0.4.29 * `Versions`: diff --git a/pagination/common/src/commonMain/kotlin/dev/inmo/micro_utils/pagination/SimplePagination.kt b/pagination/common/src/commonMain/kotlin/dev/inmo/micro_utils/pagination/SimplePagination.kt index eb4bb6aabd8..fed71b34d72 100644 --- a/pagination/common/src/commonMain/kotlin/dev/inmo/micro_utils/pagination/SimplePagination.kt +++ b/pagination/common/src/commonMain/kotlin/dev/inmo/micro_utils/pagination/SimplePagination.kt @@ -7,14 +7,17 @@ const val defaultMediumPageSize = 5 const val defaultLargePageSize = 10 const val defaultExtraLargePageSize = 15 +var defaultPaginationPageSize = defaultMediumPageSize + @Suppress("NOTHING_TO_INLINE", "FunctionName") -inline fun FirstPagePagination(size: Int = defaultMediumPageSize) = +inline fun FirstPagePagination(size: Int = defaultPaginationPageSize) = SimplePagination( page = 0, size = size ) val emptyPagination = Pagination(0, 0) +val firstPageWithOneElementPagination = FirstPagePagination(1) @Suppress("NOTHING_TO_INLINE") inline fun Pagination.nextPage() = diff --git a/pagination/common/src/commonMain/kotlin/dev/inmo/micro_utils/pagination/utils/PaginatedIterable.kt b/pagination/common/src/commonMain/kotlin/dev/inmo/micro_utils/pagination/utils/PaginatedIterable.kt index 26bf118ad54..e2f52f31d3e 100644 --- a/pagination/common/src/commonMain/kotlin/dev/inmo/micro_utils/pagination/utils/PaginatedIterable.kt +++ b/pagination/common/src/commonMain/kotlin/dev/inmo/micro_utils/pagination/utils/PaginatedIterable.kt @@ -36,6 +36,6 @@ class PaginatedIterable( @Suppress("NOTHING_TO_INLINE") inline fun makeIterable( noinline countGetter: () -> Long, - pageSize: Int = defaultMediumPageSize, + pageSize: Int = defaultPaginationPageSize, noinline paginationResultGetter: Pagination.() -> PaginationResult ): Iterable = PaginatedIterable(pageSize, countGetter, paginationResultGetter) diff --git a/pagination/ktor/common/src/commonMain/kotlin/dev/inmo/micro_utils/pagination/PaginationInUrl.kt b/pagination/ktor/common/src/commonMain/kotlin/dev/inmo/micro_utils/pagination/PaginationInUrl.kt index 5373489bf32..890927abad0 100644 --- a/pagination/ktor/common/src/commonMain/kotlin/dev/inmo/micro_utils/pagination/PaginationInUrl.kt +++ b/pagination/ktor/common/src/commonMain/kotlin/dev/inmo/micro_utils/pagination/PaginationInUrl.kt @@ -18,6 +18,6 @@ val Pagination.asUrlQueryArrayParts val Map.extractPagination: Pagination get() = SimplePagination( get(paginationPageKey) ?.toIntOrNull() ?: 0, - get(paginationSizeKey) ?.toIntOrNull() ?: defaultMediumPageSize + get(paginationSizeKey) ?.toIntOrNull() ?: defaultPaginationPageSize ) diff --git a/pagination/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/pagination/ServerPaginationHelpers.kt b/pagination/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/pagination/ServerPaginationHelpers.kt index fee4d0be64a..744cc4e39dc 100644 --- a/pagination/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/pagination/ServerPaginationHelpers.kt +++ b/pagination/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/pagination/ServerPaginationHelpers.kt @@ -6,7 +6,7 @@ import io.ktor.http.Parameters val Parameters.extractPagination: Pagination get() = SimplePagination( get("page") ?.toIntOrNull() ?: 0, - get("size") ?.toIntOrNull() ?: defaultMediumPageSize + get("size") ?.toIntOrNull() ?: defaultPaginationPageSize ) val ApplicationCall.extractPagination: Pagination From 16f445f6997442790108baaa331c788f8bd036ba Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Wed, 17 Mar 2021 13:52:54 +0600 Subject: [PATCH 3/3] update klock --- CHANGELOG.md | 2 ++ gradle.properties | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 470f90e6458..60dfc95d187 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## 0.4.30 +* `Versions`: + * `Klock`: `2.0.6` -> `2.0.7` * `Pagination`: * New variable `defaultPaginationPageSize` has been added to be able to change default pagination size * Add new value `firstPageWithOneElementPagination` diff --git a/gradle.properties b/gradle.properties index 58636e280a8..7cf9f57a1bd 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,7 +13,7 @@ kotlin_exposed_version=0.29.1 ktor_version=1.5.2 -klockVersion=2.0.6 +klockVersion=2.0.7 github_release_plugin_version=2.2.12