Skip to content

Commit

Permalink
🔀 :: (#523) 버그 제보 이미지 여러개 넣기
Browse files Browse the repository at this point in the history
  • Loading branch information
juyeong525 authored Jun 29, 2023
2 parents 7aa1279 + 875fc74 commit 608722c
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 22 deletions.
Original file line number Diff line number Diff line change
@@ -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
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions Application/Sources/ResoucesCode/Image.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
41 changes: 27 additions & 14 deletions Application/Sources/Scene/BugReport/BugImage/BugImageView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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
}
}
}
}
Expand Down
7 changes: 2 additions & 5 deletions Application/Sources/Scene/BugReport/BugReportView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions Application/Sources/Scene/BugReport/BugReportViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -74,7 +74,7 @@ class BugReportViewModel: ObservableObject {
case "일정":
self.catagory = .schedule
default:
self.catagory = .all
self.catagory = .home
}
}
}

0 comments on commit 608722c

Please sign in to comment.