mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2025-09-03 15:19:44 +00:00
fixes in build
This commit is contained in:
@@ -50,7 +50,7 @@ abstract class AbstractMutableAndroidCRUDRepo<ObjectType, IdType, InputValueType
|
||||
override suspend fun deleteById(ids: List<IdType>) {
|
||||
val deleted = mutableListOf<IdType>()
|
||||
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<ObjectType, IdType, InputValueType
|
||||
}
|
||||
}
|
||||
}
|
||||
deleted.forEach {
|
||||
deleteObjectsIdsChannel.emit(it)
|
||||
for (deletedItem in deleted) {
|
||||
deleteObjectsIdsChannel.emit(deletedItem)
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -42,9 +42,9 @@ class KeyValueStore<T : Any> 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<T : Any> internal constructor (
|
||||
|
||||
override suspend fun set(toSet: Map<String, T>) {
|
||||
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<T : Any> internal constructor (
|
||||
}
|
||||
}
|
||||
}
|
||||
toSet.forEach { (k, v) ->
|
||||
for ((k, v) in toSet) {
|
||||
onNewValueChannel.emit(k to v)
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun unset(toUnset: List<String>) {
|
||||
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<T>) {
|
||||
|
@@ -55,7 +55,7 @@ class OneToManyAndroidRepo<Key, Value>(
|
||||
override suspend fun add(toAdd: Map<Key, List<Value>>) {
|
||||
val added = mutableListOf<Pair<Key, Value>>()
|
||||
helper.blockingWritableTransaction {
|
||||
toAdd.forEach { (k, values) ->
|
||||
for ((k, values) in toAdd) {
|
||||
values.forEach { v ->
|
||||
insert(
|
||||
tableName,
|
||||
|
Reference in New Issue
Block a user