@@ -219,6 +219,7 @@ class PdfReaderViewModel @Inject constructor(
219
219
private val onAnnotationSearchStateFlow = MutableStateFlow (" " )
220
220
private val onAnnotationChangedDebouncerFlow = MutableStateFlow <Triple <Int , List <String >, FreeTextAnnotation > ? > (null )
221
221
private val onOutlineSearchStateFlow = MutableStateFlow (" " )
222
+ private val onStorePageFlow = MutableStateFlow (0 )
222
223
private val onCommentChangeFlow = MutableStateFlow <Pair <String , String >? > (null )
223
224
private lateinit var fragmentManager: FragmentManager
224
225
private var isTablet: Boolean = false
@@ -256,6 +257,8 @@ class PdfReaderViewModel @Inject constructor(
256
257
updateState {
257
258
copy(selectedThumbnail = row)
258
259
}
260
+
261
+ onStorePageFlow.tryEmit(event.pageIndex)
259
262
}
260
263
261
264
@Subscribe(threadMode = ThreadMode .MAIN )
@@ -421,6 +424,7 @@ class PdfReaderViewModel @Inject constructor(
421
424
setupAnnotationSearchStateFlow()
422
425
setupOutlineSearchStateFlow()
423
426
setupCommentChangeFlow()
427
+ setupStorePageFlow()
424
428
setupAnnotationChangedDebouncerFlow()
425
429
426
430
val pdfSettings = defaults.getPDFSettings()
@@ -628,6 +632,15 @@ class PdfReaderViewModel @Inject constructor(
628
632
.launchIn(viewModelScope)
629
633
}
630
634
635
+ private fun setupStorePageFlow () {
636
+ onStorePageFlow
637
+ .debounce(3000 )
638
+ .map { page ->
639
+ store(page)
640
+ }
641
+ .launchIn(viewModelScope)
642
+ }
643
+
631
644
private fun setupCommentChangeFlow () {
632
645
onCommentChangeFlow
633
646
.debounce(500 )
0 commit comments