Self online/offline time

This commit is contained in:
Natsumi
2020-12-31 17:33:30 +13:00
parent 035d72b020
commit eb0ddf864d
2 changed files with 17 additions and 2 deletions

View File

@@ -1146,6 +1146,8 @@ speechSynthesis.getVoices();
json.state = API.currentUser.state;
json.last_login = API.currentUser.last_login;
json.location = ($app.isGameRunning === true) ? $app.lastLocation : '';
json.$online_for = API.currentUser.$online_for;
json.$offline_for = API.currentUser.$offline_for;
}
if (ref === undefined) {
ref = {
@@ -5774,6 +5776,19 @@ speechSynthesis.getVoices();
configRepository.setString('VRCX_notificationPosition', this.notificationPosition);
};
var isGameRunningStateChange = function () {
$app.lastLocation = '';
if (this.isGameRunning) {
API.currentUser.$online_for = Date.now();
API.currentUser.$offline_for = '';
}
else {
API.currentUser.$online_for = '';
API.currentUser.$offline_for = Date.now();
}
}
$app.watch.isGameRunning = isGameRunningStateChange;
API.$on('LOGIN', function () {
$app.currentUserTreeData = [];
$app.pastDisplayNameTable.data = [];
@@ -7760,7 +7775,7 @@ speechSynthesis.getVoices();
return arr.join(' ');
};
if (ctx.ref.state === 'online') {
if ((ctx.ref.state === 'online') && (ctx.ref.$online_for)) {
return timeToText(Date.now() - ctx.ref.$online_for)
} else if (ctx.ref.$offline_for) {
return timeToText(Date.now() - ctx.ref.$offline_for)

View File

@@ -825,7 +825,7 @@ html
span.extra(v-else style="color:#F56C6C") Deny
.x-friend-item
.detail
span.name(v-if="userDialog.ref.state === 'online'") Online For
span.name(v-if="userDialog.ref.state === 'online' && userDialog.ref.$online_for") Online For
span.name(v-else) Offline For
span.extra(v-text="userOnlineFor(userDialog)")
.x-friend-item