캔 충전 후 로컬에 저장된 캔 수가 변하지 않는 버그 수정
This commit is contained in:
parent
63a259f890
commit
41b7247a44
|
@ -60,7 +60,7 @@ struct LiveRoomDonationDialogView: View {
|
||||||
Image("ic_forward")
|
Image("ic_forward")
|
||||||
}
|
}
|
||||||
.onTapGesture {
|
.onTapGesture {
|
||||||
AppState.shared.setAppStep(step: .canCharge(refresh: {}))
|
AppState.shared.setAppStep(step: .canCharge(refresh: {}, afterCompletionToGoBack: true))
|
||||||
self.isShowing = false
|
self.isShowing = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ struct CanPgPaymentView: View {
|
||||||
ZStack {
|
ZStack {
|
||||||
Color.black.ignoresSafeArea()
|
Color.black.ignoresSafeArea()
|
||||||
|
|
||||||
if viewModel.isShowPamentView {
|
if viewModel.isShowPaymentView {
|
||||||
BootpayUI(payload: viewModel.payload, requestType: BootpayRequest.TYPE_PAYMENT)
|
BootpayUI(payload: viewModel.payload, requestType: BootpayRequest.TYPE_PAYMENT)
|
||||||
.onConfirm {
|
.onConfirm {
|
||||||
DEBUG_LOG("onConfirm: \($0)")
|
DEBUG_LOG("onConfirm: \($0)")
|
||||||
|
@ -38,28 +38,31 @@ struct CanPgPaymentView: View {
|
||||||
}
|
}
|
||||||
.onError {
|
.onError {
|
||||||
DEBUG_LOG("onError: \($0)")
|
DEBUG_LOG("onError: \($0)")
|
||||||
viewModel.isShowPamentView = false
|
viewModel.isShowPaymentView = false
|
||||||
viewModel.errorMessage = "결제 중 오류가 발생했습니다."
|
viewModel.errorMessage = "결제 중 오류가 발생했습니다."
|
||||||
viewModel.isShowPopup = true
|
viewModel.isShowPopup = true
|
||||||
}
|
}
|
||||||
.onDone {
|
.onDone {
|
||||||
DEBUG_LOG("onDone: \($0)")
|
DEBUG_LOG("onDone: \($0)")
|
||||||
viewModel.verifyPayment($0) {
|
viewModel.verifyPayment($0) {
|
||||||
self.refresh()
|
|
||||||
|
|
||||||
if afterCompletionToGoBack {
|
|
||||||
AppState.shared.back()
|
|
||||||
} else {
|
|
||||||
AppState.shared.setAppStep(step: .canStatus(refresh: refresh))
|
|
||||||
}
|
|
||||||
|
|
||||||
let can = UserDefaults.int(forKey: .can)
|
let can = UserDefaults.int(forKey: .can)
|
||||||
UserDefaults.set(can + canResponse.can + canResponse.rewardCan, forKey: .can)
|
UserDefaults.set(can + canResponse.can + canResponse.rewardCan, forKey: .can)
|
||||||
|
|
||||||
|
self.refresh()
|
||||||
|
|
||||||
|
DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
|
||||||
|
if afterCompletionToGoBack {
|
||||||
|
AppState.shared.back()
|
||||||
|
AppState.shared.back()
|
||||||
|
} else {
|
||||||
|
AppState.shared.setAppStep(step: .canStatus(refresh: refresh))
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.onClose {
|
.onClose {
|
||||||
DEBUG_LOG("onClose")
|
DEBUG_LOG("onClose")
|
||||||
viewModel.isShowPamentView = false
|
viewModel.isShowPaymentView = false
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
GeometryReader { proxy in
|
GeometryReader { proxy in
|
||||||
|
@ -279,7 +282,7 @@ struct CanPgPaymentView: View {
|
||||||
viewModel.payload.price = Double(canResponse.price)
|
viewModel.payload.price = Double(canResponse.price)
|
||||||
viewModel.payload.taxFree = 0
|
viewModel.payload.taxFree = 0
|
||||||
|
|
||||||
viewModel.isShowPamentView = true
|
viewModel.isShowPaymentView = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ final class CanPgPaymentViewModel: ObservableObject {
|
||||||
@Published var isShowPopup = false
|
@Published var isShowPopup = false
|
||||||
@Published var isLoading = false
|
@Published var isLoading = false
|
||||||
|
|
||||||
@Published var isShowPamentView = false
|
@Published var isShowPaymentView = false
|
||||||
@Published var paymentMethod: PaymentMethod? = nil
|
@Published var paymentMethod: PaymentMethod? = nil
|
||||||
|
|
||||||
let payload = Payload()
|
let payload = Payload()
|
||||||
|
@ -99,6 +99,9 @@ final class CanPgPaymentViewModel: 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.errorMessage = "캔이 충전되었습니다"
|
||||||
|
self.isShowPopup = true
|
||||||
|
|
||||||
onSuccess()
|
onSuccess()
|
||||||
} else {
|
} else {
|
||||||
if let message = decoded.message {
|
if let message = decoded.message {
|
||||||
|
|
Loading…
Reference in New Issue