@@ -61,7 +61,6 @@ use uuid::Uuid;
61
61
use self :: content:: TimelineItemContent ;
62
62
pub use self :: msg_like:: MessageContent ;
63
63
use crate :: {
64
- client:: ProgressWatcher ,
65
64
error:: { ClientError , RoomError } ,
66
65
event:: EventOrTransactionId ,
67
66
ruma:: {
@@ -99,7 +98,6 @@ impl Timeline {
99
98
params : UploadParameters ,
100
99
attachment_info : AttachmentInfo ,
101
100
mime_type : Option < String > ,
102
- progress_watcher : Option < Box < dyn ProgressWatcher > > ,
103
101
thumbnail : Option < Thumbnail > ,
104
102
) -> Result < Arc < SendAttachmentJoinHandle > , RoomError > {
105
103
let mime_str = mime_type. as_ref ( ) . ok_or ( RoomError :: InvalidAttachmentMimeType ) ?;
@@ -134,15 +132,6 @@ impl Timeline {
134
132
request = request. use_send_queue ( ) ;
135
133
}
136
134
137
- if let Some ( progress_watcher) = progress_watcher {
138
- let mut subscriber = request. subscribe_to_send_progress ( ) ;
139
- get_runtime_handle ( ) . spawn ( async move {
140
- while let Some ( progress) = subscriber. next ( ) . await {
141
- progress_watcher. transmission_progress ( progress. into ( ) ) ;
142
- }
143
- } ) ;
144
- }
145
-
146
135
request. await . map_err ( |_| RoomError :: FailedSendingAttachment ) ?;
147
136
Ok ( ( ) )
148
137
} ) ) ;
@@ -399,78 +388,61 @@ impl Timeline {
399
388
params : UploadParameters ,
400
389
thumbnail_path : Option < String > ,
401
390
image_info : ImageInfo ,
402
- progress_watcher : Option < Box < dyn ProgressWatcher > > ,
403
391
) -> Result < Arc < SendAttachmentJoinHandle > , RoomError > {
404
392
let attachment_info = AttachmentInfo :: Image (
405
393
BaseImageInfo :: try_from ( & image_info) . map_err ( |_| RoomError :: InvalidAttachmentData ) ?,
406
394
) ;
407
395
let thumbnail = build_thumbnail_info ( thumbnail_path, image_info. thumbnail_info ) ?;
408
- self . send_attachment (
409
- params,
410
- attachment_info,
411
- image_info. mimetype ,
412
- progress_watcher,
413
- thumbnail,
414
- )
396
+ self . send_attachment ( params, attachment_info, image_info. mimetype , thumbnail)
415
397
}
416
398
417
399
pub fn send_video (
418
400
self : Arc < Self > ,
419
401
params : UploadParameters ,
420
402
thumbnail_path : Option < String > ,
421
403
video_info : VideoInfo ,
422
- progress_watcher : Option < Box < dyn ProgressWatcher > > ,
423
404
) -> Result < Arc < SendAttachmentJoinHandle > , RoomError > {
424
405
let attachment_info = AttachmentInfo :: Video (
425
406
BaseVideoInfo :: try_from ( & video_info) . map_err ( |_| RoomError :: InvalidAttachmentData ) ?,
426
407
) ;
427
408
let thumbnail = build_thumbnail_info ( thumbnail_path, video_info. thumbnail_info ) ?;
428
- self . send_attachment (
429
- params,
430
- attachment_info,
431
- video_info. mimetype ,
432
- progress_watcher,
433
- thumbnail,
434
- )
409
+ self . send_attachment ( params, attachment_info, video_info. mimetype , thumbnail)
435
410
}
436
411
437
412
pub fn send_audio (
438
413
self : Arc < Self > ,
439
414
params : UploadParameters ,
440
415
audio_info : AudioInfo ,
441
- progress_watcher : Option < Box < dyn ProgressWatcher > > ,
442
416
) -> Result < Arc < SendAttachmentJoinHandle > , RoomError > {
443
417
let attachment_info = AttachmentInfo :: Audio (
444
418
BaseAudioInfo :: try_from ( & audio_info) . map_err ( |_| RoomError :: InvalidAttachmentData ) ?,
445
419
) ;
446
- self . send_attachment ( params, attachment_info, audio_info. mimetype , progress_watcher , None )
420
+ self . send_attachment ( params, attachment_info, audio_info. mimetype , None )
447
421
}
448
422
449
423
pub fn send_voice_message (
450
424
self : Arc < Self > ,
451
425
params : UploadParameters ,
452
426
audio_info : AudioInfo ,
453
427
waveform : Vec < u16 > ,
454
- progress_watcher : Option < Box < dyn ProgressWatcher > > ,
455
428
) -> Result < Arc < SendAttachmentJoinHandle > , RoomError > {
456
429
let attachment_info = AttachmentInfo :: Voice {
457
430
audio_info : BaseAudioInfo :: try_from ( & audio_info)
458
431
. map_err ( |_| RoomError :: InvalidAttachmentData ) ?,
459
432
waveform : Some ( waveform) ,
460
433
} ;
461
- self . send_attachment ( params, attachment_info, audio_info. mimetype , progress_watcher , None )
434
+ self . send_attachment ( params, attachment_info, audio_info. mimetype , None )
462
435
}
463
436
464
437
pub fn send_file (
465
438
self : Arc < Self > ,
466
439
params : UploadParameters ,
467
440
file_info : FileInfo ,
468
- progress_watcher : Option < Box < dyn ProgressWatcher > > ,
469
441
) -> Result < Arc < SendAttachmentJoinHandle > , RoomError > {
470
442
let attachment_info = AttachmentInfo :: File (
471
443
BaseFileInfo :: try_from ( & file_info) . map_err ( |_| RoomError :: InvalidAttachmentData ) ?,
472
444
) ;
473
- self . send_attachment ( params, attachment_info, file_info. mimetype , progress_watcher , None )
445
+ self . send_attachment ( params, attachment_info, file_info. mimetype , None )
474
446
}
475
447
476
448
pub async fn create_poll (
0 commit comments