From 522b499c6324683db59986fc42a5003154a8b83c Mon Sep 17 00:00:00 2001 From: Eric Andrews Date: Sat, 16 Sep 2023 18:10:10 -0400 Subject: [PATCH] hacked images to be smooth --- .../Links/Community/CommunityLinkView.swift | 3 ++- .../Shared/Posts/Post Sizes/Large Post.swift | 14 +++++++++++--- Mlem/Views/Shared/Website Icon Complex.swift | 17 +++++++++++++---- 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/Mlem/Views/Shared/Links/Community/CommunityLinkView.swift b/Mlem/Views/Shared/Links/Community/CommunityLinkView.swift index c9c5eaba9..6efff86dc 100644 --- a/Mlem/Views/Shared/Links/Community/CommunityLinkView.swift +++ b/Mlem/Views/Shared/Links/Community/CommunityLinkView.swift @@ -26,7 +26,8 @@ struct CommunityLinkView: View { } var body: some View { - NavigationLink(value: community) { + // NavigationLink(value: community) { + NavigationLink(.apiCommunity(community)) { HStack { CommunityLabelView( community: community, diff --git a/Mlem/Views/Shared/Posts/Post Sizes/Large Post.swift b/Mlem/Views/Shared/Posts/Post Sizes/Large Post.swift index 84f3435d2..8d54caf02 100644 --- a/Mlem/Views/Shared/Posts/Post Sizes/Large Post.swift +++ b/Mlem/Views/Shared/Posts/Post Sizes/Large Post.swift @@ -92,6 +92,9 @@ struct LargePost: View { } } + // REMOVEME: needed for TF hack + var screenWidth: CGFloat = UIScreen.main.bounds.width - (AppConstants.postAndCommentSpacing * 2) + // initializer--used so we can set showNsfwFilterToggle to false when expanded or true when not init( post: PostModel, @@ -202,13 +205,18 @@ struct LargePost: View { if layoutMode != .minimize { CachedImage( url: url, - maxHeight: layoutMode.getMaxHeight(limitHeight), + // maxHeight: layoutMode.getMaxHeight(limitHeight), + // CHANGEME: hack for TF release + fixedSize: CGSize(width: screenWidth, height: screenWidth), dismissCallback: markPostAsRead, cornerRadius: AppConstants.largeItemCornerRadius ) .frame( - maxWidth: .infinity, - maxHeight: layoutMode.getMaxHeight(limitHeight), + // CHANGEME: hack for TF release + width: screenWidth, + height: screenWidth, + // maxWidth: .infinity, + // maxHeight: layoutMode.getMaxHeight(limitHeight), alignment: .top ) .applyNsfwOverlay(post.post.nsfw || post.community.nsfw, canTapFullImage: isExpanded) diff --git a/Mlem/Views/Shared/Website Icon Complex.swift b/Mlem/Views/Shared/Website Icon Complex.swift index 19b18b1ed..187f3126b 100644 --- a/Mlem/Views/Shared/Website Icon Complex.swift +++ b/Mlem/Views/Shared/Website Icon Complex.swift @@ -55,14 +55,23 @@ struct WebsiteIconComplex: View { } return "some website" } + + // REMOVEME: needed for TF hack + var screenWidth: CGFloat = UIScreen.main.bounds.width - (AppConstants.postAndCommentSpacing * 2) var body: some View { VStack(spacing: 0) { if shouldShowWebsitePreviews, let thumbnailURL = post.thumbnailImageUrl { - CachedImage(url: thumbnailURL, shouldExpand: false) - .frame(maxHeight: 400) - .applyNsfwOverlay(post.nsfw) - .clipped() + CachedImage( + url: thumbnailURL, + shouldExpand: false, + // CHANGEME: hack for TF release + fixedSize: CGSize(width: screenWidth, height: screenWidth * 0.66) + ) + // .frame(maxHeight: 400) + .frame(width: screenWidth, height: screenWidth * 0.66) + .applyNsfwOverlay(post.nsfw) + .clipped() } VStack(alignment: .leading, spacing: AppConstants.postAndCommentSpacing) {