feat(creator): 현재 라이브 섹션을 연결한다

This commit is contained in:
Yu Sung
2026-07-03 02:48:42 +09:00
parent 2f1feb9561
commit 0e358d73c3
7 changed files with 189 additions and 4 deletions

View File

@@ -25,6 +25,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
private var subscription = Set<AnyCancellable>()
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
guard !Self.isRunningForPreviews else { return true }
FirebaseApp.configure()
LoginManager.shared.setup(channelID: LINE_CHANNEL_ID, universalLinkURL: nil)
Notifly.initialize(projectId: NOTIFLY_PROJECT_ID, username: NOTIFLY_USERNAME, password: NOTIFLY_PASSWORD)
@@ -50,6 +52,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
return true
}
private static var isRunningForPreviews: Bool {
ProcessInfo.processInfo.environment["XCODE_RUNNING_FOR_PREVIEWS"] == "1"
}
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
// Print full message.

View File

@@ -29,8 +29,14 @@ struct SodaLiveApp: App {
configureImageCache()
// ,
LanguageHeaderProvider.initialize()
guard !Self.isRunningForPreviews else { return }
KakaoSDK.initSDK(appKey: KAKAO_APP_KEY)
}
private static var isRunningForPreviews: Bool {
ProcessInfo.processInfo.environment["XCODE_RUNNING_FOR_PREVIEWS"] == "1"
}
private func configureImageCache() {
// Kingfisher
@@ -50,6 +56,8 @@ struct SodaLiveApp: App {
ContentView(canPgPaymentViewModel: canPgPaymentViewModel)
.environment(\.locale, languageEnvironment.locale)
.task {
guard !Self.isRunningForPreviews else { return }
await LanguageContainer.service.bootstrap()
}
.onReceive(NotificationCenter.default.publisher(for: UIApplication.didEnterBackgroundNotification)) { _ in
@@ -62,6 +70,8 @@ struct SodaLiveApp: App {
ImageCache.default.clearMemoryCache()
}
.onReceive(NotificationCenter.default.publisher(for: UIApplication.didBecomeActiveNotification)) { _ in
guard !Self.isRunningForPreviews else { return }
UIApplication.shared.applicationIconBadgeNumber = 0
AppsFlyerLib.shared().start()

View File

@@ -86,6 +86,8 @@ struct SplashView: View {
}
private func fetchLastestVersion() {
guard !isRunningForPreviews else { return }
let remoteConfig = RemoteConfig.remoteConfig()
let configSettings = RemoteConfigSettings()
configSettings.minimumFetchInterval = 60
@@ -163,6 +165,10 @@ struct SplashView: View {
nextAppStep()
}
}
private var isRunningForPreviews: Bool {
ProcessInfo.processInfo.environment["XCODE_RUNNING_FOR_PREVIEWS"] == "1"
}
}
#Preview {

View File

@@ -0,0 +1,140 @@
import SwiftUI
struct CreatorChannelCurrentLiveSection: View {
let currentLive: CreatorChannelLiveResponse?
let onTapLive: (Int) -> Void
init(
currentLive: CreatorChannelLiveResponse?,
onTapLive: @escaping (Int) -> Void = { _ in }
) {
self.currentLive = currentLive
self.onTapLive = onTapLive
}
var body: some View {
if let currentLive {
CreatorChannelCurrentLiveCard(live: currentLive) {
onTapLive(currentLive.liveId)
}
.padding(.horizontal, SodaSpacing.s20)
}
}
}
private struct CreatorChannelCurrentLiveCard: View {
let live: CreatorChannelLiveResponse
let action: () -> Void
var body: some View {
Button(action: action) {
HStack(alignment: .center, spacing: 0) {
VStack(alignment: .leading, spacing: SodaSpacing.s4) {
HStack(alignment: .center, spacing: SodaSpacing.s8) {
LiveTagView()
Text(live.relativeStartedAtText())
.appFont(size: 14, weight: .regular)
.foregroundColor(Color.gray700)
.lineLimit(1)
.fixedSize(horizontal: true, vertical: false)
}
Text(live.title)
.appFont(size: 18, weight: .bold)
.foregroundColor(.black)
.lineLimit(1)
.truncationMode(.tail)
}
.frame(width: 262, alignment: .leading)
Spacer(minLength: 0)
priceBadge
.frame(height: 78)
.layoutPriority(1)
}
.padding(.leading, SodaSpacing.s24)
.padding(.trailing, SodaSpacing.s14)
.frame(maxWidth: .infinity, minHeight: 78, alignment: .leading)
.background(cardBackground)
.clipShape(Capsule())
}
.buttonStyle(.plain)
}
private var cardBackground: LinearGradient {
LinearGradient(
colors: [Color(hex: "00FBE2"), Color(hex: "62CFFF")],
startPoint: .leading,
endPoint: .trailing
)
}
private var priceBadge: some View {
ZStack {
HStack(spacing: 2) {
Image("ic_bar_cash")
.resizable()
.scaledToFit()
Text(live.priceText)
.appFont(size: 14, weight: .regular)
.foregroundColor(.white)
.lineLimit(1)
.fixedSize(horizontal: true, vertical: false)
}
.padding(.horizontal, SodaSpacing.s6)
.padding(.vertical, SodaSpacing.s4)
.background(Color.black.opacity(0.4))
.clipShape(Capsule())
}
}
}
private struct LiveTagView: View {
var body: some View {
HStack(alignment: .center, spacing: SodaSpacing.s4) {
Circle()
.fill(Color.red400)
.frame(width: 8, height: 8)
Text(I18n.HomeFollowing.liveTag)
.appFont(size: 12, weight: .regular)
.foregroundColor(.white)
.lineLimit(1)
}
.padding(.horizontal, SodaSpacing.s6)
.padding(.vertical, 2)
.frame(height: 18)
.background(Color.black)
.clipShape(Capsule())
}
}
private extension CreatorChannelLiveResponse {
func relativeStartedAtText(now: Date = Date()) -> String {
DateParser.relativeTimeText(fromUTC: beginDateTimeUtc, fallback: beginDateTimeUtc, now: now)
}
var priceText: String {
price > 0 ? price.comma() : I18n.LiveReservation.Item.free
}
}
struct CreatorChannelCurrentLiveSection_Previews: PreviewProvider {
static var previews: some View {
CreatorChannelCurrentLiveSection(
currentLive: CreatorChannelLiveResponse(
liveId: 1,
title: "라이브 제목",
coverImageUrl: "https://picsum.photos/300/300",
beginDateTimeUtc: "2026-07-01T00:30:00Z",
price: 300,
isAdult: true
)
)
.background(Color.black)
.previewLayout(.sizeThatFits)
}
}

View File

@@ -3,12 +3,26 @@ import SwiftUI
struct CreatorChannelHomeView: View {
let response: CreatorChannelHomeResponse
let onSelectTab: (CreatorChannelTab) -> Void
let onTapLive: (Int) -> Void
init(
response: CreatorChannelHomeResponse,
onSelectTab: @escaping (CreatorChannelTab) -> Void,
onTapLive: @escaping (Int) -> Void = { _ in }
) {
self.response = response
self.onSelectTab = onSelectTab
self.onTapLive = onTapLive
}
var body: some View {
ScrollView {
Color.clear
.frame(height: 1)
VStack(alignment: .leading, spacing: 0) {
CreatorChannelCurrentLiveSection(
currentLive: response.currentLive,
onTapLive: onTapLive
)
}
.frame(maxWidth: .infinity, alignment: .leading)
.background(Color.black)
}
}