This commit is contained in:
syuilo 2021-11-18 23:36:04 +09:00
parent 73b5c12927
commit 318759cfa4
5 changed files with 13 additions and 15 deletions

View file

@ -1,6 +1,6 @@
import { Directive, ref } from 'vue'; import { Directive, ref } from 'vue';
import { isDeviceTouch } from '@/scripts/is-device-touch'; import { isDeviceTouch } from '@/scripts/is-device-touch';
import { popup, dialog } from '@/os'; import { popup, alert } from '@/os';
const start = isDeviceTouch ? 'touchstart' : 'mouseover'; const start = isDeviceTouch ? 'touchstart' : 'mouseover';
const end = isDeviceTouch ? 'touchend' : 'mouseleave'; const end = isDeviceTouch ? 'touchend' : 'mouseleave';
@ -28,7 +28,7 @@ export default {
el.addEventListener('click', (ev) => { el.addEventListener('click', (ev) => {
ev.preventDefault(); ev.preventDefault();
ev.stopPropagation(); ev.stopPropagation();
dialog({ alert({
type: 'info', type: 'info',
text: binding.value, text: binding.value,
}); });

View file

@ -26,7 +26,7 @@ import { router } from '@/router';
import { applyTheme } from '@/scripts/theme'; import { applyTheme } from '@/scripts/theme';
import { isDeviceDarkmode } from '@/scripts/is-device-darkmode'; import { isDeviceDarkmode } from '@/scripts/is-device-darkmode';
import { i18n } from '@/i18n'; 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 * as sound from '@/scripts/sound';
import { $i, refreshAccount, login, updateAccount, signout } from '@/account'; import { $i, refreshAccount, login, updateAccount, signout } from '@/account';
import { defaultStore, ColdDeviceStorage } from '@/store'; import { defaultStore, ColdDeviceStorage } from '@/store';
@ -53,7 +53,7 @@ if (_DEV_) {
window.addEventListener('error', event => { window.addEventListener('error', event => {
console.error(event); console.error(event);
/* /*
dialog({ alert({
type: 'error', type: 'error',
title: 'DEV: Unhandled error', title: 'DEV: Unhandled error',
text: event.message text: event.message
@ -64,7 +64,7 @@ if (_DEV_) {
window.addEventListener('unhandledrejection', event => { window.addEventListener('unhandledrejection', event => {
console.error(event); console.error(event);
/* /*
dialog({ alert({
type: 'error', type: 'error',
title: 'DEV: Unhandled promise rejection', title: 'DEV: Unhandled promise rejection',
text: event.reason text: event.reason
@ -311,11 +311,10 @@ stream.on('_disconnected_', async () => {
} else if (defaultStore.state.serverDisconnectedBehavior === 'dialog') { } else if (defaultStore.state.serverDisconnectedBehavior === 'dialog') {
if (reloadDialogShowing) return; if (reloadDialogShowing) return;
reloadDialogShowing = true; reloadDialogShowing = true;
const { canceled } = await dialog({ const { canceled } = await confirm({
type: 'warning', type: 'warning',
title: i18n.locale.disconnectedFromServer, title: i18n.locale.disconnectedFromServer,
text: i18n.locale.reloadConfirm, text: i18n.locale.reloadConfirm,
showCancelButton: true
}); });
reloadDialogShowing = false; reloadDialogShowing = false;
if (!canceled) { if (!canceled) {
@ -337,7 +336,7 @@ for (const plugin of ColdDeviceStorage.get('plugins').filter(p => p.active)) {
if ($i) { if ($i) {
if ($i.isDeleted) { if ($i.isDeleted) {
dialog({ alert({
type: 'warning', type: 'warning',
text: i18n.locale.accountDeletionInProgress, text: i18n.locale.accountDeletionInProgress,
}); });

View file

@ -103,7 +103,7 @@ export const apiWithDialog = ((
) => { ) => {
const promise = api(endpoint, data, token); const promise = api(endpoint, data, token);
promiseDialog(promise, null, (e) => { promiseDialog(promise, null, (e) => {
dialog({ alert({
type: 'error', type: 'error',
text: e.message + '\n' + (e as any).id, text: e.message + '\n' + (e as any).id,
}); });
@ -136,7 +136,7 @@ export function promiseDialog<T extends Promise<any>>(
if (onFailure) { if (onFailure) {
onFailure(e); onFailure(e);
} else { } else {
dialog({ alert({
type: 'error', type: 'error',
text: e text: e
}); });

View file

@ -2,7 +2,7 @@ import { AiScript, utils, values } from '@syuilo/aiscript';
import { deserialize } from '@syuilo/aiscript/built/serializer'; import { deserialize } from '@syuilo/aiscript/built/serializer';
import { jsToVal } from '@syuilo/aiscript/built/interpreter/util'; import { jsToVal } from '@syuilo/aiscript/built/interpreter/util';
import { createAiScriptEnv } from '@/scripts/aiscript/api'; import { createAiScriptEnv } from '@/scripts/aiscript/api';
import { dialog } from '@/os'; import { inputText } from '@/os';
import { noteActions, notePostInterruptors, noteViewInterruptors, postFormActions, userActions } from '@/store'; import { noteActions, notePostInterruptors, noteViewInterruptors, postFormActions, userActions } from '@/store';
const pluginContexts = new Map<string, AiScript>(); const pluginContexts = new Map<string, AiScript>();
@ -16,9 +16,8 @@ export function install(plugin) {
}), { }), {
in: (q) => { in: (q) => {
return new Promise(ok => { return new Promise(ok => {
dialog({ inputText({
title: q, title: q,
input: {}
}).then(({ canceled, result: a }) => { }).then(({ canceled, result: a }) => {
ok(a); ok(a);
}); });

View file

@ -1,11 +1,11 @@
import { $i } from '@/account'; import { $i } from '@/account';
import { i18n } from '@/i18n'; import { i18n } from '@/i18n';
import { dialog } from '@/os'; import { alert } from '@/os';
export function pleaseLogin() { export function pleaseLogin() {
if ($i) return; if ($i) return;
dialog({ alert({
title: i18n.locale.signinRequired, title: i18n.locale.signinRequired,
text: null text: null
}); });