diff --git a/src/components/modals/main/settings/sections/background/Background.jsx b/src/components/modals/main/settings/sections/background/Background.jsx
index 7d8f8fc2..e64b367d 100644
--- a/src/components/modals/main/settings/sections/background/Background.jsx
+++ b/src/components/modals/main/settings/sections/background/Background.jsx
@@ -154,6 +154,21 @@ export default class BackgroundSettings extends PureComponent {
}
];
+ const interval = (
+ <>
+
+
+
+
+
+
+
+
+
+
+ >
+ );
+
const APISettings = (
<>
@@ -171,16 +186,7 @@ export default class BackgroundSettings extends PureComponent {
-
-
-
-
-
-
-
-
-
-
+ {interval}
>
);
@@ -201,6 +207,7 @@ export default class BackgroundSettings extends PureComponent {
))}
this.customBackground(e, false, this.state.currentBackgroundIndex)} />
+ {interval}
>
);
diff --git a/src/components/widgets/background/Background.jsx b/src/components/widgets/background/Background.jsx
index c12d44e7..b2e4b8bc 100644
--- a/src/components/widgets/background/Background.jsx
+++ b/src/components/widgets/background/Background.jsx
@@ -210,14 +210,18 @@ export default class Background extends PureComponent {
}
if (customBackground !== '' && customBackground !== 'undefined' && customBackground !== ['']) {
- this.setState({
+ const object = {
url: customBackground,
type: 'custom',
video: videoCheck(customBackground),
photoInfo: {
hidden: true
}
- });
+ };
+
+ this.setState(object);
+
+ localStorage.setItem('currentBackground', JSON.stringify(object));
}
break;
@@ -338,7 +342,8 @@ export default class Background extends PureComponent {
const interval = localStorage.getItem('backgroundchange');
if (interval && interval !== 'refresh') {
- if (localStorage.getItem('backgroundType') === 'api') {
+ const type = localStorage.getItem('backgroundType')
+ if (type === 'api' || type === 'custom') {
Interval(() => {
try {
document.getElementById('backgroundImage').classList.remove('fade-in');
@@ -352,6 +357,9 @@ export default class Background extends PureComponent {
try {
// todo: refactor this mess
const current = JSON.parse(localStorage.getItem('currentBackground'));
+ if (current.type !== type) {
+ this.getBackground();
+ }
const offline = localStorage.getItem('offlineMode');
if (current.url.startsWith('http') && offline === 'false') {
this.setState(current);