fixes in build

This commit is contained in:
InsanusMokrassar 2021-05-06 17:52:53 +06:00
parent ad1ea985b8
commit a6135738a3
5 changed files with 18 additions and 13 deletions

View File

@ -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"

View File

@ -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

View File

@ -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)
}
}

View File

@ -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>) {

View File

@ -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,