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

Hacked images to be smooth for TF release #614

Merged
merged 2 commits into from
Sep 16, 2023
Merged
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion Mlem/Views/Shared/Links/Community/CommunityLinkView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ struct CommunityLinkView: View {
}

var body: some View {
NavigationLink(value: community) {
// NavigationLink(value: community) {
NavigationLink(.apiCommunity(community)) {
HStack {
CommunityLabelView(
community: community,
Expand Down
23 changes: 17 additions & 6 deletions Mlem/Views/Shared/Posts/Post Sizes/Large Post.swift
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,12 @@ struct LargePost: View {
}
}

// REMOVEME: needed for TF hack
@Environment(\.horizontalSizeClass) var horizontalSizeClass
var screenWidth: CGFloat = UIScreen.main.bounds.width - (AppConstants.postAndCommentSpacing * 2)
var imageWidth: CGFloat { horizontalSizeClass == .regular ? screenWidth * 0.8 : screenWidth }
var imageHeight: CGFloat { horizontalSizeClass == .regular ? 600 : screenWidth }

// initializer--used so we can set showNsfwFilterToggle to false when expanded or true when not
init(
post: PostModel,
Expand Down Expand Up @@ -202,15 +208,20 @@ 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: imageWidth, height: imageHeight),
dismissCallback: markPostAsRead,
cornerRadius: AppConstants.largeItemCornerRadius
)
.frame(
maxWidth: .infinity,
maxHeight: layoutMode.getMaxHeight(limitHeight),
alignment: .top
)
// CHANGEME: hack for TF release
.frame(height: imageHeight)
.frame(maxWidth: .infinity, alignment: .center)
// .frame(
// maxWidth: .infinity,
// maxHeight: layoutMode.getMaxHeight(limitHeight),
// alignment: .top
// )
.applyNsfwOverlay(post.post.nsfw || post.community.nsfw, canTapFullImage: isExpanded)
.clipped()
}
Expand Down
20 changes: 16 additions & 4 deletions Mlem/Views/Shared/Website Icon Complex.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,26 @@ struct WebsiteIconComplex: View {
}
return "some website"
}

// REMOVEME: needed for TF hack
@Environment(\.horizontalSizeClass) var horizontalSizeClass
var screenWidth: CGFloat = UIScreen.main.bounds.width - (AppConstants.postAndCommentSpacing * 2)
var imageWidth: CGFloat { horizontalSizeClass == .regular ? screenWidth * 0.8 : screenWidth }
var imageHeight: CGFloat { horizontalSizeClass == .regular ? 400 : screenWidth * 0.66 }

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: imageWidth, height: imageHeight)
)
// .frame(maxHeight: 400)
.frame(width: imageWidth, height: imageHeight)
.applyNsfwOverlay(post.nsfw)
.clipped()
}

VStack(alignment: .leading, spacing: AppConstants.postAndCommentSpacing) {
Expand Down