크리에이터 채널 - 팔로우와 알림설정
- 팔로잉 상태에서 알림 켜기/끄기 상태 추가
This commit is contained in:
@@ -31,6 +31,8 @@ struct CreatorResponse: Decodable {
|
||||
let youtubeUrl: String?
|
||||
let websiteUrl: String?
|
||||
let blogUrl: String?
|
||||
let isFollow: Bool
|
||||
let isNotify: Bool
|
||||
let isNotification: Bool
|
||||
let notificationRecipientCount: Int
|
||||
}
|
||||
|
@@ -13,7 +13,7 @@ struct UserProfileCreatorView: View {
|
||||
let creator: CreatorResponse
|
||||
|
||||
let creatorFollow: () -> Void
|
||||
let creatorUnFollow: () -> Void
|
||||
let showCreatorFollowNotifyDialog: () -> Void
|
||||
let shareChannel: () -> Void
|
||||
|
||||
var body: some View {
|
||||
@@ -57,12 +57,16 @@ struct UserProfileCreatorView: View {
|
||||
}
|
||||
} else {
|
||||
VStack(alignment: .leading, spacing: 9.3) {
|
||||
Image(creator.isNotification ? "btn_following_big" : "btn_follow_big")
|
||||
Image(
|
||||
creator.isFollow ?
|
||||
creator.isNotify ? "btn_following_big": "btn_following_no_alarm_big"
|
||||
: "btn_follow_big"
|
||||
)
|
||||
.resizable()
|
||||
.frame(width: 83.3, height: 26.7)
|
||||
.onTapGesture {
|
||||
if creator.isNotification {
|
||||
creatorUnFollow()
|
||||
if creator.isFollow {
|
||||
showCreatorFollowNotifyDialog()
|
||||
} else {
|
||||
creatorFollow()
|
||||
}
|
||||
@@ -143,11 +147,13 @@ struct UserProfileCreatorView_Previews: PreviewProvider {
|
||||
youtubeUrl: Optional("https://www.youtube.com/watch?v=3x2tfZnfLRo"),
|
||||
websiteUrl: Optional("https://instagram.com/dear.zia"),
|
||||
blogUrl: Optional("dear.zia"),
|
||||
isFollow: false,
|
||||
isNotify: false,
|
||||
isNotification: false,
|
||||
notificationRecipientCount: 2
|
||||
)
|
||||
) {
|
||||
} creatorUnFollow: {
|
||||
} showCreatorFollowNotifyDialog: {
|
||||
} shareChannel: {
|
||||
}
|
||||
}
|
||||
|
@@ -14,6 +14,7 @@ struct UserProfileView: View {
|
||||
|
||||
@State private var memberId: Int = 0
|
||||
@State private var isShowMemberProfilePopup: Bool = false
|
||||
@State private var isShowFollowNotifyDialog: Bool = false
|
||||
|
||||
var body: some View {
|
||||
GeometryReader { proxy in
|
||||
@@ -52,8 +53,8 @@ struct UserProfileView: View {
|
||||
UserProfileCreatorView(
|
||||
creator: creatorProfile.creator) {
|
||||
viewModel.creatorFollow()
|
||||
} creatorUnFollow: {
|
||||
viewModel.creatorUnFollow()
|
||||
} showCreatorFollowNotifyDialog: {
|
||||
isShowFollowNotifyDialog = true
|
||||
} shareChannel: {
|
||||
viewModel.shareChannel(userId: userId)
|
||||
}
|
||||
@@ -323,6 +324,21 @@ struct UserProfileView: View {
|
||||
MemberProfileDialog(isShowing: $isShowMemberProfilePopup, memberId: memberId)
|
||||
}
|
||||
}
|
||||
|
||||
if isShowFollowNotifyDialog {
|
||||
CreatorFollowNotifyDialog(
|
||||
isShowing: $isShowFollowNotifyDialog,
|
||||
onClickNotifyAll: {
|
||||
viewModel.creatorFollow(follow: true, notify: true)
|
||||
},
|
||||
onClickNotifyNone: {
|
||||
viewModel.creatorFollow(follow: true, notify: false)
|
||||
},
|
||||
onClickUnFollow: {
|
||||
viewModel.creatorFollow(follow: false, notify: false)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
.sheet(
|
||||
isPresented: $viewModel.isShowShareView,
|
||||
|
@@ -282,11 +282,11 @@ final class UserProfileViewModel: ObservableObject {
|
||||
.store(in: &subscription)
|
||||
}
|
||||
|
||||
func creatorFollow() {
|
||||
func creatorFollow(follow: Bool = true, notify: Bool = true) {
|
||||
if let creator = creatorProfile {
|
||||
isLoading = true
|
||||
|
||||
userRepository.creatorFollow(creatorId: creator.creator.creatorId)
|
||||
userRepository.creatorFollow(creatorId: creator.creator.creatorId, follow: follow, notify: notify)
|
||||
.sink { result in
|
||||
switch result {
|
||||
case .finished:
|
||||
|
Reference in New Issue
Block a user