Remove some usages of global scope

(cherry picked from commit 8efb20439a3d06766f257227f68bf1b762f9c432)
This commit is contained in:
arkon 2022-08-29 15:15:18 -04:00 committed by Jobobby04
parent ae64f9fabd
commit f5fd4526d3
5 changed files with 5 additions and 7 deletions

View File

@ -784,7 +784,7 @@ open class BrowseSourceController(bundle: Bundle) :
override fun onItemLongClick(position: Int) {
val activity = activity ?: return
val manga = (adapter?.getItem(position) as? SourceItem?)?.manga ?: return
launchIO {
viewScope.launchIO {
val duplicateManga = presenter.getDuplicateLibraryManga(manga)
withUIContext {
@ -820,7 +820,7 @@ open class BrowseSourceController(bundle: Bundle) :
private fun addToLibrary(newManga: Manga, position: Int) {
val activity = activity ?: return
launchIO {
viewScope.launchIO {
val categories = presenter.getCategories()
val defaultCategoryId = preferences.defaultCategory()
val defaultCategory = categories.find { it.id == defaultCategoryId.toLong() }

View File

@ -258,7 +258,7 @@ open class BrowseSourcePresenter(
if (!hasNextPage()) return
nextPageJob?.cancel()
nextPageJob = launchIO {
nextPageJob = presenterScope.launchIO {
try {
pager.requestNextPage()
} catch (e: Throwable) {

View File

@ -1440,7 +1440,7 @@ class MangaPresenter(
fun trackingSearch(query: String, service: TrackService) {
searchTrackerJob?.cancel()
searchTrackerJob = launchIO {
searchTrackerJob = presenterScope.launchIO {
try {
val results = service.search(query)
withUIContext { view?.onTrackingSearchResults(results) }

View File

@ -293,7 +293,7 @@ class ReaderPresenter(
fun init(mangaId: Long, initialChapterId: Long) {
if (!needsInit()) return
launchIO {
presenterScope.launchIO {
try {
// SY -->
val manga = getManga.await(mangaId) ?: return@launchIO

View File

@ -21,8 +21,6 @@ class TrackLoginDialog(
private val service = Injekt.get<TrackManager>().getService(args.getLong("serviceId"))!!
constructor(service: TrackService) : this(service, null)
constructor(service: TrackService, @StringRes usernameLabelRes: Int?) :
this(usernameLabelRes, bundleOf("serviceId" to service.id))