mirror of
https://github.com/immich-app/immich.git
synced 2026-05-18 03:10:24 +03:00
chore: remove drift prefix naming
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
class DriftOcr {
|
class Ocr {
|
||||||
final String id;
|
final String id;
|
||||||
final String assetId;
|
final String assetId;
|
||||||
final double x1;
|
final double x1;
|
||||||
@@ -14,7 +14,7 @@ class DriftOcr {
|
|||||||
final String text;
|
final String text;
|
||||||
final bool isVisible;
|
final bool isVisible;
|
||||||
|
|
||||||
const DriftOcr({
|
const Ocr({
|
||||||
required this.id,
|
required this.id,
|
||||||
required this.assetId,
|
required this.assetId,
|
||||||
required this.x1,
|
required this.x1,
|
||||||
@@ -31,7 +31,7 @@ class DriftOcr {
|
|||||||
required this.isVisible,
|
required this.isVisible,
|
||||||
});
|
});
|
||||||
|
|
||||||
DriftOcr copyWith({
|
Ocr copyWith({
|
||||||
String? id,
|
String? id,
|
||||||
String? assetId,
|
String? assetId,
|
||||||
double? x1,
|
double? x1,
|
||||||
@@ -47,7 +47,7 @@ class DriftOcr {
|
|||||||
String? text,
|
String? text,
|
||||||
bool? isVisible,
|
bool? isVisible,
|
||||||
}) {
|
}) {
|
||||||
return DriftOcr(
|
return Ocr(
|
||||||
id: id ?? this.id,
|
id: id ?? this.id,
|
||||||
assetId: assetId ?? this.assetId,
|
assetId: assetId ?? this.assetId,
|
||||||
x1: x1 ?? this.x1,
|
x1: x1 ?? this.x1,
|
||||||
@@ -89,7 +89,7 @@ class DriftOcr {
|
|||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
if (identical(this, other)) return true;
|
if (identical(this, other)) return true;
|
||||||
|
|
||||||
return other is DriftOcr &&
|
return other is Ocr &&
|
||||||
other.id == id &&
|
other.id == id &&
|
||||||
other.assetId == assetId &&
|
other.assetId == assetId &&
|
||||||
other.x1 == x1 &&
|
other.x1 == x1 &&
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import 'package:immich_mobile/domain/models/ocr.model.dart';
|
import 'package:immich_mobile/domain/models/ocr.model.dart';
|
||||||
import 'package:immich_mobile/infrastructure/repositories/ocr.repository.dart';
|
import 'package:immich_mobile/infrastructure/repositories/ocr.repository.dart';
|
||||||
|
|
||||||
class DriftOcrService {
|
class OcrService {
|
||||||
final DriftOcrRepository _repository;
|
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);
|
return _repository.get(assetId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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/entities/asset_ocr.entity.drift.dart';
|
||||||
import 'package:immich_mobile/infrastructure/repositories/db.repository.dart';
|
import 'package:immich_mobile/infrastructure/repositories/db.repository.dart';
|
||||||
|
|
||||||
class DriftOcrRepository extends DriftDatabaseRepository {
|
class OcrRepository extends DriftDatabaseRepository {
|
||||||
final Drift _db;
|
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 query = _db.select(_db.assetOcrEntity)..where((row) => row.assetId.equals(assetId));
|
||||||
|
|
||||||
final result = await query.get();
|
final result = await query.get();
|
||||||
@@ -15,8 +15,8 @@ class DriftOcrRepository extends DriftDatabaseRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
extension on AssetOcrEntityData {
|
extension on AssetOcrEntityData {
|
||||||
DriftOcr toDto() {
|
Ocr toDto() {
|
||||||
return DriftOcr(
|
return Ocr(
|
||||||
id: id,
|
id: id,
|
||||||
assetId: assetId,
|
assetId: assetId,
|
||||||
x1: x1,
|
x1: x1,
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ class _OcrOverlayState extends ConsumerState<OcrOverlay> {
|
|||||||
return const SizedBox.shrink();
|
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(
|
return ocrData.when(
|
||||||
data: (data) {
|
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
|
// Use the actual decoded image size from PhotoView's scaleBoundaries when
|
||||||
// available. The image provider may serve a downscaled preview (e.g. Immich
|
// available. The image provider may serve a downscaled preview (e.g. Immich
|
||||||
// serves a ~1440px preview for large originals), so the decoded dimensions
|
// 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);
|
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 imageWidth = imageSize.width;
|
||||||
final imageHeight = imageSize.height;
|
final imageHeight = imageSize.height;
|
||||||
final viewportWidth = widget.viewportSize.width;
|
final viewportWidth = widget.viewportSize.width;
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ class ViewerTopAppBar extends ConsumerWidget implements PreferredSizeWidget {
|
|||||||
final isOwner = asset is RemoteAsset && asset.ownerId == user?.id;
|
final isOwner = asset is RemoteAsset && asset.ownerId == user?.id;
|
||||||
final isInLockedView = ref.watch(inLockedViewProvider);
|
final isInLockedView = ref.watch(inLockedViewProvider);
|
||||||
final isReadonlyModeEnabled = ref.watch(readonlyModeProvider);
|
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));
|
final showingDetails = ref.watch(assetViewerProvider.select((state) => state.showingDetails));
|
||||||
|
|
||||||
|
|||||||
@@ -4,13 +4,11 @@ import 'package:immich_mobile/infrastructure/repositories/ocr.repository.dart';
|
|||||||
import 'package:immich_mobile/providers/infrastructure/db.provider.dart';
|
import 'package:immich_mobile/providers/infrastructure/db.provider.dart';
|
||||||
import 'package:riverpod_annotation/riverpod_annotation.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>(
|
final ocrServiceProvider = Provider<OcrService>((ref) => OcrService(ref.watch(ocrRepositoryProvider)));
|
||||||
(ref) => DriftOcrService(ref.watch(driftOcrRepositoryProvider)),
|
|
||||||
);
|
|
||||||
|
|
||||||
final driftOcrAssetProvider = FutureProvider.family<List<DriftOcr>?, String>((ref, assetId) async {
|
final ocrAssetProvider = FutureProvider.family<List<Ocr>?, String>((ref, assetId) async {
|
||||||
final service = ref.watch(driftOcrServiceProvider);
|
final service = ref.watch(ocrServiceProvider);
|
||||||
return service.get(assetId);
|
return service.get(assetId);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user