mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-12 19:33:50 +02:00
Touch ups
This commit is contained in:
45
src/app.js
45
src/app.js
@@ -185,10 +185,6 @@ console.log(`isLinux: ${LINUX}`);
|
||||
this.checkForVRCXUpdate();
|
||||
}
|
||||
await AppApi.CheckGameRunning();
|
||||
this.isSidebarGroupByInstance =
|
||||
(await configRepository.getBool(
|
||||
'VRCX_sidebarGroupByInstance'
|
||||
)) ?? true;
|
||||
this.isGameNoVR = await configRepository.getBool('isGameNoVR');
|
||||
await AppApi.SetAppLauncherSettings(
|
||||
this.enableAppLauncher,
|
||||
@@ -3785,6 +3781,7 @@ console.log(`isLinux: ${LINUX}`);
|
||||
if (isGameRunning) {
|
||||
API.currentUser.$online_for = Date.now();
|
||||
API.currentUser.$offline_for = '';
|
||||
API.currentUser.$previousAvatarSwapTime = Date.now();
|
||||
} else {
|
||||
await configRepository.setBool('isGameNoVR', this.isGameNoVR);
|
||||
API.currentUser.$online_for = '';
|
||||
@@ -3793,6 +3790,8 @@ console.log(`isLinux: ${LINUX}`);
|
||||
this.autoVRChatCacheManagement();
|
||||
this.checkIfGameCrashed();
|
||||
this.ipcTimeout = 0;
|
||||
this.addAvatarWearTime(API.currentUser.currentAvatar);
|
||||
API.currentUser.$previousAvatarSwapTime = '';
|
||||
}
|
||||
this.lastLocationReset();
|
||||
this.clearNowPlaying();
|
||||
@@ -3805,13 +3804,6 @@ console.log(`isLinux: ${LINUX}`);
|
||||
console.log(new Date(), 'isGameRunning', isGameRunning);
|
||||
}
|
||||
|
||||
if (isGameRunning) {
|
||||
API.currentUser.$previousAvatarSwapTime = Date.now();
|
||||
} else if (API.currentUser.$previousAvatarSwapTime) {
|
||||
this.addAvatarWearTime(API.currentUser.currentAvatar);
|
||||
API.currentUser.$previousAvatarSwapTime = '';
|
||||
}
|
||||
|
||||
if (isSteamVRRunning !== this.isSteamVRRunning) {
|
||||
this.isSteamVRRunning = isSteamVRRunning;
|
||||
console.log('isSteamVRRunning:', isSteamVRRunning);
|
||||
@@ -12173,7 +12165,16 @@ console.log(`isLinux: ${LINUX}`);
|
||||
}
|
||||
}
|
||||
database.getAvatarTimeSpent(avatarId).then((aviTime) => {
|
||||
D.timeSpent = aviTime.timeSpent;
|
||||
if (D.id === aviTime.avatarId) {
|
||||
D.timeSpent = aviTime.timeSpent;
|
||||
if (
|
||||
D.id === API.currentUser.currentAvatar &&
|
||||
API.currentUser.$previousAvatarSwapTime
|
||||
) {
|
||||
D.timeSpent +=
|
||||
Date.now() - API.currentUser.$previousAvatarSwapTime;
|
||||
}
|
||||
}
|
||||
});
|
||||
API.getAvatar({ avatarId })
|
||||
.then((args) => {
|
||||
@@ -19870,8 +19871,12 @@ console.log(`isLinux: ${LINUX}`);
|
||||
var historyArray = await database.getAvatarHistory(API.currentUser.id);
|
||||
this.avatarHistoryArray = historyArray;
|
||||
for (var i = 0; i < historyArray.length; i++) {
|
||||
this.avatarHistory.add(historyArray[i].id);
|
||||
API.applyAvatar(historyArray[i]);
|
||||
var avatar = historyArray[i];
|
||||
if (avatar.authorId === API.currentUser.id) {
|
||||
continue;
|
||||
}
|
||||
this.avatarHistory.add(avatar.id);
|
||||
API.applyAvatar(avatar);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -19899,9 +19904,12 @@ console.log(`isLinux: ${LINUX}`);
|
||||
});
|
||||
};
|
||||
|
||||
$app.methods.addAvatarWearTime = function (avatar) {
|
||||
$app.methods.addAvatarWearTime = function (avatarId) {
|
||||
if (!API.currentUser.$previousAvatarSwapTime || !avatarId) {
|
||||
return;
|
||||
}
|
||||
const timeSpent = Date.now() - API.currentUser.$previousAvatarSwapTime;
|
||||
database.addAvatarTimeSpent(avatar, timeSpent);
|
||||
database.addAvatarTimeSpent(avatarId, timeSpent);
|
||||
};
|
||||
|
||||
$app.methods.promptClearAvatarHistory = function () {
|
||||
@@ -23124,7 +23132,10 @@ console.log(`isLinux: ${LINUX}`);
|
||||
// friendsListSidebar
|
||||
// - SidebarGroupByInstance
|
||||
|
||||
$app.data.isSidebarGroupByInstance = true;
|
||||
$app.data.isSidebarGroupByInstance = await configRepository.getBool(
|
||||
'VRCX_sidebarGroupByInstance',
|
||||
true
|
||||
);
|
||||
$app.computed.onlineFriendsInSameInstance = function () {
|
||||
const groupedItems = {};
|
||||
|
||||
|
||||
@@ -165,8 +165,10 @@ export default class extends baseClass {
|
||||
if (this.isLoggedIn) {
|
||||
if (json.currentAvatar !== ref.currentAvatar) {
|
||||
$app.addAvatarToHistory(json.currentAvatar);
|
||||
$app.addAvatarWearTime(ref.currentAvatar);
|
||||
this.currentUser.$previousAvatarSwapTime = Date.now();
|
||||
if ($app.isGameRunning) {
|
||||
$app.addAvatarWearTime(ref.currentAvatar);
|
||||
ref.$previousAvatarSwapTime = Date.now();
|
||||
}
|
||||
}
|
||||
Object.assign(ref, json);
|
||||
if (ref.homeLocation !== ref.$homeLocation.tag) {
|
||||
@@ -278,7 +280,7 @@ export default class extends baseClass {
|
||||
$offline_for: '',
|
||||
$location_at: Date.now(),
|
||||
$travelingToTime: Date.now(),
|
||||
$previousAvatarSwapTime: Date.now(),
|
||||
$previousAvatarSwapTime: '',
|
||||
$homeLocation: {},
|
||||
$isVRCPlus: false,
|
||||
$isModerator: false,
|
||||
@@ -294,6 +296,9 @@ export default class extends baseClass {
|
||||
$vrchatcredits: null,
|
||||
...json
|
||||
};
|
||||
if ($app.isGameRunning) {
|
||||
ref.$previousAvatarSwapTime = Date.now();
|
||||
}
|
||||
ref.$homeLocation = $app.parseLocation(ref.homeLocation);
|
||||
ref.$isVRCPlus = ref.tags.includes('system_supporter');
|
||||
this.applyUserTrustLevel(ref);
|
||||
|
||||
@@ -104,6 +104,8 @@ mixin avatarDialog()
|
||||
.x-friend-item(style="cursor:default")
|
||||
.detail
|
||||
span.name {{ $t('dialog.avatar.info.time_spent') }}
|
||||
el-tooltip(v-if="!hideTooltips" placement="top" style="margin-left:5px" :content="$t('dialog.world.info.accuracy_notice')")
|
||||
i.el-icon-warning
|
||||
span.extra(v-if="avatarDialog.timeSpent === 0") -
|
||||
span.extra(v-else) {{ timeToText(avatarDialog.timeSpent) }}
|
||||
.x-friend-item(style="width:100%;cursor:default")
|
||||
|
||||
@@ -2710,7 +2710,7 @@ class Database {
|
||||
const columnExists = dbRow.some((row) => row.name === 'time');
|
||||
if (!columnExists) {
|
||||
sqliteService.executeNonQuery(
|
||||
`ALTER TABLE ${Database.userPrefix}_avatar_history ADD COLUMN 'time' INTEGER DEFAULT 0;`
|
||||
`ALTER TABLE ${Database.userPrefix}_avatar_history ADD time INTEGER DEFAULT 0`
|
||||
);
|
||||
}
|
||||
}, `PRAGMA table_info(${Database.userPrefix}_avatar_history);`);
|
||||
|
||||
Reference in New Issue
Block a user