Skip to content

Commit 77831c1

Browse files
compose [nfc]: Expose uploadFiles on ComposeBoxState
This will be used soon to allow uploading files directly via using `MessageListPageState`.
1 parent 997b930 commit 77831c1

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

lib/widgets/compose_box.dart

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1869,6 +1869,20 @@ abstract class ComposeBoxState extends State<ComposeBox> {
18691869

18701870
/// Switch the compose box back to regular non-edit mode, with no content.
18711871
void endEditInteraction();
1872+
1873+
/// Uploads the provided files, populating the compose box with their links.
1874+
///
1875+
/// If any of the file is larger than maximum file size allowed by the
1876+
/// server, an error dialog is shown mentioning their names and actual
1877+
/// file sizes.
1878+
///
1879+
/// While uploading, a placeholder link is inserted in the compose box and
1880+
/// it is replaced with an actual link after uploading completes
1881+
/// successfully.
1882+
///
1883+
/// If there is an error while uploading a file, then an error dialog is
1884+
/// shown mentioning the corresponding file name.
1885+
Future<void> uploadFiles(Iterable<FileToUpload> files);
18721886
}
18731887

18741888
class _ComposeBoxState extends State<ComposeBox> with PerAccountStoreAwareStateMixin<ComposeBox> implements ComposeBoxState {
@@ -2021,6 +2035,15 @@ class _ComposeBoxState extends State<ComposeBox> with PerAccountStoreAwareStateM
20212035
});
20222036
}
20232037

2038+
@override
2039+
Future<void> uploadFiles(Iterable<FileToUpload> files) async {
2040+
await _uploadFiles(
2041+
context: context,
2042+
contentController: controller.content,
2043+
contentFocusNode: controller.contentFocusNode,
2044+
files: files);
2045+
}
2046+
20242047
@override
20252048
void onNewStore() {
20262049
final newStore = PerAccountStoreWidget.of(context);

0 commit comments

Comments
 (0)