From 318759cfa41915e4813defe9591123286669e9fa Mon Sep 17 00:00:00 2001 From: syuilo Date: Thu, 18 Nov 2021 23:36:04 +0900 Subject: [PATCH] fix --- packages/client/src/directives/tooltip.ts | 4 ++-- packages/client/src/init.ts | 11 +++++------ packages/client/src/os.ts | 4 ++-- packages/client/src/plugin.ts | 5 ++--- packages/client/src/scripts/please-login.ts | 4 ++-- 5 files changed, 13 insertions(+), 15 deletions(-) diff --git a/packages/client/src/directives/tooltip.ts b/packages/client/src/directives/tooltip.ts index 1294f6b06..b96671be3 100644 --- a/packages/client/src/directives/tooltip.ts +++ b/packages/client/src/directives/tooltip.ts @@ -1,6 +1,6 @@ import { Directive, ref } from 'vue'; import { isDeviceTouch } from '@/scripts/is-device-touch'; -import { popup, dialog } from '@/os'; +import { popup, alert } from '@/os'; const start = isDeviceTouch ? 'touchstart' : 'mouseover'; const end = isDeviceTouch ? 'touchend' : 'mouseleave'; @@ -28,7 +28,7 @@ export default { el.addEventListener('click', (ev) => { ev.preventDefault(); ev.stopPropagation(); - dialog({ + alert({ type: 'info', text: binding.value, }); diff --git a/packages/client/src/init.ts b/packages/client/src/init.ts index 27ed78106..f0368cc1d 100644 --- a/packages/client/src/init.ts +++ b/packages/client/src/init.ts @@ -26,7 +26,7 @@ import { router } from '@/router'; import { applyTheme } from '@/scripts/theme'; import { isDeviceDarkmode } from '@/scripts/is-device-darkmode'; import { i18n } from '@/i18n'; -import { stream, dialog, post, popup } from '@/os'; +import { stream, confirm, alert, post, popup } from '@/os'; import * as sound from '@/scripts/sound'; import { $i, refreshAccount, login, updateAccount, signout } from '@/account'; import { defaultStore, ColdDeviceStorage } from '@/store'; @@ -53,7 +53,7 @@ if (_DEV_) { window.addEventListener('error', event => { console.error(event); /* - dialog({ + alert({ type: 'error', title: 'DEV: Unhandled error', text: event.message @@ -64,7 +64,7 @@ if (_DEV_) { window.addEventListener('unhandledrejection', event => { console.error(event); /* - dialog({ + alert({ type: 'error', title: 'DEV: Unhandled promise rejection', text: event.reason @@ -311,11 +311,10 @@ stream.on('_disconnected_', async () => { } else if (defaultStore.state.serverDisconnectedBehavior === 'dialog') { if (reloadDialogShowing) return; reloadDialogShowing = true; - const { canceled } = await dialog({ + const { canceled } = await confirm({ type: 'warning', title: i18n.locale.disconnectedFromServer, text: i18n.locale.reloadConfirm, - showCancelButton: true }); reloadDialogShowing = false; if (!canceled) { @@ -337,7 +336,7 @@ for (const plugin of ColdDeviceStorage.get('plugins').filter(p => p.active)) { if ($i) { if ($i.isDeleted) { - dialog({ + alert({ type: 'warning', text: i18n.locale.accountDeletionInProgress, }); diff --git a/packages/client/src/os.ts b/packages/client/src/os.ts index 4f547ba5a..2bd270a97 100644 --- a/packages/client/src/os.ts +++ b/packages/client/src/os.ts @@ -103,7 +103,7 @@ export const apiWithDialog = (( ) => { const promise = api(endpoint, data, token); promiseDialog(promise, null, (e) => { - dialog({ + alert({ type: 'error', text: e.message + '\n' + (e as any).id, }); @@ -136,7 +136,7 @@ export function promiseDialog>( if (onFailure) { onFailure(e); } else { - dialog({ + alert({ type: 'error', text: e }); diff --git a/packages/client/src/plugin.ts b/packages/client/src/plugin.ts index c56ee1eb2..ca7b4b73d 100644 --- a/packages/client/src/plugin.ts +++ b/packages/client/src/plugin.ts @@ -2,7 +2,7 @@ import { AiScript, utils, values } from '@syuilo/aiscript'; import { deserialize } from '@syuilo/aiscript/built/serializer'; import { jsToVal } from '@syuilo/aiscript/built/interpreter/util'; import { createAiScriptEnv } from '@/scripts/aiscript/api'; -import { dialog } from '@/os'; +import { inputText } from '@/os'; import { noteActions, notePostInterruptors, noteViewInterruptors, postFormActions, userActions } from '@/store'; const pluginContexts = new Map(); @@ -16,9 +16,8 @@ export function install(plugin) { }), { in: (q) => { return new Promise(ok => { - dialog({ + inputText({ title: q, - input: {} }).then(({ canceled, result: a }) => { ok(a); }); diff --git a/packages/client/src/scripts/please-login.ts b/packages/client/src/scripts/please-login.ts index 928f6ec0f..fe3919e4c 100644 --- a/packages/client/src/scripts/please-login.ts +++ b/packages/client/src/scripts/please-login.ts @@ -1,11 +1,11 @@ import { $i } from '@/account'; import { i18n } from '@/i18n'; -import { dialog } from '@/os'; +import { alert } from '@/os'; export function pleaseLogin() { if ($i) return; - dialog({ + alert({ title: i18n.locale.signinRequired, text: null });