From 4187ceb248b4267f82de7ba14214b81f7a885647 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Mon, 2 Jun 2025 01:08:04 +0800 Subject: [PATCH] :alien: Support new attachment reference system --- assets/i18n/en-US.json | 3 +- ios/Runner/NotifyDelegate.swift | 4 +- .../NotificationService.swift | 10 ++--- lib/models/chat.dart | 2 - lib/models/chat.freezed.dart | 38 ++++++++----------- lib/models/chat.g.dart | 4 -- lib/models/file.dart | 1 - lib/models/file.freezed.dart | 31 +++++++-------- lib/models/file.g.dart | 2 - lib/models/post.dart | 2 - lib/models/post.freezed.dart | 38 ++++++++----------- lib/models/post.g.dart | 4 -- lib/models/realm.dart | 2 - lib/models/realm.freezed.dart | 38 ++++++++----------- lib/models/realm.g.dart | 4 -- lib/models/user.dart | 2 - lib/models/user.freezed.dart | 38 ++++++++----------- lib/models/user.g.dart | 4 -- lib/pods/config.g.dart | 2 +- lib/screens/account.dart | 6 +-- lib/screens/account/me/event_calendar.dart | 2 +- lib/screens/account/me/update.dart | 6 +-- lib/screens/account/profile.dart | 6 +-- lib/screens/account/relationship.dart | 2 +- lib/screens/auth/tabs.dart | 5 +++ lib/screens/chat/call.dart | 3 +- lib/screens/chat/chat.dart | 20 +++++----- lib/screens/chat/room.dart | 24 ++++++++---- lib/screens/chat/room_detail.dart | 16 ++++---- lib/screens/creators/hub.dart | 10 ++--- lib/screens/creators/publishers.dart | 14 +++---- lib/screens/posts/compose.dart | 2 +- lib/screens/posts/pub_profile.dart | 32 ++++++++++++++-- lib/screens/realm/detail.dart | 10 ++--- lib/screens/realm/realms.dart | 8 ++-- lib/widgets/account/account_picker.dart | 2 +- lib/widgets/account/status.dart | 2 +- lib/widgets/app_scaffold.dart | 2 +- lib/widgets/chat/call_button.g.dart | 2 +- lib/widgets/chat/call_overlay.dart | 5 ++- lib/widgets/chat/call_participant_tile.dart | 2 +- lib/widgets/chat/message_item.dart | 2 +- lib/widgets/check_in.dart | 4 +- .../content/cloud_file_collection.dart | 2 +- lib/widgets/content/cloud_file_picker.dart | 2 +- lib/widgets/post/post_item.dart | 2 +- lib/widgets/post/post_quick_reply.dart | 2 +- lib/widgets/realms/selection_dropdown.dart | 2 +- macos/Podfile.lock | 6 +++ pubspec.lock | 14 +++---- 50 files changed, 219 insertions(+), 227 deletions(-) diff --git a/assets/i18n/en-US.json b/assets/i18n/en-US.json index 3ce7fda..7055611 100644 --- a/assets/i18n/en-US.json +++ b/assets/i18n/en-US.json @@ -314,5 +314,6 @@ "accountSettingsHelp": "Account Settings Help", "accountSettingsHelpContent": "This page allows you to manage your account security, privacy, and other settings. If you need assistance, please contact support.", "unauthorized": "Unauthorized", - "unauthorizedHint": "You're not signed in or session expired, please sign in again." + "unauthorizedHint": "You're not signed in or session expired, please sign in again.", + "publisherVisitAccountPage": "Visit the profile of {}" } diff --git a/ios/Runner/NotifyDelegate.swift b/ios/Runner/NotifyDelegate.swift index 15b3432..b325ea6 100644 --- a/ios/Runner/NotifyDelegate.swift +++ b/ios/Runner/NotifyDelegate.swift @@ -27,9 +27,9 @@ class NotifyDelegate: UIResponder, UNUserNotificationCenterDelegate { } let serverUrl = "https://nt.solian.app" - let url = "\(serverUrl)/chat/\(metadata["room_id"])/messages" + let url = "\(serverUrl)/chat/\(metadata["room_id"] ?? "")/messages" - let parameters: [String: Any] = [ + let parameters: [String: Any?] = [ "content": textResponse.userText, "replied_message_id": metadata["message_id"] ] diff --git a/ios/SolianNotificationService/NotificationService.swift b/ios/SolianNotificationService/NotificationService.swift index 9d08f9b..3a5d18e 100644 --- a/ios/SolianNotificationService/NotificationService.swift +++ b/ios/SolianNotificationService/NotificationService.swift @@ -58,9 +58,7 @@ class NotificationService: UNNotificationServiceExtension { throw ParseNotificationPayloadError.missingMetadata("The notification has no meta.") } - guard let pfpIdentifier = meta["pfp"] as? String else { - throw ParseNotificationPayloadError.missingAvatarUrl("The notification has no pfp.") - } + let pfpIdentifier = meta["pfp"] as? String let replyableMessageCategory = UNNotificationCategory( identifier: content.categoryIdentifier, @@ -78,13 +76,13 @@ class NotificationService: UNNotificationServiceExtension { UNUserNotificationCenter.current().setNotificationCategories([replyableMessageCategory]) content.categoryIdentifier = replyableMessageCategory.identifier - let metaCopy = meta as? [String: String] ?? [:] - let pfpUrl = getAttachmentUrl(for: pfpIdentifier) + let metaCopy = meta as? [String: Any] ?? [:] + let pfpUrl = pfpIdentifier != nil ? getAttachmentUrl(for: pfpIdentifier!) : nil let targetSize = 512 let scaleProcessor = ResizingImageProcessor(referenceSize: CGSize(width: targetSize, height: targetSize), mode: .aspectFit) - KingfisherManager.shared.retrieveImage(with: URL(string: pfpUrl)!, options: [.processor(scaleProcessor)], completionHandler: { result in + KingfisherManager.shared.retrieveImage(with: URL(string: pfpUrl!)!, options: [.processor(scaleProcessor)], completionHandler: { result in var image: Data? switch result { case .success(let value): diff --git a/lib/models/chat.dart b/lib/models/chat.dart index d6733ae..026d7a7 100644 --- a/lib/models/chat.dart +++ b/lib/models/chat.dart @@ -14,9 +14,7 @@ sealed class SnChatRoom with _$SnChatRoom { required String? description, required int type, required bool isPublic, - required String? pictureId, required SnCloudFile? picture, - required String? backgroundId, required SnCloudFile? background, required String? realmId, required SnRealm? realm, diff --git a/lib/models/chat.freezed.dart b/lib/models/chat.freezed.dart index 5eb124b..e0ee55b 100644 --- a/lib/models/chat.freezed.dart +++ b/lib/models/chat.freezed.dart @@ -16,7 +16,7 @@ T _$identity(T value) => value; /// @nodoc mixin _$SnChatRoom { - String get id; String? get name; String? get description; int get type; bool get isPublic; String? get pictureId; SnCloudFile? get picture; String? get backgroundId; SnCloudFile? get background; String? get realmId; SnRealm? get realm; DateTime get createdAt; DateTime get updatedAt; DateTime? get deletedAt; List? get members; + String get id; String? get name; String? get description; int get type; bool get isPublic; SnCloudFile? get picture; SnCloudFile? get background; String? get realmId; SnRealm? get realm; DateTime get createdAt; DateTime get updatedAt; DateTime? get deletedAt; List? get members; /// Create a copy of SnChatRoom /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @@ -29,16 +29,16 @@ $SnChatRoomCopyWith get copyWith => _$SnChatRoomCopyWithImpl Object.hash(runtimeType,id,name,description,type,isPublic,pictureId,picture,backgroundId,background,realmId,realm,createdAt,updatedAt,deletedAt,const DeepCollectionEquality().hash(members)); +int get hashCode => Object.hash(runtimeType,id,name,description,type,isPublic,picture,background,realmId,realm,createdAt,updatedAt,deletedAt,const DeepCollectionEquality().hash(members)); @override String toString() { - return 'SnChatRoom(id: $id, name: $name, description: $description, type: $type, isPublic: $isPublic, pictureId: $pictureId, picture: $picture, backgroundId: $backgroundId, background: $background, realmId: $realmId, realm: $realm, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt, members: $members)'; + return 'SnChatRoom(id: $id, name: $name, description: $description, type: $type, isPublic: $isPublic, picture: $picture, background: $background, realmId: $realmId, realm: $realm, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt, members: $members)'; } @@ -49,7 +49,7 @@ abstract mixin class $SnChatRoomCopyWith<$Res> { factory $SnChatRoomCopyWith(SnChatRoom value, $Res Function(SnChatRoom) _then) = _$SnChatRoomCopyWithImpl; @useResult $Res call({ - String id, String? name, String? description, int type, bool isPublic, String? pictureId, SnCloudFile? picture, String? backgroundId, SnCloudFile? background, String? realmId, SnRealm? realm, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt, List? members + String id, String? name, String? description, int type, bool isPublic, SnCloudFile? picture, SnCloudFile? background, String? realmId, SnRealm? realm, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt, List? members }); @@ -66,17 +66,15 @@ class _$SnChatRoomCopyWithImpl<$Res> /// Create a copy of SnChatRoom /// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? name = freezed,Object? description = freezed,Object? type = null,Object? isPublic = null,Object? pictureId = freezed,Object? picture = freezed,Object? backgroundId = freezed,Object? background = freezed,Object? realmId = freezed,Object? realm = freezed,Object? createdAt = null,Object? updatedAt = null,Object? deletedAt = freezed,Object? members = freezed,}) { +@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? name = freezed,Object? description = freezed,Object? type = null,Object? isPublic = null,Object? picture = freezed,Object? background = freezed,Object? realmId = freezed,Object? realm = freezed,Object? createdAt = null,Object? updatedAt = null,Object? deletedAt = freezed,Object? members = freezed,}) { return _then(_self.copyWith( id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable as String,name: freezed == name ? _self.name : name // ignore: cast_nullable_to_non_nullable as String?,description: freezed == description ? _self.description : description // ignore: cast_nullable_to_non_nullable as String?,type: null == type ? _self.type : type // ignore: cast_nullable_to_non_nullable as int,isPublic: null == isPublic ? _self.isPublic : isPublic // ignore: cast_nullable_to_non_nullable -as bool,pictureId: freezed == pictureId ? _self.pictureId : pictureId // ignore: cast_nullable_to_non_nullable -as String?,picture: freezed == picture ? _self.picture : picture // ignore: cast_nullable_to_non_nullable -as SnCloudFile?,backgroundId: freezed == backgroundId ? _self.backgroundId : backgroundId // ignore: cast_nullable_to_non_nullable -as String?,background: freezed == background ? _self.background : background // ignore: cast_nullable_to_non_nullable +as bool,picture: freezed == picture ? _self.picture : picture // ignore: cast_nullable_to_non_nullable +as SnCloudFile?,background: freezed == background ? _self.background : background // ignore: cast_nullable_to_non_nullable as SnCloudFile?,realmId: freezed == realmId ? _self.realmId : realmId // ignore: cast_nullable_to_non_nullable as String?,realm: freezed == realm ? _self.realm : realm // ignore: cast_nullable_to_non_nullable as SnRealm?,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable @@ -130,7 +128,7 @@ $SnRealmCopyWith<$Res>? get realm { @JsonSerializable() class _SnChatRoom implements SnChatRoom { - const _SnChatRoom({required this.id, required this.name, required this.description, required this.type, required this.isPublic, required this.pictureId, required this.picture, required this.backgroundId, required this.background, required this.realmId, required this.realm, required this.createdAt, required this.updatedAt, required this.deletedAt, required final List? members}): _members = members; + const _SnChatRoom({required this.id, required this.name, required this.description, required this.type, required this.isPublic, required this.picture, required this.background, required this.realmId, required this.realm, required this.createdAt, required this.updatedAt, required this.deletedAt, required final List? members}): _members = members; factory _SnChatRoom.fromJson(Map json) => _$SnChatRoomFromJson(json); @override final String id; @@ -138,9 +136,7 @@ class _SnChatRoom implements SnChatRoom { @override final String? description; @override final int type; @override final bool isPublic; -@override final String? pictureId; @override final SnCloudFile? picture; -@override final String? backgroundId; @override final SnCloudFile? background; @override final String? realmId; @override final SnRealm? realm; @@ -170,16 +166,16 @@ Map toJson() { @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is _SnChatRoom&&(identical(other.id, id) || other.id == id)&&(identical(other.name, name) || other.name == name)&&(identical(other.description, description) || other.description == description)&&(identical(other.type, type) || other.type == type)&&(identical(other.isPublic, isPublic) || other.isPublic == isPublic)&&(identical(other.pictureId, pictureId) || other.pictureId == pictureId)&&(identical(other.picture, picture) || other.picture == picture)&&(identical(other.backgroundId, backgroundId) || other.backgroundId == backgroundId)&&(identical(other.background, background) || other.background == background)&&(identical(other.realmId, realmId) || other.realmId == realmId)&&(identical(other.realm, realm) || other.realm == realm)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.deletedAt, deletedAt) || other.deletedAt == deletedAt)&&const DeepCollectionEquality().equals(other._members, _members)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is _SnChatRoom&&(identical(other.id, id) || other.id == id)&&(identical(other.name, name) || other.name == name)&&(identical(other.description, description) || other.description == description)&&(identical(other.type, type) || other.type == type)&&(identical(other.isPublic, isPublic) || other.isPublic == isPublic)&&(identical(other.picture, picture) || other.picture == picture)&&(identical(other.background, background) || other.background == background)&&(identical(other.realmId, realmId) || other.realmId == realmId)&&(identical(other.realm, realm) || other.realm == realm)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.deletedAt, deletedAt) || other.deletedAt == deletedAt)&&const DeepCollectionEquality().equals(other._members, _members)); } @JsonKey(includeFromJson: false, includeToJson: false) @override -int get hashCode => Object.hash(runtimeType,id,name,description,type,isPublic,pictureId,picture,backgroundId,background,realmId,realm,createdAt,updatedAt,deletedAt,const DeepCollectionEquality().hash(_members)); +int get hashCode => Object.hash(runtimeType,id,name,description,type,isPublic,picture,background,realmId,realm,createdAt,updatedAt,deletedAt,const DeepCollectionEquality().hash(_members)); @override String toString() { - return 'SnChatRoom(id: $id, name: $name, description: $description, type: $type, isPublic: $isPublic, pictureId: $pictureId, picture: $picture, backgroundId: $backgroundId, background: $background, realmId: $realmId, realm: $realm, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt, members: $members)'; + return 'SnChatRoom(id: $id, name: $name, description: $description, type: $type, isPublic: $isPublic, picture: $picture, background: $background, realmId: $realmId, realm: $realm, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt, members: $members)'; } @@ -190,7 +186,7 @@ abstract mixin class _$SnChatRoomCopyWith<$Res> implements $SnChatRoomCopyWith<$ factory _$SnChatRoomCopyWith(_SnChatRoom value, $Res Function(_SnChatRoom) _then) = __$SnChatRoomCopyWithImpl; @override @useResult $Res call({ - String id, String? name, String? description, int type, bool isPublic, String? pictureId, SnCloudFile? picture, String? backgroundId, SnCloudFile? background, String? realmId, SnRealm? realm, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt, List? members + String id, String? name, String? description, int type, bool isPublic, SnCloudFile? picture, SnCloudFile? background, String? realmId, SnRealm? realm, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt, List? members }); @@ -207,17 +203,15 @@ class __$SnChatRoomCopyWithImpl<$Res> /// Create a copy of SnChatRoom /// with the given fields replaced by the non-null parameter values. -@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? name = freezed,Object? description = freezed,Object? type = null,Object? isPublic = null,Object? pictureId = freezed,Object? picture = freezed,Object? backgroundId = freezed,Object? background = freezed,Object? realmId = freezed,Object? realm = freezed,Object? createdAt = null,Object? updatedAt = null,Object? deletedAt = freezed,Object? members = freezed,}) { +@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? name = freezed,Object? description = freezed,Object? type = null,Object? isPublic = null,Object? picture = freezed,Object? background = freezed,Object? realmId = freezed,Object? realm = freezed,Object? createdAt = null,Object? updatedAt = null,Object? deletedAt = freezed,Object? members = freezed,}) { return _then(_SnChatRoom( id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable as String,name: freezed == name ? _self.name : name // ignore: cast_nullable_to_non_nullable as String?,description: freezed == description ? _self.description : description // ignore: cast_nullable_to_non_nullable as String?,type: null == type ? _self.type : type // ignore: cast_nullable_to_non_nullable as int,isPublic: null == isPublic ? _self.isPublic : isPublic // ignore: cast_nullable_to_non_nullable -as bool,pictureId: freezed == pictureId ? _self.pictureId : pictureId // ignore: cast_nullable_to_non_nullable -as String?,picture: freezed == picture ? _self.picture : picture // ignore: cast_nullable_to_non_nullable -as SnCloudFile?,backgroundId: freezed == backgroundId ? _self.backgroundId : backgroundId // ignore: cast_nullable_to_non_nullable -as String?,background: freezed == background ? _self.background : background // ignore: cast_nullable_to_non_nullable +as bool,picture: freezed == picture ? _self.picture : picture // ignore: cast_nullable_to_non_nullable +as SnCloudFile?,background: freezed == background ? _self.background : background // ignore: cast_nullable_to_non_nullable as SnCloudFile?,realmId: freezed == realmId ? _self.realmId : realmId // ignore: cast_nullable_to_non_nullable as String?,realm: freezed == realm ? _self.realm : realm // ignore: cast_nullable_to_non_nullable as SnRealm?,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable diff --git a/lib/models/chat.g.dart b/lib/models/chat.g.dart index 859177f..1f2cc8f 100644 --- a/lib/models/chat.g.dart +++ b/lib/models/chat.g.dart @@ -12,12 +12,10 @@ _SnChatRoom _$SnChatRoomFromJson(Map json) => _SnChatRoom( description: json['description'] as String?, type: (json['type'] as num).toInt(), isPublic: json['is_public'] as bool, - pictureId: json['picture_id'] as String?, picture: json['picture'] == null ? null : SnCloudFile.fromJson(json['picture'] as Map), - backgroundId: json['background_id'] as String?, background: json['background'] == null ? null @@ -46,9 +44,7 @@ Map _$SnChatRoomToJson(_SnChatRoom instance) => 'description': instance.description, 'type': instance.type, 'is_public': instance.isPublic, - 'picture_id': instance.pictureId, 'picture': instance.picture?.toJson(), - 'background_id': instance.backgroundId, 'background': instance.background?.toJson(), 'realm_id': instance.realmId, 'realm': instance.realm?.toJson(), diff --git a/lib/models/file.dart b/lib/models/file.dart index 0c0b06d..48cc1f0 100644 --- a/lib/models/file.dart +++ b/lib/models/file.dart @@ -43,7 +43,6 @@ sealed class SnCloudFile with _$SnCloudFile { required int size, required DateTime? uploadedAt, required String? uploadedTo, - required int usedCount, required DateTime createdAt, required DateTime updatedAt, required DateTime? deletedAt, diff --git a/lib/models/file.freezed.dart b/lib/models/file.freezed.dart index db3aeba..8b37e32 100644 --- a/lib/models/file.freezed.dart +++ b/lib/models/file.freezed.dart @@ -146,7 +146,7 @@ as UniversalFileType, /// @nodoc mixin _$SnCloudFile { - String get id; String get name; String? get description; Map? get fileMeta; Map? get userMeta; String? get mimeType; String? get hash; int get size; DateTime? get uploadedAt; String? get uploadedTo; int get usedCount; DateTime get createdAt; DateTime get updatedAt; DateTime? get deletedAt; + String get id; String get name; String? get description; Map? get fileMeta; Map? get userMeta; String? get mimeType; String? get hash; int get size; DateTime? get uploadedAt; String? get uploadedTo; DateTime get createdAt; DateTime get updatedAt; DateTime? get deletedAt; /// Create a copy of SnCloudFile /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @@ -159,16 +159,16 @@ $SnCloudFileCopyWith get copyWith => _$SnCloudFileCopyWithImpl Object.hash(runtimeType,id,name,description,const DeepCollectionEquality().hash(fileMeta),const DeepCollectionEquality().hash(userMeta),mimeType,hash,size,uploadedAt,uploadedTo,usedCount,createdAt,updatedAt,deletedAt); +int get hashCode => Object.hash(runtimeType,id,name,description,const DeepCollectionEquality().hash(fileMeta),const DeepCollectionEquality().hash(userMeta),mimeType,hash,size,uploadedAt,uploadedTo,createdAt,updatedAt,deletedAt); @override String toString() { - return 'SnCloudFile(id: $id, name: $name, description: $description, fileMeta: $fileMeta, userMeta: $userMeta, mimeType: $mimeType, hash: $hash, size: $size, uploadedAt: $uploadedAt, uploadedTo: $uploadedTo, usedCount: $usedCount, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt)'; + return 'SnCloudFile(id: $id, name: $name, description: $description, fileMeta: $fileMeta, userMeta: $userMeta, mimeType: $mimeType, hash: $hash, size: $size, uploadedAt: $uploadedAt, uploadedTo: $uploadedTo, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt)'; } @@ -179,7 +179,7 @@ abstract mixin class $SnCloudFileCopyWith<$Res> { factory $SnCloudFileCopyWith(SnCloudFile value, $Res Function(SnCloudFile) _then) = _$SnCloudFileCopyWithImpl; @useResult $Res call({ - String id, String name, String? description, Map? fileMeta, Map? userMeta, String? mimeType, String? hash, int size, DateTime? uploadedAt, String? uploadedTo, int usedCount, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt + String id, String name, String? description, Map? fileMeta, Map? userMeta, String? mimeType, String? hash, int size, DateTime? uploadedAt, String? uploadedTo, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt }); @@ -196,7 +196,7 @@ class _$SnCloudFileCopyWithImpl<$Res> /// Create a copy of SnCloudFile /// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? name = null,Object? description = freezed,Object? fileMeta = freezed,Object? userMeta = freezed,Object? mimeType = freezed,Object? hash = freezed,Object? size = null,Object? uploadedAt = freezed,Object? uploadedTo = freezed,Object? usedCount = null,Object? createdAt = null,Object? updatedAt = null,Object? deletedAt = freezed,}) { +@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? name = null,Object? description = freezed,Object? fileMeta = freezed,Object? userMeta = freezed,Object? mimeType = freezed,Object? hash = freezed,Object? size = null,Object? uploadedAt = freezed,Object? uploadedTo = freezed,Object? createdAt = null,Object? updatedAt = null,Object? deletedAt = freezed,}) { return _then(_self.copyWith( id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable as String,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable @@ -208,8 +208,7 @@ as String?,hash: freezed == hash ? _self.hash : hash // ignore: cast_nullable_to as String?,size: null == size ? _self.size : size // ignore: cast_nullable_to_non_nullable as int,uploadedAt: freezed == uploadedAt ? _self.uploadedAt : uploadedAt // ignore: cast_nullable_to_non_nullable as DateTime?,uploadedTo: freezed == uploadedTo ? _self.uploadedTo : uploadedTo // ignore: cast_nullable_to_non_nullable -as String?,usedCount: null == usedCount ? _self.usedCount : usedCount // ignore: cast_nullable_to_non_nullable -as int,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable +as String?,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable as DateTime,updatedAt: null == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable as DateTime,deletedAt: freezed == deletedAt ? _self.deletedAt : deletedAt // ignore: cast_nullable_to_non_nullable as DateTime?, @@ -223,7 +222,7 @@ as DateTime?, @JsonSerializable() class _SnCloudFile implements SnCloudFile { - const _SnCloudFile({required this.id, required this.name, required this.description, required final Map? fileMeta, required final Map? userMeta, required this.mimeType, required this.hash, required this.size, required this.uploadedAt, required this.uploadedTo, required this.usedCount, required this.createdAt, required this.updatedAt, required this.deletedAt}): _fileMeta = fileMeta,_userMeta = userMeta; + const _SnCloudFile({required this.id, required this.name, required this.description, required final Map? fileMeta, required final Map? userMeta, required this.mimeType, required this.hash, required this.size, required this.uploadedAt, required this.uploadedTo, required this.createdAt, required this.updatedAt, required this.deletedAt}): _fileMeta = fileMeta,_userMeta = userMeta; factory _SnCloudFile.fromJson(Map json) => _$SnCloudFileFromJson(json); @override final String id; @@ -252,7 +251,6 @@ class _SnCloudFile implements SnCloudFile { @override final int size; @override final DateTime? uploadedAt; @override final String? uploadedTo; -@override final int usedCount; @override final DateTime createdAt; @override final DateTime updatedAt; @override final DateTime? deletedAt; @@ -270,16 +268,16 @@ Map toJson() { @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is _SnCloudFile&&(identical(other.id, id) || other.id == id)&&(identical(other.name, name) || other.name == name)&&(identical(other.description, description) || other.description == description)&&const DeepCollectionEquality().equals(other._fileMeta, _fileMeta)&&const DeepCollectionEquality().equals(other._userMeta, _userMeta)&&(identical(other.mimeType, mimeType) || other.mimeType == mimeType)&&(identical(other.hash, hash) || other.hash == hash)&&(identical(other.size, size) || other.size == size)&&(identical(other.uploadedAt, uploadedAt) || other.uploadedAt == uploadedAt)&&(identical(other.uploadedTo, uploadedTo) || other.uploadedTo == uploadedTo)&&(identical(other.usedCount, usedCount) || other.usedCount == usedCount)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.deletedAt, deletedAt) || other.deletedAt == deletedAt)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is _SnCloudFile&&(identical(other.id, id) || other.id == id)&&(identical(other.name, name) || other.name == name)&&(identical(other.description, description) || other.description == description)&&const DeepCollectionEquality().equals(other._fileMeta, _fileMeta)&&const DeepCollectionEquality().equals(other._userMeta, _userMeta)&&(identical(other.mimeType, mimeType) || other.mimeType == mimeType)&&(identical(other.hash, hash) || other.hash == hash)&&(identical(other.size, size) || other.size == size)&&(identical(other.uploadedAt, uploadedAt) || other.uploadedAt == uploadedAt)&&(identical(other.uploadedTo, uploadedTo) || other.uploadedTo == uploadedTo)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.deletedAt, deletedAt) || other.deletedAt == deletedAt)); } @JsonKey(includeFromJson: false, includeToJson: false) @override -int get hashCode => Object.hash(runtimeType,id,name,description,const DeepCollectionEquality().hash(_fileMeta),const DeepCollectionEquality().hash(_userMeta),mimeType,hash,size,uploadedAt,uploadedTo,usedCount,createdAt,updatedAt,deletedAt); +int get hashCode => Object.hash(runtimeType,id,name,description,const DeepCollectionEquality().hash(_fileMeta),const DeepCollectionEquality().hash(_userMeta),mimeType,hash,size,uploadedAt,uploadedTo,createdAt,updatedAt,deletedAt); @override String toString() { - return 'SnCloudFile(id: $id, name: $name, description: $description, fileMeta: $fileMeta, userMeta: $userMeta, mimeType: $mimeType, hash: $hash, size: $size, uploadedAt: $uploadedAt, uploadedTo: $uploadedTo, usedCount: $usedCount, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt)'; + return 'SnCloudFile(id: $id, name: $name, description: $description, fileMeta: $fileMeta, userMeta: $userMeta, mimeType: $mimeType, hash: $hash, size: $size, uploadedAt: $uploadedAt, uploadedTo: $uploadedTo, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt)'; } @@ -290,7 +288,7 @@ abstract mixin class _$SnCloudFileCopyWith<$Res> implements $SnCloudFileCopyWith factory _$SnCloudFileCopyWith(_SnCloudFile value, $Res Function(_SnCloudFile) _then) = __$SnCloudFileCopyWithImpl; @override @useResult $Res call({ - String id, String name, String? description, Map? fileMeta, Map? userMeta, String? mimeType, String? hash, int size, DateTime? uploadedAt, String? uploadedTo, int usedCount, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt + String id, String name, String? description, Map? fileMeta, Map? userMeta, String? mimeType, String? hash, int size, DateTime? uploadedAt, String? uploadedTo, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt }); @@ -307,7 +305,7 @@ class __$SnCloudFileCopyWithImpl<$Res> /// Create a copy of SnCloudFile /// with the given fields replaced by the non-null parameter values. -@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? name = null,Object? description = freezed,Object? fileMeta = freezed,Object? userMeta = freezed,Object? mimeType = freezed,Object? hash = freezed,Object? size = null,Object? uploadedAt = freezed,Object? uploadedTo = freezed,Object? usedCount = null,Object? createdAt = null,Object? updatedAt = null,Object? deletedAt = freezed,}) { +@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? name = null,Object? description = freezed,Object? fileMeta = freezed,Object? userMeta = freezed,Object? mimeType = freezed,Object? hash = freezed,Object? size = null,Object? uploadedAt = freezed,Object? uploadedTo = freezed,Object? createdAt = null,Object? updatedAt = null,Object? deletedAt = freezed,}) { return _then(_SnCloudFile( id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable as String,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable @@ -319,8 +317,7 @@ as String?,hash: freezed == hash ? _self.hash : hash // ignore: cast_nullable_to as String?,size: null == size ? _self.size : size // ignore: cast_nullable_to_non_nullable as int,uploadedAt: freezed == uploadedAt ? _self.uploadedAt : uploadedAt // ignore: cast_nullable_to_non_nullable as DateTime?,uploadedTo: freezed == uploadedTo ? _self.uploadedTo : uploadedTo // ignore: cast_nullable_to_non_nullable -as String?,usedCount: null == usedCount ? _self.usedCount : usedCount // ignore: cast_nullable_to_non_nullable -as int,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable +as String?,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable as DateTime,updatedAt: null == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable as DateTime,deletedAt: freezed == deletedAt ? _self.deletedAt : deletedAt // ignore: cast_nullable_to_non_nullable as DateTime?, diff --git a/lib/models/file.g.dart b/lib/models/file.g.dart index d5ce020..4a1a6a6 100644 --- a/lib/models/file.g.dart +++ b/lib/models/file.g.dart @@ -20,7 +20,6 @@ _SnCloudFile _$SnCloudFileFromJson(Map json) => _SnCloudFile( ? null : DateTime.parse(json['uploaded_at'] as String), uploadedTo: json['uploaded_to'] as String?, - usedCount: (json['used_count'] as num).toInt(), createdAt: DateTime.parse(json['created_at'] as String), updatedAt: DateTime.parse(json['updated_at'] as String), deletedAt: @@ -41,7 +40,6 @@ Map _$SnCloudFileToJson(_SnCloudFile instance) => 'size': instance.size, 'uploaded_at': instance.uploadedAt?.toIso8601String(), 'uploaded_to': instance.uploadedTo, - 'used_count': instance.usedCount, 'created_at': instance.createdAt.toIso8601String(), 'updated_at': instance.updatedAt.toIso8601String(), 'deleted_at': instance.deletedAt?.toIso8601String(), diff --git a/lib/models/post.dart b/lib/models/post.dart index 99683d6..d551152 100644 --- a/lib/models/post.dart +++ b/lib/models/post.dart @@ -51,9 +51,7 @@ sealed class SnPublisher with _$SnPublisher { required String name, required String nick, @Default('') String bio, - required String? pictureId, required SnCloudFile? picture, - required String? backgroundId, required SnCloudFile? background, required SnAccount? account, required String? accountId, diff --git a/lib/models/post.freezed.dart b/lib/models/post.freezed.dart index bc3307f..17f0592 100644 --- a/lib/models/post.freezed.dart +++ b/lib/models/post.freezed.dart @@ -370,7 +370,7 @@ $SnPublisherCopyWith<$Res> get publisher { /// @nodoc mixin _$SnPublisher { - String get id; int get type; String get name; String get nick; String get bio; String? get pictureId; SnCloudFile? get picture; String? get backgroundId; SnCloudFile? get background; SnAccount? get account; String? get accountId; DateTime get createdAt; DateTime get updatedAt; DateTime? get deletedAt; String? get realmId; + String get id; int get type; String get name; String get nick; String get bio; SnCloudFile? get picture; SnCloudFile? get background; SnAccount? get account; String? get accountId; DateTime get createdAt; DateTime get updatedAt; DateTime? get deletedAt; String? get realmId; /// Create a copy of SnPublisher /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @@ -383,16 +383,16 @@ $SnPublisherCopyWith get copyWith => _$SnPublisherCopyWithImpl Object.hash(runtimeType,id,type,name,nick,bio,pictureId,picture,backgroundId,background,account,accountId,createdAt,updatedAt,deletedAt,realmId); +int get hashCode => Object.hash(runtimeType,id,type,name,nick,bio,picture,background,account,accountId,createdAt,updatedAt,deletedAt,realmId); @override String toString() { - return 'SnPublisher(id: $id, type: $type, name: $name, nick: $nick, bio: $bio, pictureId: $pictureId, picture: $picture, backgroundId: $backgroundId, background: $background, account: $account, accountId: $accountId, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt, realmId: $realmId)'; + return 'SnPublisher(id: $id, type: $type, name: $name, nick: $nick, bio: $bio, picture: $picture, background: $background, account: $account, accountId: $accountId, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt, realmId: $realmId)'; } @@ -403,7 +403,7 @@ abstract mixin class $SnPublisherCopyWith<$Res> { factory $SnPublisherCopyWith(SnPublisher value, $Res Function(SnPublisher) _then) = _$SnPublisherCopyWithImpl; @useResult $Res call({ - String id, int type, String name, String nick, String bio, String? pictureId, SnCloudFile? picture, String? backgroundId, SnCloudFile? background, SnAccount? account, String? accountId, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt, String? realmId + String id, int type, String name, String nick, String bio, SnCloudFile? picture, SnCloudFile? background, SnAccount? account, String? accountId, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt, String? realmId }); @@ -420,17 +420,15 @@ class _$SnPublisherCopyWithImpl<$Res> /// Create a copy of SnPublisher /// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? type = null,Object? name = null,Object? nick = null,Object? bio = null,Object? pictureId = freezed,Object? picture = freezed,Object? backgroundId = freezed,Object? background = freezed,Object? account = freezed,Object? accountId = freezed,Object? createdAt = null,Object? updatedAt = null,Object? deletedAt = freezed,Object? realmId = freezed,}) { +@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? type = null,Object? name = null,Object? nick = null,Object? bio = null,Object? picture = freezed,Object? background = freezed,Object? account = freezed,Object? accountId = freezed,Object? createdAt = null,Object? updatedAt = null,Object? deletedAt = freezed,Object? realmId = freezed,}) { return _then(_self.copyWith( id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable as String,type: null == type ? _self.type : type // ignore: cast_nullable_to_non_nullable as int,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable as String,nick: null == nick ? _self.nick : nick // ignore: cast_nullable_to_non_nullable as String,bio: null == bio ? _self.bio : bio // ignore: cast_nullable_to_non_nullable -as String,pictureId: freezed == pictureId ? _self.pictureId : pictureId // ignore: cast_nullable_to_non_nullable -as String?,picture: freezed == picture ? _self.picture : picture // ignore: cast_nullable_to_non_nullable -as SnCloudFile?,backgroundId: freezed == backgroundId ? _self.backgroundId : backgroundId // ignore: cast_nullable_to_non_nullable -as String?,background: freezed == background ? _self.background : background // ignore: cast_nullable_to_non_nullable +as String,picture: freezed == picture ? _self.picture : picture // ignore: cast_nullable_to_non_nullable +as SnCloudFile?,background: freezed == background ? _self.background : background // ignore: cast_nullable_to_non_nullable as SnCloudFile?,account: freezed == account ? _self.account : account // ignore: cast_nullable_to_non_nullable as SnAccount?,accountId: freezed == accountId ? _self.accountId : accountId // ignore: cast_nullable_to_non_nullable as String?,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable @@ -484,7 +482,7 @@ $SnAccountCopyWith<$Res>? get account { @JsonSerializable() class _SnPublisher implements SnPublisher { - const _SnPublisher({required this.id, required this.type, required this.name, required this.nick, this.bio = '', required this.pictureId, required this.picture, required this.backgroundId, required this.background, required this.account, required this.accountId, required this.createdAt, required this.updatedAt, required this.deletedAt, required this.realmId}); + const _SnPublisher({required this.id, required this.type, required this.name, required this.nick, this.bio = '', required this.picture, required this.background, required this.account, required this.accountId, required this.createdAt, required this.updatedAt, required this.deletedAt, required this.realmId}); factory _SnPublisher.fromJson(Map json) => _$SnPublisherFromJson(json); @override final String id; @@ -492,9 +490,7 @@ class _SnPublisher implements SnPublisher { @override final String name; @override final String nick; @override@JsonKey() final String bio; -@override final String? pictureId; @override final SnCloudFile? picture; -@override final String? backgroundId; @override final SnCloudFile? background; @override final SnAccount? account; @override final String? accountId; @@ -516,16 +512,16 @@ Map toJson() { @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is _SnPublisher&&(identical(other.id, id) || other.id == id)&&(identical(other.type, type) || other.type == type)&&(identical(other.name, name) || other.name == name)&&(identical(other.nick, nick) || other.nick == nick)&&(identical(other.bio, bio) || other.bio == bio)&&(identical(other.pictureId, pictureId) || other.pictureId == pictureId)&&(identical(other.picture, picture) || other.picture == picture)&&(identical(other.backgroundId, backgroundId) || other.backgroundId == backgroundId)&&(identical(other.background, background) || other.background == background)&&(identical(other.account, account) || other.account == account)&&(identical(other.accountId, accountId) || other.accountId == accountId)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.deletedAt, deletedAt) || other.deletedAt == deletedAt)&&(identical(other.realmId, realmId) || other.realmId == realmId)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is _SnPublisher&&(identical(other.id, id) || other.id == id)&&(identical(other.type, type) || other.type == type)&&(identical(other.name, name) || other.name == name)&&(identical(other.nick, nick) || other.nick == nick)&&(identical(other.bio, bio) || other.bio == bio)&&(identical(other.picture, picture) || other.picture == picture)&&(identical(other.background, background) || other.background == background)&&(identical(other.account, account) || other.account == account)&&(identical(other.accountId, accountId) || other.accountId == accountId)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.deletedAt, deletedAt) || other.deletedAt == deletedAt)&&(identical(other.realmId, realmId) || other.realmId == realmId)); } @JsonKey(includeFromJson: false, includeToJson: false) @override -int get hashCode => Object.hash(runtimeType,id,type,name,nick,bio,pictureId,picture,backgroundId,background,account,accountId,createdAt,updatedAt,deletedAt,realmId); +int get hashCode => Object.hash(runtimeType,id,type,name,nick,bio,picture,background,account,accountId,createdAt,updatedAt,deletedAt,realmId); @override String toString() { - return 'SnPublisher(id: $id, type: $type, name: $name, nick: $nick, bio: $bio, pictureId: $pictureId, picture: $picture, backgroundId: $backgroundId, background: $background, account: $account, accountId: $accountId, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt, realmId: $realmId)'; + return 'SnPublisher(id: $id, type: $type, name: $name, nick: $nick, bio: $bio, picture: $picture, background: $background, account: $account, accountId: $accountId, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt, realmId: $realmId)'; } @@ -536,7 +532,7 @@ abstract mixin class _$SnPublisherCopyWith<$Res> implements $SnPublisherCopyWith factory _$SnPublisherCopyWith(_SnPublisher value, $Res Function(_SnPublisher) _then) = __$SnPublisherCopyWithImpl; @override @useResult $Res call({ - String id, int type, String name, String nick, String bio, String? pictureId, SnCloudFile? picture, String? backgroundId, SnCloudFile? background, SnAccount? account, String? accountId, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt, String? realmId + String id, int type, String name, String nick, String bio, SnCloudFile? picture, SnCloudFile? background, SnAccount? account, String? accountId, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt, String? realmId }); @@ -553,17 +549,15 @@ class __$SnPublisherCopyWithImpl<$Res> /// Create a copy of SnPublisher /// with the given fields replaced by the non-null parameter values. -@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? type = null,Object? name = null,Object? nick = null,Object? bio = null,Object? pictureId = freezed,Object? picture = freezed,Object? backgroundId = freezed,Object? background = freezed,Object? account = freezed,Object? accountId = freezed,Object? createdAt = null,Object? updatedAt = null,Object? deletedAt = freezed,Object? realmId = freezed,}) { +@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? type = null,Object? name = null,Object? nick = null,Object? bio = null,Object? picture = freezed,Object? background = freezed,Object? account = freezed,Object? accountId = freezed,Object? createdAt = null,Object? updatedAt = null,Object? deletedAt = freezed,Object? realmId = freezed,}) { return _then(_SnPublisher( id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable as String,type: null == type ? _self.type : type // ignore: cast_nullable_to_non_nullable as int,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable as String,nick: null == nick ? _self.nick : nick // ignore: cast_nullable_to_non_nullable as String,bio: null == bio ? _self.bio : bio // ignore: cast_nullable_to_non_nullable -as String,pictureId: freezed == pictureId ? _self.pictureId : pictureId // ignore: cast_nullable_to_non_nullable -as String?,picture: freezed == picture ? _self.picture : picture // ignore: cast_nullable_to_non_nullable -as SnCloudFile?,backgroundId: freezed == backgroundId ? _self.backgroundId : backgroundId // ignore: cast_nullable_to_non_nullable -as String?,background: freezed == background ? _self.background : background // ignore: cast_nullable_to_non_nullable +as String,picture: freezed == picture ? _self.picture : picture // ignore: cast_nullable_to_non_nullable +as SnCloudFile?,background: freezed == background ? _self.background : background // ignore: cast_nullable_to_non_nullable as SnCloudFile?,account: freezed == account ? _self.account : account // ignore: cast_nullable_to_non_nullable as SnAccount?,accountId: freezed == accountId ? _self.accountId : accountId // ignore: cast_nullable_to_non_nullable as String?,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable diff --git a/lib/models/post.g.dart b/lib/models/post.g.dart index 5fa824a..40e9702 100644 --- a/lib/models/post.g.dart +++ b/lib/models/post.g.dart @@ -100,12 +100,10 @@ _SnPublisher _$SnPublisherFromJson(Map json) => _SnPublisher( name: json['name'] as String, nick: json['nick'] as String, bio: json['bio'] as String? ?? '', - pictureId: json['picture_id'] as String?, picture: json['picture'] == null ? null : SnCloudFile.fromJson(json['picture'] as Map), - backgroundId: json['background_id'] as String?, background: json['background'] == null ? null @@ -131,9 +129,7 @@ Map _$SnPublisherToJson(_SnPublisher instance) => 'name': instance.name, 'nick': instance.nick, 'bio': instance.bio, - 'picture_id': instance.pictureId, 'picture': instance.picture?.toJson(), - 'background_id': instance.backgroundId, 'background': instance.background?.toJson(), 'account': instance.account?.toJson(), 'account_id': instance.accountId, diff --git a/lib/models/realm.dart b/lib/models/realm.dart index 2c4e573..9f89371 100644 --- a/lib/models/realm.dart +++ b/lib/models/realm.dart @@ -16,9 +16,7 @@ sealed class SnRealm with _$SnRealm { required DateTime? verifiedAt, required bool isCommunity, required bool isPublic, - required String? pictureId, required SnCloudFile? picture, - required String? backgroundId, required SnCloudFile? background, required String accountId, required DateTime createdAt, diff --git a/lib/models/realm.freezed.dart b/lib/models/realm.freezed.dart index b96480c..3b128db 100644 --- a/lib/models/realm.freezed.dart +++ b/lib/models/realm.freezed.dart @@ -16,7 +16,7 @@ T _$identity(T value) => value; /// @nodoc mixin _$SnRealm { - String get id; String get slug; String get name; String get description; String? get verifiedAs; DateTime? get verifiedAt; bool get isCommunity; bool get isPublic; String? get pictureId; SnCloudFile? get picture; String? get backgroundId; SnCloudFile? get background; String get accountId; DateTime get createdAt; DateTime get updatedAt; DateTime? get deletedAt; + String get id; String get slug; String get name; String get description; String? get verifiedAs; DateTime? get verifiedAt; bool get isCommunity; bool get isPublic; SnCloudFile? get picture; SnCloudFile? get background; String get accountId; DateTime get createdAt; DateTime get updatedAt; DateTime? get deletedAt; /// Create a copy of SnRealm /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @@ -29,16 +29,16 @@ $SnRealmCopyWith get copyWith => _$SnRealmCopyWithImpl(this as @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is SnRealm&&(identical(other.id, id) || other.id == id)&&(identical(other.slug, slug) || other.slug == slug)&&(identical(other.name, name) || other.name == name)&&(identical(other.description, description) || other.description == description)&&(identical(other.verifiedAs, verifiedAs) || other.verifiedAs == verifiedAs)&&(identical(other.verifiedAt, verifiedAt) || other.verifiedAt == verifiedAt)&&(identical(other.isCommunity, isCommunity) || other.isCommunity == isCommunity)&&(identical(other.isPublic, isPublic) || other.isPublic == isPublic)&&(identical(other.pictureId, pictureId) || other.pictureId == pictureId)&&(identical(other.picture, picture) || other.picture == picture)&&(identical(other.backgroundId, backgroundId) || other.backgroundId == backgroundId)&&(identical(other.background, background) || other.background == background)&&(identical(other.accountId, accountId) || other.accountId == accountId)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.deletedAt, deletedAt) || other.deletedAt == deletedAt)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is SnRealm&&(identical(other.id, id) || other.id == id)&&(identical(other.slug, slug) || other.slug == slug)&&(identical(other.name, name) || other.name == name)&&(identical(other.description, description) || other.description == description)&&(identical(other.verifiedAs, verifiedAs) || other.verifiedAs == verifiedAs)&&(identical(other.verifiedAt, verifiedAt) || other.verifiedAt == verifiedAt)&&(identical(other.isCommunity, isCommunity) || other.isCommunity == isCommunity)&&(identical(other.isPublic, isPublic) || other.isPublic == isPublic)&&(identical(other.picture, picture) || other.picture == picture)&&(identical(other.background, background) || other.background == background)&&(identical(other.accountId, accountId) || other.accountId == accountId)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.deletedAt, deletedAt) || other.deletedAt == deletedAt)); } @JsonKey(includeFromJson: false, includeToJson: false) @override -int get hashCode => Object.hash(runtimeType,id,slug,name,description,verifiedAs,verifiedAt,isCommunity,isPublic,pictureId,picture,backgroundId,background,accountId,createdAt,updatedAt,deletedAt); +int get hashCode => Object.hash(runtimeType,id,slug,name,description,verifiedAs,verifiedAt,isCommunity,isPublic,picture,background,accountId,createdAt,updatedAt,deletedAt); @override String toString() { - return 'SnRealm(id: $id, slug: $slug, name: $name, description: $description, verifiedAs: $verifiedAs, verifiedAt: $verifiedAt, isCommunity: $isCommunity, isPublic: $isPublic, pictureId: $pictureId, picture: $picture, backgroundId: $backgroundId, background: $background, accountId: $accountId, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt)'; + return 'SnRealm(id: $id, slug: $slug, name: $name, description: $description, verifiedAs: $verifiedAs, verifiedAt: $verifiedAt, isCommunity: $isCommunity, isPublic: $isPublic, picture: $picture, background: $background, accountId: $accountId, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt)'; } @@ -49,7 +49,7 @@ abstract mixin class $SnRealmCopyWith<$Res> { factory $SnRealmCopyWith(SnRealm value, $Res Function(SnRealm) _then) = _$SnRealmCopyWithImpl; @useResult $Res call({ - String id, String slug, String name, String description, String? verifiedAs, DateTime? verifiedAt, bool isCommunity, bool isPublic, String? pictureId, SnCloudFile? picture, String? backgroundId, SnCloudFile? background, String accountId, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt + String id, String slug, String name, String description, String? verifiedAs, DateTime? verifiedAt, bool isCommunity, bool isPublic, SnCloudFile? picture, SnCloudFile? background, String accountId, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt }); @@ -66,7 +66,7 @@ class _$SnRealmCopyWithImpl<$Res> /// Create a copy of SnRealm /// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? slug = null,Object? name = null,Object? description = null,Object? verifiedAs = freezed,Object? verifiedAt = freezed,Object? isCommunity = null,Object? isPublic = null,Object? pictureId = freezed,Object? picture = freezed,Object? backgroundId = freezed,Object? background = freezed,Object? accountId = null,Object? createdAt = null,Object? updatedAt = null,Object? deletedAt = freezed,}) { +@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? slug = null,Object? name = null,Object? description = null,Object? verifiedAs = freezed,Object? verifiedAt = freezed,Object? isCommunity = null,Object? isPublic = null,Object? picture = freezed,Object? background = freezed,Object? accountId = null,Object? createdAt = null,Object? updatedAt = null,Object? deletedAt = freezed,}) { return _then(_self.copyWith( id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable as String,slug: null == slug ? _self.slug : slug // ignore: cast_nullable_to_non_nullable @@ -76,10 +76,8 @@ as String,verifiedAs: freezed == verifiedAs ? _self.verifiedAs : verifiedAs // i as String?,verifiedAt: freezed == verifiedAt ? _self.verifiedAt : verifiedAt // ignore: cast_nullable_to_non_nullable as DateTime?,isCommunity: null == isCommunity ? _self.isCommunity : isCommunity // ignore: cast_nullable_to_non_nullable as bool,isPublic: null == isPublic ? _self.isPublic : isPublic // ignore: cast_nullable_to_non_nullable -as bool,pictureId: freezed == pictureId ? _self.pictureId : pictureId // ignore: cast_nullable_to_non_nullable -as String?,picture: freezed == picture ? _self.picture : picture // ignore: cast_nullable_to_non_nullable -as SnCloudFile?,backgroundId: freezed == backgroundId ? _self.backgroundId : backgroundId // ignore: cast_nullable_to_non_nullable -as String?,background: freezed == background ? _self.background : background // ignore: cast_nullable_to_non_nullable +as bool,picture: freezed == picture ? _self.picture : picture // ignore: cast_nullable_to_non_nullable +as SnCloudFile?,background: freezed == background ? _self.background : background // ignore: cast_nullable_to_non_nullable as SnCloudFile?,accountId: null == accountId ? _self.accountId : accountId // ignore: cast_nullable_to_non_nullable as String,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable as DateTime,updatedAt: null == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable @@ -119,7 +117,7 @@ $SnCloudFileCopyWith<$Res>? get background { @JsonSerializable() class _SnRealm implements SnRealm { - const _SnRealm({required this.id, required this.slug, required this.name, required this.description, required this.verifiedAs, required this.verifiedAt, required this.isCommunity, required this.isPublic, required this.pictureId, required this.picture, required this.backgroundId, required this.background, required this.accountId, required this.createdAt, required this.updatedAt, required this.deletedAt}); + const _SnRealm({required this.id, required this.slug, required this.name, required this.description, required this.verifiedAs, required this.verifiedAt, required this.isCommunity, required this.isPublic, required this.picture, required this.background, required this.accountId, required this.createdAt, required this.updatedAt, required this.deletedAt}); factory _SnRealm.fromJson(Map json) => _$SnRealmFromJson(json); @override final String id; @@ -130,9 +128,7 @@ class _SnRealm implements SnRealm { @override final DateTime? verifiedAt; @override final bool isCommunity; @override final bool isPublic; -@override final String? pictureId; @override final SnCloudFile? picture; -@override final String? backgroundId; @override final SnCloudFile? background; @override final String accountId; @override final DateTime createdAt; @@ -152,16 +148,16 @@ Map toJson() { @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is _SnRealm&&(identical(other.id, id) || other.id == id)&&(identical(other.slug, slug) || other.slug == slug)&&(identical(other.name, name) || other.name == name)&&(identical(other.description, description) || other.description == description)&&(identical(other.verifiedAs, verifiedAs) || other.verifiedAs == verifiedAs)&&(identical(other.verifiedAt, verifiedAt) || other.verifiedAt == verifiedAt)&&(identical(other.isCommunity, isCommunity) || other.isCommunity == isCommunity)&&(identical(other.isPublic, isPublic) || other.isPublic == isPublic)&&(identical(other.pictureId, pictureId) || other.pictureId == pictureId)&&(identical(other.picture, picture) || other.picture == picture)&&(identical(other.backgroundId, backgroundId) || other.backgroundId == backgroundId)&&(identical(other.background, background) || other.background == background)&&(identical(other.accountId, accountId) || other.accountId == accountId)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.deletedAt, deletedAt) || other.deletedAt == deletedAt)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is _SnRealm&&(identical(other.id, id) || other.id == id)&&(identical(other.slug, slug) || other.slug == slug)&&(identical(other.name, name) || other.name == name)&&(identical(other.description, description) || other.description == description)&&(identical(other.verifiedAs, verifiedAs) || other.verifiedAs == verifiedAs)&&(identical(other.verifiedAt, verifiedAt) || other.verifiedAt == verifiedAt)&&(identical(other.isCommunity, isCommunity) || other.isCommunity == isCommunity)&&(identical(other.isPublic, isPublic) || other.isPublic == isPublic)&&(identical(other.picture, picture) || other.picture == picture)&&(identical(other.background, background) || other.background == background)&&(identical(other.accountId, accountId) || other.accountId == accountId)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.deletedAt, deletedAt) || other.deletedAt == deletedAt)); } @JsonKey(includeFromJson: false, includeToJson: false) @override -int get hashCode => Object.hash(runtimeType,id,slug,name,description,verifiedAs,verifiedAt,isCommunity,isPublic,pictureId,picture,backgroundId,background,accountId,createdAt,updatedAt,deletedAt); +int get hashCode => Object.hash(runtimeType,id,slug,name,description,verifiedAs,verifiedAt,isCommunity,isPublic,picture,background,accountId,createdAt,updatedAt,deletedAt); @override String toString() { - return 'SnRealm(id: $id, slug: $slug, name: $name, description: $description, verifiedAs: $verifiedAs, verifiedAt: $verifiedAt, isCommunity: $isCommunity, isPublic: $isPublic, pictureId: $pictureId, picture: $picture, backgroundId: $backgroundId, background: $background, accountId: $accountId, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt)'; + return 'SnRealm(id: $id, slug: $slug, name: $name, description: $description, verifiedAs: $verifiedAs, verifiedAt: $verifiedAt, isCommunity: $isCommunity, isPublic: $isPublic, picture: $picture, background: $background, accountId: $accountId, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt)'; } @@ -172,7 +168,7 @@ abstract mixin class _$SnRealmCopyWith<$Res> implements $SnRealmCopyWith<$Res> { factory _$SnRealmCopyWith(_SnRealm value, $Res Function(_SnRealm) _then) = __$SnRealmCopyWithImpl; @override @useResult $Res call({ - String id, String slug, String name, String description, String? verifiedAs, DateTime? verifiedAt, bool isCommunity, bool isPublic, String? pictureId, SnCloudFile? picture, String? backgroundId, SnCloudFile? background, String accountId, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt + String id, String slug, String name, String description, String? verifiedAs, DateTime? verifiedAt, bool isCommunity, bool isPublic, SnCloudFile? picture, SnCloudFile? background, String accountId, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt }); @@ -189,7 +185,7 @@ class __$SnRealmCopyWithImpl<$Res> /// Create a copy of SnRealm /// with the given fields replaced by the non-null parameter values. -@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? slug = null,Object? name = null,Object? description = null,Object? verifiedAs = freezed,Object? verifiedAt = freezed,Object? isCommunity = null,Object? isPublic = null,Object? pictureId = freezed,Object? picture = freezed,Object? backgroundId = freezed,Object? background = freezed,Object? accountId = null,Object? createdAt = null,Object? updatedAt = null,Object? deletedAt = freezed,}) { +@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? slug = null,Object? name = null,Object? description = null,Object? verifiedAs = freezed,Object? verifiedAt = freezed,Object? isCommunity = null,Object? isPublic = null,Object? picture = freezed,Object? background = freezed,Object? accountId = null,Object? createdAt = null,Object? updatedAt = null,Object? deletedAt = freezed,}) { return _then(_SnRealm( id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable as String,slug: null == slug ? _self.slug : slug // ignore: cast_nullable_to_non_nullable @@ -199,10 +195,8 @@ as String,verifiedAs: freezed == verifiedAs ? _self.verifiedAs : verifiedAs // i as String?,verifiedAt: freezed == verifiedAt ? _self.verifiedAt : verifiedAt // ignore: cast_nullable_to_non_nullable as DateTime?,isCommunity: null == isCommunity ? _self.isCommunity : isCommunity // ignore: cast_nullable_to_non_nullable as bool,isPublic: null == isPublic ? _self.isPublic : isPublic // ignore: cast_nullable_to_non_nullable -as bool,pictureId: freezed == pictureId ? _self.pictureId : pictureId // ignore: cast_nullable_to_non_nullable -as String?,picture: freezed == picture ? _self.picture : picture // ignore: cast_nullable_to_non_nullable -as SnCloudFile?,backgroundId: freezed == backgroundId ? _self.backgroundId : backgroundId // ignore: cast_nullable_to_non_nullable -as String?,background: freezed == background ? _self.background : background // ignore: cast_nullable_to_non_nullable +as bool,picture: freezed == picture ? _self.picture : picture // ignore: cast_nullable_to_non_nullable +as SnCloudFile?,background: freezed == background ? _self.background : background // ignore: cast_nullable_to_non_nullable as SnCloudFile?,accountId: null == accountId ? _self.accountId : accountId // ignore: cast_nullable_to_non_nullable as String,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable as DateTime,updatedAt: null == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable diff --git a/lib/models/realm.g.dart b/lib/models/realm.g.dart index c96a71b..193c3d3 100644 --- a/lib/models/realm.g.dart +++ b/lib/models/realm.g.dart @@ -18,12 +18,10 @@ _SnRealm _$SnRealmFromJson(Map json) => _SnRealm( : DateTime.parse(json['verified_at'] as String), isCommunity: json['is_community'] as bool, isPublic: json['is_public'] as bool, - pictureId: json['picture_id'] as String?, picture: json['picture'] == null ? null : SnCloudFile.fromJson(json['picture'] as Map), - backgroundId: json['background_id'] as String?, background: json['background'] == null ? null @@ -46,9 +44,7 @@ Map _$SnRealmToJson(_SnRealm instance) => { 'verified_at': instance.verifiedAt?.toIso8601String(), 'is_community': instance.isCommunity, 'is_public': instance.isPublic, - 'picture_id': instance.pictureId, 'picture': instance.picture?.toJson(), - 'background_id': instance.backgroundId, 'background': instance.background?.toJson(), 'account_id': instance.accountId, 'created_at': instance.createdAt.toIso8601String(), diff --git a/lib/models/user.dart b/lib/models/user.dart index b7a83a4..19157aa 100644 --- a/lib/models/user.dart +++ b/lib/models/user.dart @@ -31,12 +31,10 @@ sealed class SnAccountProfile with _$SnAccountProfile { required String? middleName, required String? lastName, @Default('') String bio, - required String? pictureId, required int experience, required int level, required double levelingProgress, required SnCloudFile? picture, - required String? backgroundId, required SnCloudFile? background, required DateTime createdAt, required DateTime updatedAt, diff --git a/lib/models/user.freezed.dart b/lib/models/user.freezed.dart index 9423b21..2b18074 100644 --- a/lib/models/user.freezed.dart +++ b/lib/models/user.freezed.dart @@ -200,7 +200,7 @@ $SnAccountProfileCopyWith<$Res> get profile { /// @nodoc mixin _$SnAccountProfile { - String get id; String? get firstName; String? get middleName; String? get lastName; String get bio; String? get pictureId; int get experience; int get level; double get levelingProgress; SnCloudFile? get picture; String? get backgroundId; SnCloudFile? get background; DateTime get createdAt; DateTime get updatedAt; DateTime? get deletedAt; + String get id; String? get firstName; String? get middleName; String? get lastName; String get bio; int get experience; int get level; double get levelingProgress; SnCloudFile? get picture; SnCloudFile? get background; DateTime get createdAt; DateTime get updatedAt; DateTime? get deletedAt; /// Create a copy of SnAccountProfile /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @@ -213,16 +213,16 @@ $SnAccountProfileCopyWith get copyWith => _$SnAccountProfileCo @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is SnAccountProfile&&(identical(other.id, id) || other.id == id)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.middleName, middleName) || other.middleName == middleName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.bio, bio) || other.bio == bio)&&(identical(other.pictureId, pictureId) || other.pictureId == pictureId)&&(identical(other.experience, experience) || other.experience == experience)&&(identical(other.level, level) || other.level == level)&&(identical(other.levelingProgress, levelingProgress) || other.levelingProgress == levelingProgress)&&(identical(other.picture, picture) || other.picture == picture)&&(identical(other.backgroundId, backgroundId) || other.backgroundId == backgroundId)&&(identical(other.background, background) || other.background == background)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.deletedAt, deletedAt) || other.deletedAt == deletedAt)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is SnAccountProfile&&(identical(other.id, id) || other.id == id)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.middleName, middleName) || other.middleName == middleName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.bio, bio) || other.bio == bio)&&(identical(other.experience, experience) || other.experience == experience)&&(identical(other.level, level) || other.level == level)&&(identical(other.levelingProgress, levelingProgress) || other.levelingProgress == levelingProgress)&&(identical(other.picture, picture) || other.picture == picture)&&(identical(other.background, background) || other.background == background)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.deletedAt, deletedAt) || other.deletedAt == deletedAt)); } @JsonKey(includeFromJson: false, includeToJson: false) @override -int get hashCode => Object.hash(runtimeType,id,firstName,middleName,lastName,bio,pictureId,experience,level,levelingProgress,picture,backgroundId,background,createdAt,updatedAt,deletedAt); +int get hashCode => Object.hash(runtimeType,id,firstName,middleName,lastName,bio,experience,level,levelingProgress,picture,background,createdAt,updatedAt,deletedAt); @override String toString() { - return 'SnAccountProfile(id: $id, firstName: $firstName, middleName: $middleName, lastName: $lastName, bio: $bio, pictureId: $pictureId, experience: $experience, level: $level, levelingProgress: $levelingProgress, picture: $picture, backgroundId: $backgroundId, background: $background, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt)'; + return 'SnAccountProfile(id: $id, firstName: $firstName, middleName: $middleName, lastName: $lastName, bio: $bio, experience: $experience, level: $level, levelingProgress: $levelingProgress, picture: $picture, background: $background, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt)'; } @@ -233,7 +233,7 @@ abstract mixin class $SnAccountProfileCopyWith<$Res> { factory $SnAccountProfileCopyWith(SnAccountProfile value, $Res Function(SnAccountProfile) _then) = _$SnAccountProfileCopyWithImpl; @useResult $Res call({ - String id, String? firstName, String? middleName, String? lastName, String bio, String? pictureId, int experience, int level, double levelingProgress, SnCloudFile? picture, String? backgroundId, SnCloudFile? background, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt + String id, String? firstName, String? middleName, String? lastName, String bio, int experience, int level, double levelingProgress, SnCloudFile? picture, SnCloudFile? background, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt }); @@ -250,20 +250,18 @@ class _$SnAccountProfileCopyWithImpl<$Res> /// Create a copy of SnAccountProfile /// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? firstName = freezed,Object? middleName = freezed,Object? lastName = freezed,Object? bio = null,Object? pictureId = freezed,Object? experience = null,Object? level = null,Object? levelingProgress = null,Object? picture = freezed,Object? backgroundId = freezed,Object? background = freezed,Object? createdAt = null,Object? updatedAt = null,Object? deletedAt = freezed,}) { +@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? firstName = freezed,Object? middleName = freezed,Object? lastName = freezed,Object? bio = null,Object? experience = null,Object? level = null,Object? levelingProgress = null,Object? picture = freezed,Object? background = freezed,Object? createdAt = null,Object? updatedAt = null,Object? deletedAt = freezed,}) { return _then(_self.copyWith( id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable as String,firstName: freezed == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable as String?,middleName: freezed == middleName ? _self.middleName : middleName // ignore: cast_nullable_to_non_nullable as String?,lastName: freezed == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable as String?,bio: null == bio ? _self.bio : bio // ignore: cast_nullable_to_non_nullable -as String,pictureId: freezed == pictureId ? _self.pictureId : pictureId // ignore: cast_nullable_to_non_nullable -as String?,experience: null == experience ? _self.experience : experience // ignore: cast_nullable_to_non_nullable +as String,experience: null == experience ? _self.experience : experience // ignore: cast_nullable_to_non_nullable as int,level: null == level ? _self.level : level // ignore: cast_nullable_to_non_nullable as int,levelingProgress: null == levelingProgress ? _self.levelingProgress : levelingProgress // ignore: cast_nullable_to_non_nullable as double,picture: freezed == picture ? _self.picture : picture // ignore: cast_nullable_to_non_nullable -as SnCloudFile?,backgroundId: freezed == backgroundId ? _self.backgroundId : backgroundId // ignore: cast_nullable_to_non_nullable -as String?,background: freezed == background ? _self.background : background // ignore: cast_nullable_to_non_nullable +as SnCloudFile?,background: freezed == background ? _self.background : background // ignore: cast_nullable_to_non_nullable as SnCloudFile?,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable as DateTime,updatedAt: null == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable as DateTime,deletedAt: freezed == deletedAt ? _self.deletedAt : deletedAt // ignore: cast_nullable_to_non_nullable @@ -302,7 +300,7 @@ $SnCloudFileCopyWith<$Res>? get background { @JsonSerializable() class _SnAccountProfile implements SnAccountProfile { - const _SnAccountProfile({required this.id, required this.firstName, required this.middleName, required this.lastName, this.bio = '', required this.pictureId, required this.experience, required this.level, required this.levelingProgress, required this.picture, required this.backgroundId, required this.background, required this.createdAt, required this.updatedAt, required this.deletedAt}); + const _SnAccountProfile({required this.id, required this.firstName, required this.middleName, required this.lastName, this.bio = '', required this.experience, required this.level, required this.levelingProgress, required this.picture, required this.background, required this.createdAt, required this.updatedAt, required this.deletedAt}); factory _SnAccountProfile.fromJson(Map json) => _$SnAccountProfileFromJson(json); @override final String id; @@ -310,12 +308,10 @@ class _SnAccountProfile implements SnAccountProfile { @override final String? middleName; @override final String? lastName; @override@JsonKey() final String bio; -@override final String? pictureId; @override final int experience; @override final int level; @override final double levelingProgress; @override final SnCloudFile? picture; -@override final String? backgroundId; @override final SnCloudFile? background; @override final DateTime createdAt; @override final DateTime updatedAt; @@ -334,16 +330,16 @@ Map toJson() { @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is _SnAccountProfile&&(identical(other.id, id) || other.id == id)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.middleName, middleName) || other.middleName == middleName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.bio, bio) || other.bio == bio)&&(identical(other.pictureId, pictureId) || other.pictureId == pictureId)&&(identical(other.experience, experience) || other.experience == experience)&&(identical(other.level, level) || other.level == level)&&(identical(other.levelingProgress, levelingProgress) || other.levelingProgress == levelingProgress)&&(identical(other.picture, picture) || other.picture == picture)&&(identical(other.backgroundId, backgroundId) || other.backgroundId == backgroundId)&&(identical(other.background, background) || other.background == background)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.deletedAt, deletedAt) || other.deletedAt == deletedAt)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is _SnAccountProfile&&(identical(other.id, id) || other.id == id)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.middleName, middleName) || other.middleName == middleName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.bio, bio) || other.bio == bio)&&(identical(other.experience, experience) || other.experience == experience)&&(identical(other.level, level) || other.level == level)&&(identical(other.levelingProgress, levelingProgress) || other.levelingProgress == levelingProgress)&&(identical(other.picture, picture) || other.picture == picture)&&(identical(other.background, background) || other.background == background)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.deletedAt, deletedAt) || other.deletedAt == deletedAt)); } @JsonKey(includeFromJson: false, includeToJson: false) @override -int get hashCode => Object.hash(runtimeType,id,firstName,middleName,lastName,bio,pictureId,experience,level,levelingProgress,picture,backgroundId,background,createdAt,updatedAt,deletedAt); +int get hashCode => Object.hash(runtimeType,id,firstName,middleName,lastName,bio,experience,level,levelingProgress,picture,background,createdAt,updatedAt,deletedAt); @override String toString() { - return 'SnAccountProfile(id: $id, firstName: $firstName, middleName: $middleName, lastName: $lastName, bio: $bio, pictureId: $pictureId, experience: $experience, level: $level, levelingProgress: $levelingProgress, picture: $picture, backgroundId: $backgroundId, background: $background, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt)'; + return 'SnAccountProfile(id: $id, firstName: $firstName, middleName: $middleName, lastName: $lastName, bio: $bio, experience: $experience, level: $level, levelingProgress: $levelingProgress, picture: $picture, background: $background, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt)'; } @@ -354,7 +350,7 @@ abstract mixin class _$SnAccountProfileCopyWith<$Res> implements $SnAccountProfi factory _$SnAccountProfileCopyWith(_SnAccountProfile value, $Res Function(_SnAccountProfile) _then) = __$SnAccountProfileCopyWithImpl; @override @useResult $Res call({ - String id, String? firstName, String? middleName, String? lastName, String bio, String? pictureId, int experience, int level, double levelingProgress, SnCloudFile? picture, String? backgroundId, SnCloudFile? background, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt + String id, String? firstName, String? middleName, String? lastName, String bio, int experience, int level, double levelingProgress, SnCloudFile? picture, SnCloudFile? background, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt }); @@ -371,20 +367,18 @@ class __$SnAccountProfileCopyWithImpl<$Res> /// Create a copy of SnAccountProfile /// with the given fields replaced by the non-null parameter values. -@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? firstName = freezed,Object? middleName = freezed,Object? lastName = freezed,Object? bio = null,Object? pictureId = freezed,Object? experience = null,Object? level = null,Object? levelingProgress = null,Object? picture = freezed,Object? backgroundId = freezed,Object? background = freezed,Object? createdAt = null,Object? updatedAt = null,Object? deletedAt = freezed,}) { +@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? firstName = freezed,Object? middleName = freezed,Object? lastName = freezed,Object? bio = null,Object? experience = null,Object? level = null,Object? levelingProgress = null,Object? picture = freezed,Object? background = freezed,Object? createdAt = null,Object? updatedAt = null,Object? deletedAt = freezed,}) { return _then(_SnAccountProfile( id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable as String,firstName: freezed == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable as String?,middleName: freezed == middleName ? _self.middleName : middleName // ignore: cast_nullable_to_non_nullable as String?,lastName: freezed == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable as String?,bio: null == bio ? _self.bio : bio // ignore: cast_nullable_to_non_nullable -as String,pictureId: freezed == pictureId ? _self.pictureId : pictureId // ignore: cast_nullable_to_non_nullable -as String?,experience: null == experience ? _self.experience : experience // ignore: cast_nullable_to_non_nullable +as String,experience: null == experience ? _self.experience : experience // ignore: cast_nullable_to_non_nullable as int,level: null == level ? _self.level : level // ignore: cast_nullable_to_non_nullable as int,levelingProgress: null == levelingProgress ? _self.levelingProgress : levelingProgress // ignore: cast_nullable_to_non_nullable as double,picture: freezed == picture ? _self.picture : picture // ignore: cast_nullable_to_non_nullable -as SnCloudFile?,backgroundId: freezed == backgroundId ? _self.backgroundId : backgroundId // ignore: cast_nullable_to_non_nullable -as String?,background: freezed == background ? _self.background : background // ignore: cast_nullable_to_non_nullable +as SnCloudFile?,background: freezed == background ? _self.background : background // ignore: cast_nullable_to_non_nullable as SnCloudFile?,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable as DateTime,updatedAt: null == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable as DateTime,deletedAt: freezed == deletedAt ? _self.deletedAt : deletedAt // ignore: cast_nullable_to_non_nullable diff --git a/lib/models/user.g.dart b/lib/models/user.g.dart index 514e5de..e504b25 100644 --- a/lib/models/user.g.dart +++ b/lib/models/user.g.dart @@ -47,7 +47,6 @@ _SnAccountProfile _$SnAccountProfileFromJson(Map json) => middleName: json['middle_name'] as String?, lastName: json['last_name'] as String?, bio: json['bio'] as String? ?? '', - pictureId: json['picture_id'] as String?, experience: (json['experience'] as num).toInt(), level: (json['level'] as num).toInt(), levelingProgress: (json['leveling_progress'] as num).toDouble(), @@ -55,7 +54,6 @@ _SnAccountProfile _$SnAccountProfileFromJson(Map json) => json['picture'] == null ? null : SnCloudFile.fromJson(json['picture'] as Map), - backgroundId: json['background_id'] as String?, background: json['background'] == null ? null @@ -77,12 +75,10 @@ Map _$SnAccountProfileToJson(_SnAccountProfile instance) => 'middle_name': instance.middleName, 'last_name': instance.lastName, 'bio': instance.bio, - 'picture_id': instance.pictureId, 'experience': instance.experience, 'level': instance.level, 'leveling_progress': instance.levelingProgress, 'picture': instance.picture?.toJson(), - 'background_id': instance.backgroundId, 'background': instance.background?.toJson(), 'created_at': instance.createdAt.toIso8601String(), 'updated_at': instance.updatedAt.toIso8601String(), diff --git a/lib/pods/config.g.dart b/lib/pods/config.g.dart index 5ea6dba..d92b563 100644 --- a/lib/pods/config.g.dart +++ b/lib/pods/config.g.dart @@ -7,7 +7,7 @@ part of 'config.dart'; // ************************************************************************** String _$appSettingsNotifierHash() => - r'049447d982114220771702146a08b9b4626c31e5'; + r'4f727d448ee17a87b5698b8e36ef67521655406c'; /// See also [AppSettingsNotifier]. @ProviderFor(AppSettingsNotifier) diff --git a/lib/screens/account.dart b/lib/screens/account.dart index 1380e66..e1d66d3 100644 --- a/lib/screens/account.dart +++ b/lib/screens/account.dart @@ -74,7 +74,7 @@ class AccountScreen extends HookConsumerWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - if (user.value?.profile.backgroundId != null) + if (user.value?.profile.background?.id != null) ClipRRect( borderRadius: BorderRadius.only( topLeft: Radius.circular(8), @@ -83,7 +83,7 @@ class AccountScreen extends HookConsumerWidget { child: AspectRatio( aspectRatio: 16 / 7, child: CloudImageWidget( - fileId: user.value!.profile.backgroundId!, + fileId: user.value!.profile.background!.id, fit: BoxFit.cover, ), ), @@ -94,7 +94,7 @@ class AccountScreen extends HookConsumerWidget { children: [ GestureDetector( child: ProfilePictureWidget( - fileId: user.value?.profile.pictureId, + fileId: user.value?.profile.picture?.id, radius: 24, ), onTap: () { diff --git a/lib/screens/account/me/event_calendar.dart b/lib/screens/account/me/event_calendar.dart index 8b1f93d..52d9a25 100644 --- a/lib/screens/account/me/event_calendar.dart +++ b/lib/screens/account/me/event_calendar.dart @@ -202,7 +202,7 @@ class EventCalanderScreen extends HookConsumerWidget { color: Colors.transparent, child: ListTile( leading: ProfilePictureWidget( - fileId: user.value!.profile.pictureId, + fileId: user.value!.profile.picture?.id, ), title: Text(user.value!.nick).bold(), subtitle: Text('@${user.value!.name}'), diff --git a/lib/screens/account/me/update.dart b/lib/screens/account/me/update.dart index fddf7cb..2ebeeda 100644 --- a/lib/screens/account/me/update.dart +++ b/lib/screens/account/me/update.dart @@ -159,9 +159,9 @@ class UpdateProfileScreen extends HookConsumerWidget { child: Container( color: Theme.of(context).colorScheme.surfaceContainerHigh, child: - user.value!.profile.backgroundId != null + user.value!.profile.background?.id != null ? CloudImageWidget( - fileId: user.value!.profile.backgroundId!, + fileId: user.value!.profile.background!.id, fit: BoxFit.cover, ) : const SizedBox.shrink(), @@ -175,7 +175,7 @@ class UpdateProfileScreen extends HookConsumerWidget { bottom: -32, child: GestureDetector( child: ProfilePictureWidget( - fileId: user.value!.profile.pictureId, + fileId: user.value!.profile.picture?.id, radius: 40, ), onTap: () { diff --git a/lib/screens/account/profile.dart b/lib/screens/account/profile.dart index e0f0608..96a7c4d 100644 --- a/lib/screens/account/profile.dart +++ b/lib/screens/account/profile.dart @@ -67,9 +67,9 @@ class AccountProfileScreen extends HookConsumerWidget { leading: PageBackButton(shadows: [iconShadow]), flexibleSpace: FlexibleSpaceBar( background: - data.profile.backgroundId != null + data.profile.background?.id != null ? CloudImageWidget( - fileId: data.profile.backgroundId!, + fileId: data.profile.background!.id, ) : Container( color: @@ -91,7 +91,7 @@ class AccountProfileScreen extends HookConsumerWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ ProfilePictureWidget( - fileId: data.profile.pictureId, + fileId: data.profile.picture?.id, radius: 32, ), const Gap(20), diff --git a/lib/screens/account/relationship.dart b/lib/screens/account/relationship.dart index 99bc7df..4926480 100644 --- a/lib/screens/account/relationship.dart +++ b/lib/screens/account/relationship.dart @@ -100,7 +100,7 @@ class RelationshipListTile extends StatelessWidget { return ListTile( contentPadding: const EdgeInsets.only(left: 16, right: 12), - leading: ProfilePictureWidget(fileId: account.profile.pictureId), + leading: ProfilePictureWidget(fileId: account.profile.picture?.id), title: Row( spacing: 6, children: [ diff --git a/lib/screens/auth/tabs.dart b/lib/screens/auth/tabs.dart index 2de5dfd..352c9a7 100644 --- a/lib/screens/auth/tabs.dart +++ b/lib/screens/auth/tabs.dart @@ -1,3 +1,5 @@ +import 'dart:developer'; + import 'package:auto_route/auto_route.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; @@ -17,6 +19,7 @@ class TabNavigationObserver extends AutoRouterObserver { @override void didPush(Route route, Route? previousRoute) { + log('pushed ${previousRoute?.settings.name} -> ${route.settings.name}'); if (route is DialogRoute) return; Future(() { onChange(route.settings.name); @@ -25,6 +28,7 @@ class TabNavigationObserver extends AutoRouterObserver { @override void didPop(Route route, Route? previousRoute) { + log('popped ${route.settings.name} -> ${previousRoute?.settings.name}'); if (route is DialogRoute) return; Future(() { onChange(previousRoute?.settings.name); @@ -81,6 +85,7 @@ class TabsNavigationWidget extends HookConsumerWidget { ]; final routeNames = [ ExploreRoute.name, + ExploreShellRoute.name, ChatListRoute.name, RealmListRoute.name, AccountRoute.name, diff --git a/lib/screens/chat/call.dart b/lib/screens/chat/call.dart index e6e46e7..95ad4cb 100644 --- a/lib/screens/chat/call.dart +++ b/lib/screens/chat/call.dart @@ -166,7 +166,8 @@ class CallScreen extends HookConsumerWidget { .profile ?.account .profile - .pictureId, + .picture + ?.id, size: 72, ), ), diff --git a/lib/screens/chat/chat.dart b/lib/screens/chat/chat.dart index be77fb2..29394de 100644 --- a/lib/screens/chat/chat.dart +++ b/lib/screens/chat/chat.dart @@ -109,7 +109,7 @@ class ChatRoomListTile extends HookConsumerWidget { }, loading: () => const SizedBox.shrink(), error: - (_, __) => + (_, _) => isDirect && room.description == null ? Text( room.members!.map((e) => '@${e.account.name}').join(', '), @@ -127,19 +127,19 @@ class ChatRoomListTile extends HookConsumerWidget { isLabelVisible: summary.when( data: (data) => (data?.unreadCount ?? 0) > 0, loading: () => false, - error: (_, __) => false, + error: (_, _) => false, ), child: - (isDirect && room.pictureId == null) + (isDirect && room.picture?.id == null) ? SplitAvatarWidget( filesId: room.members! - .map((e) => e.account.profile.pictureId) + .map((e) => e.account.profile.picture?.id) .toList(), ) - : room.pictureId == null + : room.picture?.id == null ? CircleAvatar(child: Text(room.name![0].toUpperCase())) - : ProfilePictureWidget(fileId: room.pictureId), + : ProfilePictureWidget(fileId: room.picture?.id), ), title: Text( (isDirect && room.name == null) @@ -147,7 +147,7 @@ class ChatRoomListTile extends HookConsumerWidget { : room.name ?? '', ), subtitle: buildSubtitle(), - trailing: trailing, // Add this line + trailing: trailing, // Add this line onTap: () async { // Clear unread count if there are unread messages ref.read(chatSummaryProvider.future).then((summary) { @@ -280,13 +280,13 @@ class ChatListScreen extends HookConsumerWidget { label: Text( chatInvites.when( data: (invites) => invites.length.toString(), - error: (_, __) => '0', + error: (_, _) => '0', loading: () => '0', ), ), isLabelVisible: chatInvites.when( data: (invites) => invites.isNotEmpty, - error: (_, __) => false, + error: (_, _) => false, loading: () => false, ), child: const Icon(Symbols.email), @@ -589,7 +589,7 @@ class EditChatScreen extends HookConsumerWidget { realms: joinedRealms.when( data: (realms) => realms, loading: () => [], - error: (_, __) => [], + error: (_, _) => [], ), onChanged: (SnRealm? value) { currentRealm.value = value; diff --git a/lib/screens/chat/room.dart b/lib/screens/chat/room.dart index 469cf04..e3ea7b5 100644 --- a/lib/screens/chat/room.dart +++ b/lib/screens/chat/room.dart @@ -433,19 +433,23 @@ class ChatRoomScreen extends HookConsumerWidget { height: 26, width: 26, child: - (room!.type == 1 && room.pictureId == null) + (room!.type == 1 && room.picture?.id == null) ? SplitAvatarWidget( filesId: room.members! .map( (e) => - e.account.profile.pictureId, + e + .account + .profile + .picture + ?.id, ) .toList(), ) - : room.pictureId != null + : room.picture?.id != null ? ProfilePictureWidget( - fileId: room.pictureId, + fileId: room.picture?.id, fallbackIcon: Symbols.chat, ) : CircleAvatar( @@ -473,19 +477,23 @@ class ChatRoomScreen extends HookConsumerWidget { height: 26, width: 26, child: - (room!.type == 1 && room.pictureId == null) + (room!.type == 1 && room.picture?.id == null) ? SplitAvatarWidget( filesId: room.members! .map( (e) => - e.account.profile.pictureId, + e + .account + .profile + .picture + ?.id, ) .toList(), ) - : room.pictureId != null + : room.picture?.id != null ? ProfilePictureWidget( - fileId: room.pictureId, + fileId: room.picture?.id, fallbackIcon: Symbols.chat, ) : CircleAvatar( diff --git a/lib/screens/chat/room_detail.dart b/lib/screens/chat/room_detail.dart index c09bc7e..c5c604f 100644 --- a/lib/screens/chat/room_detail.dart +++ b/lib/screens/chat/room_detail.dart @@ -48,9 +48,9 @@ class ChatDetailScreen extends HookConsumerWidget { flexibleSpace: FlexibleSpaceBar( background: (currentRoom!.type == 1 && - currentRoom.backgroundId != null) + currentRoom.background?.id != null) ? CloudImageWidget( - fileId: currentRoom.backgroundId!, + fileId: currentRoom.background!.id, ) : (currentRoom.type == 1 && currentRoom.members!.length == 1 && @@ -59,7 +59,8 @@ class ChatDetailScreen extends HookConsumerWidget { .first .account .profile - .backgroundId != + .background + ?.id != null) ? CloudImageWidget( fileId: @@ -68,11 +69,12 @@ class ChatDetailScreen extends HookConsumerWidget { .first .account .profile - .backgroundId!, + .background! + .id, ) - : currentRoom.backgroundId != null + : currentRoom.background?.id != null ? CloudImageWidget( - fileId: currentRoom.backgroundId!, + fileId: currentRoom.background!.id, fit: BoxFit.cover, ) : Container( @@ -390,7 +392,7 @@ class _ChatMemberListSheet extends HookConsumerWidget { return ListTile( contentPadding: EdgeInsets.only(left: 16, right: 12), leading: ProfilePictureWidget( - fileId: member.account.profile.pictureId, + fileId: member.account.profile.picture?.id, ), title: Row( spacing: 6, diff --git a/lib/screens/creators/hub.dart b/lib/screens/creators/hub.dart index 41a3238..eae5d20 100644 --- a/lib/screens/creators/hub.dart +++ b/lib/screens/creators/hub.dart @@ -101,7 +101,7 @@ class CreatorHubScreen extends HookConsumerWidget { minTileHeight: 48, leading: ProfilePictureWidget( radius: 16, - fileId: item.pictureId, + fileId: item.picture?.id, ), title: Text(item.nick), subtitle: Text('@${item.name}'), @@ -115,7 +115,7 @@ class CreatorHubScreen extends HookConsumerWidget { ) .toList(), loading: () => [], - error: (_, __) => [], + error: (_, _) => [], ); final publisherStats = ref.watch( @@ -150,7 +150,7 @@ class CreatorHubScreen extends HookConsumerWidget { ...publishersMenu.map( (e) => ProfilePictureWidget( radius: 16, - fileId: e.value?.pictureId, + fileId: e.value?.picture?.id, ).center().padding(right: 8), ), ]; @@ -204,7 +204,7 @@ class CreatorHubScreen extends HookConsumerWidget { ...(publishers.value?.map( (publisher) => ListTile( leading: ProfilePictureWidget( - fileId: publisher.pictureId, + fileId: publisher.picture?.id, ), title: Text(publisher.nick), subtitle: Text('@${publisher.name}'), @@ -293,7 +293,7 @@ class CreatorHubScreen extends HookConsumerWidget { ), ), loading: () => const Center(child: CircularProgressIndicator()), - error: (_, __) => const SizedBox.shrink(), + error: (_, _) => const SizedBox.shrink(), ), ); } diff --git a/lib/screens/creators/publishers.dart b/lib/screens/creators/publishers.dart index 5730e66..c68ca64 100644 --- a/lib/screens/creators/publishers.dart +++ b/lib/screens/creators/publishers.dart @@ -138,8 +138,8 @@ class EditPublisherScreen extends HookConsumerWidget { useEffect(() { if (publisher.value != null) { - picture.value = publisher.value!.pictureId; - background.value = publisher.value!.backgroundId; + picture.value = publisher.value!.picture?.id; + background.value = publisher.value!.background?.id; nameController.text = publisher.value!.name; nickController.text = publisher.value!.nick; bioController.text = publisher.value!.bio; @@ -193,7 +193,7 @@ class EditPublisherScreen extends HookConsumerWidget { realms: joinedRealms.when( data: (realms) => realms, loading: () => [], - error: (_, __) => [], + error: (_, _) => [], ), onChanged: (SnRealm? value) { currentRealm.value = value; @@ -279,14 +279,14 @@ class EditPublisherScreen extends HookConsumerWidget { nameController.text = user.value!.name; nickController.text = user.value!.nick; bioController.text = user.value!.profile.bio; - picture.value = user.value!.profile.pictureId; - background.value = user.value!.profile.backgroundId; + picture.value = user.value!.profile.picture?.id; + background.value = user.value!.profile.background?.id; } else { nameController.text = currentRealm.value!.slug; nickController.text = currentRealm.value!.name; bioController.text = currentRealm.value!.description; - picture.value = currentRealm.value!.pictureId; - background.value = currentRealm.value!.backgroundId; + picture.value = currentRealm.value!.picture?.id; + background.value = currentRealm.value!.background?.id; } }, label: diff --git a/lib/screens/posts/compose.dart b/lib/screens/posts/compose.dart index e368948..9bd743c 100644 --- a/lib/screens/posts/compose.dart +++ b/lib/screens/posts/compose.dart @@ -303,7 +303,7 @@ class PostComposeScreen extends HookConsumerWidget { children: [ GestureDetector( child: ProfilePictureWidget( - fileId: currentPublisher.value?.pictureId, + fileId: currentPublisher.value?.picture?.id, radius: 20, fallbackIcon: currentPublisher.value == null diff --git a/lib/screens/posts/pub_profile.dart b/lib/screens/posts/pub_profile.dart index 0f3fbd9..8c54496 100644 --- a/lib/screens/posts/pub_profile.dart +++ b/lib/screens/posts/pub_profile.dart @@ -1,4 +1,5 @@ import 'package:auto_route/annotations.dart'; +import 'package:auto_route/auto_route.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; @@ -108,8 +109,8 @@ class PublisherProfileScreen extends HookConsumerWidget { leading: PageBackButton(shadows: [iconShadow]), flexibleSpace: FlexibleSpaceBar( background: - data.backgroundId != null - ? CloudImageWidget(fileId: data.backgroundId!) + data.background?.id != null + ? CloudImageWidget(fileId: data.background!.id) : Container( color: Theme.of(context).appBarTheme.backgroundColor, @@ -139,7 +140,7 @@ class PublisherProfileScreen extends HookConsumerWidget { shadows: [iconShadow], ), ), - error: (_, __) => const SizedBox(), + error: (_, _) => const SizedBox(), loading: () => const SizedBox( width: 48, @@ -163,7 +164,10 @@ class PublisherProfileScreen extends HookConsumerWidget { crossAxisAlignment: CrossAxisAlignment.start, spacing: 20, children: [ - ProfilePictureWidget(fileId: data.pictureId!, radius: 32), + ProfilePictureWidget( + fileId: data.picture!.id, + radius: 32, + ), Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, @@ -177,6 +181,26 @@ class PublisherProfileScreen extends HookConsumerWidget { ).fontSize(14).opacity(0.85), ], ), + if (data.type == 0 && data.account != null) + InkWell( + onTap: () { + context.router.pushPath( + '/account/${data.account!.name}', + ); + }, + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + spacing: 4, + children: [ + Text( + 'publisherVisitAccountPage'.tr( + args: ['@${data.account!.name}'], + ), + ).fontSize(14), + Icon(Icons.launch, size: 14), + ], + ).opacity(0.85), + ).padding(bottom: 6), if (data.type == 0 && data.account != null) AccountStatusWidget( uname: data.account!.name, diff --git a/lib/screens/realm/detail.dart b/lib/screens/realm/detail.dart index 349a296..3d48e70 100644 --- a/lib/screens/realm/detail.dart +++ b/lib/screens/realm/detail.dart @@ -54,8 +54,8 @@ class RealmDetailScreen extends HookConsumerWidget { leading: PageBackButton(shadows: [iconShadow]), flexibleSpace: FlexibleSpaceBar( background: - realm!.backgroundId != null - ? CloudImageWidget(fileId: realm.backgroundId!) + realm!.background?.id != null + ? CloudImageWidget(fileId: realm.background!.id) : Container( color: Theme.of(context).appBarTheme.backgroundColor, @@ -118,7 +118,7 @@ class _RealmActionMenu extends HookConsumerWidget { final isModerator = realmIdentityAsync.when( data: (identity) => (identity?.role ?? 0) >= 50, loading: () => false, - error: (_, __) => false, + error: (_, _) => false, ); return PopupMenuButton( @@ -212,7 +212,7 @@ class _RealmActionMenu extends HookConsumerWidget { child: Center(child: CircularProgressIndicator()), ), error: - (_, __) => PopupMenuItem( + (_, _) => PopupMenuItem( child: Row( children: [ Icon( @@ -403,7 +403,7 @@ class _RealmMemberListSheet extends HookConsumerWidget { return ListTile( contentPadding: EdgeInsets.only(left: 16, right: 12), leading: ProfilePictureWidget( - fileId: member.account!.profile.pictureId, + fileId: member.account!.profile.picture?.id, ), title: Row( spacing: 6, diff --git a/lib/screens/realm/realms.dart b/lib/screens/realm/realms.dart index 32f795b..debeec8 100644 --- a/lib/screens/realm/realms.dart +++ b/lib/screens/realm/realms.dart @@ -49,13 +49,13 @@ class RealmListScreen extends HookConsumerWidget { label: Text( realmInvites.when( data: (invites) => invites.length.toString(), - error: (_, __) => '0', + error: (_, _) => '0', loading: () => '0', ), ), isLabelVisible: realmInvites.when( data: (invites) => invites.isNotEmpty, - error: (_, __) => false, + error: (_, _) => false, loading: () => false, ), child: const Icon(Symbols.email), @@ -97,7 +97,7 @@ class RealmListScreen extends HookConsumerWidget { return ListTile( isThreeLine: true, leading: ProfilePictureWidget( - fileId: value[item].pictureId, + fileId: value[item].picture?.id, fallbackIcon: Symbols.group, ), title: Text(value[item].name), @@ -448,7 +448,7 @@ class _RealmInviteSheet extends HookConsumerWidget { final invite = items[index]; return ListTile( leading: ProfilePictureWidget( - fileId: invite.realm!.pictureId, + fileId: invite.realm!.picture?.id, fallbackIcon: Symbols.group, ), title: Text(invite.realm!.name), diff --git a/lib/widgets/account/account_picker.dart b/lib/widgets/account/account_picker.dart index 6c24180..8531151 100644 --- a/lib/widgets/account/account_picker.dart +++ b/lib/widgets/account/account_picker.dart @@ -81,7 +81,7 @@ class AccountPickerSheet extends HookConsumerWidget { final account = accounts[index]; return ListTile( leading: ProfilePictureWidget( - fileId: account.profile.pictureId, + fileId: account.profile.picture?.id, ), title: Text(account.nick), subtitle: Text('@${account.name}'), diff --git a/lib/widgets/account/status.dart b/lib/widgets/account/status.dart index bf3af72..8f30757 100644 --- a/lib/widgets/account/status.dart +++ b/lib/widgets/account/status.dart @@ -146,7 +146,7 @@ class StatusActivityWidget extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ ProfilePictureWidget( - fileId: item.account.profile.pictureId, + fileId: item.account.profile.picture?.id, radius: 12, ), Expanded( diff --git a/lib/widgets/app_scaffold.dart b/lib/widgets/app_scaffold.dart index 45d2907..4c48e2a 100644 --- a/lib/widgets/app_scaffold.dart +++ b/lib/widgets/app_scaffold.dart @@ -235,7 +235,7 @@ class AppBackground extends ConsumerWidget { }, loading: () => const SizedBox(), error: - (_, __) => Material( + (_, _) => Material( color: Theme.of(context).colorScheme.surface, child: child, ), diff --git a/lib/widgets/chat/call_button.g.dart b/lib/widgets/chat/call_button.g.dart index 73c8727..5e6d5c2 100644 --- a/lib/widgets/chat/call_button.g.dart +++ b/lib/widgets/chat/call_button.g.dart @@ -6,7 +6,7 @@ part of 'call_button.dart'; // RiverpodGenerator // ************************************************************************** -String _$ongoingCallHash() => r'd8a942e6695a7da702daeaa452464c16761ef6e7'; +String _$ongoingCallHash() => r'ab7337bcd4d766897bd6d6a38f418c6bdd15eb94'; /// Copied from Dart SDK class _SystemHash { diff --git a/lib/widgets/chat/call_overlay.dart b/lib/widgets/chat/call_overlay.dart index e438504..3e05ae8 100644 --- a/lib/widgets/chat/call_overlay.dart +++ b/lib/widgets/chat/call_overlay.dart @@ -45,7 +45,7 @@ class CallControlsBar extends HookConsumerWidget { callNotifier.localParticipant!.isSpeaking, audioLevel: callNotifier.localParticipant!.audioLevel, - pictureId: userInfo.value?.profile.pictureId, + pictureId: userInfo.value?.profile.picture?.id, size: 36, ).center(), ); @@ -158,7 +158,8 @@ class CallOverlayBar extends HookConsumerWidget { .profile ?.account .profile - .pictureId, + .picture + ?.id, size: 36, ).center(), ); diff --git a/lib/widgets/chat/call_participant_tile.dart b/lib/widgets/chat/call_participant_tile.dart index 87cb63e..3d1bffd 100644 --- a/lib/widgets/chat/call_participant_tile.dart +++ b/lib/widgets/chat/call_participant_tile.dart @@ -106,7 +106,7 @@ class CallParticipantTile extends StatelessWidget { return SpeakingRippleAvatar( isSpeaking: live.isSpeaking, audioLevel: audioLevel, - pictureId: live.participant.profile?.account.profile.pictureId, + pictureId: live.participant.profile?.account.profile.picture?.id, size: 84, ); } diff --git a/lib/widgets/chat/message_item.dart b/lib/widgets/chat/message_item.dart index 3fcb4c4..e505362 100644 --- a/lib/widgets/chat/message_item.dart +++ b/lib/widgets/chat/message_item.dart @@ -111,7 +111,7 @@ class MessageItem extends HookConsumerWidget { mainAxisSize: MainAxisSize.min, children: [ ProfilePictureWidget( - fileId: sender.account.profile.pictureId, + fileId: sender.account.profile.picture?.id, radius: 16, ), Column( diff --git a/lib/widgets/check_in.dart b/lib/widgets/check_in.dart index 1a7a026..b9cda18 100644 --- a/lib/widgets/check_in.dart +++ b/lib/widgets/check_in.dart @@ -151,7 +151,7 @@ class CheckInWidget extends HookConsumerWidget { key: ValueKey(result != null), ), loading: () => const Icon(Symbols.refresh), - error: (_, __) => const Icon(Symbols.error), + error: (_, _) => const Icon(Symbols.error), ), ), ), @@ -188,7 +188,7 @@ class CheckInActivityWidget extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ ProfilePictureWidget( - fileId: result.account!.profile.pictureId, + fileId: result.account!.profile.picture?.id, radius: 12, ), Expanded( diff --git a/lib/widgets/content/cloud_file_collection.dart b/lib/widgets/content/cloud_file_collection.dart index 564e835..7007185 100644 --- a/lib/widgets/content/cloud_file_collection.dart +++ b/lib/widgets/content/cloud_file_collection.dart @@ -159,7 +159,7 @@ class CloudFileList extends HookConsumerWidget { ), ); }, - separatorBuilder: (_, __) => const Gap(8), + separatorBuilder: (_, _) => const Gap(8), ), ), ); diff --git a/lib/widgets/content/cloud_file_picker.dart b/lib/widgets/content/cloud_file_picker.dart index dd8be9b..e9d8a70 100644 --- a/lib/widgets/content/cloud_file_picker.dart +++ b/lib/widgets/content/cloud_file_picker.dart @@ -259,7 +259,7 @@ class CloudFilePicker extends HookConsumerWidget { progress: null, ); }, - separatorBuilder: (_, __) => const Gap(8), + separatorBuilder: (_, _) => const Gap(8), ), ), Card( diff --git a/lib/widgets/post/post_item.dart b/lib/widgets/post/post_item.dart index 986d6dc..18eec7e 100644 --- a/lib/widgets/post/post_item.dart +++ b/lib/widgets/post/post_item.dart @@ -118,7 +118,7 @@ class PostItem extends HookConsumerWidget { children: [ GestureDetector( child: ProfilePictureWidget( - fileId: item.publisher.pictureId, + fileId: item.publisher.picture?.id, ), onTap: () { context.router.push( diff --git a/lib/widgets/post/post_quick_reply.dart b/lib/widgets/post/post_quick_reply.dart index 7a41988..f95e76b 100644 --- a/lib/widgets/post/post_quick_reply.dart +++ b/lib/widgets/post/post_quick_reply.dart @@ -65,7 +65,7 @@ class PostQuickReply extends HookConsumerWidget { children: [ GestureDetector( child: ProfilePictureWidget( - fileId: currentPublisher.value?.pictureId, + fileId: currentPublisher.value?.picture?.id, radius: 16, ), onTap: () { diff --git a/lib/widgets/realms/selection_dropdown.dart b/lib/widgets/realms/selection_dropdown.dart index 3c13f44..bd7a9b9 100644 --- a/lib/widgets/realms/selection_dropdown.dart +++ b/lib/widgets/realms/selection_dropdown.dart @@ -49,7 +49,7 @@ class RealmSelectionDropdown extends StatelessWidget { child: Row( children: [ ProfilePictureWidget( - fileId: realm.pictureId, + fileId: realm.picture?.id, fallbackIcon: Symbols.workspaces, radius: 16, ), diff --git a/macos/Podfile.lock b/macos/Podfile.lock index af02618..10c06ee 100644 --- a/macos/Podfile.lock +++ b/macos/Podfile.lock @@ -101,6 +101,8 @@ PODS: - OrderedSet (6.0.3) - package_info_plus (0.0.1): - FlutterMacOS + - pasteboard (0.0.1): + - FlutterMacOS - path_provider_foundation (0.0.1): - Flutter - FlutterMacOS @@ -163,6 +165,7 @@ DEPENDENCIES: - media_kit_libs_macos_video (from `Flutter/ephemeral/.symlinks/plugins/media_kit_libs_macos_video/macos`) - media_kit_video (from `Flutter/ephemeral/.symlinks/plugins/media_kit_video/macos`) - package_info_plus (from `Flutter/ephemeral/.symlinks/plugins/package_info_plus/macos`) + - pasteboard (from `Flutter/ephemeral/.symlinks/plugins/pasteboard/macos`) - path_provider_foundation (from `Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin`) - shared_preferences_foundation (from `Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/darwin`) - sqflite_darwin (from `Flutter/ephemeral/.symlinks/plugins/sqflite_darwin/darwin`) @@ -225,6 +228,8 @@ EXTERNAL SOURCES: :path: Flutter/ephemeral/.symlinks/plugins/media_kit_video/macos package_info_plus: :path: Flutter/ephemeral/.symlinks/plugins/package_info_plus/macos + pasteboard: + :path: Flutter/ephemeral/.symlinks/plugins/pasteboard/macos path_provider_foundation: :path: Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin shared_preferences_foundation: @@ -270,6 +275,7 @@ SPEC CHECKSUMS: nanopb: fad817b59e0457d11a5dfbde799381cd727c1275 OrderedSet: e539b66b644ff081c73a262d24ad552a69be3a94 package_info_plus: f0052d280d17aa382b932f399edf32507174e870 + pasteboard: 278d8100149f940fb795d6b3a74f0720c890ecb7 path_provider_foundation: 080d55be775b7414fd5a5ef3ac137b97b097e564 PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47 SAMKeychain: 483e1c9f32984d50ca961e26818a534283b4cd5c diff --git a/pubspec.lock b/pubspec.lock index b2be000..1c25c41 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -786,10 +786,10 @@ packages: dependency: "direct dev" description: name: flutter_lints - sha256: "5398f14efa795ffb7a33e9b6a08798b26a180edac4ad7db3f231e40f82ce11e1" + sha256: "3105dc8492f6183fb076ccf1f351ac3d60564bff92e20bfc4af9cc1651f4e7e1" url: "https://pub.dev" source: hosted - version: "5.0.0" + version: "6.0.0" flutter_localizations: dependency: transitive description: flutter @@ -831,10 +831,10 @@ packages: dependency: "direct main" description: name: flutter_platform_alert - sha256: c4b509956346ce9666512b700354de4c6f8fdff94cd47c12368e4a6b1c25a02c + sha256: "70f4979a617388cd890ec32e9acc1a6a425bcdf3d8b444eb976be1834e79dc0c" url: "https://pub.dev" source: hosted - version: "0.7.0" + version: "0.8.0" flutter_plugin_android_lifecycle: dependency: transitive description: @@ -1170,10 +1170,10 @@ packages: dependency: transitive description: name: lints - sha256: c35bb79562d980e9a453fc715854e1ed39e24e7d0297a880ef54e17f9874a9d7 + sha256: a5e2b223cb7c9c8efdc663ef484fdd95bb243bff242ef5b13e26883547fce9a0 url: "https://pub.dev" source: hosted - version: "5.1.1" + version: "6.0.0" livekit_client: dependency: "direct main" description: @@ -2246,5 +2246,5 @@ packages: source: hosted version: "3.1.3" sdks: - dart: ">=3.7.2 <4.0.0" + dart: ">=3.8.0 <4.0.0" flutter: ">=3.27.0"