콘텐츠 메인, 라이브 메인, 오디션 메인, 마이페이지

- 로그인 하지 않고 페이지 조회가 되도록 수정
This commit is contained in:
Yu Sung
2025-03-24 18:32:27 +09:00
parent fa94c5447f
commit 80cb19a1c7
32 changed files with 874 additions and 595 deletions

View File

@@ -17,10 +17,12 @@ struct MyPageView: View {
@StateObject var viewModel = MyPageViewModel()
@State private var payload = Payload()
@AppStorage("token") private var token: String = UserDefaults.string(forKey: UserDefaultsKey.token)
var body: some View {
BaseView(isLoading: $viewModel.isLoading) {
if viewModel.isShowAuthView {
if !token.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty &&
viewModel.isShowAuthView {
BootpayUI(payload: payload, requestType: BootpayRequest.TYPE_AUTHENTICATION)
.onConfirm {
DEBUG_LOG("onConfirm: \($0)")
@@ -47,100 +49,45 @@ struct MyPageView: View {
GeometryReader { geo in
VStack {
HomeNavigationBar(title: "마이 페이지") {
Image("ic_settings")
.resizable()
.frame(width: 20, height: 20)
.onTapGesture {
AppState.shared.setAppStep(step: .settings)
}
}
RefreshableScrollView(
refreshing: $viewModel.isLoading,
action: {
viewModel.getMypage()
if !token.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty {
Image("ic_settings")
.resizable()
.frame(width: 20, height: 20)
.onTapGesture {
AppState.shared.setAppStep(step: .settings)
}
}
) {
VStack(spacing: 0) {
if let data = viewModel.myPageResponse {
MyInfoCardView(data: data) {
viewModel.getMypage()
}
.frame(width: screenSize().width - 26.7)
.padding(.top, 13.3)
if UserDefaults.string(forKey: .role) == MemberRole.CREATOR.rawValue {
Text("내 채널 보기")
.frame(width: screenSize().width - 26.7, height: 46.7)
.font(.custom(Font.bold.rawValue, size: 15.3))
.foregroundColor(Color.grayee)
.background(Color.button)
.cornerRadius(6.7)
.padding(.top, 26.7)
.onTapGesture {
AppState.shared.setAppStep(step: .creatorDetail(userId: UserDefaults.int(forKey: .userId)))
}
}
HStack(spacing: 10.7) {
Text("팔로잉 리스트")
.font(.custom(Font.bold.rawValue, size: 14.7))
.foregroundColor(Color.button)
.frame(maxWidth: .infinity)
.padding(.vertical, 13.3)
.background(Color.bg)
.cornerRadius(6.7)
.overlay(
RoundedRectangle(cornerRadius: 6.7)
.stroke(Color.button, lineWidth: 1.3)
)
.contentShape(Rectangle())
.onTapGesture {
AppState.shared.setAppStep(step: .followingList)
}
Text("차단 리스트")
.font(.custom(Font.bold.rawValue, size: 14.7))
.foregroundColor(Color.button)
.frame(maxWidth: .infinity)
.padding(.vertical, 13.3)
.background(Color.bg)
.cornerRadius(6.7)
.overlay(
RoundedRectangle(cornerRadius: 6.7)
.stroke(Color.button, lineWidth: 1.3)
)
.contentShape(Rectangle())
.onTapGesture {
AppState.shared.setAppStep(step: .blockList)
}
}
.padding(.top, 26.7)
.padding(.horizontal, 13.3)
if UserDefaults.int(forKey: .userId) != 17958 {
CanCardView(data: data) {
}
if !token.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty {
RefreshableScrollView(
refreshing: $viewModel.isLoading,
action: {
viewModel.getMypage()
}
) {
VStack(spacing: 0) {
if let data = viewModel.myPageResponse {
MyInfoCardView(data: data) {
viewModel.getMypage()
}
.frame(width: screenSize().width - 26.7)
.padding(.top, 26.7)
}
if data.isAuth {
CanChargeCouponButtonView()
.frame(width: screenSize().width - 26.7)
.padding(.top, 13.3)
.onTapGesture {
AppState.shared.setAppStep(step: .canCoupon)
}
}
VStack(alignment: .leading, spacing: 13.3) {
Text("내 보관함")
.font(.custom(Font.bold.rawValue, size: 18.3))
.foregroundColor(Color.grayee)
.padding(.top, 13.3)
if UserDefaults.string(forKey: .role) == MemberRole.CREATOR.rawValue {
Text("내 채널 보기")
.frame(width: screenSize().width - 26.7, height: 46.7)
.font(.custom(Font.bold.rawValue, size: 15.3))
.foregroundColor(Color.grayee)
.background(Color.button)
.cornerRadius(6.7)
.padding(.top, 26.7)
.onTapGesture {
AppState.shared.setAppStep(step: .creatorDetail(userId: UserDefaults.int(forKey: .userId)))
}
}
HStack(spacing: 10.7) {
Text("구매목록")
Text("팔로잉 리스트")
.font(.custom(Font.bold.rawValue, size: 14.7))
.foregroundColor(Color.button)
.frame(maxWidth: .infinity)
@@ -153,10 +100,10 @@ struct MyPageView: View {
)
.contentShape(Rectangle())
.onTapGesture {
AppState.shared.setAppStep(step: .myBox(currentTab: .orderlist))
AppState.shared.setAppStep(step: .followingList)
}
Text("재생목록")
Text("차단 리스트")
.font(.custom(Font.bold.rawValue, size: 14.7))
.foregroundColor(Color.button)
.frame(maxWidth: .infinity)
@@ -169,26 +116,175 @@ struct MyPageView: View {
)
.contentShape(Rectangle())
.onTapGesture {
AppState.shared.setAppStep(step: .myBox(currentTab: .playlist))
AppState.shared.setAppStep(step: .blockList)
}
}
.padding(.top, 26.7)
.padding(.horizontal, 13.3)
if UserDefaults.int(forKey: .userId) != 17958 {
CanCardView(data: data) {
viewModel.getMypage()
}
.frame(width: screenSize().width - 26.7)
.padding(.top, 26.7)
}
if data.isAuth {
CanChargeCouponButtonView()
.frame(width: screenSize().width - 26.7)
.padding(.top, 13.3)
.onTapGesture {
AppState.shared.setAppStep(step: .canCoupon)
}
}
VStack(alignment: .leading, spacing: 13.3) {
Text("내 보관함")
.font(.custom(Font.bold.rawValue, size: 18.3))
.foregroundColor(Color.grayee)
HStack(spacing: 10.7) {
Text("구매목록")
.font(.custom(Font.bold.rawValue, size: 14.7))
.foregroundColor(Color.button)
.frame(maxWidth: .infinity)
.padding(.vertical, 13.3)
.background(Color.bg)
.cornerRadius(6.7)
.overlay(
RoundedRectangle(cornerRadius: 6.7)
.stroke(Color.button, lineWidth: 1.3)
)
.contentShape(Rectangle())
.onTapGesture {
AppState.shared.setAppStep(step: .myBox(currentTab: .orderlist))
}
Text("재생목록")
.font(.custom(Font.bold.rawValue, size: 14.7))
.foregroundColor(Color.button)
.frame(maxWidth: .infinity)
.padding(.vertical, 13.3)
.background(Color.bg)
.cornerRadius(6.7)
.overlay(
RoundedRectangle(cornerRadius: 6.7)
.stroke(Color.button, lineWidth: 1.3)
)
.contentShape(Rectangle())
.onTapGesture {
AppState.shared.setAppStep(step: .myBox(currentTab: .playlist))
}
}
}
.padding(.top, 33)
.padding(.horizontal, 13.3)
ReservationStatusView(data: data)
.padding(.top, 40)
ServiceCenterButtonView()
.padding(.top, 40)
if !data.isAuth {
AuthButtonView()
.padding(.top, 40)
.onTapGesture {
viewModel.isShowAuthView = true
}
}
if let url = URL(string: "https://blog.naver.com/sodalive_official"),
UIApplication.shared.canOpenURL(url) {
Image("img_how_to_use")
.resizable()
.frame(
width: screenSize().width,
height: (200 * screenSize().width) / 1080
)
.padding(.vertical, 40)
.onTapGesture {
UIApplication.shared.open(url)
}
}
}
.padding(.top, 33)
}
}
} else {
ScrollView(.vertical, showsIndicators: false) {
VStack(spacing: 24) {
HStack(spacing: 6.7) {
Image("ic_logo_circle_gray")
Text("Login")
.font(.custom(Font.medium.rawValue, size: 32))
.foregroundColor(.gray90)
}
.padding(20)
.frame(maxWidth: .infinity)
.background(Color.bg)
.cornerRadius(6.7)
.contentShape(Rectangle())
.padding(.horizontal, 13.3)
.padding(.top, 24)
.onTapGesture {
AppState.shared
.setAppStep(step: .login)
}
HStack(spacing: 0) {
HStack(spacing: 6.7) {
Text("0")
.font(.custom(Font.bold.rawValue, size: 18.3))
.foregroundColor(.grayee)
Image("ic_can")
.resizable()
.frame(width: 20, height: 20)
Image("ic_forward")
.resizable()
.frame(width: 20, height: 20)
}
.onTapGesture {
AppState.shared
.setAppStep(step: .login)
}
Spacer()
HStack(spacing: 7) {
Image("ic_coin_w")
.resizable()
.frame(width: 26.7, height: 26.7)
Text("충전")
.font(.custom(Font.bold.rawValue, size: 12))
.foregroundColor(Color(hex: "b38fff"))
}
.padding(.horizontal, 11.3)
.padding(.vertical, 7)
.overlay(
RoundedRectangle(cornerRadius: CGFloat(16.7))
.stroke(lineWidth: 1)
.foregroundColor(Color(hex: "b38fff"))
)
.cornerRadius(16.7)
.onTapGesture {
AppState.shared
.setAppStep(step: .login)
}
}
.frame(maxWidth: .infinity)
.padding(.horizontal, 13.3)
.padding(.vertical, 10)
.background(Color.gray22)
.cornerRadius(6.7)
.padding(.horizontal, 13.3)
ReservationStatusView(data: data)
.padding(.top, 40)
ServiceCenterButtonView()
.padding(.top, 40)
if !data.isAuth {
AuthButtonView()
.padding(.top, 40)
.onTapGesture {
viewModel.isShowAuthView = true
}
}
.padding(.horizontal, 13.3)
if let url = URL(string: "https://blog.naver.com/sodalive_official"),
UIApplication.shared.canOpenURL(url) {
@@ -198,7 +294,6 @@ struct MyPageView: View {
width: screenSize().width,
height: (200 * screenSize().width) / 1080
)
.padding(.vertical, 40)
.onTapGesture {
UIApplication.shared.open(url)
}
@@ -210,7 +305,9 @@ struct MyPageView: View {
.frame(width: geo.size.width, height: geo.size.height)
}
.onAppear {
viewModel.getMypage()
if !token.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty {
viewModel.getMypage()
}
}
}
}

View File

@@ -43,6 +43,6 @@ extension FaqApi: TargetType {
}
var headers: [String : String]? {
return ["Authorization": "Bearer \(UserDefaults.string(forKey: UserDefaultsKey.token))"]
return nil
}
}

View File

@@ -25,8 +25,9 @@ struct ServiceCenterButtonView: View {
.frame(width: 20, height: 20)
}
.padding(.horizontal, 13.3)
.frame(width: screenSize().width - 26.7, height: 66.7)
.background(Color(hex: "13181b"))
.frame(height: 66.7)
.frame(maxWidth: .infinity)
.background(Color.bg)
.cornerRadius(6.7)
.onTapGesture {
AppState.shared.setAppStep(step: .serviceCenter)

View File

@@ -25,7 +25,7 @@ struct ServiceCenterView: View {
Text("고객센터")
.font(.custom(Font.bold.rawValue, size: 20))
.foregroundColor(Color(hex: "eeeeee"))
.foregroundColor(.grayee)
HStack(spacing: 13.3) {
Image("ic_service_center_kakao")
@@ -48,13 +48,14 @@ struct ServiceCenterView: View {
Rectangle()
.frame(width: screenSize().width, height: 6.7)
.foregroundColor(Color(hex: "232323"))
.foregroundColor(.gray23)
.padding(.vertical, 20)
Text("자주 묻는 질문")
.font(.custom(Font.bold.rawValue, size: 18.3))
.foregroundColor(Color(hex: "eeeeee"))
.frame(width: screenSize().width - 26.7, alignment: .leading)
.foregroundColor(.grayee)
.frame(maxWidth: .infinity, alignment: .leading)
.padding(.horizontal, 13.3)
ServiceCenterCategoryView(
categories: viewModel.categories,