From 7d2c127580998abd48eab727d97f1e170ec6be10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=85=B1=E5=A4=A9=E5=B0=8F=E7=A6=BD=E5=85=BD?= Date: Sat, 23 Jul 2022 19:30:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=8B=E8=BD=BDnpe=20cooki?= =?UTF-8?q?e=E7=99=BB=E9=99=86=E6=97=B6=E8=8B=A5=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E9=94=99=E8=AF=AF=EF=BC=8C=E8=BF=9B=E8=A1=8C=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=20=E4=BF=AE=E5=A4=8D=E9=98=85=E8=AF=BB=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E9=83=A8=E5=88=86=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/src/pages/read/read_page_logic.dart | 11 ++++++++--- .../setting/account/login/login_page_logic.dart | 14 ++++++++++++-- lib/src/service/gallery_download_service.dart | 4 +++- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/lib/src/pages/read/read_page_logic.dart b/lib/src/pages/read/read_page_logic.dart index e1761b37..17fe1e1e 100644 --- a/lib/src/pages/read/read_page_logic.dart +++ b/lib/src/pages/read/read_page_logic.dart @@ -522,9 +522,14 @@ class ReadPageLogic extends GetxController { /// for some reason like slow loading of some image, [ItemPositions] may be not in index order, and even some of /// them are not in viewport List _filterAndSortItems(Iterable positions) { - positions = positions.where((item) => !(item.itemTrailingEdge < 0 || item.itemLeadingEdge > 1)).toList(); - (positions as List).sort((a, b) => a.index - b.index); - return positions; + List actualPositions = positions.where((item) => !(item.itemTrailingEdge < 0 || item.itemLeadingEdge > 1)).toList(); + actualPositions.sort((a, b) => a.index - b.index); + + if (actualPositions.isEmpty) { + Log.upload(StateError('NoItemPosition!'), stackTrace: StackTrace.current, extraInfos: {'positions': positions}); + } + + return actualPositions; } double _getVisibleHeight() { diff --git a/lib/src/pages/setting/account/login/login_page_logic.dart b/lib/src/pages/setting/account/login/login_page_logic.dart index ab06021c..4764814e 100644 --- a/lib/src/pages/setting/account/login/login_page_logic.dart +++ b/lib/src/pages/setting/account/login/login_page_logic.dart @@ -103,8 +103,18 @@ class LoginPageLogic extends GetxController { return; } - int ipbMemberId = int.parse(match.group(1)!); - String ipbPassHash = match.group(2)!; + int ipbMemberId; + String ipbPassHash; + try { + ipbMemberId = int.parse(match.group(1)!); + ipbPassHash = match.group(2)!; + } on Exception catch (e) { + Log.error('loginFail'.tr, e); + Log.upload(e); + snack('loginFail'.tr, 'cookieFormatError'.tr); + return; + } + await cookieManager.storeEhCookiesForAllUri([ Cookie('ipb_member_id', ipbMemberId.toString()), Cookie('ipb_pass_hash', ipbPassHash), diff --git a/lib/src/service/gallery_download_service.dart b/lib/src/service/gallery_download_service.dart index 4f69ff13..ed27ee53 100644 --- a/lib/src/service/gallery_download_service.dart +++ b/lib/src/service/gallery_download_service.dart @@ -807,7 +807,9 @@ class GalleryDownloadService extends GetxController { } bool _taskHasBeenPausedOrRemoved(GalleryDownloadedData gallery) { - return gid2DownloadProgress[gallery.gid] == null || gid2DownloadProgress[gallery.gid]!.downloadStatus == DownloadStatus.paused; + return gid2DownloadProgress[gallery.gid] == null || + gid2DownloadProgress[gallery.gid]!.downloadStatus == DownloadStatus.paused || + gid2ImageHrefs[gallery.gid] == null; } static void ensureDownloadDirExists() {