Theme sync with system #216

This commit is contained in:
CunYu
2021-06-08 07:59:46 +08:00
committed by Natsumi
parent db489ee6bd
commit 59e9da9985
2 changed files with 145 additions and 131 deletions
+140 -129
View File
@@ -3847,7 +3847,7 @@ speechSynthesis.getVoices();
var locationBias = Date.now() - 30000; //30 seconds var locationBias = Date.now() - 30000; //30 seconds
if ((this.isGameRunning) && (this.lastLocation.date < locationBias) && if ((this.isGameRunning) && (this.lastLocation.date < locationBias) &&
((this.sharedFeedFilters.wrist.OnPlayerJoining === 'Friends') || (this.sharedFeedFilters.wrist.OnPlayerJoining === 'VIP') || ((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 joiningMap = []; var joiningMap = [];
var bias = new Date(Date.now() - 120000).toJSON(); //2 minutes var bias = new Date(Date.now() - 120000).toJSON(); //2 minutes
var feedTable = this.feedTable.data; var feedTable = this.feedTable.data;
@@ -4066,8 +4066,8 @@ speechSynthesis.getVoices();
var created_at = ctx.created_at; var created_at = ctx.created_at;
if ((wristFilter[type]) && if ((wristFilter[type]) &&
((wristFilter[type] === 'Everyone') || ((wristFilter[type] === 'Everyone') ||
((wristFilter[type] === 'Friends') && (isFriend)) || ((wristFilter[type] === 'Friends') && (isFriend)) ||
((wristFilter[type] === 'VIP') && (isFavorite)))) { ((wristFilter[type] === 'VIP') && (isFavorite)))) {
wristArr.unshift({ wristArr.unshift({
created_at, created_at,
type, type,
@@ -4079,8 +4079,8 @@ speechSynthesis.getVoices();
} }
if ((notyFilter[type]) && if ((notyFilter[type]) &&
((notyFilter[type] === 'Everyone') || ((notyFilter[type] === 'Everyone') ||
((notyFilter[type] === 'Friends') && (isFriend)) || ((notyFilter[type] === 'Friends') && (isFriend)) ||
((notyFilter[type] === 'VIP') && (isFavorite)))) { ((notyFilter[type] === 'VIP') && (isFavorite)))) {
notyArr.unshift({ notyArr.unshift({
created_at, created_at,
type, type,
@@ -4095,9 +4095,9 @@ speechSynthesis.getVoices();
} }
if ((w < 20) && (wristFilter[ctx.type]) && if ((w < 20) && (wristFilter[ctx.type]) &&
((wristFilter[ctx.type] === 'On') || ((wristFilter[ctx.type] === 'On') ||
(wristFilter[ctx.type] === 'Everyone') || (wristFilter[ctx.type] === 'Everyone') ||
((wristFilter[ctx.type] === 'Friends') && (isFriend)) || ((wristFilter[ctx.type] === 'Friends') && (isFriend)) ||
((wristFilter[ctx.type] === 'VIP') && (isFavorite)))) { ((wristFilter[ctx.type] === 'VIP') && (isFavorite)))) {
wristArr.push({ wristArr.push({
...ctx, ...ctx,
isFriend, isFriend,
@@ -4107,9 +4107,9 @@ speechSynthesis.getVoices();
} }
if ((n < 1) && (notyFilter[ctx.type]) && if ((n < 1) && (notyFilter[ctx.type]) &&
((notyFilter[ctx.type] === 'On') || ((notyFilter[ctx.type] === 'On') ||
(notyFilter[ctx.type] === 'Everyone') || (notyFilter[ctx.type] === 'Everyone') ||
((notyFilter[ctx.type] === 'Friends') && (isFriend)) || ((notyFilter[ctx.type] === 'Friends') && (isFriend)) ||
((notyFilter[ctx.type] === 'VIP') && (isFavorite)))) { ((notyFilter[ctx.type] === 'VIP') && (isFavorite)))) {
notyArr.push({ notyArr.push({
...ctx, ...ctx,
isFriend, isFriend,
@@ -4192,7 +4192,7 @@ speechSynthesis.getVoices();
var isFavorite = API.cachedFavoritesByObjectId.has(ctx.userId); var isFavorite = API.cachedFavoritesByObjectId.has(ctx.userId);
if ((w < 20) && (wristFilter[ctx.type]) && if ((w < 20) && (wristFilter[ctx.type]) &&
((wristFilter[ctx.type] === 'Friends') || ((wristFilter[ctx.type] === 'Friends') ||
((wristFilter[ctx.type] === 'VIP') && (isFavorite)))) { ((wristFilter[ctx.type] === 'VIP') && (isFavorite)))) {
wristArr.push({ wristArr.push({
...ctx, ...ctx,
isFriend, isFriend,
@@ -4202,7 +4202,7 @@ speechSynthesis.getVoices();
} }
if ((n < 1) && (notyFilter[ctx.type]) && if ((n < 1) && (notyFilter[ctx.type]) &&
((notyFilter[ctx.type] === 'Friends') || ((notyFilter[ctx.type] === 'Friends') ||
((notyFilter[ctx.type] === 'VIP') && (isFavorite)))) { ((notyFilter[ctx.type] === 'VIP') && (isFavorite)))) {
notyArr.push({ notyArr.push({
...ctx, ...ctx,
isFriend, isFriend,
@@ -4248,8 +4248,8 @@ speechSynthesis.getVoices();
var isFavorite = API.cachedFavoritesByObjectId.has(ctx.senderUserId); var isFavorite = API.cachedFavoritesByObjectId.has(ctx.senderUserId);
if ((w < 20) && (wristFilter[ctx.type]) && if ((w < 20) && (wristFilter[ctx.type]) &&
((wristFilter[ctx.type] === 'On') || ((wristFilter[ctx.type] === 'On') ||
(wristFilter[ctx.type] === 'Friends') || (wristFilter[ctx.type] === 'Friends') ||
((wristFilter[ctx.type] === 'VIP') && (isFavorite)))) { ((wristFilter[ctx.type] === 'VIP') && (isFavorite)))) {
wristArr.push({ wristArr.push({
...ctx, ...ctx,
isFriend, isFriend,
@@ -4259,8 +4259,8 @@ speechSynthesis.getVoices();
} }
if ((n < 1) && (notyFilter[ctx.type]) && if ((n < 1) && (notyFilter[ctx.type]) &&
((notyFilter[ctx.type] === 'On') || ((notyFilter[ctx.type] === 'On') ||
(notyFilter[ctx.type] === 'Friends') || (notyFilter[ctx.type] === 'Friends') ||
((notyFilter[ctx.type] === 'VIP') && (isFavorite)))) { ((notyFilter[ctx.type] === 'VIP') && (isFavorite)))) {
notyArr.push({ notyArr.push({
...ctx, ...ctx,
isFriend, isFriend,
@@ -4306,8 +4306,8 @@ speechSynthesis.getVoices();
var isFavorite = API.cachedFavoritesByObjectId.has(ctx.userId); var isFavorite = API.cachedFavoritesByObjectId.has(ctx.userId);
if ((w < 20) && (wristFilter[ctx.type]) && if ((w < 20) && (wristFilter[ctx.type]) &&
((wristFilter[ctx.type] === 'On') || ((wristFilter[ctx.type] === 'On') ||
(wristFilter[ctx.type] === 'Friends') || (wristFilter[ctx.type] === 'Friends') ||
((wristFilter[ctx.type] === 'VIP') && (isFavorite)))) { ((wristFilter[ctx.type] === 'VIP') && (isFavorite)))) {
wristArr.push({ wristArr.push({
...ctx, ...ctx,
isFriend, isFriend,
@@ -4317,8 +4317,8 @@ speechSynthesis.getVoices();
} }
if ((n < 1) && (notyFilter[ctx.type]) && if ((n < 1) && (notyFilter[ctx.type]) &&
((notyFilter[ctx.type] === 'On') || ((notyFilter[ctx.type] === 'On') ||
(notyFilter[ctx.type] === 'Friends') || (notyFilter[ctx.type] === 'Friends') ||
((notyFilter[ctx.type] === 'VIP') && (isFavorite)))) { ((notyFilter[ctx.type] === 'VIP') && (isFavorite)))) {
notyArr.push({ notyArr.push({
...ctx, ...ctx,
isFriend, isFriend,
@@ -5842,7 +5842,7 @@ speechSynthesis.getVoices();
$app.addFeed('GPS', ref, { $app.addFeed('GPS', ref, {
location: [ location: [
props.location[0], props.location[0],
props.location[1] props.location[1]
], ],
time: props.location[2] time: props.location[2]
}); });
@@ -7301,13 +7301,24 @@ speechSynthesis.getVoices();
$app.watch.worldAutoCacheGPSFilter = saveOpenVROption; $app.watch.worldAutoCacheGPSFilter = saveOpenVROption;
$app.watch.autoSweepVRChatCache = saveOpenVROption; $app.watch.autoSweepVRChatCache = saveOpenVROption;
$app.watch.notificationTTS = saveNotificationTTS; $app.watch.notificationTTS = saveNotificationTTS;
$app.data.isDarkMode = configRepository.getBool('isDarkMode'); $app.data.themeMode = configRepository.getString('VRCX_ThemeMode');
if (!$app.data.themeMode) $app.data.themeMode = 'system';
var systemIsDarkMode = _ => window.matchMedia('(prefers-color-scheme: dark)').matches;
$app.data.isDarkMode = $app.data.themeMode === 'system' ? systemIsDarkMode() : configRepository.getBool('isDarkMode');
$appDarkStyle.disabled = $app.data.isDarkMode === false; $appDarkStyle.disabled = $app.data.isDarkMode === false;
$app.watch.isDarkMode = function () { $app.watch.isDarkMode = function () {
configRepository.setBool('isDarkMode', this.isDarkMode); configRepository.setBool('isDarkMode', this.isDarkMode);
$appDarkStyle.disabled = this.isDarkMode === false; $appDarkStyle.disabled = this.isDarkMode === false;
this.updateVRConfigVars(); this.updateVRConfigVars();
}; };
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', (e) => {
$app._data.isDarkMode = e && e.matches;
})
$app.watch.themeMode = function () {
configRepository.setString('VRCX_ThemeMode', this.themeMode)
if (this.themeMode === 'system') this.isDarkMode = systemIsDarkMode();
else this.isDarkMode = this.themeMode === 'dark';
}
$app.data.isStartAtWindowsStartup = configRepository.getBool('VRCX_StartAtWindowsStartup'); $app.data.isStartAtWindowsStartup = configRepository.getBool('VRCX_StartAtWindowsStartup');
$app.data.isStartAsMinimizedState = (VRCXStorage.Get('VRCX_StartAsMinimizedState') === 'true'); $app.data.isStartAsMinimizedState = (VRCXStorage.Get('VRCX_StartAsMinimizedState') === 'true');
$app.data.isCloseToTray = configRepository.getBool('VRCX_CloseToTray'); $app.data.isCloseToTray = configRepository.getBool('VRCX_CloseToTray');
@@ -7416,7 +7427,7 @@ speechSynthesis.getVoices();
backgroundColor: 'white', backgroundColor: 'white',
selectedBackgroundColor: '#409eff', selectedBackgroundColor: '#409eff',
selectedColor: 'white', selectedColor: 'white',
color: '#409eff', color: '#409eff',
borderColor: '#409eff', borderColor: '#409eff',
fontWeight: 'bold', fontWeight: 'bold',
fontFamily: '"Noto Sans JP", "Noto Sans KR", "Meiryo UI", "Malgun Gothic", "Segoe UI", "sans-serif"' fontFamily: '"Noto Sans JP", "Noto Sans KR", "Meiryo UI", "Malgun Gothic", "Segoe UI", "sans-serif"'
@@ -8270,8 +8281,8 @@ speechSynthesis.getVoices();
for (var ref of API.cachedUsers.values()) { for (var ref of API.cachedUsers.values()) {
if (ref.displayName === player) { if (ref.displayName === player) {
users.push(ref); users.push(ref);
break; break;
} }
} }
} }
} }
@@ -8848,21 +8859,21 @@ speechSynthesis.getVoices();
if (playersInInstance.includes(ref.displayName)) { if (playersInInstance.includes(ref.displayName)) {
instance.users.push(ref); instance.users.push(ref);
} }
var friendsInInstance = this.lastLocation.friendList; var friendsInInstance = this.lastLocation.friendList;
for (var i = 0; i < friendsInInstance.length; i++) { for (var i = 0; i < friendsInInstance.length; i++) {
var addUser = true; var addUser = true;
var player = friendsInInstance[i]; var player = friendsInInstance[i];
for (var k = 0; k < instance.users.length; k++) { for (var k = 0; k < instance.users.length; k++) {
var user = instance.users[k]; var user = instance.users[k];
if (user.displayName === player) { if (user.displayName === player) {
addUser = false; addUser = false;
break; break;
}
} }
if (addUser) { }
for (var ref of API.cachedUsers.values()) { if (addUser) {
if (ref.displayName === player) { for (var ref of API.cachedUsers.values()) {
instance.users.push(ref); if (ref.displayName === player) {
instance.users.push(ref);
break; break;
} }
} }
@@ -8877,14 +8888,14 @@ speechSynthesis.getVoices();
continue; continue;
} }
var { instanceId } = ref.$location; var { instanceId } = ref.$location;
var instance = instances[instanceId]; var instance = instances[instanceId];
if (typeof instance === 'undefined') { if (typeof instance === 'undefined') {
instance = { instance = {
id: instanceId, id: instanceId,
occupants: 0, occupants: 0,
users: [] users: []
}; };
instances[instanceId] = instance; instances[instanceId] = instance;
} }
instance.users.push(ref); instance.users.push(ref);
} }
@@ -8940,12 +8951,12 @@ speechSynthesis.getVoices();
D.loading = true; D.loading = true;
API.getWorld({ API.getWorld({
worldId: D.id worldId: D.id
}).catch((err) => { }).catch((err) => {
D.loading = false; D.loading = false;
D.visible = false; D.visible = false;
throw err; throw err;
}).then((args) => { }).then((args) => {
if (D.id === args.ref.id) { if (D.id === args.ref.id) {
D.loading = false; D.loading = false;
D.ref = args.ref; D.ref = args.ref;
D.isFavorite = API.cachedFavoritesByObjectId.has(D.id); D.isFavorite = API.cachedFavoritesByObjectId.has(D.id);
@@ -8979,36 +8990,36 @@ speechSynthesis.getVoices();
this.$confirm(`Continue? ${command}`, 'Confirm', { this.$confirm(`Continue? ${command}`, 'Confirm', {
confirmButtonText: 'Confirm', confirmButtonText: 'Confirm',
cancelButtonText: 'Cancel', cancelButtonText: 'Cancel',
type: 'info', type: 'info',
callback: (action) => { callback: (action) => {
if (action !== 'confirm') { if (action !== 'confirm') {
return; return;
} }
switch (command) { switch (command) {
case 'Delete Favorite': case 'Delete Favorite':
API.deleteFavorite({ API.deleteFavorite({
objectId: D.id objectId: D.id
});
break;
case 'Make Home':
API.saveCurrentUser({
homeLocation: D.id
}).then((args) => {
this.$message({
message: 'Home world updated',
type: 'success'
}); });
return args; break;
}); case 'Make Home':
break; API.saveCurrentUser({
case 'Reset Home': homeLocation: D.id
API.saveCurrentUser({ }).then((args) => {
homeLocation: '' this.$message({
}).then((args) => { message: 'Home world updated',
this.$message({ type: 'success'
message: 'Home world has been reset', });
type: 'success' return args;
}); });
break;
case 'Reset Home':
API.saveCurrentUser({
homeLocation: ''
}).then((args) => {
this.$message({
message: 'Home world has been reset',
type: 'success'
});
return args; return args;
}); });
break; break;
@@ -9232,25 +9243,25 @@ speechSynthesis.getVoices();
this.$confirm(`Continue? ${command}`, 'Confirm', { this.$confirm(`Continue? ${command}`, 'Confirm', {
confirmButtonText: 'Confirm', confirmButtonText: 'Confirm',
cancelButtonText: 'Cancel', cancelButtonText: 'Cancel',
type: 'info', type: 'info',
callback: (action) => { callback: (action) => {
if (action !== 'confirm') { if (action !== 'confirm') {
return; return;
} }
switch (command) { switch (command) {
case 'Delete Favorite': case 'Delete Favorite':
API.deleteFavorite({ API.deleteFavorite({
objectId: D.id objectId: D.id
});
break;
case 'Select Avatar':
API.selectAvatar({
avatarId: D.id
}).then((args) => {
this.$message({
message: 'Avatar changed',
type: 'success'
}); });
break;
case 'Select Avatar':
API.selectAvatar({
avatarId: D.id
}).then((args) => {
this.$message({
message: 'Avatar changed',
type: 'success'
});
return args; return args;
}); });
break; break;
@@ -9268,24 +9279,24 @@ speechSynthesis.getVoices();
case 'Make Public': case 'Make Public':
API.saveAvatar({ API.saveAvatar({
id: D.id, id: D.id,
releaseStatus: 'public' releaseStatus: 'public'
}).then((args) => { }).then((args) => {
this.$message({ this.$message({
message: 'Avatar updated to public', message: 'Avatar updated to public',
type: 'success' type: 'success'
}); });
return args; return args;
});
break;
case 'Make Private':
API.saveAvatar({
id: D.id,
releaseStatus: 'private'
}).then((args) => {
this.$message({
message: 'Avatar updated to private',
type: 'success'
}); });
break;
case 'Make Private':
API.saveAvatar({
id: D.id,
releaseStatus: 'private'
}).then((args) => {
this.$message({
message: 'Avatar updated to private',
type: 'success'
});
return args; return args;
}); });
break; break;
@@ -9338,22 +9349,22 @@ speechSynthesis.getVoices();
if (ownerId === refUserId) { if (ownerId === refUserId) {
this.$message({ this.$message({
message: 'It\'s personal (own) avatar', message: 'It\'s personal (own) avatar',
type: 'warning'
});
return;
}
this.showUserDialog(ownerId);
} else {
API.getAvatarImages({fileId}).then((args) => {
var ownerId = args.json.ownerId;
if (ownerId === refUserId) {
this.$message({
message: 'It\'s personal (own) avatar',
type: 'warning' type: 'warning'
}); });
return; return;
} }
this.showUserDialog(ownerId); this.showUserDialog(ownerId);
} else {
API.getAvatarImages({fileId}).then((args) => {
var ownerId = args.json.ownerId;
if (ownerId === refUserId) {
this.$message({
message: 'It\'s personal (own) avatar',
type: 'warning'
});
return;
}
this.showUserDialog(ownerId);
}); });
} }
}; };
@@ -12157,7 +12168,7 @@ speechSynthesis.getVoices();
(feed.location === 'offline') || (feed.location === 'offline') ||
(feed.location === 'private') || (feed.location === 'private') ||
((!this.worldAutoCacheGPSFilter) && ((!this.worldAutoCacheGPSFilter) &&
(!API.cachedFavoritesByObjectId.has(feed.id)))) { (!API.cachedFavoritesByObjectId.has(feed.id)))) {
return; return;
} }
this.autoDownloadWorldCache(feed.location, 'GPS', feed.id); this.autoDownloadWorldCache(feed.location, 'GPS', feed.id);
+5 -2
View File
@@ -725,8 +725,11 @@ html
div.options-container div.options-container
span.header Appearance span.header Appearance
div.options-container-item div.options-container-item
span.name Dark Mode span.name Theme mode
el-switch(v-model="isDarkMode") el-radio-group(v-model="themeMode" size="mini")
el-radio-button(label="system") System
el-radio-button(label="light") Light
el-radio-button(label="dark") Dark
div.options-container-item div.options-container-item
span.name Profile Picture Override span.name Profile Picture Override
el-switch(v-model="displayProfilePicOverrideAsAvatar") el-switch(v-model="displayProfilePicOverrideAsAvatar")