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