feat(mobile): backup to album

This commit is contained in:
Alex
2024-06-16 08:57:39 -07:00
parent 1cd51cc2de
commit a3e8701f0a
3 changed files with 62 additions and 12 deletions
@@ -0,0 +1,36 @@
// ignore_for_file: public_member_api_docs, sort_constructors_first
import 'package:photo_manager/photo_manager.dart';
class BackupCandidate {
final String albumName;
final AssetEntity asset;
BackupCandidate({
required this.albumName,
required this.asset,
});
BackupCandidate copyWith({
String? albumName,
AssetEntity? asset,
}) {
return BackupCandidate(
albumName: albumName ?? this.albumName,
asset: asset ?? this.asset,
);
}
@override
String toString() => 'BackupCandidate(albumName: $albumName, asset: $asset)';
@override
bool operator ==(covariant BackupCandidate other) {
if (identical(this, other)) return true;
return other.albumName == albumName && other.asset == asset;
}
@override
int get hashCode => albumName.hashCode ^ asset.hashCode;
}
@@ -2,7 +2,7 @@
import 'package:cancellation_token_http/http.dart';
import 'package:collection/collection.dart';
import 'package:photo_manager/photo_manager.dart';
import 'package:immich_mobile/models/backup/backup_candidate.model.dart';
import 'package:immich_mobile/models/backup/available_album.model.dart';
import 'package:immich_mobile/models/backup/current_upload_asset.model.dart';
@@ -41,7 +41,7 @@ class BackUpState {
final Set<AvailableAlbum> excludedBackupAlbums;
/// Assets that are not overlapping in selected backup albums and excluded backup albums
final Set<AssetEntity> allUniqueAssets;
final Set<BackupCandidate> allUniqueAssets;
/// All assets from the selected albums that have been backup
final Set<String> selectedAlbumsBackupAssetsIds;
@@ -94,7 +94,7 @@ class BackUpState {
List<AvailableAlbum>? availableAlbums,
Set<AvailableAlbum>? selectedBackupAlbums,
Set<AvailableAlbum>? excludedBackupAlbums,
Set<AssetEntity>? allUniqueAssets,
Set<BackupCandidate>? allUniqueAssets,
Set<String>? selectedAlbumsBackupAssetsIds,
CurrentUploadAsset? currentUploadAsset,
}) {