From 258b98d87cac9ee659fc8b386aa93da383431ecc Mon Sep 17 00:00:00 2001 From: Hamlet Jiang Su Date: Mon, 4 Dec 2023 17:54:22 -0800 Subject: [PATCH 1/2] image dimension fetch is now disabled when compact mode is enabled --- lib/post/utils/post.dart | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/post/utils/post.dart b/lib/post/utils/post.dart index 1facb4e77..9da0cc860 100644 --- a/lib/post/utils/post.dart +++ b/lib/post/utils/post.dart @@ -112,11 +112,13 @@ Future savePost(int postId, bool save) async { Future> parsePostViews(List postViews) async { SharedPreferences prefs = (await UserPreferences.instance).sharedPreferences; - bool fetchImageDimensions = prefs.getBool(LocalSettings.showPostFullHeightImages.name) ?? false; + bool fetchImageDimensions = prefs.getBool(LocalSettings.showPostFullHeightImages.name) == true && prefs.getBool(LocalSettings.useCompactView.name) != true; bool edgeToEdgeImages = prefs.getBool(LocalSettings.showPostEdgeToEdgeImages.name) ?? false; bool tabletMode = prefs.getBool(LocalSettings.useTabletMode.name) ?? false; bool hideNsfwPosts = prefs.getBool(LocalSettings.hideNsfwPosts.name) ?? false; + print('fetchImageDimensions $fetchImageDimensions'); + Iterable> postFutures = postViews.expand((post) => [if (!hideNsfwPosts || (!post.post.nsfw && hideNsfwPosts)) parsePostView(post, fetchImageDimensions, edgeToEdgeImages, tabletMode)]).toList(); List posts = await Future.wait(postFutures); From 48a71803abf0b6848552b30b97053a4973b8f719 Mon Sep 17 00:00:00 2001 From: Hamlet Jiang Su Date: Mon, 4 Dec 2023 17:58:11 -0800 Subject: [PATCH 2/2] linting and changelog --- CHANGELOG.md | 1 + lib/post/utils/post.dart | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 98e6f8a8b..51bda88b5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ ### Fixed - Fixed issue where custom tabs would not respect default browser when opening links - Fixed issue where initial app startup takes a long time to load (503 errors) +- Fixed issue where image dimensions were being fetched regardless of post view types (card/compact) ## 0.2.6 - 2023-11-22 ### Fixed diff --git a/lib/post/utils/post.dart b/lib/post/utils/post.dart index 9da0cc860..20c26ca27 100644 --- a/lib/post/utils/post.dart +++ b/lib/post/utils/post.dart @@ -117,8 +117,6 @@ Future> parsePostViews(List postViews) async { bool tabletMode = prefs.getBool(LocalSettings.useTabletMode.name) ?? false; bool hideNsfwPosts = prefs.getBool(LocalSettings.hideNsfwPosts.name) ?? false; - print('fetchImageDimensions $fetchImageDimensions'); - Iterable> postFutures = postViews.expand((post) => [if (!hideNsfwPosts || (!post.post.nsfw && hideNsfwPosts)) parsePostView(post, fetchImageDimensions, edgeToEdgeImages, tabletMode)]).toList(); List posts = await Future.wait(postFutures);