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

- 팔로잉 상태에서 알림 켜기/끄기 상태 추가
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

@@ -12,6 +12,10 @@ struct FollowerListView: View {
let userId: Int
@StateObject var viewModel = FollowerListViewModel()
@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) {
@@ -20,11 +24,11 @@ struct FollowerListView: View {
HStack(spacing: 4) {
Text("전체")
.font(.custom(Font.bold.rawValue, size: 18.3))
.foregroundColor(Color(hex: "eeeeee"))
.foregroundColor(Color.grayee)
Text("\(viewModel.totalCount)")
.font(.custom(Font.medium.rawValue, size: 18.3))
.foregroundColor(Color(hex: "9970ff"))
.foregroundColor(Color.button)
Spacer()
}
@@ -38,10 +42,12 @@ struct FollowerListView: View {
FollowerListItemView(
item: item,
creatorFollow: {
viewModel.creatorFollow(userId: $0)
viewModel.creatorFollow(creatorId: $0, index: index)
},
creatorUnFollow: {
viewModel.creatorUnFollow(userId: $0)
showCreatorFollowNotifyDialog: {
creatorId = $0
selectedItemIndex = index
isShowFollowNotifyDialog = true
}
)
.onAppear {
@@ -55,6 +61,42 @@ struct FollowerListView: View {
.padding(.bottom, 20)
}
}
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
}
)
}
}
.popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .bottom, autohideIn: 2) {
HStack {
@@ -63,7 +105,7 @@ struct FollowerListView: View {
.padding(.vertical, 13.3)
.frame(width: screenSize().width - 66.7, alignment: .center)
.font(.custom(Font.medium.rawValue, size: 12))
.background(Color(hex: "9970ff"))
.background(Color.button)
.foregroundColor(Color.white)
.multilineTextAlignment(.leading)
.cornerRadius(20)