mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-27 14:59:29 +01:00
feat: Save files images and videos
This commit is contained in:
parent
359c8db1ac
commit
7e442ec504
@ -23,6 +23,7 @@ import 'package:fluffychat/config/app_config.dart';
|
||||
import 'package:fluffychat/pages/chat/chat_view.dart';
|
||||
import 'package:fluffychat/pages/chat/event_info_dialog.dart';
|
||||
import 'package:fluffychat/pages/chat/recording_dialog.dart';
|
||||
import 'package:fluffychat/utils/matrix_sdk_extensions.dart/event_extension.dart';
|
||||
import 'package:fluffychat/utils/matrix_sdk_extensions.dart/matrix_locals.dart';
|
||||
import 'package:fluffychat/utils/platform_infos.dart';
|
||||
import 'package:fluffychat/widgets/matrix.dart';
|
||||
@ -83,6 +84,18 @@ class ChatController extends State<Chat> {
|
||||
}
|
||||
}
|
||||
|
||||
bool get canSaveSelectedEvent =>
|
||||
selectedEvents.length == 1 &&
|
||||
{
|
||||
MessageTypes.Video,
|
||||
MessageTypes.Image,
|
||||
MessageTypes.Sticker,
|
||||
MessageTypes.Audio,
|
||||
MessageTypes.File,
|
||||
}.contains(selectedEvents.single.messageType);
|
||||
|
||||
void saveSelectedEvent() => selectedEvents.single.saveFile(context);
|
||||
|
||||
List<Event> selectedEvents = [];
|
||||
|
||||
List<Event> filteredEvents;
|
||||
|
@ -49,6 +49,12 @@ class ChatView extends StatelessWidget {
|
||||
tooltip: L10n.of(context).copy,
|
||||
onPressed: controller.copyEventsAction,
|
||||
),
|
||||
if (controller.canSaveSelectedEvent)
|
||||
IconButton(
|
||||
icon: Icon(Icons.adaptive.share),
|
||||
tooltip: L10n.of(context).share,
|
||||
onPressed: controller.saveSelectedEvent,
|
||||
),
|
||||
if (controller.canRedactSelectedEvents)
|
||||
IconButton(
|
||||
icon: const Icon(Icons.delete_outlined),
|
||||
|
Loading…
Reference in New Issue
Block a user