Skip to content

Commit

Permalink
Settings are reset on major release
Browse files Browse the repository at this point in the history
  • Loading branch information
eps0003 committed Aug 9, 2021
1 parent d4b6809 commit 0e92fe8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion html/popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
<br />
e.g. set it to 1% min and 99% max to find servers that are not empty and not full, or set it to 50% to 99% to find servers that are 'at least half full'.
</div>
<footer>Made by <a id="creator" href="https://twitter.com/epsilul" target="_blank">epsilon</a> | <a id="support" href="https://buymeacoffee.com/epsilul" target="_blank">Buy me a coffee</a></footer>
<footer>Made by <a id="creator" href="https://twitter.com/epsilul" target="_blank">epsilon</a> | <a id="support" href="https://buymeacoffee.com/epsilul" target="_blank">Buy me a coffee</a></footer>
</div>

<div id="search-grid">
Expand Down
11 changes: 8 additions & 3 deletions scripts/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ chrome.runtime.onInstalled.addListener(function (details) {
if (details.reason === "install") {
installedExtension(thisVersion);
} else if (details.reason === "update") {
const prevVersion = details.previousVersion;
updatedExtension(prevVersion, thisVersion);
updatedExtension(details.previousVersion, thisVersion);
}

displayMessage = details.reason;
Expand All @@ -18,7 +17,13 @@ function installedExtension(version) {
initSettings();
}

function updatedExtension(prevVersion, thisVersion) {}
function updatedExtension(prevVersion, thisVersion) {
//reset settings on major release
if (thisVersion.charAt(0) !== prevVersion.charAt(0)) {
chrome.storage.sync.clear();
initSettings();
}
}

function receivedServers() {
updateBadge();
Expand Down
4 changes: 2 additions & 2 deletions scripts/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ $(function () {
let text = [
//
`Thanks for using my extension! I hope it's been useful to you.`,
`The extension has been rewritten from scratch. As a result, you will most likely need to reset your settings from the options menu for the extension to work properly.`,
`The extension has been rewritten from scratch. As a result, your settings and favorited servers have unfortunately needed to be reset in order for the extension to work properly.`,
`You can view a full changelog on the <a href="https://forum.thd.vg/threads/27522" target="_blank">forum thread</a>.`,
`Be sure to leave a review on the <a href="https://chrome.google.com/webstore/detail/aipcclcgemecihikpdgfoonlfpjkekmp" target="_blank">store page</a> and share it with others.`,
`The extension is now open source on <a href="https://github.com/eps0003/kag-chrome-server-browser" target="_blank">GitHub</a>. Feel free to contribute or leave feedback and suggestions.`,
`Please consider supporting my work by <a href="https://buymeacoffee.com/epsilul" target="_blank">buying me a coffee</a>.`,
`Please consider supporting my work by <a href="https://buymeacoffee.com/epsilul" target="_blank">buying me a coffee</a>.`,
];
InfoModal("update-modal", "Extension update", text.join("<br /><br />"), 500);
}
Expand Down

0 comments on commit 0e92fe8

Please sign in to comment.