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