feat(backup): wire opportunistic backup trigger into HomeViewModel.loadHome
This commit is contained in:
parent
fd854b635c
commit
72c251ae95
|
|
@ -198,7 +198,8 @@ class HomeViewModel @Inject constructor(
|
|||
private val dailyQuestionResolver: app.closer.domain.usecase.DailyQuestionResolver,
|
||||
private val dateMemoryDataSource: app.closer.data.remote.FirestoreDateMemoryDataSource,
|
||||
private val dateReflectionDataSource: app.closer.data.remote.FirestoreDateReflectionDataSource,
|
||||
private val answerDataSource: FirestoreAnswerDataSource
|
||||
private val answerDataSource: FirestoreAnswerDataSource,
|
||||
private val backupManager: app.closer.data.backup.BackupManager
|
||||
) : ViewModel() {
|
||||
|
||||
private val _uiState = MutableStateFlow(HomeUiState())
|
||||
|
|
@ -273,6 +274,12 @@ class HomeViewModel @Inject constructor(
|
|||
// stops showing a stale "your turn" and never offers a re-answer that the immutable
|
||||
// secure/payload rule would reject (R23). Room-first → a no-op once Room is correct;
|
||||
// the answers observer then recomputes the card.
|
||||
// Opportunistic E2EE conversation backup (throttled + single-flighted inside the manager;
|
||||
// no-op without a couple key). Keeps the device-durable backup fresh for restore.
|
||||
if (couple != null) {
|
||||
launch { runCatching { backupManager.backupNow() } }
|
||||
}
|
||||
|
||||
val dailyAnswerCoupleId = couple?.id
|
||||
if (uid != null && dailyAnswerCoupleId != null && dailyQuestion != null) {
|
||||
launch {
|
||||
|
|
|
|||
Loading…
Reference in New Issue