mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-22 23:01:51 +01:00
Remove some unnecessary coroutine dispatcher switching
This commit is contained in:
parent
63398fe491
commit
b7914909d0
@ -24,7 +24,6 @@ import eu.kanade.tachiyomi.util.isLocal
|
|||||||
import eu.kanade.tachiyomi.util.lang.await
|
import eu.kanade.tachiyomi.util.lang.await
|
||||||
import eu.kanade.tachiyomi.util.lang.isNullOrUnsubscribed
|
import eu.kanade.tachiyomi.util.lang.isNullOrUnsubscribed
|
||||||
import eu.kanade.tachiyomi.util.lang.launchIO
|
import eu.kanade.tachiyomi.util.lang.launchIO
|
||||||
import eu.kanade.tachiyomi.util.lang.launchUI
|
|
||||||
import eu.kanade.tachiyomi.util.prepUpdateCover
|
import eu.kanade.tachiyomi.util.prepUpdateCover
|
||||||
import eu.kanade.tachiyomi.util.removeCovers
|
import eu.kanade.tachiyomi.util.removeCovers
|
||||||
import eu.kanade.tachiyomi.util.shouldDownloadNewChapters
|
import eu.kanade.tachiyomi.util.shouldDownloadNewChapters
|
||||||
@ -511,9 +510,7 @@ class MangaPresenter(
|
|||||||
refreshChapters()
|
refreshChapters()
|
||||||
}
|
}
|
||||||
|
|
||||||
launchUI {
|
view?.onChaptersDeleted(chapters)
|
||||||
view?.onChaptersDeleted(chapters)
|
|
||||||
}
|
|
||||||
} catch (e: Throwable) {
|
} catch (e: Throwable) {
|
||||||
view?.onChaptersDeletedError(e)
|
view?.onChaptersDeletedError(e)
|
||||||
}
|
}
|
||||||
|
@ -114,12 +114,10 @@ class TrackPresenter(
|
|||||||
try {
|
try {
|
||||||
service.update(track)
|
service.update(track)
|
||||||
db.insertTrack(track).await()
|
db.insertTrack(track).await()
|
||||||
launchUI {
|
view?.onRefreshDone()
|
||||||
view!!.onRefreshDone()
|
|
||||||
}
|
|
||||||
} catch (e: Throwable) {
|
} catch (e: Throwable) {
|
||||||
launchUI {
|
launchUI {
|
||||||
view!!.onRefreshError(e)
|
view?.onRefreshError(e)
|
||||||
|
|
||||||
// Restart on error to set old values
|
// Restart on error to set old values
|
||||||
fetchTrackings()
|
fetchTrackings()
|
||||||
|
@ -2,7 +2,6 @@ package eu.kanade.tachiyomi.ui.setting.track
|
|||||||
|
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import eu.kanade.tachiyomi.util.lang.launchIO
|
import eu.kanade.tachiyomi.util.lang.launchIO
|
||||||
import eu.kanade.tachiyomi.util.lang.launchUI
|
|
||||||
|
|
||||||
class AnilistLoginActivity : BaseOAuthLoginActivity() {
|
class AnilistLoginActivity : BaseOAuthLoginActivity() {
|
||||||
|
|
||||||
@ -12,9 +11,7 @@ class AnilistLoginActivity : BaseOAuthLoginActivity() {
|
|||||||
if (matchResult?.groups?.get(1) != null) {
|
if (matchResult?.groups?.get(1) != null) {
|
||||||
launchIO {
|
launchIO {
|
||||||
trackManager.aniList.login(matchResult.groups[1]!!.value)
|
trackManager.aniList.login(matchResult.groups[1]!!.value)
|
||||||
launchUI {
|
returnToSettings()
|
||||||
returnToSettings()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
trackManager.aniList.logout()
|
trackManager.aniList.logout()
|
||||||
|
@ -2,7 +2,6 @@ package eu.kanade.tachiyomi.ui.setting.track
|
|||||||
|
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import eu.kanade.tachiyomi.util.lang.launchIO
|
import eu.kanade.tachiyomi.util.lang.launchIO
|
||||||
import eu.kanade.tachiyomi.util.lang.launchUI
|
|
||||||
|
|
||||||
class BangumiLoginActivity : BaseOAuthLoginActivity() {
|
class BangumiLoginActivity : BaseOAuthLoginActivity() {
|
||||||
|
|
||||||
@ -11,9 +10,7 @@ class BangumiLoginActivity : BaseOAuthLoginActivity() {
|
|||||||
if (code != null) {
|
if (code != null) {
|
||||||
launchIO {
|
launchIO {
|
||||||
trackManager.bangumi.login(code)
|
trackManager.bangumi.login(code)
|
||||||
launchUI {
|
returnToSettings()
|
||||||
returnToSettings()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
trackManager.bangumi.logout()
|
trackManager.bangumi.logout()
|
||||||
|
@ -2,7 +2,6 @@ package eu.kanade.tachiyomi.ui.setting.track
|
|||||||
|
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import eu.kanade.tachiyomi.util.lang.launchIO
|
import eu.kanade.tachiyomi.util.lang.launchIO
|
||||||
import eu.kanade.tachiyomi.util.lang.launchUI
|
|
||||||
|
|
||||||
class MyAnimeListLoginActivity : BaseOAuthLoginActivity() {
|
class MyAnimeListLoginActivity : BaseOAuthLoginActivity() {
|
||||||
|
|
||||||
@ -11,9 +10,7 @@ class MyAnimeListLoginActivity : BaseOAuthLoginActivity() {
|
|||||||
if (code != null) {
|
if (code != null) {
|
||||||
launchIO {
|
launchIO {
|
||||||
trackManager.myAnimeList.login(code)
|
trackManager.myAnimeList.login(code)
|
||||||
launchUI {
|
returnToSettings()
|
||||||
returnToSettings()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
trackManager.myAnimeList.logout()
|
trackManager.myAnimeList.logout()
|
||||||
|
@ -2,7 +2,6 @@ package eu.kanade.tachiyomi.ui.setting.track
|
|||||||
|
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import eu.kanade.tachiyomi.util.lang.launchIO
|
import eu.kanade.tachiyomi.util.lang.launchIO
|
||||||
import eu.kanade.tachiyomi.util.lang.launchUI
|
|
||||||
|
|
||||||
class ShikimoriLoginActivity : BaseOAuthLoginActivity() {
|
class ShikimoriLoginActivity : BaseOAuthLoginActivity() {
|
||||||
|
|
||||||
@ -11,9 +10,7 @@ class ShikimoriLoginActivity : BaseOAuthLoginActivity() {
|
|||||||
if (code != null) {
|
if (code != null) {
|
||||||
launchIO {
|
launchIO {
|
||||||
trackManager.shikimori.login(code)
|
trackManager.shikimori.login(code)
|
||||||
launchUI {
|
returnToSettings()
|
||||||
returnToSettings()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
trackManager.shikimori.logout()
|
trackManager.shikimori.logout()
|
||||||
|
@ -45,16 +45,12 @@ class TrackLoginDialog(
|
|||||||
launchIO {
|
launchIO {
|
||||||
try {
|
try {
|
||||||
service.login(user, pass)
|
service.login(user, pass)
|
||||||
launchUI {
|
dialog?.dismiss()
|
||||||
dialog?.dismiss()
|
launchUI { view?.context?.toast(R.string.login_success) }
|
||||||
view?.context?.toast(R.string.login_success)
|
|
||||||
}
|
|
||||||
} catch (e: Throwable) {
|
} catch (e: Throwable) {
|
||||||
launchUI {
|
binding?.login?.progress = -1
|
||||||
binding!!.login.progress = -1
|
binding?.login?.setText(R.string.unknown_error)
|
||||||
binding!!.login.setText(R.string.unknown_error)
|
launchUI { e.message?.let { view?.context?.toast(it) } }
|
||||||
e.message?.let { view?.context?.toast(it) }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user