mirror of
				https://github.com/immich-app/immich.git
				synced 2025-11-04 03:27:09 -05:00 
			
		
		
		
	* feat(mobile): add bulk download functionality and update UI messages - Added `downloadAll` method to `IDownloadRepository` and its implementation in `DownloadRepository` to handle multiple asset downloads. - Implemented `downloadAllAsset` in `DownloadStateNotifier` to trigger bulk downloads. - Updated `DownloadService` to create download tasks for all selected assets. - Enhanced UI with new download success and failure messages in `en.json`. - Added download button to `ControlBottomAppBar` and integrated download functionality in `MultiselectGrid`. * translations use i18n method t() * Update mobile/lib/services/download.service.dart Co-authored-by: shenlong <139912620+shenlong-tanwen@users.noreply.github.com> * fix(mobile): update download logic in DownloadService - Changed the download method to utilize downloadAll for handling multiple tasks. - Simplified remoteId check by removing unnecessary condition. * sort i18n keys * remove the download signature from interface and logic as we use the downloadAll now --------- Co-authored-by: shenlong <139912620+shenlong-tanwen@users.noreply.github.com>
		
			
				
	
	
		
			57 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			Dart
		
	
	
	
	
	
			
		
		
	
	
			57 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			Dart
		
	
	
	
	
	
import 'package:immich_mobile/entities/asset.entity.dart';
 | 
						|
 | 
						|
class AssetSelectionState {
 | 
						|
  final bool hasRemote;
 | 
						|
  final bool hasLocal;
 | 
						|
  final bool hasMerged;
 | 
						|
  final int selectedCount;
 | 
						|
 | 
						|
  const AssetSelectionState({
 | 
						|
    this.hasRemote = false,
 | 
						|
    this.hasLocal = false,
 | 
						|
    this.hasMerged = false,
 | 
						|
    this.selectedCount = 0,
 | 
						|
  });
 | 
						|
 | 
						|
  AssetSelectionState copyWith({
 | 
						|
    bool? hasRemote,
 | 
						|
    bool? hasLocal,
 | 
						|
    bool? hasMerged,
 | 
						|
    int? selectedCount,
 | 
						|
  }) {
 | 
						|
    return AssetSelectionState(
 | 
						|
      hasRemote: hasRemote ?? this.hasRemote,
 | 
						|
      hasLocal: hasLocal ?? this.hasLocal,
 | 
						|
      hasMerged: hasMerged ?? this.hasMerged,
 | 
						|
      selectedCount: selectedCount ?? this.selectedCount,
 | 
						|
    );
 | 
						|
  }
 | 
						|
 | 
						|
  AssetSelectionState.fromSelection(Set<Asset> selection)
 | 
						|
      : hasLocal = selection.any((e) => e.storage == AssetState.local),
 | 
						|
        hasMerged = selection.any((e) => e.storage == AssetState.merged),
 | 
						|
        hasRemote = selection.any((e) => e.storage == AssetState.remote),
 | 
						|
        selectedCount = selection.length;
 | 
						|
 | 
						|
  @override
 | 
						|
  String toString() =>
 | 
						|
      'SelectionAssetState(hasRemote: $hasRemote, hasLocal: $hasLocal, hasMerged: $hasMerged, selectedCount: $selectedCount)';
 | 
						|
 | 
						|
  @override
 | 
						|
  bool operator ==(covariant AssetSelectionState other) {
 | 
						|
    if (identical(this, other)) return true;
 | 
						|
 | 
						|
    return other.hasRemote == hasRemote &&
 | 
						|
        other.hasLocal == hasLocal &&
 | 
						|
        other.hasMerged == hasMerged &&
 | 
						|
        other.selectedCount == selectedCount;
 | 
						|
  }
 | 
						|
 | 
						|
  @override
 | 
						|
  int get hashCode =>
 | 
						|
      hasRemote.hashCode ^
 | 
						|
      hasLocal.hashCode ^
 | 
						|
      hasMerged.hashCode ^
 | 
						|
      selectedCount.hashCode;
 | 
						|
}
 |