Skip to content

Commit

Permalink
fix: option to show release notes on GitHub when the add-on is updated
Browse files Browse the repository at this point in the history
  • Loading branch information
teddy-gustiaux committed Jun 30, 2019
1 parent 172528f commit a938635
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 23 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@

All notable changes to this project are documented in this file.

> 🛈 No longer want to see this page when the add-on is updated?
>
> Go to the add-on settings, and uncheck the option *`Show the release notes on GitHub when the add-on is updated`* in the `About` section.
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
Additionally, the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0-beta.2/) format is respected and used to generate the [conventional changelog](https://github.com/conventional-changelog/conventional-changelog).
Additionally, the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0-beta.2/) format is respected and used to generate this [conventional changelog](https://github.com/conventional-changelog/conventional-changelog).

# [2.10.0](https://github.com/teddy-gustiaux/default-bookmark-folder/compare/v2.9.0...v2.10.0) (2019-05-21)

Expand Down
4 changes: 2 additions & 2 deletions src/_locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@
"message": "About"
},
"options_release_open_changelog": {
"message": "Show the release notes when the add-on is updated"
"message": "Show the release notes on GitHub when the add-on is updated"
},
"options_release_changelog_github": {
"message": "The release notes of the add-on are now accessible on GitHub."
"message": "The release notes of the add-on are accessible on GitHub (in English only)."
},
"options_release_full_changelog": {
"message": "Access the changelog"
Expand Down
4 changes: 2 additions & 2 deletions src/_locales/fr/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@
"message": "À propos"
},
"options_release_open_changelog": {
"message": "Montrer les notes de version quand l’extension est mise à jour"
"message": "Ouvrir les notes de version sur GitHub quand l’extension est mise à jour"
},
"options_release_changelog_github": {
"message": "Les notes de versions sont maintenant consultables sur GitHub."
"message": "Les notes de versions sont consultables sur GitHub (en anglais uniquement)."
},
"options_release_full_changelog": {
"message": "Accéder aux notes de versions"
Expand Down
4 changes: 2 additions & 2 deletions src/_locales/hu/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@
"message": "About"
},
"options_release_open_changelog": {
"message": "Show the release notes when the add-on is updated"
"message": "Show the release notes on GitHub when the add-on is updated"
},
"options_release_changelog_github": {
"message": "The release notes of the add-on are now accessible on GitHub."
"message": "The release notes of the add-on are accessible on GitHub (in English only)."
},
"options_release_full_changelog": {
"message": "Access the changelog"
Expand Down
4 changes: 2 additions & 2 deletions src/_locales/ru/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@
"message": "About"
},
"options_release_open_changelog": {
"message": "Показывать примечания к релизам при каждом обновлении расширения"
"message": "Show the release notes on GitHub when the add-on is updated"
},
"options_release_changelog_github": {
"message": "The release notes of the add-on are now accessible on GitHub."
"message": "The release notes of the add-on are accessible on GitHub (in English only)."
},
"options_release_full_changelog": {
"message": "Access the changelog"
Expand Down
2 changes: 2 additions & 0 deletions src/background/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,13 @@ async function onContextMenuClick(info, tab) {
}

async function onAddonInstallation(details) {
globalOptions = await getNewOptions(globalOptions);
const update = new Update(globalOptions);
if (details.reason === 'install') {
update.openOptionsPage();
} else if (details.reason === 'update') {
if (details.previousVersion[0] === '1') update.updateFromFirstVersion();
if (details.previousVersion === '2.10.0') update.updateRemovedNewReleaseOption();
await update.displayReleaseNotes();
}
}
Expand Down
16 changes: 12 additions & 4 deletions src/background/components/Update.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,27 @@ class Update {
this._options = options;
}

openOptionsPage() {
browser.runtime.openOptionsPage();
async openChangelogPage() {
return browser.tabs.create({
url:
'https://github.com/teddy-gustiaux/default-bookmark-folder/blob/master/CHANGELOG.md',
active: true,
});
}

async displayReleaseNotes() {
if (this._options.isDisplayReleaseNotesEnabled()) {
await browser.storage.local.set({ [NEW_RELEASE]: true });
this.openOptionsPage();
this.openChangelogPage();
}
}

// Update from version 1.*
updateFromFirstVersion() {
browser.storage.local.remove(['override', 'icon', 'inbox', 'addtotop']);
}

// Update from version 2.10.0
updateRemovedNewReleaseOption() {
browser.storage.local.remove('newRelease');
}
}
1 change: 0 additions & 1 deletion src/globals.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ const BUILTIN = 'builtin';
const ALLTABS = 'alltabs';
const ICON = 'icon';
const MISC = 'miscellaneous';
const NEW_RELEASE = 'newRelease';
const NOTIFICATION = 'updateNotification';
const TAB = 'tab';
// List of stored options properties
Expand Down
3 changes: 1 addition & 2 deletions src/options/scripts/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@ const OPTIONS_BOILERPLATE = {
[MISC]: {
[LAST_USED_FOLDER]: 'string',
},
[NOTIFICATION]: 'boolean', // Welcome message diplayed (at least once)
[NOTIFICATION]: 'boolean', // Welcome message displayed (at least once)
[TAB]: 'integer',
[NEW_RELEASE]: 'boolean', // This is a new version
};

// List of all add-on options IDs for selection
Expand Down
7 changes: 0 additions & 7 deletions src/options/scripts/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,6 @@ function closeWelcomeMessage() {

async function welcomeMessage() {
const options = await getOptions();
if (
Object.prototype.hasOwnProperty.call(options, NEW_RELEASE) &&
options[NEW_RELEASE] === true
) {
switchTab(TAB_DEFAULT_NUMBER);
browser.storage.local.set({ [NEW_RELEASE]: false });
}
if (
!Object.prototype.hasOwnProperty.call(options, NOTIFICATION) ||
options[NOTIFICATION] !== true
Expand Down

0 comments on commit a938635

Please sign in to comment.