Show thumbnail uploading progress when uploading

This commit is contained in:
miruka 2020-03-08 08:05:41 -04:00
parent d1e42a72a0
commit e1b26d1ec7
2 changed files with 7 additions and 4 deletions

View File

@ -9,7 +9,6 @@
- nio ClientTimeout
- no thumb if bigger than original
- upload delay at the end?
- Handle upload file size limit
- Handle set avatar upload errors
- Confirmation box after picking file to upload

View File

@ -418,9 +418,13 @@ class MatrixClient(nio.AsyncClient):
upload_item.total_size = len(thumb_data)
try:
# The total_size passed to the monitor only considers
# the file itself, and not the thumbnail.
monitor.on_transferred = None
upload_item.total_size = thumb_info.size
monitor = nio.TransferMonitor(thumb_info.size)
monitor.on_transferred = on_transferred
monitor.on_speed_changed = on_speed_changed
self.upload_monitors[item_uuid] = monitor
thumb_url, _, thumb_crypt_dict = await self.upload(
lambda *_: thumb_data,