forked from rugk/awesome-emoji-picker
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Also adds migration to convert old emoji set setting to new one. And removed old emoji sets from doc/Readme etc.
- Loading branch information
Showing
15 changed files
with
89 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/** | ||
* Upgrades user data on installation of new updates. | ||
* | ||
* Attention: Currently you must not include this script asyncronously. See | ||
* https://bugzilla.mozilla.org/show_bug.cgi?id=1506464 for details. | ||
* | ||
* @module InstallUpgrade | ||
*/ | ||
|
||
/** | ||
* Upgrade the emoji sets to replaced removed/deprecated ones. | ||
* | ||
* @private | ||
* @param {Object} emojiPickerSettings | ||
* @returns {Promise} | ||
*/ | ||
async function upgradeEmojiSet(emojiPickerSettings) { | ||
// change removed emoji sets to best existing one | ||
switch (emojiPickerSettings.set) { | ||
case "emojione": // removed in v3.0.0 of emoji-mart https://github.com/missive/emoji-mart/blob/master/CHANGELOG.md#v300 | ||
emojiPickerSettings.set = "twitter"; // upgrade set from EmojiOne to Twitter | ||
emojiPickerSettings.setMigratedToTwitterFrom = "emojione"; // save old setting to be able to return to that later | ||
break; | ||
case "messenger": // removed in v3.0.0 of emoji-mart https://github.com/missive/emoji-mart/blob/master/CHANGELOG.md#v300 | ||
emojiPickerSettings.set = "facebook"; // upgrade set from Messenger to Facebook | ||
emojiPickerSettings.setMigratedToFacebookFrom = "messenger"; // save old setting to be able to return to that later | ||
break; | ||
default: // no upgrade needed | ||
// eslint-disable-next-line no-case-declarations | ||
const text = "No emoji set upgrade needed."; | ||
console.log(text); | ||
return Promise.reject(new Error(text)); | ||
} | ||
|
||
console.log("Doing emoji set upgrade."); | ||
await browser.storage.sync.set({ | ||
emojiPicker: emojiPickerSettings | ||
}); | ||
|
||
console.info("Emoji set upgrade successful.", await browser.storage.sync.get()); | ||
return Promise.resolve(); | ||
} | ||
|
||
/** | ||
* Checks whether an upgrade is needed. | ||
* | ||
* @see {@link https://developer.mozilla.org/docs/Mozilla/Add-ons/WebExtensions/API/runtime/onInstalled} | ||
* @private | ||
* @param {Object} details | ||
* @returns {Promise} | ||
*/ | ||
async function handleInstalled(details) { | ||
// only trigger for usual addon updates | ||
if (details.reason !== "update") { | ||
return; | ||
} | ||
|
||
console.log(`Doing upgrade from ${details.previousVersion}.`, details); | ||
const oldData = await browser.storage.sync.get(); | ||
|
||
// ignore returned promise, because it just carries the update status and is already logged | ||
upgradeEmojiSet(oldData.emojiPicker).catch(() => {}); | ||
} | ||
|
||
/** | ||
* Inits module. | ||
* | ||
* @private | ||
* @returns {void} | ||
*/ | ||
function init() { | ||
browser.runtime.onInstalled.addListener(handleInstalled); | ||
} | ||
|
||
init(); |
Submodule emoji-mart-embed
updated
9 files
+26 −0 | .github/workflows/nodejs.yml | |
+2 −0 | README.md | |
+1,988 −117 | THIRD_PARTY_LICENSES.md | |
+2 −1 | dist/emoji-mart.css | |
+1 −1 | dist/emoji-mart.js | |
+1 −1 | dist/emoji-mart.js.map | |
+918 −224 | package-lock.json | |
+8 −7 | package.json | |
+2 −2 | src.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters