Last location name and date

This commit is contained in:
Natsumi
2021-03-02 12:15:30 +13:00
parent 7329b157e8
commit b8e74c8ea5
3 changed files with 48 additions and 35 deletions
+41 -28
View File
@@ -860,9 +860,7 @@ speechSynthesis.getVoices();
date_joined: json.date_joined, date_joined: json.date_joined,
allowAvatarCopying: json.allowAvatarCopying, allowAvatarCopying: json.allowAvatarCopying,
isFriend: false, isFriend: false,
location: ($app.isGameRunning === true) location: $app.lastLocation.location
? $app.lastLocation
: ''
}); });
}); });
@@ -1158,9 +1156,10 @@ speechSynthesis.getVoices();
json.statusDescription = API.currentUser.statusDescription; json.statusDescription = API.currentUser.statusDescription;
json.state = API.currentUser.state; json.state = API.currentUser.state;
json.last_login = API.currentUser.last_login; json.last_login = API.currentUser.last_login;
json.location = ($app.isGameRunning === true) if ($app.lastLocation.location) {
? $app.lastLocation json.location = $app.lastLocation.location;
: ''; json.$location_at = Date.parse($app.lastLocation.date);
}
json.$online_for = API.currentUser.$online_for; json.$online_for = API.currentUser.$online_for;
json.$offline_for = API.currentUser.$offline_for; json.$offline_for = API.currentUser.$offline_for;
} }
@@ -3690,14 +3689,14 @@ speechSynthesis.getVoices();
// OnPlayerJoining // OnPlayerJoining
if ((this.isGameRunning) && ((this.sharedFeedFilters.wrist.OnPlayerJoining === 'Friends') || (this.sharedFeedFilters.wrist.OnPlayerJoining === 'VIP') || if ((this.isGameRunning) && ((this.sharedFeedFilters.wrist.OnPlayerJoining === 'Friends') || (this.sharedFeedFilters.wrist.OnPlayerJoining === 'VIP') ||
(this.sharedFeedFilters.noty.OnPlayerJoining === 'Friends') || (this.sharedFeedFilters.noty.OnPlayerJoining === 'VIP'))) { (this.sharedFeedFilters.noty.OnPlayerJoining === 'Friends') || (this.sharedFeedFilters.noty.OnPlayerJoining === 'VIP'))) {
var bias = new Date(Date.now() - 120000).toJSON(); var bias = new Date(Date.now() - 120000).toJSON(); //2 minutes
var locationBias = new Date(Date.now() - 15000).toJSON(); //15 seconds var locationBias = new Date(Date.now() - 15000).toJSON(); //15 seconds
for (var i = 0; i < wristFeed.length; i++) { for (var i = 0; i < wristFeed.length; i++) {
var ctx = wristFeed[i]; var ctx = wristFeed[i];
if ((ctx.created_at < bias) || (ctx.type === 'Location')) { if ((ctx.created_at < bias) || (ctx.type === 'Location')) {
break; break;
} }
if ((ctx.type === 'GPS') && (ctx.location[0] === this.lastLocation)) { if ((ctx.type === 'GPS') && (ctx.location[0] === this.lastLocation.location)) {
var joining = true; var joining = true;
for (var k = 0; k < wristFeed.length; k++) { for (var k = 0; k < wristFeed.length; k++) {
var feedItem = wristFeed[k]; var feedItem = wristFeed[k];
@@ -5389,7 +5388,11 @@ speechSynthesis.getVoices();
// App: gameLog // App: gameLog
$app.data.lastLocation = ''; $app.data.lastLocation = {
date: '',
location: '',
name: ''
};
$app.data.lastLocation$ = {}; $app.data.lastLocation$ = {};
$app.data.discordActive = configRepository.getBool('discordActive'); $app.data.discordActive = configRepository.getBool('discordActive');
$app.data.discordInstance = configRepository.getBool('discordInstance'); $app.data.discordInstance = configRepository.getBool('discordInstance');
@@ -5438,7 +5441,11 @@ speechSynthesis.getVoices();
$app.methods.resetGameLog = async function () { $app.methods.resetGameLog = async function () {
await gameLogService.reset(); await gameLogService.reset();
this.gameLogTable.data = []; this.gameLogTable.data = [];
this.lastLocation = ''; this.lastLocation = {
date: '',
location: '',
name: ''
};
}; };
$app.methods.updateGameLogLoop = async function () { $app.methods.updateGameLogLoop = async function () {
@@ -5470,7 +5477,11 @@ speechSynthesis.getVoices();
switch (gameLog.type) { switch (gameLog.type) {
case 'location': case 'location':
if (this.isGameRunning) { if (this.isGameRunning) {
this.lastLocation = gameLog.location; this.lastLocation = {
date: gameLog.dt,
location: gameLog.location,
name: gameLog.worldName
};
} }
tableData = { tableData = {
created_at: gameLog.dt, created_at: gameLog.dt,
@@ -5539,9 +5550,7 @@ speechSynthesis.getVoices();
$app.methods.updateDiscord = function () { $app.methods.updateDiscord = function () {
var ref = API.cachedUsers.get(API.currentUser.id); var ref = API.cachedUsers.get(API.currentUser.id);
if (typeof ref !== 'undefined') { if (typeof ref !== 'undefined') {
var myLocation = (this.isGameRunning === true) var myLocation = this.lastLocation.location;
? this.lastLocation
: '';
if (ref.location !== myLocation) { if (ref.location !== myLocation) {
API.applyUser({ API.applyUser({
id: ref.id, id: ref.id,
@@ -5550,12 +5559,12 @@ speechSynthesis.getVoices();
} }
} }
if (this.isGameRunning === false || if (this.isGameRunning === false ||
this.lastLocation === '') { this.lastLocation.location === '') {
Discord.SetActive(false); Discord.SetActive(false);
return; return;
} }
if (this.lastLocation !== this.lastLocation$.tag) { if (this.lastLocation.location !== this.lastLocation$.tag) {
var L = API.parseLocation(this.lastLocation); var L = API.parseLocation(this.lastLocation.location);
L.worldName = L.worldId; L.worldName = L.worldId;
this.lastLocation$ = L; this.lastLocation$ = L;
if (L.worldId) { if (L.worldId) {
@@ -6828,7 +6837,11 @@ speechSynthesis.getVoices();
sharedRepository.setBool('is_game_running', false); sharedRepository.setBool('is_game_running', false);
var isGameRunningStateChange = function () { var isGameRunningStateChange = function () {
sharedRepository.setBool('is_game_running', this.isGameRunning); sharedRepository.setBool('is_game_running', this.isGameRunning);
$app.lastLocation = ''; $app.lastLocation = {
date: '',
location: '',
name: ''
};
if (this.isGameRunning) { if (this.isGameRunning) {
API.currentUser.$online_for = Date.now(); API.currentUser.$online_for = Date.now();
API.currentUser.$offline_for = ''; API.currentUser.$offline_for = '';
@@ -6846,9 +6859,9 @@ speechSynthesis.getVoices();
$app.watch.isGameNoVR = isGameNoVRStateChange; $app.watch.isGameNoVR = isGameNoVRStateChange;
var lastLocationStateChange = function () { var lastLocationStateChange = function () {
sharedRepository.setString('last_location', $app.lastLocation); sharedRepository.setObject('last_location', $app.lastLocation);
}; };
$app.watch.lastLocation = lastLocationStateChange; $app.watch['lastLocation.location'] = lastLocationStateChange;
$app.methods.updateVRConfigVars = function () { $app.methods.updateVRConfigVars = function () {
if (configRepository.getBool('isDarkMode')) { if (configRepository.getBool('isDarkMode')) {
@@ -7350,7 +7363,7 @@ speechSynthesis.getVoices();
} }
} }
if (this.isGameRunning && if (this.isGameRunning &&
this.lastLocation === L.tag) { this.lastLocation.location === L.tag) {
var ref = API.cachedUsers.get(API.currentUser.id); var ref = API.cachedUsers.get(API.currentUser.id);
users.push((typeof ref === 'undefined') users.push((typeof ref === 'undefined')
? API.currentUser ? API.currentUser
@@ -7611,13 +7624,13 @@ speechSynthesis.getVoices();
return args; return args;
}); });
} else if (command === 'Invite Message') { } else if (command === 'Invite Message') {
var L = API.parseLocation(this.lastLocation); var L = API.parseLocation(this.lastLocation.location);
API.getCachedWorld({ API.getCachedWorld({
worldId: L.worldId worldId: L.worldId
}).then((args) => { }).then((args) => {
this.showSendInviteDialog({ this.showSendInviteDialog({
instanceId: this.lastLocation, instanceId: this.lastLocation.location,
worldId: this.lastLocation, worldId: this.lastLocation.location,
worldName: args.ref.name worldName: args.ref.name
}, D.id); }, D.id);
}); });
@@ -7626,13 +7639,13 @@ speechSynthesis.getVoices();
platform: 'standalonewindows' platform: 'standalonewindows'
}, D.id); }, D.id);
} else if (command === 'Invite') { } else if (command === 'Invite') {
var L = API.parseLocation(this.lastLocation); var L = API.parseLocation(this.lastLocation.location);
API.getCachedWorld({ API.getCachedWorld({
worldId: L.worldId worldId: L.worldId
}).then((args) => { }).then((args) => {
API.sendInvite({ API.sendInvite({
instanceId: this.lastLocation, instanceId: this.lastLocation.location,
worldId: this.lastLocation, worldId: this.lastLocation.location,
worldName: args.ref.name worldName: args.ref.name
}, D.id).then((_args) => { }, D.id).then((_args) => {
this.$message('Invite sent'); this.$message('Invite sent');
@@ -7864,7 +7877,7 @@ speechSynthesis.getVoices();
instance.users.push(ref); instance.users.push(ref);
} }
if (this.isGameRunning) { if (this.isGameRunning) {
var lastLocation$ = API.parseLocation(this.lastLocation); var lastLocation$ = API.parseLocation(this.lastLocation.location);
if (lastLocation$.worldId === D.id) { if (lastLocation$.worldId === D.id) {
var instance = instances[lastLocation$.instanceId]; var instance = instances[lastLocation$.instanceId];
if (typeof instance === 'undefined') { if (typeof instance === 'undefined') {
+2 -2
View File
@@ -778,7 +778,7 @@ html
img(v-else v-lazy="API.currentUser.currentAvatarThumbnailImageUrl") img(v-else v-lazy="API.currentUser.currentAvatarThumbnailImageUrl")
.detail .detail
span.name(v-text="API.currentUser.displayName" :class="API.currentUser.$trustClass") span.name(v-text="API.currentUser.displayName" :class="API.currentUser.$trustClass")
location.extra(v-if="isGameRunning === true" :location="lastLocation" :link="false") location.extra(v-if="isGameRunning === true" :location="lastLocation.location" :link="false")
span.extra(v-else v-text="API.currentUser.statusDescription" :link="false") span.extra(v-else v-text="API.currentUser.statusDescription" :link="false")
.x-friend-group(v-show="friendsGroup0.length") .x-friend-group(v-show="friendsGroup0.length")
i.el-icon-arrow-right(:class="{ rotate: isFriendsGroup0 }") i.el-icon-arrow-right(:class="{ rotate: isFriendsGroup0 }")
@@ -897,7 +897,7 @@ html
el-dropdown-item(icon="el-icon-edit" command="Edit Bio") Bio el-dropdown-item(icon="el-icon-edit" command="Edit Bio") Bio
el-dropdown-item(icon="el-icon-switch-button" command="Logout" divided) Logout el-dropdown-item(icon="el-icon-switch-button" command="Logout" divided) Logout
template(v-else) template(v-else)
template(v-if="lastLocation && isGameRunning") template(v-if="lastLocation.location && isGameRunning")
el-dropdown-item(icon="el-icon-message" command="Invite") Invite el-dropdown-item(icon="el-icon-message" command="Invite") Invite
el-dropdown-item(icon="el-icon-message" command="Invite Message") Invite With Message el-dropdown-item(icon="el-icon-message" command="Invite Message") Invite With Message
template(v-if="userDialog.isFriend") template(v-if="userDialog.isFriend")
+2 -2
View File
@@ -694,7 +694,7 @@ speechSynthesis.getVoices();
config: {}, config: {},
isGameRunning: false, isGameRunning: false,
isGameNoVR: false, isGameNoVR: false,
lastLocation: '', lastLocation: {},
wristFeedLastEntry: '', wristFeedLastEntry: '',
notyFeedLastEntry: '', notyFeedLastEntry: '',
wristFeed: [], wristFeed: [],
@@ -737,7 +737,7 @@ speechSynthesis.getVoices();
this.currentUserStatus = sharedRepository.getString('current_user_status'); this.currentUserStatus = sharedRepository.getString('current_user_status');
this.isGameRunning = sharedRepository.getBool('is_game_running'); this.isGameRunning = sharedRepository.getBool('is_game_running');
this.isGameNoVR = sharedRepository.getBool('is_Game_No_VR'); this.isGameNoVR = sharedRepository.getBool('is_Game_No_VR');
this.lastLocation = sharedRepository.getString('last_location'); this.lastLocation = sharedRepository.getObject('last_location');
var newConfig = sharedRepository.getObject('VRConfigVars'); var newConfig = sharedRepository.getObject('VRConfigVars');
if (newConfig) { if (newConfig) {
if (JSON.stringify(newConfig) !== JSON.stringify(this.config)) { if (JSON.stringify(newConfig) !== JSON.stringify(this.config)) {