"fix(chat-room): 쿼터 UI를 totalRemaining 대신 nextRechargeAtEpoch 기준으로 갱신
This commit is contained in:
		@@ -379,7 +379,7 @@ class ChatRoomActivity : BaseActivity<ActivityChatRoomBinding>(
 | 
				
			|||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                // 응답에 포함된 쿼터 상태로 UI 갱신
 | 
					                // 응답에 포함된 쿼터 상태로 UI 갱신
 | 
				
			||||||
                updateQuotaUi(response.totalRemaining, response.nextRechargeAtEpoch)
 | 
					                updateQuotaUi(response.nextRechargeAtEpoch)
 | 
				
			||||||
            }, { error ->
 | 
					            }, { error ->
 | 
				
			||||||
                // 실패: 타이핑 인디케이터 제거 및 FAILED로 업데이트
 | 
					                // 실패: 타이핑 인디케이터 제거 및 FAILED로 업데이트
 | 
				
			||||||
                chatAdapter.hideTypingIndicator()
 | 
					                chatAdapter.hideTypingIndicator()
 | 
				
			||||||
@@ -466,7 +466,7 @@ class ChatRoomActivity : BaseActivity<ActivityChatRoomBinding>(
 | 
				
			|||||||
                .observeOn(AndroidSchedulers.mainThread())
 | 
					                .observeOn(AndroidSchedulers.mainThread())
 | 
				
			||||||
                .subscribe({ resp ->
 | 
					                .subscribe({ resp ->
 | 
				
			||||||
                    // 쿼터 UI 갱신
 | 
					                    // 쿼터 UI 갱신
 | 
				
			||||||
                    updateQuotaUi(resp.totalRemaining, resp.nextRechargeAtEpoch)
 | 
					                    updateQuotaUi(resp.nextRechargeAtEpoch)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    // 결제 성공 시 로컬 캔 차감(30캔) 및 헤더 배지 즉시 반영
 | 
					                    // 결제 성공 시 로컬 캔 차감(30캔) 및 헤더 배지 즉시 반영
 | 
				
			||||||
                    val newCan = (SharedPreferenceManager.can - 30).coerceAtLeast(0)
 | 
					                    val newCan = (SharedPreferenceManager.can - 30).coerceAtLeast(0)
 | 
				
			||||||
@@ -478,18 +478,18 @@ class ChatRoomActivity : BaseActivity<ActivityChatRoomBinding>(
 | 
				
			|||||||
        )
 | 
					        )
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private fun updateQuotaUi(totalRemaining: Int, nextRechargeAtEpoch: Long?) {
 | 
					    private fun updateQuotaUi(nextRechargeAtEpoch: Long?) {
 | 
				
			||||||
        if (totalRemaining > 0) {
 | 
					        if (nextRechargeAtEpoch != null) {
 | 
				
			||||||
            // 입력창 표시 및 안내 제거
 | 
					 | 
				
			||||||
            binding.inputContainer.isVisible = true
 | 
					 | 
				
			||||||
            stopQuotaCountdown()
 | 
					 | 
				
			||||||
            ensureQuotaNoticeRemoved()
 | 
					 | 
				
			||||||
        } else {
 | 
					 | 
				
			||||||
            // 입력창 숨김 및 안내 표시 + 카운트다운 시작
 | 
					            // 입력창 숨김 및 안내 표시 + 카운트다운 시작
 | 
				
			||||||
            binding.inputContainer.isVisible = false
 | 
					            binding.inputContainer.isVisible = false
 | 
				
			||||||
            val timeText = formatEpochToHms(nextRechargeAtEpoch)
 | 
					            val timeText = formatEpochToHms(nextRechargeAtEpoch)
 | 
				
			||||||
            ensureQuotaNoticeShown(timeText)
 | 
					            ensureQuotaNoticeShown(timeText)
 | 
				
			||||||
            startQuotaCountdown(nextRechargeAtEpoch)
 | 
					            startQuotaCountdown(nextRechargeAtEpoch)
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            // 입력창 표시 및 안내 제거
 | 
				
			||||||
 | 
					            binding.inputContainer.isVisible = true
 | 
				
			||||||
 | 
					            stopQuotaCountdown()
 | 
				
			||||||
 | 
					            ensureQuotaNoticeRemoved()
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -551,7 +551,7 @@ class ChatRoomActivity : BaseActivity<ActivityChatRoomBinding>(
 | 
				
			|||||||
            chatRepository.getChatQuotaStatus(roomId, token)
 | 
					            chatRepository.getChatQuotaStatus(roomId, token)
 | 
				
			||||||
                .observeOn(AndroidSchedulers.mainThread())
 | 
					                .observeOn(AndroidSchedulers.mainThread())
 | 
				
			||||||
                .subscribe({ resp ->
 | 
					                .subscribe({ resp ->
 | 
				
			||||||
                    updateQuotaUi(resp.totalRemaining, resp.nextRechargeAtEpoch)
 | 
					                    updateQuotaUi(resp.nextRechargeAtEpoch)
 | 
				
			||||||
                }, { /* 무시: 다음 틱에 재시도 가능 */ })
 | 
					                }, { /* 무시: 다음 틱에 재시도 가능 */ })
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -655,7 +655,7 @@ class ChatRoomActivity : BaseActivity<ActivityChatRoomBinding>(
 | 
				
			|||||||
                isLoading = false
 | 
					                isLoading = false
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                // 쿼터 UI 갱신
 | 
					                // 쿼터 UI 갱신
 | 
				
			||||||
                updateQuotaUi(response.totalRemaining, response.nextRechargeAtEpoch)
 | 
					                updateQuotaUi(response.nextRechargeAtEpoch)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                // 7.3: 오래된 메시지 정리(백그라운드)
 | 
					                // 7.3: 오래된 메시지 정리(백그라운드)
 | 
				
			||||||
                compositeDisposable.add(
 | 
					                compositeDisposable.add(
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user