diff --git a/lib/common/widgets/interactiveviewer_gallery/interactiveviewer_gallery.dart b/lib/common/widgets/interactiveviewer_gallery/interactiveviewer_gallery.dart index 01f2b79d2..6b00551c7 100644 --- a/lib/common/widgets/interactiveviewer_gallery/interactiveviewer_gallery.dart +++ b/lib/common/widgets/interactiveviewer_gallery/interactiveviewer_gallery.dart @@ -389,7 +389,7 @@ class _InteractiveviewerGalleryState extends State PopupMenuItem( onTap: () { DownloadUtils.downloadImg( - context, + this.context, [widget.sources[currentIndex.value].url], ); }, @@ -399,7 +399,7 @@ class _InteractiveviewerGalleryState extends State PopupMenuItem( onTap: () { DownloadUtils.downloadImg( - context, + this.context, widget.sources .map((item) => item.url) .toList(), @@ -412,7 +412,7 @@ class _InteractiveviewerGalleryState extends State PopupMenuItem( onTap: () { DownloadUtils.downloadLivePhoto( - context: context, + context: this.context, url: widget.sources[currentIndex.value].url, liveUrl: widget .sources[currentIndex.value].liveUrl!, @@ -567,7 +567,7 @@ class _InteractiveviewerGalleryState extends State onTap: () { Get.back(); DownloadUtils.downloadImg( - context, + this.context, [widget.sources[currentIndex.value].url], ); }, @@ -579,7 +579,7 @@ class _InteractiveviewerGalleryState extends State onTap: () { Get.back(); DownloadUtils.downloadImg( - context, + this.context, widget.sources.map((item) => item.url).toList(), ); }, @@ -592,7 +592,7 @@ class _InteractiveviewerGalleryState extends State onTap: () { Get.back(); DownloadUtils.downloadLivePhoto( - context: context, + context: this.context, url: widget.sources[currentIndex.value].url, liveUrl: widget.sources[currentIndex.value].liveUrl!, width: widget.sources[currentIndex.value].width!, diff --git a/lib/pages/video/detail/reply/widgets/reply_item_grpc.dart b/lib/pages/video/detail/reply/widgets/reply_item_grpc.dart index 93ec4ce2a..75991429d 100644 --- a/lib/pages/video/detail/reply/widgets/reply_item_grpc.dart +++ b/lib/pages/video/detail/reply/widgets/reply_item_grpc.dart @@ -1211,7 +1211,7 @@ class ReplyItemGrpc extends StatelessWidget { barrierLabel: '', barrierDismissible: true, pageBuilder: (context, animation, secondaryAnimation) { - return ReplySavePanel(replyItem: item); + return ReplySavePanel(upMid: upMid, replyItem: item); }, transitionDuration: const Duration(milliseconds: 255), transitionBuilder: (context, animation, secondaryAnimation, child) { diff --git a/lib/pages/video/detail/reply/widgets/reply_save.dart b/lib/pages/video/detail/reply/widgets/reply_save.dart index e7e8a61ac..04009406f 100644 --- a/lib/pages/video/detail/reply/widgets/reply_save.dart +++ b/lib/pages/video/detail/reply/widgets/reply_save.dart @@ -7,6 +7,7 @@ import 'package:PiliPlus/grpc/app/main/community/reply/v1/reply.pb.dart'; import 'package:PiliPlus/models/dynamics/result.dart'; import 'package:PiliPlus/pages/video/detail/introduction/controller.dart'; import 'package:PiliPlus/pages/video/detail/reply/widgets/reply_item_grpc.dart'; +import 'package:PiliPlus/utils/download.dart'; import 'package:PiliPlus/utils/utils.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; @@ -17,8 +18,13 @@ import 'package:saver_gallery/saver_gallery.dart'; import 'package:share_plus/share_plus.dart'; class ReplySavePanel extends StatefulWidget { - const ReplySavePanel({required this.replyItem, super.key}); + const ReplySavePanel({ + required this.upMid, + required this.replyItem, + super.key, + }); + final dynamic upMid; final ReplyInfo replyItem; @override @@ -29,6 +35,12 @@ class _ReplySavePanelState extends State { final boundaryKey = GlobalKey(); void _onSaveOrSharePic([bool isShare = false]) async { + if (!isShare) { + if (mounted && + !await DownloadUtils.checkPermissionDependOnSdkInt(context)) { + return; + } + } SmartDialog.showLoading(); try { RenderRepaintBoundary boundary = boundaryKey.currentContext! @@ -185,6 +197,7 @@ class _ReplySavePanelState extends State { showReplyRow: false, replyLevel: '', needDivider: false, + upMid: widget.upMid, ), ), if (cover?.isNotEmpty == true &&