1
0
mirror of https://github.com/RobinLinus/snapdrop.git synced 2025-05-18 08:30:09 -07:00

iOS: More fallback tests

This commit is contained in:
RobinLinus 2018-10-11 00:31:07 +02:00
parent 508b5e22f9
commit bc2956f5ad
2 changed files with 11 additions and 4 deletions

View File

@ -480,13 +480,14 @@ class FileDigester {
this.progress = this._bytesReceived / this._size; this.progress = this._bytesReceived / this._size;
if (this._bytesReceived < this._size) return; if (this._bytesReceived < this._size) return;
// we are done // we are done
let received = new Blob(this._buffer, { type: this._mime }); let blob = new Blob(this._buffer, { type: this._mime });
let url = URL.createObjectURL(received); let url = URL.createObjectURL(blob);
this._callback({ this._callback({
name: this._name, name: this._name,
mime: this._mime, mime: this._mime,
size: this._size, size: this._size,
url: url url: url,
blob: blob
}); });
} }

View File

@ -238,7 +238,13 @@ class ReceiveDialog extends Dialog {
this.show(); this.show();
if (window.isDownloadSupported) return; if (window.isDownloadSupported) return;
$a.target = "_blank"; // fallback // fallback for iOS
$a.href = null;
let reader = new FileReader();
reader.onload = e => {
$a.onclick = window.open(reader.result,'_blank');
}
reader.readAsDataURL(file.blob);
} }
_formatFileSize(bytes) { _formatFileSize(bytes) {