fix(mobile): deep links when using the beta timeline (#20111)

* fix: deep links when using the beta timeline

* Update remote_asset.repository.dart

* Update mobile/lib/domain/services/asset.service.dart

Co-authored-by: Alex <alex.tran1502@gmail.com>

* return optional from album get

* do not include trashed assets in album asset count

Co-authored-by: shenlong <139912620+shenlong-tanwen@users.noreply.github.com>

* formatting

---------

Co-authored-by: Alex <alex.tran1502@gmail.com>
Co-authored-by: shenlong <139912620+shenlong-tanwen@users.noreply.github.com>
This commit is contained in:
Brandon Wees
2025-07-25 12:02:49 -05:00
committed by GitHub
parent 2e0ee6ec05
commit f9292c9c96
7 changed files with 212 additions and 35 deletions
@@ -58,6 +58,43 @@ class DriftMemoryRepository extends DriftDatabaseRepository {
return memoriesMap.values.toList();
}
Future<DriftMemory?> get(String memoryId) async {
final query = _db.select(_db.memoryEntity).join([
leftOuterJoin(
_db.memoryAssetEntity,
_db.memoryAssetEntity.memoryId.equalsExp(_db.memoryEntity.id),
),
leftOuterJoin(
_db.remoteAssetEntity,
_db.remoteAssetEntity.id.equalsExp(_db.memoryAssetEntity.assetId) &
_db.remoteAssetEntity.deletedAt.isNull() &
_db.remoteAssetEntity.visibility.equalsValue(AssetVisibility.timeline),
),
])
..where(_db.memoryEntity.id.equals(memoryId))
..where(_db.memoryEntity.deletedAt.isNull())
..orderBy([
OrderingTerm.desc(_db.memoryEntity.memoryAt),
OrderingTerm.asc(_db.remoteAssetEntity.createdAt),
]);
final rows = await query.get();
if (rows.isEmpty) {
return null;
}
final memory = rows.first.readTable(_db.memoryEntity);
final assets = <RemoteAsset>[];
for (final row in rows) {
final asset = row.readTable(_db.remoteAssetEntity);
assets.add(asset.toDto());
}
return memory.toDto().copyWith(assets: assets);
}
Future<int> getCount() {
return _db.managers.memoryEntity.count();
}