From 4f6c5aa053324cb2943134e0b5b40c5f29919ad6 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Sun, 4 Aug 2024 21:12:35 +0800 Subject: [PATCH] :bug: Bug fixes --- lib/providers/attachment_uploader.dart | 5 +- lib/providers/content/attachment.dart | 2 + lib/screens/posts/post_detail.dart | 3 +- .../attachments/attachment_editor.dart | 47 +++++++++++-------- lib/widgets/posts/post_item.dart | 6 ++- pubspec.yaml | 2 +- 6 files changed, 40 insertions(+), 25 deletions(-) diff --git a/lib/providers/attachment_uploader.dart b/lib/providers/attachment_uploader.dart index 5c675e7..7e0a362 100644 --- a/lib/providers/attachment_uploader.dart +++ b/lib/providers/attachment_uploader.dart @@ -138,8 +138,9 @@ class AttachmentUploaderController extends GetxController { queueOfUpload[idx].isCompleted = true; } - queueOfUpload.value = - queueOfUpload.where((x) => x.error == null).toList(growable: true); + queueOfUpload.value = queueOfUpload + .where((x) => x.error == null && x.isCompleted) + .toList(growable: true); _stopProgressSyncTimer(); _syncProgress(); diff --git a/lib/providers/content/attachment.dart b/lib/providers/content/attachment.dart index edea50c..915745b 100644 --- a/lib/providers/content/attachment.dart +++ b/lib/providers/content/attachment.dart @@ -89,6 +89,8 @@ class AttachmentProvider extends GetConnect { final AuthProvider auth = Get.find(); if (auth.isAuthorized.isFalse) throw Exception('unauthorized'); + await auth.ensureCredentials(); + final filePayload = dio.MultipartFile.fromBytes(data, filename: basename(path)); final fileAlt = basename(path).contains('.') diff --git a/lib/screens/posts/post_detail.dart b/lib/screens/posts/post_detail.dart index c9b657b..02847d9 100644 --- a/lib/screens/posts/post_detail.dart +++ b/lib/screens/posts/post_detail.dart @@ -59,7 +59,8 @@ class _PostDetailScreenState extends State { SliverToBoxAdapter( child: PostItem( item: item!, - isClickable: true, + isClickable: false, + isOverrideEmbedClickable: true, isFullDate: true, isFullContent: true, isShowReply: false, diff --git a/lib/widgets/attachments/attachment_editor.dart b/lib/widgets/attachments/attachment_editor.dart index df1a855..2ef9ab9 100644 --- a/lib/widgets/attachments/attachment_editor.dart +++ b/lib/widgets/attachments/attachment_editor.dart @@ -597,30 +597,39 @@ class _AttachmentEditorPopupState extends State { mainAxisSize: MainAxisSize.min, children: [ Expanded( - child: Text( - 'attachmentAdd'.tr, - style: Theme.of(context).textTheme.headlineSmall, - maxLines: 2, - overflow: TextOverflow.fade, + child: Row( + children: [ + Expanded( + child: Text( + 'attachmentAdd'.tr, + style: + Theme.of(context).textTheme.headlineSmall, + maxLines: 1, + overflow: TextOverflow.ellipsis, + ), + ), + const SizedBox(width: 10), + Obx(() { + if (_uploadController.isUploading.value) { + return SizedBox( + width: 18, + height: 18, + child: CircularProgressIndicator( + strokeWidth: 2.5, + value: _uploadController + .progressOfUpload.value, + ), + ); + } + return const SizedBox(); + }), + ], ), ), - const SizedBox(width: 10), - Obx(() { - if (_uploadController.isUploading.value) { - return SizedBox( - width: 18, - height: 18, - child: CircularProgressIndicator( - strokeWidth: 2.5, - value: _uploadController.progressOfUpload.value, - ), - ); - } - return const SizedBox(); - }), ], ), ), + const SizedBox(width: 20), Text('attachmentAutoUpload'.tr), const SizedBox(width: 8), Switch( diff --git a/lib/widgets/posts/post_item.dart b/lib/widgets/posts/post_item.dart index 3cb9a67..dc4261a 100644 --- a/lib/widgets/posts/post_item.dart +++ b/lib/widgets/posts/post_item.dart @@ -23,6 +23,7 @@ class PostItem extends StatefulWidget { final bool isReactable; final bool isShowReply; final bool isShowEmbed; + final bool isOverrideEmbedClickable; final bool isFullDate; final bool isFullContent; final bool isContentSelectable; @@ -37,6 +38,7 @@ class PostItem extends StatefulWidget { this.isReactable = true, this.isShowReply = true, this.isShowEmbed = true, + this.isOverrideEmbedClickable = false, this.isFullDate = false, this.isFullContent = false, this.isContentSelectable = false, @@ -176,7 +178,7 @@ class _PostItemState extends State { Widget _buildReply(BuildContext context) { return OpenContainer( - tappable: widget.isClickable, + tappable: widget.isClickable || widget.isOverrideEmbedClickable, closedBuilder: (_, openContainer) => Column( children: [ Row( @@ -223,7 +225,7 @@ class _PostItemState extends State { Widget _buildRepost(BuildContext context) { return OpenContainer( - tappable: widget.isClickable, + tappable: widget.isClickable || widget.isOverrideEmbedClickable, closedBuilder: (_, openContainer) => Column( children: [ Row( diff --git a/pubspec.yaml b/pubspec.yaml index 6f084e8..2e29217 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -2,7 +2,7 @@ name: solian description: "The Solar Network App" publish_to: "none" -version: 1.2.1+5 +version: 1.2.1+6 environment: sdk: ">=3.3.4 <4.0.0"