mirror of
				https://github.com/immich-app/immich.git
				synced 2025-10-31 02:27:08 -04:00 
			
		
		
		
	* refactor: autoroutex pushroute * refactor: autoroutex popRoute * refactor: autoroutex navigate and replace * chore: add doc comments for extension methods * refactor: Add LoggerMixin and refactor Album activities to use mixin * refactor: Activity page * chore: activity user from user constructor * fix: update current asset after build method * refactor: tests with similar structure as lib * chore: remove avoid-declaring-call-method rule from dcm analysis * test: fix proper expect order * test: activity_statistics_provider_test * test: activity_provider_test * test: use proper matchers * test: activity_text_field_test & dismissible_activity_test added * test: add http mock to return transparent image * test: download isar core libs during test * test: add widget tags to widget test cases * test: activity_tile_test * build: currentAlbumProvider to generator * movie add / remove like to activity input tile * test: activities_page_test.dart * chore: better error logs * chore: dismissibleactivity as statelesswidget --------- Co-authored-by: shalong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
		
			
				
	
	
		
			78 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			Dart
		
	
	
	
	
	
			
		
		
	
	
			78 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			Dart
		
	
	
	
	
	
| import 'package:immich_mobile/shared/models/user.dart';
 | |
| import 'package:openapi/api.dart';
 | |
| 
 | |
| enum ActivityType { comment, like }
 | |
| 
 | |
| class Activity {
 | |
|   final String id;
 | |
|   final String? assetId;
 | |
|   final String? comment;
 | |
|   final DateTime createdAt;
 | |
|   final ActivityType type;
 | |
|   final User user;
 | |
| 
 | |
|   const Activity({
 | |
|     required this.id,
 | |
|     this.assetId,
 | |
|     this.comment,
 | |
|     required this.createdAt,
 | |
|     required this.type,
 | |
|     required this.user,
 | |
|   });
 | |
| 
 | |
|   Activity copyWith({
 | |
|     String? id,
 | |
|     String? assetId,
 | |
|     String? comment,
 | |
|     DateTime? createdAt,
 | |
|     ActivityType? type,
 | |
|     User? user,
 | |
|   }) {
 | |
|     return Activity(
 | |
|       id: id ?? this.id,
 | |
|       assetId: assetId ?? this.assetId,
 | |
|       comment: comment ?? this.comment,
 | |
|       createdAt: createdAt ?? this.createdAt,
 | |
|       type: type ?? this.type,
 | |
|       user: user ?? this.user,
 | |
|     );
 | |
|   }
 | |
| 
 | |
|   Activity.fromDto(ActivityResponseDto dto)
 | |
|       : id = dto.id,
 | |
|         assetId = dto.assetId,
 | |
|         comment = dto.comment,
 | |
|         createdAt = dto.createdAt,
 | |
|         type = dto.type == ActivityResponseDtoTypeEnum.comment
 | |
|             ? ActivityType.comment
 | |
|             : ActivityType.like,
 | |
|         user = User.fromSimpleUserDto(dto.user);
 | |
| 
 | |
|   @override
 | |
|   String toString() {
 | |
|     return 'Activity(id: $id, assetId: $assetId, comment: $comment, createdAt: $createdAt, type: $type, user: $user)';
 | |
|   }
 | |
| 
 | |
|   @override
 | |
|   bool operator ==(covariant Activity other) {
 | |
|     if (identical(this, other)) return true;
 | |
| 
 | |
|     return other.id == id &&
 | |
|         other.assetId == assetId &&
 | |
|         other.comment == comment &&
 | |
|         other.createdAt == createdAt &&
 | |
|         other.type == type &&
 | |
|         other.user == user;
 | |
|   }
 | |
| 
 | |
|   @override
 | |
|   int get hashCode {
 | |
|     return id.hashCode ^
 | |
|         assetId.hashCode ^
 | |
|         comment.hashCode ^
 | |
|         createdAt.hashCode ^
 | |
|         type.hashCode ^
 | |
|         user.hashCode;
 | |
|   }
 | |
| }
 |