Respond to PR feedback
- makeThumbnail -> makeImageThumbnail - duplicate 'display: flex' - remove no-longer-applicable comment
This commit is contained in:
parent
ac0b50d20f
commit
27a30b3267
3 changed files with 5 additions and 8 deletions
|
@ -631,7 +631,7 @@
|
||||||
const objectUrl = this.makeObjectUrl(data, contentType);
|
const objectUrl = this.makeObjectUrl(data, contentType);
|
||||||
|
|
||||||
const thumbnail = Signal.Util.GoogleChrome.isImageTypeSupported(contentType)
|
const thumbnail = Signal.Util.GoogleChrome.isImageTypeSupported(contentType)
|
||||||
? await Whisper.FileInputView.makeThumbnail(128, objectUrl)
|
? await Whisper.FileInputView.makeImageThumbnail(128, objectUrl)
|
||||||
: await Whisper.FileInputView.makeVideoThumbnail(128, objectUrl);
|
: await Whisper.FileInputView.makeVideoThumbnail(128, objectUrl);
|
||||||
|
|
||||||
URL.revokeObjectURL(objectUrl);
|
URL.revokeObjectURL(objectUrl);
|
||||||
|
@ -1163,8 +1163,6 @@
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Maybe in the future we could try to pull the thumbnail from a video ourselves,
|
|
||||||
// but for now we will rely on incoming thumbnails only.
|
|
||||||
if (!Signal.Util.GoogleChrome.isImageTypeSupported(first.contentType) &&
|
if (!Signal.Util.GoogleChrome.isImageTypeSupported(first.contentType) &&
|
||||||
!Signal.Util.GoogleChrome.isVideoTypeSupported(first.contentType)) {
|
!Signal.Util.GoogleChrome.isVideoTypeSupported(first.contentType)) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
template: i18n('unsupportedFileType'),
|
template: i18n('unsupportedFileType'),
|
||||||
});
|
});
|
||||||
|
|
||||||
function makeThumbnail(size, objectUrl) {
|
function makeImageThumbnail(size, objectUrl) {
|
||||||
return new Promise(((resolve, reject) => {
|
return new Promise(((resolve, reject) => {
|
||||||
const img = document.createElement('img');
|
const img = document.createElement('img');
|
||||||
img.onerror = reject;
|
img.onerror = reject;
|
||||||
|
@ -117,7 +117,7 @@
|
||||||
const arrayBuffer = await blobToArrayBuffer(blob);
|
const arrayBuffer = await blobToArrayBuffer(blob);
|
||||||
const screenshotObjectUrl = makeObjectUrl(arrayBuffer, 'image/png');
|
const screenshotObjectUrl = makeObjectUrl(arrayBuffer, 'image/png');
|
||||||
|
|
||||||
return makeThumbnail(size, screenshotObjectUrl);
|
return makeImageThumbnail(size, screenshotObjectUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
Whisper.FileInputView = Backbone.View.extend({
|
Whisper.FileInputView = Backbone.View.extend({
|
||||||
|
@ -354,7 +354,7 @@
|
||||||
|
|
||||||
const objectUrl = URL.createObjectURL(file);
|
const objectUrl = URL.createObjectURL(file);
|
||||||
|
|
||||||
const arrayBuffer = await makeThumbnail(size, objectUrl);
|
const arrayBuffer = await makeImageThumbnail(size, objectUrl);
|
||||||
URL.revokeObjectURL(objectUrl);
|
URL.revokeObjectURL(objectUrl);
|
||||||
|
|
||||||
return this.readFile(arrayBuffer);
|
return this.readFile(arrayBuffer);
|
||||||
|
@ -447,7 +447,7 @@
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
Whisper.FileInputView.makeThumbnail = makeThumbnail;
|
Whisper.FileInputView.makeImageThumbnail = makeImageThumbnail;
|
||||||
Whisper.FileInputView.makeVideoThumbnail = makeVideoThumbnail;
|
Whisper.FileInputView.makeVideoThumbnail = makeVideoThumbnail;
|
||||||
Whisper.FileInputView.makeVideoScreenshot = makeVideoScreenshot;
|
Whisper.FileInputView.makeVideoScreenshot = makeVideoScreenshot;
|
||||||
}());
|
}());
|
||||||
|
|
|
@ -940,7 +940,6 @@ span.status {
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
|
|
||||||
display: flex;
|
|
||||||
text-align: center;
|
text-align: center;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
Loading…
Add table
Reference in a new issue