diff --git a/html/src/app.js b/html/src/app.js index 7104a278..e8d85caf 100644 --- a/html/src/app.js +++ b/html/src/app.js @@ -5594,6 +5594,34 @@ import gameLogService from './service/gamelog.js' $app.watch.isStartAtWindowsStartup = saveVRCXWindowOption; $app.watch.isStartAsMinimizedState = saveVRCXWindowOption; $app.watch.isCloseToTray = saveVRCXWindowOption; + if (!configRepository.getString('VRCX_notificationTimeout')) { + $app.data.notificationTimeout = 3000; + configRepository.setString('VRCX_notificationTimeout', $app.data.notificationTimeout); + } + if (!configRepository.getString('VRCX_notificationJoinLeaveFilter')) { + $app.data.notificationJoinLeaveFilter = 'VIP'; + configRepository.setString('VRCX_notificationJoinLeaveFilter', $app.data.notificationJoinLeaveFilter); + } + if (!configRepository.getString('VRCX_notificationOnlineOfflineFilter')) { + $app.data.notificationOnlineOfflineFilter = 'VIP'; + configRepository.setString('VRCX_notificationOnlineOfflineFilter', $app.data.notificationOnlineOfflineFilter); + } + if (!configRepository.getString('VRCX_notificationPosition')) { + $app.data.notificationPosition = 'topCenter'; + configRepository.setString('VRCX_notificationPosition', $app.data.notificationPosition); + } + $app.data.notificationJoinLeaveFilter = configRepository.getString('VRCX_notificationJoinLeaveFilter'); + $app.methods.changeNotificationJoinLeaveFilter = function () { + configRepository.setString('VRCX_notificationJoinLeaveFilter', this.notificationJoinLeaveFilter); + }; + $app.data.notificationOnlineOfflineFilter = configRepository.getString('VRCX_notificationOnlineOfflineFilter'); + $app.methods.changeNotificationOnlineOfflineFilter = function () { + configRepository.setString('VRCX_notificationOnlineOfflineFilter', this.notificationOnlineOfflineFilter); + }; + $app.data.notificationPosition = configRepository.getString('VRCX_notificationPosition'); + $app.methods.changeNotificationPosition = function () { + configRepository.setString('VRCX_notificationPosition', this.notificationPosition); + }; API.$on('LOGIN', function () { $app.currentUserTreeData = []; diff --git a/html/src/index.pug b/html/src/index.pug index 28c96e3f..67324f0d 100644 --- a/html/src/index.pug +++ b/html/src/index.pug @@ -514,6 +514,36 @@ html el-switch(v-model="overlayNotifications") div(style="font-size:12px;margin-top:5px") el-button(size="small" icon="el-icon-time" @click="promptNotificationTimeout()") Notification Timeout + div(style="margin-top:30px") + span Join/Leave Notifications + div(style="font-size:12px;margin-top:5px") + el-radio-group(v-model="notificationJoinLeaveFilter" size="mini" style="margin-left:30px" @change="changeNotificationJoinLeaveFilter") + el-radio(label="VIP" v-model="notificationJoinLeaveFilter") VIP + el-radio(label="Friends" v-model="notificationJoinLeaveFilter") Friends + el-radio(label="Everyone" v-model="notificationJoinLeaveFilter") Everyone + el-radio(label="Off" v-model="notificationJoinLeaveFilter") Off + div(style="margin-top:30px") + span Online/Offline Notifications + div(style="font-size:12px;margin-top:5px") + el-radio-group(v-model="notificationOnlineOfflineFilter" size="mini" style="margin-left:30px" @change="changeNotificationOnlineOfflineFilter") + el-radio(label="VIP" v-model="notificationOnlineOfflineFilter") VIP + el-radio(label="Friends" v-model="notificationOnlineOfflineFilter") Friends + el-radio(label="Off" v-model="notificationOnlineOfflineFilter") Off + div(style="margin-top:30px") + span Notification position + div(style="font-size:12px;margin-top:5px") + el-radio-group(v-model="notificationPosition" size="mini" style="margin-left:30px" @change="changeNotificationPosition") + el-radio(label="top" v-model="notificationPosition") Top + el-radio(label="topLeft" v-model="notificationPosition") Top Left + el-radio(label="topCenter" v-model="notificationPosition") Top Center + el-radio(label="topRight" v-model="notificationPosition") Top Right + el-radio(label="center" v-model="notificationPosition") Center + el-radio(label="centerLeft" v-model="notificationPosition") Center Left + el-radio(label="centerRight" v-model="notificationPosition") Center Right + el-radio(label="bottom" v-model="notificationPosition") Bottom + el-radio(label="bottomLeft" v-model="notificationPosition") Bottom Left + el-radio(label="bottomCenter" v-model="notificationPosition") Bottom Center + el-radio(label="bottomRight" v-model="notificationPosition") Bottom Right div(style="margin-top:30px") span(style="font-weight:bold") Window div(style="font-size:12px;margin-top:5px") diff --git a/html/src/vr.js b/html/src/vr.js index 195a5741..a7cb0000 100644 --- a/html/src/vr.js +++ b/html/src/vr.js @@ -645,10 +645,8 @@ import webApiService from './service/webapi.js'; $app.methods.updateSharedFeed = async function () { // TODO: block mute hideAvatar unfriend this.isMinimalFeed = configRepository.getBool('VRCX_minimalFeed'); + var notificationPosition = configRepository.getString('VRCX_notificationPosition'); var notificationTimeout = configRepository.getString('VRCX_notificationTimeout'); - if (notificationTimeout == '' || isNaN(notificationTimeout)) { - notificationTimeout = 3000; - } var theme = 'relax'; if (configRepository.getBool('isDarkMode') === true) { theme = 'sunset'; @@ -663,21 +661,21 @@ import webApiService from './service/webapi.js'; this.feeds = feeds; if (this.appType === '2') { + var notificationJoinLeaveFilter = configRepository.getString('VRCX_notificationJoinLeaveFilter'); + var notificationOnlineOfflineFilter = configRepository.getString('VRCX_notificationOnlineOfflineFilter'); var map = {}; _feeds.forEach((feed) => { - if (feed.isFavorite) { - if (feed.type === 'OnPlayerJoined' || - feed.type === 'OnPlayerLeft') { - if (!map[feed.data] || - map[feed.data] < feed.created_at) { - map[feed.data] = feed.created_at; - } - } else if (feed.type === 'Online' || - feed.type === 'Offline') { - if (!map[feed.displayName] || - map[feed.displayName] < feed.created_at) { - map[feed.displayName] = feed.created_at; - } + if (feed.type === 'OnPlayerJoined' || + feed.type === 'OnPlayerLeft') { + if (!map[feed.data] || + map[feed.data] < feed.created_at) { + map[feed.data] = feed.created_at; + } + } else if (feed.type === 'Online' || + feed.type === 'Offline') { + if (!map[feed.displayName] || + map[feed.displayName] < feed.created_at) { + map[feed.displayName] = feed.created_at; } } if (feed.type === 'invite' || @@ -696,7 +694,8 @@ import webApiService from './service/webapi.js'; if (configRepository.getBool('VRCX_overlayNotifications') === true) { var notys = []; this.feeds.forEach((feed) => { - if (feed.isFavorite) { + if (((notificationOnlineOfflineFilter === "Friends") && (feed.isFriend)) || + ((notificationOnlineOfflineFilter === "VIP") && (feed.isFavorite))) { if (feed.type === 'Online' || feed.type === 'Offline') { if (!map[feed.displayName] || @@ -704,7 +703,12 @@ import webApiService from './service/webapi.js'; map[feed.displayName] = feed.created_at; notys.push(feed); } - } else if (feed.type === 'OnPlayerJoined' || + } + } + if ((notificationJoinLeaveFilter === "Everyone") || + ((notificationJoinLeaveFilter === "Friends") && (feed.isFriend)) || + ((notificationJoinLeaveFilter === "VIP") && (feed.isFavorite))) { + if (feed.type === 'OnPlayerJoined' || feed.type === 'OnPlayerLeft') { if (!map[feed.data] || map[feed.data] < feed.created_at) { @@ -736,6 +740,7 @@ import webApiService from './service/webapi.js'; type: 'alert', theme: theme, timeout: notificationTimeout, + layout: notificationPosition, text: `${noty.data} has joined` }).show(); break; @@ -744,6 +749,7 @@ import webApiService from './service/webapi.js'; type: 'alert', theme: theme, timeout: notificationTimeout, + layout: notificationPosition, text: `${noty.data} has left` }).show(); break; @@ -752,6 +758,7 @@ import webApiService from './service/webapi.js'; type: 'alert', theme: theme, timeout: notificationTimeout, + layout: notificationPosition, text: `${noty.displayName} has logged in` }).show(); break; @@ -760,6 +767,7 @@ import webApiService from './service/webapi.js'; type: 'alert', theme: theme, timeout: notificationTimeout, + layout: notificationPosition, text: `${noty.displayName} has logged out` }).show(); break; @@ -768,6 +776,7 @@ import webApiService from './service/webapi.js'; type: 'alert', theme: theme, timeout: notificationTimeout, + layout: notificationPosition, text: `${noty.senderUsername} has invited you to ${noty.details.worldName}` }).show(); break; @@ -776,6 +785,7 @@ import webApiService from './service/webapi.js'; type: 'alert', theme: theme, timeout: notificationTimeout, + layout: notificationPosition, text: `${noty.senderUsername} has requested an invite` }).show(); break; @@ -784,6 +794,7 @@ import webApiService from './service/webapi.js'; type: 'alert', theme: theme, timeout: notificationTimeout, + layout: notificationPosition, text: `${noty.senderUsername} has sent you a friend request` }).show(); break;