fix: tab name language, favourite marketplace backgrounds, birthday greeting message etc

This commit is contained in:
David Ralph
2021-08-22 15:00:05 +01:00
parent 490f42a9ad
commit 096df4f073
3 changed files with 25 additions and 12 deletions

View File

@@ -82,23 +82,26 @@ export default class Background extends PureComponent {
offline = true;
}
const setFavourited = (favourited) => {
this.setState({
url: favourited.url,
photoInfo: {
credit: favourited.credit,
location: favourited.location,
camera: favourited.camera
}
});
}
switch (localStorage.getItem('backgroundType')) {
case 'api':
if (offline) {
return this.setState(offlineBackground());
}
// favourite button
const favourited = JSON.parse(localStorage.getItem('favourite'));
if (favourited) {
return this.setState({
url: favourited.url,
photoInfo: {
credit: favourited.credit,
location: favourited.location,
camera: favourited.camera
}
});
return setFavourited(favourited);
}
// API background
@@ -205,6 +208,11 @@ export default class Background extends PureComponent {
return this.setState(offlineBackground());
}
const photofavourited = JSON.parse(localStorage.getItem('favourite'));
if (photofavourited) {
return setFavourited(photofavourited);
}
const photoPack = JSON.parse(localStorage.getItem('photo_packs'));
if (photoPack) {
const randomPhoto = photoPack[Math.floor(Math.random() * photoPack.length)];