fix mutex

This commit is contained in:
Sarang S 2022-08-17 23:17:19 +05:30
parent 48f080c843
commit e50c001ab1

View file

@ -194,6 +194,7 @@ class InAppUpdater {
} }
private val updateLock = Mutex()
private fun Activity.downloadUpdate(url: String): Boolean { private fun Activity.downloadUpdate(url: String): Boolean {
@ -204,7 +205,7 @@ class InAppUpdater {
val downloadedFile = File.createTempFile("CloudStream",".apk") val downloadedFile = File.createTempFile("CloudStream",".apk")
val sink: BufferedSink = downloadedFile.sink().buffer() val sink: BufferedSink = downloadedFile.sink().buffer()
val updateLock = Mutex()
ioSafe { ioSafe {
updateLock.withLock { updateLock.withLock {
sink.writeAll(app.get(url).body.source() ) sink.writeAll(app.get(url).body.source() )
@ -216,7 +217,7 @@ class InAppUpdater {
return true return true
} }
fun openApk(context: Context, uri: Uri) { private fun openApk(context: Context, uri: Uri) {
try { try {
uri.path?.let { uri.path?.let {
val contentUri = FileProvider.getUriForFile( val contentUri = FileProvider.getUriForFile(