diff --git a/Mlem/Views/Shared/Cached Image.swift b/Mlem/Views/Shared/Cached Image.swift index 5190651cf..a91c19232 100644 --- a/Mlem/Views/Shared/Cached Image.swift +++ b/Mlem/Views/Shared/Cached Image.swift @@ -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 @@ -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 @@ -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 @@ -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) { diff --git a/Mlem/Views/Shared/Components/Thumbnail Image View.swift b/Mlem/Views/Shared/Components/Thumbnail Image View.swift index a8faaf881..8b0e418a1 100644 --- a/Mlem/Views/Shared/Components/Thumbnail Image View.swift +++ b/Mlem/Views/Shared/Components/Thumbnail Image View.swift @@ -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 { @@ -48,7 +49,6 @@ struct ThumbnailImageView: View { markPostAsRead() } } - .blur(radius: showNsfwFilter ? 8 : 0) .overlay { Group { WebsiteIndicatorView() diff --git a/Mlem/Views/Shared/Links/AvatarView.swift b/Mlem/Views/Shared/Links/AvatarView.swift index d8a48ae6d..e8cde5ecb 100644 --- a/Mlem/Views/Shared/Links/AvatarView.swift +++ b/Mlem/Views/Shared/Links/AvatarView.swift @@ -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( diff --git a/Mlem/Views/Tabs/Search/Results/CommunityResultView.swift b/Mlem/Views/Tabs/Search/Results/CommunityResultView.swift index 6891f59e3..60de04a62 100644 --- a/Mlem/Views/Tabs/Search/Results/CommunityResultView.swift +++ b/Mlem/Views/Tabs/Search/Results/CommunityResultView.swift @@ -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 }