feat(chat-room): 채팅방에서 메시지 보내기 API 연동

- 타이핑 indicator 동작하지 않던 버그 수정
- 이미지 4:5 비율로 보이도록 수정
This commit is contained in:
Yu Sung
2025-09-04 05:10:32 +09:00
parent 2576c851ee
commit 6ce85a485a
4 changed files with 90 additions and 19 deletions

View File

@@ -93,16 +93,13 @@ struct AiMessageItemView: View {
let maxWidth = (UIScreen.main.bounds.width - 48) * 0.7
let imageHeight = maxWidth * 5 / 4 // 4:5
KFImage(URL(string: imageUrl))
.placeholder {
Rectangle()
.fill(Color.gray.opacity(0.3))
.frame(width: maxWidth, height: imageHeight)
}
.resizable()
.aspectRatio(4/5, contentMode: .fit)
.frame(width: maxWidth, height: imageHeight)
.cornerRadius(10)
ZStack {
KFImage(URL(string: imageUrl))
.resizable()
.scaledToFill() //
}
.frame(width: maxWidth, height: imageHeight)
.clipShape(RoundedRectangle(cornerRadius: 10, style: .continuous))
} else {
//
HStack(spacing: 10) {

View File

@@ -10,10 +10,13 @@ import Kingfisher
struct TypingIndicatorItemView: View {
var dotCount: Int = 3
var size: CGFloat = 6
var size: CGFloat = 8
var spacing: CGFloat = 6
var color: Color = .secondary
var period: Double = 1.2 //
var color: Color = .primary
/// ( , )
var period: Double = 1.2
/// ()
var phaseStep: Double = 0.7
let characterName: String
let characterProfileUrl: String
@@ -40,17 +43,22 @@ struct TypingIndicatorItemView: View {
HStack(spacing: 10) {
TimelineView(.animation) { context in
let t = context.date.timeIntervalSinceReferenceDate
let base = (t.truncatingRemainder(dividingBy: period)) / period
HStack(spacing: spacing) {
ForEach(0..<dotCount, id: \.self) { i in
let angle = base * 2 * .pi - Double(i) * phaseStep
// 0...1
let wave = (sin(angle) + 1) / 2
Circle()
.fill(color)
.frame(width: size, height: size)
.opacity(opacity(for: i, time: t))
.scaleEffect(0.7 + 0.3 * wave) // 0.7 ~ 1.0
.opacity(0.35 + 0.65 * wave) // 0.35 ~ 1.0
.accessibilityHidden(true)
}
}
//
.animation(.easeInOut(duration: period / Double(dotCount)).repeatForever(autoreverses: true), value: context.date)
}
.accessibilityLabel(Text("입력 중"))
}
.padding(.horizontal, 10)
.padding(.vertical, 8)