diff --git a/lib/models/embed.dart b/lib/models/embed.dart index 05b727b2..c4c62bc6 100644 --- a/lib/models/embed.dart +++ b/lib/models/embed.dart @@ -8,7 +8,7 @@ sealed class SnScrappedLink with _$SnScrappedLink { const factory SnScrappedLink({ required String type, required String url, - required String title, + required String? title, required String? description, required String? imageUrl, required String? faviconUrl, diff --git a/lib/models/embed.freezed.dart b/lib/models/embed.freezed.dart index d566bda2..13ab7fdf 100644 --- a/lib/models/embed.freezed.dart +++ b/lib/models/embed.freezed.dart @@ -15,7 +15,7 @@ T _$identity(T value) => value; /// @nodoc mixin _$SnScrappedLink { - String get type; String get url; String get title; String? get description; String? get imageUrl; String? get faviconUrl; String? get siteName; String? get contentType; String? get author; DateTime? get publishedDate; + String get type; String get url; String? get title; String? get description; String? get imageUrl; String? get faviconUrl; String? get siteName; String? get contentType; String? get author; DateTime? get publishedDate; /// Create a copy of SnScrappedLink /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @@ -48,7 +48,7 @@ abstract mixin class $SnScrappedLinkCopyWith<$Res> { factory $SnScrappedLinkCopyWith(SnScrappedLink value, $Res Function(SnScrappedLink) _then) = _$SnScrappedLinkCopyWithImpl; @useResult $Res call({ - String type, String url, String title, String? description, String? imageUrl, String? faviconUrl, String? siteName, String? contentType, String? author, DateTime? publishedDate + String type, String url, String? title, String? description, String? imageUrl, String? faviconUrl, String? siteName, String? contentType, String? author, DateTime? publishedDate }); @@ -65,12 +65,12 @@ class _$SnScrappedLinkCopyWithImpl<$Res> /// Create a copy of SnScrappedLink /// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') @override $Res call({Object? type = null,Object? url = null,Object? title = null,Object? description = freezed,Object? imageUrl = freezed,Object? faviconUrl = freezed,Object? siteName = freezed,Object? contentType = freezed,Object? author = freezed,Object? publishedDate = freezed,}) { +@pragma('vm:prefer-inline') @override $Res call({Object? type = null,Object? url = null,Object? title = freezed,Object? description = freezed,Object? imageUrl = freezed,Object? faviconUrl = freezed,Object? siteName = freezed,Object? contentType = freezed,Object? author = freezed,Object? publishedDate = freezed,}) { return _then(_self.copyWith( type: null == type ? _self.type : type // ignore: cast_nullable_to_non_nullable as String,url: null == url ? _self.url : url // ignore: cast_nullable_to_non_nullable -as String,title: null == title ? _self.title : title // ignore: cast_nullable_to_non_nullable -as String,description: freezed == description ? _self.description : description // ignore: cast_nullable_to_non_nullable +as String,title: freezed == title ? _self.title : title // ignore: cast_nullable_to_non_nullable +as String?,description: freezed == description ? _self.description : description // ignore: cast_nullable_to_non_nullable as String?,imageUrl: freezed == imageUrl ? _self.imageUrl : imageUrl // ignore: cast_nullable_to_non_nullable as String?,faviconUrl: freezed == faviconUrl ? _self.faviconUrl : faviconUrl // ignore: cast_nullable_to_non_nullable as String?,siteName: freezed == siteName ? _self.siteName : siteName // ignore: cast_nullable_to_non_nullable @@ -159,7 +159,7 @@ return $default(_that);case _: /// } /// ``` -@optionalTypeArgs TResult maybeWhen(TResult Function( String type, String url, String title, String? description, String? imageUrl, String? faviconUrl, String? siteName, String? contentType, String? author, DateTime? publishedDate)? $default,{required TResult orElse(),}) {final _that = this; +@optionalTypeArgs TResult maybeWhen(TResult Function( String type, String url, String? title, String? description, String? imageUrl, String? faviconUrl, String? siteName, String? contentType, String? author, DateTime? publishedDate)? $default,{required TResult orElse(),}) {final _that = this; switch (_that) { case _SnScrappedLink() when $default != null: return $default(_that.type,_that.url,_that.title,_that.description,_that.imageUrl,_that.faviconUrl,_that.siteName,_that.contentType,_that.author,_that.publishedDate);case _: @@ -180,7 +180,7 @@ return $default(_that.type,_that.url,_that.title,_that.description,_that.imageUr /// } /// ``` -@optionalTypeArgs TResult when(TResult Function( String type, String url, String title, String? description, String? imageUrl, String? faviconUrl, String? siteName, String? contentType, String? author, DateTime? publishedDate) $default,) {final _that = this; +@optionalTypeArgs TResult when(TResult Function( String type, String url, String? title, String? description, String? imageUrl, String? faviconUrl, String? siteName, String? contentType, String? author, DateTime? publishedDate) $default,) {final _that = this; switch (_that) { case _SnScrappedLink(): return $default(_that.type,_that.url,_that.title,_that.description,_that.imageUrl,_that.faviconUrl,_that.siteName,_that.contentType,_that.author,_that.publishedDate);} @@ -197,7 +197,7 @@ return $default(_that.type,_that.url,_that.title,_that.description,_that.imageUr /// } /// ``` -@optionalTypeArgs TResult? whenOrNull(TResult? Function( String type, String url, String title, String? description, String? imageUrl, String? faviconUrl, String? siteName, String? contentType, String? author, DateTime? publishedDate)? $default,) {final _that = this; +@optionalTypeArgs TResult? whenOrNull(TResult? Function( String type, String url, String? title, String? description, String? imageUrl, String? faviconUrl, String? siteName, String? contentType, String? author, DateTime? publishedDate)? $default,) {final _that = this; switch (_that) { case _SnScrappedLink() when $default != null: return $default(_that.type,_that.url,_that.title,_that.description,_that.imageUrl,_that.faviconUrl,_that.siteName,_that.contentType,_that.author,_that.publishedDate);case _: @@ -217,7 +217,7 @@ class _SnScrappedLink implements SnScrappedLink { @override final String type; @override final String url; -@override final String title; +@override final String? title; @override final String? description; @override final String? imageUrl; @override final String? faviconUrl; @@ -259,7 +259,7 @@ abstract mixin class _$SnScrappedLinkCopyWith<$Res> implements $SnScrappedLinkCo factory _$SnScrappedLinkCopyWith(_SnScrappedLink value, $Res Function(_SnScrappedLink) _then) = __$SnScrappedLinkCopyWithImpl; @override @useResult $Res call({ - String type, String url, String title, String? description, String? imageUrl, String? faviconUrl, String? siteName, String? contentType, String? author, DateTime? publishedDate + String type, String url, String? title, String? description, String? imageUrl, String? faviconUrl, String? siteName, String? contentType, String? author, DateTime? publishedDate }); @@ -276,12 +276,12 @@ class __$SnScrappedLinkCopyWithImpl<$Res> /// Create a copy of SnScrappedLink /// with the given fields replaced by the non-null parameter values. -@override @pragma('vm:prefer-inline') $Res call({Object? type = null,Object? url = null,Object? title = null,Object? description = freezed,Object? imageUrl = freezed,Object? faviconUrl = freezed,Object? siteName = freezed,Object? contentType = freezed,Object? author = freezed,Object? publishedDate = freezed,}) { +@override @pragma('vm:prefer-inline') $Res call({Object? type = null,Object? url = null,Object? title = freezed,Object? description = freezed,Object? imageUrl = freezed,Object? faviconUrl = freezed,Object? siteName = freezed,Object? contentType = freezed,Object? author = freezed,Object? publishedDate = freezed,}) { return _then(_SnScrappedLink( type: null == type ? _self.type : type // ignore: cast_nullable_to_non_nullable as String,url: null == url ? _self.url : url // ignore: cast_nullable_to_non_nullable -as String,title: null == title ? _self.title : title // ignore: cast_nullable_to_non_nullable -as String,description: freezed == description ? _self.description : description // ignore: cast_nullable_to_non_nullable +as String,title: freezed == title ? _self.title : title // ignore: cast_nullable_to_non_nullable +as String?,description: freezed == description ? _self.description : description // ignore: cast_nullable_to_non_nullable as String?,imageUrl: freezed == imageUrl ? _self.imageUrl : imageUrl // ignore: cast_nullable_to_non_nullable as String?,faviconUrl: freezed == faviconUrl ? _self.faviconUrl : faviconUrl // ignore: cast_nullable_to_non_nullable as String?,siteName: freezed == siteName ? _self.siteName : siteName // ignore: cast_nullable_to_non_nullable diff --git a/lib/models/embed.g.dart b/lib/models/embed.g.dart index 8dbfe38c..1c93f1a0 100644 --- a/lib/models/embed.g.dart +++ b/lib/models/embed.g.dart @@ -10,7 +10,7 @@ _SnScrappedLink _$SnScrappedLinkFromJson(Map json) => _SnScrappedLink( type: json['type'] as String, url: json['url'] as String, - title: json['title'] as String, + title: json['title'] as String?, description: json['description'] as String?, imageUrl: json['image_url'] as String?, faviconUrl: json['favicon_url'] as String?, diff --git a/lib/pods/chat/messages_notifier.g.dart b/lib/pods/chat/messages_notifier.g.dart index d4f8193b..4db416b9 100644 --- a/lib/pods/chat/messages_notifier.g.dart +++ b/lib/pods/chat/messages_notifier.g.dart @@ -50,7 +50,7 @@ final class MessagesNotifierProvider } } -String _$messagesNotifierHash() => r'a721a4b92b48ee7c2289cdcd7130bbf1ca9dcb40'; +String _$messagesNotifierHash() => r'622fed0908eb04381a971e36540c516743246dff'; final class MessagesNotifierFamily extends $Family with diff --git a/lib/pods/config.g.dart b/lib/pods/config.g.dart index 507b5b15..8c52da01 100644 --- a/lib/pods/config.g.dart +++ b/lib/pods/config.g.dart @@ -65,7 +65,7 @@ final class AppSettingsNotifierProvider } String _$appSettingsNotifierHash() => - r'2437c621dcb1625a120ed1f21ab5c29906ba98be'; + r'64cf6dfda90fc634336d96bd5313b2a07b19eccb'; abstract class _$AppSettingsNotifier extends $Notifier { AppSettings build(); diff --git a/lib/services/analytics_service.dart b/lib/services/analytics_service.dart index 22036181..d293dd22 100644 --- a/lib/services/analytics_service.dart +++ b/lib/services/analytics_service.dart @@ -64,7 +64,7 @@ class AnalyticsService { logEvent('post_created', { 'post_type': postType, 'visibility': visibility, - 'has_attachments': hasAttachments, + 'has_attachments': hasAttachments ? 'yes' : 'no', 'publisher_id': publisherId, }); } diff --git a/lib/widgets/content/embed/link.dart b/lib/widgets/content/embed/link.dart index 06748e5e..9c6f2bf0 100644 --- a/lib/widgets/content/embed/link.dart +++ b/lib/widgets/content/embed/link.dart @@ -202,9 +202,9 @@ class _EmbedLinkWidgetState extends State { const Gap(8), // Title - if (widget.link.title.isNotEmpty) ...[ + if (widget.link.title?.isNotEmpty ?? false) ...[ Text( - widget.link.title, + widget.link.title!, style: theme.textTheme.titleMedium?.copyWith( fontWeight: FontWeight.w600, ), diff --git a/lib/widgets/share/share_sheet.dart b/lib/widgets/share/share_sheet.dart index e206a7a9..fc16648c 100644 --- a/lib/widgets/share/share_sheet.dart +++ b/lib/widgets/share/share_sheet.dart @@ -998,14 +998,15 @@ class _LinkPreview extends ConsumerWidget { overflow: TextOverflow.ellipsis, ), // Title - Text( - embed.title, - style: Theme.of(context).textTheme.titleSmall?.copyWith( - fontWeight: FontWeight.w600, + if (embed.title != null) + Text( + embed.title!, + style: Theme.of(context).textTheme.titleSmall?.copyWith( + fontWeight: FontWeight.w600, + ), + maxLines: 2, + overflow: TextOverflow.ellipsis, ), - maxLines: 2, - overflow: TextOverflow.ellipsis, - ), // Description if (embed.description != null && embed.description!.isNotEmpty)