mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2024-12-20 15:47:15 +00:00
fixes in build
This commit is contained in:
parent
ad1ea985b8
commit
a6135738a3
@ -8,7 +8,7 @@ buildscript {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
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-gradle-plugin:$kotlin_version"
|
||||||
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
|
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
|
||||||
classpath "com.getkeepsafe.dexcount:dexcount-gradle-plugin:$dexcount_version"
|
classpath "com.getkeepsafe.dexcount:dexcount-gradle-plugin:$dexcount_version"
|
||||||
|
@ -5,6 +5,7 @@ kotlin.incremental=true
|
|||||||
kotlin.incremental.js=true
|
kotlin.incremental.js=true
|
||||||
android.useAndroidX=true
|
android.useAndroidX=true
|
||||||
android.enableJetifier=true
|
android.enableJetifier=true
|
||||||
|
org.gradle.jvmargs=-Xmx2g
|
||||||
|
|
||||||
kotlin_version=1.5.0
|
kotlin_version=1.5.0
|
||||||
kotlin_coroutines_version=1.4.3
|
kotlin_coroutines_version=1.4.3
|
||||||
@ -27,7 +28,7 @@ appcompat_version=1.2.0
|
|||||||
|
|
||||||
android_minSdkVersion=19
|
android_minSdkVersion=19
|
||||||
android_compileSdkVersion=30
|
android_compileSdkVersion=30
|
||||||
android_buildToolsVersion=30.0.2
|
android_buildToolsVersion=30.0.3
|
||||||
dexcount_version=2.0.0
|
dexcount_version=2.0.0
|
||||||
junit_version=4.12
|
junit_version=4.12
|
||||||
test_ext_junit_version=1.1.2
|
test_ext_junit_version=1.1.2
|
||||||
|
@ -50,7 +50,7 @@ abstract class AbstractMutableAndroidCRUDRepo<ObjectType, IdType, InputValueType
|
|||||||
override suspend fun deleteById(ids: List<IdType>) {
|
override suspend fun deleteById(ids: List<IdType>) {
|
||||||
val deleted = mutableListOf<IdType>()
|
val deleted = mutableListOf<IdType>()
|
||||||
helper.blockingWritableTransaction {
|
helper.blockingWritableTransaction {
|
||||||
ids.forEach { id ->
|
for (id in ids) {
|
||||||
delete(tableName, "$idColumnName=?", arrayOf(id.asId)).also {
|
delete(tableName, "$idColumnName=?", arrayOf(id.asId)).also {
|
||||||
if (it > 0) {
|
if (it > 0) {
|
||||||
deleted.add(id)
|
deleted.add(id)
|
||||||
@ -58,8 +58,8 @@ abstract class AbstractMutableAndroidCRUDRepo<ObjectType, IdType, InputValueType
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
deleted.forEach {
|
for (deletedItem in deleted) {
|
||||||
deleteObjectsIdsChannel.emit(it)
|
deleteObjectsIdsChannel.emit(deletedItem)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,9 +42,9 @@ class KeyValueStore<T : Any> internal constructor (
|
|||||||
|
|
||||||
init {
|
init {
|
||||||
cachedData ?.let {
|
cachedData ?.let {
|
||||||
sharedPreferences.all.forEach {
|
for ((key, value) in sharedPreferences.all) {
|
||||||
if (it.value != null) {
|
if (value != null) {
|
||||||
cachedData[it.key] = it.value as Any
|
cachedData[key] = value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sharedPreferences.registerOnSharedPreferenceChangeListener(this)
|
sharedPreferences.registerOnSharedPreferenceChangeListener(this)
|
||||||
@ -113,7 +113,7 @@ class KeyValueStore<T : Any> internal constructor (
|
|||||||
|
|
||||||
override suspend fun set(toSet: Map<String, T>) {
|
override suspend fun set(toSet: Map<String, T>) {
|
||||||
sharedPreferences.edit {
|
sharedPreferences.edit {
|
||||||
toSet.forEach { (k, v) ->
|
for ((k, v) in toSet) {
|
||||||
when(v) {
|
when(v) {
|
||||||
is Int -> putInt(k, v)
|
is Int -> putInt(k, v)
|
||||||
is Long -> putLong(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)
|
onNewValueChannel.emit(k to v)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun unset(toUnset: List<String>) {
|
override suspend fun unset(toUnset: List<String>) {
|
||||||
sharedPreferences.edit {
|
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>) {
|
override suspend fun unsetWithValues(toUnset: List<T>) {
|
||||||
|
@ -55,7 +55,7 @@ class OneToManyAndroidRepo<Key, Value>(
|
|||||||
override suspend fun add(toAdd: Map<Key, List<Value>>) {
|
override suspend fun add(toAdd: Map<Key, List<Value>>) {
|
||||||
val added = mutableListOf<Pair<Key, Value>>()
|
val added = mutableListOf<Pair<Key, Value>>()
|
||||||
helper.blockingWritableTransaction {
|
helper.blockingWritableTransaction {
|
||||||
toAdd.forEach { (k, values) ->
|
for ((k, values) in toAdd) {
|
||||||
values.forEach { v ->
|
values.forEach { v ->
|
||||||
insert(
|
insert(
|
||||||
tableName,
|
tableName,
|
||||||
|
Loading…
Reference in New Issue
Block a user