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
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ extension GoalDetailReducer {
state.isPresentedProofPhoto = false
return .none

case let .proofPhoto(.delegate(.completedUploadPhoto(myPhotoLog, editedImageData: editedImageData))):
case let .proofPhoto(.delegate(.completedUploadPhoto(myPhotoLog, editedImageData))):
state.isPresentedProofPhoto = false
state.pendingEditedImageData = editedImageData
var myPhotoLog = myPhotoLog
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ extension ProofPhotoReducer {
.delegate(
.completedUploadPhoto(
myPhotoLog: myPhotoLog,
editedImageData: nil
editedImageData: imageData
)
)
)
Expand Down
20 changes: 11 additions & 9 deletions Projects/Feature/ProofPhoto/Sources/ProofPhotoView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ private extension ProofPhotoView {
var mainContent: some View {
VStack(spacing: 0) {
topBar
.padding(.trailing, 10)
titleText
.padding(.top, 25)
photoPreview
Expand All @@ -110,7 +111,9 @@ private extension ProofPhotoView {
store.send(.closeButtonTapped)
} label: {
Image.Icon.Symbol.closeM
.resizable()
.renderingMode(.template)
.frame(width: 24, height: 24)
.foregroundStyle(Color.Gray.gray100)
.frame(width: 44, height: 44)
}
Expand Down Expand Up @@ -179,14 +182,11 @@ private extension ProofPhotoView {

@ViewBuilder
var bottomControls: some View {
Group {
if store.hasImage {
uploadControls
} else {
captureControls
}
if store.hasImage {
uploadControls
} else {
captureControls
}
.frame(height: 74)
}

var captureControls: some View {
Expand Down Expand Up @@ -223,6 +223,7 @@ private extension ProofPhotoView {
.frame(width: 50)
}
.frame(maxWidth: .infinity)
.frame(height: 74)
}

var galleryButton: some View {
Expand Down Expand Up @@ -258,6 +259,7 @@ private extension ProofPhotoView {
.frame(width: 84, height: 84)
)
}
.frame(width: 84, height: 84)
.disabled(store.isCapturing)
}

Expand All @@ -278,7 +280,7 @@ private extension ProofPhotoView {
func previewContainer(
@ViewBuilder content: @escaping () -> some View
) -> some View {
let shape = RoundedRectangle(cornerRadius: 76)
let shape = RoundedRectangle(cornerRadius: 76, style: .continuous)

return Color.clear
.frame(maxWidth: .infinity)
Expand Down Expand Up @@ -314,7 +316,7 @@ private extension ProofPhotoView {
}
commentCircle
}
.padding(.bottom, 26)
.padding(.bottom, 28)
.frame(width: rectFrame.width, height: rectFrame.height, alignment: .bottom)
.offset(x: posX, y: posY)
.animation(.easeOut(duration: 0.25), value: keyboardInset)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public struct TXShadowButton: View {
var borderColor: Color = .clear
let borderWidth: CGFloat = 1.6
let shadowHeight: CGFloat = 70
let shadowTopPadding: CGFloat = 4
let shadowTopPadding: CGFloat = 6
let frameHeight: CGFloat = 74

var buttonWidth: CGFloat? {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public struct TXCommentCircle: View {
onFocused?(isFocused)
externalFocus?.wrappedValue = isFocused
}
.onChange(of: externalFocus?.wrappedValue) { newValue in
.onChange(of: externalFocus?.wrappedValue) { _, newValue in
guard let newValue, newValue != isFocused else { return }
isFocused = newValue
}
Expand All @@ -75,23 +75,15 @@ public struct TXCommentCircle: View {
// MARK: - SubViews
private extension TXCommentCircle {
var borderCircles: some View {
HStack(spacing: Constants.circleSpacing) {
ForEach(0..<Constants.maxCount, id: \.self) { _ in
Circle()
.outsideBorder(.black, shape: .circle, lineWidth: 2)
.frame(width: Constants.circleSize, height: Constants.circleSize)
}
}
mergedCircleBorderShape(lineWidth: Constants.borderLineWidth)
.fill(Color.black)
.frame(width: Constants.totalWidth, height: Constants.circleSize)
}

var fillCircles: some View {
HStack(spacing: Constants.circleSpacing) {
ForEach(0..<Constants.maxCount, id: \.self) { _ in
Circle()
.fill(Color.white)
.frame(width: Constants.circleSize, height: Constants.circleSize)
}
}
mergedCircleShape(inset: Constants.borderLineWidth)
.fill(Color.white)
.frame(width: Constants.totalWidth, height: Constants.circleSize)
}

var textCircles: some View {
Expand Down Expand Up @@ -138,15 +130,61 @@ private extension TXCommentCircle {
}
.allowsHitTesting(false)
}

func mergedCircleBorderShape(lineWidth: CGFloat) -> AnyShape {
let outer = mergedCircleShape(inset: 0)
let inner = mergedCircleShape(inset: lineWidth)
return AnyShape(outer.subtracting(inner))
}

func mergedCircleShape(inset: CGFloat) -> AnyShape {
let diameter = Constants.circleSize - (inset * 2)
let step = Constants.circleSize + Constants.circleSpacing
let baseCircle = AnyShape(
PositionedCircleShape(
posX: inset,
posY: inset,
diameter: diameter
)
)

var merged = baseCircle
for index in 1..<Constants.maxCount {
let offsetX = CGFloat(index) * step + inset
let nextCircle = AnyShape(
PositionedCircleShape(
posX: offsetX,
posY: inset,
diameter: diameter
)
)
merged = AnyShape(merged.union(nextCircle))
}

return merged
}
}

private enum Constants {
static let maxCount = 5
static let circleSize: CGFloat = 62
static let circleSize: CGFloat = 64
static let circleSpacing: CGFloat = -14
static let borderLineWidth: CGFloat = 1.6
static let totalWidth: CGFloat = (circleSize * CGFloat(maxCount))
+ (circleSpacing * CGFloat(maxCount - 1))
static let placeholder = Array("코멘트추가")
}

private struct PositionedCircleShape: Shape {
let posX: CGFloat
let posY: CGFloat
let diameter: CGFloat

func path(in rect: CGRect) -> Path {
Path(ellipseIn: CGRect(x: posX, y: posY, width: diameter, height: diameter))
}
}

#Preview {
@Previewable @State var text: String = ""
TXCommentCircle(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ public extension View {
.padding(.vertical, token.lineSpacing / 2)
.font(token.font.swiftUIFont(size: token.size))
.lineSpacing(token.lineSpacing)
.kerning(token.kerning)
.tracking(token.kerning)
}
}