Skip to content
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
48 changes: 48 additions & 0 deletions Common/Sources/DesignSystem/AsyncThumbnailImage.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
//
// AsyncThumbnailImage.swift
// Common
//
// Created by 강동영 on 1/12/26.
//

import SwiftUI

public struct AsyncThumbnailImage: View {
private let imageURL: String?
private let width: CGFloat?
private let height: CGFloat?
private let cornerRadius: CGFloat

public init(
imageURL: String?,
width: CGFloat? = nil,
height: CGFloat? = nil,
cornerRadius: CGFloat = 8
) {
self.imageURL = imageURL
self.width = width
self.height = height
self.cornerRadius = cornerRadius
}

public var body: some View {
content
.frame(width: width, height: height)
.clipShape(RoundedRectangle(cornerRadius: cornerRadius))
}

@ViewBuilder
private var content: some View {
if let imageURL = imageURL,
!imageURL.isEmpty,
let url = URL(string: imageURL) {
AsyncImage(url: url) { phase in
if case .success(let image) = phase {
image
.resizable()
.aspectRatio(contentMode: .fill)
}
}
}
}
}
4 changes: 4 additions & 0 deletions Community/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ let package = Package(
name: Config.name,
targets: Config.allCases.map(\.name)
),
.library(
name: "CommunityDomain",
targets: ["CommunityDomain"]
),
],
dependencies: [
.package(name: "DI", path: "../DI"),
Expand Down
11 changes: 0 additions & 11 deletions Community/Sources/DI/CommunityDIContainer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,6 @@ struct CommunityWriteAssembly: Assembly {
struct CommunityAssembly: Assembly {

func assemble(container: GenericDIContainer) {
// NetworkService registration (only for mock mode)
// In normal mode, NetworkService comes from parent container
// if isMock {
// container.register(NetworkServiceInterface.self) { _ in
// let config = URLSessionConfiguration.ephemeral
// config.protocolClasses = [CommunityURLProtocol.self]
// setupURLProtocol()
// return NetworkServiceImpl(configuration: config)
// }
// }

// APIClient registration
container.register(CommunityAPIClientInterface.self) { resolver in
// if self.isMock {
Expand Down
44 changes: 3 additions & 41 deletions Community/Sources/Presentation/Community/CommunityView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ fileprivate struct CommunityPostListCard: View {
.pretendard(.caption(.base))
.foregroundColor(Color.textG600)

Image(.communityComment)
Image(.communityCommentFill)
.resizable()
.frame(width: 12, height: 12)

Expand Down Expand Up @@ -419,7 +419,7 @@ fileprivate struct CommunityPostFeedCard: View {
.pretendard(.caption(.base))
.foregroundColor(Color.textG600)

Image(.communityComment)
Image(.communityCommentFill)
.resizable()
.frame(width: 12, height: 12)

Expand All @@ -443,42 +443,4 @@ fileprivate struct CommunityPostFeedCard: View {
}
}

struct AsyncThumbnailImage: View {
private let imageURL: String?
private let width: CGFloat?
private let height: CGFloat?
private let cornerRadius: CGFloat

init(
imageURL: String?,
width: CGFloat? = nil,
height: CGFloat? = nil,
cornerRadius: CGFloat = 8
) {
self.imageURL = imageURL
self.width = width
self.height = height
self.cornerRadius = cornerRadius
}

var body: some View {
content
.frame(width: width, height: height)
.clipShape(RoundedRectangle(cornerRadius: cornerRadius))
}

@ViewBuilder
private var content: some View {
if let imageURL = imageURL,
!imageURL.isEmpty,
let url = URL(string: imageURL) {
AsyncImage(url: url) { phase in
if case .success(let image) = phase {
image
.resizable()
.aspectRatio(contentMode: .fill)
}
}
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ public struct CommunityDetailView: View {
}

HStack(spacing: 4) {
Image(.communityComment)
Image(.communityCommentFill)
.resizable()
.frame(width: 20, height: 20)

Expand Down
4 changes: 4 additions & 0 deletions Hambug.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,8 @@
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = Hambug/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = "햄버그";
INFOPLIST_KEY_ITSAppUsesNonExemptEncryption = NO;
"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphoneos*]" = YES;
"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphonesimulator*]" = YES;
"INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphoneos*]" = YES;
Expand Down Expand Up @@ -543,6 +545,8 @@
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = Hambug/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = "햄버그";
INFOPLIST_KEY_ITSAppUsesNonExemptEncryption = NO;
"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphoneos*]" = YES;
"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphonesimulator*]" = YES;
"INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphoneos*]" = YES;
Expand Down
3 changes: 2 additions & 1 deletion Hambug/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ struct ContentView: View {

NavigationStack {
MyPageView(
viewModel: mypageDIContainer.makeMyPageViewModel()
viewModel: mypageDIContainer.makeMyPageViewModel(),
activitesFactory: mypageDIContainer
)
}
.tag(2)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,81 +1,10 @@
{
"images" : [
{
"filename" : "app_icon-1024x1024 2.png",
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "tinted"
}
],
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
},
{
"idiom" : "mac",
"scale" : "1x",
"size" : "16x16"
},
{
"idiom" : "mac",
"scale" : "2x",
"size" : "16x16"
},
{
"idiom" : "mac",
"scale" : "1x",
"size" : "32x32"
},
{
"idiom" : "mac",
"scale" : "2x",
"size" : "32x32"
},
{
"idiom" : "mac",
"scale" : "1x",
"size" : "128x128"
},
{
"idiom" : "mac",
"scale" : "2x",
"size" : "128x128"
},
{
"idiom" : "mac",
"scale" : "1x",
"size" : "256x256"
},
{
"idiom" : "mac",
"scale" : "2x",
"size" : "256x256"
},
{
"idiom" : "mac",
"scale" : "1x",
"size" : "512x512"
},
{
"idiom" : "mac",
"scale" : "2x",
"size" : "512x512"
}
],
"info" : {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "community_comment_fill.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion Home/Sources/Data/DTO/TrendingPostResponse.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import Foundation
import HomeDomain
import Util
import CommunityDomain

public struct TrendingPostResponse: Decodable, Sendable {
public let id: Int
Expand All @@ -33,7 +34,7 @@ extension TrendingPostResponse {
id: id,
title: title,
content: content,
category: category,
category: BoardCategory(rawValue: category) ?? .freeTalk,
imageUrls: imageUrls,
authorNickname: authorNickname,
authorId: authorId,
Expand Down
39 changes: 20 additions & 19 deletions Home/Sources/Domain/Entities/TrendingPost.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
//

import Foundation
import CommunityDomain

public struct TrendingPost: Identifiable, Equatable, Sendable {
public let id: Int
public let title: String
public let content: String
public let category: String
public let category: BoardCategory
public let imageUrls: [String]
public let authorNickname: String
public let authorId: Int
Expand Down Expand Up @@ -39,28 +40,28 @@ public struct TrendingPost: Identifiable, Equatable, Sendable {
id: Int,
title: String,
content: String,
category: String,
category: BoardCategory,
imageUrls: [String],
authorNickname: String,
authorId: Int,
createdAt: Date,
updatedAt: Date,
viewCount: Int,
likeCount: Int, commentCount: Int, isLiked: Bool) {
self.id = id
self.title = title
self.content = content
self.category = category
self.imageUrls = imageUrls
self.authorNickname = authorNickname
self.authorId = authorId
self.createdAt = createdAt
self.updatedAt = updatedAt
self.viewCount = viewCount
self.likeCount = likeCount
self.commentCount = commentCount
self.isLiked = isLiked
}
self.id = id
self.title = title
self.content = content
self.category = category
self.imageUrls = imageUrls
self.authorNickname = authorNickname
self.authorId = authorId
self.createdAt = createdAt
self.updatedAt = updatedAt
self.viewCount = viewCount
self.likeCount = likeCount
self.commentCount = commentCount
self.isLiked = isLiked
}
}

// MARK: - Sample Data
Expand All @@ -72,7 +73,7 @@ extension TrendingPost {
id: 1,
title: "맥도날드 신메뉴 후기",
content: "새로 나온 버거가 진짜 맛있어요!",
category: "리뷰",
category: .review,
imageUrls: ["https://via.placeholder.com/400x300"],
authorNickname: "햄버거러버",
authorId: 101,
Expand All @@ -87,7 +88,7 @@ extension TrendingPost {
id: 2,
title: "버거킹 할인 정보",
content: "이번 주 버거킹 2+1 행사!",
category: "자유게시판",
category: .freeTalk,
imageUrls: ["https://via.placeholder.com/400x300"],
authorNickname: "버거헌터",
authorId: 102,
Expand All @@ -102,7 +103,7 @@ extension TrendingPost {
id: 3,
title: "수제버거 맛집 추천",
content: "홍대 근처 숨은 맛집 발견했어요",
category: "추천",
category: .recommendation,
imageUrls: ["https://via.placeholder.com/400x300"],
authorNickname: "맛집탐험가",
authorId: 103,
Expand Down
Loading
Loading