Skip to content

Commit

Permalink
Merge pull request #162 from mnao305/develop
Browse files Browse the repository at this point in the history
version 1.5.2
  • Loading branch information
mnao305 authored Dec 19, 2020
2 parents 9cdff11 + bfa397e commit ab1e6cf
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 20 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vrcfriendcheck",
"version": "1.5.1",
"version": "1.5.2",
"description": "VRChatにてフレンドのオンライ状況が確認できる拡張機能です",
"author": "mnao305 <naomasa305@gmail.com>",
"scripts": {
Expand Down
47 changes: 29 additions & 18 deletions src/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,48 +32,59 @@ Browser.alarms.onAlarm.addListener(async (alarm) => {
Browser.browserAction.setBadgeText({ text: '' })

// リスト取得
let favOnlineUsers, onlineFriends
let favUsers, onlineFriends
if (
favFriendOnlyNotification === 'on' ||
showNumberIconIsFavFriend === 'on'
) {
const tmp = await getFavFriend()
favOnlineUsers = tmp.favOnlineUsers
Browser.storage.local.set(
{
favOfflineUsers: tmp.favOfflineUsers,
favOnlineUsers: favOnlineUsers,
favLastUpdate: Date.now()
}
)
favUsers = await getFavFriend()
}
if (
favFriendOnlyNotification === 'off' ||
showNumberIconIsFavFriend === 'off'
) {
onlineFriends = await getOnlineFriends()
Browser.storage.local.set(
{
onlineUsers: onlineFriends,
lastUpdate: Date.now()
}
)
}

// 通知
if (favFriendOnlyNotification === 'on') {
newOnlineFriendCheck(favOnlineUsers)
newOnlineFriendCheck(favUsers.favOnlineUsers)
} else {
newOnlineFriendCheck(onlineFriends)
}
// バッジ表示
if (showNumberIcon === 'on') {
if (showNumberIconIsFavFriend === 'on') {
setOnlineUserNumOverIcon(favOnlineUsers.length)
setOnlineUserNumOverIcon(favUsers.favOnlineUsers.length)
} else {
setOnlineUserNumOverIcon(onlineFriends.length)
}
}

// リスト保存
if (
favFriendOnlyNotification === 'on' ||
showNumberIconIsFavFriend === 'on'
) {
Browser.storage.local.set(
{
favOfflineUsers: favUsers.favOfflineUsers,
favOnlineUsers: favUsers.favOnlineUsers,
favLastUpdate: Date.now()
}
)
}
if (
favFriendOnlyNotification === 'off' ||
showNumberIconIsFavFriend === 'off'
) {
Browser.storage.local.set(
{
onlineUsers: onlineFriends,
lastUpdate: Date.now()
}
)
}
} catch (error) {
console.error(error)
Browser.browserAction.setBadgeText({ text: '!' })
Expand Down

0 comments on commit ab1e6cf

Please sign in to comment.