Compare commits

...

4 Commits

Author SHA1 Message Date
10e03bb951 allow to create own Diff with constructor 2023-12-14 23:56:56 +06:00
aa4f392948 start 0.20.22 2023-12-14 23:52:28 +06:00
f51b59ec02 Update libs.versions.toml 2023-12-14 13:47:34 +06:00
8c76834ae4 Merge pull request #359 from InsanusMokrassar/0.20.21
0.20.21
2023-12-12 23:49:26 +06:00
4 changed files with 13 additions and 4 deletions

View File

@@ -1,5 +1,10 @@
# Changelog # Changelog
## 0.20.22
* `Common`:
* Add opportunity to create own `Diff` with base constructor
## 0.20.21 ## 0.20.21
* `Resources`: * `Resources`:

View File

@@ -27,7 +27,7 @@ private inline fun <T> getObject(
* @see calculateDiff * @see calculateDiff
*/ */
@Serializable @Serializable
data class Diff<T> internal constructor( data class Diff<T> @Warning(warning) constructor(
val removed: List<@Serializable(IndexedValueSerializer::class) IndexedValue<T>>, val removed: List<@Serializable(IndexedValueSerializer::class) IndexedValue<T>>,
/** /**
* Old-New values pairs * Old-New values pairs
@@ -36,6 +36,10 @@ data class Diff<T> internal constructor(
val added: List<@Serializable(IndexedValueSerializer::class) IndexedValue<T>> val added: List<@Serializable(IndexedValueSerializer::class) IndexedValue<T>>
) { ) {
fun isEmpty(): Boolean = removed.isEmpty() && replaced.isEmpty() && added.isEmpty() fun isEmpty(): Boolean = removed.isEmpty() && replaced.isEmpty() && added.isEmpty()
companion object {
private const val warning = "This feature can be changed without any warranties. Use with caution and only in case you know what you are doing"
}
} }
fun <T> emptyDiff(): Diff<T> = Diff(emptyList(), emptyList(), emptyList()) fun <T> emptyDiff(): Diff<T> = Diff(emptyList(), emptyList(), emptyList())

View File

@@ -15,5 +15,5 @@ crypto_js_version=4.1.1
# Project data # Project data
group=dev.inmo group=dev.inmo
version=0.20.21 version=0.20.22
android_code_version=227 android_code_version=228

View File

@@ -21,7 +21,7 @@ koin = "3.5.0"
okio = "3.6.0" okio = "3.6.0"
ksp = "1.9.21-1.0.15" ksp = "1.9.21-1.0.16"
kotlin-poet = "1.15.3" kotlin-poet = "1.15.3"
versions = "0.50.0" versions = "0.50.0"