mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2025-10-12 10:50:25 +00:00
Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
cfc7119697 | |||
22a6520d3e | |||
fb25e91191 | |||
c116b270b6 | |||
aa2d598689 | |||
5ef3bb746b | |||
037616e271 |
13
CHANGELOG.md
13
CHANGELOG.md
@@ -1,5 +1,18 @@
|
||||
# Changelog
|
||||
|
||||
## 0.11.9
|
||||
|
||||
* `Versions`
|
||||
* `Coroutines`: `1.6.1` -> `1.6.3`
|
||||
* `Ktor`: `2.0.2` -> `2.0.3`
|
||||
* `Compose`: `1.2.0-alpha01-dev686` -> `1.2.0-alpha01-dev729`
|
||||
|
||||
## 0.11.8
|
||||
|
||||
* `Repos`:
|
||||
* `Common`:
|
||||
* Fixes in `FileKeyValueRepo`
|
||||
|
||||
## 0.11.7
|
||||
|
||||
* `Common`:
|
||||
|
@@ -14,5 +14,5 @@ crypto_js_version=4.1.1
|
||||
# Project data
|
||||
|
||||
group=dev.inmo
|
||||
version=0.11.7
|
||||
android_code_version=131
|
||||
version=0.11.9
|
||||
android_code_version=133
|
||||
|
@@ -2,18 +2,18 @@
|
||||
|
||||
kt = "1.6.21"
|
||||
kt-serialization = "1.3.3"
|
||||
kt-coroutines = "1.6.1"
|
||||
kt-coroutines = "1.6.3"
|
||||
|
||||
jb-compose = "1.2.0-alpha01-dev686"
|
||||
jb-compose = "1.2.0-alpha01-dev729"
|
||||
jb-exposed = "0.38.2"
|
||||
jb-dokka = "1.6.21"
|
||||
|
||||
klock = "2.7.0"
|
||||
uuid = "0.4.1"
|
||||
|
||||
ktor = "2.0.2"
|
||||
ktor = "2.0.3"
|
||||
|
||||
gh-release = "2.3.7"
|
||||
gh-release = "2.4.1"
|
||||
|
||||
android-gradle = "7.0.4"
|
||||
dexcount = "3.1.0"
|
||||
|
@@ -99,7 +99,9 @@ class FileWriteKeyValueRepo(
|
||||
override val onValueRemoved: Flow<String> = _onValueRemoved.asSharedFlow()
|
||||
|
||||
init {
|
||||
folder.mkdirs()
|
||||
if (!folder.mkdirs() && !folder.exists()) {
|
||||
error("Unable to create folder ${folder.absolutePath}")
|
||||
}
|
||||
filesChangedProcessingScope ?.let {
|
||||
it.launch {
|
||||
try {
|
||||
@@ -144,15 +146,17 @@ class FileWriteKeyValueRepo(
|
||||
}
|
||||
|
||||
override suspend fun set(toSet: Map<String, File>) {
|
||||
supervisorScope {
|
||||
val scope = CoroutineScope(currentCoroutineContext())
|
||||
toSet.map { (filename, fileSource) ->
|
||||
launch {
|
||||
scope.launch {
|
||||
val file = File(folder, filename)
|
||||
|
||||
file.delete()
|
||||
fileSource.copyTo(file, overwrite = true)
|
||||
_onNewValue.emit(filename to file)
|
||||
if (!file.exists()) {
|
||||
error("Can't create file $file with new content")
|
||||
}
|
||||
_onNewValue.emit(filename to file)
|
||||
}
|
||||
}.joinAll()
|
||||
}
|
||||
|
Reference in New Issue
Block a user