회사정보 변경

This commit is contained in:
Yu Sung 2024-05-21 01:24:27 +09:00
parent 568d7f2284
commit 043a583985
7 changed files with 31 additions and 20 deletions

View File

@ -37,6 +37,8 @@ class AppState: ObservableObject {
}
@Published var eventPopup: EventItem? = nil
@Published var purchasedContentId = 0
@Published var purchasedContentOrderType = OrderType.KEEP
func setAppStep(step: AppStep) {
switch step {

View File

@ -128,5 +128,5 @@ enum AppStep {
case seriesContentAll(seriesId: Int, seriesTitle: String)
case tempCanPayment(title: String, can: Int, onSuccess: () -> Void)
case tempCanPayment(orderType: OrderType, contentId: Int, title: String, can: Int)
}

View File

@ -230,11 +230,10 @@ struct ContentDetailView: View {
AppState.shared
.setAppStep(
step: .tempCanPayment(
orderType: orderType,
contentId: audioContent.contentId,
title: audioContent.title,
can: orderType == .RENTAL ? Int(ceil(Double(audioContent.price) * 0.6)) : audioContent.price,
onSuccess: {
viewModel.order(orderType: orderType)
}
can: orderType == .RENTAL ? Int(ceil(Double(audioContent.price) * 0.6)) : audioContent.price
)
)
} else {

View File

@ -62,7 +62,11 @@ final class ContentDetailViewModel: ObservableObject {
let decoded = try jsonDecoder.decode(ApiResponse<GetAudioContentDetailResponse>.self, from: responseData)
if let data = decoded.data, decoded.success {
self.audioContent = data
if AppState.shared.purchasedContentId > 0 && AppState.shared.purchasedContentId == data.contentId {
self.order(orderType: AppState.shared.purchasedContentOrderType)
} else {
self.audioContent = data
}
} else {
if let message = decoded.message {
self.errorMessage = message
@ -298,6 +302,9 @@ final class ContentDetailViewModel: ObservableObject {
let decoded = try jsonDecoder.decode(ApiResponseWithoutData.self, from: responseData)
if decoded.success {
AppState.shared.purchasedContentId = 0
AppState.shared.purchasedContentOrderType = .KEEP
self.orderType = nil
self.errorMessage = orderType == .RENTAL ? "대여가 완료되었습니다." : "구매가 완료되었습니다."
self.isShowPopup = true

View File

@ -187,8 +187,8 @@ struct ContentView: View {
case .seriesContentAll(let seriesId, let seriesTitle):
SeriesContentAllView(seriesId: seriesId, seriesTitle: seriesTitle)
case .tempCanPayment(let title, let can, let onSuccess):
CanPaymentTempView(title: title, can: can, onSuccess: onSuccess)
case .tempCanPayment(let orderType, let contentId, let title, let can):
CanPaymentTempView(orderType: orderType, contentId: contentId, title: title, can: can)
default:

View File

@ -13,14 +13,16 @@ struct CanPaymentTempView: View {
@StateObject var viewModel = CanPaymentTempViewModel()
let orderType: OrderType
let contentId: Int
let title: String
let can: Int
let onSuccess: () -> Void
init(title: String, can: Int, onSuccess: @escaping () -> Void) {
init(orderType: OrderType, contentId: Int, title: String, can: Int) {
self.orderType = orderType
self.contentId = contentId
self.title = title
self.can = can
self.onSuccess = onSuccess
}
var body: some View {
@ -48,9 +50,11 @@ struct CanPaymentTempView: View {
let can = UserDefaults.int(forKey: .can)
UserDefaults.set(can + self.can, forKey: .can)
DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
AppState.shared.purchasedContentId = contentId
AppState.shared.purchasedContentOrderType = orderType
DispatchQueue.main.async {
AppState.shared.back()
onSuccess()
}
}
}
@ -271,5 +275,5 @@ struct CanPaymentTempView: View {
}
#Preview {
CanPaymentTempView(title: "콘텐츠 제목", can: 1000, onSuccess: {})
CanPaymentTempView(orderType: .KEEP, contentId: 0, title: "콘텐츠 제목", can: 1000)
}

View File

@ -156,11 +156,10 @@ struct SettingsView: View {
.padding(.top, 13.3)
Text("""
- :
- :
- : 410, 11 A08호(, )
- : 508-86-01545
- : 2022--00559
- :
- :
- : 335 10, 5 563A호 (, )
- : 870-81-03220
- : 02.2055.1477
""")
.font(.custom(Font.medium.rawValue, size: 11))