chore: remove drift prefix naming

This commit is contained in:
Yaros 2026-04-13 17:28:05 +02:00
parent 4de5837ff9
commit 0c985ec1e8
6 changed files with 22 additions and 24 deletions

View File

@ -1,4 +1,4 @@
class DriftOcr {
class Ocr {
final String id;
final String assetId;
final double x1;
@ -14,7 +14,7 @@ class DriftOcr {
final String text;
final bool isVisible;
const DriftOcr({
const Ocr({
required this.id,
required this.assetId,
required this.x1,
@ -31,7 +31,7 @@ class DriftOcr {
required this.isVisible,
});
DriftOcr copyWith({
Ocr copyWith({
String? id,
String? assetId,
double? x1,
@ -47,7 +47,7 @@ class DriftOcr {
String? text,
bool? isVisible,
}) {
return DriftOcr(
return Ocr(
id: id ?? this.id,
assetId: assetId ?? this.assetId,
x1: x1 ?? this.x1,
@ -89,7 +89,7 @@ class DriftOcr {
bool operator ==(Object other) {
if (identical(this, other)) return true;
return other is DriftOcr &&
return other is Ocr &&
other.id == id &&
other.assetId == assetId &&
other.x1 == x1 &&

View File

@ -1,12 +1,12 @@
import 'package:immich_mobile/domain/models/ocr.model.dart';
import 'package:immich_mobile/infrastructure/repositories/ocr.repository.dart';
class DriftOcrService {
final DriftOcrRepository _repository;
class OcrService {
final OcrRepository _repository;
const DriftOcrService(this._repository);
const OcrService(this._repository);
Future<List<DriftOcr>?> get(String assetId) {
Future<List<Ocr>?> get(String assetId) {
return _repository.get(assetId);
}
}

View File

@ -2,11 +2,11 @@ import 'package:immich_mobile/domain/models/ocr.model.dart';
import 'package:immich_mobile/infrastructure/entities/asset_ocr.entity.drift.dart';
import 'package:immich_mobile/infrastructure/repositories/db.repository.dart';
class DriftOcrRepository extends DriftDatabaseRepository {
class OcrRepository extends DriftDatabaseRepository {
final Drift _db;
const DriftOcrRepository(this._db) : super(_db);
const OcrRepository(this._db) : super(_db);
Future<List<DriftOcr>?> get(String assetId) async {
Future<List<Ocr>?> get(String assetId) async {
final query = _db.select(_db.assetOcrEntity)..where((row) => row.assetId.equals(assetId));
final result = await query.get();
@ -15,8 +15,8 @@ class DriftOcrRepository extends DriftDatabaseRepository {
}
extension on AssetOcrEntityData {
DriftOcr toDto() {
return DriftOcr(
Ocr toDto() {
return Ocr(
id: id,
assetId: assetId,
x1: x1,

View File

@ -85,7 +85,7 @@ class _OcrOverlayState extends ConsumerState<OcrOverlay> {
return const SizedBox.shrink();
}
final ocrData = ref.watch(driftOcrAssetProvider((widget.asset as RemoteAsset).id));
final ocrData = ref.watch(ocrAssetProvider((widget.asset as RemoteAsset).id));
return ocrData.when(
data: (data) {
@ -99,7 +99,7 @@ class _OcrOverlayState extends ConsumerState<OcrOverlay> {
);
}
Widget _buildOcrBoxes(List<DriftOcr> ocrData) {
Widget _buildOcrBoxes(List<Ocr> ocrData) {
// Use the actual decoded image size from PhotoView's scaleBoundaries when
// available. The image provider may serve a downscaled preview (e.g. Immich
// serves a ~1440px preview for large originals), so the decoded dimensions
@ -114,7 +114,7 @@ class _OcrOverlayState extends ConsumerState<OcrOverlay> {
return _buildBoxStack(ocrData, imageSize, scale, position);
}
Widget _buildBoxStack(List<DriftOcr> ocrData, Size imageSize, double scale, Offset position) {
Widget _buildBoxStack(List<Ocr> ocrData, Size imageSize, double scale, Offset position) {
final imageWidth = imageSize.width;
final imageHeight = imageSize.height;
final viewportWidth = widget.viewportSize.width;

View File

@ -33,7 +33,7 @@ class ViewerTopAppBar extends ConsumerWidget implements PreferredSizeWidget {
final isOwner = asset is RemoteAsset && asset.ownerId == user?.id;
final isInLockedView = ref.watch(inLockedViewProvider);
final isReadonlyModeEnabled = ref.watch(readonlyModeProvider);
final hasOcr = asset is RemoteAsset && ref.watch(driftOcrAssetProvider(asset.id)).valueOrNull?.isNotEmpty == true;
final hasOcr = asset is RemoteAsset && ref.watch(ocrAssetProvider(asset.id)).valueOrNull?.isNotEmpty == true;
final showingDetails = ref.watch(assetViewerProvider.select((state) => state.showingDetails));

View File

@ -4,13 +4,11 @@ import 'package:immich_mobile/infrastructure/repositories/ocr.repository.dart';
import 'package:immich_mobile/providers/infrastructure/db.provider.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';
final driftOcrRepositoryProvider = Provider<DriftOcrRepository>((ref) => DriftOcrRepository(ref.watch(driftProvider)));
final ocrRepositoryProvider = Provider<OcrRepository>((ref) => OcrRepository(ref.watch(driftProvider)));
final driftOcrServiceProvider = Provider<DriftOcrService>(
(ref) => DriftOcrService(ref.watch(driftOcrRepositoryProvider)),
);
final ocrServiceProvider = Provider<OcrService>((ref) => OcrService(ref.watch(ocrRepositoryProvider)));
final driftOcrAssetProvider = FutureProvider.family<List<DriftOcr>?, String>((ref, assetId) async {
final service = ref.watch(driftOcrServiceProvider);
final ocrAssetProvider = FutureProvider.family<List<Ocr>?, String>((ref, assetId) async {
final service = ref.watch(ocrServiceProvider);
return service.get(assetId);
});