0
0
Fork 0

Add option to disable blurhash previews (#11188)

* Add option to disable blurhash previews

* Update option text

* Change options order
This commit is contained in:
ThibG 2019-06-26 19:33:04 +02:00 committed by Eugen Rochko
parent 915c619394
commit 3086c645fd
10 changed files with 21 additions and 3 deletions

View file

@ -6,7 +6,7 @@ import IconButton from './icon_button';
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
import { isIOS } from '../is_mobile';
import classNames from 'classnames';
import { autoPlayGif, displayMedia } from '../initial_state';
import { autoPlayGif, displayMedia, useBlurhash } from '../initial_state';
import { decode } from 'blurhash';
const messages = defineMessages({
@ -81,6 +81,8 @@ class Item extends React.PureComponent {
}
_decode () {
if (!useBlurhash) return;
const hash = this.props.attachment.get('blurhash');
const pixels = decode(hash, 32, 32);

View file

@ -5,7 +5,7 @@ import { fromJS, is } from 'immutable';
import { throttle } from 'lodash';
import classNames from 'classnames';
import { isFullscreen, requestFullscreen, exitFullscreen } from '../ui/util/fullscreen';
import { displayMedia } from '../../initial_state';
import { displayMedia, useBlurhash } from '../../initial_state';
import Icon from 'mastodon/components/icon';
import { decode } from 'blurhash';
@ -298,6 +298,8 @@ class Video extends React.PureComponent {
}
_decode () {
if (!useBlurhash) return;
const hash = this.props.blurhash;
const pixels = decode(hash, 32, 32);

View file

@ -20,5 +20,6 @@ export const mascot = getMeta('mascot');
export const profile_directory = getMeta('profile_directory');
export const isStaff = getMeta('is_staff');
export const forceSingleColumn = !getMeta('advanced_layout');
export const useBlurhash = getMeta('use_blurhash');
export default initialState;