From 5d9a65ee9fb078ca8bd5734539ab4ffdd1b2431f Mon Sep 17 00:00:00 2001 From: uunwon Date: Wed, 20 Nov 2024 19:38:03 +0900 Subject: [PATCH] =?UTF-8?q?Fix:=20=EC=82=AC=EC=A7=84=20=EC=A0=80=EC=9E=A5?= =?UTF-8?q?=20=ED=9B=84=20=EC=B2=B4=ED=81=AC=20=ED=91=9C=EC=8B=9C=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../View/LetterBox/PhotoDetailView.swift | 39 ++++++++++++++----- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/Kabinett/Presentation/View/LetterBox/PhotoDetailView.swift b/Kabinett/Presentation/View/LetterBox/PhotoDetailView.swift index 2024b23..44558a0 100644 --- a/Kabinett/Presentation/View/LetterBox/PhotoDetailView.swift +++ b/Kabinett/Presentation/View/LetterBox/PhotoDetailView.swift @@ -10,6 +10,9 @@ import Kingfisher struct PhotoDetailView: View { let photoUrl: String + let savedColor = Color(UIColor(red: 95/255, green: 239/255, blue: 155/255, alpha: 1)) + + @State private var isPhotoSaved: Bool = false @Environment(\.dismiss) private var dismiss var body: some View { @@ -26,15 +29,24 @@ struct PhotoDetailView: View { VStack { Spacer() Button(action: { - Task { - await savePhotoToAlbum() + if !isPhotoSaved { + Task { + await savePhotoToAlbum() + } } }) { - Image(systemName: "square.and.arrow.down") - .font(.system(size: 20, weight: .medium)) - .foregroundStyle(.white) + ZStack { + Circle() + .fill(isPhotoSaved ? savedColor : .contentPrimary) + .frame(width: isPhotoSaved ? 35 : 37) + + Image(systemName: isPhotoSaved ? "checkmark" : "square.and.arrow.down") + .font(.system(size: 20, weight: .medium)) + .foregroundStyle(isPhotoSaved ? .black : .white) + .padding(.bottom, isPhotoSaved ? 0 : 5) + } } - .padding(.bottom, 30) + .padding(.bottom, 10) } VStack { @@ -43,10 +55,16 @@ struct PhotoDetailView: View { Button(action: { dismiss() }) { - Image(systemName: "xmark") - .font(.system(size: 22, weight: .medium)) - .foregroundStyle(.white) - .padding(.trailing, 4) + ZStack { + Circle() + .fill(.contentPrimary) + .frame(width: 31, height: 31) + + Image(systemName: "xmark") + .font(.system(size: 16, weight: .medium)) + .foregroundStyle(.white) + } + .padding(.trailing, 4) } .padding() } @@ -63,6 +81,7 @@ struct PhotoDetailView: View { let (data, _) = try await URLSession.shared.data(from: url) if let image = UIImage(data: data) { UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil) + isPhotoSaved = true } else { print("이미지 변환에 실패했습니다.") }