mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-27 18:53:47 +02:00
Refactor Discord RPC
This commit is contained in:
@@ -28,22 +28,12 @@ export const useLocationStore = defineStore('Location', () => {
|
||||
|
||||
const state = reactive({
|
||||
lastLocation: {
|
||||
date: 0,
|
||||
date: null,
|
||||
location: '',
|
||||
name: '',
|
||||
playerList: new Map(),
|
||||
friendList: new Map()
|
||||
},
|
||||
lastLocation$: {
|
||||
tag: '',
|
||||
instanceId: '',
|
||||
accessType: '',
|
||||
worldName: '',
|
||||
worldCapacity: 0,
|
||||
joinUrl: '',
|
||||
statusName: '',
|
||||
statusImage: ''
|
||||
},
|
||||
lastLocationDestination: '',
|
||||
lastLocationDestinationTime: 0
|
||||
});
|
||||
@@ -55,13 +45,6 @@ export const useLocationStore = defineStore('Location', () => {
|
||||
}
|
||||
});
|
||||
|
||||
const lastLocation$ = computed({
|
||||
get: () => state.lastLocation$,
|
||||
set: (value) => {
|
||||
state.lastLocation$ = value;
|
||||
}
|
||||
});
|
||||
|
||||
const lastLocationDestination = computed({
|
||||
get: () => state.lastLocationDestination,
|
||||
set: (value) => {
|
||||
@@ -153,7 +136,7 @@ export const useLocationStore = defineStore('Location', () => {
|
||||
const L = parseLocation(location);
|
||||
|
||||
state.lastLocation.location = location;
|
||||
state.lastLocation.date = dt;
|
||||
state.lastLocation.date = Date.now();
|
||||
|
||||
const entry = {
|
||||
created_at: dt,
|
||||
@@ -174,7 +157,7 @@ export const useLocationStore = defineStore('Location', () => {
|
||||
instanceStore.applyGroupDialogInstances();
|
||||
} else {
|
||||
state.lastLocation.location = '';
|
||||
state.lastLocation.date = '';
|
||||
state.lastLocation.date = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -218,7 +201,7 @@ export const useLocationStore = defineStore('Location', () => {
|
||||
gameLogStore.addGameLog(entry);
|
||||
}
|
||||
database.addGamelogJoinLeaveBulk(dataBaseEntries);
|
||||
if (state.lastLocation.date !== 0) {
|
||||
if (state.lastLocation.date !== null && state.lastLocation.date > 0) {
|
||||
const update = {
|
||||
time: dateTimeStamp - state.lastLocation.date,
|
||||
created_at: new Date(state.lastLocation.date).toJSON()
|
||||
@@ -248,7 +231,6 @@ export const useLocationStore = defineStore('Location', () => {
|
||||
return {
|
||||
state,
|
||||
lastLocation,
|
||||
lastLocation$,
|
||||
lastLocationDestination,
|
||||
lastLocationDestinationTime,
|
||||
updateCurrentUserLocation,
|
||||
|
||||
Reference in New Issue
Block a user