|
|
|
@ -431,12 +431,16 @@ class DriftTimelineRepository extends DriftDatabaseRepository {
|
|
|
|
return query.map((row) => row.readTable(_db.remoteAssetEntity).toDto()).get();
|
|
|
|
return query.map((row) => row.readTable(_db.remoteAssetEntity).toDto()).get();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TimelineQuery map(LatLngBounds bounds, GroupAssetsBy groupBy) => (
|
|
|
|
TimelineQuery map(String userId, LatLngBounds bounds, GroupAssetsBy groupBy) => (
|
|
|
|
bucketSource: () => _watchMapBucket(bounds, groupBy: groupBy),
|
|
|
|
bucketSource: () => _watchMapBucket(userId, bounds, groupBy: groupBy),
|
|
|
|
assetSource: (offset, count) => _getMapBucketAssets(bounds, offset: offset, count: count),
|
|
|
|
assetSource: (offset, count) => _getMapBucketAssets(userId, bounds, offset: offset, count: count),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
Stream<List<Bucket>> _watchMapBucket(LatLngBounds bounds, {GroupAssetsBy groupBy = GroupAssetsBy.day}) {
|
|
|
|
Stream<List<Bucket>> _watchMapBucket(
|
|
|
|
|
|
|
|
String userId,
|
|
|
|
|
|
|
|
LatLngBounds bounds, {
|
|
|
|
|
|
|
|
GroupAssetsBy groupBy = GroupAssetsBy.day,
|
|
|
|
|
|
|
|
}) {
|
|
|
|
if (groupBy == GroupAssetsBy.none) {
|
|
|
|
if (groupBy == GroupAssetsBy.none) {
|
|
|
|
// TODO: Support GroupAssetsBy.none
|
|
|
|
// TODO: Support GroupAssetsBy.none
|
|
|
|
throw UnsupportedError("GroupAssetsBy.none is not supported for _watchMapBucket");
|
|
|
|
throw UnsupportedError("GroupAssetsBy.none is not supported for _watchMapBucket");
|
|
|
|
@ -455,7 +459,8 @@ class DriftTimelineRepository extends DriftDatabaseRepository {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
])
|
|
|
|
])
|
|
|
|
..where(
|
|
|
|
..where(
|
|
|
|
_db.remoteExifEntity.inBounds(bounds) &
|
|
|
|
_db.remoteAssetEntity.ownerId.equals(userId) &
|
|
|
|
|
|
|
|
_db.remoteExifEntity.inBounds(bounds) &
|
|
|
|
_db.remoteAssetEntity.visibility.equalsValue(AssetVisibility.timeline) &
|
|
|
|
_db.remoteAssetEntity.visibility.equalsValue(AssetVisibility.timeline) &
|
|
|
|
_db.remoteAssetEntity.deletedAt.isNull(),
|
|
|
|
_db.remoteAssetEntity.deletedAt.isNull(),
|
|
|
|
)
|
|
|
|
)
|
|
|
|
@ -469,7 +474,12 @@ class DriftTimelineRepository extends DriftDatabaseRepository {
|
|
|
|
}).watch();
|
|
|
|
}).watch();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Future<List<BaseAsset>> _getMapBucketAssets(LatLngBounds bounds, {required int offset, required int count}) {
|
|
|
|
Future<List<BaseAsset>> _getMapBucketAssets(
|
|
|
|
|
|
|
|
String userId,
|
|
|
|
|
|
|
|
LatLngBounds bounds, {
|
|
|
|
|
|
|
|
required int offset,
|
|
|
|
|
|
|
|
required int count,
|
|
|
|
|
|
|
|
}) {
|
|
|
|
final query =
|
|
|
|
final query =
|
|
|
|
_db.remoteAssetEntity.select().join([
|
|
|
|
_db.remoteAssetEntity.select().join([
|
|
|
|
innerJoin(
|
|
|
|
innerJoin(
|
|
|
|
@ -479,7 +489,8 @@ class DriftTimelineRepository extends DriftDatabaseRepository {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
])
|
|
|
|
])
|
|
|
|
..where(
|
|
|
|
..where(
|
|
|
|
_db.remoteExifEntity.inBounds(bounds) &
|
|
|
|
_db.remoteAssetEntity.ownerId.equals(userId) &
|
|
|
|
|
|
|
|
_db.remoteExifEntity.inBounds(bounds) &
|
|
|
|
_db.remoteAssetEntity.visibility.equalsValue(AssetVisibility.timeline) &
|
|
|
|
_db.remoteAssetEntity.visibility.equalsValue(AssetVisibility.timeline) &
|
|
|
|
_db.remoteAssetEntity.deletedAt.isNull(),
|
|
|
|
_db.remoteAssetEntity.deletedAt.isNull(),
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|