mirror of
https://github.com/rebelonion/Dantotsu.git
synced 2026-01-18 14:53:57 +00:00
fix: addon race condition
This commit is contained in:
@@ -24,7 +24,7 @@ class DownloadAddonManager(
|
||||
override var name: String = "Download Addon"
|
||||
override var type = AddonType.DOWNLOAD
|
||||
|
||||
private val _isInitialized = MutableLiveData<Boolean>().apply { postValue(false) }
|
||||
private val _isInitialized = MutableLiveData(false)
|
||||
val isInitialized: LiveData<Boolean> = _isInitialized
|
||||
|
||||
private var error: String? = null
|
||||
@@ -53,11 +53,12 @@ class DownloadAddonManager(
|
||||
hasUpdate = AddonDownloader.hasUpdate(REPO, it.extension.versionName)
|
||||
}
|
||||
}
|
||||
Logger.log("Download addon initialized successfully")
|
||||
withContext(Dispatchers.Main) {
|
||||
_isInitialized.value = true
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
Logger.log("Error initializing Download extension")
|
||||
Logger.log("Error initializing Download addon")
|
||||
Logger.log(e)
|
||||
error = e.message
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ class TorrentAddonManager(
|
||||
override var type: AddonType = AddonType.TORRENT
|
||||
var torrentHash: String? = null
|
||||
|
||||
private val _isInitialized = MutableLiveData<Boolean>().apply { postValue(false) }
|
||||
private val _isInitialized = MutableLiveData(false)
|
||||
val isInitialized: LiveData<Boolean> = _isInitialized
|
||||
|
||||
private var error: String? = null
|
||||
@@ -61,11 +61,12 @@ class TorrentAddonManager(
|
||||
hasUpdate = hasUpdate(REPO, it.extension.versionName)
|
||||
}
|
||||
}
|
||||
Logger.log("Torrent addon initialized successfully")
|
||||
withContext(Dispatchers.Main) {
|
||||
_isInitialized.value = true
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
Logger.log("Error initializing torrent extension")
|
||||
Logger.log("Error initializing torrent addon")
|
||||
Logger.log(e)
|
||||
error = e.message
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user