diff --git a/Application/Resources/Assets.xcassets/Image/DefaultBugImage.imageset/Contents.json b/Application/Resources/Assets.xcassets/Image/DefaultBugImage.imageset/Contents.json new file mode 100644 index 00000000..ce431e72 --- /dev/null +++ b/Application/Resources/Assets.xcassets/Image/DefaultBugImage.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "Group 13183.svg", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Application/Resources/Assets.xcassets/Image/DefaultBugImage.imageset/Group 13183.svg b/Application/Resources/Assets.xcassets/Image/DefaultBugImage.imageset/Group 13183.svg new file mode 100644 index 00000000..0bbb442b --- /dev/null +++ b/Application/Resources/Assets.xcassets/Image/DefaultBugImage.imageset/Group 13183.svg @@ -0,0 +1,4 @@ + + + + diff --git a/Application/Sources/ResoucesCode/Image.swift b/Application/Sources/ResoucesCode/Image.swift index 2928819c..7a747567 100644 --- a/Application/Sources/ResoucesCode/Image.swift +++ b/Application/Sources/ResoucesCode/Image.swift @@ -4,6 +4,9 @@ extension Image { static let logo = Image("Logo") + // default + static let defaultBugImage = Image("DefaultBugImage") + // Onboarding static let onboardingDms = Image("Onboarding-DMS") static let onboardingDnms = Image("Onboarding-DNMS") diff --git a/Application/Sources/Scene/BugReport/BugImage/BugImageView.swift b/Application/Sources/Scene/BugReport/BugImage/BugImageView.swift index fc38bfe4..525a0b13 100644 --- a/Application/Sources/Scene/BugReport/BugImage/BugImageView.swift +++ b/Application/Sources/Scene/BugReport/BugImage/BugImageView.swift @@ -3,8 +3,9 @@ import SemicolonDesign struct BugImageView: View { @Binding var isLoading: Bool - @Binding var uiimage: UIImage + @Binding var uiimage: [UIImage] @Binding var isEmpty: Bool + @Binding var xPhotosIsPresented: Bool var body: some View { if isLoading { ProgressView() @@ -13,19 +14,31 @@ struct BugImageView: View { .cornerRadius(8) .padding(.bottom, 24) } else { - if isEmpty { - Spacer() - .frame(width: 160, height: 160) - .background(Color.GrayScale.gray100) - .cornerRadius(8) - .padding(.bottom, 24) - } else { - Image(uiImage: uiimage) - .resizable() - .scaledToFit() - .frame(width: 160, height: 160) - .cornerRadius(8) - .padding(.bottom, 24) + ScrollView(.horizontal, showsIndicators: false) { + HStack(spacing: 16) { + if !isEmpty { + ForEach(uiimage, id: \.self) { + Image(uiImage: $0) + .resizable() + .scaledToFill() + .frame(width: 160, height: 160) + .cornerRadius(8) + .padding(.bottom, 24) + } + } else { + ZStack(alignment: .center) { + Spacer() + Image.defaultBugImage + } + .frame(width: 160, height: 160) + .background(Color.GrayScale.gray100) + .cornerRadius(8) + .padding(.bottom, 24) + } + } + .onTapGesture { + xPhotosIsPresented = true + } } } } diff --git a/Application/Sources/Scene/BugReport/BugReportView.swift b/Application/Sources/Scene/BugReport/BugReportView.swift index f6ee5947..ebae3622 100644 --- a/Application/Sources/Scene/BugReport/BugReportView.swift +++ b/Application/Sources/Scene/BugReport/BugReportView.swift @@ -21,15 +21,12 @@ struct BugReportView: View { .frame(height: 48) ImportantTextView(text: "사진을 첨부해주세요", isImportant: false) .padding(.bottom, 8) - BugImageView( isLoading: $viewModel.isLoading, uiimage: $viewModel.bugImage, - isEmpty: $viewModel.isEmpty + isEmpty: $viewModel.isEmpty, + xPhotosIsPresented: $viewModel.xPhotosIsPresented ) - .onTapGesture { - viewModel.xPhotosIsPresented = true - } ImportantTextView(text: "버그에 대해 요약해서 설명해주세요.") .padding(.bottom, 8) SDTextEditor(placeholder: "설명을 입력하세요.", text: $viewModel.content) diff --git a/Application/Sources/Scene/BugReport/BugReportViewModel.swift b/Application/Sources/Scene/BugReport/BugReportViewModel.swift index 4fb398a2..1f50740d 100644 --- a/Application/Sources/Scene/BugReport/BugReportViewModel.swift +++ b/Application/Sources/Scene/BugReport/BugReportViewModel.swift @@ -9,7 +9,7 @@ class BugReportViewModel: ObservableObject { @Published var isDisabled: Bool = true @Published var networking: Bool = false @Published var bugImageUrl = [""] - @Published var bugImage: UIImage = UIImage() + @Published var bugImage: [UIImage] = [UIImage()] @Published var xPhotosIsPresented: Bool = false @Published var isLoading: Bool = false @Published var isEmpty: Bool = false @@ -32,7 +32,7 @@ class BugReportViewModel: ObservableObject { } func uploadImage() { self.uploadImageUseCase - .excute(files: [self.bugImage.jpegData(compressionQuality: 0.5) ?? Data()]) + .excute(files: self.bugImage.map { $0.jpegData(compressionQuality: 0.1) ?? Data() }) .subscribe(onSuccess: { self.isLoading = false self.bugImageUrl = $0 @@ -74,7 +74,7 @@ class BugReportViewModel: ObservableObject { case "일정": self.catagory = .schedule default: - self.catagory = .all + self.catagory = .home } } }