fix: addon race condition
This commit is contained in:
parent
7e504df55a
commit
4ac53da4b8
2 changed files with 6 additions and 4 deletions
|
@ -24,7 +24,7 @@ class DownloadAddonManager(
|
||||||
override var name: String = "Download Addon"
|
override var name: String = "Download Addon"
|
||||||
override var type = AddonType.DOWNLOAD
|
override var type = AddonType.DOWNLOAD
|
||||||
|
|
||||||
private val _isInitialized = MutableLiveData<Boolean>().apply { postValue(false) }
|
private val _isInitialized = MutableLiveData(false)
|
||||||
val isInitialized: LiveData<Boolean> = _isInitialized
|
val isInitialized: LiveData<Boolean> = _isInitialized
|
||||||
|
|
||||||
private var error: String? = null
|
private var error: String? = null
|
||||||
|
@ -53,11 +53,12 @@ class DownloadAddonManager(
|
||||||
hasUpdate = AddonDownloader.hasUpdate(REPO, it.extension.versionName)
|
hasUpdate = AddonDownloader.hasUpdate(REPO, it.extension.versionName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Logger.log("Download addon initialized successfully")
|
||||||
withContext(Dispatchers.Main) {
|
withContext(Dispatchers.Main) {
|
||||||
_isInitialized.value = true
|
_isInitialized.value = true
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
Logger.log("Error initializing Download extension")
|
Logger.log("Error initializing Download addon")
|
||||||
Logger.log(e)
|
Logger.log(e)
|
||||||
error = e.message
|
error = e.message
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ class TorrentAddonManager(
|
||||||
override var type: AddonType = AddonType.TORRENT
|
override var type: AddonType = AddonType.TORRENT
|
||||||
var torrentHash: String? = null
|
var torrentHash: String? = null
|
||||||
|
|
||||||
private val _isInitialized = MutableLiveData<Boolean>().apply { postValue(false) }
|
private val _isInitialized = MutableLiveData(false)
|
||||||
val isInitialized: LiveData<Boolean> = _isInitialized
|
val isInitialized: LiveData<Boolean> = _isInitialized
|
||||||
|
|
||||||
private var error: String? = null
|
private var error: String? = null
|
||||||
|
@ -61,11 +61,12 @@ class TorrentAddonManager(
|
||||||
hasUpdate = hasUpdate(REPO, it.extension.versionName)
|
hasUpdate = hasUpdate(REPO, it.extension.versionName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Logger.log("Torrent addon initialized successfully")
|
||||||
withContext(Dispatchers.Main) {
|
withContext(Dispatchers.Main) {
|
||||||
_isInitialized.value = true
|
_isInitialized.value = true
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
Logger.log("Error initializing torrent extension")
|
Logger.log("Error initializing torrent addon")
|
||||||
Logger.log(e)
|
Logger.log(e)
|
||||||
error = e.message
|
error = e.message
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue