Fix web compile and sending web attachments

This commit is contained in:
Tanay Neotia
2023-08-19 09:52:40 -04:00
parent 2b0b2f0d0f
commit aaf2d4289e
3 changed files with 4 additions and 4 deletions

View File

@ -122,7 +122,7 @@ class Player {
FutureOr<void> setShuffle(bool shuffle) {}
}
abstract class VideoController {
class VideoController {
/// The [Player] instance associated with this [VideoController].
final Player player;
@ -143,7 +143,7 @@ abstract class VideoController {
/// Disposes the [VideoController].
/// Releases the allocated resources back to the system.
Future<void> dispose();
Future<void> dispose() async {}
}
class Video extends StatefulWidget {

View File

@ -194,7 +194,7 @@ class ActionHandler extends GetxService {
http.sendAttachment(
c.guid,
attachment.guid!,
PlatformFile(name: attachment.transferName!, bytes: attachment.bytes, path: attachment.path, size: attachment.totalBytes ?? 0),
PlatformFile(name: attachment.transferName!, bytes: attachment.bytes, path: kIsWeb ? null : attachment.path, size: attachment.totalBytes ?? 0),
onSendProgress: (count, total) => progress.item2.value = count / attachment.bytes!.length,
method: (ss.settings.enablePrivateAPI.value
&& ss.settings.privateAPIAttachmentSend.value)

View File

@ -608,7 +608,7 @@ class HttpService extends GetxService {
/// body of the message.
Future<Response> sendAttachment(String chatGuid, String tempGuid, PlatformFile file, {void Function(int, int)? onSendProgress, String? method, String? effectId, String? subject, String? selectedMessageGuid, int? partIndex, bool? isAudioMessage, CancelToken? cancelToken}) async {
return runApiGuarded(() async {
final fileName = file.path!.split('/').last;
final fileName = file.name;
final formData = FormData.fromMap({
"attachment": kIsWeb ? MultipartFile.fromBytes(file.bytes!, filename: fileName) : await MultipartFile.fromFile(file.path!, filename: fileName),
"chatGuid": chatGuid,