Skip to content

Commit

Permalink
- If all cookies are blocked in the browser, Vidi will now still star…
Browse files Browse the repository at this point in the history
…tup, but with a blank state.
  • Loading branch information
mapcentia committed May 30, 2022
1 parent 2290175 commit 7cfbab1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ and this project adheres to [CalVer](https://calver.org/).
"lineCap": "butt"
}
```
- If all cookies are blocked in the browser, Vidi will now still startup, but with a blank state.

## [2022.5.1] - 2022-12-5
### Added
Expand Down
11 changes: 6 additions & 5 deletions browser/modules/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -449,12 +449,11 @@ module.exports = {
}
}, 1000);
}).catch(error => {
console.error(`Unable to register the service worker, please load the application over HTTPS in order to use its full functionality`);
console.error(error);
});
} else {
console.warn(`Service workers are not supported in this browser, some features may be unavailable`);
}

if (window.localforage) {
localforage.getItem('appVersion').then(versionValue => {
localforage.getItem('appExtensionsBuild').then(extensionsBuildValue => {
Expand All @@ -464,7 +463,7 @@ module.exports = {
console.log(`Versioning: setting new application version (${window.vidiConfig.appVersion}, ${window.vidiConfig.appExtensionsBuild})`);
});
}).catch(error => {
throw new Error(`Unable to store current application version`);
console.error(`Unable to store current application version`, error);
});
} else {
// If two versions are correctly detected
Expand Down Expand Up @@ -511,15 +510,17 @@ module.exports = {
}).catch(error => {
localforage.setItem('appExtensionsBuild', '0').then(() => {
}).catch(error => {
throw new Error(`Unable to store current application version`);
console.error(`Unable to store current application version`, error);
});
});
}
}
});
}).catch(error =>{
console.error(`Can't get item from localforage`, error);
});
} else {
throw new Error(`localforage is not available`);
console.error(`localforage is not available`);
}
}
};
8 changes: 4 additions & 4 deletions browser/modules/state.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ const _getInternalState = () => {
if (LOG) console.log('State: after getting state');

if (error) {
throw new Error('State: error occured while accessing the store', error);
resolve({});
}

let localState = {modules: {}};
Expand All @@ -106,11 +106,11 @@ const _setInternalState = (value) => {
let result = new Promise((resolve, reject) => {
localforage.setItem(STATE_STORE_NAME, JSON.stringify(value), (error) => {
if (error) {
throw new Error('State: error occured while storing the state');
console.error(error);
} else {
if (LOG) console.log('State: saved', value);
resolve();
}
resolve();
});
});

Expand Down Expand Up @@ -160,7 +160,7 @@ module.exports = {
try {

if (!('localforage' in window)) {
throw new Error('localforage is not defined');
console.error('localforage is not defined');
}

var arr, i, maxBounds = setting.getMaxBounds();
Expand Down

0 comments on commit 7cfbab1

Please sign in to comment.