Skip to content

Commit

Permalink
Parse showKey before precache
Browse files Browse the repository at this point in the history
  • Loading branch information
wh201906 authored and honjow committed Nov 26, 2023
1 parent 1404203 commit 2cfabb6
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions lib/pages/image_view/controller/view_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,19 @@ class ViewExtController extends GetxController {
await _galleryPageController?.loadImagesForSer(itemSer);
}

var needShowKey =
vState.pageState?.galleryProvider?.showKey?.isEmpty ?? true;

if (needShowKey) {
// fetchAndParserImageInfo() then ehPrecacheImages()
// make sure showKey is parsed before ehPrecacheImages()
image = await _galleryPageController?.fetchAndParserImageInfo(
itemSer,
cancelToken: vState.getMoreCancelToken,
changeSource: changeSource,
);
}

GalleryPara.instance
.ehPrecacheImages(
imageMap: _galleryPageStat?.imageMap,
Expand All @@ -582,11 +595,16 @@ class ViewExtController extends GetxController {
}
});

image = await _galleryPageController?.fetchAndParserImageInfo(
if (!needShowKey) {
// ehPrecacheImages() then fetchAndParserImageInfo()
// the original logic
image = await _galleryPageController?.fetchAndParserImageInfo(
itemSer,
cancelToken: vState.getMoreCancelToken,
changeSource: changeSource,
);
);
}

}

return image;
Expand Down

0 comments on commit 2cfabb6

Please sign in to comment.