mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-22 14:31:52 +01:00
parent
65387d0089
commit
280b0f42db
@ -18,6 +18,13 @@ class ToggleSource(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun await(sourceIds: List<Long>, enable: Boolean) {
|
||||||
|
val transformedSourceIds = sourceIds.map { it.toString() }
|
||||||
|
preferences.disabledSources().getAndSet { disabled ->
|
||||||
|
if (enable) disabled.minus(transformedSourceIds) else disabled.plus(transformedSourceIds)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun isEnabled(sourceId: Long): Boolean {
|
private fun isEnabled(sourceId: Long): Boolean {
|
||||||
return sourceId.toString() in preferences.disabledSources().get()
|
return sourceId.toString() in preferences.disabledSources().get()
|
||||||
}
|
}
|
||||||
|
@ -118,7 +118,9 @@ class ExtensionDetailsPresenter(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun toggleSources(enable: Boolean) {
|
fun toggleSources(enable: Boolean) {
|
||||||
extension?.sources?.forEach { toggleSource.await(it.id, enable) }
|
extension?.sources
|
||||||
|
?.map { it.id }
|
||||||
|
?.let { toggleSource.await(it, enable) }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun createUrl(url: String, pkgName: String, pkgFactory: String?, path: String = ""): String {
|
private fun createUrl(url: String, pkgName: String, pkgFactory: String?, path: String = ""): String {
|
||||||
|
Loading…
Reference in New Issue
Block a user