reloadAskを汎用化、理由を受け取るように
This commit is contained in:
parent
1603ce980d
commit
215f7f0826
|
@ -3121,7 +3121,7 @@ export interface Locale extends ILocale {
|
||||||
*/
|
*/
|
||||||
"narrow": string;
|
"narrow": string;
|
||||||
/**
|
/**
|
||||||
* 設定はページリロード後に反映されます。今すぐリロードしますか?
|
* 設定はページリロード後に反映されます。
|
||||||
*/
|
*/
|
||||||
"reloadToApplySetting": string;
|
"reloadToApplySetting": string;
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -776,7 +776,7 @@ left: "左"
|
||||||
center: "中央"
|
center: "中央"
|
||||||
wide: "広い"
|
wide: "広い"
|
||||||
narrow: "狭い"
|
narrow: "狭い"
|
||||||
reloadToApplySetting: "設定はページリロード後に反映されます。今すぐリロードしますか?"
|
reloadToApplySetting: "設定はページリロード後に反映されます。"
|
||||||
needReloadToApply: "反映には再起動が必要です。"
|
needReloadToApply: "反映には再起動が必要です。"
|
||||||
showTitlebar: "タイトルバーを表示する"
|
showTitlebar: "タイトルバーを表示する"
|
||||||
clearCache: "キャッシュをクリア"
|
clearCache: "キャッシュをクリア"
|
||||||
|
|
|
@ -359,7 +359,7 @@ watch([
|
||||||
confirmWhenRevealingSensitiveMedia,
|
confirmWhenRevealingSensitiveMedia,
|
||||||
contextMenu,
|
contextMenu,
|
||||||
], async () => {
|
], async () => {
|
||||||
await reloadAsk();
|
await reloadAsk({ reason: i18n.ts.reloadToApplySetting, unison: true });
|
||||||
});
|
});
|
||||||
|
|
||||||
const emojiIndexLangs = ['en-US', 'ja-JP', 'ja-JP_hira'] as const;
|
const emojiIndexLangs = ['en-US', 'ja-JP', 'ja-JP_hira'] as const;
|
||||||
|
|
|
@ -90,7 +90,7 @@ function removeItem(index: number) {
|
||||||
|
|
||||||
async function save() {
|
async function save() {
|
||||||
defaultStore.set('menu', items.value.map(x => x.type));
|
defaultStore.set('menu', items.value.map(x => x.type));
|
||||||
await reloadAsk();
|
await reloadAsk({ reason: i18n.ts.reloadToApplySetting, unison: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
function reset() {
|
function reset() {
|
||||||
|
@ -101,7 +101,7 @@ function reset() {
|
||||||
}
|
}
|
||||||
|
|
||||||
watch(menuDisplay, async () => {
|
watch(menuDisplay, async () => {
|
||||||
await reloadAsk();
|
await reloadAsk({ reason: i18n.ts.reloadToApplySetting, unison: true });
|
||||||
});
|
});
|
||||||
|
|
||||||
const headerActions = computed(() => []);
|
const headerActions = computed(() => []);
|
||||||
|
|
|
@ -145,7 +145,7 @@ async function updateRepliesAll(withReplies: boolean) {
|
||||||
watch([
|
watch([
|
||||||
enableCondensedLineForAcct,
|
enableCondensedLineForAcct,
|
||||||
], async () => {
|
], async () => {
|
||||||
await reloadAsk();
|
await reloadAsk({ reason: i18n.ts.reloadToApplySetting, unison: true });
|
||||||
});
|
});
|
||||||
|
|
||||||
const headerActions = computed(() => []);
|
const headerActions = computed(() => []);
|
||||||
|
|
|
@ -144,7 +144,7 @@ watch(wallpaper, () => {
|
||||||
} else {
|
} else {
|
||||||
miLocalStorage.setItem('wallpaper', wallpaper.value);
|
miLocalStorage.setItem('wallpaper', wallpaper.value);
|
||||||
}
|
}
|
||||||
reloadAsk();
|
await reloadAsk({ reason: i18n.ts.reloadToApplySetting, unison: true });
|
||||||
});
|
});
|
||||||
|
|
||||||
onActivated(() => {
|
onActivated(() => {
|
||||||
|
|
|
@ -9,21 +9,32 @@ import { unisonReload } from '@/scripts/unison-reload.js';
|
||||||
|
|
||||||
let isReloadConfirming = false;
|
let isReloadConfirming = false;
|
||||||
|
|
||||||
export async function reloadAsk() {
|
export async function reloadAsk(opts: {
|
||||||
|
unison?: boolean;
|
||||||
|
reason?: string;
|
||||||
|
}) {
|
||||||
if (isReloadConfirming) {
|
if (isReloadConfirming) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
isReloadConfirming = true;
|
isReloadConfirming = true;
|
||||||
|
|
||||||
const { canceled } = await os.confirm({
|
const { canceled } = await os.confirm(opts.reason == null ? {
|
||||||
type: 'info',
|
type: 'info',
|
||||||
text: i18n.ts.reloadToApplySetting,
|
text: i18n.ts.reloadConfirm,
|
||||||
|
} : {
|
||||||
|
type: 'info',
|
||||||
|
title: i18n.ts.reloadConfirm,
|
||||||
|
text: opts.reason,
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
isReloadConfirming = false;
|
isReloadConfirming = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (canceled) return;
|
if (canceled) return;
|
||||||
|
|
||||||
|
if (opts.unison) {
|
||||||
unisonReload();
|
unisonReload();
|
||||||
|
} else {
|
||||||
|
location.reload();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue