Skip to content

Commit a8b27b7

Browse files
[Merge] #190 - pull request #191 from YAPP-Github/chore/#190-alert-interaction
[Chore] 짤막 QA 처리
2 parents 9815fbc + 9086d9b commit a8b27b7

3 files changed

Lines changed: 18 additions & 15 deletions

File tree

Neki-iOS/Features/QRCodeScanner/Sources/Presentation/Sources/Features/QRCodeScanFeature.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ struct QRCodeScanFeature {
102102

103103
case .closeExpiredAlertButtonTapped:
104104
state.isExpiredAlertPresented = false
105-
return .none
105+
return .send(.addPhotoFromGalleryButtonTapped)
106106

107107
// MARK: - Scanning Flow
108108
case .codeScanned(let urlString):

Neki-iOS/Features/QRCodeScanner/Sources/Presentation/Sources/Views/QRCodeScannerView.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@ struct QRCodeScannerView: View {
8181
.nekiAlert(
8282
isPresented: $store.isExpiredAlertPresented,
8383
style: .plain,
84-
title: "만료된 QR 코드예요.",
85-
subtitle: "만료되지 않은 네컷사진만 저장할 수 있어요.",
86-
confirmText: "확인",
84+
title: "QR이 만료되었어요.",
85+
subtitle: "일정 시간이 지나면 QR로는 더 이상 불러올 수 없어요. 이미 저장된 사진이 있다면 갤러리에서 추가해보세요.",
86+
confirmText: "갤러리에서 추가하기",
8787
onConfirm: { store.send(.closeExpiredAlertButtonTapped) }
8888
)
8989
.fullScreenCover(isPresented: $store.isLoading) { LoadingView() }

Neki-iOS/Shared/DesignSystem/Sources/Modifier/NekiAlertModifier.swift

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ struct NekiAlertModifier: ViewModifier {
2323
let hasIcon: Bool
2424

2525
// 액션 클로저
26-
let onConfirm: () -> Void
27-
let onCancel: () -> Void
28-
let onSecondary: () -> Void
26+
let onConfirm: (() -> Void)?
27+
let onCancel: (() -> Void)?
28+
let onSecondary: (() -> Void)?
2929

3030
func body(content: Content) -> some View {
3131
ZStack {
@@ -38,8 +38,11 @@ struct NekiAlertModifier: ViewModifier {
3838
.zIndex(1)
3939
.transition(.opacity)
4040
.onTapGesture {
41-
// 필요 시 배경 탭으로 닫기 로직 추가 가능
42-
// isPresented.toggle()
41+
if let onCancel = onCancel {
42+
onCancel()
43+
} else {
44+
isPresented.toggle()
45+
}
4346
}
4447

4548
NekiAlertModal(hasIcon: hasIcon) {
@@ -89,7 +92,7 @@ struct NekiAlertModifier: ViewModifier {
8992
// 개별 버튼 컴포넌트
9093
private var confirmButton: some View {
9194
Button {
92-
onConfirm()
95+
onConfirm?()
9396
} label: {
9497
Text(confirmText)
9598
.frame(maxWidth: .infinity)
@@ -100,7 +103,7 @@ struct NekiAlertModifier: ViewModifier {
100103

101104
private var cancelButton: some View {
102105
Button {
103-
onCancel()
106+
onCancel?()
104107
} label: {
105108
Text(cancelText ?? "취소")
106109
.frame(maxWidth: .infinity)
@@ -111,7 +114,7 @@ struct NekiAlertModifier: ViewModifier {
111114

112115
private var secondaryButton: some View {
113116
Button {
114-
onSecondary()
117+
onSecondary?()
115118
} label: {
116119
Text(secondaryText ?? "선택")
117120
.padding(.horizontal, 32)
@@ -136,9 +139,9 @@ public extension View {
136139
secondaryText: String? = nil,
137140
isProcessing: Bool = false,
138141
hasIcon: Bool = true,
139-
onConfirm: @escaping () -> Void = {},
140-
onCancel: @escaping () -> Void = {},
141-
onSecondary: @escaping () -> Void = {}
142+
onConfirm: (() -> Void)? = nil,
143+
onCancel: (() -> Void)? = nil,
144+
onSecondary: (() -> Void)? = nil
142145
) -> some View {
143146
self.modifier(NekiAlertModifier(
144147
isPresented: isPresented,

0 commit comments

Comments
 (0)