Fix the download icon on attachments
This commit is contained in:
parent
57d82eb39e
commit
21d65d2ad1
1 changed files with 9 additions and 6 deletions
|
@ -22,7 +22,7 @@ import MatrixClientPeg from '../../../MatrixClientPeg';
|
||||||
import sdk from '../../../index';
|
import sdk from '../../../index';
|
||||||
import {decryptFile} from '../../../utils/DecryptFile';
|
import {decryptFile} from '../../../utils/DecryptFile';
|
||||||
import Tinter from '../../../Tinter';
|
import Tinter from '../../../Tinter';
|
||||||
import 'isomorphic-fetch';
|
import request from 'browser-request';
|
||||||
import q from 'q';
|
import q from 'q';
|
||||||
import Modal from '../../../Modal';
|
import Modal from '../../../Modal';
|
||||||
|
|
||||||
|
@ -41,10 +41,13 @@ function updateTintedDownloadImage() {
|
||||||
// Download the svg as an XML document.
|
// Download the svg as an XML document.
|
||||||
// We could cache the XML response here, but since the tint rarely changes
|
// We could cache the XML response here, but since the tint rarely changes
|
||||||
// it's probably not worth it.
|
// it's probably not worth it.
|
||||||
q(fetch("img/download.svg")).then(function(response) {
|
// Also note that we can't use fetch here because fetch doesn't support
|
||||||
return response.text();
|
// file URLs, which the download image will be if we're running from
|
||||||
}).then(function(svgText) {
|
// the filesystem (like in an Electron wrapper).
|
||||||
const svg = new DOMParser().parseFromString(svgText, "image/svg+xml");
|
request({uri: "img/download.svg"}, (err, response, body) => {
|
||||||
|
if (err) return;
|
||||||
|
|
||||||
|
const svg = new DOMParser().parseFromString(body, "image/svg+xml");
|
||||||
// Apply the fixups to the XML.
|
// Apply the fixups to the XML.
|
||||||
const fixups = Tinter.calcSvgFixups([{contentDocument: svg}]);
|
const fixups = Tinter.calcSvgFixups([{contentDocument: svg}]);
|
||||||
Tinter.applySvgFixups(fixups);
|
Tinter.applySvgFixups(fixups);
|
||||||
|
@ -55,7 +58,7 @@ function updateTintedDownloadImage() {
|
||||||
Object.keys(mounts).forEach(function(id) {
|
Object.keys(mounts).forEach(function(id) {
|
||||||
mounts[id].tint();
|
mounts[id].tint();
|
||||||
});
|
});
|
||||||
}).done();
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Tinter.registerTintable(updateTintedDownloadImage);
|
Tinter.registerTintable(updateTintedDownloadImage);
|
||||||
|
|
Loading…
Reference in a new issue