Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
Sjmarf committed Jan 12, 2024
1 parent 0672654 commit 0199890
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions Mlem/Views/Shared/Cached Image.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ struct CachedImage: View {
let maxHeight: CGFloat
let screenWidth: CGFloat
let contentMode: ContentMode
let blurRadius: CGFloat
let cornerRadius: CGFloat
let errorBackgroundColor: Color

Expand All @@ -40,6 +41,7 @@ struct CachedImage: View {
fixedSize: CGSize? = nil,
imageNotFound: @escaping () -> AnyView = imageNotFoundDefault,
errorBackgroundColor: Color = Color(uiColor: .systemGray4),
blurRadius: CGFloat = 0,
contentMode: ContentMode = .fit,
onTapCallback: (() -> Void)? = nil,
cornerRadius: CGFloat? = nil
Expand All @@ -49,6 +51,7 @@ struct CachedImage: View {
self.maxHeight = maxHeight
self.imageNotFound = imageNotFound
self.errorBackgroundColor = errorBackgroundColor
self.blurRadius = blurRadius
self.contentMode = contentMode
self.onTapCallback = onTapCallback
self.cornerRadius = cornerRadius ?? 0
Expand Down Expand Up @@ -88,6 +91,7 @@ struct CachedImage: View {
.aspectRatio(contentMode: contentMode)
.cornerRadius(cornerRadius)
.frame(idealWidth: size.width, maxHeight: size.height)
.blur(radius: blurRadius)
.clipped()
.allowsHitTesting(false)
.overlay(alignment: .top) {
Expand Down
4 changes: 2 additions & 2 deletions Mlem/Views/Shared/Components/Thumbnail Image View.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,16 @@ struct ThumbnailImageView: View {
CachedImage(
url: url,
fixedSize: size,
blurRadius: showNsfwFilter ? 8 : 0,
contentMode: .fill,
onTapCallback: markPostAsRead
)
.blur(radius: showNsfwFilter ? 8 : 0)
case let .link(url):
CachedImage(
url: url,
shouldExpand: false,
fixedSize: size,
blurRadius: showNsfwFilter ? 8 : 0,
contentMode: .fill
)
.onTapGesture {
Expand All @@ -48,7 +49,6 @@ struct ThumbnailImageView: View {
markPostAsRead()
}
}
.blur(radius: showNsfwFilter ? 8 : 0)
.overlay {
Group {
WebsiteIndicatorView()
Expand Down
2 changes: 1 addition & 1 deletion Mlem/Views/Shared/Links/AvatarView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,11 @@ struct AvatarView: View {
shouldExpand: false,
fixedSize: CGSize(width: avatarSize, height: avatarSize),
imageNotFound: { AnyView(DefaultAvatarView(avatarType: type)) },
blurRadius: blurAvatar ? 4 : 0,
contentMode: .fill
)
.frame(width: avatarSize, height: avatarSize)
.accessibilityHidden(true)
.blur(radius: blurAvatar ? 4 : 0)
.clipShape(Circle())
.overlay(Circle()
.stroke(
Expand Down
4 changes: 2 additions & 2 deletions Mlem/Views/Tabs/Search/Results/CommunityResultView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ struct CommunityResultView: View {

var title: String {
if community.blocked ?? false {
return "\(community.name) ∙ Blocked"
return "\(community.name!) ∙ Blocked"
} else if community.nsfw {
return "\(community.name) ∙ NSFW"
return "\(community.name!) ∙ NSFW"
} else {
return community.name
}
Expand Down

0 comments on commit 0199890

Please sign in to comment.