TF-2245 Fix upload attachment when token expired on web

Signed-off-by: dab246 <tdvu@linagora.com>
(cherry picked from commit 0b2ab3c6ff4213bccc064822e640cc40592a39e8)
This commit is contained in:
dab246
2023-10-24 11:22:38 +07:00
committed by Dat H. Pham
parent ebd9663a5c
commit 14047c9ccc
9 changed files with 89 additions and 41 deletions
@@ -1750,17 +1750,17 @@ class ComposerController extends BaseController {
Future<InlineImage?> _selectFromFile() async {
final filePickerResult = await FilePicker.platform.pickFiles(
type: FileType.image,
withData: PlatformInfo.isMobile,
withReadStream: PlatformInfo.isWeb);
final platformFile = filePickerResult?.files.single;
if (platformFile != null) {
type: FileType.image,
withData: PlatformInfo.isWeb
);
if (filePickerResult?.files.isNotEmpty == true) {
PlatformFile platformFile = filePickerResult!.files.first;
final fileSelected = FileInfo(
platformFile.name,
PlatformInfo.isWeb ? '' : platformFile.path ?? '',
platformFile.size,
bytes: platformFile.bytes,
readStream: platformFile.readStream);
platformFile.name,
PlatformInfo.isWeb ? '' : platformFile.path ?? '',
platformFile.size,
bytes: PlatformInfo.isWeb ? platformFile.bytes : null,
);
return InlineImage(ImageSource.local, fileInfo: fileSelected);
}