feat: Save files images and videos
This commit is contained in:
parent
7417a3bd32
commit
c0e2f66bf6
2 changed files with 19 additions and 0 deletions
|
|
@ -23,6 +23,7 @@ import 'package:fluffychat/config/app_config.dart';
|
||||||
import 'package:fluffychat/pages/chat/chat_view.dart';
|
import 'package:fluffychat/pages/chat/chat_view.dart';
|
||||||
import 'package:fluffychat/pages/chat/event_info_dialog.dart';
|
import 'package:fluffychat/pages/chat/event_info_dialog.dart';
|
||||||
import 'package:fluffychat/pages/chat/recording_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/matrix_sdk_extensions.dart/matrix_locals.dart';
|
||||||
import 'package:fluffychat/utils/platform_infos.dart';
|
import 'package:fluffychat/utils/platform_infos.dart';
|
||||||
import 'package:fluffychat/widgets/matrix.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> selectedEvents = [];
|
||||||
|
|
||||||
List<Event> filteredEvents;
|
List<Event> filteredEvents;
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,12 @@ class ChatView extends StatelessWidget {
|
||||||
tooltip: L10n.of(context).copy,
|
tooltip: L10n.of(context).copy,
|
||||||
onPressed: controller.copyEventsAction,
|
onPressed: controller.copyEventsAction,
|
||||||
),
|
),
|
||||||
|
if (controller.canSaveSelectedEvent)
|
||||||
|
IconButton(
|
||||||
|
icon: Icon(Icons.adaptive.share),
|
||||||
|
tooltip: L10n.of(context).share,
|
||||||
|
onPressed: controller.saveSelectedEvent,
|
||||||
|
),
|
||||||
if (controller.canRedactSelectedEvents)
|
if (controller.canRedactSelectedEvents)
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: const Icon(Icons.delete_outlined),
|
icon: const Icon(Icons.delete_outlined),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue