mirror of
https://github.com/schlagmichdoch/PairDrop.git
synced 2025-04-21 15:26:17 -04:00
Fix multiple bugs on iOS
- receive multiple files - display videos correctly
This commit is contained in:
parent
eee098e723
commit
73c7430883
2 changed files with 9 additions and 5 deletions
|
@ -480,13 +480,12 @@ class FileDigester {
|
|||
this.progress = this._bytesReceived / this._size;
|
||||
if (this._bytesReceived < this._size) return;
|
||||
// we are done
|
||||
let received = new Blob(this._buffer, { type: this._mime });
|
||||
let url = URL.createObjectURL(received);
|
||||
let blob = new Blob(this._buffer, { type: this._mime });
|
||||
this._callback({
|
||||
name: this._name,
|
||||
mime: this._mime,
|
||||
size: this._size,
|
||||
url: url
|
||||
blob: blob
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -230,7 +230,8 @@ class ReceiveDialog extends Dialog {
|
|||
|
||||
_displayFile(file) {
|
||||
const $a = this.$el.querySelector('#download');
|
||||
$a.href = file.url;
|
||||
const url = URL.createObjectURL(file.blob);
|
||||
$a.href = url;
|
||||
$a.download = file.name;
|
||||
|
||||
this.$el.querySelector('#fileName').textContent = file.name;
|
||||
|
@ -238,7 +239,11 @@ class ReceiveDialog extends Dialog {
|
|||
this.show();
|
||||
|
||||
if (window.isDownloadSupported) return;
|
||||
// $a.target = "_blank"; // fallback
|
||||
// fallback for iOS
|
||||
$a.target = '_blank';
|
||||
const reader = new FileReader();
|
||||
reader.onload = e => $a.href = reader.result;
|
||||
reader.readAsDataURL(file.blob);
|
||||
}
|
||||
|
||||
_formatFileSize(bytes) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue