chore: Do not hide error on file sending
This commit is contained in:
parent
fcd3227ef5
commit
9d0cefce18
1 changed files with 16 additions and 13 deletions
|
|
@ -1,3 +1,5 @@
|
||||||
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
|
@ -6,7 +8,7 @@ import 'package:future_loading_dialog/future_loading_dialog.dart';
|
||||||
import 'package:matrix/matrix.dart';
|
import 'package:matrix/matrix.dart';
|
||||||
|
|
||||||
import 'package:fluffychat/config/app_config.dart';
|
import 'package:fluffychat/config/app_config.dart';
|
||||||
import 'package:fluffychat/utils/localized_exception_extension.dart';
|
import 'package:fluffychat/utils/error_reporter.dart';
|
||||||
import 'package:fluffychat/utils/size_string.dart';
|
import 'package:fluffychat/utils/size_string.dart';
|
||||||
import '../../utils/resize_image.dart';
|
import '../../utils/resize_image.dart';
|
||||||
|
|
||||||
|
|
@ -42,19 +44,20 @@ class SendFileDialogState extends State<SendFileDialog> {
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
final scaffoldMessenger = ScaffoldMessenger.of(context);
|
try {
|
||||||
widget.room
|
await widget.room.sendFileEvent(
|
||||||
.sendFileEvent(
|
file,
|
||||||
file,
|
thumbnail: thumbnail,
|
||||||
thumbnail: thumbnail,
|
shrinkImageMaxDimension: origImage ? null : 1600,
|
||||||
shrinkImageMaxDimension: origImage ? null : 1600,
|
|
||||||
)
|
|
||||||
.catchError((e) {
|
|
||||||
scaffoldMessenger.showSnackBar(
|
|
||||||
SnackBar(content: Text((e as Object).toLocalizedString(context))),
|
|
||||||
);
|
);
|
||||||
return null;
|
} on IOException catch (_) {
|
||||||
});
|
} on FileTooBigMatrixException catch (_) {
|
||||||
|
} catch (e, s) {
|
||||||
|
if (mounted) {
|
||||||
|
ErrorReporter(context, 'Unable to send file').onErrorCallback(e, s);
|
||||||
|
}
|
||||||
|
rethrow;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Navigator.of(context, rootNavigator: false).pop();
|
Navigator.of(context, rootNavigator: false).pop();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue