From e30928e23d3b1a7cf4b8af6c9ef2e74e6c138a36 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Wed, 28 Apr 2021 23:25:21 +0600 Subject: [PATCH 01/15] start 0.5.0 --- CHANGELOG.md | 2 ++ gradle.properties | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 71f99dde23d..df1ca2888f2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Changelog +## 0.5.0 + ## 0.4.36 * All `Android` targets inside common mpp modules now includes JVM code diff --git a/gradle.properties b/gradle.properties index 2bf9bf62a82..d614c56c764 100644 --- a/gradle.properties +++ b/gradle.properties @@ -44,5 +44,5 @@ dokka_version=1.4.30 # Project data group=dev.inmo -version=0.4.36 -android_code_version=40 +version=0.5.0 +android_code_version=41 From 122daa32202ffa3ec78a8c6bd738641727d376dc Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Wed, 28 Apr 2021 23:58:55 +0600 Subject: [PATCH 02/15] update dependencies --- CHANGELOG.md | 4 ++++ gradle.properties | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index df1ca2888f2..cf0c0d795ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## 0.5.0 +* `Versions`: + * `Kotlin Exposed`: `0.30.2` -> `0.31.1` + * `RecyclerView`: `1.1.0` -> `1.2.0` + ## 0.4.36 * All `Android` targets inside common mpp modules now includes JVM code diff --git a/gradle.properties b/gradle.properties index d614c56c764..c6ff1028bbf 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,7 @@ android.enableJetifier=true kotlin_version=1.4.32 kotlin_coroutines_version=1.4.3 kotlin_serialisation_core_version=1.1.0 -kotlin_exposed_version=0.30.2 +kotlin_exposed_version=0.31.1 ktor_version=1.5.3 @@ -22,7 +22,7 @@ uuidVersion=0.2.4 # ANDROID core_ktx_version=1.3.2 -androidx_recycler_version=1.1.0 +androidx_recycler_version=1.2.0 appcompat_version=1.2.0 android_minSdkVersion=19 From 4dc27f44893cb4aa7a0335a9dc2b1d721dcd4452 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Thu, 29 Apr 2021 12:28:52 +0600 Subject: [PATCH 03/15] all deprecations were removed --- CHANGELOG.md | 1 + .../dev/inmo/micro_utils/common/Base64.kt | 89 ------------------- .../dev/inmo/micro_utils/common/Base64Text.kt | 33 ------- .../micro_utils/coroutines/HandleSafely.kt | 28 ------ .../pagination/CRUDPaginationExtensions.kt | 20 ----- .../KeyValuePaginationExtensions.kt | 18 ---- .../OneToManyPaginationExtensions.kt | 28 ------ .../exposed/AbstractExposedWriteCRUDRepo.kt | 4 +- .../one_to_many/OneToManyParametersNames.kt | 8 -- 9 files changed, 2 insertions(+), 227 deletions(-) delete mode 100644 common/src/commonMain/kotlin/dev/inmo/micro_utils/common/Base64.kt delete mode 100644 common/src/commonTest/kotlin/dev/inmo/micro_utils/common/Base64Text.kt delete mode 100644 repos/ktor/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/common/one_to_many/OneToManyParametersNames.kt diff --git a/CHANGELOG.md b/CHANGELOG.md index cf0c0d795ea..25669184a38 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ * `Versions`: * `Kotlin Exposed`: `0.30.2` -> `0.31.1` * `RecyclerView`: `1.1.0` -> `1.2.0` +* **ALL DEPRECATIONS WERE REMOVED** ## 0.4.36 diff --git a/common/src/commonMain/kotlin/dev/inmo/micro_utils/common/Base64.kt b/common/src/commonMain/kotlin/dev/inmo/micro_utils/common/Base64.kt deleted file mode 100644 index 26bdf061c77..00000000000 --- a/common/src/commonMain/kotlin/dev/inmo/micro_utils/common/Base64.kt +++ /dev/null @@ -1,89 +0,0 @@ -package dev.inmo.micro_utils.common - -import kotlin.experimental.and - -private const val BASE64_ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" -private const val BASE64_MASK: Byte = 0x3f -private const val BASE64_PAD = '=' -private val BASE64_INVERSE_ALPHABET = IntArray(256) { - BASE64_ALPHABET.indexOf(it.toChar()) -} - -internal fun Int.toBase64(): Char = BASE64_ALPHABET[this] -internal fun Byte.fromBase64(): Byte = BASE64_INVERSE_ALPHABET[toInt() and 0xff].toByte() and BASE64_MASK - -const val replacedInCrypto = "Replaced in crypto subproject" - -@Deprecated(replacedInCrypto, ReplaceWith("EncodedBase64String", "dev.inmo.micro_utils.crypto")) -typealias EncodedBase64String = String -@Deprecated(replacedInCrypto, ReplaceWith("EncodedByteArray", "dev.inmo.micro_utils.crypto")) -typealias EncodedByteArray = ByteArray - -@Deprecated(replacedInCrypto, ReplaceWith("encodeBase64String()", "dev.inmo.micro_utils.crypto")) -fun String.encodeBase64String(): EncodedBase64String = encodeToByteArray().encodeBase64String() -@Deprecated(replacedInCrypto, ReplaceWith("encodeBase64()", "dev.inmo.micro_utils.crypto")) -fun String.encodeBase64(): EncodedByteArray = encodeToByteArray().encodeBase64() - -@Deprecated(replacedInCrypto, ReplaceWith("encodeBase64String()", "dev.inmo.micro_utils.crypto")) -fun ByteArray.encodeBase64String(): EncodedBase64String = buildString { - var i = 0 - while (this@encodeBase64String.size > i) { - val read = kotlin.math.min(3, this@encodeBase64String.size - i) - val data = ByteArray(3) { - if (it < read) { - this@encodeBase64String[it + i] - } else { - 0 - } - } - - val padSize = (data.size - read) * 8 / 6 - val chunk = ((data[0].toInt() and 0xFF) shl 16) or - ((data[1].toInt() and 0xFF) shl 8) or - (data[2].toInt() and 0xFF) - - for (index in data.size downTo padSize) { - val char = (chunk shr (6 * index)) and BASE64_MASK.toInt() - append(char.toBase64()) - } - - repeat(padSize) { append(BASE64_PAD) } - - i += read - } -} -@Deprecated(replacedInCrypto, ReplaceWith("encodeBase64()", "dev.inmo.micro_utils.crypto")) -fun ByteArray.encodeBase64(): EncodedByteArray = encodeBase64String().encodeToByteArray() - -@Deprecated(replacedInCrypto, ReplaceWith("decodeBase64()", "dev.inmo.micro_utils.crypto")) -fun EncodedBase64String.decodeBase64() = dropLastWhile { it == BASE64_PAD }.encodeToByteArray().decodeBase64() -@Deprecated(replacedInCrypto, ReplaceWith("decodeBase64String()", "dev.inmo.micro_utils.crypto")) -fun EncodedBase64String.decodeBase64String() = decodeBase64().decodeToString() - -@Deprecated(replacedInCrypto, ReplaceWith("decodeBase64()", "dev.inmo.micro_utils.crypto")) -fun EncodedByteArray.decodeBase64(): ByteArray { - val result = mutableListOf() - val data = ByteArray(4) - (0 until size step 4).forEach { i -> - var read = 0 - for (j in 0 until 4) { - if (j + i < size) { - data[j] = get(j + i) - read++ - } else { - break - } - } - val chunk = data.foldIndexed(0) { index, result, current -> - result or (current.fromBase64().toInt() shl ((3 - index) * 6)) - } - for (index in data.size - 2 downTo (data.size - read)) { - val origin = (chunk shr (8 * index)) and 0xff - result.add(origin.toByte()) - } - } - - return result.toByteArray() -} -@Deprecated(replacedInCrypto, ReplaceWith("decodeBase64String()", "dev.inmo.micro_utils.crypto")) -fun EncodedByteArray.decodeBase64String() = decodeBase64().decodeToString() diff --git a/common/src/commonTest/kotlin/dev/inmo/micro_utils/common/Base64Text.kt b/common/src/commonTest/kotlin/dev/inmo/micro_utils/common/Base64Text.kt deleted file mode 100644 index 8fdc9b95b7d..00000000000 --- a/common/src/commonTest/kotlin/dev/inmo/micro_utils/common/Base64Text.kt +++ /dev/null @@ -1,33 +0,0 @@ -package dev.inmo.micro_utils.common - -import kotlin.random.Random -import kotlin.test.Test -import kotlin.test.assertEquals - - - -class Base64Text { - - val testText = """Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. -Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?""" - val base64Text = """TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdCwgc2VkIGRvIGVpdXNtb2QgdGVtcG9yIGluY2lkaWR1bnQgdXQgbGFib3JlIGV0IGRvbG9yZSBtYWduYSBhbGlxdWEuIFV0IGVuaW0gYWQgbWluaW0gdmVuaWFtLCBxdWlzIG5vc3RydWQgZXhlcmNpdGF0aW9uIHVsbGFtY28gbGFib3JpcyBuaXNpIHV0IGFsaXF1aXAgZXggZWEgY29tbW9kbyBjb25zZXF1YXQuIER1aXMgYXV0ZSBpcnVyZSBkb2xvciBpbiByZXByZWhlbmRlcml0IGluIHZvbHVwdGF0ZSB2ZWxpdCBlc3NlIGNpbGx1bSBkb2xvcmUgZXUgZnVnaWF0IG51bGxhIHBhcmlhdHVyLiBFeGNlcHRldXIgc2ludCBvY2NhZWNhdCBjdXBpZGF0YXQgbm9uIHByb2lkZW50LCBzdW50IGluIGN1bHBhIHF1aSBvZmZpY2lhIGRlc2VydW50IG1vbGxpdCBhbmltIGlkIGVzdCBsYWJvcnVtLgpTZWQgdXQgcGVyc3BpY2lhdGlzIHVuZGUgb21uaXMgaXN0ZSBuYXR1cyBlcnJvciBzaXQgdm9sdXB0YXRlbSBhY2N1c2FudGl1bSBkb2xvcmVtcXVlIGxhdWRhbnRpdW0sIHRvdGFtIHJlbSBhcGVyaWFtLCBlYXF1ZSBpcHNhIHF1YWUgYWIgaWxsbyBpbnZlbnRvcmUgdmVyaXRhdGlzIGV0IHF1YXNpIGFyY2hpdGVjdG8gYmVhdGFlIHZpdGFlIGRpY3RhIHN1bnQgZXhwbGljYWJvLiBOZW1vIGVuaW0gaXBzYW0gdm9sdXB0YXRlbSBxdWlhIHZvbHVwdGFzIHNpdCBhc3Blcm5hdHVyIGF1dCBvZGl0IGF1dCBmdWdpdCwgc2VkIHF1aWEgY29uc2VxdXVudHVyIG1hZ25pIGRvbG9yZXMgZW9zIHF1aSByYXRpb25lIHZvbHVwdGF0ZW0gc2VxdWkgbmVzY2l1bnQuIE5lcXVlIHBvcnJvIHF1aXNxdWFtIGVzdCwgcXVpIGRvbG9yZW0gaXBzdW0gcXVpYSBkb2xvciBzaXQgYW1ldCwgY29uc2VjdGV0dXIsIGFkaXBpc2NpIHZlbGl0LCBzZWQgcXVpYSBub24gbnVtcXVhbSBlaXVzIG1vZGkgdGVtcG9yYSBpbmNpZHVudCB1dCBsYWJvcmUgZXQgZG9sb3JlIG1hZ25hbSBhbGlxdWFtIHF1YWVyYXQgdm9sdXB0YXRlbS4gVXQgZW5pbSBhZCBtaW5pbWEgdmVuaWFtLCBxdWlzIG5vc3RydW0gZXhlcmNpdGF0aW9uZW0gdWxsYW0gY29ycG9yaXMgc3VzY2lwaXQgbGFib3Jpb3NhbSwgbmlzaSB1dCBhbGlxdWlkIGV4IGVhIGNvbW1vZGkgY29uc2VxdWF0dXI/IFF1aXMgYXV0ZW0gdmVsIGV1bSBpdXJlIHJlcHJlaGVuZGVyaXQgcXVpIGluIGVhIHZvbHVwdGF0ZSB2ZWxpdCBlc3NlIHF1YW0gbmloaWwgbW9sZXN0aWFlIGNvbnNlcXVhdHVyLCB2ZWwgaWxsdW0gcXVpIGRvbG9yZW0gZXVtIGZ1Z2lhdCBxdW8gdm9sdXB0YXMgbnVsbGEgcGFyaWF0dXI/""" - - @Test - fun decodeEncode() { - val encoded = testText.encodeBase64String() - assertEquals(base64Text, encoded) - val decoded = encoded.decodeBase64String() - assertEquals(testText, decoded) - } - - val urlTestText = "https://example.com?isitexample=1" - val urlTestBase64Text = "aHR0cHM6Ly9leGFtcGxlLmNvbT9pc2l0ZXhhbXBsZT0x" - - @Test - fun decodeEncodeUrl() { - val encoded = urlTestText.encodeBase64String() - assertEquals(urlTestBase64Text, encoded) - val decoded = encoded.decodeBase64String() - assertEquals(urlTestText, decoded) - } -} \ No newline at end of file diff --git a/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/HandleSafely.kt b/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/HandleSafely.kt index 7b55ec37843..d0bad07fc90 100644 --- a/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/HandleSafely.kt +++ b/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/HandleSafely.kt @@ -22,34 +22,6 @@ var defaultSafelyWithoutExceptionHandler: ExceptionHandler = { } } -/** - * Key for [SafelyExceptionHandler] which can be used in [CoroutineContext.get] to get current default - * [SafelyExceptionHandler] - */ -@Deprecated("This method will be useless in future major update", ReplaceWith("ContextSafelyExceptionHandlerKey", "dev.inmo.micro_utils.coroutines.ContextSafelyExceptionHandler")) -class SafelyExceptionHandlerKey : CoroutineContext.Key> - -/** - * Shortcut for creating instance of [SafelyExceptionHandlerKey] - */ -@Suppress("NOTHING_TO_INLINE") -@Deprecated("This method will be useless in future major update", ReplaceWith("ContextSafelyExceptionHandlerKey", "dev.inmo.micro_utils.coroutines.ContextSafelyExceptionHandler")) -inline fun safelyExceptionHandlerKey() = SafelyExceptionHandlerKey() - -/** - * Wrapper for [ExceptionHandler] which can be used in [CoroutineContext] to set local (for [CoroutineContext]) default - * [ExceptionHandler]. To get it use [CoroutineContext.get] with key [SafelyExceptionHandlerKey] - * - * @see SafelyExceptionHandlerKey - * @see ExceptionHandler - */ -@Deprecated("This method will be useless in future major update", ReplaceWith("ContextSafelyExceptionHandler", "dev.inmo.micro_utils.coroutines.ContextSafelyExceptionHandler")) -class SafelyExceptionHandler( - val handler: ExceptionHandler -) : CoroutineContext.Element { - override val key: CoroutineContext.Key<*> = safelyExceptionHandlerKey() -} - /** * This key can (and will) be used to get [ContextSafelyExceptionHandler] from [coroutineContext] of suspend functions * and in [ContextSafelyExceptionHandler] for defining of its [CoroutineContext.Element.key] diff --git a/repos/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/pagination/CRUDPaginationExtensions.kt b/repos/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/pagination/CRUDPaginationExtensions.kt index 75478b0a2ae..eeda0b9a748 100644 --- a/repos/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/pagination/CRUDPaginationExtensions.kt +++ b/repos/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/pagination/CRUDPaginationExtensions.kt @@ -5,26 +5,6 @@ import dev.inmo.micro_utils.pagination.utils.doForAllWithNextPaging import dev.inmo.micro_utils.pagination.utils.getAllWithNextPaging import dev.inmo.micro_utils.repos.ReadStandardCRUDRepo -@Deprecated("Will be removed soon due to redundancy. Can be replaced with other doForAll extensions") -suspend inline fun > REPO.doForAll( - @Suppress("REDUNDANT_INLINE_SUSPEND_FUNCTION_TYPE") - crossinline methodCaller: suspend REPO.(Pagination) -> PaginationResult, - crossinline block: (List) -> Unit -) { - doForAllWithNextPaging { - methodCaller(it).also { - block(it.results) - } - } -} - -@Deprecated("Will be removed soon due to redundancy. Can be replaced with other doForAll extensions") -suspend inline fun > REPO.doForAll( - crossinline block: (List) -> Unit -) = doForAllWithNextPaging { - getByPagination(it).also { block(it.results) } -} - suspend inline fun > REPO.getAll( @Suppress("REDUNDANT_INLINE_SUSPEND_FUNCTION_TYPE") crossinline methodCaller: suspend REPO.(Pagination) -> PaginationResult diff --git a/repos/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/pagination/KeyValuePaginationExtensions.kt b/repos/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/pagination/KeyValuePaginationExtensions.kt index bb9a75b91a7..abf462ff4e6 100644 --- a/repos/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/pagination/KeyValuePaginationExtensions.kt +++ b/repos/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/pagination/KeyValuePaginationExtensions.kt @@ -4,24 +4,6 @@ import dev.inmo.micro_utils.pagination.* import dev.inmo.micro_utils.pagination.utils.getAllWithNextPaging import dev.inmo.micro_utils.repos.ReadStandardKeyValueRepo -@Deprecated("Will be removed soon due to redundancy") -suspend inline fun > REPO.doForAll( - @Suppress("REDUNDANT_INLINE_SUSPEND_FUNCTION_TYPE") - methodCaller: suspend REPO.(Pagination) -> PaginationResult, - block: (List>) -> Unit -) { - doWithPagination { - methodCaller(it).also { keys -> - block(keys.results.mapNotNull { key -> get(key) ?.let { value -> key to value } }) - }.nextPageIfNotEmpty() - } -} - -@Deprecated("Will be removed soon due to redundancy") -suspend inline fun > REPO.doForAll( - block: (List>) -> Unit -) = doForAll({ keys(it, false) }, block) - suspend inline fun > REPO.getAll( @Suppress("REDUNDANT_INLINE_SUSPEND_FUNCTION_TYPE") crossinline methodCaller: suspend REPO.(Pagination) -> PaginationResult diff --git a/repos/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/pagination/OneToManyPaginationExtensions.kt b/repos/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/pagination/OneToManyPaginationExtensions.kt index 5e46015a060..5a2749a0f1e 100644 --- a/repos/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/pagination/OneToManyPaginationExtensions.kt +++ b/repos/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/pagination/OneToManyPaginationExtensions.kt @@ -4,34 +4,6 @@ import dev.inmo.micro_utils.pagination.* import dev.inmo.micro_utils.pagination.utils.getAllWithNextPaging import dev.inmo.micro_utils.repos.ReadOneToManyKeyValueRepo -@Deprecated("Will be removed soon due to redundancy") -suspend inline fun > REPO.doForAll( - @Suppress("REDUNDANT_INLINE_SUSPEND_FUNCTION_TYPE") - methodCaller: suspend REPO.(Pagination) -> PaginationResult, - block: (List>>) -> Unit -) { - doWithPagination { - methodCaller(it).also { keys -> - block( - keys.results.mapNotNull { key -> - val values = mutableListOf() - doWithPagination { - get(key, it).also { - values.addAll(it.results) - }.nextPageIfNotEmpty() - } - key to values - } - ) - }.nextPageIfNotEmpty() - } -} - -@Deprecated("Will be removed soon due to redundancy") -suspend inline fun > REPO.doForAll( - block: (List>>) -> Unit -) = doForAll({ keys(it, false) }, block) - suspend inline fun > REPO.getAll( @Suppress("REDUNDANT_INLINE_SUSPEND_FUNCTION_TYPE") crossinline methodCaller: suspend REPO.(Pagination) -> PaginationResult diff --git a/repos/exposed/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/exposed/AbstractExposedWriteCRUDRepo.kt b/repos/exposed/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/exposed/AbstractExposedWriteCRUDRepo.kt index afdaa115286..dccae6ceda0 100644 --- a/repos/exposed/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/exposed/AbstractExposedWriteCRUDRepo.kt +++ b/repos/exposed/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/exposed/AbstractExposedWriteCRUDRepo.kt @@ -24,9 +24,7 @@ abstract class AbstractExposedWriteCRUDRepo( override val updatedObjectsFlow: Flow = updateObjectsChannel.asSharedFlow() override val deletedObjectsIdsFlow: Flow = deleteObjectsIdsChannel.asSharedFlow() - @Deprecated("Will be removed in near major update. Override open fun with the same name instead") - abstract val InsertStatement.asObject: ObjectType - protected open fun InsertStatement.asObject(value: InputValueType): ObjectType = asObject + protected abstract fun InsertStatement.asObject(value: InputValueType): ObjectType abstract val selectByIds: SqlExpressionBuilder.(List) -> Op protected abstract fun insert(value: InputValueType, it: InsertStatement) diff --git a/repos/ktor/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/common/one_to_many/OneToManyParametersNames.kt b/repos/ktor/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/common/one_to_many/OneToManyParametersNames.kt deleted file mode 100644 index 2e8d9b29cc3..00000000000 --- a/repos/ktor/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/common/one_to_many/OneToManyParametersNames.kt +++ /dev/null @@ -1,8 +0,0 @@ -package dev.inmo.micro_utils.repos.ktor.common.one_to_many - -@Deprecated("Replaced", ReplaceWith("keyParameterName", "dev.inmo.micro_utils.repos.ktor.common.keyParameterName")) -const val keyParameterName = dev.inmo.micro_utils.repos.ktor.common.keyParameterName -@Deprecated("Replaced", ReplaceWith("valueParameterName", "dev.inmo.micro_utils.repos.ktor.common.valueParameterName")) -const val valueParameterName = dev.inmo.micro_utils.repos.ktor.common.valueParameterName -@Deprecated("Replaced", ReplaceWith("reversedParameterName", "dev.inmo.micro_utils.repos.ktor.common.reversedParameterName")) -const val reversedParameterName = dev.inmo.micro_utils.repos.ktor.common.reversedParameterName \ No newline at end of file From 2058950d072df0fa94035551c9c836094455885a Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Mon, 3 May 2021 10:48:31 +0600 Subject: [PATCH 04/15] update ktor --- CHANGELOG.md | 1 + gradle.properties | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 25669184a38..1b28be97c7c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ * `Versions`: * `Kotlin Exposed`: `0.30.2` -> `0.31.1` * `RecyclerView`: `1.1.0` -> `1.2.0` + * `Ktor`: `1.5.3` -> `1.5.4` * **ALL DEPRECATIONS WERE REMOVED** ## 0.4.36 diff --git a/gradle.properties b/gradle.properties index c6ff1028bbf..eb139718ef1 100644 --- a/gradle.properties +++ b/gradle.properties @@ -11,7 +11,7 @@ kotlin_coroutines_version=1.4.3 kotlin_serialisation_core_version=1.1.0 kotlin_exposed_version=0.31.1 -ktor_version=1.5.3 +ktor_version=1.5.4 klockVersion=2.0.7 From ad1ea985b80c4c0f5cceff7b39a6b223f60b95f9 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Thu, 6 May 2021 15:58:18 +0600 Subject: [PATCH 05/15] invalid update up to kotlin 1.5.0 --- gradle.properties | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gradle.properties b/gradle.properties index eb139718ef1..4a619fb34ea 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,14 +6,14 @@ kotlin.incremental.js=true android.useAndroidX=true android.enableJetifier=true -kotlin_version=1.4.32 +kotlin_version=1.5.0 kotlin_coroutines_version=1.4.3 -kotlin_serialisation_core_version=1.1.0 +kotlin_serialisation_core_version=1.2.0 kotlin_exposed_version=0.31.1 ktor_version=1.5.4 -klockVersion=2.0.7 +klockVersion=2.1.0 github_release_plugin_version=2.2.12 From a6135738a32454fa38a08a06a1aeb4764b046b68 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Thu, 6 May 2021 17:52:53 +0600 Subject: [PATCH 06/15] fixes in build --- build.gradle | 2 +- gradle.properties | 3 ++- .../crud/AbstractMutableAndroidCRUDRepo.kt | 6 +++--- .../repos/keyvalue/KeyValueStore.kt | 18 +++++++++++------- .../repos/onetomany/OneToManyAndroidRepo.kt | 2 +- 5 files changed, 18 insertions(+), 13 deletions(-) diff --git a/build.gradle b/build.gradle index 4f15e458e16..c39bf9800a4 100644 --- a/build.gradle +++ b/build.gradle @@ -8,7 +8,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:4.0.2' + classpath 'com.android.tools.build:gradle:4.1.3' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version" classpath "com.getkeepsafe.dexcount:dexcount-gradle-plugin:$dexcount_version" diff --git a/gradle.properties b/gradle.properties index 4a619fb34ea..8a63f7b156f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,6 +5,7 @@ kotlin.incremental=true kotlin.incremental.js=true android.useAndroidX=true android.enableJetifier=true +org.gradle.jvmargs=-Xmx2g kotlin_version=1.5.0 kotlin_coroutines_version=1.4.3 @@ -27,7 +28,7 @@ appcompat_version=1.2.0 android_minSdkVersion=19 android_compileSdkVersion=30 -android_buildToolsVersion=30.0.2 +android_buildToolsVersion=30.0.3 dexcount_version=2.0.0 junit_version=4.12 test_ext_junit_version=1.1.2 diff --git a/repos/common/src/main/kotlin/dev/inmo/micro_utils/repos/crud/AbstractMutableAndroidCRUDRepo.kt b/repos/common/src/main/kotlin/dev/inmo/micro_utils/repos/crud/AbstractMutableAndroidCRUDRepo.kt index ba5861aaad6..fc016c19a5c 100644 --- a/repos/common/src/main/kotlin/dev/inmo/micro_utils/repos/crud/AbstractMutableAndroidCRUDRepo.kt +++ b/repos/common/src/main/kotlin/dev/inmo/micro_utils/repos/crud/AbstractMutableAndroidCRUDRepo.kt @@ -50,7 +50,7 @@ abstract class AbstractMutableAndroidCRUDRepo) { val deleted = mutableListOf() helper.blockingWritableTransaction { - ids.forEach { id -> + for (id in ids) { delete(tableName, "$idColumnName=?", arrayOf(id.asId)).also { if (it > 0) { deleted.add(id) @@ -58,8 +58,8 @@ abstract class AbstractMutableAndroidCRUDRepo internal constructor ( init { cachedData ?.let { - sharedPreferences.all.forEach { - if (it.value != null) { - cachedData[it.key] = it.value as Any + for ((key, value) in sharedPreferences.all) { + if (value != null) { + cachedData[key] = value } } sharedPreferences.registerOnSharedPreferenceChangeListener(this) @@ -113,7 +113,7 @@ class KeyValueStore internal constructor ( override suspend fun set(toSet: Map) { sharedPreferences.edit { - toSet.forEach { (k, v) -> + for ((k, v) in toSet) { when(v) { is Int -> putInt(k, v) is Long -> putLong(k, v) @@ -127,16 +127,20 @@ class KeyValueStore internal constructor ( } } } - toSet.forEach { (k, v) -> + for ((k, v) in toSet) { onNewValueChannel.emit(k to v) } } override suspend fun unset(toUnset: List) { sharedPreferences.edit { - toUnset.forEach { remove(it) } + for (item in toUnset) { + remove(item) + } + } + for (it in toUnset) { + _onValueRemovedFlow.emit(it) } - toUnset.forEach { _onValueRemovedFlow.emit(it) } } override suspend fun unsetWithValues(toUnset: List) { diff --git a/repos/common/src/main/kotlin/dev/inmo/micro_utils/repos/onetomany/OneToManyAndroidRepo.kt b/repos/common/src/main/kotlin/dev/inmo/micro_utils/repos/onetomany/OneToManyAndroidRepo.kt index 81c748b172e..bc910985df6 100644 --- a/repos/common/src/main/kotlin/dev/inmo/micro_utils/repos/onetomany/OneToManyAndroidRepo.kt +++ b/repos/common/src/main/kotlin/dev/inmo/micro_utils/repos/onetomany/OneToManyAndroidRepo.kt @@ -55,7 +55,7 @@ class OneToManyAndroidRepo( override suspend fun add(toAdd: Map>) { val added = mutableListOf>() helper.blockingWritableTransaction { - toAdd.forEach { (k, values) -> + for ((k, values) in toAdd) { values.forEach { v -> insert( tableName, From c4e2c06cf5faf8fc4202e3e213ea445cb114e762 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Thu, 6 May 2021 18:02:33 +0600 Subject: [PATCH 07/15] remove excluding signMetadataPublication --- .github/workflows/packages_push.yml | 2 +- gradle.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/packages_push.yml b/.github/workflows/packages_push.yml index 23d3b54dbfd..347bc48f10f 100644 --- a/.github/workflows/packages_push.yml +++ b/.github/workflows/packages_push.yml @@ -18,7 +18,7 @@ jobs: - name: Build run: ./gradlew build - name: Publish - run: ./gradlew --no-parallel publishAllPublicationsToGithubPackagesRepository -x signJsPublication -x signJvmPublication -x signKotlinMultiplatformPublication -x signMetadataPublication -x signAndroidDebugPublication -x signAndroidReleasePublication -x signKotlinMultiplatformPublication + run: ./gradlew --no-parallel publishAllPublicationsToGithubPackagesRepository -x signJsPublication -x signJvmPublication -x signKotlinMultiplatformPublication -x signAndroidDebugPublication -x signAndroidReleasePublication -x signKotlinMultiplatformPublication env: GITHUBPACKAGES_USER: ${{ github.actor }} GITHUBPACKAGES_PASSWORD: ${{ secrets.GITHUB_TOKEN }} diff --git a/gradle.properties b/gradle.properties index 8a63f7b156f..4ba2c01a93b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -40,7 +40,7 @@ crypto_js_version=4.0.0 # Dokka -dokka_version=1.4.30 +dokka_version=1.4.32 # Project data From ccbed95cdcc3dcbf9c21c40eeac5638ea93869f8 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Thu, 6 May 2021 18:18:42 +0600 Subject: [PATCH 08/15] update uuid and fill changelog --- CHANGELOG.md | 2 ++ gradle.properties | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b28be97c7c..dfe40d180e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ * `Kotlin Exposed`: `0.30.2` -> `0.31.1` * `RecyclerView`: `1.1.0` -> `1.2.0` * `Ktor`: `1.5.3` -> `1.5.4` + * `Klock`: `2.0.7` -> `2.1.0` + * `UUID`: `0.2.4` -> `0.3.0` * **ALL DEPRECATIONS WERE REMOVED** ## 0.4.36 diff --git a/gradle.properties b/gradle.properties index 4ba2c01a93b..83ddebe500e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -18,7 +18,7 @@ klockVersion=2.1.0 github_release_plugin_version=2.2.12 -uuidVersion=0.2.4 +uuidVersion=0.3.0 # ANDROID From 702c5a3e5d36f5fddcea1975525658894c17ad2e Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Mon, 10 May 2021 13:49:27 +0600 Subject: [PATCH 09/15] update coroutines --- CHANGELOG.md | 1 + gradle.properties | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dfe40d180e8..2883d69f3f2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ * `Versions`: * `Kotlin Exposed`: `0.30.2` -> `0.31.1` + * `Kotlin Coroutines`: `1.4.3` -> `1.5.0-RC` * `RecyclerView`: `1.1.0` -> `1.2.0` * `Ktor`: `1.5.3` -> `1.5.4` * `Klock`: `2.0.7` -> `2.1.0` diff --git a/gradle.properties b/gradle.properties index 83ddebe500e..120096e3ac2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,7 +8,7 @@ android.enableJetifier=true org.gradle.jvmargs=-Xmx2g kotlin_version=1.5.0 -kotlin_coroutines_version=1.4.3 +kotlin_coroutines_version=1.5.0-RC kotlin_serialisation_core_version=1.2.0 kotlin_exposed_version=0.31.1 From e9223d550283827b463a8a5c9678fc148c0827a8 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Mon, 10 May 2021 19:20:57 +0600 Subject: [PATCH 10/15] add doSynchronously --- CHANGELOG.md | 2 ++ .../dev/inmo/micro_utils/coroutines/LaunchSynchronously.kt | 3 +++ 2 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2883d69f3f2..1b826566561 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ * `Klock`: `2.0.7` -> `2.1.0` * `UUID`: `0.2.4` -> `0.3.0` * **ALL DEPRECATIONS WERE REMOVED** +* `Coroutines`: + * New extension and function `doSynchronously` which are the same as `launchSynchronously` ## 0.4.36 diff --git a/coroutines/src/jvmMain/kotlin/dev/inmo/micro_utils/coroutines/LaunchSynchronously.kt b/coroutines/src/jvmMain/kotlin/dev/inmo/micro_utils/coroutines/LaunchSynchronously.kt index 36e7d8b608a..d5142fcba7f 100644 --- a/coroutines/src/jvmMain/kotlin/dev/inmo/micro_utils/coroutines/LaunchSynchronously.kt +++ b/coroutines/src/jvmMain/kotlin/dev/inmo/micro_utils/coroutines/LaunchSynchronously.kt @@ -27,3 +27,6 @@ fun CoroutineScope.launchSynchronously(block: suspend CoroutineScope.() -> T } fun launchSynchronously(block: suspend CoroutineScope.() -> T): T = CoroutineScope(Dispatchers.Default).launchSynchronously(block) + +fun CoroutineScope.doSynchronously(block: suspend CoroutineScope.() -> T): T = launchSynchronously(block) +fun doSynchronously(block: suspend CoroutineScope.() -> T): T = launchSynchronously(block) From df4eaea4b9fd4e1da22af9a72e439d2b1e3cd54f Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Mon, 10 May 2021 19:24:21 +0600 Subject: [PATCH 11/15] doInDefault and doInIO --- CHANGELOG.md | 1 + .../main/kotlin/dev/inmo/micro_utils/coroutines/DoInUI.kt | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b826566561..7ae0d1cccfa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ * **ALL DEPRECATIONS WERE REMOVED** * `Coroutines`: * New extension and function `doSynchronously` which are the same as `launchSynchronously` + * New extensions `doInDefault` and `doInIO` ## 0.4.36 diff --git a/coroutines/src/main/kotlin/dev/inmo/micro_utils/coroutines/DoInUI.kt b/coroutines/src/main/kotlin/dev/inmo/micro_utils/coroutines/DoInUI.kt index f938e53655f..ab23e3f87d7 100644 --- a/coroutines/src/main/kotlin/dev/inmo/micro_utils/coroutines/DoInUI.kt +++ b/coroutines/src/main/kotlin/dev/inmo/micro_utils/coroutines/DoInUI.kt @@ -8,3 +8,11 @@ suspend inline fun doInUI(noinline block: suspend CoroutineScope.() -> T) = Dispatchers.Main, block ) +suspend inline fun doInDefault(noinline block: suspend CoroutineScope.() -> T) = withContext( + Dispatchers.Default, + block +) +suspend inline fun doInIO(noinline block: suspend CoroutineScope.() -> T) = withContext( + Dispatchers.IO, + block +) From 5860901c300ba743ca45f4fee473501c146f468e Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Wed, 12 May 2021 21:16:05 +0600 Subject: [PATCH 12/15] recyclerview alerts public --- CHANGELOG.md | 4 ++++ .../micro_utils/android/alerts/recyclerview/ActionsAlerts.kt | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ae0d1cccfa..f64ccf4151c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,10 @@ * `Klock`: `2.0.7` -> `2.1.0` * `UUID`: `0.2.4` -> `0.3.0` * **ALL DEPRECATIONS WERE REMOVED** +* `Android`: + * `Alerts`: + * `RecyclerView`: + * Classes `ActionViewHolder` and `ActionsRecyclerViewAdapter` became public * `Coroutines`: * New extension and function `doSynchronously` which are the same as `launchSynchronously` * New extensions `doInDefault` and `doInIO` diff --git a/android/alerts/recyclerview/src/main/kotlin/dev/inmo/micro_utils/android/alerts/recyclerview/ActionsAlerts.kt b/android/alerts/recyclerview/src/main/kotlin/dev/inmo/micro_utils/android/alerts/recyclerview/ActionsAlerts.kt index 99efd6ebe41..d7a1de7ba48 100644 --- a/android/alerts/recyclerview/src/main/kotlin/dev/inmo/micro_utils/android/alerts/recyclerview/ActionsAlerts.kt +++ b/android/alerts/recyclerview/src/main/kotlin/dev/inmo/micro_utils/android/alerts/recyclerview/ActionsAlerts.kt @@ -15,7 +15,7 @@ data class AlertAction( val callback: (DialogInterface) -> Unit ) -private class ActionViewHolder( +class ActionViewHolder( container: ViewGroup, dialogInterfaceGetter: () -> DialogInterface ) : AbstractStandardViewHolder(container, android.R.layout.simple_list_item_1) { private lateinit var action: AlertAction @@ -34,7 +34,7 @@ private class ActionViewHolder( } } -private class ActionsRecyclerViewAdapter( +class ActionsRecyclerViewAdapter( data: List, private val dialogInterfaceGetter: () -> DialogInterface ) : RecyclerViewAdapter(data) { From b0441c134ca059e002c2674dc66e95afb79183df Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sat, 15 May 2021 01:36:26 +0600 Subject: [PATCH 13/15] Update gradle.properties --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 120096e3ac2..f8d42d1b0b1 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,7 +8,7 @@ android.enableJetifier=true org.gradle.jvmargs=-Xmx2g kotlin_version=1.5.0 -kotlin_coroutines_version=1.5.0-RC +kotlin_coroutines_version=1.5.0 kotlin_serialisation_core_version=1.2.0 kotlin_exposed_version=0.31.1 From bd0423f2431cf79acd3fc378a066d64665039eaf Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sat, 15 May 2021 01:36:56 +0600 Subject: [PATCH 14/15] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f64ccf4151c..79c4a1853b5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ * `Versions`: * `Kotlin Exposed`: `0.30.2` -> `0.31.1` - * `Kotlin Coroutines`: `1.4.3` -> `1.5.0-RC` + * `Kotlin Coroutines`: `1.4.3` -> `1.5.0` * `RecyclerView`: `1.1.0` -> `1.2.0` * `Ktor`: `1.5.3` -> `1.5.4` * `Klock`: `2.0.7` -> `2.1.0` From 7238e1ea8ac944377f4e17d4cebb5c341f13e630 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Tue, 18 May 2021 09:41:59 +0600 Subject: [PATCH 15/15] Update CHANGELOG.md --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 79c4a1853b5..941b0559fb9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ ## 0.5.0 +**Notice**: This version is still depend on Kotlin +Exposed 0.31.1. That means that this version +may work improperly in modules based on Kotlin +Exposed + * `Versions`: * `Kotlin Exposed`: `0.30.2` -> `0.31.1` * `Kotlin Coroutines`: `1.4.3` -> `1.5.0`