From 9bed679568e09d0affc736db7d9ab2c1a02a92b0 Mon Sep 17 00:00:00 2001 From: Krille Date: Wed, 19 Apr 2023 15:51:53 +0200 Subject: [PATCH] chore: Follow up file download type fix --- lib/utils/matrix_sdk_extensions/event_extension.dart | 3 +++ lib/utils/matrix_sdk_extensions/matrix_file_extension.dart | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/utils/matrix_sdk_extensions/event_extension.dart b/lib/utils/matrix_sdk_extensions/event_extension.dart index 358a8a95..dbd4a4ae 100644 --- a/lib/utils/matrix_sdk_extensions/event_extension.dart +++ b/lib/utils/matrix_sdk_extensions/event_extension.dart @@ -1,3 +1,5 @@ +import 'dart:developer'; + import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; @@ -22,6 +24,7 @@ extension LocalizedBody on Event { void shareFile(BuildContext context) async { final matrixFile = await _getFile(context); + inspect(matrixFile); matrixFile.result?.share(context); } diff --git a/lib/utils/matrix_sdk_extensions/matrix_file_extension.dart b/lib/utils/matrix_sdk_extensions/matrix_file_extension.dart index 7dd35374..17028d30 100644 --- a/lib/utils/matrix_sdk_extensions/matrix_file_extension.dart +++ b/lib/utils/matrix_sdk_extensions/matrix_file_extension.dart @@ -73,7 +73,7 @@ extension MatrixFileExtension on MatrixFile { href: html.Url.createObjectUrlFromBlob( html.Blob( [bytes], - 'application/octet-stream', + mimeType, ), ), ) @@ -87,7 +87,7 @@ extension MatrixFileExtension on MatrixFile { final box = context.findRenderObject() as RenderBox?; await Share.shareXFiles( - [XFile.fromData(bytes)], + [XFile.fromData(bytes, name: name, mimeType: mimeType)], sharePositionOrigin: box == null ? null : box.localToGlobal(Offset.zero) & box.size, );