Add support for story archiving.

This commit is contained in:
Greyson Parrelli
2026-03-04 19:28:55 -05:00
committed by jeffrey-signal
parent ff50755ba2
commit e7d1db446b
33 changed files with 1237 additions and 21 deletions

View File

@@ -8,6 +8,8 @@ import java.util.List;
import io.reactivex.rxjava3.subjects.BehaviorSubject;
import io.reactivex.rxjava3.subjects.Subject;
import kotlinx.coroutines.flow.MutableStateFlow;
import kotlinx.coroutines.flow.StateFlow;
/**
* The primary entry point for creating paged data.
@@ -36,6 +38,14 @@ public class PagedData<Key> {
return new ObservablePagedData<>(subject, controller);
}
@AnyThread
public static <Key, Data> StateFlowPagedData<Key, Data> createForStateFlow(@NonNull PagedDataSource<Key, Data> dataSource, @NonNull PagingConfig config) {
MutableStateFlow<List<Data>> stateFlow = kotlinx.coroutines.flow.StateFlowKt.MutableStateFlow(java.util.Collections.emptyList());
PagingController<Key> controller = new BufferedPagingController<>(dataSource, config, stateFlow::setValue);
return new StateFlowPagedData<>(stateFlow, controller);
}
public PagingController<Key> getController() {
return controller;
}

View File

@@ -0,0 +1,11 @@
package org.signal.paging
import kotlinx.coroutines.flow.StateFlow
/**
* An implementation of [PagedData] that will provide data as a [StateFlow].
*/
class StateFlowPagedData<Key, Data>(
val data: StateFlow<List<Data>>,
controller: PagingController<Key>
) : PagedData<Key>(controller)