optimise and add prefer dark theme detection back

This commit is contained in:
David Ralph
2020-09-16 17:14:38 +01:00
parent 8b79f82e29
commit 97f680d738
2 changed files with 15 additions and 25 deletions

View File

@@ -1,5 +1,4 @@
import React from 'react';
import supportsWebP from 'supports-webp';
import * as Constants from '../../modules/constants';
export default class Background extends React.PureComponent {
@@ -65,7 +64,7 @@ export default class Background extends React.PureComponent {
requestURL = `${Constants.UNSPLASH_URL}/getImage`;
break;
default: // Defaults to Mue
if (await supportsWebP && enabled === 'true') requestURL = `${Constants.API_URL}/getImage?webp=true`;
if (localStorage.getItem('supportswebp') === 'true' && enabled === 'true') requestURL = `${Constants.API_URL}/getImage?webp=true`;
else requestURL = `${Constants.API_URL}/getImage?category=Outdoors`;
break;
}