Added sync in file download

This commit is contained in:
Gouri Panda 2023-10-19 00:50:29 +05:30
parent 69072ecee4
commit 98ee430d92
2 changed files with 25 additions and 1 deletions

View File

@ -21,7 +21,7 @@ apply(plugin = "com.jakewharton.butterknife")
ext { ext {
set("versionMajor", 3) set("versionMajor", 3)
set("versionMinor", 7) set("versionMinor", 7)
set("versionPatch", 2) set("versionPatch", 3)
} }
/* /*

View File

@ -4,6 +4,8 @@ import com.android.build.gradle.internal.dsl.ProductFlavor
import custom.CustomApps import custom.CustomApps
import custom.createPublisher import custom.createPublisher
import custom.transactionWithCommit import custom.transactionWithCommit
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.runBlocking
import plugin.KiwixConfigurationPlugin import plugin.KiwixConfigurationPlugin
import java.net.URI import java.net.URI
import java.net.URLDecoder import java.net.URLDecoder
@ -14,6 +16,9 @@ import okhttp3.OkHttpClient
import okhttp3.Request import okhttp3.Request
import okhttp3.ResponseBody import okhttp3.ResponseBody
import java.io.FileNotFoundException import java.io.FileNotFoundException
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.async
import kotlinx.coroutines.withContext
plugins { plugins {
android android
@ -38,6 +43,25 @@ android {
createDownloadTaskForPlayAssetDelivery(it) createDownloadTaskForPlayAssetDelivery(it)
createPublishBundleWithAssetPlayDelivery() createPublishBundleWithAssetPlayDelivery()
} }
runBlocking {
val downloadTaskDeferred = async {
withContext(Dispatchers.IO) {
val file =
File("$projectDir/../install_time_asset_for_dwds/src/main/assets", "$name.zim")
createDownloadTaskForPlayAssetDelivery(file)
}
}
val bundleTaskDeferred = async {
withContext(Dispatchers.Default) {
createPublishBundleWithAssetPlayDelivery()
}
}
downloadTaskDeferred.await()
bundleTaskDeferred.await()
}
} }
} }