mirror of
https://github.com/immich-app/immich.git
synced 2026-05-18 03:10:24 +03:00
Merge branch 'main' into feat/search-filter-album/web
This commit is contained in:
+1
-1
File diff suppressed because one or more lines are too long
@@ -3,7 +3,7 @@
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 77;
|
||||
objectVersion = 54;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
@@ -117,6 +117,8 @@
|
||||
/* Begin PBXFileSystemSynchronizedRootGroup section */
|
||||
B2CF7F8C2DDE4EBB00744BF6 /* Sync */ = {
|
||||
isa = PBXFileSystemSynchronizedRootGroup;
|
||||
exceptions = (
|
||||
);
|
||||
path = Sync;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
@@ -471,14 +473,10 @@
|
||||
inputFileListPaths = (
|
||||
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-input-files.xcfilelist",
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "[CP] Copy Pods Resources";
|
||||
outputFileListPaths = (
|
||||
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-output-files.xcfilelist",
|
||||
);
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n";
|
||||
@@ -507,14 +505,10 @@
|
||||
inputFileListPaths = (
|
||||
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "[CP] Embed Pods Frameworks";
|
||||
outputFileListPaths = (
|
||||
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
|
||||
);
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
customLLDBInitFile = "$(SRCROOT)/Flutter/ephemeral/flutter_lldbinit"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
@@ -43,6 +44,7 @@
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
customLLDBInitFile = "$(SRCROOT)/Flutter/ephemeral/flutter_lldbinit"
|
||||
disableMainThreadChecker = "YES"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
|
||||
@@ -43,6 +43,8 @@ sealed class BaseAsset {
|
||||
bool get isImage => type == AssetType.image;
|
||||
bool get isVideo => type == AssetType.video;
|
||||
|
||||
bool get isMotionPhoto => livePhotoVideoId != null;
|
||||
|
||||
Duration get duration {
|
||||
final durationInSeconds = this.durationInSeconds;
|
||||
if (durationInSeconds != null) {
|
||||
|
||||
@@ -94,6 +94,7 @@ class RemoteAsset extends BaseAsset {
|
||||
bool? isFavorite,
|
||||
String? thumbHash,
|
||||
AssetVisibility? visibility,
|
||||
String? livePhotoVideoId,
|
||||
}) {
|
||||
return RemoteAsset(
|
||||
id: id ?? this.id,
|
||||
@@ -110,6 +111,7 @@ class RemoteAsset extends BaseAsset {
|
||||
isFavorite: isFavorite ?? this.isFavorite,
|
||||
thumbHash: thumbHash ?? this.thumbHash,
|
||||
visibility: visibility ?? this.visibility,
|
||||
livePhotoVideoId: livePhotoVideoId ?? this.livePhotoVideoId,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
import 'dart:ui';
|
||||
|
||||
enum UserMetadataKey {
|
||||
// do not change this order!
|
||||
onboarding,
|
||||
preferences,
|
||||
license,
|
||||
}
|
||||
|
||||
enum AvatarColor {
|
||||
// do not change this order or reuse indices for other purposes, adding is OK
|
||||
primary("primary"),
|
||||
@@ -31,7 +38,45 @@ enum AvatarColor {
|
||||
};
|
||||
}
|
||||
|
||||
class UserPreferences {
|
||||
class Onboarding {
|
||||
final bool isOnboarded;
|
||||
|
||||
const Onboarding({required this.isOnboarded});
|
||||
|
||||
Onboarding copyWith({bool? isOnboarded}) {
|
||||
return Onboarding(isOnboarded: isOnboarded ?? this.isOnboarded);
|
||||
}
|
||||
|
||||
Map<String, Object?> toMap() {
|
||||
final onboarding = <String, Object?>{};
|
||||
onboarding["isOnboarded"] = isOnboarded;
|
||||
return onboarding;
|
||||
}
|
||||
|
||||
factory Onboarding.fromMap(Map<String, Object?> map) {
|
||||
return Onboarding(isOnboarded: map["isOnboarded"] as bool);
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return '''Onboarding {
|
||||
isOnboarded: $isOnboarded,
|
||||
}''';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(covariant Onboarding other) {
|
||||
if (identical(this, other)) return true;
|
||||
|
||||
return isOnboarded == other.isOnboarded;
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => isOnboarded.hashCode;
|
||||
}
|
||||
|
||||
// TODO: wait to be overwritten
|
||||
class Preferences {
|
||||
final bool foldersEnabled;
|
||||
final bool memoriesEnabled;
|
||||
final bool peopleEnabled;
|
||||
@@ -41,7 +86,7 @@ class UserPreferences {
|
||||
final AvatarColor userAvatarColor;
|
||||
final bool showSupportBadge;
|
||||
|
||||
const UserPreferences({
|
||||
const Preferences({
|
||||
this.foldersEnabled = false,
|
||||
this.memoriesEnabled = true,
|
||||
this.peopleEnabled = true,
|
||||
@@ -52,7 +97,7 @@ class UserPreferences {
|
||||
this.showSupportBadge = true,
|
||||
});
|
||||
|
||||
UserPreferences copyWith({
|
||||
Preferences copyWith({
|
||||
bool? foldersEnabled,
|
||||
bool? memoriesEnabled,
|
||||
bool? peopleEnabled,
|
||||
@@ -62,7 +107,7 @@ class UserPreferences {
|
||||
AvatarColor? userAvatarColor,
|
||||
bool? showSupportBadge,
|
||||
}) {
|
||||
return UserPreferences(
|
||||
return Preferences(
|
||||
foldersEnabled: foldersEnabled ?? this.foldersEnabled,
|
||||
memoriesEnabled: memoriesEnabled ?? this.memoriesEnabled,
|
||||
peopleEnabled: peopleEnabled ?? this.peopleEnabled,
|
||||
@@ -87,8 +132,8 @@ class UserPreferences {
|
||||
return preferences;
|
||||
}
|
||||
|
||||
factory UserPreferences.fromMap(Map<String, Object?> map) {
|
||||
return UserPreferences(
|
||||
factory Preferences.fromMap(Map<String, Object?> map) {
|
||||
return Preferences(
|
||||
foldersEnabled: map["folders-Enabled"] as bool? ?? false,
|
||||
memoriesEnabled: map["memories-Enabled"] as bool? ?? true,
|
||||
peopleEnabled: map["people-Enabled"] as bool? ?? true,
|
||||
@@ -102,4 +147,173 @@ class UserPreferences {
|
||||
showSupportBadge: map["purchase-ShowSupportBadge"] as bool? ?? true,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return '''Preferences: {
|
||||
foldersEnabled: $foldersEnabled,
|
||||
memoriesEnabled: $memoriesEnabled,
|
||||
peopleEnabled: $peopleEnabled,
|
||||
ratingsEnabled: $ratingsEnabled,
|
||||
sharedLinksEnabled: $sharedLinksEnabled,
|
||||
tagsEnabled: $tagsEnabled,
|
||||
userAvatarColor: $userAvatarColor,
|
||||
showSupportBadge: $showSupportBadge,
|
||||
}''';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(covariant Preferences other) {
|
||||
if (identical(this, other)) return true;
|
||||
|
||||
return other.foldersEnabled == foldersEnabled &&
|
||||
other.memoriesEnabled == memoriesEnabled &&
|
||||
other.peopleEnabled == peopleEnabled &&
|
||||
other.ratingsEnabled == ratingsEnabled &&
|
||||
other.sharedLinksEnabled == sharedLinksEnabled &&
|
||||
other.tagsEnabled == tagsEnabled &&
|
||||
other.userAvatarColor == userAvatarColor &&
|
||||
other.showSupportBadge == showSupportBadge;
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode {
|
||||
return foldersEnabled.hashCode ^
|
||||
memoriesEnabled.hashCode ^
|
||||
peopleEnabled.hashCode ^
|
||||
ratingsEnabled.hashCode ^
|
||||
sharedLinksEnabled.hashCode ^
|
||||
tagsEnabled.hashCode ^
|
||||
userAvatarColor.hashCode ^
|
||||
showSupportBadge.hashCode;
|
||||
}
|
||||
}
|
||||
|
||||
class License {
|
||||
final DateTime activatedAt;
|
||||
final String activationKey;
|
||||
final String licenseKey;
|
||||
|
||||
const License({
|
||||
required this.activatedAt,
|
||||
required this.activationKey,
|
||||
required this.licenseKey,
|
||||
});
|
||||
|
||||
License copyWith({
|
||||
DateTime? activatedAt,
|
||||
String? activationKey,
|
||||
String? licenseKey,
|
||||
}) {
|
||||
return License(
|
||||
activatedAt: activatedAt ?? this.activatedAt,
|
||||
activationKey: activationKey ?? this.activationKey,
|
||||
licenseKey: licenseKey ?? this.licenseKey,
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, Object?> toMap() {
|
||||
final license = <String, Object?>{};
|
||||
license["activatedAt"] = activatedAt;
|
||||
license["activationKey"] = activationKey;
|
||||
license["licenseKey"] = licenseKey;
|
||||
return license;
|
||||
}
|
||||
|
||||
factory License.fromMap(Map<String, Object?> map) {
|
||||
return License(
|
||||
activatedAt: map["activatedAt"] as DateTime,
|
||||
activationKey: map["activationKey"] as String,
|
||||
licenseKey: map["licenseKey"] as String,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return '''License {
|
||||
activatedAt: $activatedAt,
|
||||
activationKey: $activationKey,
|
||||
licenseKey: $licenseKey,
|
||||
}''';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(covariant License other) {
|
||||
if (identical(this, other)) return true;
|
||||
|
||||
return activatedAt == other.activatedAt &&
|
||||
activationKey == other.activationKey &&
|
||||
licenseKey == other.licenseKey;
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
activatedAt.hashCode ^ activationKey.hashCode ^ licenseKey.hashCode;
|
||||
}
|
||||
|
||||
// Model for a user metadata stored in the server
|
||||
class UserMetadata {
|
||||
final String userId;
|
||||
final UserMetadataKey key;
|
||||
final Onboarding? onboarding;
|
||||
final Preferences? preferences;
|
||||
final License? license;
|
||||
|
||||
const UserMetadata({
|
||||
required this.userId,
|
||||
required this.key,
|
||||
this.onboarding,
|
||||
this.preferences,
|
||||
this.license,
|
||||
}) : assert(
|
||||
onboarding != null || preferences != null || license != null,
|
||||
'One of onboarding, preferences and license must be provided',
|
||||
);
|
||||
|
||||
UserMetadata copyWith({
|
||||
String? userId,
|
||||
UserMetadataKey? key,
|
||||
Onboarding? onboarding,
|
||||
Preferences? preferences,
|
||||
License? license,
|
||||
}) {
|
||||
return UserMetadata(
|
||||
userId: userId ?? this.userId,
|
||||
key: key ?? this.key,
|
||||
onboarding: onboarding ?? this.onboarding,
|
||||
preferences: preferences ?? this.preferences,
|
||||
license: license ?? this.license,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return '''UserMetadata: {
|
||||
userId: $userId,
|
||||
key: $key,
|
||||
onboarding: ${onboarding ?? "<NA>"},
|
||||
preferences: ${preferences ?? "<NA>"},
|
||||
license: ${license ?? "<NA>"},
|
||||
}''';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(covariant UserMetadata other) {
|
||||
if (identical(this, other)) return true;
|
||||
|
||||
return other.userId == userId &&
|
||||
other.key == key &&
|
||||
other.onboarding == onboarding &&
|
||||
other.preferences == preferences &&
|
||||
other.license == license;
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode {
|
||||
return userId.hashCode ^
|
||||
key.hashCode ^
|
||||
onboarding.hashCode ^
|
||||
preferences.hashCode ^
|
||||
license.hashCode;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,4 +61,8 @@ class AssetService {
|
||||
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
Future<List<(String, String)>> getPlaces() {
|
||||
return _remoteAssetRepository.getPlaces();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,59 @@ class SyncStreamService {
|
||||
return _syncApiRepository.streamChanges(_handleEvents);
|
||||
}
|
||||
|
||||
Future<void> handleWsAssetUploadReadyV1Batch(List<dynamic> batchData) async {
|
||||
if (batchData.isEmpty) return;
|
||||
|
||||
_logger.info(
|
||||
'Processing batch of ${batchData.length} AssetUploadReadyV1 events',
|
||||
);
|
||||
|
||||
final List<SyncAssetV1> assets = [];
|
||||
final List<SyncAssetExifV1> exifs = [];
|
||||
|
||||
try {
|
||||
for (final data in batchData) {
|
||||
if (data is! Map<String, dynamic>) {
|
||||
continue;
|
||||
}
|
||||
|
||||
final payload = data;
|
||||
final assetData = payload['asset'];
|
||||
final exifData = payload['exif'];
|
||||
|
||||
if (assetData == null || exifData == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
final asset = SyncAssetV1.fromJson(assetData);
|
||||
final exif = SyncAssetExifV1.fromJson(exifData);
|
||||
|
||||
if (asset != null && exif != null) {
|
||||
assets.add(asset);
|
||||
exifs.add(exif);
|
||||
}
|
||||
}
|
||||
|
||||
if (assets.isNotEmpty && exifs.isNotEmpty) {
|
||||
await _syncStreamRepository.updateAssetsV1(
|
||||
assets,
|
||||
debugLabel: 'websocket-batch',
|
||||
);
|
||||
await _syncStreamRepository.updateAssetsExifV1(
|
||||
exifs,
|
||||
debugLabel: 'websocket-batch',
|
||||
);
|
||||
_logger.info('Successfully processed ${assets.length} assets in batch');
|
||||
}
|
||||
} catch (error, stackTrace) {
|
||||
_logger.severe(
|
||||
"Error processing AssetUploadReadyV1 websocket batch events",
|
||||
error,
|
||||
stackTrace,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _handleEvents(List<SyncEvent> events, Function() abort) async {
|
||||
List<SyncEvent> items = [];
|
||||
for (final event in events) {
|
||||
@@ -179,6 +232,14 @@ class SyncStreamService {
|
||||
data.cast(),
|
||||
debugLabel: 'partner',
|
||||
);
|
||||
case SyncEntityType.userMetadataV1:
|
||||
return _syncStreamRepository.updateUserMetadatasV1(
|
||||
data.cast(),
|
||||
);
|
||||
case SyncEntityType.userMetadataDeleteV1:
|
||||
return _syncStreamRepository.deleteUserMetadatasV1(
|
||||
data.cast(),
|
||||
);
|
||||
default:
|
||||
_logger.warning("Unknown sync data type: $type");
|
||||
}
|
||||
|
||||
@@ -62,6 +62,9 @@ class TimelineFactory {
|
||||
|
||||
TimelineService video(String userId) =>
|
||||
TimelineService(_timelineRepository.video(userId, groupBy));
|
||||
|
||||
TimelineService place(String place) =>
|
||||
TimelineService(_timelineRepository.place(place, groupBy));
|
||||
}
|
||||
|
||||
class TimelineService {
|
||||
|
||||
@@ -6,6 +6,7 @@ import 'package:worker_manager/worker_manager.dart';
|
||||
|
||||
class BackgroundSyncManager {
|
||||
Cancelable<void>? _syncTask;
|
||||
Cancelable<void>? _syncWebsocketTask;
|
||||
Cancelable<void>? _deviceAlbumSyncTask;
|
||||
Cancelable<void>? _hashTask;
|
||||
|
||||
@@ -20,6 +21,12 @@ class BackgroundSyncManager {
|
||||
_syncTask?.cancel();
|
||||
_syncTask = null;
|
||||
|
||||
if (_syncWebsocketTask != null) {
|
||||
futures.add(_syncWebsocketTask!.future);
|
||||
}
|
||||
_syncWebsocketTask?.cancel();
|
||||
_syncWebsocketTask = null;
|
||||
|
||||
return Future.wait(futures);
|
||||
}
|
||||
|
||||
@@ -72,4 +79,19 @@ class BackgroundSyncManager {
|
||||
_syncTask = null;
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> syncWebsocketBatch(List<dynamic> batchData) {
|
||||
if (_syncWebsocketTask != null) {
|
||||
return _syncWebsocketTask!.future;
|
||||
}
|
||||
|
||||
_syncWebsocketTask = runInIsolateGentle(
|
||||
computation: (ref) => ref
|
||||
.read(syncStreamServiceProvider)
|
||||
.handleWsAssetUploadReadyV1Batch(batchData),
|
||||
);
|
||||
return _syncWebsocketTask!.whenComplete(() {
|
||||
_syncWebsocketTask = null;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ mergedAsset: SELECT * FROM
|
||||
rae.thumb_hash,
|
||||
rae.checksum,
|
||||
rae.owner_id,
|
||||
rae.live_photo_video_id,
|
||||
0 as orientation
|
||||
FROM
|
||||
remote_asset_entity rae
|
||||
@@ -39,6 +40,7 @@ mergedAsset: SELECT * FROM
|
||||
NULL as thumb_hash,
|
||||
lae.checksum,
|
||||
NULL as owner_id,
|
||||
NULL as live_photo_video_id,
|
||||
lae.orientation
|
||||
FROM
|
||||
local_asset_entity lae
|
||||
|
||||
+4
-1
@@ -18,7 +18,7 @@ class MergedAssetDrift extends i1.ModularAccessor {
|
||||
final generatedlimit = $write(limit, startIndex: $arrayStartIndex);
|
||||
$arrayStartIndex += generatedlimit.amountOfVariables;
|
||||
return customSelect(
|
||||
'SELECT * FROM (SELECT rae.id AS remote_id, lae.id AS local_id, rae.name, rae.type, rae.created_at, rae.updated_at, rae.width, rae.height, rae.duration_in_seconds, rae.is_favorite, rae.thumb_hash, rae.checksum, rae.owner_id, 0 AS orientation FROM remote_asset_entity AS rae LEFT JOIN local_asset_entity AS lae ON rae.checksum = lae.checksum WHERE rae.deleted_at IS NULL AND rae.visibility = 0 AND rae.owner_id IN ($expandedvar1) UNION ALL SELECT NULL AS remote_id, lae.id AS local_id, lae.name, lae.type, lae.created_at, lae.updated_at, lae.width, lae.height, lae.duration_in_seconds, lae.is_favorite, NULL AS thumb_hash, lae.checksum, NULL AS owner_id, lae.orientation FROM local_asset_entity AS lae LEFT JOIN remote_asset_entity AS rae ON rae.checksum = lae.checksum WHERE rae.id IS NULL) ORDER BY created_at DESC ${generatedlimit.sql}',
|
||||
'SELECT * FROM (SELECT rae.id AS remote_id, lae.id AS local_id, rae.name, rae.type, rae.created_at, rae.updated_at, rae.width, rae.height, rae.duration_in_seconds, rae.is_favorite, rae.thumb_hash, rae.checksum, rae.owner_id, rae.live_photo_video_id, 0 AS orientation FROM remote_asset_entity AS rae LEFT JOIN local_asset_entity AS lae ON rae.checksum = lae.checksum WHERE rae.deleted_at IS NULL AND rae.visibility = 0 AND rae.owner_id IN ($expandedvar1) UNION ALL SELECT NULL AS remote_id, lae.id AS local_id, lae.name, lae.type, lae.created_at, lae.updated_at, lae.width, lae.height, lae.duration_in_seconds, lae.is_favorite, NULL AS thumb_hash, lae.checksum, NULL AS owner_id, NULL AS live_photo_video_id, lae.orientation FROM local_asset_entity AS lae LEFT JOIN remote_asset_entity AS rae ON rae.checksum = lae.checksum WHERE rae.id IS NULL) ORDER BY created_at DESC ${generatedlimit.sql}',
|
||||
variables: [
|
||||
for (var $ in var1) i0.Variable<String>($),
|
||||
...generatedlimit.introducedVariables
|
||||
@@ -42,6 +42,7 @@ class MergedAssetDrift extends i1.ModularAccessor {
|
||||
thumbHash: row.readNullable<String>('thumb_hash'),
|
||||
checksum: row.readNullable<String>('checksum'),
|
||||
ownerId: row.readNullable<String>('owner_id'),
|
||||
livePhotoVideoId: row.readNullable<String>('live_photo_video_id'),
|
||||
orientation: row.read<int>('orientation'),
|
||||
));
|
||||
}
|
||||
@@ -88,6 +89,7 @@ class MergedAssetResult {
|
||||
final String? thumbHash;
|
||||
final String? checksum;
|
||||
final String? ownerId;
|
||||
final String? livePhotoVideoId;
|
||||
final int orientation;
|
||||
MergedAssetResult({
|
||||
this.remoteId,
|
||||
@@ -103,6 +105,7 @@ class MergedAssetResult {
|
||||
this.thumbHash,
|
||||
this.checksum,
|
||||
this.ownerId,
|
||||
this.livePhotoVideoId,
|
||||
required this.orientation,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -30,6 +30,8 @@ class RemoteAssetEntity extends Table
|
||||
|
||||
DateTimeColumn get deletedAt => dateTime().nullable()();
|
||||
|
||||
TextColumn get livePhotoVideoId => text().nullable()();
|
||||
|
||||
IntColumn get visibility => intEnum<AssetVisibility>()();
|
||||
|
||||
@override
|
||||
@@ -51,6 +53,7 @@ extension RemoteAssetEntityDataDomainEx on RemoteAssetEntityData {
|
||||
width: width,
|
||||
thumbHash: thumbHash,
|
||||
visibility: visibility,
|
||||
livePhotoVideoId: livePhotoVideoId,
|
||||
localId: null,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ typedef $$RemoteAssetEntityTableCreateCompanionBuilder
|
||||
i0.Value<DateTime?> localDateTime,
|
||||
i0.Value<String?> thumbHash,
|
||||
i0.Value<DateTime?> deletedAt,
|
||||
i0.Value<String?> livePhotoVideoId,
|
||||
required i2.AssetVisibility visibility,
|
||||
});
|
||||
typedef $$RemoteAssetEntityTableUpdateCompanionBuilder
|
||||
@@ -45,6 +46,7 @@ typedef $$RemoteAssetEntityTableUpdateCompanionBuilder
|
||||
i0.Value<DateTime?> localDateTime,
|
||||
i0.Value<String?> thumbHash,
|
||||
i0.Value<DateTime?> deletedAt,
|
||||
i0.Value<String?> livePhotoVideoId,
|
||||
i0.Value<i2.AssetVisibility> visibility,
|
||||
});
|
||||
|
||||
@@ -134,6 +136,10 @@ class $$RemoteAssetEntityTableFilterComposer
|
||||
i0.ColumnFilters<DateTime> get deletedAt => $composableBuilder(
|
||||
column: $table.deletedAt, builder: (column) => i0.ColumnFilters(column));
|
||||
|
||||
i0.ColumnFilters<String> get livePhotoVideoId => $composableBuilder(
|
||||
column: $table.livePhotoVideoId,
|
||||
builder: (column) => i0.ColumnFilters(column));
|
||||
|
||||
i0.ColumnWithTypeConverterFilters<i2.AssetVisibility, i2.AssetVisibility, int>
|
||||
get visibility => $composableBuilder(
|
||||
column: $table.visibility,
|
||||
@@ -217,6 +223,10 @@ class $$RemoteAssetEntityTableOrderingComposer
|
||||
column: $table.deletedAt,
|
||||
builder: (column) => i0.ColumnOrderings(column));
|
||||
|
||||
i0.ColumnOrderings<String> get livePhotoVideoId => $composableBuilder(
|
||||
column: $table.livePhotoVideoId,
|
||||
builder: (column) => i0.ColumnOrderings(column));
|
||||
|
||||
i0.ColumnOrderings<int> get visibility => $composableBuilder(
|
||||
column: $table.visibility,
|
||||
builder: (column) => i0.ColumnOrderings(column));
|
||||
@@ -292,6 +302,9 @@ class $$RemoteAssetEntityTableAnnotationComposer
|
||||
i0.GeneratedColumn<DateTime> get deletedAt =>
|
||||
$composableBuilder(column: $table.deletedAt, builder: (column) => column);
|
||||
|
||||
i0.GeneratedColumn<String> get livePhotoVideoId => $composableBuilder(
|
||||
column: $table.livePhotoVideoId, builder: (column) => column);
|
||||
|
||||
i0.GeneratedColumnWithTypeConverter<i2.AssetVisibility, int> get visibility =>
|
||||
$composableBuilder(
|
||||
column: $table.visibility, builder: (column) => column);
|
||||
@@ -358,6 +371,7 @@ class $$RemoteAssetEntityTableTableManager extends i0.RootTableManager<
|
||||
i0.Value<DateTime?> localDateTime = const i0.Value.absent(),
|
||||
i0.Value<String?> thumbHash = const i0.Value.absent(),
|
||||
i0.Value<DateTime?> deletedAt = const i0.Value.absent(),
|
||||
i0.Value<String?> livePhotoVideoId = const i0.Value.absent(),
|
||||
i0.Value<i2.AssetVisibility> visibility = const i0.Value.absent(),
|
||||
}) =>
|
||||
i1.RemoteAssetEntityCompanion(
|
||||
@@ -375,6 +389,7 @@ class $$RemoteAssetEntityTableTableManager extends i0.RootTableManager<
|
||||
localDateTime: localDateTime,
|
||||
thumbHash: thumbHash,
|
||||
deletedAt: deletedAt,
|
||||
livePhotoVideoId: livePhotoVideoId,
|
||||
visibility: visibility,
|
||||
),
|
||||
createCompanionCallback: ({
|
||||
@@ -392,6 +407,7 @@ class $$RemoteAssetEntityTableTableManager extends i0.RootTableManager<
|
||||
i0.Value<DateTime?> localDateTime = const i0.Value.absent(),
|
||||
i0.Value<String?> thumbHash = const i0.Value.absent(),
|
||||
i0.Value<DateTime?> deletedAt = const i0.Value.absent(),
|
||||
i0.Value<String?> livePhotoVideoId = const i0.Value.absent(),
|
||||
required i2.AssetVisibility visibility,
|
||||
}) =>
|
||||
i1.RemoteAssetEntityCompanion.insert(
|
||||
@@ -409,6 +425,7 @@ class $$RemoteAssetEntityTableTableManager extends i0.RootTableManager<
|
||||
localDateTime: localDateTime,
|
||||
thumbHash: thumbHash,
|
||||
deletedAt: deletedAt,
|
||||
livePhotoVideoId: livePhotoVideoId,
|
||||
visibility: visibility,
|
||||
),
|
||||
withReferenceMapper: (p0) => p0
|
||||
@@ -573,6 +590,12 @@ class $RemoteAssetEntityTable extends i3.RemoteAssetEntity
|
||||
late final i0.GeneratedColumn<DateTime> deletedAt =
|
||||
i0.GeneratedColumn<DateTime>('deleted_at', aliasedName, true,
|
||||
type: i0.DriftSqlType.dateTime, requiredDuringInsert: false);
|
||||
static const i0.VerificationMeta _livePhotoVideoIdMeta =
|
||||
const i0.VerificationMeta('livePhotoVideoId');
|
||||
@override
|
||||
late final i0.GeneratedColumn<String> livePhotoVideoId =
|
||||
i0.GeneratedColumn<String>('live_photo_video_id', aliasedName, true,
|
||||
type: i0.DriftSqlType.string, requiredDuringInsert: false);
|
||||
@override
|
||||
late final i0.GeneratedColumnWithTypeConverter<i2.AssetVisibility, int>
|
||||
visibility = i0.GeneratedColumn<int>('visibility', aliasedName, false,
|
||||
@@ -595,6 +618,7 @@ class $RemoteAssetEntityTable extends i3.RemoteAssetEntity
|
||||
localDateTime,
|
||||
thumbHash,
|
||||
deletedAt,
|
||||
livePhotoVideoId,
|
||||
visibility
|
||||
];
|
||||
@override
|
||||
@@ -673,6 +697,12 @@ class $RemoteAssetEntityTable extends i3.RemoteAssetEntity
|
||||
context.handle(_deletedAtMeta,
|
||||
deletedAt.isAcceptableOrUnknown(data['deleted_at']!, _deletedAtMeta));
|
||||
}
|
||||
if (data.containsKey('live_photo_video_id')) {
|
||||
context.handle(
|
||||
_livePhotoVideoIdMeta,
|
||||
livePhotoVideoId.isAcceptableOrUnknown(
|
||||
data['live_photo_video_id']!, _livePhotoVideoIdMeta));
|
||||
}
|
||||
return context;
|
||||
}
|
||||
|
||||
@@ -712,6 +742,9 @@ class $RemoteAssetEntityTable extends i3.RemoteAssetEntity
|
||||
.read(i0.DriftSqlType.string, data['${effectivePrefix}thumb_hash']),
|
||||
deletedAt: attachedDatabase.typeMapping
|
||||
.read(i0.DriftSqlType.dateTime, data['${effectivePrefix}deleted_at']),
|
||||
livePhotoVideoId: attachedDatabase.typeMapping.read(
|
||||
i0.DriftSqlType.string,
|
||||
data['${effectivePrefix}live_photo_video_id']),
|
||||
visibility: i1.$RemoteAssetEntityTable.$convertervisibility.fromSql(
|
||||
attachedDatabase.typeMapping.read(
|
||||
i0.DriftSqlType.int, data['${effectivePrefix}visibility'])!),
|
||||
@@ -750,6 +783,7 @@ class RemoteAssetEntityData extends i0.DataClass
|
||||
final DateTime? localDateTime;
|
||||
final String? thumbHash;
|
||||
final DateTime? deletedAt;
|
||||
final String? livePhotoVideoId;
|
||||
final i2.AssetVisibility visibility;
|
||||
const RemoteAssetEntityData(
|
||||
{required this.name,
|
||||
@@ -766,6 +800,7 @@ class RemoteAssetEntityData extends i0.DataClass
|
||||
this.localDateTime,
|
||||
this.thumbHash,
|
||||
this.deletedAt,
|
||||
this.livePhotoVideoId,
|
||||
required this.visibility});
|
||||
@override
|
||||
Map<String, i0.Expression> toColumns(bool nullToAbsent) {
|
||||
@@ -799,6 +834,9 @@ class RemoteAssetEntityData extends i0.DataClass
|
||||
if (!nullToAbsent || deletedAt != null) {
|
||||
map['deleted_at'] = i0.Variable<DateTime>(deletedAt);
|
||||
}
|
||||
if (!nullToAbsent || livePhotoVideoId != null) {
|
||||
map['live_photo_video_id'] = i0.Variable<String>(livePhotoVideoId);
|
||||
}
|
||||
{
|
||||
map['visibility'] = i0.Variable<int>(
|
||||
i1.$RemoteAssetEntityTable.$convertervisibility.toSql(visibility));
|
||||
@@ -825,6 +863,7 @@ class RemoteAssetEntityData extends i0.DataClass
|
||||
localDateTime: serializer.fromJson<DateTime?>(json['localDateTime']),
|
||||
thumbHash: serializer.fromJson<String?>(json['thumbHash']),
|
||||
deletedAt: serializer.fromJson<DateTime?>(json['deletedAt']),
|
||||
livePhotoVideoId: serializer.fromJson<String?>(json['livePhotoVideoId']),
|
||||
visibility: i1.$RemoteAssetEntityTable.$convertervisibility
|
||||
.fromJson(serializer.fromJson<int>(json['visibility'])),
|
||||
);
|
||||
@@ -848,6 +887,7 @@ class RemoteAssetEntityData extends i0.DataClass
|
||||
'localDateTime': serializer.toJson<DateTime?>(localDateTime),
|
||||
'thumbHash': serializer.toJson<String?>(thumbHash),
|
||||
'deletedAt': serializer.toJson<DateTime?>(deletedAt),
|
||||
'livePhotoVideoId': serializer.toJson<String?>(livePhotoVideoId),
|
||||
'visibility': serializer.toJson<int>(
|
||||
i1.$RemoteAssetEntityTable.$convertervisibility.toJson(visibility)),
|
||||
};
|
||||
@@ -868,6 +908,7 @@ class RemoteAssetEntityData extends i0.DataClass
|
||||
i0.Value<DateTime?> localDateTime = const i0.Value.absent(),
|
||||
i0.Value<String?> thumbHash = const i0.Value.absent(),
|
||||
i0.Value<DateTime?> deletedAt = const i0.Value.absent(),
|
||||
i0.Value<String?> livePhotoVideoId = const i0.Value.absent(),
|
||||
i2.AssetVisibility? visibility}) =>
|
||||
i1.RemoteAssetEntityData(
|
||||
name: name ?? this.name,
|
||||
@@ -887,6 +928,9 @@ class RemoteAssetEntityData extends i0.DataClass
|
||||
localDateTime.present ? localDateTime.value : this.localDateTime,
|
||||
thumbHash: thumbHash.present ? thumbHash.value : this.thumbHash,
|
||||
deletedAt: deletedAt.present ? deletedAt.value : this.deletedAt,
|
||||
livePhotoVideoId: livePhotoVideoId.present
|
||||
? livePhotoVideoId.value
|
||||
: this.livePhotoVideoId,
|
||||
visibility: visibility ?? this.visibility,
|
||||
);
|
||||
RemoteAssetEntityData copyWithCompanion(i1.RemoteAssetEntityCompanion data) {
|
||||
@@ -910,6 +954,9 @@ class RemoteAssetEntityData extends i0.DataClass
|
||||
: this.localDateTime,
|
||||
thumbHash: data.thumbHash.present ? data.thumbHash.value : this.thumbHash,
|
||||
deletedAt: data.deletedAt.present ? data.deletedAt.value : this.deletedAt,
|
||||
livePhotoVideoId: data.livePhotoVideoId.present
|
||||
? data.livePhotoVideoId.value
|
||||
: this.livePhotoVideoId,
|
||||
visibility:
|
||||
data.visibility.present ? data.visibility.value : this.visibility,
|
||||
);
|
||||
@@ -932,6 +979,7 @@ class RemoteAssetEntityData extends i0.DataClass
|
||||
..write('localDateTime: $localDateTime, ')
|
||||
..write('thumbHash: $thumbHash, ')
|
||||
..write('deletedAt: $deletedAt, ')
|
||||
..write('livePhotoVideoId: $livePhotoVideoId, ')
|
||||
..write('visibility: $visibility')
|
||||
..write(')'))
|
||||
.toString();
|
||||
@@ -953,6 +1001,7 @@ class RemoteAssetEntityData extends i0.DataClass
|
||||
localDateTime,
|
||||
thumbHash,
|
||||
deletedAt,
|
||||
livePhotoVideoId,
|
||||
visibility);
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
@@ -972,6 +1021,7 @@ class RemoteAssetEntityData extends i0.DataClass
|
||||
other.localDateTime == this.localDateTime &&
|
||||
other.thumbHash == this.thumbHash &&
|
||||
other.deletedAt == this.deletedAt &&
|
||||
other.livePhotoVideoId == this.livePhotoVideoId &&
|
||||
other.visibility == this.visibility);
|
||||
}
|
||||
|
||||
@@ -991,6 +1041,7 @@ class RemoteAssetEntityCompanion
|
||||
final i0.Value<DateTime?> localDateTime;
|
||||
final i0.Value<String?> thumbHash;
|
||||
final i0.Value<DateTime?> deletedAt;
|
||||
final i0.Value<String?> livePhotoVideoId;
|
||||
final i0.Value<i2.AssetVisibility> visibility;
|
||||
const RemoteAssetEntityCompanion({
|
||||
this.name = const i0.Value.absent(),
|
||||
@@ -1007,6 +1058,7 @@ class RemoteAssetEntityCompanion
|
||||
this.localDateTime = const i0.Value.absent(),
|
||||
this.thumbHash = const i0.Value.absent(),
|
||||
this.deletedAt = const i0.Value.absent(),
|
||||
this.livePhotoVideoId = const i0.Value.absent(),
|
||||
this.visibility = const i0.Value.absent(),
|
||||
});
|
||||
RemoteAssetEntityCompanion.insert({
|
||||
@@ -1024,6 +1076,7 @@ class RemoteAssetEntityCompanion
|
||||
this.localDateTime = const i0.Value.absent(),
|
||||
this.thumbHash = const i0.Value.absent(),
|
||||
this.deletedAt = const i0.Value.absent(),
|
||||
this.livePhotoVideoId = const i0.Value.absent(),
|
||||
required i2.AssetVisibility visibility,
|
||||
}) : name = i0.Value(name),
|
||||
type = i0.Value(type),
|
||||
@@ -1046,6 +1099,7 @@ class RemoteAssetEntityCompanion
|
||||
i0.Expression<DateTime>? localDateTime,
|
||||
i0.Expression<String>? thumbHash,
|
||||
i0.Expression<DateTime>? deletedAt,
|
||||
i0.Expression<String>? livePhotoVideoId,
|
||||
i0.Expression<int>? visibility,
|
||||
}) {
|
||||
return i0.RawValuesInsertable({
|
||||
@@ -1063,6 +1117,7 @@ class RemoteAssetEntityCompanion
|
||||
if (localDateTime != null) 'local_date_time': localDateTime,
|
||||
if (thumbHash != null) 'thumb_hash': thumbHash,
|
||||
if (deletedAt != null) 'deleted_at': deletedAt,
|
||||
if (livePhotoVideoId != null) 'live_photo_video_id': livePhotoVideoId,
|
||||
if (visibility != null) 'visibility': visibility,
|
||||
});
|
||||
}
|
||||
@@ -1082,6 +1137,7 @@ class RemoteAssetEntityCompanion
|
||||
i0.Value<DateTime?>? localDateTime,
|
||||
i0.Value<String?>? thumbHash,
|
||||
i0.Value<DateTime?>? deletedAt,
|
||||
i0.Value<String?>? livePhotoVideoId,
|
||||
i0.Value<i2.AssetVisibility>? visibility}) {
|
||||
return i1.RemoteAssetEntityCompanion(
|
||||
name: name ?? this.name,
|
||||
@@ -1098,6 +1154,7 @@ class RemoteAssetEntityCompanion
|
||||
localDateTime: localDateTime ?? this.localDateTime,
|
||||
thumbHash: thumbHash ?? this.thumbHash,
|
||||
deletedAt: deletedAt ?? this.deletedAt,
|
||||
livePhotoVideoId: livePhotoVideoId ?? this.livePhotoVideoId,
|
||||
visibility: visibility ?? this.visibility,
|
||||
);
|
||||
}
|
||||
@@ -1148,6 +1205,9 @@ class RemoteAssetEntityCompanion
|
||||
if (deletedAt.present) {
|
||||
map['deleted_at'] = i0.Variable<DateTime>(deletedAt.value);
|
||||
}
|
||||
if (livePhotoVideoId.present) {
|
||||
map['live_photo_video_id'] = i0.Variable<String>(livePhotoVideoId.value);
|
||||
}
|
||||
if (visibility.present) {
|
||||
map['visibility'] = i0.Variable<int>(i1
|
||||
.$RemoteAssetEntityTable.$convertervisibility
|
||||
@@ -1173,6 +1233,7 @@ class RemoteAssetEntityCompanion
|
||||
..write('localDateTime: $localDateTime, ')
|
||||
..write('thumbHash: $thumbHash, ')
|
||||
..write('deletedAt: $deletedAt, ')
|
||||
..write('livePhotoVideoId: $livePhotoVideoId, ')
|
||||
..write('visibility: $visibility')
|
||||
..write(')'))
|
||||
.toString();
|
||||
|
||||
@@ -8,14 +8,16 @@ class UserMetadataEntity extends Table with DriftDefaultsMixin {
|
||||
|
||||
TextColumn get userId =>
|
||||
text().references(UserEntity, #id, onDelete: KeyAction.cascade)();
|
||||
TextColumn get preferences => text().map(userPreferenceConverter)();
|
||||
|
||||
IntColumn get key => intEnum<UserMetadataKey>()();
|
||||
|
||||
BlobColumn get value => blob().map(userMetadataConverter)();
|
||||
|
||||
@override
|
||||
Set<Column> get primaryKey => {userId};
|
||||
Set<Column> get primaryKey => {userId, key};
|
||||
}
|
||||
|
||||
final JsonTypeConverter2<UserPreferences, String, Object?>
|
||||
userPreferenceConverter = TypeConverter.json2(
|
||||
fromJson: (json) => UserPreferences.fromMap(json as Map<String, Object?>),
|
||||
toJson: (pref) => pref.toMap(),
|
||||
final JsonTypeConverter2<Map<String, Object?>, Uint8List, Object?>
|
||||
userMetadataConverter = TypeConverter.jsonb(
|
||||
fromJson: (json) => json as Map<String, Object?>,
|
||||
);
|
||||
|
||||
+148
-93
@@ -4,21 +4,24 @@ import 'package:drift/drift.dart' as i0;
|
||||
import 'package:immich_mobile/infrastructure/entities/user_metadata.entity.drift.dart'
|
||||
as i1;
|
||||
import 'package:immich_mobile/domain/models/user_metadata.model.dart' as i2;
|
||||
import 'dart:typed_data' as i3;
|
||||
import 'package:immich_mobile/infrastructure/entities/user_metadata.entity.dart'
|
||||
as i3;
|
||||
import 'package:immich_mobile/infrastructure/entities/user.entity.drift.dart'
|
||||
as i4;
|
||||
import 'package:drift/internal/modular.dart' as i5;
|
||||
import 'package:immich_mobile/infrastructure/entities/user.entity.drift.dart'
|
||||
as i5;
|
||||
import 'package:drift/internal/modular.dart' as i6;
|
||||
|
||||
typedef $$UserMetadataEntityTableCreateCompanionBuilder
|
||||
= i1.UserMetadataEntityCompanion Function({
|
||||
required String userId,
|
||||
required i2.UserPreferences preferences,
|
||||
required i2.UserMetadataKey key,
|
||||
required Map<String, Object?> value,
|
||||
});
|
||||
typedef $$UserMetadataEntityTableUpdateCompanionBuilder
|
||||
= i1.UserMetadataEntityCompanion Function({
|
||||
i0.Value<String> userId,
|
||||
i0.Value<i2.UserPreferences> preferences,
|
||||
i0.Value<i2.UserMetadataKey> key,
|
||||
i0.Value<Map<String, Object?>> value,
|
||||
});
|
||||
|
||||
final class $$UserMetadataEntityTableReferences extends i0.BaseReferences<
|
||||
@@ -28,26 +31,26 @@ final class $$UserMetadataEntityTableReferences extends i0.BaseReferences<
|
||||
$$UserMetadataEntityTableReferences(
|
||||
super.$_db, super.$_table, super.$_typedResult);
|
||||
|
||||
static i4.$UserEntityTable _userIdTable(i0.GeneratedDatabase db) =>
|
||||
i5.ReadDatabaseContainer(db)
|
||||
.resultSet<i4.$UserEntityTable>('user_entity')
|
||||
static i5.$UserEntityTable _userIdTable(i0.GeneratedDatabase db) =>
|
||||
i6.ReadDatabaseContainer(db)
|
||||
.resultSet<i5.$UserEntityTable>('user_entity')
|
||||
.createAlias(i0.$_aliasNameGenerator(
|
||||
i5.ReadDatabaseContainer(db)
|
||||
i6.ReadDatabaseContainer(db)
|
||||
.resultSet<i1.$UserMetadataEntityTable>(
|
||||
'user_metadata_entity')
|
||||
.userId,
|
||||
i5.ReadDatabaseContainer(db)
|
||||
.resultSet<i4.$UserEntityTable>('user_entity')
|
||||
i6.ReadDatabaseContainer(db)
|
||||
.resultSet<i5.$UserEntityTable>('user_entity')
|
||||
.id));
|
||||
|
||||
i4.$$UserEntityTableProcessedTableManager get userId {
|
||||
i5.$$UserEntityTableProcessedTableManager get userId {
|
||||
final $_column = $_itemColumn<String>('user_id')!;
|
||||
|
||||
final manager = i4
|
||||
final manager = i5
|
||||
.$$UserEntityTableTableManager(
|
||||
$_db,
|
||||
i5.ReadDatabaseContainer($_db)
|
||||
.resultSet<i4.$UserEntityTable>('user_entity'))
|
||||
i6.ReadDatabaseContainer($_db)
|
||||
.resultSet<i5.$UserEntityTable>('user_entity'))
|
||||
.filter((f) => f.id.sqlEquals($_column));
|
||||
final item = $_typedResult.readTableOrNull(_userIdTable($_db));
|
||||
if (item == null) return manager;
|
||||
@@ -65,26 +68,31 @@ class $$UserMetadataEntityTableFilterComposer
|
||||
super.$addJoinBuilderToRootComposer,
|
||||
super.$removeJoinBuilderFromRootComposer,
|
||||
});
|
||||
i0.ColumnWithTypeConverterFilters<i2.UserPreferences, i2.UserPreferences,
|
||||
String>
|
||||
get preferences => $composableBuilder(
|
||||
column: $table.preferences,
|
||||
i0.ColumnWithTypeConverterFilters<i2.UserMetadataKey, i2.UserMetadataKey, int>
|
||||
get key => $composableBuilder(
|
||||
column: $table.key,
|
||||
builder: (column) => i0.ColumnWithTypeConverterFilters(column));
|
||||
|
||||
i4.$$UserEntityTableFilterComposer get userId {
|
||||
final i4.$$UserEntityTableFilterComposer composer = $composerBuilder(
|
||||
i0.ColumnWithTypeConverterFilters<Map<String, Object?>, Map<String, Object>,
|
||||
i3.Uint8List>
|
||||
get value => $composableBuilder(
|
||||
column: $table.value,
|
||||
builder: (column) => i0.ColumnWithTypeConverterFilters(column));
|
||||
|
||||
i5.$$UserEntityTableFilterComposer get userId {
|
||||
final i5.$$UserEntityTableFilterComposer composer = $composerBuilder(
|
||||
composer: this,
|
||||
getCurrentColumn: (t) => t.userId,
|
||||
referencedTable: i5.ReadDatabaseContainer($db)
|
||||
.resultSet<i4.$UserEntityTable>('user_entity'),
|
||||
referencedTable: i6.ReadDatabaseContainer($db)
|
||||
.resultSet<i5.$UserEntityTable>('user_entity'),
|
||||
getReferencedColumn: (t) => t.id,
|
||||
builder: (joinBuilder,
|
||||
{$addJoinBuilderToRootComposer,
|
||||
$removeJoinBuilderFromRootComposer}) =>
|
||||
i4.$$UserEntityTableFilterComposer(
|
||||
i5.$$UserEntityTableFilterComposer(
|
||||
$db: $db,
|
||||
$table: i5.ReadDatabaseContainer($db)
|
||||
.resultSet<i4.$UserEntityTable>('user_entity'),
|
||||
$table: i6.ReadDatabaseContainer($db)
|
||||
.resultSet<i5.$UserEntityTable>('user_entity'),
|
||||
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
||||
joinBuilder: joinBuilder,
|
||||
$removeJoinBuilderFromRootComposer:
|
||||
@@ -103,24 +111,26 @@ class $$UserMetadataEntityTableOrderingComposer
|
||||
super.$addJoinBuilderToRootComposer,
|
||||
super.$removeJoinBuilderFromRootComposer,
|
||||
});
|
||||
i0.ColumnOrderings<String> get preferences => $composableBuilder(
|
||||
column: $table.preferences,
|
||||
builder: (column) => i0.ColumnOrderings(column));
|
||||
i0.ColumnOrderings<int> get key => $composableBuilder(
|
||||
column: $table.key, builder: (column) => i0.ColumnOrderings(column));
|
||||
|
||||
i4.$$UserEntityTableOrderingComposer get userId {
|
||||
final i4.$$UserEntityTableOrderingComposer composer = $composerBuilder(
|
||||
i0.ColumnOrderings<i3.Uint8List> get value => $composableBuilder(
|
||||
column: $table.value, builder: (column) => i0.ColumnOrderings(column));
|
||||
|
||||
i5.$$UserEntityTableOrderingComposer get userId {
|
||||
final i5.$$UserEntityTableOrderingComposer composer = $composerBuilder(
|
||||
composer: this,
|
||||
getCurrentColumn: (t) => t.userId,
|
||||
referencedTable: i5.ReadDatabaseContainer($db)
|
||||
.resultSet<i4.$UserEntityTable>('user_entity'),
|
||||
referencedTable: i6.ReadDatabaseContainer($db)
|
||||
.resultSet<i5.$UserEntityTable>('user_entity'),
|
||||
getReferencedColumn: (t) => t.id,
|
||||
builder: (joinBuilder,
|
||||
{$addJoinBuilderToRootComposer,
|
||||
$removeJoinBuilderFromRootComposer}) =>
|
||||
i4.$$UserEntityTableOrderingComposer(
|
||||
i5.$$UserEntityTableOrderingComposer(
|
||||
$db: $db,
|
||||
$table: i5.ReadDatabaseContainer($db)
|
||||
.resultSet<i4.$UserEntityTable>('user_entity'),
|
||||
$table: i6.ReadDatabaseContainer($db)
|
||||
.resultSet<i5.$UserEntityTable>('user_entity'),
|
||||
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
||||
joinBuilder: joinBuilder,
|
||||
$removeJoinBuilderFromRootComposer:
|
||||
@@ -139,24 +149,27 @@ class $$UserMetadataEntityTableAnnotationComposer
|
||||
super.$addJoinBuilderToRootComposer,
|
||||
super.$removeJoinBuilderFromRootComposer,
|
||||
});
|
||||
i0.GeneratedColumnWithTypeConverter<i2.UserPreferences, String>
|
||||
get preferences => $composableBuilder(
|
||||
column: $table.preferences, builder: (column) => column);
|
||||
i0.GeneratedColumnWithTypeConverter<i2.UserMetadataKey, int> get key =>
|
||||
$composableBuilder(column: $table.key, builder: (column) => column);
|
||||
|
||||
i4.$$UserEntityTableAnnotationComposer get userId {
|
||||
final i4.$$UserEntityTableAnnotationComposer composer = $composerBuilder(
|
||||
i0.GeneratedColumnWithTypeConverter<Map<String, Object?>, i3.Uint8List>
|
||||
get value =>
|
||||
$composableBuilder(column: $table.value, builder: (column) => column);
|
||||
|
||||
i5.$$UserEntityTableAnnotationComposer get userId {
|
||||
final i5.$$UserEntityTableAnnotationComposer composer = $composerBuilder(
|
||||
composer: this,
|
||||
getCurrentColumn: (t) => t.userId,
|
||||
referencedTable: i5.ReadDatabaseContainer($db)
|
||||
.resultSet<i4.$UserEntityTable>('user_entity'),
|
||||
referencedTable: i6.ReadDatabaseContainer($db)
|
||||
.resultSet<i5.$UserEntityTable>('user_entity'),
|
||||
getReferencedColumn: (t) => t.id,
|
||||
builder: (joinBuilder,
|
||||
{$addJoinBuilderToRootComposer,
|
||||
$removeJoinBuilderFromRootComposer}) =>
|
||||
i4.$$UserEntityTableAnnotationComposer(
|
||||
i5.$$UserEntityTableAnnotationComposer(
|
||||
$db: $db,
|
||||
$table: i5.ReadDatabaseContainer($db)
|
||||
.resultSet<i4.$UserEntityTable>('user_entity'),
|
||||
$table: i6.ReadDatabaseContainer($db)
|
||||
.resultSet<i5.$UserEntityTable>('user_entity'),
|
||||
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
||||
joinBuilder: joinBuilder,
|
||||
$removeJoinBuilderFromRootComposer:
|
||||
@@ -193,19 +206,23 @@ class $$UserMetadataEntityTableTableManager extends i0.RootTableManager<
|
||||
$db: db, $table: table),
|
||||
updateCompanionCallback: ({
|
||||
i0.Value<String> userId = const i0.Value.absent(),
|
||||
i0.Value<i2.UserPreferences> preferences = const i0.Value.absent(),
|
||||
i0.Value<i2.UserMetadataKey> key = const i0.Value.absent(),
|
||||
i0.Value<Map<String, Object?>> value = const i0.Value.absent(),
|
||||
}) =>
|
||||
i1.UserMetadataEntityCompanion(
|
||||
userId: userId,
|
||||
preferences: preferences,
|
||||
key: key,
|
||||
value: value,
|
||||
),
|
||||
createCompanionCallback: ({
|
||||
required String userId,
|
||||
required i2.UserPreferences preferences,
|
||||
required i2.UserMetadataKey key,
|
||||
required Map<String, Object?> value,
|
||||
}) =>
|
||||
i1.UserMetadataEntityCompanion.insert(
|
||||
userId: userId,
|
||||
preferences: preferences,
|
||||
key: key,
|
||||
value: value,
|
||||
),
|
||||
withReferenceMapper: (p0) => p0
|
||||
.map((e) => (
|
||||
@@ -266,7 +283,7 @@ typedef $$UserMetadataEntityTableProcessedTableManager
|
||||
i1.UserMetadataEntityData,
|
||||
i0.PrefetchHooks Function({bool userId})>;
|
||||
|
||||
class $UserMetadataEntityTable extends i3.UserMetadataEntity
|
||||
class $UserMetadataEntityTable extends i4.UserMetadataEntity
|
||||
with i0.TableInfo<$UserMetadataEntityTable, i1.UserMetadataEntityData> {
|
||||
@override
|
||||
final i0.GeneratedDatabase attachedDatabase;
|
||||
@@ -282,14 +299,20 @@ class $UserMetadataEntityTable extends i3.UserMetadataEntity
|
||||
defaultConstraints: i0.GeneratedColumn.constraintIsAlways(
|
||||
'REFERENCES user_entity (id) ON DELETE CASCADE'));
|
||||
@override
|
||||
late final i0.GeneratedColumnWithTypeConverter<i2.UserPreferences, String>
|
||||
preferences = i0.GeneratedColumn<String>(
|
||||
'preferences', aliasedName, false,
|
||||
type: i0.DriftSqlType.string, requiredDuringInsert: true)
|
||||
.withConverter<i2.UserPreferences>(
|
||||
i1.$UserMetadataEntityTable.$converterpreferences);
|
||||
late final i0.GeneratedColumnWithTypeConverter<i2.UserMetadataKey, int> key =
|
||||
i0.GeneratedColumn<int>('key', aliasedName, false,
|
||||
type: i0.DriftSqlType.int, requiredDuringInsert: true)
|
||||
.withConverter<i2.UserMetadataKey>(
|
||||
i1.$UserMetadataEntityTable.$converterkey);
|
||||
@override
|
||||
List<i0.GeneratedColumn> get $columns => [userId, preferences];
|
||||
late final i0
|
||||
.GeneratedColumnWithTypeConverter<Map<String, Object?>, i3.Uint8List>
|
||||
value = i0.GeneratedColumn<i3.Uint8List>('value', aliasedName, false,
|
||||
type: i0.DriftSqlType.blob, requiredDuringInsert: true)
|
||||
.withConverter<Map<String, Object?>>(
|
||||
i1.$UserMetadataEntityTable.$convertervalue);
|
||||
@override
|
||||
List<i0.GeneratedColumn> get $columns => [userId, key, value];
|
||||
@override
|
||||
String get aliasedName => _alias ?? actualTableName;
|
||||
@override
|
||||
@@ -311,7 +334,7 @@ class $UserMetadataEntityTable extends i3.UserMetadataEntity
|
||||
}
|
||||
|
||||
@override
|
||||
Set<i0.GeneratedColumn> get $primaryKey => {userId};
|
||||
Set<i0.GeneratedColumn> get $primaryKey => {userId, key};
|
||||
@override
|
||||
i1.UserMetadataEntityData map(Map<String, dynamic> data,
|
||||
{String? tablePrefix}) {
|
||||
@@ -319,9 +342,12 @@ class $UserMetadataEntityTable extends i3.UserMetadataEntity
|
||||
return i1.UserMetadataEntityData(
|
||||
userId: attachedDatabase.typeMapping
|
||||
.read(i0.DriftSqlType.string, data['${effectivePrefix}user_id'])!,
|
||||
preferences: i1.$UserMetadataEntityTable.$converterpreferences.fromSql(
|
||||
attachedDatabase.typeMapping.read(
|
||||
i0.DriftSqlType.string, data['${effectivePrefix}preferences'])!),
|
||||
key: i1.$UserMetadataEntityTable.$converterkey.fromSql(attachedDatabase
|
||||
.typeMapping
|
||||
.read(i0.DriftSqlType.int, data['${effectivePrefix}key'])!),
|
||||
value: i1.$UserMetadataEntityTable.$convertervalue.fromSql(
|
||||
attachedDatabase.typeMapping
|
||||
.read(i0.DriftSqlType.blob, data['${effectivePrefix}value'])!),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -330,8 +356,11 @@ class $UserMetadataEntityTable extends i3.UserMetadataEntity
|
||||
return $UserMetadataEntityTable(attachedDatabase, alias);
|
||||
}
|
||||
|
||||
static i0.JsonTypeConverter2<i2.UserPreferences, String, Object?>
|
||||
$converterpreferences = i3.userPreferenceConverter;
|
||||
static i0.JsonTypeConverter2<i2.UserMetadataKey, int, int> $converterkey =
|
||||
const i0.EnumIndexConverter<i2.UserMetadataKey>(
|
||||
i2.UserMetadataKey.values);
|
||||
static i0.JsonTypeConverter2<Map<String, Object?>, i3.Uint8List, Object?>
|
||||
$convertervalue = i4.userMetadataConverter;
|
||||
@override
|
||||
bool get withoutRowId => true;
|
||||
@override
|
||||
@@ -341,16 +370,21 @@ class $UserMetadataEntityTable extends i3.UserMetadataEntity
|
||||
class UserMetadataEntityData extends i0.DataClass
|
||||
implements i0.Insertable<i1.UserMetadataEntityData> {
|
||||
final String userId;
|
||||
final i2.UserPreferences preferences;
|
||||
final i2.UserMetadataKey key;
|
||||
final Map<String, Object?> value;
|
||||
const UserMetadataEntityData(
|
||||
{required this.userId, required this.preferences});
|
||||
{required this.userId, required this.key, required this.value});
|
||||
@override
|
||||
Map<String, i0.Expression> toColumns(bool nullToAbsent) {
|
||||
final map = <String, i0.Expression>{};
|
||||
map['user_id'] = i0.Variable<String>(userId);
|
||||
{
|
||||
map['preferences'] = i0.Variable<String>(
|
||||
i1.$UserMetadataEntityTable.$converterpreferences.toSql(preferences));
|
||||
map['key'] = i0.Variable<int>(
|
||||
i1.$UserMetadataEntityTable.$converterkey.toSql(key));
|
||||
}
|
||||
{
|
||||
map['value'] = i0.Variable<i3.Uint8List>(
|
||||
i1.$UserMetadataEntityTable.$convertervalue.toSql(value));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
@@ -360,8 +394,10 @@ class UserMetadataEntityData extends i0.DataClass
|
||||
serializer ??= i0.driftRuntimeOptions.defaultSerializer;
|
||||
return UserMetadataEntityData(
|
||||
userId: serializer.fromJson<String>(json['userId']),
|
||||
preferences: i1.$UserMetadataEntityTable.$converterpreferences
|
||||
.fromJson(serializer.fromJson<Object?>(json['preferences'])),
|
||||
key: i1.$UserMetadataEntityTable.$converterkey
|
||||
.fromJson(serializer.fromJson<int>(json['key'])),
|
||||
value: i1.$UserMetadataEntityTable.$convertervalue
|
||||
.fromJson(serializer.fromJson<Object?>(json['value'])),
|
||||
);
|
||||
}
|
||||
@override
|
||||
@@ -369,24 +405,28 @@ class UserMetadataEntityData extends i0.DataClass
|
||||
serializer ??= i0.driftRuntimeOptions.defaultSerializer;
|
||||
return <String, dynamic>{
|
||||
'userId': serializer.toJson<String>(userId),
|
||||
'preferences': serializer.toJson<Object?>(i1
|
||||
.$UserMetadataEntityTable.$converterpreferences
|
||||
.toJson(preferences)),
|
||||
'key': serializer
|
||||
.toJson<int>(i1.$UserMetadataEntityTable.$converterkey.toJson(key)),
|
||||
'value': serializer.toJson<Object?>(
|
||||
i1.$UserMetadataEntityTable.$convertervalue.toJson(value)),
|
||||
};
|
||||
}
|
||||
|
||||
i1.UserMetadataEntityData copyWith(
|
||||
{String? userId, i2.UserPreferences? preferences}) =>
|
||||
{String? userId,
|
||||
i2.UserMetadataKey? key,
|
||||
Map<String, Object?>? value}) =>
|
||||
i1.UserMetadataEntityData(
|
||||
userId: userId ?? this.userId,
|
||||
preferences: preferences ?? this.preferences,
|
||||
key: key ?? this.key,
|
||||
value: value ?? this.value,
|
||||
);
|
||||
UserMetadataEntityData copyWithCompanion(
|
||||
i1.UserMetadataEntityCompanion data) {
|
||||
return UserMetadataEntityData(
|
||||
userId: data.userId.present ? data.userId.value : this.userId,
|
||||
preferences:
|
||||
data.preferences.present ? data.preferences.value : this.preferences,
|
||||
key: data.key.present ? data.key.value : this.key,
|
||||
value: data.value.present ? data.value.value : this.value,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -394,49 +434,60 @@ class UserMetadataEntityData extends i0.DataClass
|
||||
String toString() {
|
||||
return (StringBuffer('UserMetadataEntityData(')
|
||||
..write('userId: $userId, ')
|
||||
..write('preferences: $preferences')
|
||||
..write('key: $key, ')
|
||||
..write('value: $value')
|
||||
..write(')'))
|
||||
.toString();
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(userId, preferences);
|
||||
int get hashCode => Object.hash(userId, key, value);
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
(other is i1.UserMetadataEntityData &&
|
||||
other.userId == this.userId &&
|
||||
other.preferences == this.preferences);
|
||||
other.key == this.key &&
|
||||
other.value == this.value);
|
||||
}
|
||||
|
||||
class UserMetadataEntityCompanion
|
||||
extends i0.UpdateCompanion<i1.UserMetadataEntityData> {
|
||||
final i0.Value<String> userId;
|
||||
final i0.Value<i2.UserPreferences> preferences;
|
||||
final i0.Value<i2.UserMetadataKey> key;
|
||||
final i0.Value<Map<String, Object?>> value;
|
||||
const UserMetadataEntityCompanion({
|
||||
this.userId = const i0.Value.absent(),
|
||||
this.preferences = const i0.Value.absent(),
|
||||
this.key = const i0.Value.absent(),
|
||||
this.value = const i0.Value.absent(),
|
||||
});
|
||||
UserMetadataEntityCompanion.insert({
|
||||
required String userId,
|
||||
required i2.UserPreferences preferences,
|
||||
required i2.UserMetadataKey key,
|
||||
required Map<String, Object?> value,
|
||||
}) : userId = i0.Value(userId),
|
||||
preferences = i0.Value(preferences);
|
||||
key = i0.Value(key),
|
||||
value = i0.Value(value);
|
||||
static i0.Insertable<i1.UserMetadataEntityData> custom({
|
||||
i0.Expression<String>? userId,
|
||||
i0.Expression<String>? preferences,
|
||||
i0.Expression<int>? key,
|
||||
i0.Expression<i3.Uint8List>? value,
|
||||
}) {
|
||||
return i0.RawValuesInsertable({
|
||||
if (userId != null) 'user_id': userId,
|
||||
if (preferences != null) 'preferences': preferences,
|
||||
if (key != null) 'key': key,
|
||||
if (value != null) 'value': value,
|
||||
});
|
||||
}
|
||||
|
||||
i1.UserMetadataEntityCompanion copyWith(
|
||||
{i0.Value<String>? userId, i0.Value<i2.UserPreferences>? preferences}) {
|
||||
{i0.Value<String>? userId,
|
||||
i0.Value<i2.UserMetadataKey>? key,
|
||||
i0.Value<Map<String, Object?>>? value}) {
|
||||
return i1.UserMetadataEntityCompanion(
|
||||
userId: userId ?? this.userId,
|
||||
preferences: preferences ?? this.preferences,
|
||||
key: key ?? this.key,
|
||||
value: value ?? this.value,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -446,10 +497,13 @@ class UserMetadataEntityCompanion
|
||||
if (userId.present) {
|
||||
map['user_id'] = i0.Variable<String>(userId.value);
|
||||
}
|
||||
if (preferences.present) {
|
||||
map['preferences'] = i0.Variable<String>(i1
|
||||
.$UserMetadataEntityTable.$converterpreferences
|
||||
.toSql(preferences.value));
|
||||
if (key.present) {
|
||||
map['key'] = i0.Variable<int>(
|
||||
i1.$UserMetadataEntityTable.$converterkey.toSql(key.value));
|
||||
}
|
||||
if (value.present) {
|
||||
map['value'] = i0.Variable<i3.Uint8List>(
|
||||
i1.$UserMetadataEntityTable.$convertervalue.toSql(value.value));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
@@ -458,7 +512,8 @@ class UserMetadataEntityCompanion
|
||||
String toString() {
|
||||
return (StringBuffer('UserMetadataEntityCompanion(')
|
||||
..write('userId: $userId, ')
|
||||
..write('preferences: $preferences')
|
||||
..write('key: $key, ')
|
||||
..write('value: $value')
|
||||
..write(')'))
|
||||
.toString();
|
||||
}
|
||||
|
||||
@@ -56,6 +56,42 @@ class RemoteAssetRepository extends DriftDatabaseRepository {
|
||||
.getSingleOrNull();
|
||||
}
|
||||
|
||||
Future<List<(String, String)>> getPlaces() {
|
||||
final asset = Subquery(
|
||||
_db.remoteAssetEntity.select()
|
||||
..orderBy([(row) => OrderingTerm.desc(row.createdAt)]),
|
||||
"asset",
|
||||
);
|
||||
|
||||
final query = asset.selectOnly().join([
|
||||
innerJoin(
|
||||
_db.remoteExifEntity,
|
||||
_db.remoteExifEntity.assetId
|
||||
.equalsExp(asset.ref(_db.remoteAssetEntity.id)),
|
||||
useColumns: false,
|
||||
),
|
||||
])
|
||||
..addColumns([
|
||||
_db.remoteExifEntity.city,
|
||||
_db.remoteExifEntity.assetId,
|
||||
])
|
||||
..where(
|
||||
_db.remoteExifEntity.city.isNotNull() &
|
||||
asset.ref(_db.remoteAssetEntity.deletedAt).isNull() &
|
||||
asset
|
||||
.ref(_db.remoteAssetEntity.visibility)
|
||||
.equals(AssetVisibility.timeline.index),
|
||||
)
|
||||
..groupBy([_db.remoteExifEntity.city])
|
||||
..orderBy([OrderingTerm.asc(_db.remoteExifEntity.city)]);
|
||||
|
||||
return query.map((row) {
|
||||
final assetId = row.read(_db.remoteExifEntity.assetId);
|
||||
final city = row.read(_db.remoteExifEntity.city);
|
||||
return (city!, assetId!);
|
||||
}).get();
|
||||
}
|
||||
|
||||
Future<void> updateFavorite(List<String> ids, bool isFavorite) {
|
||||
return _db.batch((batch) async {
|
||||
for (final id in ids) {
|
||||
|
||||
@@ -56,6 +56,7 @@ class SyncApiRepository {
|
||||
SyncRequestType.memoryToAssetsV1,
|
||||
SyncRequestType.stacksV1,
|
||||
SyncRequestType.partnerStacksV1,
|
||||
SyncRequestType.userMetadataV1,
|
||||
],
|
||||
).toJson(),
|
||||
);
|
||||
@@ -170,6 +171,8 @@ const _kResponseMap = <SyncEntityType, Function(Object)>{
|
||||
SyncEntityType.partnerStackV1: SyncStackV1.fromJson,
|
||||
SyncEntityType.partnerStackBackfillV1: SyncStackV1.fromJson,
|
||||
SyncEntityType.partnerStackDeleteV1: SyncStackDeleteV1.fromJson,
|
||||
SyncEntityType.userMetadataV1: SyncUserMetadataV1.fromJson,
|
||||
SyncEntityType.userMetadataDeleteV1: SyncUserMetadataDeleteV1.fromJson,
|
||||
};
|
||||
|
||||
class _SyncAckV1 {
|
||||
|
||||
@@ -4,16 +4,18 @@ import 'package:drift/drift.dart';
|
||||
import 'package:immich_mobile/domain/models/album/album.model.dart';
|
||||
import 'package:immich_mobile/domain/models/asset/base_asset.model.dart';
|
||||
import 'package:immich_mobile/domain/models/memory.model.dart';
|
||||
import 'package:immich_mobile/domain/models/user_metadata.model.dart';
|
||||
import 'package:immich_mobile/infrastructure/entities/exif.entity.drift.dart';
|
||||
import 'package:immich_mobile/infrastructure/entities/memory.entity.drift.dart';
|
||||
import 'package:immich_mobile/infrastructure/entities/memory_asset.entity.drift.dart';
|
||||
import 'package:immich_mobile/infrastructure/entities/partner.entity.drift.dart';
|
||||
import 'package:immich_mobile/infrastructure/entities/remote_album.entity.drift.dart';
|
||||
import 'package:immich_mobile/infrastructure/entities/remote_album_asset.entity.drift.dart';
|
||||
import 'package:immich_mobile/infrastructure/entities/remote_album_user.entity.drift.dart';
|
||||
import 'package:immich_mobile/infrastructure/entities/remote_asset.entity.drift.dart';
|
||||
import 'package:immich_mobile/infrastructure/entities/memory.entity.drift.dart';
|
||||
import 'package:immich_mobile/infrastructure/entities/stack.entity.drift.dart';
|
||||
import 'package:immich_mobile/infrastructure/entities/user.entity.drift.dart';
|
||||
import 'package:immich_mobile/infrastructure/entities/user_metadata.entity.drift.dart';
|
||||
import 'package:immich_mobile/infrastructure/repositories/db.repository.dart';
|
||||
import 'package:logging/logging.dart';
|
||||
import 'package:openapi/api.dart' as api show AssetVisibility, AlbumUserRole;
|
||||
@@ -134,6 +136,7 @@ class SyncStreamRepository extends DriftDatabaseRepository {
|
||||
thumbHash: Value(asset.thumbhash),
|
||||
deletedAt: Value(asset.deletedAt),
|
||||
visibility: Value(asset.visibility.toAssetVisibility()),
|
||||
livePhotoVideoId: Value(asset.livePhotoVideoId),
|
||||
);
|
||||
|
||||
batch.insert(
|
||||
@@ -460,6 +463,53 @@ class SyncStreamRepository extends DriftDatabaseRepository {
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> updateUserMetadatasV1(
|
||||
Iterable<SyncUserMetadataV1> data,
|
||||
) async {
|
||||
try {
|
||||
await _db.batch((batch) {
|
||||
for (final userMetadata in data) {
|
||||
final companion = UserMetadataEntityCompanion(
|
||||
value: Value(userMetadata.value as Map<String, Object?>),
|
||||
);
|
||||
|
||||
batch.insert(
|
||||
_db.userMetadataEntity,
|
||||
companion.copyWith(
|
||||
userId: Value(userMetadata.userId),
|
||||
key: Value(userMetadata.key.toUserMetadataKey()),
|
||||
),
|
||||
onConflict: DoUpdate((_) => companion),
|
||||
);
|
||||
}
|
||||
});
|
||||
} catch (error, stack) {
|
||||
_logger.severe('Error: deleteUserMetadatasV1', error, stack);
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> deleteUserMetadatasV1(
|
||||
Iterable<SyncUserMetadataDeleteV1> data,
|
||||
) async {
|
||||
try {
|
||||
await _db.batch((batch) {
|
||||
for (final userMetadata in data) {
|
||||
batch.delete(
|
||||
_db.userMetadataEntity,
|
||||
UserMetadataEntityCompanion(
|
||||
userId: Value(userMetadata.userId),
|
||||
key: Value(userMetadata.key.toUserMetadataKey()),
|
||||
),
|
||||
);
|
||||
}
|
||||
});
|
||||
} catch (error, stack) {
|
||||
_logger.severe('Error: deleteUserMetadatasV1', error, stack);
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension on AssetTypeEnum {
|
||||
@@ -505,6 +555,15 @@ extension on api.AssetVisibility {
|
||||
};
|
||||
}
|
||||
|
||||
extension on String {
|
||||
UserMetadataKey toUserMetadataKey() => switch (this) {
|
||||
"onboarding" => UserMetadataKey.onboarding,
|
||||
"preferences" => UserMetadataKey.preferences,
|
||||
"license" => UserMetadataKey.license,
|
||||
_ => throw Exception('Unknown UserMetadataKey value: $this'),
|
||||
};
|
||||
}
|
||||
|
||||
extension on String {
|
||||
Duration? toDuration() {
|
||||
try {
|
||||
|
||||
@@ -87,6 +87,7 @@ class DriftTimelineRepository extends DriftDatabaseRepository {
|
||||
height: row.height,
|
||||
isFavorite: row.isFavorite,
|
||||
durationInSeconds: row.durationInSeconds,
|
||||
livePhotoVideoId: row.livePhotoVideoId,
|
||||
)
|
||||
: LocalAsset(
|
||||
id: row.localId!,
|
||||
@@ -302,6 +303,84 @@ class DriftTimelineRepository extends DriftDatabaseRepository {
|
||||
groupBy: groupBy,
|
||||
);
|
||||
|
||||
TimelineQuery place(String place, GroupAssetsBy groupBy) => (
|
||||
bucketSource: () => _watchPlaceBucket(
|
||||
place,
|
||||
groupBy: groupBy,
|
||||
),
|
||||
assetSource: (offset, count) => _getPlaceBucketAssets(
|
||||
place,
|
||||
offset: offset,
|
||||
count: count,
|
||||
),
|
||||
);
|
||||
|
||||
Stream<List<Bucket>> _watchPlaceBucket(
|
||||
String place, {
|
||||
GroupAssetsBy groupBy = GroupAssetsBy.day,
|
||||
}) {
|
||||
if (groupBy == GroupAssetsBy.none) {
|
||||
// TODO: implement GroupAssetBy for place
|
||||
throw UnsupportedError(
|
||||
"GroupAssetsBy.none is not supported for watchPlaceBucket",
|
||||
);
|
||||
}
|
||||
|
||||
final assetCountExp = _db.remoteAssetEntity.id.count();
|
||||
final dateExp = _db.remoteAssetEntity.createdAt.dateFmt(groupBy);
|
||||
|
||||
final query = _db.remoteAssetEntity.selectOnly()
|
||||
..addColumns([assetCountExp, dateExp])
|
||||
..join([
|
||||
innerJoin(
|
||||
_db.remoteExifEntity,
|
||||
_db.remoteExifEntity.assetId.equalsExp(_db.remoteAssetEntity.id),
|
||||
useColumns: false,
|
||||
),
|
||||
])
|
||||
..where(
|
||||
_db.remoteExifEntity.city.equals(place) &
|
||||
_db.remoteAssetEntity.deletedAt.isNull() &
|
||||
_db.remoteAssetEntity.visibility
|
||||
.equalsValue(AssetVisibility.timeline),
|
||||
)
|
||||
..groupBy([dateExp])
|
||||
..orderBy([OrderingTerm.desc(dateExp)]);
|
||||
|
||||
return query.map((row) {
|
||||
final timeline = row.read(dateExp)!.dateFmt(groupBy);
|
||||
final assetCount = row.read(assetCountExp)!;
|
||||
return TimeBucket(date: timeline, assetCount: assetCount);
|
||||
}).watch();
|
||||
}
|
||||
|
||||
Future<List<BaseAsset>> _getPlaceBucketAssets(
|
||||
String place, {
|
||||
required int offset,
|
||||
required int count,
|
||||
}) {
|
||||
final query = _db.remoteAssetEntity.select().join(
|
||||
[
|
||||
innerJoin(
|
||||
_db.remoteExifEntity,
|
||||
_db.remoteExifEntity.assetId.equalsExp(_db.remoteAssetEntity.id),
|
||||
useColumns: false,
|
||||
),
|
||||
],
|
||||
)
|
||||
..where(
|
||||
_db.remoteAssetEntity.deletedAt.isNull() &
|
||||
_db.remoteAssetEntity.visibility
|
||||
.equalsValue(AssetVisibility.timeline) &
|
||||
_db.remoteExifEntity.city.equals(place),
|
||||
)
|
||||
..orderBy([OrderingTerm.desc(_db.remoteAssetEntity.createdAt)])
|
||||
..limit(count, offset: offset);
|
||||
return query
|
||||
.map((row) => row.readTable(_db.remoteAssetEntity).toDto())
|
||||
.get();
|
||||
}
|
||||
|
||||
TimelineQuery _remoteQueryBuilder({
|
||||
required Expression<bool> Function($RemoteAssetEntityTable row) filter,
|
||||
GroupAssetsBy groupBy = GroupAssetsBy.day,
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
import 'package:drift/drift.dart';
|
||||
import 'package:immich_mobile/domain/models/user_metadata.model.dart';
|
||||
import 'package:immich_mobile/infrastructure/entities/user_metadata.entity.drift.dart';
|
||||
import 'package:immich_mobile/infrastructure/repositories/db.repository.dart';
|
||||
|
||||
class DriftUserMetadataRepository extends DriftDatabaseRepository {
|
||||
final Drift _db;
|
||||
const DriftUserMetadataRepository(this._db) : super(_db);
|
||||
|
||||
Future<List<UserMetadata>> getUserMetadata(String userId) {
|
||||
final query = _db.userMetadataEntity.select()
|
||||
..where((e) => e.userId.equals(userId));
|
||||
|
||||
return query.map((userMetadata) {
|
||||
return userMetadata.toDto();
|
||||
}).get();
|
||||
}
|
||||
}
|
||||
|
||||
extension on UserMetadataEntityData {
|
||||
UserMetadata toDto() => switch (key) {
|
||||
UserMetadataKey.onboarding => UserMetadata(
|
||||
userId: userId,
|
||||
key: key,
|
||||
onboarding: Onboarding.fromMap(value),
|
||||
),
|
||||
UserMetadataKey.preferences => UserMetadata(
|
||||
userId: userId,
|
||||
key: key,
|
||||
preferences: Preferences.fromMap(value),
|
||||
),
|
||||
UserMetadataKey.license => UserMetadata(
|
||||
userId: userId,
|
||||
key: key,
|
||||
license: License.fromMap(value),
|
||||
),
|
||||
};
|
||||
}
|
||||
@@ -256,9 +256,7 @@ class _PlacesCollectionCard extends StatelessWidget {
|
||||
|
||||
return GestureDetector(
|
||||
onTap: () => context.pushRoute(
|
||||
PlacesCollectionRoute(
|
||||
currentLocation: null,
|
||||
),
|
||||
DriftPlaceRoute(currentLocation: null),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
|
||||
@@ -0,0 +1,190 @@
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:immich_mobile/extensions/build_context_extensions.dart';
|
||||
import 'package:immich_mobile/extensions/translate_extensions.dart';
|
||||
import 'package:immich_mobile/pages/common/large_leading_tile.dart';
|
||||
import 'package:immich_mobile/presentation/widgets/images/thumbnail.widget.dart';
|
||||
import 'package:immich_mobile/providers/infrastructure/asset.provider.dart';
|
||||
import 'package:immich_mobile/routing/router.dart';
|
||||
import 'package:immich_mobile/widgets/common/search_field.dart';
|
||||
import 'package:immich_mobile/widgets/map/map_thumbnail.dart';
|
||||
import 'package:maplibre_gl/maplibre_gl.dart';
|
||||
|
||||
@RoutePage()
|
||||
class DriftPlacePage extends StatelessWidget {
|
||||
const DriftPlacePage({super.key, this.currentLocation});
|
||||
|
||||
final LatLng? currentLocation;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final ValueNotifier<String?> search = ValueNotifier(null);
|
||||
|
||||
return Scaffold(
|
||||
body: CustomScrollView(
|
||||
slivers: [
|
||||
_PlaceSliverAppBar(search: search),
|
||||
_Map(search: search, currentLocation: currentLocation),
|
||||
_PlaceList(search: search),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _PlaceSliverAppBar extends StatelessWidget {
|
||||
const _PlaceSliverAppBar({required this.search});
|
||||
|
||||
final ValueNotifier<String?> search;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final searchFocusNode = FocusNode();
|
||||
|
||||
return SliverAppBar(
|
||||
floating: true,
|
||||
pinned: true,
|
||||
snap: false,
|
||||
backgroundColor: context.colorScheme.surfaceContainer,
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(5)),
|
||||
),
|
||||
automaticallyImplyLeading: search.value == null,
|
||||
centerTitle: true,
|
||||
title: search.value != null
|
||||
? SearchField(
|
||||
focusNode: searchFocusNode,
|
||||
onTapOutside: (_) => searchFocusNode.unfocus(),
|
||||
onChanged: (value) => search.value = value,
|
||||
filled: true,
|
||||
hintText: 'filter_places'.t(context: context),
|
||||
autofocus: true,
|
||||
)
|
||||
: Text('places'.t(context: context)),
|
||||
actions: [
|
||||
IconButton(
|
||||
icon: Icon(search.value != null ? Icons.close : Icons.search),
|
||||
onPressed: () {
|
||||
search.value = search.value == null ? '' : null;
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _Map extends StatelessWidget {
|
||||
const _Map({required this.search, this.currentLocation});
|
||||
|
||||
final ValueNotifier<String?> search;
|
||||
final LatLng? currentLocation;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return search.value == null
|
||||
? SliverPadding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
sliver: SliverToBoxAdapter(
|
||||
child: SizedBox(
|
||||
height: 200,
|
||||
width: context.width,
|
||||
// TODO: migrate to DriftMapRoute after merging #19898
|
||||
child: MapThumbnail(
|
||||
onTap: (_, __) => context
|
||||
.pushRoute(MapRoute(initialLocation: currentLocation)),
|
||||
zoom: 8,
|
||||
centre: currentLocation ??
|
||||
const LatLng(
|
||||
21.44950,
|
||||
-157.91959,
|
||||
),
|
||||
showAttribution: false,
|
||||
themeMode:
|
||||
context.isDarkTheme ? ThemeMode.dark : ThemeMode.light,
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
: const SizedBox.shrink();
|
||||
}
|
||||
}
|
||||
|
||||
class _PlaceList extends ConsumerWidget {
|
||||
const _PlaceList({required this.search});
|
||||
|
||||
final ValueNotifier<String?> search;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final places = ref.watch(placesProvider);
|
||||
|
||||
return places.when(
|
||||
loading: () => const SliverToBoxAdapter(
|
||||
child: Center(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(20.0),
|
||||
child: CircularProgressIndicator(),
|
||||
),
|
||||
),
|
||||
),
|
||||
error: (error, stack) => SliverToBoxAdapter(
|
||||
child: Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(20.0),
|
||||
child: Text(
|
||||
'Error loading places: $error, stack: $stack',
|
||||
style: TextStyle(
|
||||
color: context.colorScheme.error,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
data: (places) {
|
||||
if (search.value != null) {
|
||||
places = places.where((place) {
|
||||
return place.$1.toLowerCase().contains(search.value!.toLowerCase());
|
||||
}).toList();
|
||||
}
|
||||
|
||||
return SliverList.builder(
|
||||
itemCount: places.length,
|
||||
itemBuilder: (context, index) {
|
||||
final place = places[index];
|
||||
return _PlaceTile(place: place);
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _PlaceTile extends StatelessWidget {
|
||||
const _PlaceTile({required this.place});
|
||||
|
||||
final (String, String) place;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return LargeLeadingTile(
|
||||
onTap: () => context.pushRoute(DriftPlaceDetailRoute(place: place.$1)),
|
||||
title: Text(
|
||||
place.$1,
|
||||
style: context.textTheme.titleMedium?.copyWith(
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
leading: ClipRRect(
|
||||
borderRadius: const BorderRadius.all(
|
||||
Radius.circular(20),
|
||||
),
|
||||
child: Thumbnail(
|
||||
size: const Size(80, 80),
|
||||
fit: BoxFit.cover,
|
||||
remoteId: place.$2,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:immich_mobile/presentation/widgets/timeline/timeline.widget.dart';
|
||||
import 'package:immich_mobile/providers/infrastructure/timeline.provider.dart';
|
||||
import 'package:immich_mobile/widgets/common/mesmerizing_sliver_app_bar.dart';
|
||||
|
||||
@RoutePage()
|
||||
class DriftPlaceDetailPage extends StatelessWidget {
|
||||
final String place;
|
||||
|
||||
const DriftPlaceDetailPage({
|
||||
super.key,
|
||||
required this.place,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ProviderScope(
|
||||
overrides: [
|
||||
timelineServiceProvider.overrideWith(
|
||||
(ref) {
|
||||
final timelineService =
|
||||
ref.watch(timelineFactoryProvider).place(place);
|
||||
ref.onDispose(timelineService.dispose);
|
||||
return timelineService;
|
||||
},
|
||||
),
|
||||
],
|
||||
child: Timeline(
|
||||
appBar: MesmerizingSliverAppBar(
|
||||
title: place,
|
||||
icon: Icons.location_on,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.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/asset_viewer/is_motion_video_playing.provider.dart';
|
||||
|
||||
class MotionPhotoActionButton extends ConsumerWidget {
|
||||
const MotionPhotoActionButton({super.key, this.menuItem = true});
|
||||
|
||||
final bool menuItem;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final isPlaying = ref.watch(isPlayingMotionVideoProvider);
|
||||
|
||||
return BaseActionButton(
|
||||
iconData: isPlaying
|
||||
? Icons.motion_photos_pause_outlined
|
||||
: Icons.play_circle_outline_rounded,
|
||||
label: "play_motion_photo".t(context: context),
|
||||
onPressed: ref.read(isPlayingMotionVideoProvider.notifier).toggle,
|
||||
menuItem: menuItem,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,7 @@ import 'package:immich_mobile/presentation/widgets/asset_viewer/top_app_bar.widg
|
||||
import 'package:immich_mobile/presentation/widgets/asset_viewer/video_viewer.widget.dart';
|
||||
import 'package:immich_mobile/presentation/widgets/images/image_provider.dart';
|
||||
import 'package:immich_mobile/presentation/widgets/images/thumbnail.widget.dart';
|
||||
import 'package:immich_mobile/providers/asset_viewer/is_motion_video_playing.provider.dart';
|
||||
import 'package:immich_mobile/providers/asset_viewer/video_player_controls_provider.dart';
|
||||
import 'package:immich_mobile/providers/asset_viewer/video_player_value_provider.dart';
|
||||
import 'package:immich_mobile/providers/infrastructure/asset_viewer/current_asset.provider.dart';
|
||||
@@ -165,7 +166,7 @@ class _AssetViewerState extends ConsumerState<AssetViewer> {
|
||||
void _onAssetChanged(int index) {
|
||||
final asset = ref.read(timelineServiceProvider).getAsset(index);
|
||||
ref.read(currentAssetNotifier.notifier).setAsset(asset);
|
||||
if (asset.isVideo) {
|
||||
if (asset.isVideo || asset.isMotionPhoto) {
|
||||
ref.read(videoPlaybackValueProvider.notifier).reset();
|
||||
ref.read(videoPlayerControlsProvider.notifier).pause();
|
||||
}
|
||||
@@ -473,11 +474,16 @@ class _AssetViewerState extends ConsumerState<AssetViewer> {
|
||||
}
|
||||
}
|
||||
|
||||
void _onLongPress(_, __, ___) {
|
||||
ref.read(isPlayingMotionVideoProvider.notifier).playing = true;
|
||||
}
|
||||
|
||||
PhotoViewGalleryPageOptions _assetBuilder(BuildContext ctx, int index) {
|
||||
scaffoldContext ??= ctx;
|
||||
final asset = ref.read(timelineServiceProvider).getAsset(index);
|
||||
final isPlayingMotionVideo = ref.read(isPlayingMotionVideoProvider);
|
||||
|
||||
if (asset.isImage) {
|
||||
if (asset.isImage && !isPlayingMotionVideo) {
|
||||
return _imageBuilder(ctx, asset);
|
||||
}
|
||||
|
||||
@@ -500,6 +506,7 @@ class _AssetViewerState extends ConsumerState<AssetViewer> {
|
||||
onDragUpdate: _onDragUpdate,
|
||||
onDragEnd: _onDragEnd,
|
||||
onTapDown: _onTapDown,
|
||||
onLongPressStart: asset.isMotionPhoto ? _onLongPress : null,
|
||||
errorBuilder: (_, __, ___) => Container(
|
||||
width: ctx.width,
|
||||
height: ctx.height,
|
||||
@@ -561,6 +568,7 @@ class _AssetViewerState extends ConsumerState<AssetViewer> {
|
||||
// Using multiple selectors to avoid unnecessary rebuilds for other state changes
|
||||
ref.watch(assetViewerProvider.select((s) => s.showingBottomSheet));
|
||||
ref.watch(assetViewerProvider.select((s) => s.backgroundOpacity));
|
||||
ref.watch(isPlayingMotionVideoProvider);
|
||||
|
||||
// Currently it is not possible to scroll the asset when the bottom sheet is open all the way.
|
||||
// Issue: https://github.com/flutter/flutter/issues/109037
|
||||
|
||||
@@ -6,6 +6,7 @@ import 'package:immich_mobile/domain/models/asset/base_asset.model.dart';
|
||||
import 'package:immich_mobile/domain/utils/event_stream.dart';
|
||||
import 'package:immich_mobile/extensions/build_context_extensions.dart';
|
||||
import 'package:immich_mobile/presentation/widgets/action_buttons/favorite_action_button.widget.dart';
|
||||
import 'package:immich_mobile/presentation/widgets/action_buttons/motion_photo_action_button.widget.dart';
|
||||
import 'package:immich_mobile/presentation/widgets/action_buttons/unfavorite_action_button.widget.dart';
|
||||
import 'package:immich_mobile/presentation/widgets/asset_viewer/asset_viewer.state.dart';
|
||||
import 'package:immich_mobile/providers/infrastructure/asset_viewer/current_asset.provider.dart';
|
||||
@@ -44,6 +45,7 @@ class ViewerTopAppBar extends ConsumerWidget implements PreferredSizeWidget {
|
||||
source: ActionSource.viewer,
|
||||
menuItem: true,
|
||||
),
|
||||
if (asset.isMotionPhoto) const MotionPhotoActionButton(menuItem: true),
|
||||
const _KebabMenu(),
|
||||
];
|
||||
|
||||
|
||||
@@ -270,10 +270,7 @@ class NativeVideoViewer extends HookConsumerWidget {
|
||||
return;
|
||||
}
|
||||
|
||||
if (videoController.playbackInfo?.status == PlaybackStatus.stopped &&
|
||||
!ref
|
||||
.read(appSettingsServiceProvider)
|
||||
.getSetting<bool>(AppSettingsEnum.loopVideo)) {
|
||||
if (videoController.playbackInfo?.status == PlaybackStatus.stopped) {
|
||||
ref.read(isPlayingMotionVideoProvider.notifier).playing = false;
|
||||
}
|
||||
}
|
||||
@@ -310,7 +307,7 @@ class NativeVideoViewer extends HookConsumerWidget {
|
||||
final loopVideo = ref
|
||||
.read(appSettingsServiceProvider)
|
||||
.getSetting<bool>(AppSettingsEnum.loopVideo);
|
||||
nc.setLoop(loopVideo);
|
||||
nc.setLoop(!asset.isMotionPhoto && loopVideo);
|
||||
|
||||
controller.value = nc;
|
||||
Timer(const Duration(milliseconds: 200), checkIfBuffering);
|
||||
|
||||
@@ -10,6 +10,7 @@ import 'package:immich_mobile/presentation/widgets/timeline/header.widget.dart';
|
||||
import 'package:immich_mobile/presentation/widgets/timeline/segment.model.dart';
|
||||
import 'package:immich_mobile/presentation/widgets/timeline/segment_builder.dart';
|
||||
import 'package:immich_mobile/presentation/widgets/timeline/timeline.state.dart';
|
||||
import 'package:immich_mobile/providers/asset_viewer/is_motion_video_playing.provider.dart';
|
||||
import 'package:immich_mobile/providers/haptic_feedback.provider.dart';
|
||||
import 'package:immich_mobile/providers/infrastructure/timeline.provider.dart';
|
||||
import 'package:immich_mobile/providers/timeline/multiselect.provider.dart';
|
||||
@@ -171,6 +172,7 @@ class _AssetTileWidget extends ConsumerWidget {
|
||||
ref.read(multiSelectProvider.notifier).toggleAssetSelection(asset);
|
||||
} else {
|
||||
await ref.read(timelineServiceProvider).loadAssets(assetIndex, 1);
|
||||
ref.read(isPlayingMotionVideoProvider.notifier).playing = false;
|
||||
ctx.pushRoute(
|
||||
AssetViewerRoute(
|
||||
initialIndex: assetIndex,
|
||||
|
||||
@@ -18,3 +18,10 @@ final assetServiceProvider = Provider(
|
||||
localAssetRepository: ref.watch(localAssetRepository),
|
||||
),
|
||||
);
|
||||
|
||||
final placesProvider = FutureProvider<List<(String, String)>>(
|
||||
(ref) => AssetService(
|
||||
remoteAssetRepository: ref.watch(remoteAssetRepositoryProvider),
|
||||
localAssetRepository: ref.watch(localAssetRepository),
|
||||
).getPlaces(),
|
||||
);
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:immich_mobile/infrastructure/repositories/user_metadata.repository.dart';
|
||||
import 'package:immich_mobile/providers/infrastructure/db.provider.dart';
|
||||
|
||||
final userMetadataRepository = Provider<DriftUserMetadataRepository>(
|
||||
(ref) => DriftUserMetadataRepository(ref.watch(driftProvider)),
|
||||
);
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:collection/collection.dart';
|
||||
@@ -10,6 +11,7 @@ import 'package:immich_mobile/entities/store.entity.dart';
|
||||
import 'package:immich_mobile/models/server_info/server_version.model.dart';
|
||||
import 'package:immich_mobile/providers/asset.provider.dart';
|
||||
import 'package:immich_mobile/providers/auth.provider.dart';
|
||||
import 'package:immich_mobile/providers/background_sync.provider.dart';
|
||||
import 'package:immich_mobile/providers/db.provider.dart';
|
||||
import 'package:immich_mobile/providers/server_info.provider.dart';
|
||||
import 'package:immich_mobile/services/api.service.dart';
|
||||
@@ -106,6 +108,18 @@ class WebsocketNotifier extends StateNotifier<WebsocketState> {
|
||||
final Debouncer _debounce =
|
||||
Debouncer(interval: const Duration(milliseconds: 500));
|
||||
|
||||
final Debouncer _batchDebouncer = Debouncer(
|
||||
interval: const Duration(seconds: 5),
|
||||
maxWaitTime: const Duration(seconds: 10),
|
||||
);
|
||||
final List<dynamic> _batchedAssetUploadReady = [];
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_batchDebouncer.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
/// Connects websocket to server unless already connected
|
||||
void connect() {
|
||||
if (state.isConnected) return;
|
||||
@@ -171,6 +185,7 @@ class WebsocketNotifier extends StateNotifier<WebsocketState> {
|
||||
socket.on('on_asset_stack_update', _handleServerUpdates);
|
||||
socket.on('on_asset_hidden', _handleOnAssetHidden);
|
||||
socket.on('on_new_release', _handleReleaseUpdates);
|
||||
socket.on('AssetUploadReadyV1', _handleSyncAssetUploadReady);
|
||||
} catch (e) {
|
||||
debugPrint("[WEBSOCKET] Catch Websocket Error - ${e.toString()}");
|
||||
}
|
||||
@@ -180,6 +195,8 @@ class WebsocketNotifier extends StateNotifier<WebsocketState> {
|
||||
void disconnect() {
|
||||
debugPrint("Attempting to disconnect from websocket");
|
||||
|
||||
_batchedAssetUploadReady.clear();
|
||||
|
||||
var socket = state.socket?.disconnect();
|
||||
|
||||
if (socket?.disconnected == true) {
|
||||
@@ -288,7 +305,7 @@ class WebsocketNotifier extends StateNotifier<WebsocketState> {
|
||||
}
|
||||
}
|
||||
|
||||
void handlePendingChanges() async {
|
||||
Future<void> handlePendingChanges() async {
|
||||
await _handlePendingUploaded();
|
||||
await _handlePendingDeletes();
|
||||
await _handlingPendingHidden();
|
||||
@@ -347,6 +364,29 @@ class WebsocketNotifier extends StateNotifier<WebsocketState> {
|
||||
.read(serverInfoProvider.notifier)
|
||||
.handleNewRelease(serverVersion, releaseVersion);
|
||||
}
|
||||
|
||||
void _handleSyncAssetUploadReady(dynamic data) {
|
||||
_batchedAssetUploadReady.add(data);
|
||||
_batchDebouncer.run(_processBatchedAssetUploadReady);
|
||||
}
|
||||
|
||||
void _processBatchedAssetUploadReady() {
|
||||
if (_batchedAssetUploadReady.isEmpty) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
unawaited(
|
||||
_ref
|
||||
.read(backgroundSyncProvider)
|
||||
.syncWebsocketBatch(_batchedAssetUploadReady.toList()),
|
||||
);
|
||||
} catch (error) {
|
||||
_log.severe("Error processing batched AssetUploadReadyV1 events: $error");
|
||||
}
|
||||
|
||||
_batchedAssetUploadReady.clear();
|
||||
}
|
||||
}
|
||||
|
||||
final websocketProvider =
|
||||
|
||||
@@ -72,6 +72,8 @@ import 'package:immich_mobile/pages/share_intent/share_intent.page.dart';
|
||||
import 'package:immich_mobile/presentation/pages/drift_favorite.page.dart';
|
||||
import 'package:immich_mobile/presentation/pages/drift_partner_detail.page.dart';
|
||||
import 'package:immich_mobile/presentation/pages/drift_local_album.page.dart';
|
||||
import 'package:immich_mobile/presentation/pages/drift_place.page.dart';
|
||||
import 'package:immich_mobile/presentation/pages/drift_place_detail.page.dart';
|
||||
import 'package:immich_mobile/presentation/pages/drift_recently_taken.page.dart';
|
||||
import 'package:immich_mobile/presentation/pages/drift_video.page.dart';
|
||||
import 'package:immich_mobile/presentation/pages/drift_trash.page.dart';
|
||||
@@ -453,7 +455,14 @@ class AppRouter extends RootStackRouter {
|
||||
page: DriftCreateAlbumRoute.page,
|
||||
guards: [_authGuard, _duplicateGuard],
|
||||
),
|
||||
|
||||
AutoRoute(
|
||||
page: DriftPlaceRoute.page,
|
||||
guards: [_authGuard, _duplicateGuard],
|
||||
),
|
||||
AutoRoute(
|
||||
page: DriftPlaceDetailRoute.page,
|
||||
guards: [_authGuard, _duplicateGuard],
|
||||
),
|
||||
// required to handle all deeplinks in deep_link.service.dart
|
||||
// auto_route_library#1722
|
||||
RedirectRoute(path: '*', redirectTo: '/'),
|
||||
|
||||
@@ -853,6 +853,85 @@ class DriftPartnerDetailRouteArgs {
|
||||
}
|
||||
}
|
||||
|
||||
/// generated route for
|
||||
/// [DriftPlaceDetailPage]
|
||||
class DriftPlaceDetailRoute extends PageRouteInfo<DriftPlaceDetailRouteArgs> {
|
||||
DriftPlaceDetailRoute({
|
||||
Key? key,
|
||||
required String place,
|
||||
List<PageRouteInfo>? children,
|
||||
}) : super(
|
||||
DriftPlaceDetailRoute.name,
|
||||
args: DriftPlaceDetailRouteArgs(key: key, place: place),
|
||||
initialChildren: children,
|
||||
);
|
||||
|
||||
static const String name = 'DriftPlaceDetailRoute';
|
||||
|
||||
static PageInfo page = PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
final args = data.argsAs<DriftPlaceDetailRouteArgs>();
|
||||
return DriftPlaceDetailPage(key: args.key, place: args.place);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
class DriftPlaceDetailRouteArgs {
|
||||
const DriftPlaceDetailRouteArgs({this.key, required this.place});
|
||||
|
||||
final Key? key;
|
||||
|
||||
final String place;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'DriftPlaceDetailRouteArgs{key: $key, place: $place}';
|
||||
}
|
||||
}
|
||||
|
||||
/// generated route for
|
||||
/// [DriftPlacePage]
|
||||
class DriftPlaceRoute extends PageRouteInfo<DriftPlaceRouteArgs> {
|
||||
DriftPlaceRoute({
|
||||
Key? key,
|
||||
LatLng? currentLocation,
|
||||
List<PageRouteInfo>? children,
|
||||
}) : super(
|
||||
DriftPlaceRoute.name,
|
||||
args: DriftPlaceRouteArgs(key: key, currentLocation: currentLocation),
|
||||
initialChildren: children,
|
||||
);
|
||||
|
||||
static const String name = 'DriftPlaceRoute';
|
||||
|
||||
static PageInfo page = PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
final args = data.argsAs<DriftPlaceRouteArgs>(
|
||||
orElse: () => const DriftPlaceRouteArgs(),
|
||||
);
|
||||
return DriftPlacePage(
|
||||
key: args.key,
|
||||
currentLocation: args.currentLocation,
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
class DriftPlaceRouteArgs {
|
||||
const DriftPlaceRouteArgs({this.key, this.currentLocation});
|
||||
|
||||
final Key? key;
|
||||
|
||||
final LatLng? currentLocation;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'DriftPlaceRouteArgs{key: $key, currentLocation: $currentLocation}';
|
||||
}
|
||||
}
|
||||
|
||||
/// generated route for
|
||||
/// [DriftRecentlyTakenPage]
|
||||
class DriftRecentlyTakenRoute extends PageRouteInfo<void> {
|
||||
|
||||
@@ -482,10 +482,10 @@ class _RandomAssetBackgroundState extends State<_RandomAssetBackground>
|
||||
builder: (context, child) {
|
||||
return Transform.scale(
|
||||
scale: _zoomAnimation.value,
|
||||
filterQuality: FilterQuality.low,
|
||||
filterQuality: Platform.isAndroid ? FilterQuality.low : null,
|
||||
child: Transform.translate(
|
||||
offset: _panAnimation.value,
|
||||
filterQuality: FilterQuality.low,
|
||||
filterQuality: Platform.isAndroid ? FilterQuality.low : null,
|
||||
child: Stack(
|
||||
fit: StackFit.expand,
|
||||
children: [
|
||||
|
||||
@@ -101,6 +101,10 @@ void main() {
|
||||
debugLabel: any(named: 'debugLabel'),
|
||||
),
|
||||
).thenAnswer(successHandler);
|
||||
when(() => mockSyncStreamRepo.updateUserMetadatasV1(any()))
|
||||
.thenAnswer(successHandler);
|
||||
when(() => mockSyncStreamRepo.deleteUserMetadatasV1(any()))
|
||||
.thenAnswer(successHandler);
|
||||
|
||||
sut = SyncStreamService(
|
||||
syncApiRepository: mockSyncApiRepo,
|
||||
|
||||
Reference in New Issue
Block a user