enhance(frontend): 季節に応じた画面の演出を南半球に対応させる (#12838)

* (enhance) 季節に応じた画面の演出を南半球に対応させる

* Update Changelog

* (add) 半球の簡易自動判定

---------

Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
This commit is contained in:
かっこかり 2024-01-21 19:08:07 +09:00 committed by GitHub
parent 676ee87963
commit 3784b39a5f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 44 additions and 3 deletions

View file

@ -38,6 +38,7 @@
- Enhance: 絵文字ピッカー・オートコンプリートで、完全一致した絵文字を優先的に表示するように - Enhance: 絵文字ピッカー・オートコンプリートで、完全一致した絵文字を優先的に表示するように
- Enhance: Playの説明欄にMFMを使えるように - Enhance: Playの説明欄にMFMを使えるように
- Enhance: チャンネルノートの場合は詳細ページからその前後のノートを見れるように - Enhance: チャンネルノートの場合は詳細ページからその前後のノートを見れるように
- Enhance: 季節に応じた画面の演出を南半球でも利用できるように
- Enhance: タイムラインフィルターの設定をすべて保持できるように - Enhance: タイムラインフィルターの設定をすべて保持できるように
- 今までの「TLに他の人への返信を含める」設定は一旦リセットされます - 今までの「TLに他の人への返信を含める」設定は一旦リセットされます
- Enhance: タイムラインフィルターに「センシティブなファイルを含むノートを表示」を追加 - Enhance: タイムラインフィルターに「センシティブなファイルを含むノートを表示」を追加

6
locales/index.d.ts vendored
View file

@ -4824,6 +4824,7 @@ export interface Locale extends ILocale {
* *
*/ */
"backToTitle": string; "backToTitle": string;
"hemisphere": string;
/** /**
* *
*/ */
@ -9420,6 +9421,11 @@ export interface Locale extends ILocale {
"description": string; "description": string;
}; };
}; };
"_hemisphere": {
"N": string;
"S": string;
"caption": string;
};
"_reversi": { "_reversi": {
/** /**
* *

View file

@ -1202,6 +1202,7 @@ replaying: "リプレイ中"
ranking: "ランキング" ranking: "ランキング"
lastNDays: "直近{n}日" lastNDays: "直近{n}日"
backToTitle: "タイトルへ" backToTitle: "タイトルへ"
hemisphere: "お住まいの地域"
withSensitive: "センシティブなファイルを含むノートを表示" withSensitive: "センシティブなファイルを含むノートを表示"
userSaysSomethingSensitive: "{name}のセンシティブなファイルを含む投稿" userSaysSomethingSensitive: "{name}のセンシティブなファイルを含む投稿"
enableHorizontalSwipe: "スワイプしてタブを切り替える" enableHorizontalSwipe: "スワイプしてタブを切り替える"
@ -2510,6 +2511,11 @@ _dataSaver:
title: "コードハイライト" title: "コードハイライト"
description: "MFMなどでコードハイライト記法が使われている場合、タップするまで読み込まれなくなります。コードハイライトではハイライトする言語ごとにその定義ファイルを読み込む必要がありますが、それらが自動で読み込まれなくなるため、通信量の削減が見込めます。" description: "MFMなどでコードハイライト記法が使われている場合、タップするまで読み込まれなくなります。コードハイライトではハイライトする言語ごとにその定義ファイルを読み込む必要がありますが、それらが自動で読み込まれなくなるため、通信量の削減が見込めます。"
_hemisphere:
N: "北半球"
S: "南半球"
caption: "一部のクライアント設定で、季節を判定するために使用します。"
_reversi: _reversi:
reversi: "リバーシ" reversi: "リバーシ"
gameSettings: "対局の設定" gameSettings: "対局の設定"
@ -2551,3 +2557,4 @@ _reversi:
_offlineScreen: _offlineScreen:
title: "オフライン - サーバーに接続できません" title: "オフライン - サーバーに接続できません"
header: "サーバーに接続できません" header: "サーバーに接続できません"

View file

@ -77,9 +77,18 @@ export async function mainBoot() {
if (defaultStore.state.enableSeasonalScreenEffect) { if (defaultStore.state.enableSeasonalScreenEffect) {
const month = new Date().getMonth() + 1; const month = new Date().getMonth() + 1;
if (month === 12 || month === 1) { if (defaultStore.state.hemisphere === 'S') {
const SnowfallEffect = (await import('@/scripts/snowfall-effect.js')).SnowfallEffect; // ▼南半球
new SnowfallEffect().render(); if (month === 7 || month === 8) {
const SnowfallEffect = (await import('@/scripts/snowfall-effect.js')).SnowfallEffect;
new SnowfallEffect().render();
}
} else {
// ▼北半球
if (month === 12 || month === 1) {
const SnowfallEffect = (await import('@/scripts/snowfall-effect.js')).SnowfallEffect;
new SnowfallEffect().render();
}
} }
} }

View file

@ -17,6 +17,13 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
</MkSelect> </MkSelect>
<MkRadios v-model="hemisphere">
<template #label>{{ i18n.ts.hemisphere }}</template>
<option value="N">{{ i18n.ts._hemisphere.N }}</option>
<option value="S">{{ i18n.ts._hemisphere.S }}</option>
<template #caption>{{ i18n.ts._hemisphere.caption }}</template>
</MkRadios>
<MkRadios v-model="overridedDeviceKind"> <MkRadios v-model="overridedDeviceKind">
<template #label>{{ i18n.ts.overridedDeviceKind }}</template> <template #label>{{ i18n.ts.overridedDeviceKind }}</template>
<option :value="null">{{ i18n.ts.auto }}</option> <option :value="null">{{ i18n.ts.auto }}</option>
@ -260,6 +267,7 @@ async function reloadAsk() {
unisonReload(); unisonReload();
} }
const hemisphere = computed(defaultStore.makeGetterSetter('hemisphere'));
const overridedDeviceKind = computed(defaultStore.makeGetterSetter('overridedDeviceKind')); const overridedDeviceKind = computed(defaultStore.makeGetterSetter('overridedDeviceKind'));
const serverDisconnectedBehavior = computed(defaultStore.makeGetterSetter('serverDisconnectedBehavior')); const serverDisconnectedBehavior = computed(defaultStore.makeGetterSetter('serverDisconnectedBehavior'));
const showNoteActionsOnlyHover = computed(defaultStore.makeGetterSetter('showNoteActionsOnlyHover')); const showNoteActionsOnlyHover = computed(defaultStore.makeGetterSetter('showNoteActionsOnlyHover'));
@ -322,6 +330,7 @@ watch(useSystemFont, () => {
}); });
watch([ watch([
hemisphere,
lang, lang,
fontSize, fontSize,
useSystemFont, useSystemFont,

View file

@ -33,6 +33,10 @@ try {
} }
export const dateTimeFormat = _dateTimeFormat; export const dateTimeFormat = _dateTimeFormat;
export const timeZone = dateTimeFormat.resolvedOptions().timeZone;
export const hemisphere = /^(australia|pacific|antarctica|indian)\//i.test(timeZone) ? 'S' : 'N';
let _numberFormat: Intl.NumberFormat; let _numberFormat: Intl.NumberFormat;
try { try {
_numberFormat = new Intl.NumberFormat(versatileLang); _numberFormat = new Intl.NumberFormat(versatileLang);

View file

@ -8,6 +8,7 @@ import * as Misskey from 'misskey-js';
import { miLocalStorage } from './local-storage.js'; import { miLocalStorage } from './local-storage.js';
import type { SoundType } from '@/scripts/sound.js'; import type { SoundType } from '@/scripts/sound.js';
import { Storage } from '@/pizzax.js'; import { Storage } from '@/pizzax.js';
import { hemisphere } from '@/scripts/intl-const.js';
interface PostFormAction { interface PostFormAction {
title: string, title: string,
@ -429,6 +430,10 @@ export const defaultStore = markRaw(new Storage('base', {
sfxVolume: 1, sfxVolume: 1,
}, },
}, },
hemisphere: {
where: 'device',
default: hemisphere as 'N' | 'S',
},
enableHorizontalSwipe: { enableHorizontalSwipe: {
where: 'device', where: 'device',
default: true, default: true,