Skip to content

Commit

Permalink
1.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
riophae committed Sep 12, 2019
1 parent 251a786 commit f64ad29
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
18 changes: 15 additions & 3 deletions src/features/notifications/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,23 @@ import {
} from '@constants'

const NOTIFICATION_TIMEOUT = 15 * 1000

export default context => {
const { readOptionValue, requireModules } = context
const { storage, notification } = requireModules([ 'storage', 'notification' ])

// 1.0.0 是一个不能使用的版本,下面的代码使得当用户升级到 1.0.1 后也能看到 1.0.0 的更新通知
const patchedVersionHistory = do {
const patched = [ ...versionHistory ]
const updateDetailsFor100 = versionHistory.find(({ version }) => version === '1.0.0')
const updateDetailsFor101 = { ...updateDetailsFor100 }
const indexOf100 = patched.indexOf(updateDetailsFor100)

updateDetailsFor101.version = '1.0.1'
patched.splice(indexOf100, 0, updateDetailsFor101)

patched // eslint-disable-line no-unused-expressions
}

function isExtensionUpgraded() {
return storage.read(
STORAGE_KEY_IS_EXTENSION_UPGRADED,
Expand All @@ -20,7 +32,7 @@ export default context => {

function getCurrentVersionUpdateDetails() {
const currentVersion = getExtensionVersion()
const versionItem = versionHistory.find(({ version }) => version === currentVersion)
const versionItem = patchedVersionHistory.find(({ version }) => version === currentVersion)

if (!versionItem) return ''
if (versionItem.summary) return versionItem.summary
Expand All @@ -42,7 +54,7 @@ export default context => {
const onClick = () => {
const url = chrome.runtime.getURL('settings.html') + '#version-history'

chrome.tabs.create(url)
chrome.tabs.create({ url, active: true })
}

notification.create({
Expand Down
2 changes: 1 addition & 1 deletion static/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "太空饭否",
"description": "太空饭否是一个免费、用心的开源项目,是目前最强大最好用的饭否浏览器扩展。可以给饭否添加回复和转发展开、桌面通知、浮动输入框、多用户切换、消息批量管理、自动翻页等功能,并且使饭否页面变得更美更舒心,符合您的使用习惯。",
"version": "1.0.0",
"version": "1.0.1",
"version_name": "",
"manifest_version": 2,
"minimum_chrome_version": "73",
Expand Down

0 comments on commit f64ad29

Please sign in to comment.