mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-22 12:03:09 -04:00
Added sync in file download
This commit is contained in:
parent
69072ecee4
commit
98ee430d92
@ -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)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -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()
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user