From 5048fc797187ec152c2de07721fe87354becdf86 Mon Sep 17 00:00:00 2001 From: naskya Date: Fri, 15 Sep 2023 01:17:14 +0900 Subject: [PATCH] feat: ability to disable toast --- README.md | 2 ++ locales/en-US.yml | 2 ++ locales/ja-JP.yml | 2 ++ packages/client/src/init.ts | 24 ++++++++++--------- .../client/src/pages/settings/general.vue | 11 +++++++++ packages/client/src/store.ts | 4 ++++ 6 files changed, 34 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index c9d106aca..38aada437 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,8 @@ ## 細かい変更点 +- 身バレ防止の設定を追加 + - 「おかえりなさい、◯◯さん」が出ないようにできるように - ユーザーページのデフォルトのタブを「投稿と返信」に変更 - タイムラインにリプライを表示する設定をデフォルトで有効に - 未読通知のタブをリアクションの通知を表示するタブに変更 diff --git a/locales/en-US.yml b/locales/en-US.yml index 8deeff692..833e2e630 100644 --- a/locales/en-US.yml +++ b/locales/en-US.yml @@ -2144,3 +2144,5 @@ _emojiModPerm: add: "Add" mod: "Add and Edit" full: "Allow All" +privacyForNerds: "Privacy protection in public places" +disableToast: "Don't show the \"Welcome back\" banner" diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 6c80e7eca..48c8319c8 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -1999,3 +1999,5 @@ _emojiModPerm: importZip: ZIPをインポート emojiPackCreator: 絵文字パックの作者 exportZip: ZIPをエクスポート +privacyForNerds: "身バレ防止" +disableToast: "「おかえりなさい、◯◯さん」を表示しない" diff --git a/packages/client/src/init.ts b/packages/client/src/init.ts index c416b6f06..5d4f304b0 100644 --- a/packages/client/src/init.ts +++ b/packages/client/src/init.ts @@ -436,19 +436,21 @@ function checkForSplash() { }); } - const lastUsed = localStorage.getItem("lastUsed"); - if (lastUsed) { - const lastUsedDate = parseInt(lastUsed, 10); - // 二時間以上前なら - if (Date.now() - lastUsedDate > 1000 * 60 * 60 * 2) { - toast( - i18n.t("welcomeBackWithName", { - name: $i.name || $i.username, - }), - ); + if (!defaultStore.state.disableToast) { + const lastUsed = localStorage.getItem("lastUsed"); + if (lastUsed) { + const lastUsedDate = parseInt(lastUsed, 10); + // 二時間以上前なら + if (Date.now() - lastUsedDate > 1000 * 60 * 60 * 2) { + toast( + i18n.t("welcomeBackWithName", { + name: $i.name || $i.username, + }), + ); + } } + localStorage.setItem("lastUsed", Date.now().toString()); } - localStorage.setItem("lastUsed", Date.now().toString()); const latestDonationInfoShownAt = localStorage.getItem( "latestDonationInfoShownAt", diff --git a/packages/client/src/pages/settings/general.vue b/packages/client/src/pages/settings/general.vue index caf2d13a5..1afeb91cc 100644 --- a/packages/client/src/pages/settings/general.vue +++ b/packages/client/src/pages/settings/general.vue @@ -262,6 +262,16 @@ > + + + {{ i18n.ts.disableToast + }}{{ + i18n.ts.originalFeature + }} + + { defaultStore.set("swipeOnMobile", true); diff --git a/packages/client/src/store.ts b/packages/client/src/store.ts index 45c77412e..d0c5a18b8 100644 --- a/packages/client/src/store.ts +++ b/packages/client/src/store.ts @@ -373,6 +373,10 @@ export const defaultStore = markRaw( where: "deviceAccount", default: true, }, + disableToast: { + where: "device", + default: false, + }, }), );