Compare commits
No commits in common. "50e5f526a3bf3f417ab40c5a684d30ae435b7e2b" and "f444f0bfb013b3b1b7680717dc4d1d967db8ed8a" have entirely different histories.
50e5f526a3
...
f444f0bfb0
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 5.1 KiB |
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 4.5 KiB |
|
@ -1,21 +0,0 @@
|
||||||
{
|
|
||||||
"images" : [
|
|
||||||
{
|
|
||||||
"idiom" : "universal",
|
|
||||||
"scale" : "1x"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"idiom" : "universal",
|
|
||||||
"scale" : "2x"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"filename" : "btn_following_no_alarm_big.png",
|
|
||||||
"idiom" : "universal",
|
|
||||||
"scale" : "3x"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"info" : {
|
|
||||||
"author" : "xcode",
|
|
||||||
"version" : 1
|
|
||||||
}
|
|
||||||
}
|
|
Before Width: | Height: | Size: 5.1 KiB |
|
@ -1,21 +0,0 @@
|
||||||
{
|
|
||||||
"images" : [
|
|
||||||
{
|
|
||||||
"idiom" : "universal",
|
|
||||||
"scale" : "1x"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"filename" : "ic_avatar_unfollow.png",
|
|
||||||
"idiom" : "universal",
|
|
||||||
"scale" : "2x"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"idiom" : "universal",
|
|
||||||
"scale" : "3x"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"info" : {
|
|
||||||
"author" : "xcode",
|
|
||||||
"version" : 1
|
|
||||||
}
|
|
||||||
}
|
|
Before Width: | Height: | Size: 502 B |
|
@ -1,21 +0,0 @@
|
||||||
{
|
|
||||||
"images" : [
|
|
||||||
{
|
|
||||||
"idiom" : "universal",
|
|
||||||
"scale" : "1x"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"filename" : "ic_notify_all.png",
|
|
||||||
"idiom" : "universal",
|
|
||||||
"scale" : "2x"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"idiom" : "universal",
|
|
||||||
"scale" : "3x"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"info" : {
|
|
||||||
"author" : "xcode",
|
|
||||||
"version" : 1
|
|
||||||
}
|
|
||||||
}
|
|
Before Width: | Height: | Size: 793 B |
|
@ -1,21 +0,0 @@
|
||||||
{
|
|
||||||
"images" : [
|
|
||||||
{
|
|
||||||
"idiom" : "universal",
|
|
||||||
"scale" : "1x"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"filename" : "ic_notify_none.png",
|
|
||||||
"idiom" : "universal",
|
|
||||||
"scale" : "2x"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"idiom" : "universal",
|
|
||||||
"scale" : "3x"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"info" : {
|
|
||||||
"author" : "xcode",
|
|
||||||
"version" : 1
|
|
||||||
}
|
|
||||||
}
|
|
Before Width: | Height: | Size: 1.2 KiB |
|
@ -356,7 +356,7 @@ struct ContentCreateView: View {
|
||||||
.foregroundColor(Color(hex: "eeeeee"))
|
.foregroundColor(Color(hex: "eeeeee"))
|
||||||
.frame(maxWidth: .infinity, alignment: .leading)
|
.frame(maxWidth: .infinity, alignment: .leading)
|
||||||
|
|
||||||
Text("미리듣기 시간을 직접 설정하지 않으면 콘텐츠 앞부분 15초가 자동으로 설정됩니다. 미리듣기의 시간제한은 없습니다.")
|
Text("미리듣기 시간을 직접 설정하지 않으면 콘텐츠 앞부분 30초가 자동으로 설정됩니다. 미리듣기의 시간제한은 없습니다.")
|
||||||
.font(.custom(Font.medium.rawValue, size: 13.3))
|
.font(.custom(Font.medium.rawValue, size: 13.3))
|
||||||
.foregroundColor(Color(hex: "777777"))
|
.foregroundColor(Color(hex: "777777"))
|
||||||
.frame(maxWidth: .infinity, alignment: .leading)
|
.frame(maxWidth: .infinity, alignment: .leading)
|
||||||
|
@ -387,7 +387,7 @@ struct ContentCreateView: View {
|
||||||
.foregroundColor(Color(hex: "d2d2d2"))
|
.foregroundColor(Color(hex: "d2d2d2"))
|
||||||
.frame(maxWidth: .infinity, alignment: .leading)
|
.frame(maxWidth: .infinity, alignment: .leading)
|
||||||
|
|
||||||
TextField("00:00:15", text: $viewModel.previewEndTime)
|
TextField("00:00:30", text: $viewModel.previewEndTime)
|
||||||
.autocapitalization(.none)
|
.autocapitalization(.none)
|
||||||
.disableAutocorrection(true)
|
.disableAutocorrection(true)
|
||||||
.font(.custom(Font.bold.rawValue, size: 14.6))
|
.font(.custom(Font.bold.rawValue, size: 14.6))
|
||||||
|
|
|
@ -306,8 +306,8 @@ final class ContentCreateViewModel: ObservableObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
let timeDifference = timeDifference(startTime: previewStartTime, endTime: previewEndTime)
|
let timeDifference = timeDifference(startTime: previewStartTime, endTime: previewEndTime)
|
||||||
if timeDifference < 15.0 {
|
if timeDifference < 30.0 {
|
||||||
errorMessage = "미리 듣기의 최소 시간은 15초 입니다"
|
errorMessage = "미리 듣기의 최소 시간은 30초 입니다"
|
||||||
isShowPopup = true
|
isShowPopup = true
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ struct ContentDetailCreatorProfileView: View {
|
||||||
|
|
||||||
let creator: AudioContentCreator
|
let creator: AudioContentCreator
|
||||||
let onClickFollow: (Int) -> Void
|
let onClickFollow: (Int) -> Void
|
||||||
let showCreatorFollowNotifyDialog: (Int) -> Void
|
let onClickUnFollow: (Int) -> Void
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
HStack(spacing: 0) {
|
HStack(spacing: 0) {
|
||||||
|
@ -29,15 +29,10 @@ struct ContentDetailCreatorProfileView: View {
|
||||||
Spacer()
|
Spacer()
|
||||||
|
|
||||||
if creator.creatorId != UserDefaults.int(forKey: .userId) {
|
if creator.creatorId != UserDefaults.int(forKey: .userId) {
|
||||||
Image(creator.isFollow ?
|
Image(creator.isFollowing ? "btn_following_big" : "btn_follow_big")
|
||||||
creator.isNotify ?
|
|
||||||
"btn_following_big" :
|
|
||||||
"btn_following_no_alarm_big" :
|
|
||||||
"btn_follow_big"
|
|
||||||
)
|
|
||||||
.onTapGesture {
|
.onTapGesture {
|
||||||
if creator.isFollowing {
|
if creator.isFollowing {
|
||||||
showCreatorFollowNotifyDialog(creator.creatorId)
|
onClickUnFollow(creator.creatorId)
|
||||||
} else {
|
} else {
|
||||||
onClickFollow(creator.creatorId)
|
onClickFollow(creator.creatorId)
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,10 +91,10 @@ struct ContentDetailPlayView: View {
|
||||||
.valueSliderStyle(
|
.valueSliderStyle(
|
||||||
HorizontalValueSliderStyle(
|
HorizontalValueSliderStyle(
|
||||||
track: HorizontalValueTrack(
|
track: HorizontalValueTrack(
|
||||||
view: Rectangle().foregroundColor(Color.button),
|
view: Rectangle().foregroundColor(Color(hex: "9970ff")),
|
||||||
mask: Rectangle()
|
mask: Rectangle()
|
||||||
)
|
)
|
||||||
.background(Rectangle().foregroundColor(Color.gray97.opacity(0.3)))
|
.background(Rectangle().foregroundColor(Color(hex: "979797").opacity(0.3)))
|
||||||
.frame(height: 5.3),
|
.frame(height: 5.3),
|
||||||
thumbSize: CGSizeZero,
|
thumbSize: CGSizeZero,
|
||||||
options: .interactiveTrack
|
options: .interactiveTrack
|
||||||
|
|
|
@ -19,8 +19,6 @@ struct ContentDetailView: View {
|
||||||
@State private var isShowOrderView = false
|
@State private var isShowOrderView = false
|
||||||
@State private var isShowOrderConfirmView = false
|
@State private var isShowOrderConfirmView = false
|
||||||
@State private var isShowCommentListView = false
|
@State private var isShowCommentListView = false
|
||||||
@State private var isShowFollowNotifyDialog: Bool = false
|
|
||||||
@State private var creatorId: Int = 0
|
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
GeometryReader { proxy in
|
GeometryReader { proxy in
|
||||||
|
@ -57,11 +55,8 @@ struct ContentDetailView: View {
|
||||||
if let audioContent = viewModel.audioContent {
|
if let audioContent = viewModel.audioContent {
|
||||||
ContentDetailCreatorProfileView(
|
ContentDetailCreatorProfileView(
|
||||||
creator: audioContent.creator,
|
creator: audioContent.creator,
|
||||||
onClickFollow: { viewModel.creatorFollow(creatorId: $0) },
|
onClickFollow: { viewModel.creatorFollow(userId: $0) },
|
||||||
showCreatorFollowNotifyDialog: {
|
onClickUnFollow: { viewModel.creatorUnFollow(userId: $0) }
|
||||||
creatorId = $0
|
|
||||||
isShowFollowNotifyDialog = true
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
.padding(.horizontal, 13.3)
|
.padding(.horizontal, 13.3)
|
||||||
.padding(.top, 5.3)
|
.padding(.top, 5.3)
|
||||||
|
@ -352,24 +347,6 @@ struct ContentDetailView: View {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if isShowFollowNotifyDialog {
|
|
||||||
CreatorFollowNotifyDialog(
|
|
||||||
isShowing: $isShowFollowNotifyDialog,
|
|
||||||
onClickNotifyAll: {
|
|
||||||
viewModel.creatorFollow(creatorId: creatorId, follow: true, notify: true)
|
|
||||||
creatorId = 0
|
|
||||||
},
|
|
||||||
onClickNotifyNone: {
|
|
||||||
viewModel.creatorFollow(creatorId: creatorId, follow: true, notify: false)
|
|
||||||
creatorId = 0
|
|
||||||
},
|
|
||||||
onClickUnFollow: {
|
|
||||||
viewModel.creatorFollow(creatorId: creatorId, follow: false, notify: false)
|
|
||||||
creatorId = 0
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
.sheet(
|
.sheet(
|
||||||
isPresented: $viewModel.isShowShareView,
|
isPresented: $viewModel.isShowShareView,
|
||||||
|
|
|
@ -87,10 +87,10 @@ final class ContentDetailViewModel: ObservableObject {
|
||||||
.store(in: &subscription)
|
.store(in: &subscription)
|
||||||
}
|
}
|
||||||
|
|
||||||
func creatorFollow(creatorId: Int, follow: Bool = true, notify: Bool = true) {
|
func creatorFollow(userId: Int) {
|
||||||
isLoading = true
|
isLoading = true
|
||||||
|
|
||||||
userRepository.creatorFollow(creatorId: creatorId, follow: follow, notify: notify)
|
userRepository.creatorFollow(creatorId: userId)
|
||||||
.sink { result in
|
.sink { result in
|
||||||
switch result {
|
switch result {
|
||||||
case .finished:
|
case .finished:
|
||||||
|
|
|
@ -55,6 +55,4 @@ struct AudioContentCreator: Decodable {
|
||||||
let nickname: String
|
let nickname: String
|
||||||
let profileImageUrl: String
|
let profileImageUrl: String
|
||||||
let isFollowing: Bool
|
let isFollowing: Bool
|
||||||
let isFollow: Bool
|
|
||||||
let isNotify: Bool
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,5 +34,4 @@ struct GetSeriesDetailCreator: Decodable {
|
||||||
let nickname: String
|
let nickname: String
|
||||||
let profileImage: String
|
let profileImage: String
|
||||||
let isFollow: Bool
|
let isFollow: Bool
|
||||||
let isNotify: Bool
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,9 +14,6 @@ struct SeriesDetailView: View {
|
||||||
|
|
||||||
let seriesId: Int
|
let seriesId: Int
|
||||||
|
|
||||||
@State private var isShowFollowNotifyDialog: Bool = false
|
|
||||||
@State private var creatorId: Int = 0
|
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
BaseView(isLoading: $viewModel.isLoading) {
|
BaseView(isLoading: $viewModel.isLoading) {
|
||||||
ZStack(alignment: .top) {
|
ZStack(alignment: .top) {
|
||||||
|
@ -125,17 +122,10 @@ struct SeriesDetailView: View {
|
||||||
Spacer()
|
Spacer()
|
||||||
|
|
||||||
if seriesDetail.creator.creatorId != UserDefaults.int(forKey: .userId) {
|
if seriesDetail.creator.creatorId != UserDefaults.int(forKey: .userId) {
|
||||||
Image(
|
Image(viewModel.isFollow ? "btn_following_big" : "btn_follow_big")
|
||||||
viewModel.isFollow ?
|
|
||||||
viewModel.isNotify ?
|
|
||||||
"btn_following_big" :
|
|
||||||
"btn_following_no_alarm_big" :
|
|
||||||
"btn_follow_big"
|
|
||||||
)
|
|
||||||
.onTapGesture {
|
.onTapGesture {
|
||||||
if viewModel.isFollow {
|
if viewModel.isFollow {
|
||||||
creatorId = seriesDetail.creator.creatorId
|
viewModel.unFollow(seriesDetail.creator.creatorId)
|
||||||
isShowFollowNotifyDialog = true
|
|
||||||
} else {
|
} else {
|
||||||
viewModel.follow(seriesDetail.creator.creatorId)
|
viewModel.follow(seriesDetail.creator.creatorId)
|
||||||
}
|
}
|
||||||
|
@ -193,24 +183,6 @@ struct SeriesDetailView: View {
|
||||||
.background(Color.gray11)
|
.background(Color.gray11)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if isShowFollowNotifyDialog {
|
|
||||||
CreatorFollowNotifyDialog(
|
|
||||||
isShowing: $isShowFollowNotifyDialog,
|
|
||||||
onClickNotifyAll: {
|
|
||||||
viewModel.follow(creatorId, follow: true, notify: true)
|
|
||||||
creatorId = 0
|
|
||||||
},
|
|
||||||
onClickNotifyNone: {
|
|
||||||
viewModel.follow(creatorId, follow: true, notify: false)
|
|
||||||
creatorId = 0
|
|
||||||
},
|
|
||||||
onClickUnFollow: {
|
|
||||||
viewModel.follow(creatorId, follow: false, notify: false)
|
|
||||||
creatorId = 0
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,6 @@ final class SeriesDetailViewModel: ObservableObject {
|
||||||
@Published var isShowPopup = false
|
@Published var isShowPopup = false
|
||||||
|
|
||||||
@Published var isFollow: Bool = false
|
@Published var isFollow: Bool = false
|
||||||
@Published var isNotify: Bool = false
|
|
||||||
@Published var seriesDetail: GetSeriesDetailResponse? = nil
|
@Published var seriesDetail: GetSeriesDetailResponse? = nil
|
||||||
|
|
||||||
var seriesId: Int = 0
|
var seriesId: Int = 0
|
||||||
|
@ -45,7 +44,6 @@ final class SeriesDetailViewModel: ObservableObject {
|
||||||
if let data = decoded.data, decoded.success {
|
if let data = decoded.data, decoded.success {
|
||||||
self.seriesDetail = data
|
self.seriesDetail = data
|
||||||
self.isFollow = data.creator.isFollow
|
self.isFollow = data.creator.isFollow
|
||||||
self.isNotify = data.creator.isNotify
|
|
||||||
} else {
|
} else {
|
||||||
if let message = decoded.message {
|
if let message = decoded.message {
|
||||||
self.errorMessage = message
|
self.errorMessage = message
|
||||||
|
@ -65,10 +63,10 @@ final class SeriesDetailViewModel: ObservableObject {
|
||||||
.store(in: &subscription)
|
.store(in: &subscription)
|
||||||
}
|
}
|
||||||
|
|
||||||
func follow(_ creatorId: Int, follow: Bool = true, notify: Bool = true) {
|
func follow(_ creatorId: Int) {
|
||||||
isLoading = true
|
isLoading = true
|
||||||
|
|
||||||
userRepository.creatorFollow(creatorId: creatorId, follow: follow, notify: notify)
|
userRepository.creatorFollow(creatorId: creatorId)
|
||||||
.sink { result in
|
.sink { result in
|
||||||
switch result {
|
switch result {
|
||||||
case .finished:
|
case .finished:
|
||||||
|
@ -85,8 +83,7 @@ final class SeriesDetailViewModel: ObservableObject {
|
||||||
let decoded = try jsonDecoder.decode(ApiResponseWithoutData.self, from: responseData)
|
let decoded = try jsonDecoder.decode(ApiResponseWithoutData.self, from: responseData)
|
||||||
|
|
||||||
if decoded.success {
|
if decoded.success {
|
||||||
self.isFollow = follow
|
self.isFollow = !self.isFollow
|
||||||
self.isNotify = notify
|
|
||||||
} else {
|
} else {
|
||||||
if let message = decoded.message {
|
if let message = decoded.message {
|
||||||
self.errorMessage = message
|
self.errorMessage = message
|
||||||
|
|
|
@ -1,108 +0,0 @@
|
||||||
//
|
|
||||||
// CreatorFollowNotifyDialog.swift
|
|
||||||
// SodaLive
|
|
||||||
//
|
|
||||||
// Created by klaus on 9/23/24.
|
|
||||||
//
|
|
||||||
|
|
||||||
import SwiftUI
|
|
||||||
|
|
||||||
struct CreatorFollowNotifyDialog: View {
|
|
||||||
|
|
||||||
@Binding var isShowing: Bool
|
|
||||||
let onClickNotifyAll: () -> Void
|
|
||||||
let onClickNotifyNone: () -> Void
|
|
||||||
let onClickUnFollow: () -> Void
|
|
||||||
|
|
||||||
@State private var isShow: Bool = false
|
|
||||||
|
|
||||||
var body: some View {
|
|
||||||
ZStack {
|
|
||||||
Color.black.opacity(0.7).ignoresSafeArea()
|
|
||||||
.onTapGesture {
|
|
||||||
isShowing = false
|
|
||||||
}
|
|
||||||
|
|
||||||
VStack(spacing: 0) {
|
|
||||||
Spacer()
|
|
||||||
|
|
||||||
if isShow {
|
|
||||||
VStack(alignment: .leading, spacing: 24) {
|
|
||||||
Text("알림")
|
|
||||||
.font(.custom(Font.bold.rawValue, size: 18.3))
|
|
||||||
.foregroundColor(Color.grayee)
|
|
||||||
|
|
||||||
CreatorFollowNotifyItem(
|
|
||||||
image: "ic_notify_all",
|
|
||||||
title: "전체",
|
|
||||||
onTapGesture: {
|
|
||||||
isShowing = false
|
|
||||||
onClickNotifyAll()
|
|
||||||
}
|
|
||||||
)
|
|
||||||
CreatorFollowNotifyItem(
|
|
||||||
image: "ic_notify_none",
|
|
||||||
title: "없음",
|
|
||||||
onTapGesture: {
|
|
||||||
isShowing = false
|
|
||||||
onClickNotifyNone()
|
|
||||||
}
|
|
||||||
)
|
|
||||||
CreatorFollowNotifyItem(
|
|
||||||
image: "ic_avatar_unfollow",
|
|
||||||
title: "팔로우 취소",
|
|
||||||
onTapGesture: {
|
|
||||||
isShowing = false
|
|
||||||
onClickUnFollow()
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
.frame(maxWidth:.infinity)
|
|
||||||
.padding(.horizontal, 16)
|
|
||||||
.padding(.top, 16)
|
|
||||||
.padding(.bottom, 32)
|
|
||||||
.background(Color.gray22)
|
|
||||||
.cornerRadius(10, corners: [.topLeft, .topRight])
|
|
||||||
.transition(.move(edge: .bottom))
|
|
||||||
.animation(.easeInOut(duration: 0.5), value: isShow)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.ignoresSafeArea()
|
|
||||||
}
|
|
||||||
.onAppear {
|
|
||||||
withAnimation {
|
|
||||||
isShow = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
struct CreatorFollowNotifyItem: View {
|
|
||||||
|
|
||||||
let image: String
|
|
||||||
let title: String
|
|
||||||
let onTapGesture: () -> Void
|
|
||||||
|
|
||||||
var body: some View {
|
|
||||||
HStack(spacing: 16) {
|
|
||||||
Image(image)
|
|
||||||
|
|
||||||
Text(title)
|
|
||||||
.font(.custom(Font.medium.rawValue, size: 13.3))
|
|
||||||
.foregroundColor(Color.grayee)
|
|
||||||
|
|
||||||
Spacer()
|
|
||||||
}
|
|
||||||
.contentShape(Rectangle())
|
|
||||||
.onTapGesture(perform: onTapGesture)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#Preview {
|
|
||||||
CreatorFollowNotifyDialog(
|
|
||||||
isShowing: .constant(true),
|
|
||||||
onClickNotifyAll: {},
|
|
||||||
onClickNotifyNone: {},
|
|
||||||
onClickUnFollow: {}
|
|
||||||
)
|
|
||||||
}
|
|
|
@ -12,7 +12,7 @@ struct FollowerListItemView: View {
|
||||||
|
|
||||||
let item: GetFollowerListResponseItem
|
let item: GetFollowerListResponseItem
|
||||||
let creatorFollow: (Int) -> Void
|
let creatorFollow: (Int) -> Void
|
||||||
let showCreatorFollowNotifyDialog: (Int) -> Void
|
let creatorUnFollow: (Int) -> Void
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
VStack(spacing: 13.3) {
|
VStack(spacing: 13.3) {
|
||||||
|
@ -29,16 +29,11 @@ struct FollowerListItemView: View {
|
||||||
|
|
||||||
Spacer()
|
Spacer()
|
||||||
|
|
||||||
if let isFollow = item.isFollow, let isNotify = item.isNotify {
|
if let isFollow = item.isFollow {
|
||||||
Image(isFollow ?
|
Image(isFollow ? "btn_following_big" : "btn_follow_big")
|
||||||
isNotify ?
|
|
||||||
"btn_following_big" :
|
|
||||||
"btn_following_no_alarm_big" :
|
|
||||||
"btn_follow_big"
|
|
||||||
)
|
|
||||||
.onTapGesture {
|
.onTapGesture {
|
||||||
isFollow ?
|
isFollow ?
|
||||||
showCreatorFollowNotifyDialog(item.userId) :
|
creatorUnFollow(item.userId) :
|
||||||
creatorFollow(item.userId)
|
creatorFollow(item.userId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -64,7 +59,7 @@ struct FollowerListItemView_Previews: PreviewProvider {
|
||||||
isFollow: false
|
isFollow: false
|
||||||
),
|
),
|
||||||
creatorFollow: { _ in },
|
creatorFollow: { _ in },
|
||||||
showCreatorFollowNotifyDialog: { _ in }
|
creatorUnFollow: { _ in }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,10 +12,6 @@ struct FollowerListView: View {
|
||||||
let userId: Int
|
let userId: Int
|
||||||
@StateObject var viewModel = FollowerListViewModel()
|
@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 {
|
var body: some View {
|
||||||
BaseView(isLoading: $viewModel.isLoading) {
|
BaseView(isLoading: $viewModel.isLoading) {
|
||||||
VStack(spacing: 0) {
|
VStack(spacing: 0) {
|
||||||
|
@ -24,11 +20,11 @@ struct FollowerListView: View {
|
||||||
HStack(spacing: 4) {
|
HStack(spacing: 4) {
|
||||||
Text("전체")
|
Text("전체")
|
||||||
.font(.custom(Font.bold.rawValue, size: 18.3))
|
.font(.custom(Font.bold.rawValue, size: 18.3))
|
||||||
.foregroundColor(Color.grayee)
|
.foregroundColor(Color(hex: "eeeeee"))
|
||||||
|
|
||||||
Text("\(viewModel.totalCount)")
|
Text("\(viewModel.totalCount)")
|
||||||
.font(.custom(Font.medium.rawValue, size: 18.3))
|
.font(.custom(Font.medium.rawValue, size: 18.3))
|
||||||
.foregroundColor(Color.button)
|
.foregroundColor(Color(hex: "9970ff"))
|
||||||
|
|
||||||
Spacer()
|
Spacer()
|
||||||
}
|
}
|
||||||
|
@ -42,12 +38,10 @@ struct FollowerListView: View {
|
||||||
FollowerListItemView(
|
FollowerListItemView(
|
||||||
item: item,
|
item: item,
|
||||||
creatorFollow: {
|
creatorFollow: {
|
||||||
viewModel.creatorFollow(creatorId: $0, index: index)
|
viewModel.creatorFollow(userId: $0)
|
||||||
},
|
},
|
||||||
showCreatorFollowNotifyDialog: {
|
creatorUnFollow: {
|
||||||
creatorId = $0
|
viewModel.creatorUnFollow(userId: $0)
|
||||||
selectedItemIndex = index
|
|
||||||
isShowFollowNotifyDialog = true
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.onAppear {
|
.onAppear {
|
||||||
|
@ -61,42 +55,6 @@ struct FollowerListView: View {
|
||||||
.padding(.bottom, 20)
|
.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) {
|
.popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .bottom, autohideIn: 2) {
|
||||||
HStack {
|
HStack {
|
||||||
|
@ -105,7 +63,7 @@ struct FollowerListView: View {
|
||||||
.padding(.vertical, 13.3)
|
.padding(.vertical, 13.3)
|
||||||
.frame(width: screenSize().width - 66.7, alignment: .center)
|
.frame(width: screenSize().width - 66.7, alignment: .center)
|
||||||
.font(.custom(Font.medium.rawValue, size: 12))
|
.font(.custom(Font.medium.rawValue, size: 12))
|
||||||
.background(Color.button)
|
.background(Color(hex: "9970ff"))
|
||||||
.foregroundColor(Color.white)
|
.foregroundColor(Color.white)
|
||||||
.multilineTextAlignment(.leading)
|
.multilineTextAlignment(.leading)
|
||||||
.cornerRadius(20)
|
.cornerRadius(20)
|
||||||
|
|
|
@ -76,10 +76,10 @@ final class FollowerListViewModel: ObservableObject {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func creatorFollow(creatorId: Int, index: Int, follow: Bool = true, notify: Bool = true) {
|
func creatorFollow(userId: Int) {
|
||||||
isLoading = true
|
isLoading = true
|
||||||
|
|
||||||
userRepository.creatorFollow(creatorId: creatorId, follow: follow, notify: notify)
|
userRepository.creatorFollow(creatorId: userId)
|
||||||
.sink { result in
|
.sink { result in
|
||||||
switch result {
|
switch result {
|
||||||
case .finished:
|
case .finished:
|
||||||
|
@ -96,11 +96,53 @@ final class FollowerListViewModel: ObservableObject {
|
||||||
let decoded = try jsonDecoder.decode(ApiResponseWithoutData.self, from: responseData)
|
let decoded = try jsonDecoder.decode(ApiResponseWithoutData.self, from: responseData)
|
||||||
|
|
||||||
if decoded.success {
|
if decoded.success {
|
||||||
var follower = self.followerListItems[index]
|
self.isLast = false
|
||||||
follower.isFollow = follow
|
self.page = 1
|
||||||
follower.isNotify = notify
|
DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
|
||||||
self.followerListItems.remove(at: index)
|
self.getFollowerList()
|
||||||
self.followerListItems.insert(follower, at: index)
|
}
|
||||||
|
} else {
|
||||||
|
if let message = decoded.message {
|
||||||
|
self.errorMessage = message
|
||||||
|
} else {
|
||||||
|
self.errorMessage = "다시 시도해 주세요.\n계속 같은 문제가 발생할 경우 고객센터로 문의 주시기 바랍니다."
|
||||||
|
}
|
||||||
|
|
||||||
|
self.isShowPopup = true
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
self.errorMessage = "다시 시도해 주세요.\n계속 같은 문제가 발생할 경우 고객센터로 문의 주시기 바랍니다."
|
||||||
|
self.isShowPopup = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.store(in: &subscription)
|
||||||
|
}
|
||||||
|
|
||||||
|
func creatorUnFollow(userId: Int) {
|
||||||
|
isLoading = true
|
||||||
|
|
||||||
|
userRepository.creatorUnFollow(creatorId: userId)
|
||||||
|
.sink { result in
|
||||||
|
switch result {
|
||||||
|
case .finished:
|
||||||
|
DEBUG_LOG("finish")
|
||||||
|
case .failure(let error):
|
||||||
|
ERROR_LOG(error.localizedDescription)
|
||||||
|
}
|
||||||
|
} receiveValue: { [unowned self] response in
|
||||||
|
self.isLoading = false
|
||||||
|
let responseData = response.data
|
||||||
|
|
||||||
|
do {
|
||||||
|
let jsonDecoder = JSONDecoder()
|
||||||
|
let decoded = try jsonDecoder.decode(ApiResponseWithoutData.self, from: responseData)
|
||||||
|
|
||||||
|
if decoded.success {
|
||||||
|
self.isLast = false
|
||||||
|
self.page = 1
|
||||||
|
DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
|
||||||
|
self.getFollowerList()
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if let message = decoded.message {
|
if let message = decoded.message {
|
||||||
self.errorMessage = message
|
self.errorMessage = message
|
||||||
|
|
|
@ -16,6 +16,5 @@ struct GetFollowerListResponseItem: Decodable {
|
||||||
let userId: Int
|
let userId: Int
|
||||||
let profileImage: String
|
let profileImage: String
|
||||||
let nickname: String
|
let nickname: String
|
||||||
var isFollow: Bool?
|
let isFollow: Bool?
|
||||||
var isNotify: Bool?
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,8 +31,6 @@ struct CreatorResponse: Decodable {
|
||||||
let youtubeUrl: String?
|
let youtubeUrl: String?
|
||||||
let websiteUrl: String?
|
let websiteUrl: String?
|
||||||
let blogUrl: String?
|
let blogUrl: String?
|
||||||
let isFollow: Bool
|
|
||||||
let isNotify: Bool
|
|
||||||
let isNotification: Bool
|
let isNotification: Bool
|
||||||
let notificationRecipientCount: Int
|
let notificationRecipientCount: Int
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ struct UserProfileCreatorView: View {
|
||||||
let creator: CreatorResponse
|
let creator: CreatorResponse
|
||||||
|
|
||||||
let creatorFollow: () -> Void
|
let creatorFollow: () -> Void
|
||||||
let showCreatorFollowNotifyDialog: () -> Void
|
let creatorUnFollow: () -> Void
|
||||||
let shareChannel: () -> Void
|
let shareChannel: () -> Void
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
|
@ -57,16 +57,12 @@ struct UserProfileCreatorView: View {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
VStack(alignment: .leading, spacing: 9.3) {
|
VStack(alignment: .leading, spacing: 9.3) {
|
||||||
Image(
|
Image(creator.isNotification ? "btn_following_big" : "btn_follow_big")
|
||||||
creator.isFollow ?
|
|
||||||
creator.isNotify ? "btn_following_big": "btn_following_no_alarm_big"
|
|
||||||
: "btn_follow_big"
|
|
||||||
)
|
|
||||||
.resizable()
|
.resizable()
|
||||||
.frame(width: 83.3, height: 26.7)
|
.frame(width: 83.3, height: 26.7)
|
||||||
.onTapGesture {
|
.onTapGesture {
|
||||||
if creator.isFollow {
|
if creator.isNotification {
|
||||||
showCreatorFollowNotifyDialog()
|
creatorUnFollow()
|
||||||
} else {
|
} else {
|
||||||
creatorFollow()
|
creatorFollow()
|
||||||
}
|
}
|
||||||
|
@ -147,13 +143,11 @@ struct UserProfileCreatorView_Previews: PreviewProvider {
|
||||||
youtubeUrl: Optional("https://www.youtube.com/watch?v=3x2tfZnfLRo"),
|
youtubeUrl: Optional("https://www.youtube.com/watch?v=3x2tfZnfLRo"),
|
||||||
websiteUrl: Optional("https://instagram.com/dear.zia"),
|
websiteUrl: Optional("https://instagram.com/dear.zia"),
|
||||||
blogUrl: Optional("dear.zia"),
|
blogUrl: Optional("dear.zia"),
|
||||||
isFollow: false,
|
|
||||||
isNotify: false,
|
|
||||||
isNotification: false,
|
isNotification: false,
|
||||||
notificationRecipientCount: 2
|
notificationRecipientCount: 2
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
} showCreatorFollowNotifyDialog: {
|
} creatorUnFollow: {
|
||||||
} shareChannel: {
|
} shareChannel: {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,6 @@ struct UserProfileView: View {
|
||||||
|
|
||||||
@State private var memberId: Int = 0
|
@State private var memberId: Int = 0
|
||||||
@State private var isShowMemberProfilePopup: Bool = false
|
@State private var isShowMemberProfilePopup: Bool = false
|
||||||
@State private var isShowFollowNotifyDialog: Bool = false
|
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
GeometryReader { proxy in
|
GeometryReader { proxy in
|
||||||
|
@ -53,8 +52,8 @@ struct UserProfileView: View {
|
||||||
UserProfileCreatorView(
|
UserProfileCreatorView(
|
||||||
creator: creatorProfile.creator) {
|
creator: creatorProfile.creator) {
|
||||||
viewModel.creatorFollow()
|
viewModel.creatorFollow()
|
||||||
} showCreatorFollowNotifyDialog: {
|
} creatorUnFollow: {
|
||||||
isShowFollowNotifyDialog = true
|
viewModel.creatorUnFollow()
|
||||||
} shareChannel: {
|
} shareChannel: {
|
||||||
viewModel.shareChannel(userId: userId)
|
viewModel.shareChannel(userId: userId)
|
||||||
}
|
}
|
||||||
|
@ -324,21 +323,6 @@ struct UserProfileView: View {
|
||||||
MemberProfileDialog(isShowing: $isShowMemberProfilePopup, memberId: memberId)
|
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(
|
.sheet(
|
||||||
isPresented: $viewModel.isShowShareView,
|
isPresented: $viewModel.isShowShareView,
|
||||||
|
|
|
@ -282,11 +282,11 @@ final class UserProfileViewModel: ObservableObject {
|
||||||
.store(in: &subscription)
|
.store(in: &subscription)
|
||||||
}
|
}
|
||||||
|
|
||||||
func creatorFollow(follow: Bool = true, notify: Bool = true) {
|
func creatorFollow() {
|
||||||
if let creator = creatorProfile {
|
if let creator = creatorProfile {
|
||||||
isLoading = true
|
isLoading = true
|
||||||
|
|
||||||
userRepository.creatorFollow(creatorId: creator.creator.creatorId, follow: follow, notify: notify)
|
userRepository.creatorFollow(creatorId: creator.creator.creatorId)
|
||||||
.sink { result in
|
.sink { result in
|
||||||
switch result {
|
switch result {
|
||||||
case .finished:
|
case .finished:
|
||||||
|
|
|
@ -12,7 +12,9 @@ struct FollowCreatorItemView: View {
|
||||||
|
|
||||||
let creator: GetCreatorFollowingAllListItem
|
let creator: GetCreatorFollowingAllListItem
|
||||||
let onClickFollow: (Int) -> Void
|
let onClickFollow: (Int) -> Void
|
||||||
let showCreatorFollowNotifyDialog: (Int) -> Void
|
let onClickUnFollow: (Int) -> Void
|
||||||
|
|
||||||
|
@State private var isFollow = true
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
VStack(spacing: 13.3) {
|
VStack(spacing: 13.3) {
|
||||||
|
@ -24,30 +26,29 @@ struct FollowCreatorItemView: View {
|
||||||
|
|
||||||
Text(creator.nickname)
|
Text(creator.nickname)
|
||||||
.font(.custom(Font.bold.rawValue, size: 16.7))
|
.font(.custom(Font.bold.rawValue, size: 16.7))
|
||||||
.foregroundColor(Color.grayee)
|
.foregroundColor(Color(hex: "eeeeee"))
|
||||||
.padding(.leading, 13.3)
|
.padding(.leading, 13.3)
|
||||||
|
|
||||||
Spacer()
|
Spacer()
|
||||||
|
|
||||||
Image(
|
Image(isFollow ? "btn_following_big" : "btn_follow_big")
|
||||||
creator.isFollow ?
|
|
||||||
creator.isNotify ?
|
|
||||||
"btn_following_big" :
|
|
||||||
"btn_following_no_alarm_big" :
|
|
||||||
"btn_follow_big"
|
|
||||||
)
|
|
||||||
.onTapGesture {
|
.onTapGesture {
|
||||||
if creator.isFollow {
|
if isFollow {
|
||||||
showCreatorFollowNotifyDialog(creator.creatorId)
|
onClickUnFollow(creator.creatorId)
|
||||||
} else {
|
} else {
|
||||||
onClickFollow(creator.creatorId)
|
onClickFollow(creator.creatorId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isFollow = !isFollow
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle()
|
Rectangle()
|
||||||
.foregroundColor(Color.gray59)
|
.foregroundColor(Color(hex: "595959"))
|
||||||
.frame(height: 0.5)
|
.frame(height: 0.5)
|
||||||
}
|
}
|
||||||
|
.onAppear {
|
||||||
|
isFollow = creator.isFollow
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,10 +11,6 @@ struct FollowCreatorView: View {
|
||||||
|
|
||||||
@StateObject var viewModel = FollowCreatorViewModel()
|
@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 {
|
var body: some View {
|
||||||
BaseView(isLoading: $viewModel.isLoading) {
|
BaseView(isLoading: $viewModel.isLoading) {
|
||||||
VStack(spacing: 0) {
|
VStack(spacing: 0) {
|
||||||
|
@ -46,14 +42,8 @@ struct FollowCreatorView: View {
|
||||||
|
|
||||||
FollowCreatorItemView(
|
FollowCreatorItemView(
|
||||||
creator: creator,
|
creator: creator,
|
||||||
onClickFollow: {
|
onClickFollow: { viewModel.creatorFollow(userId: $0) },
|
||||||
viewModel.creatorFollow(creatorId: $0, index: index)
|
onClickUnFollow: { viewModel.creatorUnFollow(userId: $0) }
|
||||||
},
|
|
||||||
showCreatorFollowNotifyDialog: {
|
|
||||||
creatorId = $0
|
|
||||||
selectedItemIndex = index
|
|
||||||
isShowFollowNotifyDialog = true
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
.padding(.horizontal, 20)
|
.padding(.horizontal, 20)
|
||||||
.onTapGesture {
|
.onTapGesture {
|
||||||
|
@ -94,42 +84,6 @@ struct FollowCreatorView: View {
|
||||||
Spacer()
|
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
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,9 +80,8 @@ final class FollowCreatorViewModel: ObservableObject {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func creatorFollow(creatorId: Int, index: Int, follow: Bool = true, notify: Bool = true) {
|
func creatorFollow(userId: Int) {
|
||||||
isLoading = true
|
userRepository.creatorFollow(creatorId: userId)
|
||||||
userRepository.creatorFollow(creatorId: creatorId, follow: follow, notify: notify)
|
|
||||||
.sink { result in
|
.sink { result in
|
||||||
switch result {
|
switch result {
|
||||||
case .finished:
|
case .finished:
|
||||||
|
@ -90,34 +89,20 @@ final class FollowCreatorViewModel: ObservableObject {
|
||||||
case .failure(let error):
|
case .failure(let error):
|
||||||
ERROR_LOG(error.localizedDescription)
|
ERROR_LOG(error.localizedDescription)
|
||||||
}
|
}
|
||||||
} receiveValue: { [unowned self] response in
|
} receiveValue: { _ in }
|
||||||
self.isLoading = false
|
.store(in: &subscription)
|
||||||
let responseData = response.data
|
|
||||||
|
|
||||||
do {
|
|
||||||
let jsonDecoder = JSONDecoder()
|
|
||||||
let decoded = try jsonDecoder.decode(ApiResponseWithoutData.self, from: responseData)
|
|
||||||
|
|
||||||
if decoded.success {
|
|
||||||
var creator = self.creatorList[index]
|
|
||||||
creator.isFollow = follow
|
|
||||||
creator.isNotify = notify
|
|
||||||
self.creatorList.remove(at: index)
|
|
||||||
self.creatorList.insert(creator, at: index)
|
|
||||||
} else {
|
|
||||||
if let message = decoded.message {
|
|
||||||
self.errorMessage = message
|
|
||||||
} else {
|
|
||||||
self.errorMessage = "다시 시도해 주세요.\n계속 같은 문제가 발생할 경우 고객센터로 문의 주시기 바랍니다."
|
|
||||||
}
|
}
|
||||||
|
|
||||||
self.isShowPopup = true
|
func creatorUnFollow(userId: Int) {
|
||||||
}
|
userRepository.creatorUnFollow(creatorId: userId)
|
||||||
} catch {
|
.sink { result in
|
||||||
self.errorMessage = "다시 시도해 주세요.\n계속 같은 문제가 발생할 경우 고객센터로 문의 주시기 바랍니다."
|
switch result {
|
||||||
self.isShowPopup = true
|
case .finished:
|
||||||
}
|
DEBUG_LOG("finish")
|
||||||
|
case .failure(let error):
|
||||||
|
ERROR_LOG(error.localizedDescription)
|
||||||
}
|
}
|
||||||
|
} receiveValue: { _ in }
|
||||||
.store(in: &subscription)
|
.store(in: &subscription)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,5 @@ struct GetCreatorFollowingAllListItem: Decodable {
|
||||||
let creatorId: Int
|
let creatorId: Int
|
||||||
let nickname: String
|
let nickname: String
|
||||||
let profileImageUrl: String
|
let profileImageUrl: String
|
||||||
var isFollow: Bool
|
let isFollow: Bool
|
||||||
var isNotify: Bool
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,7 +67,7 @@ struct SectionRecommendLiveView: View {
|
||||||
HStack(spacing: 4) {
|
HStack(spacing: 4) {
|
||||||
ForEach(0..<items.count, id: \.self) { index in
|
ForEach(0..<items.count, id: \.self) { index in
|
||||||
Capsule()
|
Capsule()
|
||||||
.foregroundColor(index == currentIndex ? Color.button : Color.gray90)
|
.foregroundColor(index == currentIndex ? Color(hex: "3bb9f1") : Color(hex: "909090"))
|
||||||
.frame(
|
.frame(
|
||||||
width: index == currentIndex ? 18 : 6,
|
width: index == currentIndex ? 18 : 6,
|
||||||
height: 6
|
height: 6
|
||||||
|
|
|
@ -1958,8 +1958,6 @@ extension LiveRoomViewModel: AgoraRtmDelegate {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
self.totalDonationCan += decoded.can
|
|
||||||
|
|
||||||
if let signature = decoded.signature {
|
if let signature = decoded.signature {
|
||||||
self.addSignature(signature: signature)
|
self.addSignature(signature: signature)
|
||||||
} else if let imageUrl = decoded.signatureImageUrl {
|
} else if let imageUrl = decoded.signatureImageUrl {
|
||||||
|
|
|
@ -9,6 +9,4 @@ import Foundation
|
||||||
|
|
||||||
struct CreatorFollowRequest: Encodable {
|
struct CreatorFollowRequest: Encodable {
|
||||||
let creatorId: Int
|
let creatorId: Int
|
||||||
var isNotify: Bool = true
|
|
||||||
var isActive: Bool = true
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,8 +69,8 @@ final class UserRepository {
|
||||||
return api.requestPublisher(.updatePushToken(request: PushTokenUpdateRequest(pushToken: pushToken)))
|
return api.requestPublisher(.updatePushToken(request: PushTokenUpdateRequest(pushToken: pushToken)))
|
||||||
}
|
}
|
||||||
|
|
||||||
func creatorFollow(creatorId: Int, follow: Bool = true, notify: Bool = true) -> AnyPublisher<Response, MoyaError> {
|
func creatorFollow(creatorId: Int) -> AnyPublisher<Response, MoyaError> {
|
||||||
return api.requestPublisher(.creatorFollow(request: CreatorFollowRequest(creatorId: creatorId, isNotify: notify, isActive: follow)))
|
return api.requestPublisher(.creatorFollow(request: CreatorFollowRequest(creatorId: creatorId)))
|
||||||
}
|
}
|
||||||
|
|
||||||
func creatorUnFollow(creatorId: Int) -> AnyPublisher<Response, MoyaError> {
|
func creatorUnFollow(creatorId: Int) -> AnyPublisher<Response, MoyaError> {
|
||||||
|
|