From 84c53d01b1a0981ee5125a78bf278eb585064396 Mon Sep 17 00:00:00 2001 From: song Date: Tue, 31 Dec 2024 15:08:40 +0900 Subject: [PATCH 01/21] =?UTF-8?q?Feat:=20=EC=8A=A4=ED=81=AC=EB=A1=A4=20?= =?UTF-8?q?=EB=92=A4=EC=97=90=20=EC=B2=A8=EB=B6=80=EB=90=9C=20=EC=82=AC?= =?UTF-8?q?=EC=A7=84=EC=9D=B4=20=EB=B3=B4=EC=9D=BC=20=EC=88=98=20=EC=9E=88?= =?UTF-8?q?=EA=B2=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../View/WriteLetter/ContentWriteView.swift | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Kabinett/Presentation/View/WriteLetter/ContentWriteView.swift b/Kabinett/Presentation/View/WriteLetter/ContentWriteView.swift index 1ec1adb..3ed41ee 100644 --- a/Kabinett/Presentation/View/WriteLetter/ContentWriteView.swift +++ b/Kabinett/Presentation/View/WriteLetter/ContentWriteView.swift @@ -39,7 +39,7 @@ struct ContentWriteView: View { } ZStack(alignment: .top) { VStack { - ScrollableLetterView(letterContent: $letterContent, viewModel: viewModel, currentIndex: $viewModel.currentIndex) + ScrollableLetterView(letterContent: $letterContent, viewModel: viewModel, imageViewModel: imageViewModel, currentIndex: $viewModel.currentIndex) .font(FontUtility.selectedFont(font: letterContent.fontString ?? "", size: 14)) Text("\(viewModel.currentIndex+1) / \(viewModel.texts.count)") @@ -218,6 +218,7 @@ struct ScrollableLetterView: View { @Binding var letterContent: LetterWriteModel @ObservedObject var viewModel: ContentWriteViewModel + @ObservedObject var imageViewModel: ImagePickerViewModel @Binding var currentIndex: Int var body: some View { @@ -280,6 +281,14 @@ struct ScrollableLetterView: View { .anchorPreference(key: AnchorsKey.self, value: .trailing, transform: { [i: $0] }) } } + ForEach(imageViewModel.photoContents.indices, id: \.self) { index in + if let uiImage = UIImage(data: imageViewModel.photoContents[index]) { + Image(uiImage: uiImage) + .resizable() + .aspectRatio(contentMode: .fit) + .tag(index) + } + } } .padding(.horizontal, UIScreen.main.bounds.width * 0.06) } From 3c9778238653d8dcaaf075b105506ca3b4c871ca Mon Sep 17 00:00:00 2001 From: song Date: Tue, 31 Dec 2024 17:54:23 +0900 Subject: [PATCH 02/21] =?UTF-8?q?Fix:=20=ED=95=84=EC=9A=94=EC=97=86?= =?UTF-8?q?=EB=8A=94=20VStack=20=EC=A7=80=EC=9A=B0=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../View/WriteLetter/ContentWriteView.swift | 94 +++++++++---------- 1 file changed, 46 insertions(+), 48 deletions(-) diff --git a/Kabinett/Presentation/View/WriteLetter/ContentWriteView.swift b/Kabinett/Presentation/View/WriteLetter/ContentWriteView.swift index 3ed41ee..856114e 100644 --- a/Kabinett/Presentation/View/WriteLetter/ContentWriteView.swift +++ b/Kabinett/Presentation/View/WriteLetter/ContentWriteView.swift @@ -226,61 +226,59 @@ struct ScrollableLetterView: View { ScrollViewReader { scrollViewProxy in ZStack(alignment: .top) { ScrollView(.horizontal, showsIndicators: false) { - LazyHStack(spacing: UIScreen.main.bounds.width * 0.04) { + LazyHStack(alignment: .top, spacing: UIScreen.main.bounds.width * 0.04) { ForEach(0.. Date: Tue, 31 Dec 2024 17:57:21 +0900 Subject: [PATCH 03/21] =?UTF-8?q?Feat:=20=EC=82=AC=EC=A7=84=20=ED=8F=B4?= =?UTF-8?q?=EB=9D=BC=EC=9D=B4=EB=93=9C=20=ED=98=95=ED=83=9C=EB=A1=9C=20?= =?UTF-8?q?=EB=A7=8C=EB=93=A4=EA=B8=B0=20(=EC=95=84=EC=A7=81=20=EB=94=94?= =?UTF-8?q?=EC=9E=90=EC=9D=B8=20=EC=88=98=EC=A0=95=ED=95=B4=EC=95=BC?= =?UTF-8?q?=ED=95=A8)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Presentation/View/WriteLetter/ContentWriteView.swift | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Kabinett/Presentation/View/WriteLetter/ContentWriteView.swift b/Kabinett/Presentation/View/WriteLetter/ContentWriteView.swift index 856114e..50ef1ed 100644 --- a/Kabinett/Presentation/View/WriteLetter/ContentWriteView.swift +++ b/Kabinett/Presentation/View/WriteLetter/ContentWriteView.swift @@ -284,7 +284,14 @@ struct ScrollableLetterView: View { Image(uiImage: uiImage) .resizable() .aspectRatio(contentMode: .fit) - .tag(index) + .padding(.horizontal, UIScreen.main.bounds.width * 0.1) + .padding(.vertical, UIScreen.main.bounds.width * 0.2) + .background(Color.white) + .frame(width: UIScreen.main.bounds.width * 0.88) + .cornerRadius(10) + .padding(.top, 10) + .tag(index + viewModel.texts.count) + .anchorPreference(key: AnchorsKey.self, value: .trailing, transform: { [index + viewModel.texts.count: $0] }) } } } From c4cf29359f7edb4a0146d8e6cd1a376caf754eeb Mon Sep 17 00:00:00 2001 From: song Date: Tue, 31 Dec 2024 17:57:44 +0900 Subject: [PATCH 04/21] =?UTF-8?q?Fix:=20=ED=8E=B8=EC=A7=80=EC=A7=80=20?= =?UTF-8?q?=EC=9C=84=EC=97=90=EC=84=9C=EB=A7=8C=20=EB=AF=B8=EB=8B=88?= =?UTF-8?q?=ED=88=B4=EB=B0=94=20=EB=B3=B4=EC=9D=B4=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../View/WriteLetter/ContentWriteView.swift | 124 +++++++++--------- 1 file changed, 63 insertions(+), 61 deletions(-) diff --git a/Kabinett/Presentation/View/WriteLetter/ContentWriteView.swift b/Kabinett/Presentation/View/WriteLetter/ContentWriteView.swift index 50ef1ed..73f9d41 100644 --- a/Kabinett/Presentation/View/WriteLetter/ContentWriteView.swift +++ b/Kabinett/Presentation/View/WriteLetter/ContentWriteView.swift @@ -142,72 +142,74 @@ struct MiniTabBar: View { @State var isFontEdit: Bool = true var body: some View { - HStack(alignment: .center) { - Button { - isPopup.toggle() - } label: { - Text("F") - .bold() - .frame(width: UIScreen.main.bounds.width * 0.4/4, height: 30) - .background(isFontEdit ? Color.clear : Color(.primary300)) - .clipShape(Capsule()) - } - .disabled(isFontEdit ? false : true) - .onChange(of: viewModel.texts) { - if viewModel.texts[0].isEmpty && viewModel.texts.count == 1 { - isFontEdit = true - } else { - isFontEdit = false + if viewModel.currentIndex < viewModel.texts.count { + HStack(alignment: .center) { + Button { + isPopup.toggle() + } label: { + Text("F") + .bold() + .frame(width: UIScreen.main.bounds.width * 0.4/4, height: 30) + .background(isFontEdit ? Color.clear : Color(.primary300)) + .clipShape(Capsule()) } - } - - Button { - if viewModel.texts.count > 1 { - viewModel.isDeleteAlertPresented = true + .disabled(isFontEdit ? false : true) + .onChange(of: viewModel.texts) { + if viewModel.texts[0].isEmpty && viewModel.texts.count == 1 { + isFontEdit = true + } else { + isFontEdit = false + } } - } label: { - Image("PageMinus") - .font(.system(size: 15)) - .frame(width: UIScreen.main.bounds.width * 0.4/4) - } - .alert(isPresented: $viewModel.isDeleteAlertPresented) { - Alert( - title: Text("Delete Page"), - message: Text("현재 페이지를 지우시겠어요?"), - primaryButton: .destructive(Text("삭제")) { - viewModel.deleteLetter(idx: viewModel.currentIndex) - }, - secondaryButton: .cancel(Text("취소")) { - viewModel.isDeleteAlertPresented = false + + Button { + if viewModel.texts.count > 1 { + viewModel.isDeleteAlertPresented = true } - ) - } - Button { - viewModel.createNewLetter(idx: viewModel.currentIndex) - } label: { - Image(systemName: "doc.badge.plus") - .font(.system(size: 15)) - .frame(width: UIScreen.main.bounds.width * 0.4/4) - } - Button { - customTabViewModel.showPhotoLibrary = true - customTabViewModel.isLetterWrite = true - } label: { - Image(systemName: "photo.on.rectangle.angled") - .font(.system(size: 15)) - .frame(width: UIScreen.main.bounds.width * 0.4/4, height: 30) - .background(letterContent.photoContents.isEmpty ? Color.clear : Color.white) - .foregroundStyle(letterContent.photoContents.isEmpty ? Color("ToolBarIcon") : Color(.primary900)) - .clipShape(Capsule()) - .shadow(color: letterContent.photoContents.isEmpty ? Color.clear : Color(.primary300), radius: 7, x: 3, y: 3) + } label: { + Image("PageMinus") + .font(.system(size: 15)) + .frame(width: UIScreen.main.bounds.width * 0.4/4) + } + .alert(isPresented: $viewModel.isDeleteAlertPresented) { + Alert( + title: Text("Delete Page"), + message: Text("현재 페이지를 지우시겠어요?"), + primaryButton: .destructive(Text("삭제")) { + viewModel.deleteLetter(idx: viewModel.currentIndex) + }, + secondaryButton: .cancel(Text("취소")) { + viewModel.isDeleteAlertPresented = false + } + ) + } + Button { + viewModel.createNewLetter(idx: viewModel.currentIndex) + } label: { + Image(systemName: "doc.badge.plus") + .font(.system(size: 15)) + .frame(width: UIScreen.main.bounds.width * 0.4/4) + } + Button { + customTabViewModel.showPhotoLibrary = true + customTabViewModel.isLetterWrite = true + } label: { + Image(systemName: "photo.on.rectangle.angled") + .font(.system(size: 15)) + .frame(width: UIScreen.main.bounds.width * 0.4/4, height: 30) + .background(letterContent.photoContents.isEmpty ? Color.clear : Color.white) + .foregroundStyle(letterContent.photoContents.isEmpty ? Color("ToolBarIcon") : Color(.primary900)) + .clipShape(Capsule()) + .shadow(color: letterContent.photoContents.isEmpty ? Color.clear : Color(.primary300), radius: 7, x: 3, y: 3) + } } + .frame(maxWidth: UIScreen.main.bounds.width * 0.5, maxHeight: 40) + .foregroundStyle(Color("ToolBarIcon")) + .background(Color(.primary100)) + .clipShape(Capsule()) + .shadow(color: Color(.primary300), radius: 5, x: 3, y: 3) + .padding(.top, -10) } - .frame(maxWidth: UIScreen.main.bounds.width * 0.5, maxHeight: 40) - .foregroundStyle(Color("ToolBarIcon")) - .background(Color(.primary100)) - .clipShape(Capsule()) - .shadow(color: Color(.primary300), radius: 5, x: 3, y: 3) - .padding(.top, -10) } } From b2191418d93d4fc39139442ca1cc47a736c8a6b5 Mon Sep 17 00:00:00 2001 From: song Date: Tue, 31 Dec 2024 18:05:36 +0900 Subject: [PATCH 05/21] =?UTF-8?q?Fix:=20=EC=8A=A4=ED=81=AC=EB=A1=A4?= =?UTF-8?q?=EC=9D=84=20=ED=95=B4=EB=8F=84=20=EC=9D=B8=EC=8B=9D=EC=9D=B4=20?= =?UTF-8?q?=EC=95=88=EB=90=98=EB=8A=94=20=EB=AC=B8=EC=A0=9C=20=ED=95=B4?= =?UTF-8?q?=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../View/WriteLetter/ContentWriteView.swift | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Kabinett/Presentation/View/WriteLetter/ContentWriteView.swift b/Kabinett/Presentation/View/WriteLetter/ContentWriteView.swift index 73f9d41..d1d0562 100644 --- a/Kabinett/Presentation/View/WriteLetter/ContentWriteView.swift +++ b/Kabinett/Presentation/View/WriteLetter/ContentWriteView.swift @@ -308,15 +308,17 @@ struct ScrollableLetterView: View { } } .onPreferenceChange(AnchorsKey.self) { anchors in + let horizontalPadding = UIScreen.main.bounds.width * 0.06 let leadingAnchor = anchors - .filter { geometry[$0.value].x >= 0 } + .filter { geometry[$0.value].x >= horizontalPadding } .sorted { geometry[$0.value].x < geometry[$1.value].x } .first - - if currentIndex != leadingAnchor?.key ?? 0 { - currentIndex = leadingAnchor?.key ?? 0 + + if let leadingAnchor = leadingAnchor, currentIndex != leadingAnchor.key { + currentIndex = leadingAnchor.key } } + } } } From 6016c73366da43a9c1769030f00670d549af860b Mon Sep 17 00:00:00 2001 From: song Date: Tue, 31 Dec 2024 18:06:44 +0900 Subject: [PATCH 06/21] =?UTF-8?q?Refactor:=20=EC=BD=94=EB=93=9C=EC=A0=95?= =?UTF-8?q?=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Presentation/View/WriteLetter/ContentWriteView.swift | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Kabinett/Presentation/View/WriteLetter/ContentWriteView.swift b/Kabinett/Presentation/View/WriteLetter/ContentWriteView.swift index d1d0562..f6d8891 100644 --- a/Kabinett/Presentation/View/WriteLetter/ContentWriteView.swift +++ b/Kabinett/Presentation/View/WriteLetter/ContentWriteView.swift @@ -280,8 +280,9 @@ struct ScrollableLetterView: View { .id(i) .anchorPreference(key: AnchorsKey.self, value: .trailing, transform: { [i: $0] }) } - - ForEach(imageViewModel.photoContents.indices, id: \.self) { index in + + ForEach(0.. Date: Tue, 31 Dec 2024 18:12:43 +0900 Subject: [PATCH 07/21] =?UTF-8?q?Fix:=20=ED=8E=B8=EC=A7=80=EA=B0=80=20?= =?UTF-8?q?=EB=B9=84=EC=96=B4=EC=9E=88=EB=8A=94=EB=8D=B0=20=EC=97=AC?= =?UTF-8?q?=EB=9F=AC=EC=9E=A5=20=EC=9E=88=EB=8B=A4=EB=8A=94=20=EC=9D=B4?= =?UTF-8?q?=EC=9C=A0=EB=A1=9C=20=ED=8F=B0=ED=8A=B8=EB=A5=BC=20=EB=B0=94?= =?UTF-8?q?=EA=BF=80=20=EC=88=98=20=EC=97=86=EC=9D=8C=20->=20=ED=8E=B8?= =?UTF-8?q?=EC=A7=80=EA=B0=80=20=EB=8B=A4=20=EB=B9=84=EC=96=B4=EC=9E=88?= =?UTF-8?q?=EC=9C=BC=EB=A9=B4=20=EC=88=98=EC=A0=95=EA=B0=80=EB=8A=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Presentation/View/WriteLetter/ContentWriteView.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Kabinett/Presentation/View/WriteLetter/ContentWriteView.swift b/Kabinett/Presentation/View/WriteLetter/ContentWriteView.swift index f6d8891..7ea7de0 100644 --- a/Kabinett/Presentation/View/WriteLetter/ContentWriteView.swift +++ b/Kabinett/Presentation/View/WriteLetter/ContentWriteView.swift @@ -155,10 +155,10 @@ struct MiniTabBar: View { } .disabled(isFontEdit ? false : true) .onChange(of: viewModel.texts) { - if viewModel.texts[0].isEmpty && viewModel.texts.count == 1 { - isFontEdit = true - } else { + if viewModel.texts.contains(where: { !$0.isEmpty }) { isFontEdit = false + } else { + isFontEdit = true } } From 5aba873d5a376d7c9ca0bd837b6e951ce8ad3181 Mon Sep 17 00:00:00 2001 From: song Date: Tue, 31 Dec 2024 18:22:22 +0900 Subject: [PATCH 08/21] =?UTF-8?q?Fix:=20=ED=8E=98=EC=9D=B4=EC=A7=80=20?= =?UTF-8?q?=EB=B3=B4=EC=97=AC=EC=A3=BC=EB=8A=94=20=EB=B6=80=EB=B6=84=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Presentation/View/WriteLetter/ContentWriteView.swift | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Kabinett/Presentation/View/WriteLetter/ContentWriteView.swift b/Kabinett/Presentation/View/WriteLetter/ContentWriteView.swift index 7ea7de0..836c803 100644 --- a/Kabinett/Presentation/View/WriteLetter/ContentWriteView.swift +++ b/Kabinett/Presentation/View/WriteLetter/ContentWriteView.swift @@ -42,7 +42,11 @@ struct ContentWriteView: View { ScrollableLetterView(letterContent: $letterContent, viewModel: viewModel, imageViewModel: imageViewModel, currentIndex: $viewModel.currentIndex) .font(FontUtility.selectedFont(font: letterContent.fontString ?? "", size: 14)) - Text("\(viewModel.currentIndex+1) / \(viewModel.texts.count)") + Text("\(viewModel.currentIndex+1) / \(viewModel.texts.count+imageViewModel.photoContents.count)") + .padding(2) + .padding(.horizontal, 5) + .background(Color.gray) + .clipShape(Capsule()) } MiniTabBar(letterContent: $letterContent, viewModel: viewModel, customTabViewModel: customTabViewModel, isPopup: $isPopup) } From 778264e7db6644637eeffa11013786c1f46cbf60 Mon Sep 17 00:00:00 2001 From: song Date: Tue, 31 Dec 2024 18:23:34 +0900 Subject: [PATCH 09/21] =?UTF-8?q?Refactor:=20=EB=85=B8=EB=9E=80=EC=83=89?= =?UTF-8?q?=20=EA=B2=BD=EA=B3=A0=EA=B0=80=20=EB=96=A0=EC=84=9C=20=EC=B5=9C?= =?UTF-8?q?=EC=8B=A0=EA=BB=84=EB=A1=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Kabinett/Presentation/View/WriteLetter/ContentWriteView.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Kabinett/Presentation/View/WriteLetter/ContentWriteView.swift b/Kabinett/Presentation/View/WriteLetter/ContentWriteView.swift index 836c803..ef44dff 100644 --- a/Kabinett/Presentation/View/WriteLetter/ContentWriteView.swift +++ b/Kabinett/Presentation/View/WriteLetter/ContentWriteView.swift @@ -128,7 +128,7 @@ struct CustomFontMenu: View { .padding(7) .frame(width: 250) .background(Color.white) - .cornerRadius(10) + .clipShape(RoundedRectangle(cornerRadius: 10)) .padding(.top, -(UIScreen.main.bounds.height/2.7)) .shadow(color: Color(.primary300), radius: 5, x: 3, y: 3) } @@ -295,7 +295,7 @@ struct ScrollableLetterView: View { .padding(.vertical, UIScreen.main.bounds.width * 0.2) .background(Color.white) .frame(width: UIScreen.main.bounds.width * 0.88) - .cornerRadius(10) + .clipShape(RoundedRectangle(cornerRadius: 10)) .padding(.top, 10) .tag(imageIndex) .anchorPreference(key: AnchorsKey.self, value: .trailing, transform: { [imageIndex: $0] }) From 5c6ac15a15497c4483c938f4e26afee0968049b6 Mon Sep 17 00:00:00 2001 From: song Date: Fri, 3 Jan 2025 19:21:05 +0900 Subject: [PATCH 10/21] =?UTF-8?q?Design:=20=ED=8F=B4=EB=9D=BC=EB=A1=9C?= =?UTF-8?q?=EC=9D=B4=EB=93=9C=20=EC=82=AC=EC=A7=84=20=ED=98=95=ED=83=9C?= =?UTF-8?q?=EB=A1=9C=20=EB=94=94=EC=9E=90=EC=9D=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Presentation/View/WriteLetter/ContentWriteView.swift | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Kabinett/Presentation/View/WriteLetter/ContentWriteView.swift b/Kabinett/Presentation/View/WriteLetter/ContentWriteView.swift index ef44dff..7afcada 100644 --- a/Kabinett/Presentation/View/WriteLetter/ContentWriteView.swift +++ b/Kabinett/Presentation/View/WriteLetter/ContentWriteView.swift @@ -290,9 +290,11 @@ struct ScrollableLetterView: View { if let uiImage = UIImage(data: imageViewModel.photoContents[index]) { Image(uiImage: uiImage) .resizable() + .clipShape(RoundedRectangle(cornerRadius: 10)) .aspectRatio(contentMode: .fit) - .padding(.horizontal, UIScreen.main.bounds.width * 0.1) - .padding(.vertical, UIScreen.main.bounds.width * 0.2) + .padding(.horizontal, 10) + .padding(.top, 10) + .padding(.bottom, UIScreen.main.bounds.width * 0.18) .background(Color.white) .frame(width: UIScreen.main.bounds.width * 0.88) .clipShape(RoundedRectangle(cornerRadius: 10)) From 8518a587d1bb95ff3ffab5d0aee58476d30fb253 Mon Sep 17 00:00:00 2001 From: song Date: Fri, 3 Jan 2025 19:29:43 +0900 Subject: [PATCH 11/21] =?UTF-8?q?Design:=20=ED=8E=98=EC=9D=B4=EC=A7=80?= =?UTF-8?q?=EB=A5=BC=20=EB=82=98=ED=83=80=EB=82=B4=EB=8A=94=20=EB=B6=80?= =?UTF-8?q?=EB=B6=84=20=EB=94=94=EC=9E=90=EC=9D=B8=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Presentation/View/WriteLetter/ContentWriteView.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Kabinett/Presentation/View/WriteLetter/ContentWriteView.swift b/Kabinett/Presentation/View/WriteLetter/ContentWriteView.swift index 7afcada..e3e1a88 100644 --- a/Kabinett/Presentation/View/WriteLetter/ContentWriteView.swift +++ b/Kabinett/Presentation/View/WriteLetter/ContentWriteView.swift @@ -40,12 +40,12 @@ struct ContentWriteView: View { ZStack(alignment: .top) { VStack { ScrollableLetterView(letterContent: $letterContent, viewModel: viewModel, imageViewModel: imageViewModel, currentIndex: $viewModel.currentIndex) - .font(FontUtility.selectedFont(font: letterContent.fontString ?? "", size: 14)) + .font(FontUtility.selectedFont(font: letterContent.fontString ?? "", size: 13)) Text("\(viewModel.currentIndex+1) / \(viewModel.texts.count+imageViewModel.photoContents.count)") - .padding(2) - .padding(.horizontal, 5) - .background(Color.gray) + .padding(5) + .padding(.horizontal, 8) + .background(Color(.primary900).opacity(0.3)) .clipShape(Capsule()) } MiniTabBar(letterContent: $letterContent, viewModel: viewModel, customTabViewModel: customTabViewModel, isPopup: $isPopup) From fd0892e022925d2a24fa58332e038b1f18aa7a7d Mon Sep 17 00:00:00 2001 From: song Date: Mon, 6 Jan 2025 14:27:24 +0900 Subject: [PATCH 12/21] =?UTF-8?q?Design:=20=EC=82=AC=EC=9D=B4=EC=A6=88=20?= =?UTF-8?q?=ED=94=BC=EA=B7=B8=EB=A7=88=EB=8C=80=EB=A1=9C=20=EC=A1=B0?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Presentation/View/WriteLetter/ContentWriteView.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Kabinett/Presentation/View/WriteLetter/ContentWriteView.swift b/Kabinett/Presentation/View/WriteLetter/ContentWriteView.swift index e3e1a88..af3569d 100644 --- a/Kabinett/Presentation/View/WriteLetter/ContentWriteView.swift +++ b/Kabinett/Presentation/View/WriteLetter/ContentWriteView.swift @@ -290,14 +290,14 @@ struct ScrollableLetterView: View { if let uiImage = UIImage(data: imageViewModel.photoContents[index]) { Image(uiImage: uiImage) .resizable() - .clipShape(RoundedRectangle(cornerRadius: 10)) + .clipShape(RoundedRectangle(cornerRadius: 5)) .aspectRatio(contentMode: .fit) .padding(.horizontal, 10) .padding(.top, 10) - .padding(.bottom, UIScreen.main.bounds.width * 0.18) + .padding(.bottom, UIScreen.main.bounds.width * 0.12) .background(Color.white) .frame(width: UIScreen.main.bounds.width * 0.88) - .clipShape(RoundedRectangle(cornerRadius: 10)) + .clipShape(RoundedRectangle(cornerRadius: 5)) .padding(.top, 10) .tag(imageIndex) .anchorPreference(key: AnchorsKey.self, value: .trailing, transform: { [imageIndex: $0] }) From 5a13625834be4e448d82d922ea9d9a449db8f531 Mon Sep 17 00:00:00 2001 From: song Date: Mon, 6 Jan 2025 14:27:54 +0900 Subject: [PATCH 13/21] =?UTF-8?q?Design:=20=EC=82=AC=EC=A7=84=EC=9D=80=20?= =?UTF-8?q?=EA=B0=80=EC=9A=B4=EB=8D=B0=EC=97=90=20=EC=9E=88=EC=9D=84=20?= =?UTF-8?q?=EC=88=98=20=EC=9E=88=EA=B2=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../View/WriteLetter/ContentWriteView.swift | 94 ++++++++++--------- 1 file changed, 49 insertions(+), 45 deletions(-) diff --git a/Kabinett/Presentation/View/WriteLetter/ContentWriteView.swift b/Kabinett/Presentation/View/WriteLetter/ContentWriteView.swift index af3569d..c19c4db 100644 --- a/Kabinett/Presentation/View/WriteLetter/ContentWriteView.swift +++ b/Kabinett/Presentation/View/WriteLetter/ContentWriteView.swift @@ -232,57 +232,61 @@ struct ScrollableLetterView: View { ScrollViewReader { scrollViewProxy in ZStack(alignment: .top) { ScrollView(.horizontal, showsIndicators: false) { - LazyHStack(alignment: .top, spacing: UIScreen.main.bounds.width * 0.04) { + LazyHStack(spacing: UIScreen.main.bounds.width * 0.04) { ForEach(0.. Date: Mon, 6 Jan 2025 14:41:35 +0900 Subject: [PATCH 14/21] =?UTF-8?q?Feat:=20X=20=EB=B2=84=ED=8A=BC=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/WriteLetter/ContentWriteView.swift | 40 +++++++++++++------ 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/Kabinett/Presentation/View/WriteLetter/ContentWriteView.swift b/Kabinett/Presentation/View/WriteLetter/ContentWriteView.swift index c19c4db..0eaeecd 100644 --- a/Kabinett/Presentation/View/WriteLetter/ContentWriteView.swift +++ b/Kabinett/Presentation/View/WriteLetter/ContentWriteView.swift @@ -292,21 +292,35 @@ struct ScrollableLetterView: View { ForEach(0.. Date: Mon, 6 Jan 2025 14:57:35 +0900 Subject: [PATCH 15/21] =?UTF-8?q?Refactor:=20=ED=95=98=EB=82=98=EC=9D=98?= =?UTF-8?q?=20=ED=8C=8C=EC=9D=BC=EC=97=90=20=EB=84=88=EB=AC=B4=20=EB=A7=8E?= =?UTF-8?q?=EC=9D=80=EA=B2=8C=20=EB=93=A4=EC=96=B4=EC=9E=88=EC=96=B4?= =?UTF-8?q?=EC=84=9C=20=EB=B6=84=EB=A6=AC=ED=95=B4=EC=A4=AC=EC=8A=B5?= =?UTF-8?q?=EB=8B=88=EB=8B=A4=20.=20.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Kabinett.xcodeproj/project.pbxproj | 22 +- .../ContentWriteView.swift | 199 +----------------- .../ContentWriteView/CustomFontMenu.swift | 55 +++++ .../ContentWriteView/CustomTextEditor.swift | 72 +++++++ .../ContentWriteView/MiniTabBar.swift | 88 ++++++++ 5 files changed, 237 insertions(+), 199 deletions(-) rename Kabinett/Presentation/View/WriteLetter/{ => ContentWriteView}/ContentWriteView.swift (60%) create mode 100644 Kabinett/Presentation/View/WriteLetter/ContentWriteView/CustomFontMenu.swift create mode 100644 Kabinett/Presentation/View/WriteLetter/ContentWriteView/CustomTextEditor.swift create mode 100644 Kabinett/Presentation/View/WriteLetter/ContentWriteView/MiniTabBar.swift diff --git a/Kabinett.xcodeproj/project.pbxproj b/Kabinett.xcodeproj/project.pbxproj index 1812a0e..26855f0 100644 --- a/Kabinett.xcodeproj/project.pbxproj +++ b/Kabinett.xcodeproj/project.pbxproj @@ -48,6 +48,9 @@ 53FC6B862C90207400E7D9A8 /* ContentRectangleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53FC6B852C90207400E7D9A8 /* ContentRectangleView.swift */; }; 53FC6B882C9020C100E7D9A8 /* Extension+String.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53FC6B872C9020C100E7D9A8 /* Extension+String.swift */; }; 53FC6B8A2C90221600E7D9A8 /* LetterHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53FC6B892C90221600E7D9A8 /* LetterHelper.swift */; }; + 573EE1F42D2BA4DF00978283 /* CustomFontMenu.swift in Sources */ = {isa = PBXBuildFile; fileRef = 573EE1F32D2BA4DF00978283 /* CustomFontMenu.swift */; }; + 573EE1F62D2BA50300978283 /* MiniTabBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 573EE1F52D2BA50300978283 /* MiniTabBar.swift */; }; + 573EE1F82D2BA55B00978283 /* CustomTextEditor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 573EE1F72D2BA55B00978283 /* CustomTextEditor.swift */; }; 57485D3B2C772332000601BF /* ContentWriteView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57485D3A2C772332000601BF /* ContentWriteView.swift */; }; 5753E0A02CE1AB8200ACC007 /* WriteLetterEnvelopeCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5753E09F2CE1AB8200ACC007 /* WriteLetterEnvelopeCell.swift */; }; 577156F32C74624C00E21162 /* SourceHanSerifK-Bold.otf in Resources */ = {isa = PBXBuildFile; fileRef = 577156F22C74624C00E21162 /* SourceHanSerifK-Bold.otf */; }; @@ -193,6 +196,9 @@ 53FC6B852C90207400E7D9A8 /* ContentRectangleView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentRectangleView.swift; sourceTree = ""; }; 53FC6B872C9020C100E7D9A8 /* Extension+String.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Extension+String.swift"; sourceTree = ""; }; 53FC6B892C90221600E7D9A8 /* LetterHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LetterHelper.swift; sourceTree = ""; }; + 573EE1F32D2BA4DF00978283 /* CustomFontMenu.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomFontMenu.swift; sourceTree = ""; }; + 573EE1F52D2BA50300978283 /* MiniTabBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MiniTabBar.swift; sourceTree = ""; }; + 573EE1F72D2BA55B00978283 /* CustomTextEditor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomTextEditor.swift; sourceTree = ""; }; 57485D3A2C772332000601BF /* ContentWriteView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentWriteView.swift; sourceTree = ""; }; 5753E09F2CE1AB8200ACC007 /* WriteLetterEnvelopeCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WriteLetterEnvelopeCell.swift; sourceTree = ""; }; 577156F22C74624C00E21162 /* SourceHanSerifK-Bold.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "SourceHanSerifK-Bold.otf"; sourceTree = ""; }; @@ -351,6 +357,17 @@ path = Components; sourceTree = ""; }; + 573EE1F22D2BA4B500978283 /* ContentWriteView */ = { + isa = PBXGroup; + children = ( + 57485D3A2C772332000601BF /* ContentWriteView.swift */, + 573EE1F32D2BA4DF00978283 /* CustomFontMenu.swift */, + 573EE1F52D2BA50300978283 /* MiniTabBar.swift */, + 573EE1F72D2BA55B00978283 /* CustomTextEditor.swift */, + ); + path = ContentWriteView; + sourceTree = ""; + }; 57635A6B2C88890E00727CC5 /* Extension */ = { isa = PBXGroup; children = ( @@ -553,7 +570,7 @@ 57EBE5AF2C69E5F2003ECD7F /* UserSelectionView.swift */, 57EBE5B82C6B399C003ECD7F /* StationerySelectionView.swift */, 57ED9CD42C70E4A400A4312C /* FontSelectionView.swift */, - 57485D3A2C772332000601BF /* ContentWriteView.swift */, + 573EE1F22D2BA4B500978283 /* ContentWriteView */, 57966B972C7D574E008D650B /* EnvelopeStampSelectionView.swift */, 57966BA32C7FF738008D650B /* PreviewLetterView.swift */, ); @@ -965,6 +982,7 @@ AFA75B272D013F8900DA418F /* FirestoreLetterWriteManager.swift in Sources */, 577157052C75DD9900E21162 /* Writer.swift in Sources */, 04DEC0FE2C7EDB1100D289EA /* KabinettNumberFormatter.swift in Sources */, + 573EE1F42D2BA4DF00978283 /* CustomFontMenu.swift in Sources */, 83F0D6872C7072DB001B8733 /* FirestoreWriterManager.swift in Sources */, 53FC6B842C90204D00E7D9A8 /* CloseButtonView.swift in Sources */, 577156FD2C7584E000E21162 /* NavigationBarView.swift in Sources */, @@ -989,6 +1007,7 @@ 534C67B72C7FF85700F0C175 /* LetterContentView.swift in Sources */, 7FCAE2BA2C73102900228FA7 /* ImageDetailView.swift in Sources */, 04DEC0E72C6C6C7300D289EA /* ProfileView.swift in Sources */, + 573EE1F62D2BA50300978283 /* MiniTabBar.swift in Sources */, 53A482DA2C6C6F2D00F00A9A /* LetterBoxCell.swift in Sources */, 5358E0792CE1EC7E0089C59F /* PhotoDetailView.swift in Sources */, 53A482D42C6B4E8600F00A9A /* LetterBoxView.swift in Sources */, @@ -1045,6 +1064,7 @@ 57966BA42C7FF739008D650B /* PreviewLetterView.swift in Sources */, 04DEC0DD2C6A3AD600D289EA /* SignUpView.swift in Sources */, 7F6CE9E22C6E25500074568E /* CameraViewModel.swift in Sources */, + 573EE1F82D2BA55B00978283 /* CustomTextEditor.swift in Sources */, 7FCAE2BC2C73157C00228FA7 /* LetterWritingView.swift in Sources */, 7F6CE9C22C6B33DD0074568E /* OptionOverlay.swift in Sources */, 57966B9C2C7D8DAF008D650B /* EnvelopeStampSelectionViewModel.swift in Sources */, diff --git a/Kabinett/Presentation/View/WriteLetter/ContentWriteView.swift b/Kabinett/Presentation/View/WriteLetter/ContentWriteView/ContentWriteView.swift similarity index 60% rename from Kabinett/Presentation/View/WriteLetter/ContentWriteView.swift rename to Kabinett/Presentation/View/WriteLetter/ContentWriteView/ContentWriteView.swift index 0eaeecd..a428adb 100644 --- a/Kabinett/Presentation/View/WriteLetter/ContentWriteView.swift +++ b/Kabinett/Presentation/View/WriteLetter/ContentWriteView/ContentWriteView.swift @@ -88,136 +88,7 @@ struct ContentWriteView: View { } } -struct CustomFontMenu: View { - @Binding var letterContent: LetterWriteModel - @Binding var isPopup: Bool - @ObservedObject var fontViewModel: FontSelectionViewModel - - var body: some View { - ZStack { - Color.black.opacity(0.1) - .edgesIgnoringSafeArea(.all) - .onTapGesture { - isPopup = false - } - - VStack(spacing: 0) { - ForEach(0.. 1 { - viewModel.isDeleteAlertPresented = true - } - } label: { - Image("PageMinus") - .font(.system(size: 15)) - .frame(width: UIScreen.main.bounds.width * 0.4/4) - } - .alert(isPresented: $viewModel.isDeleteAlertPresented) { - Alert( - title: Text("Delete Page"), - message: Text("현재 페이지를 지우시겠어요?"), - primaryButton: .destructive(Text("삭제")) { - viewModel.deleteLetter(idx: viewModel.currentIndex) - }, - secondaryButton: .cancel(Text("취소")) { - viewModel.isDeleteAlertPresented = false - } - ) - } - Button { - viewModel.createNewLetter(idx: viewModel.currentIndex) - } label: { - Image(systemName: "doc.badge.plus") - .font(.system(size: 15)) - .frame(width: UIScreen.main.bounds.width * 0.4/4) - } - Button { - customTabViewModel.showPhotoLibrary = true - customTabViewModel.isLetterWrite = true - } label: { - Image(systemName: "photo.on.rectangle.angled") - .font(.system(size: 15)) - .frame(width: UIScreen.main.bounds.width * 0.4/4, height: 30) - .background(letterContent.photoContents.isEmpty ? Color.clear : Color.white) - .foregroundStyle(letterContent.photoContents.isEmpty ? Color("ToolBarIcon") : Color(.primary900)) - .clipShape(Capsule()) - .shadow(color: letterContent.photoContents.isEmpty ? Color.clear : Color(.primary300), radius: 7, x: 3, y: 3) - } - } - .frame(maxWidth: UIScreen.main.bounds.width * 0.5, maxHeight: 40) - .foregroundStyle(Color("ToolBarIcon")) - .background(Color(.primary100)) - .clipShape(Capsule()) - .shadow(color: Color(.primary300), radius: 5, x: 3, y: 3) - .padding(.top, -10) - } - } -} - -// MARK: - ScrollableLetterView +// MARK: ScrollableLetterView struct ScrollableLetterView: View { let screenWidth = UIScreen.main.bounds.width let screenHeight = UIScreen.main.bounds.height @@ -307,7 +178,6 @@ struct ScrollableLetterView: View { .tag(imageIndex) .anchorPreference(key: AnchorsKey.self, value: .trailing, transform: { [imageIndex: $0] }) - // X 버튼 추가 Button(action: { imageViewModel.photoContents.remove(at: index) }) { @@ -351,75 +221,8 @@ struct ScrollableLetterView: View { struct AnchorsKey: PreferenceKey { typealias Value = [Int: Anchor] - static var defaultValue: Value { [ : ] } - static func reduce(value: inout Value, nextValue: () -> Value) { value.merge(nextValue()) { $1 } } } - - -// MARK: - CustomTextEditor.swift -struct CustomTextEditor: UIViewRepresentable { - @Binding var text: String - var maxWidth: CGFloat - var maxHeight: CGFloat - var font: UIFont - - class Coordinator: NSObject, UITextViewDelegate { - var parent: CustomTextEditor - - init(parent: CustomTextEditor) { - self.parent = parent - } - - func textViewDidChange(_ textView: UITextView) { - let size = textView.sizeThatFits(CGSize(width: parent.maxWidth, height: CGFloat.greatestFiniteMagnitude)) - - if size.height > parent.maxHeight { - textView.text = parent.text - } else { - parent.text = textView.text - } - } - } - - func makeCoordinator() -> Coordinator { - Coordinator(parent: self) - } - - func makeUIView(context: Context) -> UITextView { - let textView = UITextView() - textView.delegate = context.coordinator - textView.isScrollEnabled = false - textView.backgroundColor = .clear - textView.textContainerInset = .zero - textView.textContainer.lineFragmentPadding = 0 - textView.translatesAutoresizingMaskIntoConstraints = false - textView.autocorrectionType = .no - textView.spellCheckingType = .no - textView.smartInsertDeleteType = .no - textView.font = font - - let maxWidthConstraint = NSLayoutConstraint( - item: textView, - attribute: .width, - relatedBy: .lessThanOrEqual, - toItem: nil, - attribute: .notAnAttribute, - multiplier: 1.0, - constant: maxWidth - ) - textView.addConstraint(maxWidthConstraint) - - return textView - } - - func updateUIView(_ uiView: UITextView, context: Context) { - if uiView.text != text { - uiView.text = text - } - uiView.font = font - } -} diff --git a/Kabinett/Presentation/View/WriteLetter/ContentWriteView/CustomFontMenu.swift b/Kabinett/Presentation/View/WriteLetter/ContentWriteView/CustomFontMenu.swift new file mode 100644 index 0000000..c6e195f --- /dev/null +++ b/Kabinett/Presentation/View/WriteLetter/ContentWriteView/CustomFontMenu.swift @@ -0,0 +1,55 @@ +// +// CustomFontMenu.swift +// Kabinett +// +// Created by Song Kim on 1/6/25. +// + +import SwiftUI + +struct CustomFontMenu: View { + @Binding var letterContent: LetterWriteModel + @Binding var isPopup: Bool + @ObservedObject var fontViewModel: FontSelectionViewModel + + var body: some View { + ZStack { + Color.black.opacity(0.1) + .edgesIgnoringSafeArea(.all) + .onTapGesture { + isPopup = false + } + + VStack(spacing: 0) { + ForEach(0.. parent.maxHeight { + textView.text = parent.text + } else { + parent.text = textView.text + } + } + } + + func makeCoordinator() -> Coordinator { + Coordinator(parent: self) + } + + func makeUIView(context: Context) -> UITextView { + let textView = UITextView() + textView.delegate = context.coordinator + textView.isScrollEnabled = false + textView.backgroundColor = .clear + textView.textContainerInset = .zero + textView.textContainer.lineFragmentPadding = 0 + textView.translatesAutoresizingMaskIntoConstraints = false + textView.autocorrectionType = .no + textView.spellCheckingType = .no + textView.smartInsertDeleteType = .no + textView.font = font + + let maxWidthConstraint = NSLayoutConstraint( + item: textView, + attribute: .width, + relatedBy: .lessThanOrEqual, + toItem: nil, + attribute: .notAnAttribute, + multiplier: 1.0, + constant: maxWidth + ) + textView.addConstraint(maxWidthConstraint) + + return textView + } + + func updateUIView(_ uiView: UITextView, context: Context) { + if uiView.text != text { + uiView.text = text + } + uiView.font = font + } +} diff --git a/Kabinett/Presentation/View/WriteLetter/ContentWriteView/MiniTabBar.swift b/Kabinett/Presentation/View/WriteLetter/ContentWriteView/MiniTabBar.swift new file mode 100644 index 0000000..7cebba3 --- /dev/null +++ b/Kabinett/Presentation/View/WriteLetter/ContentWriteView/MiniTabBar.swift @@ -0,0 +1,88 @@ +// +// MiniTabBar.swift +// Kabinett +// +// Created by Song Kim on 1/6/25. +// + +import SwiftUI + +struct MiniTabBar: View { + @Binding var letterContent: LetterWriteModel + @ObservedObject var viewModel: ContentWriteViewModel + @ObservedObject var customTabViewModel: CustomTabViewModel + + @Binding var isPopup: Bool + @State var isFontEdit: Bool = true + + var body: some View { + if viewModel.currentIndex < viewModel.texts.count { + HStack(alignment: .center) { + Button { + isPopup.toggle() + } label: { + Text("F") + .bold() + .frame(width: UIScreen.main.bounds.width * 0.4/4, height: 30) + .background(isFontEdit ? Color.clear : Color(.primary300)) + .clipShape(Capsule()) + } + .disabled(isFontEdit ? false : true) + .onChange(of: viewModel.texts) { + if viewModel.texts.contains(where: { !$0.isEmpty }) { + isFontEdit = false + } else { + isFontEdit = true + } + } + + Button { + if viewModel.texts.count > 1 { + viewModel.isDeleteAlertPresented = true + } + } label: { + Image("PageMinus") + .font(.system(size: 15)) + .frame(width: UIScreen.main.bounds.width * 0.4/4) + } + .alert(isPresented: $viewModel.isDeleteAlertPresented) { + Alert( + title: Text("Delete Page"), + message: Text("현재 페이지를 지우시겠어요?"), + primaryButton: .destructive(Text("삭제")) { + viewModel.deleteLetter(idx: viewModel.currentIndex) + }, + secondaryButton: .cancel(Text("취소")) { + viewModel.isDeleteAlertPresented = false + } + ) + } + Button { + viewModel.createNewLetter(idx: viewModel.currentIndex) + } label: { + Image(systemName: "doc.badge.plus") + .font(.system(size: 15)) + .frame(width: UIScreen.main.bounds.width * 0.4/4) + } + Button { + customTabViewModel.showPhotoLibrary = true + customTabViewModel.isLetterWrite = true + } label: { + Image(systemName: "photo.on.rectangle.angled") + .font(.system(size: 15)) + .frame(width: UIScreen.main.bounds.width * 0.4/4, height: 30) + .background(letterContent.photoContents.isEmpty ? Color.clear : Color.white) + .foregroundStyle(letterContent.photoContents.isEmpty ? Color("ToolBarIcon") : Color(.primary900)) + .clipShape(Capsule()) + .shadow(color: letterContent.photoContents.isEmpty ? Color.clear : Color(.primary300), radius: 7, x: 3, y: 3) + } + } + .frame(maxWidth: UIScreen.main.bounds.width * 0.5, maxHeight: 40) + .foregroundStyle(Color("ToolBarIcon")) + .background(Color(.primary100)) + .clipShape(Capsule()) + .shadow(color: Color(.primary300), radius: 5, x: 3, y: 3) + .padding(.top, -10) + } + } +} From 28eca63074281d0330d28367ca0d5b44233475a8 Mon Sep 17 00:00:00 2001 From: song Date: Mon, 6 Jan 2025 15:16:34 +0900 Subject: [PATCH 16/21] =?UTF-8?q?Fix:=20=EC=84=A0=ED=83=9D=EB=90=9C=20?= =?UTF-8?q?=ED=8F=AC=ED=86=A0=ED=94=BC=EC=BB=A4=20=EC=95=84=EC=9D=B4?= =?UTF-8?q?=ED=85=9C=EB=8F=84=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../View/WriteLetter/ContentWriteView/ContentWriteView.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Kabinett/Presentation/View/WriteLetter/ContentWriteView/ContentWriteView.swift b/Kabinett/Presentation/View/WriteLetter/ContentWriteView/ContentWriteView.swift index a428adb..2878cc3 100644 --- a/Kabinett/Presentation/View/WriteLetter/ContentWriteView/ContentWriteView.swift +++ b/Kabinett/Presentation/View/WriteLetter/ContentWriteView/ContentWriteView.swift @@ -180,6 +180,7 @@ struct ScrollableLetterView: View { Button(action: { imageViewModel.photoContents.remove(at: index) + imageViewModel.selectedItems.remove(at: index) }) { Image(systemName: "xmark.circle.fill") .resizable() From 88748f8f4865158c00024d4d55722acbe1f7337c Mon Sep 17 00:00:00 2001 From: song Date: Mon, 6 Jan 2025 15:17:22 +0900 Subject: [PATCH 17/21] =?UTF-8?q?Refactor:=20=ED=95=84=EC=9A=94=EC=97=86?= =?UTF-8?q?=EB=8A=94=20=ED=8C=8C=EC=9D=BC=EB=93=A4=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Kabinett.xcodeproj/project.pbxproj | 12 +- .../View/WriteLetter/FontSelectionView.swift | 157 ------------------ .../OpenSourceLicenseModalView.swift | 42 +++++ 3 files changed, 46 insertions(+), 165 deletions(-) delete mode 100644 Kabinett/Presentation/View/WriteLetter/FontSelectionView.swift create mode 100644 Kabinett/Presentation/View/WriteLetter/OpenSourceLicenseModalView.swift diff --git a/Kabinett.xcodeproj/project.pbxproj b/Kabinett.xcodeproj/project.pbxproj index 26855f0..492b0a9 100644 --- a/Kabinett.xcodeproj/project.pbxproj +++ b/Kabinett.xcodeproj/project.pbxproj @@ -56,7 +56,6 @@ 577156F32C74624C00E21162 /* SourceHanSerifK-Bold.otf in Resources */ = {isa = PBXBuildFile; fileRef = 577156F22C74624C00E21162 /* SourceHanSerifK-Bold.otf */; }; 577156F52C7462E300E21162 /* MaruBuriot-Bold.otf in Resources */ = {isa = PBXBuildFile; fileRef = 577156F42C7462E300E21162 /* MaruBuriot-Bold.otf */; }; 577156F72C746A7C00E21162 /* MaruBuriot-Regular.otf in Resources */ = {isa = PBXBuildFile; fileRef = 577156F62C746A7C00E21162 /* MaruBuriot-Regular.otf */; }; - 577156FD2C7584E000E21162 /* NavigationBarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 577156FC2C7584E000E21162 /* NavigationBarView.swift */; }; 577157012C75D73700E21162 /* Extension+UIApplication.swift in Sources */ = {isa = PBXBuildFile; fileRef = 577157002C75D73700E21162 /* Extension+UIApplication.swift */; }; 577157032C75D7C300E21162 /* StationerySelectionViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57ED9CDD2C73698B00A4312C /* StationerySelectionViewModel.swift */; }; 577157052C75DD9900E21162 /* Writer.swift in Sources */ = {isa = PBXBuildFile; fileRef = AFA58F172C69DB1300A7C569 /* Writer.swift */; }; @@ -74,7 +73,7 @@ 57EBE5B02C69E5F2003ECD7F /* UserSelectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57EBE5AF2C69E5F2003ECD7F /* UserSelectionView.swift */; }; 57EBE5B92C6B399C003ECD7F /* StationerySelectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57EBE5B82C6B399C003ECD7F /* StationerySelectionView.swift */; }; 57ED94FA2C84AFAC00A6F187 /* LetterWriteModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57ED94F92C84AFAC00A6F187 /* LetterWriteModel.swift */; }; - 57ED9CD52C70E4A400A4312C /* FontSelectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57ED9CD42C70E4A400A4312C /* FontSelectionView.swift */; }; + 57ED9CD52C70E4A400A4312C /* OpenSourceLicenseModalView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57ED9CD42C70E4A400A4312C /* OpenSourceLicenseModalView.swift */; }; 57ED9CD72C72C8C900A4312C /* UserSelectionViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57ED9CD62C72C8C900A4312C /* UserSelectionViewModel.swift */; }; 57ED9CDA2C733D5300A4312C /* FontSelectionViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57ED9CD92C733D5300A4312C /* FontSelectionViewModel.swift */; }; 57ED9CE02C73749800A4312C /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 57ED9CDF2C73749800A4312C /* Assets.xcassets */; }; @@ -204,7 +203,6 @@ 577156F22C74624C00E21162 /* SourceHanSerifK-Bold.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "SourceHanSerifK-Bold.otf"; sourceTree = ""; }; 577156F42C7462E300E21162 /* MaruBuriot-Bold.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "MaruBuriot-Bold.otf"; sourceTree = ""; }; 577156F62C746A7C00E21162 /* MaruBuriot-Regular.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "MaruBuriot-Regular.otf"; sourceTree = ""; }; - 577156FC2C7584E000E21162 /* NavigationBarView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationBarView.swift; sourceTree = ""; }; 577157002C75D73700E21162 /* Extension+UIApplication.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Extension+UIApplication.swift"; sourceTree = ""; }; 5771570A2C77071300E21162 /* ContentWriteViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentWriteViewModel.swift; sourceTree = ""; }; 577C86722C8B8D5700EAB1BE /* Extension+View.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Extension+View.swift"; sourceTree = ""; }; @@ -220,7 +218,7 @@ 57EBE5AF2C69E5F2003ECD7F /* UserSelectionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserSelectionView.swift; sourceTree = ""; }; 57EBE5B82C6B399C003ECD7F /* StationerySelectionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StationerySelectionView.swift; sourceTree = ""; }; 57ED94F92C84AFAC00A6F187 /* LetterWriteModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = LetterWriteModel.swift; path = Kabinett/Presentation/ViewModel/WriteLetter/LetterWriteModel.swift; sourceTree = SOURCE_ROOT; }; - 57ED9CD42C70E4A400A4312C /* FontSelectionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FontSelectionView.swift; sourceTree = ""; }; + 57ED9CD42C70E4A400A4312C /* OpenSourceLicenseModalView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenSourceLicenseModalView.swift; sourceTree = ""; }; 57ED9CD62C72C8C900A4312C /* UserSelectionViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserSelectionViewModel.swift; sourceTree = ""; }; 57ED9CD92C733D5300A4312C /* FontSelectionViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FontSelectionViewModel.swift; sourceTree = ""; }; 57ED9CDD2C73698B00A4312C /* StationerySelectionViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StationerySelectionViewModel.swift; sourceTree = ""; }; @@ -564,12 +562,11 @@ 8366B6F32C65ECE60021FAE0 /* WriteLetter */ = { isa = PBXGroup; children = ( + 57ED9CD42C70E4A400A4312C /* OpenSourceLicenseModalView.swift */, 5753E09F2CE1AB8200ACC007 /* WriteLetterEnvelopeCell.swift */, - 577156FC2C7584E000E21162 /* NavigationBarView.swift */, 57966B9F2C7EC452008D650B /* SelectionTabView.swift */, 57EBE5AF2C69E5F2003ECD7F /* UserSelectionView.swift */, 57EBE5B82C6B399C003ECD7F /* StationerySelectionView.swift */, - 57ED9CD42C70E4A400A4312C /* FontSelectionView.swift */, 573EE1F22D2BA4B500978283 /* ContentWriteView */, 57966B972C7D574E008D650B /* EnvelopeStampSelectionView.swift */, 57966BA32C7FF738008D650B /* PreviewLetterView.swift */, @@ -985,7 +982,6 @@ 573EE1F42D2BA4DF00978283 /* CustomFontMenu.swift in Sources */, 83F0D6872C7072DB001B8733 /* FirestoreWriterManager.swift in Sources */, 53FC6B842C90204D00E7D9A8 /* CloseButtonView.swift in Sources */, - 577156FD2C7584E000E21162 /* NavigationBarView.swift in Sources */, 835684412CE0A43600120EC8 /* InjectionKey.swift in Sources */, 5300DA4E2C7EC2F9005F22EB /* LetterView.swift in Sources */, 53FC6B862C90207400E7D9A8 /* ContentRectangleView.swift in Sources */, @@ -994,7 +990,7 @@ 57ED9CDA2C733D5300A4312C /* FontSelectionViewModel.swift in Sources */, 577157032C75D7C300E21162 /* StationerySelectionViewModel.swift in Sources */, AF9B18FA2C894B7100F3E446 /* DefaultLetterBoxUseCase.swift in Sources */, - 57ED9CD52C70E4A400A4312C /* FontSelectionView.swift in Sources */, + 57ED9CD52C70E4A400A4312C /* OpenSourceLicenseModalView.swift in Sources */, 7F397C552C7DF20C00388645 /* ImportDialog.swift in Sources */, 7F7868562C7B14220083D204 /* HorizontalPadding.swift in Sources */, 8356843F2CE0A43600120EC8 /* DIContainer.swift in Sources */, diff --git a/Kabinett/Presentation/View/WriteLetter/FontSelectionView.swift b/Kabinett/Presentation/View/WriteLetter/FontSelectionView.swift deleted file mode 100644 index eebd751..0000000 --- a/Kabinett/Presentation/View/WriteLetter/FontSelectionView.swift +++ /dev/null @@ -1,157 +0,0 @@ -// -// FontSelectionView.swift -// Kabinett -// -// Created by Song Kim on 8/17/24. -// - -import SwiftUI -import FirebaseAnalytics - -struct FontSelectionView: View { - @Binding var letterContent: LetterWriteModel - @StateObject var viewModel = FontSelectionViewModel() - @ObservedObject var customViewModel: CustomTabViewModel - @ObservedObject var imageViewModel: ImagePickerViewModel - - var body: some View { - ZStack { - Color(.background).ignoresSafeArea() - .onTapGesture { - UIApplication.shared.endEditing() - } - - VStack(alignment: .leading) { - List { - ForEach(0.. Date: Mon, 6 Jan 2025 15:23:24 +0900 Subject: [PATCH 18/21] =?UTF-8?q?Refactor:=20=EC=83=88=EB=A1=9C=EC=9A=B4?= =?UTF-8?q?=20=EA=B7=B8=EB=A3=B9=EC=9C=BC=EB=A1=9C=20=ED=8C=8C=EC=9D=BC=20?= =?UTF-8?q?=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Kabinett.xcodeproj/project.pbxproj | 14 +- .../xcshareddata/swiftpm/Package.resolved | 132 ------------------ .../OpenSourceLicenseModalView.swift | 0 .../{ => Components}/SelectionTabView.swift | 0 .../WriteLetterEnvelopeCell.swift | 0 5 files changed, 11 insertions(+), 135 deletions(-) delete mode 100644 Kabinett.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved rename Kabinett/Presentation/View/WriteLetter/{ => Components}/OpenSourceLicenseModalView.swift (100%) rename Kabinett/Presentation/View/WriteLetter/{ => Components}/SelectionTabView.swift (100%) rename Kabinett/Presentation/View/WriteLetter/{ => Components}/WriteLetterEnvelopeCell.swift (100%) diff --git a/Kabinett.xcodeproj/project.pbxproj b/Kabinett.xcodeproj/project.pbxproj index 492b0a9..bbc5b2c 100644 --- a/Kabinett.xcodeproj/project.pbxproj +++ b/Kabinett.xcodeproj/project.pbxproj @@ -380,6 +380,16 @@ path = Extension; sourceTree = ""; }; + 579E35F82D2BAE0300F92A87 /* Components */ = { + isa = PBXGroup; + children = ( + 57ED9CD42C70E4A400A4312C /* OpenSourceLicenseModalView.swift */, + 5753E09F2CE1AB8200ACC007 /* WriteLetterEnvelopeCell.swift */, + 57966B9F2C7EC452008D650B /* SelectionTabView.swift */, + ); + path = Components; + sourceTree = ""; + }; 57ED9CE12C7375AC00A4312C /* Font */ = { isa = PBXGroup; children = ( @@ -562,9 +572,7 @@ 8366B6F32C65ECE60021FAE0 /* WriteLetter */ = { isa = PBXGroup; children = ( - 57ED9CD42C70E4A400A4312C /* OpenSourceLicenseModalView.swift */, - 5753E09F2CE1AB8200ACC007 /* WriteLetterEnvelopeCell.swift */, - 57966B9F2C7EC452008D650B /* SelectionTabView.swift */, + 579E35F82D2BAE0300F92A87 /* Components */, 57EBE5AF2C69E5F2003ECD7F /* UserSelectionView.swift */, 57EBE5B82C6B399C003ECD7F /* StationerySelectionView.swift */, 573EE1F22D2BA4B500978283 /* ContentWriteView */, diff --git a/Kabinett.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Kabinett.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved deleted file mode 100644 index ee8a160..0000000 --- a/Kabinett.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ /dev/null @@ -1,132 +0,0 @@ -{ - "originHash" : "bc240f009e1fa45c62a841709821f40ecac7be19de79cf2a8db25e79d8ea121b", - "pins" : [ - { - "identity" : "abseil-cpp-binary", - "kind" : "remoteSourceControl", - "location" : "https://github.com/google/abseil-cpp-binary.git", - "state" : { - "revision" : "194a6706acbd25e4ef639bcaddea16e8758a3e27", - "version" : "1.2024011602.0" - } - }, - { - "identity" : "app-check", - "kind" : "remoteSourceControl", - "location" : "https://github.com/google/app-check.git", - "state" : { - "revision" : "21fe1af9be463a359aaf8d96789ef73fc3760d09", - "version" : "11.0.1" - } - }, - { - "identity" : "firebase-ios-sdk", - "kind" : "remoteSourceControl", - "location" : "https://github.com/firebase/firebase-ios-sdk", - "state" : { - "revision" : "1fc52ab0e172e7c5a961f975a76c2611f4f22852", - "version" : "11.2.0" - } - }, - { - "identity" : "googleappmeasurement", - "kind" : "remoteSourceControl", - "location" : "https://github.com/google/GoogleAppMeasurement.git", - "state" : { - "revision" : "07a2f57d147d2bf368a0d2dcb5579ff082d9e44f", - "version" : "11.1.0" - } - }, - { - "identity" : "googledatatransport", - "kind" : "remoteSourceControl", - "location" : "https://github.com/google/GoogleDataTransport.git", - "state" : { - "revision" : "617af071af9aa1d6a091d59a202910ac482128f9", - "version" : "10.1.0" - } - }, - { - "identity" : "googleutilities", - "kind" : "remoteSourceControl", - "location" : "https://github.com/google/GoogleUtilities.git", - "state" : { - "revision" : "53156c7ec267db846e6b64c9f4c4e31ba4cf75eb", - "version" : "8.0.2" - } - }, - { - "identity" : "grpc-binary", - "kind" : "remoteSourceControl", - "location" : "https://github.com/google/grpc-binary.git", - "state" : { - "revision" : "f56d8fc3162de9a498377c7b6cea43431f4f5083", - "version" : "1.65.1" - } - }, - { - "identity" : "gtm-session-fetcher", - "kind" : "remoteSourceControl", - "location" : "https://github.com/google/gtm-session-fetcher.git", - "state" : { - "revision" : "a2ab612cb980066ee56d90d60d8462992c07f24b", - "version" : "3.5.0" - } - }, - { - "identity" : "interop-ios-for-google-sdks", - "kind" : "remoteSourceControl", - "location" : "https://github.com/google/interop-ios-for-google-sdks.git", - "state" : { - "revision" : "2d12673670417654f08f5f90fdd62926dc3a2648", - "version" : "100.0.0" - } - }, - { - "identity" : "kingfisher", - "kind" : "remoteSourceControl", - "location" : "https://github.com/onevcat/Kingfisher.git", - "state" : { - "revision" : "2ef543ee21d63734e1c004ad6c870255e8716c50", - "version" : "7.12.0" - } - }, - { - "identity" : "leveldb", - "kind" : "remoteSourceControl", - "location" : "https://github.com/firebase/leveldb.git", - "state" : { - "revision" : "a0bc79961d7be727d258d33d5a6b2f1023270ba1", - "version" : "1.22.5" - } - }, - { - "identity" : "nanopb", - "kind" : "remoteSourceControl", - "location" : "https://github.com/firebase/nanopb.git", - "state" : { - "revision" : "b7e1104502eca3a213b46303391ca4d3bc8ddec1", - "version" : "2.30910.0" - } - }, - { - "identity" : "promises", - "kind" : "remoteSourceControl", - "location" : "https://github.com/google/promises.git", - "state" : { - "revision" : "540318ecedd63d883069ae7f1ed811a2df00b6ac", - "version" : "2.4.0" - } - }, - { - "identity" : "swift-protobuf", - "kind" : "remoteSourceControl", - "location" : "https://github.com/apple/swift-protobuf.git", - "state" : { - "revision" : "edb6ed4919f7756157fe02f2552b7e3850a538e5", - "version" : "1.28.1" - } - } - ], - "version" : 3 -} diff --git a/Kabinett/Presentation/View/WriteLetter/OpenSourceLicenseModalView.swift b/Kabinett/Presentation/View/WriteLetter/Components/OpenSourceLicenseModalView.swift similarity index 100% rename from Kabinett/Presentation/View/WriteLetter/OpenSourceLicenseModalView.swift rename to Kabinett/Presentation/View/WriteLetter/Components/OpenSourceLicenseModalView.swift diff --git a/Kabinett/Presentation/View/WriteLetter/SelectionTabView.swift b/Kabinett/Presentation/View/WriteLetter/Components/SelectionTabView.swift similarity index 100% rename from Kabinett/Presentation/View/WriteLetter/SelectionTabView.swift rename to Kabinett/Presentation/View/WriteLetter/Components/SelectionTabView.swift diff --git a/Kabinett/Presentation/View/WriteLetter/WriteLetterEnvelopeCell.swift b/Kabinett/Presentation/View/WriteLetter/Components/WriteLetterEnvelopeCell.swift similarity index 100% rename from Kabinett/Presentation/View/WriteLetter/WriteLetterEnvelopeCell.swift rename to Kabinett/Presentation/View/WriteLetter/Components/WriteLetterEnvelopeCell.swift From bca9c68fafbc862f8dd53df16498a8649a9cdb06 Mon Sep 17 00:00:00 2001 From: song Date: Mon, 6 Jan 2025 15:37:18 +0900 Subject: [PATCH 19/21] =?UTF-8?q?Refactor:=20=EB=B3=B4=EA=B8=B0=EC=89=BD?= =?UTF-8?q?=EA=B2=8C=20=ED=8C=8C=EC=9D=BC=EC=9D=84=20=EB=B6=84=EB=A6=AC?= =?UTF-8?q?=ED=95=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Kabinett.xcodeproj/project.pbxproj | 50 ++++--- .../xcshareddata/swiftpm/Package.resolved | 132 ++++++++++++++++++ .../View/WriteLetter/Cells/EnvelopeCell.swift | 67 +++++++++ .../View/WriteLetter/Cells/StampCell.swift | 67 +++++++++ .../WriteLetter/Cells/StationeryCell.swift | 47 +++++++ .../WriteLetterEnvelopeCell.swift | 2 +- .../CustomTextEditor.swift | 0 .../FontMenuView.swift} | 2 +- .../MiniTabBarView.swift} | 2 +- .../ContentWriteView.swift | 12 +- .../EnvelopeStampSelectionView.swift | 122 ---------------- .../WriteLetter/StationerySelectionView.swift | 41 ------ 12 files changed, 353 insertions(+), 191 deletions(-) create mode 100644 Kabinett.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved create mode 100644 Kabinett/Presentation/View/WriteLetter/Cells/EnvelopeCell.swift create mode 100644 Kabinett/Presentation/View/WriteLetter/Cells/StampCell.swift create mode 100644 Kabinett/Presentation/View/WriteLetter/Cells/StationeryCell.swift rename Kabinett/Presentation/View/WriteLetter/{Components => Cells}/WriteLetterEnvelopeCell.swift (99%) rename Kabinett/Presentation/View/WriteLetter/{ContentWriteView => Components}/CustomTextEditor.swift (100%) rename Kabinett/Presentation/View/WriteLetter/{ContentWriteView/CustomFontMenu.swift => Components/FontMenuView.swift} (98%) rename Kabinett/Presentation/View/WriteLetter/{ContentWriteView/MiniTabBar.swift => Components/MiniTabBarView.swift} (99%) rename Kabinett/Presentation/View/WriteLetter/{ContentWriteView => }/ContentWriteView.swift (97%) diff --git a/Kabinett.xcodeproj/project.pbxproj b/Kabinett.xcodeproj/project.pbxproj index bbc5b2c..313c866 100644 --- a/Kabinett.xcodeproj/project.pbxproj +++ b/Kabinett.xcodeproj/project.pbxproj @@ -48,8 +48,8 @@ 53FC6B862C90207400E7D9A8 /* ContentRectangleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53FC6B852C90207400E7D9A8 /* ContentRectangleView.swift */; }; 53FC6B882C9020C100E7D9A8 /* Extension+String.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53FC6B872C9020C100E7D9A8 /* Extension+String.swift */; }; 53FC6B8A2C90221600E7D9A8 /* LetterHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53FC6B892C90221600E7D9A8 /* LetterHelper.swift */; }; - 573EE1F42D2BA4DF00978283 /* CustomFontMenu.swift in Sources */ = {isa = PBXBuildFile; fileRef = 573EE1F32D2BA4DF00978283 /* CustomFontMenu.swift */; }; - 573EE1F62D2BA50300978283 /* MiniTabBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 573EE1F52D2BA50300978283 /* MiniTabBar.swift */; }; + 573EE1F42D2BA4DF00978283 /* FontMenuView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 573EE1F32D2BA4DF00978283 /* FontMenuView.swift */; }; + 573EE1F62D2BA50300978283 /* MiniTabBarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 573EE1F52D2BA50300978283 /* MiniTabBarView.swift */; }; 573EE1F82D2BA55B00978283 /* CustomTextEditor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 573EE1F72D2BA55B00978283 /* CustomTextEditor.swift */; }; 57485D3B2C772332000601BF /* ContentWriteView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57485D3A2C772332000601BF /* ContentWriteView.swift */; }; 5753E0A02CE1AB8200ACC007 /* WriteLetterEnvelopeCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5753E09F2CE1AB8200ACC007 /* WriteLetterEnvelopeCell.swift */; }; @@ -68,6 +68,9 @@ 57966BA02C7EC452008D650B /* SelectionTabView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57966B9F2C7EC452008D650B /* SelectionTabView.swift */; }; 57966BA42C7FF739008D650B /* PreviewLetterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57966BA32C7FF738008D650B /* PreviewLetterView.swift */; }; 57966BA62C81FD98008D650B /* PreviewLetterViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57966BA52C81FD98008D650B /* PreviewLetterViewModel.swift */; }; + 579E35FB2D2BB0B300F92A87 /* StationeryCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 579E35FA2D2BB0B300F92A87 /* StationeryCell.swift */; }; + 579E35FD2D2BB0FA00F92A87 /* EnvelopeCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 579E35FC2D2BB0FA00F92A87 /* EnvelopeCell.swift */; }; + 579E35FF2D2BB11400F92A87 /* StampCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 579E35FE2D2BB11400F92A87 /* StampCell.swift */; }; 57A014FE2CA57E7100580883 /* NanumMyeongjo.otf in Resources */ = {isa = PBXBuildFile; fileRef = 57A014FD2CA57E7100580883 /* NanumMyeongjo.otf */; }; 57C35C672CCA02130083A346 /* FontUtility.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57C35C662CCA02130083A346 /* FontUtility.swift */; }; 57EBE5B02C69E5F2003ECD7F /* UserSelectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57EBE5AF2C69E5F2003ECD7F /* UserSelectionView.swift */; }; @@ -195,8 +198,8 @@ 53FC6B852C90207400E7D9A8 /* ContentRectangleView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentRectangleView.swift; sourceTree = ""; }; 53FC6B872C9020C100E7D9A8 /* Extension+String.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Extension+String.swift"; sourceTree = ""; }; 53FC6B892C90221600E7D9A8 /* LetterHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LetterHelper.swift; sourceTree = ""; }; - 573EE1F32D2BA4DF00978283 /* CustomFontMenu.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomFontMenu.swift; sourceTree = ""; }; - 573EE1F52D2BA50300978283 /* MiniTabBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MiniTabBar.swift; sourceTree = ""; }; + 573EE1F32D2BA4DF00978283 /* FontMenuView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FontMenuView.swift; sourceTree = ""; }; + 573EE1F52D2BA50300978283 /* MiniTabBarView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MiniTabBarView.swift; sourceTree = ""; }; 573EE1F72D2BA55B00978283 /* CustomTextEditor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomTextEditor.swift; sourceTree = ""; }; 57485D3A2C772332000601BF /* ContentWriteView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentWriteView.swift; sourceTree = ""; }; 5753E09F2CE1AB8200ACC007 /* WriteLetterEnvelopeCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WriteLetterEnvelopeCell.swift; sourceTree = ""; }; @@ -213,6 +216,9 @@ 57966B9F2C7EC452008D650B /* SelectionTabView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectionTabView.swift; sourceTree = ""; }; 57966BA32C7FF738008D650B /* PreviewLetterView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PreviewLetterView.swift; sourceTree = ""; }; 57966BA52C81FD98008D650B /* PreviewLetterViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PreviewLetterViewModel.swift; sourceTree = ""; }; + 579E35FA2D2BB0B300F92A87 /* StationeryCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StationeryCell.swift; sourceTree = ""; }; + 579E35FC2D2BB0FA00F92A87 /* EnvelopeCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EnvelopeCell.swift; sourceTree = ""; }; + 579E35FE2D2BB11400F92A87 /* StampCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StampCell.swift; sourceTree = ""; }; 57A014FD2CA57E7100580883 /* NanumMyeongjo.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = NanumMyeongjo.otf; sourceTree = ""; }; 57C35C662CCA02130083A346 /* FontUtility.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = FontUtility.swift; path = ../../../../FontUtility.swift; sourceTree = ""; }; 57EBE5AF2C69E5F2003ECD7F /* UserSelectionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserSelectionView.swift; sourceTree = ""; }; @@ -355,17 +361,6 @@ path = Components; sourceTree = ""; }; - 573EE1F22D2BA4B500978283 /* ContentWriteView */ = { - isa = PBXGroup; - children = ( - 57485D3A2C772332000601BF /* ContentWriteView.swift */, - 573EE1F32D2BA4DF00978283 /* CustomFontMenu.swift */, - 573EE1F52D2BA50300978283 /* MiniTabBar.swift */, - 573EE1F72D2BA55B00978283 /* CustomTextEditor.swift */, - ); - path = ContentWriteView; - sourceTree = ""; - }; 57635A6B2C88890E00727CC5 /* Extension */ = { isa = PBXGroup; children = ( @@ -384,12 +379,25 @@ isa = PBXGroup; children = ( 57ED9CD42C70E4A400A4312C /* OpenSourceLicenseModalView.swift */, - 5753E09F2CE1AB8200ACC007 /* WriteLetterEnvelopeCell.swift */, 57966B9F2C7EC452008D650B /* SelectionTabView.swift */, + 573EE1F32D2BA4DF00978283 /* FontMenuView.swift */, + 573EE1F52D2BA50300978283 /* MiniTabBarView.swift */, + 573EE1F72D2BA55B00978283 /* CustomTextEditor.swift */, ); path = Components; sourceTree = ""; }; + 579E35F92D2BB09700F92A87 /* Cells */ = { + isa = PBXGroup; + children = ( + 5753E09F2CE1AB8200ACC007 /* WriteLetterEnvelopeCell.swift */, + 579E35FA2D2BB0B300F92A87 /* StationeryCell.swift */, + 579E35FC2D2BB0FA00F92A87 /* EnvelopeCell.swift */, + 579E35FE2D2BB11400F92A87 /* StampCell.swift */, + ); + path = Cells; + sourceTree = ""; + }; 57ED9CE12C7375AC00A4312C /* Font */ = { isa = PBXGroup; children = ( @@ -572,10 +580,11 @@ 8366B6F32C65ECE60021FAE0 /* WriteLetter */ = { isa = PBXGroup; children = ( + 579E35F92D2BB09700F92A87 /* Cells */, 579E35F82D2BAE0300F92A87 /* Components */, 57EBE5AF2C69E5F2003ECD7F /* UserSelectionView.swift */, 57EBE5B82C6B399C003ECD7F /* StationerySelectionView.swift */, - 573EE1F22D2BA4B500978283 /* ContentWriteView */, + 57485D3A2C772332000601BF /* ContentWriteView.swift */, 57966B972C7D574E008D650B /* EnvelopeStampSelectionView.swift */, 57966BA32C7FF738008D650B /* PreviewLetterView.swift */, ); @@ -987,8 +996,9 @@ AFA75B272D013F8900DA418F /* FirestoreLetterWriteManager.swift in Sources */, 577157052C75DD9900E21162 /* Writer.swift in Sources */, 04DEC0FE2C7EDB1100D289EA /* KabinettNumberFormatter.swift in Sources */, - 573EE1F42D2BA4DF00978283 /* CustomFontMenu.swift in Sources */, + 573EE1F42D2BA4DF00978283 /* FontMenuView.swift in Sources */, 83F0D6872C7072DB001B8733 /* FirestoreWriterManager.swift in Sources */, + 579E35FD2D2BB0FA00F92A87 /* EnvelopeCell.swift in Sources */, 53FC6B842C90204D00E7D9A8 /* CloseButtonView.swift in Sources */, 835684412CE0A43600120EC8 /* InjectionKey.swift in Sources */, 5300DA4E2C7EC2F9005F22EB /* LetterView.swift in Sources */, @@ -1011,13 +1021,14 @@ 534C67B72C7FF85700F0C175 /* LetterContentView.swift in Sources */, 7FCAE2BA2C73102900228FA7 /* ImageDetailView.swift in Sources */, 04DEC0E72C6C6C7300D289EA /* ProfileView.swift in Sources */, - 573EE1F62D2BA50300978283 /* MiniTabBar.swift in Sources */, + 573EE1F62D2BA50300978283 /* MiniTabBarView.swift in Sources */, 53A482DA2C6C6F2D00F00A9A /* LetterBoxCell.swift in Sources */, 5358E0792CE1EC7E0089C59F /* PhotoDetailView.swift in Sources */, 53A482D42C6B4E8600F00A9A /* LetterBoxView.swift in Sources */, 530C765A2C7638D9007E09C6 /* LetterBoxViewModel.swift in Sources */, 5359618D2C7488DD0031E181 /* TransparentBlurView.swift in Sources */, 57C35C672CCA02130083A346 /* FontUtility.swift in Sources */, + 579E35FF2D2BB11400F92A87 /* StampCell.swift in Sources */, 8356843E2CE0A43600120EC8 /* UseCaseKeys.swift in Sources */, 538150512C8AD5FB007B1E5A /* LayoutHelper.swift in Sources */, 535961912C74F5870031E181 /* CalendarView.swift in Sources */, @@ -1086,6 +1097,7 @@ 53A99EA72C8190B600896AAC /* SearchBarView.swift in Sources */, 577157012C75D73700E21162 /* Extension+UIApplication.swift in Sources */, 83D9C8E52C830C7600EF2684 /* DefaultSignUpUseCase.swift in Sources */, + 579E35FB2D2BB0B300F92A87 /* StationeryCell.swift in Sources */, 832C72672C71CF7B0071E8D0 /* SignUpUseCase.swift in Sources */, 04DEC0EB2C6C87B500D289EA /* AccountSettingsView.swift in Sources */, ); diff --git a/Kabinett.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Kabinett.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved new file mode 100644 index 0000000..ee8a160 --- /dev/null +++ b/Kabinett.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -0,0 +1,132 @@ +{ + "originHash" : "bc240f009e1fa45c62a841709821f40ecac7be19de79cf2a8db25e79d8ea121b", + "pins" : [ + { + "identity" : "abseil-cpp-binary", + "kind" : "remoteSourceControl", + "location" : "https://github.com/google/abseil-cpp-binary.git", + "state" : { + "revision" : "194a6706acbd25e4ef639bcaddea16e8758a3e27", + "version" : "1.2024011602.0" + } + }, + { + "identity" : "app-check", + "kind" : "remoteSourceControl", + "location" : "https://github.com/google/app-check.git", + "state" : { + "revision" : "21fe1af9be463a359aaf8d96789ef73fc3760d09", + "version" : "11.0.1" + } + }, + { + "identity" : "firebase-ios-sdk", + "kind" : "remoteSourceControl", + "location" : "https://github.com/firebase/firebase-ios-sdk", + "state" : { + "revision" : "1fc52ab0e172e7c5a961f975a76c2611f4f22852", + "version" : "11.2.0" + } + }, + { + "identity" : "googleappmeasurement", + "kind" : "remoteSourceControl", + "location" : "https://github.com/google/GoogleAppMeasurement.git", + "state" : { + "revision" : "07a2f57d147d2bf368a0d2dcb5579ff082d9e44f", + "version" : "11.1.0" + } + }, + { + "identity" : "googledatatransport", + "kind" : "remoteSourceControl", + "location" : "https://github.com/google/GoogleDataTransport.git", + "state" : { + "revision" : "617af071af9aa1d6a091d59a202910ac482128f9", + "version" : "10.1.0" + } + }, + { + "identity" : "googleutilities", + "kind" : "remoteSourceControl", + "location" : "https://github.com/google/GoogleUtilities.git", + "state" : { + "revision" : "53156c7ec267db846e6b64c9f4c4e31ba4cf75eb", + "version" : "8.0.2" + } + }, + { + "identity" : "grpc-binary", + "kind" : "remoteSourceControl", + "location" : "https://github.com/google/grpc-binary.git", + "state" : { + "revision" : "f56d8fc3162de9a498377c7b6cea43431f4f5083", + "version" : "1.65.1" + } + }, + { + "identity" : "gtm-session-fetcher", + "kind" : "remoteSourceControl", + "location" : "https://github.com/google/gtm-session-fetcher.git", + "state" : { + "revision" : "a2ab612cb980066ee56d90d60d8462992c07f24b", + "version" : "3.5.0" + } + }, + { + "identity" : "interop-ios-for-google-sdks", + "kind" : "remoteSourceControl", + "location" : "https://github.com/google/interop-ios-for-google-sdks.git", + "state" : { + "revision" : "2d12673670417654f08f5f90fdd62926dc3a2648", + "version" : "100.0.0" + } + }, + { + "identity" : "kingfisher", + "kind" : "remoteSourceControl", + "location" : "https://github.com/onevcat/Kingfisher.git", + "state" : { + "revision" : "2ef543ee21d63734e1c004ad6c870255e8716c50", + "version" : "7.12.0" + } + }, + { + "identity" : "leveldb", + "kind" : "remoteSourceControl", + "location" : "https://github.com/firebase/leveldb.git", + "state" : { + "revision" : "a0bc79961d7be727d258d33d5a6b2f1023270ba1", + "version" : "1.22.5" + } + }, + { + "identity" : "nanopb", + "kind" : "remoteSourceControl", + "location" : "https://github.com/firebase/nanopb.git", + "state" : { + "revision" : "b7e1104502eca3a213b46303391ca4d3bc8ddec1", + "version" : "2.30910.0" + } + }, + { + "identity" : "promises", + "kind" : "remoteSourceControl", + "location" : "https://github.com/google/promises.git", + "state" : { + "revision" : "540318ecedd63d883069ae7f1ed811a2df00b6ac", + "version" : "2.4.0" + } + }, + { + "identity" : "swift-protobuf", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-protobuf.git", + "state" : { + "revision" : "edb6ed4919f7756157fe02f2552b7e3850a538e5", + "version" : "1.28.1" + } + } + ], + "version" : 3 +} diff --git a/Kabinett/Presentation/View/WriteLetter/Cells/EnvelopeCell.swift b/Kabinett/Presentation/View/WriteLetter/Cells/EnvelopeCell.swift new file mode 100644 index 0000000..4a4296b --- /dev/null +++ b/Kabinett/Presentation/View/WriteLetter/Cells/EnvelopeCell.swift @@ -0,0 +1,67 @@ +// +// EnvelopeCell.swift +// Kabinett +// +// Created by Song Kim on 1/6/25. +// + +import Foundation + +struct EnvelopeCell: View { + @Binding var letterContent: LetterWriteModel + @Binding var envelopeImageUrl: String + @ObservedObject var viewModel: EnvelopeStampSelectionViewModel + + var body: some View { + ZStack { + Color(.background).ignoresSafeArea() + + VStack { + List { + ForEach(0..= horizontalPadding } .sorted { geometry[$0.value].x < geometry[$1.value].x } .first - + if let leadingAnchor = leadingAnchor, currentIndex != leadingAnchor.key { currentIndex = leadingAnchor.key } } - + } } } diff --git a/Kabinett/Presentation/View/WriteLetter/EnvelopeStampSelectionView.swift b/Kabinett/Presentation/View/WriteLetter/EnvelopeStampSelectionView.swift index 25d1964..0ef1252 100644 --- a/Kabinett/Presentation/View/WriteLetter/EnvelopeStampSelectionView.swift +++ b/Kabinett/Presentation/View/WriteLetter/EnvelopeStampSelectionView.swift @@ -139,125 +139,3 @@ struct EnvelopeStampSelectionView: View { ) } } - - -// MARK: - EnvelopeCell -struct EnvelopeCell: View { - @Binding var letterContent: LetterWriteModel - @Binding var envelopeImageUrl: String - @ObservedObject var viewModel: EnvelopeStampSelectionViewModel - - var body: some View { - ZStack { - Color(.background).ignoresSafeArea() - - VStack { - List { - ForEach(0.. Date: Mon, 6 Jan 2025 15:48:21 +0900 Subject: [PATCH 20/21] =?UTF-8?q?Fix:=20SwiftUI,=20Kingfisher=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Presentation/View/WriteLetter/Cells/EnvelopeCell.swift | 3 ++- Kabinett/Presentation/View/WriteLetter/Cells/StampCell.swift | 3 ++- .../Presentation/View/WriteLetter/Cells/StationeryCell.swift | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Kabinett/Presentation/View/WriteLetter/Cells/EnvelopeCell.swift b/Kabinett/Presentation/View/WriteLetter/Cells/EnvelopeCell.swift index 4a4296b..e1ddc8a 100644 --- a/Kabinett/Presentation/View/WriteLetter/Cells/EnvelopeCell.swift +++ b/Kabinett/Presentation/View/WriteLetter/Cells/EnvelopeCell.swift @@ -5,7 +5,8 @@ // Created by Song Kim on 1/6/25. // -import Foundation +import SwiftUI +import Kingfisher struct EnvelopeCell: View { @Binding var letterContent: LetterWriteModel diff --git a/Kabinett/Presentation/View/WriteLetter/Cells/StampCell.swift b/Kabinett/Presentation/View/WriteLetter/Cells/StampCell.swift index a60f263..d6a23a2 100644 --- a/Kabinett/Presentation/View/WriteLetter/Cells/StampCell.swift +++ b/Kabinett/Presentation/View/WriteLetter/Cells/StampCell.swift @@ -5,7 +5,8 @@ // Created by Song Kim on 1/6/25. // -import Foundation +import SwiftUI +import Kingfisher struct StampCell: View { @Binding var letterContent: LetterWriteModel diff --git a/Kabinett/Presentation/View/WriteLetter/Cells/StationeryCell.swift b/Kabinett/Presentation/View/WriteLetter/Cells/StationeryCell.swift index d2752bb..d18b9f5 100644 --- a/Kabinett/Presentation/View/WriteLetter/Cells/StationeryCell.swift +++ b/Kabinett/Presentation/View/WriteLetter/Cells/StationeryCell.swift @@ -5,7 +5,8 @@ // Created by Song Kim on 1/6/25. // -import Foundation +import SwiftUI +import Kingfisher struct StationeryCell: View { let index: Int From a1b8b7beca6fcde161e69ec894315d16499670d4 Mon Sep 17 00:00:00 2001 From: song Date: Mon, 6 Jan 2025 15:50:33 +0900 Subject: [PATCH 21/21] =?UTF-8?q?Fix:=20=EB=B7=B0=EB=AA=A8=EB=8D=B8?= =?UTF-8?q?=EB=A1=9C=20=EB=B3=B4=EB=82=B4=EB=8F=84=EB=90=98=EB=8A=94=20?= =?UTF-8?q?=EB=B3=80=EC=88=98=EB=93=A4=20=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../View/WriteLetter/Components/FontMenuView.swift | 6 +++--- .../WriteLetter/Components/MiniTabBarView.swift | 14 ++++++-------- .../View/WriteLetter/ContentWriteView.swift | 8 +++----- .../WriteLetter/ContentWriteViewModel.swift | 3 +++ 4 files changed, 15 insertions(+), 16 deletions(-) diff --git a/Kabinett/Presentation/View/WriteLetter/Components/FontMenuView.swift b/Kabinett/Presentation/View/WriteLetter/Components/FontMenuView.swift index 64c96b4..e5edccb 100644 --- a/Kabinett/Presentation/View/WriteLetter/Components/FontMenuView.swift +++ b/Kabinett/Presentation/View/WriteLetter/Components/FontMenuView.swift @@ -9,7 +9,7 @@ import SwiftUI struct FontMenuView: View { @Binding var letterContent: LetterWriteModel - @Binding var isPopup: Bool + @Binding var showFontMenu: Bool @ObservedObject var fontViewModel: FontSelectionViewModel var body: some View { @@ -17,7 +17,7 @@ struct FontMenuView: View { Color.black.opacity(0.1) .edgesIgnoringSafeArea(.all) .onTapGesture { - isPopup = false + showFontMenu = false } VStack(spacing: 0) { @@ -25,7 +25,7 @@ struct FontMenuView: View { Button(action: { fontViewModel.selectedIndex = i letterContent.fontString = fontViewModel.dummyFonts[i].font - isPopup = false + showFontMenu = false }) { HStack { Text(fontViewModel.dummyFonts[i].fontName) diff --git a/Kabinett/Presentation/View/WriteLetter/Components/MiniTabBarView.swift b/Kabinett/Presentation/View/WriteLetter/Components/MiniTabBarView.swift index f98e4ba..2fd668a 100644 --- a/Kabinett/Presentation/View/WriteLetter/Components/MiniTabBarView.swift +++ b/Kabinett/Presentation/View/WriteLetter/Components/MiniTabBarView.swift @@ -11,28 +11,26 @@ struct MiniTabBarView: View { @Binding var letterContent: LetterWriteModel @ObservedObject var viewModel: ContentWriteViewModel @ObservedObject var customTabViewModel: CustomTabViewModel - - @Binding var isPopup: Bool - @State var isFontEdit: Bool = true + @Binding var showFontMenu: Bool var body: some View { if viewModel.currentIndex < viewModel.texts.count { HStack(alignment: .center) { Button { - isPopup.toggle() + showFontMenu.toggle() } label: { Text("F") .bold() .frame(width: UIScreen.main.bounds.width * 0.4/4, height: 30) - .background(isFontEdit ? Color.clear : Color(.primary300)) + .background(viewModel.isFontEdit ? Color.clear : Color(.primary300)) .clipShape(Capsule()) } - .disabled(isFontEdit ? false : true) + .disabled(viewModel.isFontEdit ? false : true) .onChange(of: viewModel.texts) { if viewModel.texts.contains(where: { !$0.isEmpty }) { - isFontEdit = false + viewModel.isFontEdit = false } else { - isFontEdit = true + viewModel.isFontEdit = true } } diff --git a/Kabinett/Presentation/View/WriteLetter/ContentWriteView.swift b/Kabinett/Presentation/View/WriteLetter/ContentWriteView.swift index da8e01c..a621e40 100644 --- a/Kabinett/Presentation/View/WriteLetter/ContentWriteView.swift +++ b/Kabinett/Presentation/View/WriteLetter/ContentWriteView.swift @@ -18,8 +18,6 @@ struct ContentWriteView: View { @ObservedObject var customTabViewModel: CustomTabViewModel @StateObject var fontViewModel = FontSelectionViewModel() - @State var isPopup: Bool = false - init( letterContent: Binding, imageViewModel: ImagePickerViewModel, @@ -48,12 +46,12 @@ struct ContentWriteView: View { .background(Color(.primary900).opacity(0.3)) .clipShape(Capsule()) } - MiniTabBarView(letterContent: $letterContent, viewModel: viewModel, customTabViewModel: customTabViewModel, isPopup: $isPopup) + MiniTabBarView(letterContent: $letterContent, viewModel: viewModel, customTabViewModel: customTabViewModel, showFontMenu: $viewModel.showFontMenu) } } .overlay { - if isPopup { - FontMenuView(letterContent: $letterContent, isPopup: $isPopup, fontViewModel: fontViewModel) + if viewModel.showFontMenu { + FontMenuView(letterContent: $letterContent, showFontMenu: $viewModel.showFontMenu, fontViewModel: fontViewModel) } } .toolbar { diff --git a/Kabinett/Presentation/ViewModel/WriteLetter/ContentWriteViewModel.swift b/Kabinett/Presentation/ViewModel/WriteLetter/ContentWriteViewModel.swift index 44f4725..052505a 100644 --- a/Kabinett/Presentation/ViewModel/WriteLetter/ContentWriteViewModel.swift +++ b/Kabinett/Presentation/ViewModel/WriteLetter/ContentWriteViewModel.swift @@ -13,6 +13,9 @@ class ContentWriteViewModel: ObservableObject { @Published var currentIndex: Int = 0 @Published var isDeleteAlertPresented = false + @State var showFontMenu: Bool = false + @State var isFontEdit: Bool = true + func reset() { texts = [""] currentIndex = 0