Skip to content

Commit

Permalink
Merge pull request #244 from Team-Smeme/develop
Browse files Browse the repository at this point in the history
[QA] 4차 QA 이슈 대응
  • Loading branch information
cchanmi authored Dec 12, 2024
2 parents 8963e70 + 9541598 commit 9bb72ce
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 21 deletions.
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

0 comments on commit 9bb72ce

Please sign in to comment.