diff --git a/SodaLive/Resources/Assets.xcassets/img_live.imageset/Contents.json b/SodaLive/Resources/Assets.xcassets/img_live.imageset/Contents.json new file mode 100644 index 0000000..c23355f --- /dev/null +++ b/SodaLive/Resources/Assets.xcassets/img_live.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "img_live.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/SodaLive/Resources/Assets.xcassets/img_live.imageset/img_live.png b/SodaLive/Resources/Assets.xcassets/img_live.imageset/img_live.png new file mode 100644 index 0000000..0b4409d Binary files /dev/null and b/SodaLive/Resources/Assets.xcassets/img_live.imageset/img_live.png differ diff --git a/SodaLive/Resources/Assets.xcassets/rank_1.imageset/Contents.json b/SodaLive/Resources/Assets.xcassets/rank_1.imageset/Contents.json new file mode 100644 index 0000000..244013a --- /dev/null +++ b/SodaLive/Resources/Assets.xcassets/rank_1.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "rank_1.pdf", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/SodaLive/Resources/Assets.xcassets/rank_1.imageset/rank_1.pdf b/SodaLive/Resources/Assets.xcassets/rank_1.imageset/rank_1.pdf new file mode 100644 index 0000000..cd269fb Binary files /dev/null and b/SodaLive/Resources/Assets.xcassets/rank_1.imageset/rank_1.pdf differ diff --git a/SodaLive/Resources/Assets.xcassets/rank_2.imageset/Contents.json b/SodaLive/Resources/Assets.xcassets/rank_2.imageset/Contents.json new file mode 100644 index 0000000..4f22f03 --- /dev/null +++ b/SodaLive/Resources/Assets.xcassets/rank_2.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "rank_2.pdf", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/SodaLive/Resources/Assets.xcassets/rank_2.imageset/rank_2.pdf b/SodaLive/Resources/Assets.xcassets/rank_2.imageset/rank_2.pdf new file mode 100644 index 0000000..2306469 Binary files /dev/null and b/SodaLive/Resources/Assets.xcassets/rank_2.imageset/rank_2.pdf differ diff --git a/SodaLive/Resources/Assets.xcassets/rank_3.imageset/Contents.json b/SodaLive/Resources/Assets.xcassets/rank_3.imageset/Contents.json new file mode 100644 index 0000000..1cc0a68 --- /dev/null +++ b/SodaLive/Resources/Assets.xcassets/rank_3.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "rank_3.pdf", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/SodaLive/Resources/Assets.xcassets/rank_3.imageset/rank_3.pdf b/SodaLive/Resources/Assets.xcassets/rank_3.imageset/rank_3.pdf new file mode 100644 index 0000000..496a226 Binary files /dev/null and b/SodaLive/Resources/Assets.xcassets/rank_3.imageset/rank_3.pdf differ diff --git a/SodaLive/Resources/Debug/SodaLive-dev-Info.plist b/SodaLive/Resources/Debug/SodaLive-dev-Info.plist index 1b3130e..e9d3dd0 100644 --- a/SodaLive/Resources/Debug/SodaLive-dev-Info.plist +++ b/SodaLive/Resources/Debug/SodaLive-dev-Info.plist @@ -242,6 +242,10 @@ gmarket_sans_bold.otf gmarket_sans_medium.otf gmarket_sans_light.otf + Pretendard-Bold.otf + Pretendard-Medium.otf + Pretendard-Light.otf + Pretendard-Regular.otf UIBackgroundModes diff --git a/SodaLive/Resources/Font/Pretendard-Bold.otf b/SodaLive/Resources/Font/Pretendard-Bold.otf new file mode 100644 index 0000000..8e5e30a Binary files /dev/null and b/SodaLive/Resources/Font/Pretendard-Bold.otf differ diff --git a/SodaLive/Resources/Font/Pretendard-Light.otf b/SodaLive/Resources/Font/Pretendard-Light.otf new file mode 100644 index 0000000..228679e Binary files /dev/null and b/SodaLive/Resources/Font/Pretendard-Light.otf differ diff --git a/SodaLive/Resources/Font/Pretendard-Medium.otf b/SodaLive/Resources/Font/Pretendard-Medium.otf new file mode 100644 index 0000000..0575069 Binary files /dev/null and b/SodaLive/Resources/Font/Pretendard-Medium.otf differ diff --git a/SodaLive/Resources/Font/Pretendard-Regular.otf b/SodaLive/Resources/Font/Pretendard-Regular.otf new file mode 100644 index 0000000..08bf4cf Binary files /dev/null and b/SodaLive/Resources/Font/Pretendard-Regular.otf differ diff --git a/SodaLive/Resources/Info.plist b/SodaLive/Resources/Info.plist index 2cf3c09..b6c45b9 100644 --- a/SodaLive/Resources/Info.plist +++ b/SodaLive/Resources/Info.plist @@ -242,6 +242,10 @@ gmarket_sans_bold.otf gmarket_sans_medium.otf gmarket_sans_light.otf + Pretendard-Bold.otf + Pretendard-Medium.otf + Pretendard-Light.otf + Pretendard-Regular.otf UIBackgroundModes diff --git a/SodaLive/SodaLive.entitlements b/SodaLive/SodaLive.entitlements index 15006dd..2eb4e93 100644 --- a/SodaLive/SodaLive.entitlements +++ b/SodaLive/SodaLive.entitlements @@ -4,10 +4,6 @@ aps-environment development - com.apple.developer.applesignin - - Default - com.apple.developer.associated-domains applinks:voiceon.onelink.me diff --git a/SodaLive/Sources/Content/ContentItemView.swift b/SodaLive/Sources/Content/ContentItemView.swift index 728d963..c6005c1 100644 --- a/SodaLive/Sources/Content/ContentItemView.swift +++ b/SodaLive/Sources/Content/ContentItemView.swift @@ -23,23 +23,6 @@ struct ContentItemView: View { .cornerRadius(16) HStack(alignment: .top, spacing: 0) { - Text("신작") - .font(.custom(Font.medium.rawValue, size: 12)) - .foregroundColor(.white) - .padding(.horizontal, 10) - .padding(.vertical, 3) - .background( - LinearGradient( - gradient: Gradient(stops: [ - .init(color: Color(hex: "0001B1"), location: 0.24), - .init(color: Color(hex: "3B5FF1"), location: 1.0) - ]), - startPoint: .top, - endPoint: .bottom - ) - ) - .cornerRadius(16, corners: [.topLeft, .bottomRight]) - Spacer() if item.isPointAvailable { diff --git a/SodaLive/Sources/Content/Main/V2/ContentMainContentThemeView.swift b/SodaLive/Sources/Content/Main/V2/ContentMainContentThemeView.swift index 1bacfc7..68bb361 100644 --- a/SodaLive/Sources/Content/Main/V2/ContentMainContentThemeView.swift +++ b/SodaLive/Sources/Content/Main/V2/ContentMainContentThemeView.swift @@ -16,24 +16,23 @@ struct ContentMainContentThemeView: View { var body: some View { ScrollView(.horizontal, showsIndicators: false) { - HStack(alignment: .top, spacing: 8) { + HStack(alignment: .top, spacing: 16) { ForEach(0.. Void + let themeList: [String] + let contentList: [AudioContentMainItem] + + let selectTheme: (String) -> Void + @State private var selectedTheme = "전체" + + let rows = [ + GridItem(.flexible(), alignment: .leading), + GridItem(.flexible(), alignment: .leading) + ] + + var body: some View { + HStack(spacing: 0) { + Text("최신") + .font(.custom(Font.preBold.rawValue, size: 26)) + .foregroundColor(.button) + + Text(" 콘텐츠") + .font(.custom(Font.preBold.rawValue, size: 26)) + .foregroundColor(.white) + + Spacer() + + Text("전체보기") + .font(.custom(Font.preRegular.rawValue, size: 14)) + .foregroundColor(.init(hex: "78909C")) + .onTapGesture { onClickMore() } + } + .padding(.horizontal, 24) + + if !themeList.isEmpty { + ContentMainContentThemeView( + themeList: themeList, + selectTheme: selectTheme, + selectedTheme: $selectedTheme + ) + } + + ScrollView(.horizontal, showsIndicators: false) { + LazyHGrid(rows: rows, spacing: 16) { + ForEach(0..() + + func fetchData() -> AnyPublisher { + return api.requestPublisher( + .getHomeData( + isAdultContentVisible: UserDefaults.isAdultContentVisible(), + contentType: ContentType(rawValue: UserDefaults.string(forKey: .contentPreference)) ?? ContentType.ALL + ) + ) + } + + func getLatestContentByTheme(theme: String) -> AnyPublisher { + return api.requestPublisher( + .getLatestContentByTheme( + theme: theme, + isAdultContentVisible: UserDefaults.isAdultContentVisible(), + contentType: ContentType(rawValue: UserDefaults.string(forKey: .contentPreference)) ?? ContentType.ALL + ) + ) + } + + func getDayOfWeekSeriesList(dayOfWeek: SeriesPublishedDaysOfWeek) -> AnyPublisher { + return api.requestPublisher( + .getDayOfWeekSeriesList( + dayOfWeek: dayOfWeek, + isAdultContentVisible: UserDefaults.isAdultContentVisible(), + contentType: ContentType(rawValue: UserDefaults.string(forKey: .contentPreference)) ?? ContentType.ALL + ) + ) + } } diff --git a/SodaLive/Sources/Home/HomeTabView.swift b/SodaLive/Sources/Home/HomeTabView.swift index 1a97643..45419be 100644 --- a/SodaLive/Sources/Home/HomeTabView.swift +++ b/SodaLive/Sources/Home/HomeTabView.swift @@ -8,7 +8,7 @@ import SwiftUI struct HomeTabView: View { - @StateObject var viewModel = ContentMainTabHomeViewModel() + @StateObject var viewModel = HomeTabViewModel() @AppStorage("token") private var token: String = UserDefaults.string(forKey: UserDefaultsKey.token) @AppStorage("role") private var role: String = UserDefaults.string(forKey: UserDefaultsKey.role) @@ -35,80 +35,88 @@ struct HomeTabView: View { ScrollView(.vertical, showsIndicators: false) { VStack(alignment: .leading, spacing: 48) { - VStack(alignment: .leading, spacing: 16) { - HStack(spacing: 0) { - Text("지금") - .font(.custom(Font.bold.rawValue, size: 26)) - .foregroundColor(.button) - - Text(" 라이브중") - .font(.custom(Font.bold.rawValue, size: 26)) - .foregroundColor(.white) - } - - ScrollView(.horizontal, showsIndicators: false) { - HStack(spacing: 16) { + if !viewModel.liveList.isEmpty { + VStack(alignment: .leading, spacing: 16) { + HStack(spacing: 0) { + Text("지금") + .font(.custom(Font.preBold.rawValue, size: 26)) + .foregroundColor(.button) + Text(" 라이브중") + .font(.custom(Font.preBold.rawValue, size: 26)) + .foregroundColor(.white) + } + .padding(.horizontal, 24) + + ScrollView(.horizontal, showsIndicators: false) { + HStack(spacing: 16) { + ForEach(0...self, from: responseData) + + if let data = decoded.data, decoded.success { + self.liveList = data.liveList + self.creatorRanking = data.creatorRanking + self.latestContentThemeList = ["전체"] + data.latestContentThemeList + self.latestContentList = data.latestContentList + self.eventBannerList = data.eventBannerList.eventList + self.originalAudioDramaList = data.originalAudioDramaList + self.auditionList = data.auditionList + self.dayOfWeekSeriesList = data.dayOfWeekSeriesList + self.contentRanking = data.contentRanking + self.recommendChannelList = data.recommendChannelList + self.freeContentList = data.freeContentList + self.curationList = data.curationList + } else { + if let message = decoded.message { + self.errorMessage = message + } else { + self.errorMessage = "다시 시도해 주세요.\n계속 같은 문제가 발생할 경우 고객센터로 문의 주시기 바랍니다." + } + + self.isShowPopup = true + } + } catch { + self.errorMessage = "다시 시도해 주세요.\n계속 같은 문제가 발생할 경우 고객센터로 문의 주시기 바랍니다." + self.isShowPopup = true + } + + self.isLoading = false + } + .store(in: &subscription) + } + + func getLatestContentByTheme(theme: String) { + isLoading = true + + repository.getLatestContentByTheme(theme: theme == "전체" ? "" : theme) + .sink { result in + switch result { + case .finished: + DEBUG_LOG("finish") + case .failure(let error): + ERROR_LOG(error.localizedDescription) + } + } receiveValue: { [unowned self] response in + let responseData = response.data + + do { + let jsonDecoder = JSONDecoder() + let decoded = try jsonDecoder.decode(ApiResponse<[AudioContentMainItem]>.self, from: responseData) + + if let data = decoded.data, decoded.success { + self.latestContentList = data + } else { + if let message = decoded.message { + self.errorMessage = message + } else { + self.errorMessage = "다시 시도해 주세요.\n계속 같은 문제가 발생할 경우 고객센터로 문의 주시기 바랍니다." + } + + self.isShowPopup = true + } + } catch { + self.errorMessage = "다시 시도해 주세요.\n계속 같은 문제가 발생할 경우 고객센터로 문의 주시기 바랍니다." + self.isShowPopup = true + } + + self.isLoading = false + } + .store(in: &subscription) + } } diff --git a/SodaLive/Sources/User/Login/LoginView.swift b/SodaLive/Sources/User/Login/LoginView.swift index 727cb41..f0c0979 100644 --- a/SodaLive/Sources/User/Login/LoginView.swift +++ b/SodaLive/Sources/User/Login/LoginView.swift @@ -114,30 +114,6 @@ struct LoginView: View { } .padding(.top, 20) - HStack(spacing: 13.3) { - Image("ic_login_email") - .onTapGesture { - hideKeyboard() - AppState.shared.setAppStep(step: .signUp) - } - - Image("ic_login_kakao") - .onTapGesture { - hideKeyboard() - } - - Image("ic_login_google") - .onTapGesture { - hideKeyboard() - } - - Image("ic_login_apple") - .onTapGesture { - hideKeyboard() - } - } - .padding(.top, 20) - Spacer() } .onAppear {