fix: background interval

Co-authored-by: David Ralph <me@davidcralph.co.uk>
This commit is contained in:
alexsparkes
2022-10-07 19:36:58 +01:00
parent 3cc40fd15f
commit 8450d15be6
14 changed files with 55 additions and 18 deletions

View File

@@ -401,14 +401,14 @@ export default class Background extends PureComponent {
this.interval = setInterval(() => {
const targetTime = Number(
Number(localStorage.getItem('backgroundStartTime')) +
Number(localStorage.getItem('backgroundchange')),
Number(test),
);
const currentTime = Number(Date.now());
const type = localStorage.getItem('backgroundType');
if (test !== null) {
if (test !== null && test !== 'refresh') {
if (currentTime >= targetTime) {
console.log('Is this true?');
element.classList.remove('fade-in');
this.getBackground();
localStorage.setItem('backgroundStartTime', Date.now());
} else {
@@ -419,7 +419,6 @@ export default class Background extends PureComponent {
}
const offline = localStorage.getItem('offlineMode');
if (current.url.startsWith('http') && offline === 'false') {
console.log('current.url one?');
if (this.state.firstTime !== true) {
this.setState(current);
}