mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
fix mutex
This commit is contained in:
parent
48f080c843
commit
e50c001ab1
1 changed files with 3 additions and 2 deletions
|
@ -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(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue