0
0
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 { 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,
});

View File

@ -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,
});

View File

@ -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<T extends Promise<any>>(
if (onFailure) {
onFailure(e);
} else {
dialog({
alert({
type: 'error',
text: e
});

View File

@ -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<string, AiScript>();
@ -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);
});

View File

@ -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
});