main.phraseapp.repositories.operations.Cleaner.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gradle-client Show documentation
Show all versions of gradle-client Show documentation
JVM client to interact with Phrase via its API.
The newest version!
package phraseapp.repositories.operations
import kotlinx.coroutines.async
import kotlinx.coroutines.awaitAll
import kotlinx.coroutines.coroutineScope
import phraseapp.internal.platforms.Platform
import phraseapp.internal.printers.FileOperation
class Cleaner(val platform: Platform, val fileOperation: FileOperation) {
suspend fun clean(resFolders: Map>) = coroutineScope {
return@coroutineScope resFolders.keys
.map { async { platform.getStringsFilesExceptDefault(resFolder = it) } }
.awaitAll()
.map { async { it.forEach { fileOperation.delete(it) } } }
}
}