Remove some usages of global scope
This commit is contained in:
parent
43c195e14a
commit
8efb20439a
5 changed files with 5 additions and 7 deletions
|
@ -595,7 +595,7 @@ open class BrowseSourceController(bundle: Bundle) :
|
||||||
override fun onItemLongClick(position: Int) {
|
override fun onItemLongClick(position: Int) {
|
||||||
val activity = activity ?: return
|
val activity = activity ?: return
|
||||||
val manga = (adapter?.getItem(position) as? SourceItem?)?.manga ?: return
|
val manga = (adapter?.getItem(position) as? SourceItem?)?.manga ?: return
|
||||||
launchIO {
|
viewScope.launchIO {
|
||||||
val duplicateManga = presenter.getDuplicateLibraryManga(manga)
|
val duplicateManga = presenter.getDuplicateLibraryManga(manga)
|
||||||
|
|
||||||
withUIContext {
|
withUIContext {
|
||||||
|
@ -631,7 +631,7 @@ open class BrowseSourceController(bundle: Bundle) :
|
||||||
|
|
||||||
private fun addToLibrary(newManga: Manga, position: Int) {
|
private fun addToLibrary(newManga: Manga, position: Int) {
|
||||||
val activity = activity ?: return
|
val activity = activity ?: return
|
||||||
launchIO {
|
viewScope.launchIO {
|
||||||
val categories = presenter.getCategories()
|
val categories = presenter.getCategories()
|
||||||
val defaultCategoryId = preferences.defaultCategory()
|
val defaultCategoryId = preferences.defaultCategory()
|
||||||
val defaultCategory = categories.find { it.id == defaultCategoryId.toLong() }
|
val defaultCategory = categories.find { it.id == defaultCategoryId.toLong() }
|
||||||
|
|
|
@ -194,7 +194,7 @@ open class BrowseSourcePresenter(
|
||||||
if (!hasNextPage()) return
|
if (!hasNextPage()) return
|
||||||
|
|
||||||
nextPageJob?.cancel()
|
nextPageJob?.cancel()
|
||||||
nextPageJob = launchIO {
|
nextPageJob = presenterScope.launchIO {
|
||||||
try {
|
try {
|
||||||
pager.requestNextPage()
|
pager.requestNextPage()
|
||||||
} catch (e: Throwable) {
|
} catch (e: Throwable) {
|
||||||
|
|
|
@ -920,7 +920,7 @@ class MangaPresenter(
|
||||||
|
|
||||||
fun trackingSearch(query: String, service: TrackService) {
|
fun trackingSearch(query: String, service: TrackService) {
|
||||||
searchTrackerJob?.cancel()
|
searchTrackerJob?.cancel()
|
||||||
searchTrackerJob = launchIO {
|
searchTrackerJob = presenterScope.launchIO {
|
||||||
try {
|
try {
|
||||||
val results = service.search(query)
|
val results = service.search(query)
|
||||||
withUIContext { view?.onTrackingSearchResults(results) }
|
withUIContext { view?.onTrackingSearchResults(results) }
|
||||||
|
|
|
@ -249,7 +249,7 @@ class ReaderPresenter(
|
||||||
fun init(mangaId: Long, initialChapterId: Long) {
|
fun init(mangaId: Long, initialChapterId: Long) {
|
||||||
if (!needsInit()) return
|
if (!needsInit()) return
|
||||||
|
|
||||||
launchIO {
|
presenterScope.launchIO {
|
||||||
try {
|
try {
|
||||||
val manga = getManga.await(mangaId)
|
val manga = getManga.await(mangaId)
|
||||||
withUIContext {
|
withUIContext {
|
||||||
|
|
|
@ -21,8 +21,6 @@ class TrackLoginDialog(
|
||||||
|
|
||||||
private val service = Injekt.get<TrackManager>().getService(args.getLong("serviceId"))!!
|
private val service = Injekt.get<TrackManager>().getService(args.getLong("serviceId"))!!
|
||||||
|
|
||||||
constructor(service: TrackService) : this(service, null)
|
|
||||||
|
|
||||||
constructor(service: TrackService, @StringRes usernameLabelRes: Int?) :
|
constructor(service: TrackService, @StringRes usernameLabelRes: Int?) :
|
||||||
this(usernameLabelRes, bundleOf("serviceId" to service.id))
|
this(usernameLabelRes, bundleOf("serviceId" to service.id))
|
||||||
|
|
||||||
|
|
Reference in a new issue