시리즈 상세 - 크리에이터 팔로우와 알림설정

- 팔로잉 상태에서 알림 켜기/끄기 상태 추가
This commit is contained in:
Yu Sung
2024-09-23 16:57:22 +09:00
parent ed4729ac11
commit 842cbc3073
4 changed files with 47 additions and 10 deletions

View File

@@ -14,6 +14,16 @@ struct SeriesDetailView: View {
let seriesId: Int
@State private var isShowFollowNotifyDialog: Bool = false {
didSet {
if !isShowFollowNotifyDialog {
creatorId = 0
}
}
}
@State private var creatorId: Int = 0
var body: some View {
BaseView(isLoading: $viewModel.isLoading) {
ZStack(alignment: .top) {
@@ -122,14 +132,21 @@ struct SeriesDetailView: View {
Spacer()
if seriesDetail.creator.creatorId != UserDefaults.int(forKey: .userId) {
Image(viewModel.isFollow ? "btn_following_big" : "btn_follow_big")
.onTapGesture {
if viewModel.isFollow {
viewModel.unFollow(seriesDetail.creator.creatorId)
} else {
viewModel.follow(seriesDetail.creator.creatorId)
}
Image(
viewModel.isFollow ?
viewModel.isNotify ?
"btn_following_big" :
"btn_following_no_alarm_big" :
"btn_follow_big"
)
.onTapGesture {
if viewModel.isFollow {
creatorId = seriesDetail.creator.creatorId
isShowFollowNotifyDialog = true
} else {
viewModel.follow(seriesDetail.creator.creatorId)
}
}
}
}
.padding(.top, 16)
@@ -183,6 +200,21 @@ struct SeriesDetailView: View {
.background(Color.gray11)
}
}
if isShowFollowNotifyDialog {
CreatorFollowNotifyDialog(
isShowing: $isShowFollowNotifyDialog,
onClickNotifyAll: {
viewModel.follow(creatorId, follow: true, notify: true)
},
onClickNotifyNone: {
viewModel.follow(creatorId, follow: true, notify: false)
},
onClickUnFollow: {
viewModel.follow(creatorId, follow: false, notify: false)
}
)
}
}
}
}