Invites in feed and notifications

This commit is contained in:
Natsumi
2020-11-19 01:28:00 +13:00
committed by pypy
parent 0291211e4f
commit fd36751019
4 changed files with 50 additions and 9 deletions
+12 -3
View File
@@ -3460,6 +3460,15 @@ import gameLogService from './service/gamelog.js'
++j; ++j;
} }
} }
var { data } = this.notificationTable;
for (i = 0; i < data.length; i++) {
var ctx = data[i];
arr.push({
...ctx,
isFriend: this.friends.has(ctx.senderUserId),
isFavorite: API.cachedFavoritesByObjectId.has(ctx.senderUserId)
});
}
arr.sort(function (a, b) { arr.sort(function (a, b) {
if (a.created_at < b.created_at) { if (a.created_at < b.created_at) {
return 1; return 1;
@@ -5546,7 +5555,7 @@ import gameLogService from './service/gamelog.js'
$app.data.hidePrivateFromFeed = configRepository.getBool('VRCX_hidePrivateFromFeed'); $app.data.hidePrivateFromFeed = configRepository.getBool('VRCX_hidePrivateFromFeed');
$app.data.hideLoginsFromFeed = configRepository.getBool('VRCX_hideLoginsFromFeed'); $app.data.hideLoginsFromFeed = configRepository.getBool('VRCX_hideLoginsFromFeed');
$app.data.hideDevicesFromFeed = configRepository.getBool('VRCX_hideDevicesFromFeed'); $app.data.hideDevicesFromFeed = configRepository.getBool('VRCX_hideDevicesFromFeed');
$app.data.vipNotifications = configRepository.getBool('VRCX_VIPNotifications'); $app.data.overlayNotifications = configRepository.getBool('VRCX_overlayNotifications');
$app.data.minimalFeed = configRepository.getBool('VRCX_minimalFeed'); $app.data.minimalFeed = configRepository.getBool('VRCX_minimalFeed');
var saveOpenVROption = function () { var saveOpenVROption = function () {
configRepository.setBool('openVR', this.openVR); configRepository.setBool('openVR', this.openVR);
@@ -5554,7 +5563,7 @@ import gameLogService from './service/gamelog.js'
configRepository.setBool('VRCX_hidePrivateFromFeed', this.hidePrivateFromFeed); configRepository.setBool('VRCX_hidePrivateFromFeed', this.hidePrivateFromFeed);
configRepository.setBool('VRCX_hideLoginsFromFeed', this.hideLoginsFromFeed); configRepository.setBool('VRCX_hideLoginsFromFeed', this.hideLoginsFromFeed);
configRepository.setBool('VRCX_hideDevicesFromFeed', this.hideDevicesFromFeed); configRepository.setBool('VRCX_hideDevicesFromFeed', this.hideDevicesFromFeed);
configRepository.setBool('VRCX_VIPNotifications', this.vipNotifications); configRepository.setBool('VRCX_overlayNotifications', this.overlayNotifications);
configRepository.setBool('VRCX_minimalFeed', this.minimalFeed); configRepository.setBool('VRCX_minimalFeed', this.minimalFeed);
}; };
$app.watch.openVR = saveOpenVROption; $app.watch.openVR = saveOpenVROption;
@@ -5562,7 +5571,7 @@ import gameLogService from './service/gamelog.js'
$app.watch.hidePrivateFromFeed = saveOpenVROption; $app.watch.hidePrivateFromFeed = saveOpenVROption;
$app.watch.hideLoginsFromFeed = saveOpenVROption; $app.watch.hideLoginsFromFeed = saveOpenVROption;
$app.watch.hideDevicesFromFeed = saveOpenVROption; $app.watch.hideDevicesFromFeed = saveOpenVROption;
$app.watch.vipNotifications = saveOpenVROption; $app.watch.overlayNotifications = saveOpenVROption;
$app.watch.minimalFeed = saveOpenVROption; $app.watch.minimalFeed = saveOpenVROption;
$app.data.isDarkMode = configRepository.getBool('isDarkMode'); $app.data.isDarkMode = configRepository.getBool('isDarkMode');
$appDarkStyle.disabled = $app.data.isDarkMode === false; $appDarkStyle.disabled = $app.data.isDarkMode === false;
+5 -5
View File
@@ -498,19 +498,19 @@ html
span(style="display:inline-block;min-width:150px") Force Run span(style="display:inline-block;min-width:150px") Force Run
el-switch(v-model="openVRAlways") el-switch(v-model="openVRAlways")
div(style="font-size:12px;margin-top:5px") div(style="font-size:12px;margin-top:5px")
span(style="display:inline-block;min-width:150px") Hide VR devices span(style="display:inline-block;min-width:150px") Hide VR Devices
el-switch(v-model="hideDevicesFromFeed") el-switch(v-model="hideDevicesFromFeed")
div(style="font-size:12px;margin-top:5px") div(style="font-size:12px;margin-top:5px")
span(style="display:inline-block;min-width:150px") Hide Online/Offline span(style="display:inline-block;min-width:150px") Hide Online/Offline
el-switch(v-model="hideLoginsFromFeed") el-switch(v-model="hideLoginsFromFeed")
div(style="font-size:12px;margin-top:5px") div(style="font-size:12px;margin-top:5px")
span(style="display:inline-block;min-width:150px") Hide Private worlds span(style="display:inline-block;min-width:150px") Hide Private Worlds
el-switch(v-model="hidePrivateFromFeed") el-switch(v-model="hidePrivateFromFeed")
div(style="font-size:12px;margin-top:5px") div(style="font-size:12px;margin-top:5px")
span(style="display:inline-block;min-width:150px") Overlay notifications span(style="display:inline-block;min-width:150px") Overlay Notifications
el-switch(v-model="vipNotifications") el-switch(v-model="overlayNotifications")
div(style="font-size:12px;margin-top:5px") div(style="font-size:12px;margin-top:5px")
span(style="display:inline-block;min-width:150px") Minimal feed icons span(style="display:inline-block;min-width:150px") Minimal Feed Icons
el-switch(v-model="minimalFeed") el-switch(v-model="minimalFeed")
div(style="margin-top:30px") div(style="margin-top:30px")
span(style="font-weight:bold") Window span(style="font-weight:bold") Window
+21 -1
View File
@@ -672,12 +672,18 @@ import webApiService from './service/webapi.js';
} }
} }
} }
if (feed.type === 'invite') {
if (!map[feed.senderUsername] ||
map[feed.senderUsername] < feed.created_at) {
map[feed.senderUsername] = feed.created_at;
}
}
}); });
// disable notification on busy // disable notification on busy
if (this.currentUserStatus === 'busy') { if (this.currentUserStatus === 'busy') {
return; return;
} }
if (configRepository.getBool('VRCX_VIPNotifications') === true) { if (configRepository.getBool('VRCX_overlayNotifications') === true) {
var notys = []; var notys = [];
this.feeds.forEach((feed) => { this.feeds.forEach((feed) => {
if (feed.isFavorite) { if (feed.isFavorite) {
@@ -697,6 +703,13 @@ import webApiService from './service/webapi.js';
} }
} }
} }
if (feed.type === 'invite') {
if (!map[feed.senderUsername] ||
map[feed.senderUsername] < feed.created_at) {
map[feed.senderUsername] = feed.created_at;
notys.push(feed);
}
}
}); });
var bias = new Date(Date.now() - 60000).toJSON(); var bias = new Date(Date.now() - 60000).toJSON();
var theme = 'relax'; var theme = 'relax';
@@ -734,6 +747,13 @@ import webApiService from './service/webapi.js';
text: `<strong>${noty.displayName}</strong> has logged out` text: `<strong>${noty.displayName}</strong> has logged out`
}).show(); }).show();
break; break;
case 'invite':
new Noty({
type: 'alert',
theme: theme,
text: `<strong>${noty.senderUsername}</strong> has invited you to ${noty.details.worldName}`
}).show();
break;
} }
} }
}); });
+12
View File
@@ -52,6 +52,12 @@ html
span.extra span.extra
span.time {{ feed.created_at | formatDate('HH:MI') }} span.time {{ feed.created_at | formatDate('HH:MI') }}
location(:location="feed.data") location(:location="feed.data")
div(v-else-if="feed.type === 'invite'" class="x-friend-item" :class="{ friend: feed.isFriend, favorite: feed.isFavorite }")
.detail
span.extra
span.time {{ feed.created_at | formatDate('HH:MI') }}
| 📨 #[span.name(v-text="feed.senderUsername")]
| #[span(v-text="feed.details.worldName")]
template(v-else) template(v-else)
template(v-for="feed in feeds") template(v-for="feed in feeds")
.x-friend-item(v-if="feed.type === 'GPS'" :class="{ friend: feed.isFriend, favorite: feed.isFavorite }") .x-friend-item(v-if="feed.type === 'GPS'" :class="{ friend: feed.isFriend, favorite: feed.isFavorite }")
@@ -89,6 +95,12 @@ html
span.extra span.extra
span.time {{ feed.created_at | formatDate('HH:MI') }} span.time {{ feed.created_at | formatDate('HH:MI') }}
location(:location="feed.data") location(:location="feed.data")
div(v-else-if="feed.type === 'invite'" class="x-friend-item" :class="{ friend: feed.isFriend, favorite: feed.isFavorite }")
.detail
span.extra
span.time {{ feed.created_at | formatDate('HH:MI') }}
| #[span.name(v-text="feed.senderUsername")] has invited you to
| #[span(v-text="feed.details.worldName")]
.x-container .x-container
div(style="display:flex;flex-direction:row") div(style="display:flex;flex-direction:row")
template(v-if="devices.length") template(v-if="devices.length")