mirror of https://github.com/vector-im/riot-web
Also only download images after clicking on them
parent
e5228e2795
commit
7eb54cc83c
|
@ -85,6 +85,7 @@ export default class MImageBody extends React.Component {
|
||||||
showImage() {
|
showImage() {
|
||||||
localStorage.setItem("mx_ShowImage_" + this.props.mxEvent.getId(), "true");
|
localStorage.setItem("mx_ShowImage_" + this.props.mxEvent.getId(), "true");
|
||||||
this.setState({showImage: true});
|
this.setState({showImage: true});
|
||||||
|
this._downloadImage();
|
||||||
}
|
}
|
||||||
|
|
||||||
onClick(ev) {
|
onClick(ev) {
|
||||||
|
@ -253,10 +254,7 @@ export default class MImageBody extends React.Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
_downloadImage() {
|
||||||
this.unmounted = false;
|
|
||||||
this.context.on('sync', this.onClientSync);
|
|
||||||
|
|
||||||
const content = this.props.mxEvent.getContent();
|
const content = this.props.mxEvent.getContent();
|
||||||
if (content.file !== undefined && this.state.decryptedUrl === null) {
|
if (content.file !== undefined && this.state.decryptedUrl === null) {
|
||||||
let thumbnailPromise = Promise.resolve(null);
|
let thumbnailPromise = Promise.resolve(null);
|
||||||
|
@ -289,9 +287,18 @@ export default class MImageBody extends React.Component {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Remember that the user wanted to show this particular image
|
componentDidMount() {
|
||||||
if (!this.state.showImage && localStorage.getItem("mx_ShowImage_" + this.props.mxEvent.getId()) === "true") {
|
this.unmounted = false;
|
||||||
|
this.context.on('sync', this.onClientSync);
|
||||||
|
|
||||||
|
const showImage = this.state.showImage ||
|
||||||
|
localStorage.getItem("mx_ShowImage_" + this.props.mxEvent.getId()) === "true";
|
||||||
|
|
||||||
|
if (showImage) {
|
||||||
|
// Don't download anything becaue we don't want to display anything.
|
||||||
|
this._downloadImage();
|
||||||
this.setState({showImage: true});
|
this.setState({showImage: true});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue