From f4d3131ef32996d9a5913471e492058d8e76d5d2 Mon Sep 17 00:00:00 2001 From: tarsin Date: Thu, 12 Jan 2023 11:53:41 +0800 Subject: [PATCH] Put history in IO coroutines, #629 --- .../com/hippo/ehviewer/ui/scene/GalleryDetailScene.kt | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/com/hippo/ehviewer/ui/scene/GalleryDetailScene.kt b/app/src/main/java/com/hippo/ehviewer/ui/scene/GalleryDetailScene.kt index 05570e50c..7445e9114 100755 --- a/app/src/main/java/com/hippo/ehviewer/ui/scene/GalleryDetailScene.kt +++ b/app/src/main/java/com/hippo/ehviewer/ui/scene/GalleryDetailScene.kt @@ -173,17 +173,12 @@ class GalleryDetailScene : CollapsingToolbarScene(), View.OnClickListener, Downl } private fun handleArgs(args: Bundle?) { - if (args == null) { - return - } - val action = args.getString(KEY_ACTION) + val action = args?.getString(KEY_ACTION) ?: return mAction = action if (ACTION_GALLERY_INFO == action) { mGalleryInfo = args.getParcelable(KEY_GALLERY_INFO) // Add history - if (null != mGalleryInfo) { - EhDB.putHistoryInfo(mGalleryInfo) - } + mGalleryInfo?.let { lifecycleScope.launchIO { EhDB.putHistoryInfo(it) } } } else if (ACTION_GID_TOKEN == action) { mGid = args.getLong(KEY_GID) mToken = args.getString(KEY_TOKEN)