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