diff --git a/lib/controllers/chat_message_controller.dart b/lib/controllers/chat_message_controller.dart index 39bd444..8949c81 100644 --- a/lib/controllers/chat_message_controller.dart +++ b/lib/controllers/chat_message_controller.dart @@ -83,7 +83,6 @@ class ChatMessageController extends ChangeNotifier { if (member.id == profile?.id) break; if (!typingMembers.any((x) => x.id == member.id)) { typingMembers.add(member); - print('Typing member: ${typingMembers.map((ele) => member.id)}'); notifyListeners(); } typingInactiveTimer[member.id]?.cancel(); diff --git a/lib/providers/websocket.dart b/lib/providers/websocket.dart index 6bfd059..676b097 100644 --- a/lib/providers/websocket.dart +++ b/lib/providers/websocket.dart @@ -35,7 +35,7 @@ class WebSocketProvider extends ChangeNotifier { Future connect({noRetry = false}) async { if (!_ua.isAuthorized) return; - if (isConnected) { + if (isConnected || conn != null) { disconnect(); } @@ -97,7 +97,7 @@ class WebSocketProvider extends ChangeNotifier { onError: (err) { isConnected = false; notifyListeners(); - Future.delayed(const Duration(seconds: 11), () => connect()); + Future.delayed(const Duration(seconds: 1), () => connect()); }, ); } diff --git a/lib/widgets/markdown_content.dart b/lib/widgets/markdown_content.dart index 2fcae6f..db22f20 100644 --- a/lib/widgets/markdown_content.dart +++ b/lib/widgets/markdown_content.dart @@ -1,5 +1,3 @@ -import 'dart:ui'; - import 'package:dismissible_page/dismissible_page.dart'; import 'package:flutter/material.dart'; import 'package:flutter_markdown/flutter_markdown.dart'; @@ -7,15 +5,12 @@ import 'package:go_router/go_router.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:markdown/markdown.dart' as markdown; import 'package:provider/provider.dart'; -import 'package:styled_widget/styled_widget.dart'; import 'package:surface/providers/sn_network.dart'; import 'package:surface/providers/sn_sticker.dart'; import 'package:surface/types/attachment.dart'; import 'package:surface/widgets/attachment/attachment_item.dart'; import 'package:surface/widgets/universal_image.dart'; -import 'package:syntax_highlight/syntax_highlight.dart'; import 'package:url_launcher/url_launcher_string.dart'; -import 'package:path/path.dart'; import 'package:uuid/uuid.dart'; import 'attachment/attachment_zoom.dart'; diff --git a/lib/widgets/post/post_item.dart b/lib/widgets/post/post_item.dart index 0e5d957..62bfdb1 100644 --- a/lib/widgets/post/post_item.dart +++ b/lib/widgets/post/post_item.dart @@ -20,6 +20,7 @@ import 'package:styled_widget/styled_widget.dart'; import 'package:surface/providers/config.dart'; import 'package:surface/providers/sn_network.dart'; import 'package:surface/providers/userinfo.dart'; +import 'package:surface/types/attachment.dart'; import 'package:surface/types/post.dart'; import 'package:surface/types/reaction.dart'; import 'package:surface/widgets/account/account_image.dart'; @@ -198,6 +199,10 @@ class PostItem extends StatelessWidget { ).center(); } + final displayableAttachments = data.preload?.attachments + ?.where((ele) => ele?.mediaType != SnMediaType.image || data.type != 'article') + .toList(); + return Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ @@ -247,9 +252,9 @@ class PostItem extends StatelessWidget { ], ), ), - if ((data.preload?.attachments?.isNotEmpty ?? false) && data.type != 'article') + if (displayableAttachments?.isNotEmpty ?? false) AttachmentList( - data: data.preload!.attachments!, + data: displayableAttachments!, bordered: true, gridded: true, maxHeight: showFullPost ? null : 480,