Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse showKey before precache #307

Merged
merged 1 commit into from
Nov 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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