mirror of
https://github.com/immich-app/immich.git
synced 2025-07-09 09:12:57 +02:00
feat(mobile): shared album activities (#4833)
* fix(server): global activity like duplicate search * mobile: user_circle_avatar - fallback to text icon if no profile pic available * mobile: use favourite icon in search "your activity" * feat(mobile): shared album activities * mobile: align hearts with user profile icon * styling * replace bottom sheet with dismissible * add auto focus to the input --------- Co-authored-by: shalong-tanwen <139912620+shalong-tanwen@users.noreply.github.com> Co-authored-by: Alex <alex.tran1502@gmail.com>
This commit is contained in:
parent
c74ea7282a
commit
26fd9d7e5f
20 changed files with 890 additions and 15 deletions
mobile/lib/modules/activities/models
90
mobile/lib/modules/activities/models/activity.model.dart
Normal file
90
mobile/lib/modules/activities/models/activity.model.dart
Normal file
|
@ -0,0 +1,90 @@
|
|||
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(
|
||||
email: dto.user.email,
|
||||
firstName: dto.user.firstName,
|
||||
lastName: dto.user.lastName,
|
||||
profileImagePath: dto.user.profileImagePath,
|
||||
id: dto.user.id,
|
||||
// Placeholder values
|
||||
isAdmin: false,
|
||||
updatedAt: DateTime.now(),
|
||||
isPartnerSharedBy: false,
|
||||
isPartnerSharedWith: false,
|
||||
memoryEnabled: false,
|
||||
);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'Activity(id: $id, assetId: $assetId, comment: $comment, createdAt: $createdAt, type: $type, user: $user)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
if (identical(this, other)) return true;
|
||||
|
||||
return other is Activity &&
|
||||
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;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue