Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[QA] 4차 QA 이슈 대응 #244

Merged
merged 2 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,15 @@ struct CustomSegmentedControl: View {
ForEach(options.indices, id: \.self) { index in
SegmentButton(
title: options[index],
isSelected: isCoachingOn(index),
isSelected: selectedIndex == index,
isFirstButton: index == 0,
isLastButton: index == options.count - 1,
action: { selectedIndex = index }
)
}
}
// .background(Color.gray.opacity(0.2))
.cornerRadius(6)
}

private func isCoachingOn(_ index: Int) -> Bool {
return options[index] == "코칭 ON" && selectedIndex == index
}
}

struct SegmentButton: View {
Expand All @@ -48,12 +43,14 @@ struct SegmentButton: View {
.background(backgroundColor)
.foregroundColor(foregroundColor)
.font(Font(UIFont.c5))
// .lineLimit(1)
.minimumScaleFactor(0.9)
.overlay(
Group {
if isSelected && isFirstButton {
CustomStrokeShape(includeLeadingCorners: false)
CustomStrokeShape(
includeLeadingCorners: isFirstButton,
includeTrailingCorners: isLastButton
)
.stroke(Color(UIColor.gray500), lineWidth: 1)
} else if !isSelected {
CustomStrokeShape(
Expand All @@ -68,15 +65,16 @@ struct SegmentButton: View {
}

private var backgroundColor: Color {
isSelected ? Color(UIColor.point) : isFirstButton ? Color(UIColor.gray100) : Color(UIColor.white)
// 왼쪽 버튼 논리
if isFirstButton {
return isSelected ? Color(UIColor.gray100) : Color(UIColor.white)
}
// 오른쪽 버튼 논리
return isSelected ? Color(UIColor.point) : Color(UIColor.white)
}

private var foregroundColor: Color {
isSelected ? Color(UIColor.smeemWhite) : Color(UIColor.gray500)
}

private var isCoachingOn: Bool {
title == "코칭 ON"
isSelected ? isFirstButton ? Color(UIColor.gray500): Color(UIColor.smeemWhite) : Color(UIColor.gray500)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ struct DetailDiaryCoachedView: View {
}
.onReceive(navigationViewModel.rightButtonTapped) {
isShowingFloatingButtons = true
AmplitudeManager.shared.track(event: AmplitudeConstant.diaryDetail.mydiary_edit(hasCorrections).event)
}
.confirmationDialog("", isPresented: $isShowingFloatingButtons) {
Button("수정하기", role: .none) {
Expand All @@ -70,9 +71,6 @@ struct DetailDiaryCoachedView: View {
navigateToEditDiary()
}
}
.onTapGesture {
AmplitudeManager.shared.track(event: AmplitudeConstant.diaryDetail.mydiary_edit(hasCorrections).event)
}

Button("삭제하기", role: .destructive) {
deleteDiaryWithAPI(diaryID: diaryID ?? 0)
Expand Down Expand Up @@ -121,7 +119,7 @@ struct DetailDiaryCoachedView: View {
}
}
.onAppear {
AmplitudeManager.shared.track(event: AmplitudeConstant.diaryDetail.mydiary_view(hasCorrections).event)
AmplitudeManager.shared.track(event: AmplitudeConstant.diaryDetail.mydiary_click.event)
Task {
await fetchCoachingData(diaryID: diaryID ?? 0)
}
Expand Down Expand Up @@ -171,7 +169,7 @@ extension DetailDiaryCoachedView {
}

private func convertSelectedIndexToString(_ index: Int) -> String {
return index == 0 ? "코칭 OFF" : "코칭 ON"
return index == 0 ? "on" : "off"
}

@MainActor
Expand All @@ -198,7 +196,7 @@ extension DetailDiaryCoachedView {
}

func deleteDiaryWithAPI(diaryID: Int) {
SmeemLoadingView.showLoading()
isLoading = true

detailDiaryService.deleteDiary(diaryID: diaryID) { result in

Expand All @@ -210,7 +208,7 @@ extension DetailDiaryCoachedView {
toastErrorMessage = error
break
}
SmeemLoadingView.hideLoading()
isLoading = false
}
}
}
Expand Down