팔로잉/팔로워 리스트 - 팔로우와 알림설정

- 팔로잉 상태에서 알림 켜기/끄기 상태 추가
This commit is contained in:
Yu Sung
2024-09-23 17:54:35 +09:00
parent 31696ce7da
commit 6c8f3eb8bb
8 changed files with 167 additions and 100 deletions

View File

@@ -11,6 +11,10 @@ struct FollowCreatorView: View {
@StateObject var viewModel = FollowCreatorViewModel()
@State private var isShowFollowNotifyDialog: Bool = false
@State private var creatorId: Int = 0
@State private var selectedItemIndex: Int = 0
var body: some View {
BaseView(isLoading: $viewModel.isLoading) {
VStack(spacing: 0) {
@@ -42,8 +46,14 @@ struct FollowCreatorView: View {
FollowCreatorItemView(
creator: creator,
onClickFollow: { viewModel.creatorFollow(userId: $0) },
onClickUnFollow: { viewModel.creatorUnFollow(userId: $0) }
onClickFollow: {
viewModel.creatorFollow(creatorId: $0, index: index)
},
showCreatorFollowNotifyDialog: {
creatorId = $0
selectedItemIndex = index
isShowFollowNotifyDialog = true
}
)
.padding(.horizontal, 20)
.onTapGesture {
@@ -84,6 +94,42 @@ struct FollowCreatorView: View {
Spacer()
}
}
if isShowFollowNotifyDialog {
CreatorFollowNotifyDialog(
isShowing: $isShowFollowNotifyDialog,
onClickNotifyAll: {
viewModel.creatorFollow(
creatorId: creatorId,
index: selectedItemIndex,
follow: true,
notify: true
)
creatorId = 0
selectedItemIndex = -1
},
onClickNotifyNone: {
viewModel.creatorFollow(
creatorId: creatorId,
index: selectedItemIndex,
follow: true,
notify: false
)
creatorId = 0
selectedItemIndex = -1
},
onClickUnFollow: {
viewModel.creatorFollow(
creatorId: creatorId,
index: selectedItemIndex,
follow: false,
notify: false
)
creatorId = 0
selectedItemIndex = -1
}
)
}
}
}
}