Skip to content

Commit

Permalink
Version bump and version specific logic
Browse files Browse the repository at this point in the history
  • Loading branch information
aopell committed Dec 3, 2018
1 parent 9400b89 commit 2e3d802
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion js/all.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ chrome.storage.sync.get(["newVersion"], s => {
]
});

versionSpecificFirstLaunch(currentVersion);
versionSpecificFirstLaunch(currentVersion, s.newVersion);
chrome.storage.sync.set({ newVersion: chrome.runtime.getManifest().version });
}
});
Expand Down
19 changes: 12 additions & 7 deletions js/version-specific.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
function versionSpecificFirstLaunch(version) {
switch (version) {
function versionSpecificFirstLaunch(currentVersion, previousVersion) {
switch (currentVersion) {
case "4.3":
if (previousVersion != "4.2") {
versionSpecificFirstLaunch("4.2");
}
break;
case "4.2":
iziToast.show({
theme: 'dark',
Expand All @@ -25,25 +30,25 @@ function versionSpecificFirstLaunch(version) {
chrome.storage.sync.get(["unreadBroadcasts", "broadcasts", "themes"], (storage) => {
let broadcasts = storage.unreadBroadcasts || [];
broadcasts.push({
id: Number.parseInt(version.replace('.', '')),
id: Number.parseInt(currentVersion.replace('.', '')),
title: '',
message: '<span style="font-size: 16px; font-weight: bold">Take the Schoology Plus Fall 2018 Survey!</span><br/><br/><span style="font-size: 14px">Let us know your thoughts about Schoology Plus and complete the survey for a chance to win <strong style="background-color: yellow">one of two $5 Amazon gift cards!</strong><br/><br/><strong style="background-color: yellow"><a href="https://goo.gl/forms/EVi8cTaakVhLekiN2" target="_blank">Click Here to Take The Survey!</a></strong></span><br/><br/>',
shortMessage: "Complete for a chance to win an Amazon gift card!",
timestamp: Date.now()
});

let oldFormatThemesExist = false;
for(let t of storage.themes || []) {
if(t.icons && !(t.icons instanceof Array)) {
for (let t of storage.themes || []) {
if (t.icons && !(t.icons instanceof Array)) {
oldFormatThemesExist = true;
let newIconsArray = [];
for(let k in t.icons) {
for (let k in t.icons) {
newIconsArray.push([k, t.icons[k]]);
}
t.icons = newIconsArray;
}
}
if(oldFormatThemesExist) {
if (oldFormatThemesExist) {
alert("Warning! One or more of your themes were created using an old and broken format for custom icons. If custom icons have not been working for you, please proceed to the theme editor to fix the issue.");
}

Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"update_url": "https://aopell.me/SchoologyPlus/update.json"
}
},
"version": "4.2",
"version": "4.3",
"icons": {
"128": "imgs/[email protected]",
"64": "imgs/[email protected]",
Expand Down

0 comments on commit 2e3d802

Please sign in to comment.