enhance(client): サーバーから切断されたときにダイアログで警告を表示できるように

This commit is contained in:
syuilo
2020-08-19 21:47:18 +09:00
parent 6870262f8d
commit c34f302b1c
5 changed files with 35 additions and 18 deletions

View File

@ -237,6 +237,26 @@ os.init(async () => {
document.documentElement.style.setProperty('--modalBgFilter', v ? 'blur(4px)' : 'none');
}, { immediate: true });
let reloadDialogShowing = false;
os.stream.on('_disconnected_', async () => {
if (store.state.device.serverDisconnectedBehavior === 'reload') {
location.reload();
} else if (store.state.device.serverDisconnectedBehavior === 'dialog') {
if (reloadDialogShowing) return;
reloadDialogShowing = true;
const { canceled } = await app.dialog({
type: 'warning',
title: app.$t('disconnectedFromServer'),
text: app.$t('reloadConfirm'),
showCancelButton: true
});
reloadDialogShowing = false;
if (!canceled) {
location.reload();
}
}
});
os.stream.on('emojiAdded', data => {
// TODO
//store.commit('instance/set', );