mirror of
https://github.com/immich-app/immich.git
synced 2025-07-07 10:14:08 -04:00
feat(mobile): edit location action (#19645)
* change dto from integer to double * feat(mobile): edit location action * patch openapi * refactor in provider * fix lint * chore: not showing success prompt if dimissed * i18n --------- Co-authored-by: Alex <alex.tran1502@gmail.com>
This commit is contained in:
parent
639ede78c2
commit
83afd49f5c
@ -799,6 +799,7 @@
|
||||
"edit_key": "Edit key",
|
||||
"edit_link": "Edit link",
|
||||
"edit_location": "Edit location",
|
||||
"edit_location_action_prompt": "{count} location edited",
|
||||
"edit_location_dialog_title": "Location",
|
||||
"edit_name": "Edit name",
|
||||
"edit_people": "Edit people",
|
||||
|
2
mobile/drift_schemas/main/drift_schema_v1.json
generated
2
mobile/drift_schemas/main/drift_schema_v1.json
generated
File diff suppressed because one or more lines are too long
@ -116,15 +116,15 @@ class RemoteExifEntity extends Table with DriftDefaultsMixin {
|
||||
|
||||
TextColumn get exposureTime => text().nullable()();
|
||||
|
||||
IntColumn get fNumber => integer().nullable()();
|
||||
RealColumn get fNumber => real().nullable()();
|
||||
|
||||
IntColumn get fileSize => integer().nullable()();
|
||||
|
||||
IntColumn get focalLength => integer().nullable()();
|
||||
RealColumn get focalLength => real().nullable()();
|
||||
|
||||
IntColumn get latitude => integer().nullable()();
|
||||
RealColumn get latitude => real().nullable()();
|
||||
|
||||
IntColumn get longitude => integer().nullable()();
|
||||
RealColumn get longitude => real().nullable()();
|
||||
|
||||
IntColumn get iso => integer().nullable()();
|
||||
|
||||
|
@ -19,11 +19,11 @@ typedef $$RemoteExifEntityTableCreateCompanionBuilder
|
||||
i0.Value<int?> height,
|
||||
i0.Value<int?> width,
|
||||
i0.Value<String?> exposureTime,
|
||||
i0.Value<int?> fNumber,
|
||||
i0.Value<double?> fNumber,
|
||||
i0.Value<int?> fileSize,
|
||||
i0.Value<int?> focalLength,
|
||||
i0.Value<int?> latitude,
|
||||
i0.Value<int?> longitude,
|
||||
i0.Value<double?> focalLength,
|
||||
i0.Value<double?> latitude,
|
||||
i0.Value<double?> longitude,
|
||||
i0.Value<int?> iso,
|
||||
i0.Value<String?> make,
|
||||
i0.Value<String?> model,
|
||||
@ -43,11 +43,11 @@ typedef $$RemoteExifEntityTableUpdateCompanionBuilder
|
||||
i0.Value<int?> height,
|
||||
i0.Value<int?> width,
|
||||
i0.Value<String?> exposureTime,
|
||||
i0.Value<int?> fNumber,
|
||||
i0.Value<double?> fNumber,
|
||||
i0.Value<int?> fileSize,
|
||||
i0.Value<int?> focalLength,
|
||||
i0.Value<int?> latitude,
|
||||
i0.Value<int?> longitude,
|
||||
i0.Value<double?> focalLength,
|
||||
i0.Value<double?> latitude,
|
||||
i0.Value<double?> longitude,
|
||||
i0.Value<int?> iso,
|
||||
i0.Value<String?> make,
|
||||
i0.Value<String?> model,
|
||||
@ -125,20 +125,20 @@ class $$RemoteExifEntityTableFilterComposer
|
||||
column: $table.exposureTime,
|
||||
builder: (column) => i0.ColumnFilters(column));
|
||||
|
||||
i0.ColumnFilters<int> get fNumber => $composableBuilder(
|
||||
i0.ColumnFilters<double> get fNumber => $composableBuilder(
|
||||
column: $table.fNumber, builder: (column) => i0.ColumnFilters(column));
|
||||
|
||||
i0.ColumnFilters<int> get fileSize => $composableBuilder(
|
||||
column: $table.fileSize, builder: (column) => i0.ColumnFilters(column));
|
||||
|
||||
i0.ColumnFilters<int> get focalLength => $composableBuilder(
|
||||
i0.ColumnFilters<double> get focalLength => $composableBuilder(
|
||||
column: $table.focalLength,
|
||||
builder: (column) => i0.ColumnFilters(column));
|
||||
|
||||
i0.ColumnFilters<int> get latitude => $composableBuilder(
|
||||
i0.ColumnFilters<double> get latitude => $composableBuilder(
|
||||
column: $table.latitude, builder: (column) => i0.ColumnFilters(column));
|
||||
|
||||
i0.ColumnFilters<int> get longitude => $composableBuilder(
|
||||
i0.ColumnFilters<double> get longitude => $composableBuilder(
|
||||
column: $table.longitude, builder: (column) => i0.ColumnFilters(column));
|
||||
|
||||
i0.ColumnFilters<int> get iso => $composableBuilder(
|
||||
@ -223,20 +223,20 @@ class $$RemoteExifEntityTableOrderingComposer
|
||||
column: $table.exposureTime,
|
||||
builder: (column) => i0.ColumnOrderings(column));
|
||||
|
||||
i0.ColumnOrderings<int> get fNumber => $composableBuilder(
|
||||
i0.ColumnOrderings<double> get fNumber => $composableBuilder(
|
||||
column: $table.fNumber, builder: (column) => i0.ColumnOrderings(column));
|
||||
|
||||
i0.ColumnOrderings<int> get fileSize => $composableBuilder(
|
||||
column: $table.fileSize, builder: (column) => i0.ColumnOrderings(column));
|
||||
|
||||
i0.ColumnOrderings<int> get focalLength => $composableBuilder(
|
||||
i0.ColumnOrderings<double> get focalLength => $composableBuilder(
|
||||
column: $table.focalLength,
|
||||
builder: (column) => i0.ColumnOrderings(column));
|
||||
|
||||
i0.ColumnOrderings<int> get latitude => $composableBuilder(
|
||||
i0.ColumnOrderings<double> get latitude => $composableBuilder(
|
||||
column: $table.latitude, builder: (column) => i0.ColumnOrderings(column));
|
||||
|
||||
i0.ColumnOrderings<int> get longitude => $composableBuilder(
|
||||
i0.ColumnOrderings<double> get longitude => $composableBuilder(
|
||||
column: $table.longitude,
|
||||
builder: (column) => i0.ColumnOrderings(column));
|
||||
|
||||
@ -321,19 +321,19 @@ class $$RemoteExifEntityTableAnnotationComposer
|
||||
i0.GeneratedColumn<String> get exposureTime => $composableBuilder(
|
||||
column: $table.exposureTime, builder: (column) => column);
|
||||
|
||||
i0.GeneratedColumn<int> get fNumber =>
|
||||
i0.GeneratedColumn<double> get fNumber =>
|
||||
$composableBuilder(column: $table.fNumber, builder: (column) => column);
|
||||
|
||||
i0.GeneratedColumn<int> get fileSize =>
|
||||
$composableBuilder(column: $table.fileSize, builder: (column) => column);
|
||||
|
||||
i0.GeneratedColumn<int> get focalLength => $composableBuilder(
|
||||
i0.GeneratedColumn<double> get focalLength => $composableBuilder(
|
||||
column: $table.focalLength, builder: (column) => column);
|
||||
|
||||
i0.GeneratedColumn<int> get latitude =>
|
||||
i0.GeneratedColumn<double> get latitude =>
|
||||
$composableBuilder(column: $table.latitude, builder: (column) => column);
|
||||
|
||||
i0.GeneratedColumn<int> get longitude =>
|
||||
i0.GeneratedColumn<double> get longitude =>
|
||||
$composableBuilder(column: $table.longitude, builder: (column) => column);
|
||||
|
||||
i0.GeneratedColumn<int> get iso =>
|
||||
@ -416,11 +416,11 @@ class $$RemoteExifEntityTableTableManager extends i0.RootTableManager<
|
||||
i0.Value<int?> height = const i0.Value.absent(),
|
||||
i0.Value<int?> width = const i0.Value.absent(),
|
||||
i0.Value<String?> exposureTime = const i0.Value.absent(),
|
||||
i0.Value<int?> fNumber = const i0.Value.absent(),
|
||||
i0.Value<double?> fNumber = const i0.Value.absent(),
|
||||
i0.Value<int?> fileSize = const i0.Value.absent(),
|
||||
i0.Value<int?> focalLength = const i0.Value.absent(),
|
||||
i0.Value<int?> latitude = const i0.Value.absent(),
|
||||
i0.Value<int?> longitude = const i0.Value.absent(),
|
||||
i0.Value<double?> focalLength = const i0.Value.absent(),
|
||||
i0.Value<double?> latitude = const i0.Value.absent(),
|
||||
i0.Value<double?> longitude = const i0.Value.absent(),
|
||||
i0.Value<int?> iso = const i0.Value.absent(),
|
||||
i0.Value<String?> make = const i0.Value.absent(),
|
||||
i0.Value<String?> model = const i0.Value.absent(),
|
||||
@ -462,11 +462,11 @@ class $$RemoteExifEntityTableTableManager extends i0.RootTableManager<
|
||||
i0.Value<int?> height = const i0.Value.absent(),
|
||||
i0.Value<int?> width = const i0.Value.absent(),
|
||||
i0.Value<String?> exposureTime = const i0.Value.absent(),
|
||||
i0.Value<int?> fNumber = const i0.Value.absent(),
|
||||
i0.Value<double?> fNumber = const i0.Value.absent(),
|
||||
i0.Value<int?> fileSize = const i0.Value.absent(),
|
||||
i0.Value<int?> focalLength = const i0.Value.absent(),
|
||||
i0.Value<int?> latitude = const i0.Value.absent(),
|
||||
i0.Value<int?> longitude = const i0.Value.absent(),
|
||||
i0.Value<double?> focalLength = const i0.Value.absent(),
|
||||
i0.Value<double?> latitude = const i0.Value.absent(),
|
||||
i0.Value<double?> longitude = const i0.Value.absent(),
|
||||
i0.Value<int?> iso = const i0.Value.absent(),
|
||||
i0.Value<String?> make = const i0.Value.absent(),
|
||||
i0.Value<String?> model = const i0.Value.absent(),
|
||||
@ -622,9 +622,9 @@ class $RemoteExifEntityTable extends i2.RemoteExifEntity
|
||||
static const i0.VerificationMeta _fNumberMeta =
|
||||
const i0.VerificationMeta('fNumber');
|
||||
@override
|
||||
late final i0.GeneratedColumn<int> fNumber = i0.GeneratedColumn<int>(
|
||||
late final i0.GeneratedColumn<double> fNumber = i0.GeneratedColumn<double>(
|
||||
'f_number', aliasedName, true,
|
||||
type: i0.DriftSqlType.int, requiredDuringInsert: false);
|
||||
type: i0.DriftSqlType.double, requiredDuringInsert: false);
|
||||
static const i0.VerificationMeta _fileSizeMeta =
|
||||
const i0.VerificationMeta('fileSize');
|
||||
@override
|
||||
@ -634,21 +634,21 @@ class $RemoteExifEntityTable extends i2.RemoteExifEntity
|
||||
static const i0.VerificationMeta _focalLengthMeta =
|
||||
const i0.VerificationMeta('focalLength');
|
||||
@override
|
||||
late final i0.GeneratedColumn<int> focalLength = i0.GeneratedColumn<int>(
|
||||
'focal_length', aliasedName, true,
|
||||
type: i0.DriftSqlType.int, requiredDuringInsert: false);
|
||||
late final i0.GeneratedColumn<double> focalLength =
|
||||
i0.GeneratedColumn<double>('focal_length', aliasedName, true,
|
||||
type: i0.DriftSqlType.double, requiredDuringInsert: false);
|
||||
static const i0.VerificationMeta _latitudeMeta =
|
||||
const i0.VerificationMeta('latitude');
|
||||
@override
|
||||
late final i0.GeneratedColumn<int> latitude = i0.GeneratedColumn<int>(
|
||||
late final i0.GeneratedColumn<double> latitude = i0.GeneratedColumn<double>(
|
||||
'latitude', aliasedName, true,
|
||||
type: i0.DriftSqlType.int, requiredDuringInsert: false);
|
||||
type: i0.DriftSqlType.double, requiredDuringInsert: false);
|
||||
static const i0.VerificationMeta _longitudeMeta =
|
||||
const i0.VerificationMeta('longitude');
|
||||
@override
|
||||
late final i0.GeneratedColumn<int> longitude = i0.GeneratedColumn<int>(
|
||||
late final i0.GeneratedColumn<double> longitude = i0.GeneratedColumn<double>(
|
||||
'longitude', aliasedName, true,
|
||||
type: i0.DriftSqlType.int, requiredDuringInsert: false);
|
||||
type: i0.DriftSqlType.double, requiredDuringInsert: false);
|
||||
static const i0.VerificationMeta _isoMeta = const i0.VerificationMeta('iso');
|
||||
@override
|
||||
late final i0.GeneratedColumn<int> iso = i0.GeneratedColumn<int>(
|
||||
@ -853,15 +853,15 @@ class $RemoteExifEntityTable extends i2.RemoteExifEntity
|
||||
exposureTime: attachedDatabase.typeMapping.read(
|
||||
i0.DriftSqlType.string, data['${effectivePrefix}exposure_time']),
|
||||
fNumber: attachedDatabase.typeMapping
|
||||
.read(i0.DriftSqlType.int, data['${effectivePrefix}f_number']),
|
||||
.read(i0.DriftSqlType.double, data['${effectivePrefix}f_number']),
|
||||
fileSize: attachedDatabase.typeMapping
|
||||
.read(i0.DriftSqlType.int, data['${effectivePrefix}file_size']),
|
||||
focalLength: attachedDatabase.typeMapping
|
||||
.read(i0.DriftSqlType.int, data['${effectivePrefix}focal_length']),
|
||||
.read(i0.DriftSqlType.double, data['${effectivePrefix}focal_length']),
|
||||
latitude: attachedDatabase.typeMapping
|
||||
.read(i0.DriftSqlType.int, data['${effectivePrefix}latitude']),
|
||||
.read(i0.DriftSqlType.double, data['${effectivePrefix}latitude']),
|
||||
longitude: attachedDatabase.typeMapping
|
||||
.read(i0.DriftSqlType.int, data['${effectivePrefix}longitude']),
|
||||
.read(i0.DriftSqlType.double, data['${effectivePrefix}longitude']),
|
||||
iso: attachedDatabase.typeMapping
|
||||
.read(i0.DriftSqlType.int, data['${effectivePrefix}iso']),
|
||||
make: attachedDatabase.typeMapping
|
||||
@ -901,11 +901,11 @@ class RemoteExifEntityData extends i0.DataClass
|
||||
final int? height;
|
||||
final int? width;
|
||||
final String? exposureTime;
|
||||
final int? fNumber;
|
||||
final double? fNumber;
|
||||
final int? fileSize;
|
||||
final int? focalLength;
|
||||
final int? latitude;
|
||||
final int? longitude;
|
||||
final double? focalLength;
|
||||
final double? latitude;
|
||||
final double? longitude;
|
||||
final int? iso;
|
||||
final String? make;
|
||||
final String? model;
|
||||
@ -964,19 +964,19 @@ class RemoteExifEntityData extends i0.DataClass
|
||||
map['exposure_time'] = i0.Variable<String>(exposureTime);
|
||||
}
|
||||
if (!nullToAbsent || fNumber != null) {
|
||||
map['f_number'] = i0.Variable<int>(fNumber);
|
||||
map['f_number'] = i0.Variable<double>(fNumber);
|
||||
}
|
||||
if (!nullToAbsent || fileSize != null) {
|
||||
map['file_size'] = i0.Variable<int>(fileSize);
|
||||
}
|
||||
if (!nullToAbsent || focalLength != null) {
|
||||
map['focal_length'] = i0.Variable<int>(focalLength);
|
||||
map['focal_length'] = i0.Variable<double>(focalLength);
|
||||
}
|
||||
if (!nullToAbsent || latitude != null) {
|
||||
map['latitude'] = i0.Variable<int>(latitude);
|
||||
map['latitude'] = i0.Variable<double>(latitude);
|
||||
}
|
||||
if (!nullToAbsent || longitude != null) {
|
||||
map['longitude'] = i0.Variable<int>(longitude);
|
||||
map['longitude'] = i0.Variable<double>(longitude);
|
||||
}
|
||||
if (!nullToAbsent || iso != null) {
|
||||
map['iso'] = i0.Variable<int>(iso);
|
||||
@ -1016,11 +1016,11 @@ class RemoteExifEntityData extends i0.DataClass
|
||||
height: serializer.fromJson<int?>(json['height']),
|
||||
width: serializer.fromJson<int?>(json['width']),
|
||||
exposureTime: serializer.fromJson<String?>(json['exposureTime']),
|
||||
fNumber: serializer.fromJson<int?>(json['fNumber']),
|
||||
fNumber: serializer.fromJson<double?>(json['fNumber']),
|
||||
fileSize: serializer.fromJson<int?>(json['fileSize']),
|
||||
focalLength: serializer.fromJson<int?>(json['focalLength']),
|
||||
latitude: serializer.fromJson<int?>(json['latitude']),
|
||||
longitude: serializer.fromJson<int?>(json['longitude']),
|
||||
focalLength: serializer.fromJson<double?>(json['focalLength']),
|
||||
latitude: serializer.fromJson<double?>(json['latitude']),
|
||||
longitude: serializer.fromJson<double?>(json['longitude']),
|
||||
iso: serializer.fromJson<int?>(json['iso']),
|
||||
make: serializer.fromJson<String?>(json['make']),
|
||||
model: serializer.fromJson<String?>(json['model']),
|
||||
@ -1043,11 +1043,11 @@ class RemoteExifEntityData extends i0.DataClass
|
||||
'height': serializer.toJson<int?>(height),
|
||||
'width': serializer.toJson<int?>(width),
|
||||
'exposureTime': serializer.toJson<String?>(exposureTime),
|
||||
'fNumber': serializer.toJson<int?>(fNumber),
|
||||
'fNumber': serializer.toJson<double?>(fNumber),
|
||||
'fileSize': serializer.toJson<int?>(fileSize),
|
||||
'focalLength': serializer.toJson<int?>(focalLength),
|
||||
'latitude': serializer.toJson<int?>(latitude),
|
||||
'longitude': serializer.toJson<int?>(longitude),
|
||||
'focalLength': serializer.toJson<double?>(focalLength),
|
||||
'latitude': serializer.toJson<double?>(latitude),
|
||||
'longitude': serializer.toJson<double?>(longitude),
|
||||
'iso': serializer.toJson<int?>(iso),
|
||||
'make': serializer.toJson<String?>(make),
|
||||
'model': serializer.toJson<String?>(model),
|
||||
@ -1068,11 +1068,11 @@ class RemoteExifEntityData extends i0.DataClass
|
||||
i0.Value<int?> height = const i0.Value.absent(),
|
||||
i0.Value<int?> width = const i0.Value.absent(),
|
||||
i0.Value<String?> exposureTime = const i0.Value.absent(),
|
||||
i0.Value<int?> fNumber = const i0.Value.absent(),
|
||||
i0.Value<double?> fNumber = const i0.Value.absent(),
|
||||
i0.Value<int?> fileSize = const i0.Value.absent(),
|
||||
i0.Value<int?> focalLength = const i0.Value.absent(),
|
||||
i0.Value<int?> latitude = const i0.Value.absent(),
|
||||
i0.Value<int?> longitude = const i0.Value.absent(),
|
||||
i0.Value<double?> focalLength = const i0.Value.absent(),
|
||||
i0.Value<double?> latitude = const i0.Value.absent(),
|
||||
i0.Value<double?> longitude = const i0.Value.absent(),
|
||||
i0.Value<int?> iso = const i0.Value.absent(),
|
||||
i0.Value<String?> make = const i0.Value.absent(),
|
||||
i0.Value<String?> model = const i0.Value.absent(),
|
||||
@ -1232,11 +1232,11 @@ class RemoteExifEntityCompanion
|
||||
final i0.Value<int?> height;
|
||||
final i0.Value<int?> width;
|
||||
final i0.Value<String?> exposureTime;
|
||||
final i0.Value<int?> fNumber;
|
||||
final i0.Value<double?> fNumber;
|
||||
final i0.Value<int?> fileSize;
|
||||
final i0.Value<int?> focalLength;
|
||||
final i0.Value<int?> latitude;
|
||||
final i0.Value<int?> longitude;
|
||||
final i0.Value<double?> focalLength;
|
||||
final i0.Value<double?> latitude;
|
||||
final i0.Value<double?> longitude;
|
||||
final i0.Value<int?> iso;
|
||||
final i0.Value<String?> make;
|
||||
final i0.Value<String?> model;
|
||||
@ -1300,11 +1300,11 @@ class RemoteExifEntityCompanion
|
||||
i0.Expression<int>? height,
|
||||
i0.Expression<int>? width,
|
||||
i0.Expression<String>? exposureTime,
|
||||
i0.Expression<int>? fNumber,
|
||||
i0.Expression<double>? fNumber,
|
||||
i0.Expression<int>? fileSize,
|
||||
i0.Expression<int>? focalLength,
|
||||
i0.Expression<int>? latitude,
|
||||
i0.Expression<int>? longitude,
|
||||
i0.Expression<double>? focalLength,
|
||||
i0.Expression<double>? latitude,
|
||||
i0.Expression<double>? longitude,
|
||||
i0.Expression<int>? iso,
|
||||
i0.Expression<String>? make,
|
||||
i0.Expression<String>? model,
|
||||
@ -1348,11 +1348,11 @@ class RemoteExifEntityCompanion
|
||||
i0.Value<int?>? height,
|
||||
i0.Value<int?>? width,
|
||||
i0.Value<String?>? exposureTime,
|
||||
i0.Value<int?>? fNumber,
|
||||
i0.Value<double?>? fNumber,
|
||||
i0.Value<int?>? fileSize,
|
||||
i0.Value<int?>? focalLength,
|
||||
i0.Value<int?>? latitude,
|
||||
i0.Value<int?>? longitude,
|
||||
i0.Value<double?>? focalLength,
|
||||
i0.Value<double?>? latitude,
|
||||
i0.Value<double?>? longitude,
|
||||
i0.Value<int?>? iso,
|
||||
i0.Value<String?>? make,
|
||||
i0.Value<String?>? model,
|
||||
@ -1416,19 +1416,19 @@ class RemoteExifEntityCompanion
|
||||
map['exposure_time'] = i0.Variable<String>(exposureTime.value);
|
||||
}
|
||||
if (fNumber.present) {
|
||||
map['f_number'] = i0.Variable<int>(fNumber.value);
|
||||
map['f_number'] = i0.Variable<double>(fNumber.value);
|
||||
}
|
||||
if (fileSize.present) {
|
||||
map['file_size'] = i0.Variable<int>(fileSize.value);
|
||||
}
|
||||
if (focalLength.present) {
|
||||
map['focal_length'] = i0.Variable<int>(focalLength.value);
|
||||
map['focal_length'] = i0.Variable<double>(focalLength.value);
|
||||
}
|
||||
if (latitude.present) {
|
||||
map['latitude'] = i0.Variable<int>(latitude.value);
|
||||
map['latitude'] = i0.Variable<double>(latitude.value);
|
||||
}
|
||||
if (longitude.present) {
|
||||
map['longitude'] = i0.Variable<int>(longitude.value);
|
||||
map['longitude'] = i0.Variable<double>(longitude.value);
|
||||
}
|
||||
if (iso.present) {
|
||||
map['iso'] = i0.Variable<int>(iso.value);
|
||||
|
@ -1,6 +1,8 @@
|
||||
import 'package:drift/drift.dart';
|
||||
import 'package:immich_mobile/domain/models/exif.model.dart';
|
||||
import 'package:immich_mobile/infrastructure/entities/exif.entity.dart'
|
||||
as entity;
|
||||
import 'package:immich_mobile/infrastructure/entities/exif.entity.drift.dart';
|
||||
import 'package:immich_mobile/infrastructure/repositories/db.repository.dart';
|
||||
import 'package:isar/isar.dart';
|
||||
|
||||
@ -41,3 +43,36 @@ class IsarExifRepository extends IsarDatabaseRepository {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
class DriftRemoteExifRepository extends DriftDatabaseRepository {
|
||||
final Drift _db;
|
||||
const DriftRemoteExifRepository(this._db) : super(_db);
|
||||
|
||||
Future<ExifInfo?> get(String assetId) {
|
||||
final query = _db.remoteExifEntity.select()
|
||||
..where((exif) => exif.assetId.equals(assetId));
|
||||
|
||||
return query.map((asset) => asset.toDto()).getSingleOrNull();
|
||||
}
|
||||
}
|
||||
|
||||
extension on RemoteExifEntityData {
|
||||
ExifInfo toDto() {
|
||||
return ExifInfo(
|
||||
fileSize: fileSize,
|
||||
description: description,
|
||||
orientation: orientation,
|
||||
timeZone: timeZone,
|
||||
dateTimeOriginal: dateTimeOriginal,
|
||||
latitude: latitude,
|
||||
longitude: longitude,
|
||||
city: city,
|
||||
state: state,
|
||||
country: country,
|
||||
make: make,
|
||||
model: model,
|
||||
f: fNumber,
|
||||
iso: iso,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1,17 +1,13 @@
|
||||
import 'package:drift/drift.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:immich_mobile/domain/models/asset/base_asset.model.dart';
|
||||
import 'package:immich_mobile/infrastructure/entities/exif.entity.drift.dart';
|
||||
import 'package:immich_mobile/infrastructure/entities/remote_asset.entity.drift.dart';
|
||||
import 'package:immich_mobile/infrastructure/repositories/db.repository.dart';
|
||||
import 'package:immich_mobile/providers/infrastructure/db.provider.dart';
|
||||
import 'package:maplibre_gl/maplibre_gl.dart';
|
||||
|
||||
final remoteAssetRepositoryProvider = Provider<RemoteAssetRepository>(
|
||||
(ref) => RemoteAssetRepository(ref.watch(driftProvider)),
|
||||
);
|
||||
|
||||
class RemoteAssetRepository extends DriftDatabaseRepository {
|
||||
class DriftRemoteAssetRepository extends DriftDatabaseRepository {
|
||||
final Drift _db;
|
||||
const RemoteAssetRepository(this._db) : super(_db);
|
||||
const DriftRemoteAssetRepository(this._db) : super(_db);
|
||||
|
||||
Future<void> updateFavorite(List<String> ids, bool isFavorite) {
|
||||
return _db.batch((batch) async {
|
||||
@ -36,4 +32,19 @@ class RemoteAssetRepository extends DriftDatabaseRepository {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> updateLocation(List<String> ids, LatLng location) {
|
||||
return _db.batch((batch) async {
|
||||
for (final id in ids) {
|
||||
batch.update(
|
||||
_db.remoteExifEntity,
|
||||
RemoteExifEntityCompanion(
|
||||
latitude: Value(location.latitude),
|
||||
longitude: Value(location.longitude),
|
||||
),
|
||||
where: (e) => e.assetId.equals(id),
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -1,16 +1,54 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:fluttertoast/fluttertoast.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:immich_mobile/constants/enums.dart';
|
||||
import 'package:immich_mobile/extensions/translate_extensions.dart';
|
||||
import 'package:immich_mobile/presentation/widgets/action_buttons/base_action_button.widget.dart';
|
||||
import 'package:immich_mobile/providers/infrastructure/action.provider.dart';
|
||||
import 'package:immich_mobile/providers/timeline/multiselect.provider.dart';
|
||||
import 'package:immich_mobile/widgets/common/immich_toast.dart';
|
||||
|
||||
class EditLocationActionButton extends ConsumerWidget {
|
||||
const EditLocationActionButton({super.key});
|
||||
final ActionSource source;
|
||||
|
||||
const EditLocationActionButton({super.key, required this.source});
|
||||
|
||||
_onTap(BuildContext context, WidgetRef ref) async {
|
||||
if (!context.mounted) {
|
||||
return;
|
||||
}
|
||||
|
||||
final result =
|
||||
await ref.read(actionProvider.notifier).editLocation(source, context);
|
||||
if (result == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
ref.read(multiSelectProvider.notifier).reset();
|
||||
|
||||
final successMessage = 'edit_location_action_prompt'.t(
|
||||
context: context,
|
||||
args: {'count': result.count.toString()},
|
||||
);
|
||||
|
||||
if (context.mounted) {
|
||||
ImmichToast.show(
|
||||
context: context,
|
||||
msg: result.success
|
||||
? successMessage
|
||||
: 'scaffold_body_error_occurred'.t(context: context),
|
||||
gravity: ToastGravity.BOTTOM,
|
||||
toastType: result.success ? ToastType.success : ToastType.error,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
return BaseActionButton(
|
||||
iconData: Icons.edit_location_alt_outlined,
|
||||
label: "control_bottom_app_bar_edit_location".t(context: context),
|
||||
onPressed: () => _onTap(context, ref),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ class HomeBottomAppBar extends ConsumerWidget {
|
||||
? const TrashActionButton()
|
||||
: const DeletePermanentActionButton(),
|
||||
const EditDateTimeActionButton(),
|
||||
const EditLocationActionButton(),
|
||||
const EditLocationActionButton(source: ActionSource.timeline),
|
||||
const MoveToLockFolderActionButton(
|
||||
source: ActionSource.timeline,
|
||||
),
|
||||
|
@ -172,4 +172,26 @@ class ActionNotifier extends Notifier<void> {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Future<ActionResult?> editLocation(
|
||||
ActionSource source,
|
||||
BuildContext context,
|
||||
) async {
|
||||
final ids = _getIdsForSource<RemoteAsset>(source);
|
||||
try {
|
||||
final isEdited = await _service.editLocation(ids, context);
|
||||
if (!isEdited) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return ActionResult(count: ids.length, success: true);
|
||||
} catch (error, stack) {
|
||||
_logger.severe('Failed to edit location for assets', error, stack);
|
||||
return ActionResult(
|
||||
count: ids.length,
|
||||
success: false,
|
||||
error: error.toString(),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,12 @@
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:immich_mobile/infrastructure/repositories/local_asset.repository.dart';
|
||||
import 'package:immich_mobile/infrastructure/repositories/remote_asset.repository.dart';
|
||||
import 'package:immich_mobile/providers/infrastructure/db.provider.dart';
|
||||
|
||||
final localAssetRepository = Provider<DriftLocalAssetRepository>(
|
||||
(ref) => DriftLocalAssetRepository(ref.watch(driftProvider)),
|
||||
);
|
||||
|
||||
final remoteAssetRepository = Provider<DriftRemoteAssetRepository>(
|
||||
(ref) => DriftRemoteAssetRepository(ref.watch(driftProvider)),
|
||||
);
|
||||
|
@ -8,3 +8,7 @@ part 'exif.provider.g.dart';
|
||||
@Riverpod(keepAlive: true)
|
||||
IsarExifRepository exifRepository(Ref ref) =>
|
||||
IsarExifRepository(ref.watch(isarProvider));
|
||||
|
||||
final remoteExifRepository = Provider<DriftRemoteExifRepository>(
|
||||
(ref) => DriftRemoteExifRepository(ref.watch(driftProvider)),
|
||||
);
|
||||
|
@ -3,6 +3,7 @@ import 'package:immich_mobile/constants/enums.dart';
|
||||
import 'package:immich_mobile/entities/asset.entity.dart';
|
||||
import 'package:immich_mobile/providers/api.provider.dart';
|
||||
import 'package:immich_mobile/repositories/api.repository.dart';
|
||||
import 'package:maplibre_gl/maplibre_gl.dart';
|
||||
import 'package:openapi/api.dart';
|
||||
|
||||
final assetApiRepositoryProvider = Provider(
|
||||
@ -65,6 +66,19 @@ class AssetApiRepository extends ApiRepository {
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> updateLocation(
|
||||
List<String> ids,
|
||||
LatLng location,
|
||||
) async {
|
||||
return _api.updateAssets(
|
||||
AssetBulkUpdateDto(
|
||||
ids: ids,
|
||||
latitude: location.latitude,
|
||||
longitude: location.longitude,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
_mapVisibility(AssetVisibilityEnum visibility) => switch (visibility) {
|
||||
AssetVisibilityEnum.timeline => AssetVisibility.timeline,
|
||||
AssetVisibilityEnum.hidden => AssetVisibility.hidden,
|
||||
|
@ -2,23 +2,34 @@ import 'package:auto_route/auto_route.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:immich_mobile/constants/enums.dart';
|
||||
import 'package:immich_mobile/domain/models/asset/base_asset.model.dart';
|
||||
import 'package:immich_mobile/infrastructure/repositories/exif.repository.dart';
|
||||
import 'package:immich_mobile/infrastructure/repositories/remote_asset.repository.dart';
|
||||
import 'package:immich_mobile/providers/infrastructure/asset.provider.dart';
|
||||
import 'package:immich_mobile/providers/infrastructure/exif.provider.dart';
|
||||
import 'package:immich_mobile/repositories/asset_api.repository.dart';
|
||||
import 'package:immich_mobile/routing/router.dart';
|
||||
import 'package:immich_mobile/widgets/common/location_picker.dart';
|
||||
import 'package:maplibre_gl/maplibre_gl.dart';
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
|
||||
final actionServiceProvider = Provider<ActionService>(
|
||||
(ref) => ActionService(
|
||||
ref.watch(assetApiRepositoryProvider),
|
||||
ref.watch(remoteAssetRepositoryProvider),
|
||||
ref.watch(remoteAssetRepository),
|
||||
ref.watch(remoteExifRepository),
|
||||
),
|
||||
);
|
||||
|
||||
class ActionService {
|
||||
final AssetApiRepository _assetApiRepository;
|
||||
final RemoteAssetRepository _remoteAssetRepository;
|
||||
final DriftRemoteAssetRepository _remoteAssetRepository;
|
||||
final DriftRemoteExifRepository _remoteExifRepository;
|
||||
|
||||
const ActionService(this._assetApiRepository, this._remoteAssetRepository);
|
||||
const ActionService(
|
||||
this._assetApiRepository,
|
||||
this._remoteAssetRepository,
|
||||
this._remoteExifRepository,
|
||||
);
|
||||
|
||||
Future<void> shareLink(List<String> remoteIds, BuildContext context) async {
|
||||
context.pushRoute(
|
||||
@ -81,4 +92,38 @@ class ActionService {
|
||||
AssetVisibility.timeline,
|
||||
);
|
||||
}
|
||||
|
||||
Future<bool> editLocation(
|
||||
List<String> remoteIds,
|
||||
BuildContext context,
|
||||
) async {
|
||||
LatLng? initialLatLng;
|
||||
if (remoteIds.length == 1) {
|
||||
final exif = await _remoteExifRepository.get(remoteIds[0]);
|
||||
|
||||
if (exif?.latitude != null && exif?.longitude != null) {
|
||||
initialLatLng = LatLng(exif!.latitude!, exif.longitude!);
|
||||
}
|
||||
}
|
||||
|
||||
final location = await showLocationPicker(
|
||||
context: context,
|
||||
initialLatLng: initialLatLng,
|
||||
);
|
||||
|
||||
if (location == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
await _assetApiRepository.updateLocation(
|
||||
remoteIds,
|
||||
location,
|
||||
);
|
||||
await _remoteAssetRepository.updateLocation(
|
||||
remoteIds,
|
||||
location,
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
20
mobile/openapi/lib/model/sync_asset_exif_v1.dart
generated
20
mobile/openapi/lib/model/sync_asset_exif_v1.dart
generated
@ -56,21 +56,21 @@ class SyncAssetExifV1 {
|
||||
|
||||
String? exposureTime;
|
||||
|
||||
int? fNumber;
|
||||
double? fNumber;
|
||||
|
||||
int? fileSizeInByte;
|
||||
|
||||
int? focalLength;
|
||||
double? focalLength;
|
||||
|
||||
int? fps;
|
||||
double? fps;
|
||||
|
||||
int? iso;
|
||||
|
||||
int? latitude;
|
||||
double? latitude;
|
||||
|
||||
String? lensModel;
|
||||
|
||||
int? longitude;
|
||||
double? longitude;
|
||||
|
||||
String? make;
|
||||
|
||||
@ -293,14 +293,14 @@ class SyncAssetExifV1 {
|
||||
exifImageHeight: mapValueOfType<int>(json, r'exifImageHeight'),
|
||||
exifImageWidth: mapValueOfType<int>(json, r'exifImageWidth'),
|
||||
exposureTime: mapValueOfType<String>(json, r'exposureTime'),
|
||||
fNumber: mapValueOfType<int>(json, r'fNumber'),
|
||||
fNumber: (mapValueOfType<num>(json, r'fNumber'))?.toDouble(),
|
||||
fileSizeInByte: mapValueOfType<int>(json, r'fileSizeInByte'),
|
||||
focalLength: mapValueOfType<int>(json, r'focalLength'),
|
||||
fps: mapValueOfType<int>(json, r'fps'),
|
||||
focalLength: (mapValueOfType<num>(json, r'focalLength'))?.toDouble(),
|
||||
fps: (mapValueOfType<num>(json, r'fps'))?.toDouble(),
|
||||
iso: mapValueOfType<int>(json, r'iso'),
|
||||
latitude: mapValueOfType<int>(json, r'latitude'),
|
||||
latitude: (mapValueOfType<num>(json, r'latitude'))?.toDouble(),
|
||||
lensModel: mapValueOfType<String>(json, r'lensModel'),
|
||||
longitude: mapValueOfType<int>(json, r'longitude'),
|
||||
longitude: (mapValueOfType<num>(json, r'longitude'))?.toDouble(),
|
||||
make: mapValueOfType<String>(json, r'make'),
|
||||
model: mapValueOfType<String>(json, r'model'),
|
||||
modifyDate: mapDateTime(json, r'modifyDate', r''),
|
||||
|
@ -13615,36 +13615,41 @@
|
||||
"type": "string"
|
||||
},
|
||||
"fNumber": {
|
||||
"format": "double",
|
||||
"nullable": true,
|
||||
"type": "integer"
|
||||
"type": "number"
|
||||
},
|
||||
"fileSizeInByte": {
|
||||
"nullable": true,
|
||||
"type": "integer"
|
||||
},
|
||||
"focalLength": {
|
||||
"format": "double",
|
||||
"nullable": true,
|
||||
"type": "integer"
|
||||
"type": "number"
|
||||
},
|
||||
"fps": {
|
||||
"format": "double",
|
||||
"nullable": true,
|
||||
"type": "integer"
|
||||
"type": "number"
|
||||
},
|
||||
"iso": {
|
||||
"nullable": true,
|
||||
"type": "integer"
|
||||
},
|
||||
"latitude": {
|
||||
"format": "double",
|
||||
"nullable": true,
|
||||
"type": "integer"
|
||||
"type": "number"
|
||||
},
|
||||
"lensModel": {
|
||||
"nullable": true,
|
||||
"type": "string"
|
||||
},
|
||||
"longitude": {
|
||||
"format": "double",
|
||||
"nullable": true,
|
||||
"type": "integer"
|
||||
"type": "number"
|
||||
},
|
||||
"make": {
|
||||
"nullable": true,
|
||||
|
@ -206,7 +206,7 @@ class {{{classname}}} {
|
||||
: {{/isNullable}}{{{datatypeWithEnum}}}.parse('${json[r'{{{baseName}}}']}'),
|
||||
{{/isNumber}}
|
||||
{{#isDouble}}
|
||||
{{{name}}}: (mapValueOfType<num>(json, r'{{{baseName}}}'){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}}).toDouble(),
|
||||
{{{name}}}: (mapValueOfType<num>(json, r'{{{baseName}}}'){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}}){{#isNullable}}?{{/isNullable}}.toDouble(),
|
||||
{{/isDouble}}
|
||||
{{^isDouble}}
|
||||
{{^isNumber}}
|
||||
|
@ -1,5 +1,5 @@
|
||||
--- native_class.mustache 2024-09-19 11:41:07.855683995 -0400
|
||||
+++ native_class_temp.mustache 2024-09-19 11:41:57.113249395 -0400
|
||||
--- native_class.mustache 2025-07-01 08:29:23.968133163 +0800
|
||||
+++ native_class_temp.mustache 2025-07-01 08:29:44.225850583 +0800
|
||||
@@ -91,14 +91,14 @@
|
||||
{{/isDateTime}}
|
||||
{{#isNullable}}
|
||||
@ -44,7 +44,7 @@
|
||||
: {{/isNullable}}{{{datatypeWithEnum}}}.parse('${json[r'{{{baseName}}}']}'),
|
||||
{{/isNumber}}
|
||||
+ {{#isDouble}}
|
||||
+ {{{name}}}: (mapValueOfType<num>(json, r'{{{baseName}}}'){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}}).toDouble(),
|
||||
+ {{{name}}}: (mapValueOfType<num>(json, r'{{{baseName}}}'){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}}){{#isNullable}}?{{/isNullable}}.toDouble(),
|
||||
+ {{/isDouble}}
|
||||
+ {{^isDouble}}
|
||||
{{^isNumber}}
|
||||
|
@ -115,9 +115,9 @@ export class SyncAssetExifV1 {
|
||||
dateTimeOriginal!: Date | null;
|
||||
modifyDate!: Date | null;
|
||||
timeZone!: string | null;
|
||||
@ApiProperty({ type: 'integer' })
|
||||
@ApiProperty({ type: 'number', format: 'double' })
|
||||
latitude!: number | null;
|
||||
@ApiProperty({ type: 'integer' })
|
||||
@ApiProperty({ type: 'number', format: 'double' })
|
||||
longitude!: number | null;
|
||||
projectionType!: string | null;
|
||||
city!: string | null;
|
||||
@ -126,9 +126,9 @@ export class SyncAssetExifV1 {
|
||||
make!: string | null;
|
||||
model!: string | null;
|
||||
lensModel!: string | null;
|
||||
@ApiProperty({ type: 'integer' })
|
||||
@ApiProperty({ type: 'number', format: 'double' })
|
||||
fNumber!: number | null;
|
||||
@ApiProperty({ type: 'integer' })
|
||||
@ApiProperty({ type: 'number', format: 'double' })
|
||||
focalLength!: number | null;
|
||||
@ApiProperty({ type: 'integer' })
|
||||
iso!: number | null;
|
||||
@ -136,7 +136,7 @@ export class SyncAssetExifV1 {
|
||||
profileDescription!: string | null;
|
||||
@ApiProperty({ type: 'integer' })
|
||||
rating!: number | null;
|
||||
@ApiProperty({ type: 'integer' })
|
||||
@ApiProperty({ type: 'number', format: 'double' })
|
||||
fps!: number | null;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user