From b1e8678dbf68fd4e08e00f9a73a291e38c91ae3c Mon Sep 17 00:00:00 2001 From: tarsin Date: Sun, 8 Jan 2023 22:30:35 +0800 Subject: [PATCH] Fixup! Rewrite SignInScene with modern coroutines --- app/src/main/java/com/hippo/ehviewer/client/EhClient.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/hippo/ehviewer/client/EhClient.kt b/app/src/main/java/com/hippo/ehviewer/client/EhClient.kt index a0d966b9f..2ed2a3ef0 100644 --- a/app/src/main/java/com/hippo/ehviewer/client/EhClient.kt +++ b/app/src/main/java/com/hippo/ehviewer/client/EhClient.kt @@ -28,7 +28,12 @@ object EhClient { request.job = scope.launchIO { val callback: Callback? = request.callback try { - val result: Any? = execute(request.method, request.args) + val result: Any? = request.run { + if (args == null) + execute(method) + else + execute(method, *args!!) + } withUIContext { callback?.onSuccess(result) } } catch (e: Exception) { if (e is CancellationException)