Bug fixes

This commit is contained in:
Natsumi
2021-11-03 00:20:49 +13:00
parent 55ac5233d7
commit 6bf11a1f51
2 changed files with 28 additions and 4 deletions

View File

@@ -4217,8 +4217,9 @@ speechSynthesis.getVoices();
if (ctx.created_at < bias) {
break;
}
// (ctx.type === 'GPS' || ctx.type === 'Online') TODO: fix new friend triggering Online event
if (
(ctx.type === 'GPS' || ctx.type === 'Online') &&
ctx.type === 'GPS' &&
ctx.location === this.lastLocation.location
) {
if (joiningMap[ctx.displayName]) {
@@ -9981,6 +9982,21 @@ speechSynthesis.getVoices();
}
};
$app.methods.getTTSVoiceName = function () {
var voices = speechSynthesis.getVoices();
if (voices.length === 0) {
return '';
}
if (this.notificationTTSVoice >= voices.length) {
this.notificationTTSVoice = 0;
configRepository.setString(
'VRCX_notificationTTSVoice',
this.notificationTTSVoice
);
}
return voices[this.notificationTTSVoice].name;
};
$app.methods.changeTTSVoice = function (index) {
this.notificationTTSVoice = index;
configRepository.setString(
@@ -9991,7 +10007,7 @@ speechSynthesis.getVoices();
if (voices.length === 0) {
return;
}
var voiceName = voices[index < voices.length ? index : 0].name;
var voiceName = voices[index].name;
speechSynthesis.cancel();
this.speak(voiceName);
};
@@ -9999,7 +10015,14 @@ speechSynthesis.getVoices();
$app.methods.speak = function (text) {
var tts = new SpeechSynthesisUtterance();
var voices = speechSynthesis.getVoices();
tts.voice = voices[this.notificationTTSVoice];
if (voices.length === 0) {
return;
}
var index = 0;
if (this.notificationTTSVoice < voices.length) {
index = this.notificationTTSVoice;
}
tts.voice = voices[index];
tts.text = text;
speechSynthesis.speak(tts);
};

View File

@@ -1081,7 +1081,8 @@ class Database {
async getLastDateGameLogDatabase() {
var gamelogDatabase = [];
var date = '1970-01-01';
// var date = '1970-01-01';
var date = new Date(Date.now() - 86400000).toJSON(); // 24 hours
await sqliteService.execute((dbRow) => {
gamelogDatabase.unshift(dbRow[0]);
}, 'SELECT created_at FROM gamelog_location ORDER BY id DESC LIMIT 1');