feat: use sqlite timeline user provider (#19577)

use sqlite timeline user provider

Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
This commit is contained in:
shenlong 2025-06-27 18:59:27 +05:30 committed by GitHub
parent 30b4f334d8
commit 72a53f43c8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 33 additions and 4 deletions

View file

@ -15,6 +15,21 @@ class DriftTimelineRepository extends DriftDatabaseRepository {
const DriftTimelineRepository(super._db) : _db = _db;
Stream<List<String>> watchTimelineUserIds(String userId) {
final query = _db.partnerEntity.selectOnly()
..addColumns([_db.partnerEntity.sharedById])
..where(
_db.partnerEntity.inTimeline.equals(true) &
_db.partnerEntity.sharedWithId.equals(userId),
);
return query
.map((row) => row.read(_db.partnerEntity.sharedById)!)
.watch()
// Add current user ID to the list
.map((users) => users..add(userId));
}
List<Bucket> _generateBuckets(int count) {
final numBuckets = (count / kTimelineNoneSegmentSize).floor();
final buckets = List.generate(