mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2025-09-14 21:09:24 +00:00
Merge branch 'master' into 0.12.0
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package dev.inmo.micro_utils.repos.mappers
|
||||
|
||||
import dev.inmo.micro_utils.pagination.Pagination
|
||||
import dev.inmo.micro_utils.pagination.PaginationResult
|
||||
import dev.inmo.micro_utils.pagination.*
|
||||
import dev.inmo.micro_utils.repos.*
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.map
|
||||
@@ -21,11 +20,8 @@ open class MapperReadKeyValueRepo<FromKey, FromValue, ToKey, ToValue>(
|
||||
pagination,
|
||||
reversed
|
||||
).let {
|
||||
PaginationResult(
|
||||
it.page,
|
||||
it.pagesNumber,
|
||||
it.results.map { it.toInnerValue() },
|
||||
it.size
|
||||
it.changeResultsUnchecked(
|
||||
it.results.map { it.toInnerValue() }
|
||||
)
|
||||
}
|
||||
|
||||
@@ -36,11 +32,8 @@ open class MapperReadKeyValueRepo<FromKey, FromValue, ToKey, ToValue>(
|
||||
pagination,
|
||||
reversed
|
||||
).let {
|
||||
PaginationResult(
|
||||
it.page,
|
||||
it.pagesNumber,
|
||||
it.results.map { it.toInnerKey() },
|
||||
it.size
|
||||
it.changeResultsUnchecked(
|
||||
it.results.map { it.toInnerKey() }
|
||||
)
|
||||
}
|
||||
|
||||
@@ -53,11 +46,8 @@ open class MapperReadKeyValueRepo<FromKey, FromValue, ToKey, ToValue>(
|
||||
pagination,
|
||||
reversed
|
||||
).let {
|
||||
PaginationResult(
|
||||
it.page,
|
||||
it.pagesNumber,
|
||||
it.results.map { it.toInnerKey() },
|
||||
it.size
|
||||
it.changeResultsUnchecked(
|
||||
it.results.map { it.toInnerKey() }
|
||||
)
|
||||
}
|
||||
|
||||
|
@@ -1,7 +1,6 @@
|
||||
package dev.inmo.micro_utils.repos.mappers
|
||||
|
||||
import dev.inmo.micro_utils.pagination.Pagination
|
||||
import dev.inmo.micro_utils.pagination.PaginationResult
|
||||
import dev.inmo.micro_utils.pagination.*
|
||||
import dev.inmo.micro_utils.repos.*
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.map
|
||||
@@ -19,11 +18,8 @@ open class MapperReadKeyValuesRepo<FromKey, FromValue, ToKey, ToValue>(
|
||||
pagination,
|
||||
reversed
|
||||
).let {
|
||||
PaginationResult(
|
||||
it.page,
|
||||
it.pagesNumber,
|
||||
it.results.map { it.toInnerValue() },
|
||||
it.size
|
||||
it.changeResultsUnchecked(
|
||||
it.results.map { it.toInnerValue() }
|
||||
)
|
||||
}
|
||||
|
||||
@@ -34,11 +30,8 @@ open class MapperReadKeyValuesRepo<FromKey, FromValue, ToKey, ToValue>(
|
||||
pagination,
|
||||
reversed
|
||||
).let {
|
||||
PaginationResult(
|
||||
it.page,
|
||||
it.pagesNumber,
|
||||
it.results.map { it.toInnerKey() },
|
||||
it.size
|
||||
it.changeResultsUnchecked(
|
||||
it.results.map { it.toInnerKey() }
|
||||
)
|
||||
}
|
||||
|
||||
@@ -51,11 +44,8 @@ open class MapperReadKeyValuesRepo<FromKey, FromValue, ToKey, ToValue>(
|
||||
pagination,
|
||||
reversed
|
||||
).let {
|
||||
PaginationResult(
|
||||
it.page,
|
||||
it.pagesNumber,
|
||||
it.results.map { it.toInnerKey() },
|
||||
it.size
|
||||
it.changeResultsUnchecked(
|
||||
it.results.map { it.toInnerKey() }
|
||||
)
|
||||
}
|
||||
|
||||
|
@@ -3,8 +3,7 @@ package dev.inmo.micro_utils.repos.keyvalue
|
||||
import android.content.Context
|
||||
import android.content.SharedPreferences
|
||||
import androidx.core.content.edit
|
||||
import dev.inmo.micro_utils.pagination.Pagination
|
||||
import dev.inmo.micro_utils.pagination.PaginationResult
|
||||
import dev.inmo.micro_utils.pagination.*
|
||||
import dev.inmo.micro_utils.pagination.utils.paginate
|
||||
import dev.inmo.micro_utils.pagination.utils.reverse
|
||||
import dev.inmo.micro_utils.repos.KeyValueRepo
|
||||
@@ -72,14 +71,11 @@ class KeyValueStore<T : Any> internal constructor (
|
||||
return sharedPreferences.all.values.paginate(
|
||||
resultPagination
|
||||
).let {
|
||||
PaginationResult(
|
||||
it.page,
|
||||
it.pagesNumber,
|
||||
it.changeResultsUnchecked(
|
||||
it.results.map {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
it as T
|
||||
}.let { if (reversed) it.reversed() else it },
|
||||
it.size
|
||||
}.let { if (reversed) it.reversed() else it }
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -89,11 +85,8 @@ class KeyValueStore<T : Any> internal constructor (
|
||||
return sharedPreferences.all.keys.paginate(
|
||||
resultPagination
|
||||
).let {
|
||||
PaginationResult(
|
||||
it.page,
|
||||
it.pagesNumber,
|
||||
it.results.let { if (reversed) it.reversed() else it },
|
||||
it.size
|
||||
it.changeResultsUnchecked(
|
||||
it.results.let { if (reversed) it.reversed() else it }
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -103,11 +96,8 @@ class KeyValueStore<T : Any> internal constructor (
|
||||
return sharedPreferences.all.mapNotNull { (k, value) -> if (value == v) k else null }.paginate(
|
||||
resultPagination
|
||||
).let {
|
||||
PaginationResult(
|
||||
it.page,
|
||||
it.pagesNumber,
|
||||
it.results.let { if (reversed) it.reversed() else it },
|
||||
it.size
|
||||
it.changeResultsUnchecked(
|
||||
it.results.let { if (reversed) it.reversed() else it }
|
||||
)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user