From ceacc2d6f374ddf1f6ef10277629a385ca847332 Mon Sep 17 00:00:00 2001 From: dlrjswns Date: Thu, 1 Oct 2026 10:18:11 +0900 Subject: [PATCH 1/8] =?UTF-8?q?[FEAT]=20=EC=B9=B4=EB=93=9C=ED=8C=8C?= =?UTF-8?q?=EC=87=84=EA=B4=80=EB=A0=A8=20=EB=84=A4=ED=8A=B8=EC=9B=8C?= =?UTF-8?q?=ED=81=AC=20=EC=97=90=EB=9F=AC=20=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CardShred/CardShredView.swift | 24 ++++++++++++------- .../CardShred/CardShredViewModel.swift | 20 ++++++++++++++-- 2 files changed, 33 insertions(+), 11 deletions(-) diff --git a/GAMSS/Sources/Presentation/CardShred/CardShredView.swift b/GAMSS/Sources/Presentation/CardShred/CardShredView.swift index f764002..df76062 100644 --- a/GAMSS/Sources/Presentation/CardShred/CardShredView.swift +++ b/GAMSS/Sources/Presentation/CardShred/CardShredView.swift @@ -46,6 +46,15 @@ struct CardShredView: View { paperArea .frame(maxWidth: .infinity, maxHeight: .infinity) .padding(.horizontal, 27) + .overlay(alignment: .bottom) { + ZStack { + if let toastMessage = viewModel.toastMessage { + ToastView(message: toastMessage) + .transition(.opacity) + } + } + .animation(.easeInOut(duration: 0.2), value: viewModel.toastMessage) + } shredButton .padding(.horizontal, 18) @@ -55,15 +64,6 @@ struct CardShredView: View { .frame(maxWidth: .infinity, maxHeight: .infinity) .background(Color.colorWhite) .hidesTabBar() - .alert( - viewModel.alertMessage ?? "", - isPresented: Binding( - get: { viewModel.alertMessage != nil }, - set: { if !$0 { viewModel.alertMessage = nil } } - ) - ) { - Button("확인", role: .cancel) {} - } } private var powerToggle: some View { @@ -139,6 +139,12 @@ struct CardShredView: View { let succeeded = await viewModel.shred() if succeeded { onComplete() + } else { + withAnimation(.easeInOut(duration: 0.45)) { + viewModel.reset() + } completion: { + viewModel.showShredFailureToast() + } } } } else { diff --git a/GAMSS/Sources/Presentation/CardShred/CardShredViewModel.swift b/GAMSS/Sources/Presentation/CardShred/CardShredViewModel.swift index df477f4..08112ab 100644 --- a/GAMSS/Sources/Presentation/CardShred/CardShredViewModel.swift +++ b/GAMSS/Sources/Presentation/CardShred/CardShredViewModel.swift @@ -19,12 +19,15 @@ enum CardShredMode: Hashable, Identifiable { final class CardShredViewModel: ObservableObject { @Published private(set) var step = 0 @Published private(set) var isSubmitting = false - @Published var alertMessage: String? + @Published private(set) var toastMessage: String? private let mode: CardShredMode private let deleteCardUseCase: DeleteCardUseCase? private let deleteAllCardUseCase: DeleteAllCardUseCase? private let requiredSteps = 4 + private var toastDismissTask: Task? + + static let shredFailureToastMessage = "파쇄에 실패했어요. 다시 시도해주세요" init(cardId: Int, deleteCardUseCase: DeleteCardUseCase) { self.mode = .single(cardId: cardId) @@ -55,6 +58,10 @@ final class CardShredViewModel: ObservableObject { step += 1 } + func reset() { + step = 0 + } + @discardableResult func shred() async -> Bool { guard isShredEnabled, !isSubmitting else { return false } @@ -73,8 +80,17 @@ final class CardShredViewModel: ObservableObject { } return true } catch { - alertMessage = "기록을 파쇄하지 못했어요" return false } } + + func showShredFailureToast() { + toastMessage = Self.shredFailureToastMessage + toastDismissTask?.cancel() + toastDismissTask = Task { [weak self] in + try? await Task.sleep(nanoseconds: 2_000_000_000) + guard !Task.isCancelled else { return } + self?.toastMessage = nil + } + } } From 58116464d53ef68adfcbf49103bc6605ed84f5e0 Mon Sep 17 00:00:00 2001 From: dlrjswns Date: Thu, 1 Oct 2026 10:23:13 +0900 Subject: [PATCH 2/8] =?UTF-8?q?[FEAT]=20=EB=8B=89=EB=84=A4=EC=9E=84?= =?UTF-8?q?=EC=88=98=EC=A0=95=ED=99=94=EB=A9=B4=EA=B4=80=EB=A0=A8=20?= =?UTF-8?q?=EB=84=A4=ED=8A=B8=EC=9B=8C=ED=81=AC=20=EC=97=90=EB=9F=AC=20?= =?UTF-8?q?=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../NicknameEdit/NicknameEditView.swift | 10 ++++++++++ .../NicknameEdit/NicknameEditViewModel.swift | 18 ++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/GAMSS/Sources/Presentation/Setting/NicknameEdit/NicknameEditView.swift b/GAMSS/Sources/Presentation/Setting/NicknameEdit/NicknameEditView.swift index 6bde118..7ea67c2 100644 --- a/GAMSS/Sources/Presentation/Setting/NicknameEdit/NicknameEditView.swift +++ b/GAMSS/Sources/Presentation/Setting/NicknameEdit/NicknameEditView.swift @@ -73,6 +73,16 @@ struct NicknameEditView: View { ) } .disabled(!viewModel.isEnabledSaveButton) + .overlay(alignment: .top) { + ZStack { + if let toastMessage = viewModel.toastMessage { + ToastView(message: toastMessage) + .transition(.opacity) + } + } + .alignmentGuide(.top) { $0[.bottom] + Spacing.spacing200 } + .animation(.easeInOut(duration: 0.2), value: viewModel.toastMessage) + } } .padding(.horizontal, Spacing.spacing350) .padding(.bottom, 12) diff --git a/GAMSS/Sources/Presentation/Setting/NicknameEdit/NicknameEditViewModel.swift b/GAMSS/Sources/Presentation/Setting/NicknameEdit/NicknameEditViewModel.swift index 00eece3..8041cc8 100644 --- a/GAMSS/Sources/Presentation/Setting/NicknameEdit/NicknameEditViewModel.swift +++ b/GAMSS/Sources/Presentation/Setting/NicknameEdit/NicknameEditViewModel.swift @@ -8,11 +8,16 @@ import Combine import Foundation +@MainActor final class NicknameEditViewModel: ObservableObject { private let updateNicknameUseCase: UpdateNicknameUseCase + private var toastDismissTask: Task? + + static let networkUnreachableToastMessage = "네트워크 연결을 확인해주세요" @Published private(set) var editingNickname: String = "" @Published private(set) var errorMessage: String? + @Published private(set) var toastMessage: String? var isEnabledSaveButton: Bool { let length = editingNickname.count @@ -44,9 +49,22 @@ final class NicknameEditViewModel: ObservableObject { do { try await updateNicknameUseCase.execute(editingNickname) return true + } catch NetworkError.noConnection { + showToast(Self.networkUnreachableToastMessage) + return false } catch { errorMessage = error.localizedDescription return false } } + + private func showToast(_ message: String) { + toastMessage = message + toastDismissTask?.cancel() + toastDismissTask = Task { [weak self] in + try? await Task.sleep(nanoseconds: 2_000_000_000) + guard !Task.isCancelled else { return } + self?.toastMessage = nil + } + } } From 6f2b57b5b00a1592e6f1970cedefb88363adc740 Mon Sep 17 00:00:00 2001 From: dlrjswns Date: Thu, 1 Oct 2026 10:33:14 +0900 Subject: [PATCH 3/8] =?UTF-8?q?[FEAT]=20=EB=8C=80=ED=99=94=EA=B2=80?= =?UTF-8?q?=EC=83=89=ED=99=94=EB=A9=B4=20=EA=B2=80=EC=83=89=EA=B2=B0?= =?UTF-8?q?=EA=B3=BC=EC=97=86=EC=9D=84=EC=8B=9C=20View=EC=B6=94=EA=B0=80?= =?UTF-8?q?=20=EB=B0=8F=20=EC=A0=95=EB=A0=AC=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ConversationListEmptyView.swift | 3 +- .../ConversationSearchEmptyView.swift | 36 +++++ .../ConversationListView.swift | 123 ++++++++++-------- 3 files changed, 106 insertions(+), 56 deletions(-) create mode 100644 GAMSS/Sources/Presentation/ConversationList/Components/ConversationSearchEmptyView.swift diff --git a/GAMSS/Sources/Presentation/ConversationList/Components/ConversationListEmptyView.swift b/GAMSS/Sources/Presentation/ConversationList/Components/ConversationListEmptyView.swift index f47433b..eae8420 100644 --- a/GAMSS/Sources/Presentation/ConversationList/Components/ConversationListEmptyView.swift +++ b/GAMSS/Sources/Presentation/ConversationList/Components/ConversationListEmptyView.swift @@ -13,8 +13,7 @@ struct ConversationListEmptyView: View { Text("아직 나눈 대화가 없어요") .typography(.body3Regular) .foregroundStyle(Color.colorGray500) - .frame(maxWidth: .infinity) - .padding(.top, Spacing.spacing800) + .frame(maxWidth: .infinity, maxHeight: .infinity) } } diff --git a/GAMSS/Sources/Presentation/ConversationList/Components/ConversationSearchEmptyView.swift b/GAMSS/Sources/Presentation/ConversationList/Components/ConversationSearchEmptyView.swift new file mode 100644 index 0000000..611d114 --- /dev/null +++ b/GAMSS/Sources/Presentation/ConversationList/Components/ConversationSearchEmptyView.swift @@ -0,0 +1,36 @@ +// +// ConversationSearchEmptyView.swift +// GAMSS +// +// Created by 이건준 on 10/1/26. +// + +import SwiftUI + +/// 검색 결과가 없을 때 리스트 영역에 표시하는 안내 화면. +struct ConversationSearchEmptyView: View { + var body: some View { + VStack(spacing: 0) { + Image(systemName: "magnifyingglass") + .resizable() + .scaledToFit() + .frame(width: 80, height: 80) + .foregroundStyle(Color.colorGray400) + .padding(.bottom, Spacing.spacing300) + + Text("찾으시는 결과가 없어요.") + .typography(.subtitle2) + .foregroundStyle(Color.colorGray950) + .padding(.bottom, Spacing.spacing100) + + Text("다른 검색어로 다시 찾아보세요.") + .typography(.body5Regular) + .foregroundStyle(Color.colorGray500) + } + .frame(maxWidth: .infinity, maxHeight: .infinity) + } +} + +#Preview { + ConversationSearchEmptyView() +} diff --git a/GAMSS/Sources/Presentation/ConversationList/ConversationListView.swift b/GAMSS/Sources/Presentation/ConversationList/ConversationListView.swift index b373805..cff6060 100644 --- a/GAMSS/Sources/Presentation/ConversationList/ConversationListView.swift +++ b/GAMSS/Sources/Presentation/ConversationList/ConversationListView.swift @@ -52,63 +52,15 @@ struct ConversationListView: View { .transition(.move(edge: .top).combined(with: .opacity)) } - dateHeader - .padding(.vertical, Spacing.spacing150) - .padding(.horizontal, NavigationBarMetrics.horizontalPadding) - - if !viewModel.isLoading && viewModel.displayedConversations.isEmpty { - ConversationListEmptyView() - .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .top) + if isSearchResultEmpty { + ConversationSearchEmptyView() .padding(.horizontal, NavigationBarMetrics.horizontalPadding) } else { - VStack(spacing: 0) { - ScrollView { - LazyVStack(spacing: Spacing.spacing100) { - ForEach(Array(viewModel.displayedConversations.enumerated()), id: \.element.id) { index, conversation in - conversationRow(for: conversation) - .onAppear { - Task { - await viewModel.loadMoreIfNeeded(at: index) - } - } - } + dateHeader + .padding(.vertical, Spacing.spacing150) + .padding(.horizontal, NavigationBarMetrics.horizontalPadding) - if viewModel.isLoading && !viewModel.displayedConversations.isEmpty { - ProgressView() - .frame(maxWidth: .infinity) - .padding(.vertical, Spacing.spacing200) - } - } - } - .frame(maxWidth: .infinity, maxHeight: .infinity) - - if viewModel.currentMode == .delete { - Button { - isDeleteConversationPresented = true - } label: { - Text("삭제하기") - .typography(.body3Medium) - .foregroundStyle( - viewModel.isDeleteButtonEnabled - ? Color.colorWhite - : Color.colorGray300 - ) - .frame(maxWidth: .infinity) - .frame(height: 52) - .background( - viewModel.isDeleteButtonEnabled - ? Color.colorRed - : Color.colorGray075 - ) - .clipShape(RoundedRectangle(cornerRadius: 12)) - } - .padding(.top, Spacing.spacing200) - .padding(.bottom, 10) - .disabled(!viewModel.isDeleteButtonEnabled) - } - } - .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .top) - .padding(.horizontal, NavigationBarMetrics.horizontalPadding) + conversationListContent } } .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .top) @@ -160,6 +112,69 @@ struct ConversationListView: View { } } + private var isSearchResultEmpty: Bool { + viewModel.isSearchExecuted + && !viewModel.isLoading + && viewModel.displayedConversations.isEmpty + } + + @ViewBuilder + private var conversationListContent: some View { + if !viewModel.isLoading && viewModel.displayedConversations.isEmpty { + ConversationListEmptyView() + .padding(.horizontal, NavigationBarMetrics.horizontalPadding) + } else { + VStack(spacing: 0) { + ScrollView { + LazyVStack(spacing: Spacing.spacing100) { + ForEach(Array(viewModel.displayedConversations.enumerated()), id: \.element.id) { index, conversation in + conversationRow(for: conversation) + .onAppear { + Task { + await viewModel.loadMoreIfNeeded(at: index) + } + } + } + + if viewModel.isLoading && !viewModel.displayedConversations.isEmpty { + ProgressView() + .frame(maxWidth: .infinity) + .padding(.vertical, Spacing.spacing200) + } + } + } + .frame(maxWidth: .infinity, maxHeight: .infinity) + + if viewModel.currentMode == .delete { + Button { + isDeleteConversationPresented = true + } label: { + Text("삭제하기") + .typography(.body3Medium) + .foregroundStyle( + viewModel.isDeleteButtonEnabled + ? Color.colorWhite + : Color.colorGray300 + ) + .frame(maxWidth: .infinity) + .frame(height: 52) + .background( + viewModel.isDeleteButtonEnabled + ? Color.colorRed + : Color.colorGray075 + ) + .clipShape(RoundedRectangle(cornerRadius: 12)) + } + .padding(.top, Spacing.spacing200) + .padding(.bottom, 10) + .disabled(!viewModel.isDeleteButtonEnabled) + } + } + .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .top) + .padding(.horizontal, NavigationBarMetrics.horizontalPadding) + } + } + private var dateHeader: some View { HStack { Text(ConversationListDateHeaderFormatter.string(from: Date())) From 26a5325c3bc59c98b61897aa6a222735ab1a9206 Mon Sep 17 00:00:00 2001 From: dlrjswns Date: Thu, 1 Oct 2026 10:42:27 +0900 Subject: [PATCH 4/8] =?UTF-8?q?[FEAT]=20=EB=8C=80=ED=99=94=EA=B2=80?= =?UTF-8?q?=EC=83=89=ED=99=94=EB=A9=B4=20=EB=84=A4=ED=8A=B8=EC=9B=8C?= =?UTF-8?q?=ED=81=AC=20=EC=97=90=EB=9F=AC=EC=8B=9C=20=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ConversationListView.swift | 6 +++++- .../ConversationListViewModel.swift | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/GAMSS/Sources/Presentation/ConversationList/ConversationListView.swift b/GAMSS/Sources/Presentation/ConversationList/ConversationListView.swift index cff6060..07e98e3 100644 --- a/GAMSS/Sources/Presentation/ConversationList/ConversationListView.swift +++ b/GAMSS/Sources/Presentation/ConversationList/ConversationListView.swift @@ -52,7 +52,11 @@ struct ConversationListView: View { .transition(.move(edge: .top).combined(with: .opacity)) } - if isSearchResultEmpty { + if viewModel.isNetworkUnreachable { + NetworkFailureView { + Task { await viewModel.retryAfterNetworkFailure() } + } + } else if isSearchResultEmpty { ConversationSearchEmptyView() .padding(.horizontal, NavigationBarMetrics.horizontalPadding) } else { diff --git a/GAMSS/Sources/Presentation/ConversationList/ConversationListViewModel.swift b/GAMSS/Sources/Presentation/ConversationList/ConversationListViewModel.swift index 10cb948..f060a9d 100644 --- a/GAMSS/Sources/Presentation/ConversationList/ConversationListViewModel.swift +++ b/GAMSS/Sources/Presentation/ConversationList/ConversationListViewModel.swift @@ -24,6 +24,7 @@ final class ConversationListViewModel: ObservableObject { @Published var editedText: String = "" @Published var isSearching: Bool = false @Published private(set) var isSearchExecuted = false + @Published private(set) var isNetworkUnreachable = false @Published private var selectedConversations = Set() var isDeleteButtonEnabled: Bool { @@ -51,10 +52,22 @@ final class ConversationListViewModel: ObservableObject { defer { isLoading = false } do { conversations = try await getIncompleteConversationsUseCase.execute() + isNetworkUnreachable = false + } catch NetworkError.noConnection { + isNetworkUnreachable = true } catch { alertMessage = "채팅방 목록을 불러오지 못했어요" } } + + /// 네트워크 끊김 화면의 "재시도" 버튼에서 호출한다. 검색 중이었으면 검색을, 아니면 목록 조회를 다시 시도한다. + func retryAfterNetworkFailure() async { + if isSearching, !editedText.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty { + await searchText() + } else { + await load() + } + } func isSelected(id: Int) -> Bool { selectedConversations.contains(id) @@ -129,6 +142,9 @@ final class ConversationListViewModel: ObservableObject { hasMoreSearchResults = page.hasNextPage searchResults = page.items isSearchExecuted = true + isNetworkUnreachable = false + } catch NetworkError.noConnection { + isNetworkUnreachable = true } catch { alertMessage = error.localizedDescription } @@ -154,6 +170,8 @@ final class ConversationListViewModel: ObservableObject { searchPage = page.page hasMoreSearchResults = page.hasNextPage searchResults.append(contentsOf: page.items) + } catch NetworkError.noConnection { + isNetworkUnreachable = true } catch { alertMessage = error.localizedDescription } From 4b6fcc8e63fa274abe7ec0ebbfe080d9703dcd26 Mon Sep 17 00:00:00 2001 From: dlrjswns Date: Thu, 1 Oct 2026 21:59:32 +0900 Subject: [PATCH 5/8] =?UTF-8?q?[FEAT]=20=EA=B8=B0=EC=A1=B4=20=EB=8B=89?= =?UTF-8?q?=EB=84=A4=EC=9E=84=EA=B3=BC=20=EB=8F=99=EC=9D=BC=ED=95=9C=20?= =?UTF-8?q?=EA=B2=BD=EC=9A=B0=20=EB=B2=84=ED=8A=BC=20=EB=B9=84=ED=99=9C?= =?UTF-8?q?=EC=84=B1=ED=99=94=20=EB=A1=9C=EC=A7=81=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Setting/NicknameEdit/NicknameEditViewModel.swift | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/GAMSS/Sources/Presentation/Setting/NicknameEdit/NicknameEditViewModel.swift b/GAMSS/Sources/Presentation/Setting/NicknameEdit/NicknameEditViewModel.swift index 8041cc8..383fc85 100644 --- a/GAMSS/Sources/Presentation/Setting/NicknameEdit/NicknameEditViewModel.swift +++ b/GAMSS/Sources/Presentation/Setting/NicknameEdit/NicknameEditViewModel.swift @@ -15,14 +15,17 @@ final class NicknameEditViewModel: ObservableObject { static let networkUnreachableToastMessage = "네트워크 연결을 확인해주세요" + private let currentNickname: String @Published private(set) var editingNickname: String = "" @Published private(set) var errorMessage: String? @Published private(set) var toastMessage: String? var isEnabledSaveButton: Bool { let length = editingNickname.count - return length >= NicknamePolicy.minimumLength - && length <= NicknamePolicy.maximumLength + + return editingNickname != currentNickname + && length >= NicknamePolicy.minimumLength + && length <= NicknamePolicy.maximumLength } init( @@ -30,6 +33,7 @@ final class NicknameEditViewModel: ObservableObject { currentNickname: String = "" ) { self.updateNicknameUseCase = updateNicknameUseCase + self.currentNickname = currentNickname self.editingNickname = currentNickname } From 006c0f2a3467fc575d66e6eb9a564b8483a12dfc Mon Sep 17 00:00:00 2001 From: dlrjswns Date: Thu, 1 Oct 2026 23:13:40 +0900 Subject: [PATCH 6/8] =?UTF-8?q?[FEAT]=20=EA=B3=84=EC=A0=95=ED=99=94?= =?UTF-8?q?=EB=A9=B4=20=EB=84=A4=ED=8A=B8=EC=9B=8C=ED=81=AC=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Setting/Account/AccountView.swift | 9 +++++++++ .../Setting/Account/AccountViewModel.swift | 16 ++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/GAMSS/Sources/Presentation/Setting/Account/AccountView.swift b/GAMSS/Sources/Presentation/Setting/Account/AccountView.swift index d481525..1f27f90 100644 --- a/GAMSS/Sources/Presentation/Setting/Account/AccountView.swift +++ b/GAMSS/Sources/Presentation/Setting/Account/AccountView.swift @@ -81,6 +81,15 @@ struct AccountView: View { ]) } } + .overlay(alignment: .bottom) { + ToastView(message: viewModel.toastMessage ?? "") + .padding(.bottom, Spacing.spacing200) + .opacity(viewModel.toastMessage == nil ? 0 : 1) + } + .animation( + .easeInOut(duration: 0.2), + value: viewModel.toastMessage + ) .hidesTabBar() } diff --git a/GAMSS/Sources/Presentation/Setting/Account/AccountViewModel.swift b/GAMSS/Sources/Presentation/Setting/Account/AccountViewModel.swift index dd57a14..859c197 100644 --- a/GAMSS/Sources/Presentation/Setting/Account/AccountViewModel.swift +++ b/GAMSS/Sources/Presentation/Setting/Account/AccountViewModel.swift @@ -13,8 +13,10 @@ final class AccountViewModel: ObservableObject { private let logoutUseCase: LogoutUseCase private let deleteMemberUseCase: DeleteMemberUseCase private let userManager: UserManager + private var toastDismissTask: Task? @Published var errorMessage: String? + @Published var toastMessage: String? init( logoutUseCase: LogoutUseCase, @@ -29,6 +31,8 @@ final class AccountViewModel: ObservableObject { func deleteMember() async { do { try await deleteMemberUseCase.execute() + } catch NetworkError.noConnection { + showToast("네트워크 연결을 확인해주세요") } catch { errorMessage = error.localizedDescription } @@ -38,8 +42,20 @@ final class AccountViewModel: ObservableObject { do { try await logoutUseCase.logout() userManager.user = nil + } catch NetworkError.noConnection { + showToast("네트워크 연결을 확인해주세요") } catch { errorMessage = error.localizedDescription } } + + private func showToast(_ message: String) { + toastMessage = message + toastDismissTask?.cancel() + toastDismissTask = Task { [weak self] in + try? await Task.sleep(for: .seconds(2)) + guard !Task.isCancelled else { return } + self?.toastMessage = nil + } + } } From 7932daba190c47eb6c1f3e9d5c139c80ff563eec Mon Sep 17 00:00:00 2001 From: dlrjswns Date: Thu, 1 Oct 2026 23:14:09 +0900 Subject: [PATCH 7/8] =?UTF-8?q?[FIX]=20alert=EA=B4=80=EB=A0=A8=20=EB=B3=B4?= =?UTF-8?q?=EB=9D=BC=EC=83=89=20=EC=97=90=EB=9F=AC=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Archive/Detail/ArchiveDetailView.swift | 19 +++++++++++-------- .../Detail/ArchiveDetailViewModel.swift | 1 - 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/GAMSS/Sources/Presentation/Archive/Detail/ArchiveDetailView.swift b/GAMSS/Sources/Presentation/Archive/Detail/ArchiveDetailView.swift index 37b479f..7713608 100644 --- a/GAMSS/Sources/Presentation/Archive/Detail/ArchiveDetailView.swift +++ b/GAMSS/Sources/Presentation/Archive/Detail/ArchiveDetailView.swift @@ -16,6 +16,7 @@ struct ArchiveDetailView: View { @State private var shredMode: CardShredMode? @State private var selectedNote: DropNote? @State private var isEmptyNotesModalPresented = false + @State private var isErrorAlertPresented = false private let title: String @@ -84,12 +85,14 @@ struct ArchiveDetailView: View { } .alert( viewModel.errorMessage ?? "", - isPresented: Binding( - get: { viewModel.errorMessage != nil }, - set: { if !$0 { viewModel.errorMessage = nil } } - ) + isPresented: $isErrorAlertPresented ) { - Button("확인", role: .cancel) {} + Button("확인", role: .cancel) { + viewModel.errorMessage = nil + } + } + .onChange(of: viewModel.errorMessage) { _, newValue in + isErrorAlertPresented = newValue != nil } .task { await viewModel.load() @@ -122,7 +125,7 @@ struct ArchiveDetailView: View { } ) } - + if let note = selectedNote { CardDetailView( viewModel: CardDetailViewModel( @@ -151,7 +154,7 @@ struct ArchiveDetailView: View { .transition(.opacity) .zIndex(1) } - + if isEmptyNotesModalPresented { ModalContainerView(isPresented: $isEmptyNotesModalPresented) { ModalContentView( @@ -169,7 +172,7 @@ struct ArchiveDetailView: View { .animation(.easeOut(duration: 0.12), value: selectedNote?.id) .hidesTabBar() } - + private func makeShredViewModel(for mode: CardShredMode) -> CardShredViewModel { let cardRepository = DefaultCardRepository(networkManager: NetworkManager.shared) switch mode { diff --git a/GAMSS/Sources/Presentation/Archive/Detail/ArchiveDetailViewModel.swift b/GAMSS/Sources/Presentation/Archive/Detail/ArchiveDetailViewModel.swift index 5f5f873..d2582e9 100644 --- a/GAMSS/Sources/Presentation/Archive/Detail/ArchiveDetailViewModel.swift +++ b/GAMSS/Sources/Presentation/Archive/Detail/ArchiveDetailViewModel.swift @@ -32,7 +32,6 @@ final class ArchiveDetailViewModel: ObservableObject { func load() async { isLoading = true - errorMessage = nil defer { isLoading = false } do { From 84773e62b668c8e9a625bfa0493bb125fdf9ca8d Mon Sep 17 00:00:00 2001 From: dlrjswns Date: Thu, 1 Oct 2026 23:31:13 +0900 Subject: [PATCH 8/8] =?UTF-8?q?[DEL]=20=EC=84=A4=EC=A0=95=20=EC=95=8C?= =?UTF-8?q?=EB=A6=BC=20=EB=A9=94=EB=89=B4=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GAMSS/Sources/Presentation/Setting/SettingItem.swift | 9 +++------ GAMSS/Sources/Presentation/Setting/SettingView.swift | 4 +--- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/GAMSS/Sources/Presentation/Setting/SettingItem.swift b/GAMSS/Sources/Presentation/Setting/SettingItem.swift index 5fa8e9f..3dd8b73 100644 --- a/GAMSS/Sources/Presentation/Setting/SettingItem.swift +++ b/GAMSS/Sources/Presentation/Setting/SettingItem.swift @@ -16,7 +16,7 @@ enum SettingSection: CaseIterable, Identifiable { var items: [SettingItem] { switch self { case .account: - [.accountInfo, .notification] + [.accountInfo] case .service: [.privacyPolicy, .appVersion] } @@ -25,7 +25,6 @@ enum SettingSection: CaseIterable, Identifiable { enum SettingItem: Identifiable { case accountInfo - case notification case privacyPolicy case appVersion @@ -35,8 +34,6 @@ enum SettingItem: Identifiable { switch self { case .accountInfo: "계정 정보" - case .notification: - "알림 설정" case .privacyPolicy: "개인정보 처리방침" case .appVersion: @@ -56,14 +53,14 @@ enum SettingItem: Identifiable { .navigate case .privacyPolicy: .web(Environment.privacyPolicyURL) - case .appVersion, .notification: + case .appVersion: .none } } var showsDividerBelow: Bool { switch self { - case .accountInfo, .notification: + case .accountInfo: true case .privacyPolicy, .appVersion: false diff --git a/GAMSS/Sources/Presentation/Setting/SettingView.swift b/GAMSS/Sources/Presentation/Setting/SettingView.swift index 9a405cb..c1132c8 100644 --- a/GAMSS/Sources/Presentation/Setting/SettingView.swift +++ b/GAMSS/Sources/Presentation/Setting/SettingView.swift @@ -47,7 +47,7 @@ struct SettingView: View { private func settingItem(_ item: SettingItem) -> some View { let row = MenuListItemView( title: item.title, - badgeText: item == .notification ? "OFF" : nil, + badgeText: nil, trailingText: item == .appVersion ? Environment.appVersion : nil ) @@ -94,8 +94,6 @@ struct SettingView: View { ) ) ) - case .notification: - Text("알림 설정 화면 이동") case .privacyPolicy, .appVersion: EmptyView() }