From 2524defbc297b41890b616e5ce638ec2099ff38d Mon Sep 17 00:00:00 2001 From: Stephen Zhou <38493346+hyoban@users.noreply.github.com> Date: Mon, 28 Apr 2025 20:53:59 +0800 Subject: [PATCH] feat(mobile): copy inbox email address --- .../mobile/src/modules/context-menu/feeds.tsx | 8 +++- .../mobile/src/modules/context-menu/inbox.tsx | 48 +++++++++++++++++++ .../mobile/src/modules/context-menu/lists.tsx | 4 +- .../EntryContentHeaderRightActions.tsx | 2 +- .../modules/subscription/items/InboxItem.tsx | 47 +++++++++--------- locales/mobile/default/ar-DZ.json | 1 - locales/mobile/default/ar-IQ.json | 1 - locales/mobile/default/ar-KW.json | 1 - locales/mobile/default/ar-MA.json | 1 - locales/mobile/default/ar-SA.json | 1 - locales/mobile/default/ar-TN.json | 1 - locales/mobile/default/de.json | 1 - locales/mobile/default/en.json | 5 +- locales/mobile/default/es.json | 1 - locales/mobile/default/fi.json | 1 - locales/mobile/default/fr.json | 1 - locales/mobile/default/it.json | 1 - locales/mobile/default/ja.json | 1 - locales/mobile/default/ko.json | 1 - locales/mobile/default/pt.json | 1 - locales/mobile/default/ru.json | 1 - locales/mobile/default/tr.json | 1 - locales/mobile/default/zh-CN.json | 1 - locales/mobile/default/zh-HK.json | 1 - locales/mobile/default/zh-TW.json | 1 - 25 files changed, 86 insertions(+), 47 deletions(-) create mode 100644 apps/mobile/src/modules/context-menu/inbox.tsx diff --git a/apps/mobile/src/modules/context-menu/feeds.tsx b/apps/mobile/src/modules/context-menu/feeds.tsx index a7f325ce7..58a033768 100644 --- a/apps/mobile/src/modules/context-menu/feeds.tsx +++ b/apps/mobile/src/modules/context-menu/feeds.tsx @@ -203,13 +203,17 @@ const generateSubscriptionContextMenu = (navigation: Navigation, id: string) => const feed = getFeed(subscription.feedId) if (!feed) return setStringAsync(feed.url) - toast.success("Link copied to clipboard") + toast.success(t("operation.copy_which_success", { which: t("operation.copy.link") })) return } } }} > - {t("operation.copy_link")} + + {t("operation.copy_which", { + which: t("operation.copy.link"), + })} + + +export const InboxContextMenu = ({ inboxId, children }: InboxContextMenuProps) => { + const { t } = useTranslation() + const inbox = useInbox(inboxId) + + if (!inbox) { + return children + } + + return ( + + {children} + + + { + setStringAsync(`${inbox.id}@follow.re`).then(() => { + toast.success( + t("operation.copy_which_success", { which: t("operation.copy.email_address") }), + ) + }) + }} + > + + {t("operation.copy_which", { which: t("operation.copy.email_address") })} + + + + + + ) +} diff --git a/apps/mobile/src/modules/context-menu/lists.tsx b/apps/mobile/src/modules/context-menu/lists.tsx index 9554a1561..95a176a99 100644 --- a/apps/mobile/src/modules/context-menu/lists.tsx +++ b/apps/mobile/src/modules/context-menu/lists.tsx @@ -32,11 +32,11 @@ export const SubscriptionListItemContextMenu: FC< }, }, { - title: t("operation.copy_link"), + title: t("operation.copy_which", { which: t("operation.copy.link") }), onSelect: () => { const list = getList(id) if (!list) return - toast.success("Link copied to clipboard") + toast.success(t("operation.copy_which_success", { which: t("operation.copy.link") })) Clipboard.setString(`${env.WEB_URL}/share/lists/${list.id}`) }, }, diff --git a/apps/mobile/src/modules/entry-content/EntryContentHeaderRightActions.tsx b/apps/mobile/src/modules/entry-content/EntryContentHeaderRightActions.tsx index 4b2a317ea..5326a1178 100644 --- a/apps/mobile/src/modules/entry-content/EntryContentHeaderRightActions.tsx +++ b/apps/mobile/src/modules/entry-content/EntryContentHeaderRightActions.tsx @@ -208,7 +208,7 @@ const HeaderRightActionsImpl = ({ }, { key: "CopyLink", - title: t("operation.copy_link"), + title: t("operation.copy_which", { which: t("operation.copy.link") }), iconIOS: { name: "link" }, onPress: handleCopyLink, inMenu: true, diff --git a/apps/mobile/src/modules/subscription/items/InboxItem.tsx b/apps/mobile/src/modules/subscription/items/InboxItem.tsx index 424f46c8d..be232c995 100644 --- a/apps/mobile/src/modules/subscription/items/InboxItem.tsx +++ b/apps/mobile/src/modules/subscription/items/InboxItem.tsx @@ -15,6 +15,7 @@ import { useSubscription } from "@/src/store/subscription/hooks" import { getInboxStoreId } from "@/src/store/subscription/utils" import { useUnreadCount } from "@/src/store/unread/hooks" +import { InboxContextMenu } from "../../context-menu/inbox" import type { SubscriptionItemBaseProps } from "./types" import { UnreadCount } from "./UnreadCount" @@ -33,29 +34,31 @@ export const InboxItem = memo(({ id, isFirst, isLast }: SubscriptionItemBaseProp "rounded-b-[10px]": isLast, })} > - { - selectFeed({ type: "inbox", inboxId: id }) - navigation.pushControllerView(FeedScreen, { - feedId: id, - }) - }} - > - - - + + { + selectFeed({ type: "inbox", inboxId: id }) + navigation.pushControllerView(FeedScreen, { + feedId: id, + }) + }} + > + + + - - {subscription.title} - - - + + {subscription.title} + + + + ) }) diff --git a/locales/mobile/default/ar-DZ.json b/locales/mobile/default/ar-DZ.json index 48d6e8dc3..e535ec6c8 100644 --- a/locales/mobile/default/ar-DZ.json +++ b/locales/mobile/default/ar-DZ.json @@ -1,6 +1,5 @@ { "operation.change_to_other_view": "التغيير إلى عرض آخر", - "operation.copy_link": "نسخ الرابط", "operation.delete_category": "حذف الفئة", "operation.edit": "تحرير", "operation.error_since": "خطأ منذ", diff --git a/locales/mobile/default/ar-IQ.json b/locales/mobile/default/ar-IQ.json index c66e7eb43..7f7df2e8d 100644 --- a/locales/mobile/default/ar-IQ.json +++ b/locales/mobile/default/ar-IQ.json @@ -1,6 +1,5 @@ { "operation.change_to_other_view": "تغيير إلى عرض آخر", - "operation.copy_link": "نسخ الرابط", "operation.delete_category": "حذف الفئة", "operation.edit": "تحرير", "operation.error_since": "خطأ منذ", diff --git a/locales/mobile/default/ar-KW.json b/locales/mobile/default/ar-KW.json index 1c006ed95..3fa0c1c8d 100644 --- a/locales/mobile/default/ar-KW.json +++ b/locales/mobile/default/ar-KW.json @@ -1,6 +1,5 @@ { "operation.change_to_other_view": "التبديل إلى طريقة عرض أخرى", - "operation.copy_link": "نسخ الرابط", "operation.delete_category": "حذف الفئة", "operation.edit": "تحرير", "operation.error_since": "خطأ منذ", diff --git a/locales/mobile/default/ar-MA.json b/locales/mobile/default/ar-MA.json index ac5904796..e92c4f16f 100644 --- a/locales/mobile/default/ar-MA.json +++ b/locales/mobile/default/ar-MA.json @@ -1,6 +1,5 @@ { "operation.change_to_other_view": "تغيير إلى عرض آخر", - "operation.copy_link": "نسخ الرابط", "operation.delete_category": "حذف الفئة", "operation.edit": "تعديل", "operation.error_since": "خطأ منذ", diff --git a/locales/mobile/default/ar-SA.json b/locales/mobile/default/ar-SA.json index 1a5132589..26e69623b 100644 --- a/locales/mobile/default/ar-SA.json +++ b/locales/mobile/default/ar-SA.json @@ -1,6 +1,5 @@ { "operation.change_to_other_view": "التغيير إلى عرض آخر", - "operation.copy_link": "نسخ الرابط", "operation.delete_category": "حذف الفئة", "operation.edit": "تحرير", "operation.error_since": "خطأ منذ", diff --git a/locales/mobile/default/ar-TN.json b/locales/mobile/default/ar-TN.json index e96cdb356..b71697798 100644 --- a/locales/mobile/default/ar-TN.json +++ b/locales/mobile/default/ar-TN.json @@ -1,6 +1,5 @@ { "operation.change_to_other_view": "التغيير إلى عرض آخر", - "operation.copy_link": "نسخ الرابط", "operation.delete_category": "حذف الفئة", "operation.edit": "تحرير", "operation.error_since": "خطأ منذ", diff --git a/locales/mobile/default/de.json b/locales/mobile/default/de.json index 0a02f682e..9974798da 100644 --- a/locales/mobile/default/de.json +++ b/locales/mobile/default/de.json @@ -1,6 +1,5 @@ { "operation.change_to_other_view": "Zu anderer Ansicht wechseln", - "operation.copy_link": "Link kopieren", "operation.delete_category": "Kategorie löschen", "operation.edit": "Bearbeiten", "operation.error_since": "Fehler seit", diff --git a/locales/mobile/default/en.json b/locales/mobile/default/en.json index 54fb45131..57bc15010 100644 --- a/locales/mobile/default/en.json +++ b/locales/mobile/default/en.json @@ -23,7 +23,10 @@ "onboarding.welcome_title": "Welcome to Folo!", "operation.add_feeds_to_category": "Move to Category", "operation.change_to_other_view": "Switch to Another View", - "operation.copy_link": "Copy Link", + "operation.copy.email_address": "Email Address", + "operation.copy.link": "Link", + "operation.copy_which": "Copy {{which}}", + "operation.copy_which_success": "{{which}} Copied to Clipboard", "operation.delete_category": "Delete Category", "operation.edit": "Edit", "operation.error_since": "Error since", diff --git a/locales/mobile/default/es.json b/locales/mobile/default/es.json index 01ed8f6aa..f728bd3fd 100644 --- a/locales/mobile/default/es.json +++ b/locales/mobile/default/es.json @@ -1,6 +1,5 @@ { "operation.change_to_other_view": "Cambiar a otra vista", - "operation.copy_link": "Copiar enlace", "operation.delete_category": "Eliminar categoría", "operation.edit": "Editar", "operation.mark_all_as_read": "Marcar todo como leído", diff --git a/locales/mobile/default/fi.json b/locales/mobile/default/fi.json index 7cfa38ea9..4d9e216fa 100644 --- a/locales/mobile/default/fi.json +++ b/locales/mobile/default/fi.json @@ -1,6 +1,5 @@ { "operation.change_to_other_view": "Vaihda toiseen näkymään", - "operation.copy_link": "Kopioi linkki", "operation.delete_category": "Poista kategoria", "operation.edit": "Muokkaa", "operation.error_since": "Virhe alkaen", diff --git a/locales/mobile/default/fr.json b/locales/mobile/default/fr.json index 095679304..3fd289e1b 100644 --- a/locales/mobile/default/fr.json +++ b/locales/mobile/default/fr.json @@ -1,6 +1,5 @@ { "operation.change_to_other_view": "Changer pour une autre vue", - "operation.copy_link": "Copier le lien", "operation.delete_category": "Supprimer la catégorie", "operation.edit": "Éditer", "operation.error_since": "Erreur depuis", diff --git a/locales/mobile/default/it.json b/locales/mobile/default/it.json index 85aeb42cb..418d08360 100644 --- a/locales/mobile/default/it.json +++ b/locales/mobile/default/it.json @@ -1,6 +1,5 @@ { "operation.change_to_other_view": "Cambia ad altra visualizzazione", - "operation.copy_link": "Copia link", "operation.delete_category": "Elimina categoria", "operation.edit": "Modifica", "operation.error_since": "Errore da", diff --git a/locales/mobile/default/ja.json b/locales/mobile/default/ja.json index bb278e45d..0acf7fd2b 100644 --- a/locales/mobile/default/ja.json +++ b/locales/mobile/default/ja.json @@ -23,7 +23,6 @@ "onboarding.welcome_title": "Foloへようこそ!", "operation.add_feeds_to_category": "カテゴリーに移動", "operation.change_to_other_view": "他のビューに切り替え", - "operation.copy_link": "リンクをコピー", "operation.delete_category": "カテゴリーを削除", "operation.edit": "編集", "operation.error_since": "エラー発生時刻", diff --git a/locales/mobile/default/ko.json b/locales/mobile/default/ko.json index dccc8238b..2cf230761 100644 --- a/locales/mobile/default/ko.json +++ b/locales/mobile/default/ko.json @@ -1,7 +1,6 @@ { "operation.add_feeds_to_category": "카테고리로 이동", "operation.change_to_other_view": "다른 보기로 변경", - "operation.copy_link": "링크 복사", "operation.delete_category": "카테고리 삭제", "operation.edit": "편집", "operation.error_since": "오류 발생:", diff --git a/locales/mobile/default/pt.json b/locales/mobile/default/pt.json index a5874b4a3..57637a8b6 100644 --- a/locales/mobile/default/pt.json +++ b/locales/mobile/default/pt.json @@ -1,6 +1,5 @@ { "operation.change_to_other_view": "他のビューに切り替え", - "operation.copy_link": "リンクをコピー", "operation.delete_category": "カテゴリーを削除", "operation.edit": "編集", "operation.error_since": "エラー発生時刻", diff --git a/locales/mobile/default/ru.json b/locales/mobile/default/ru.json index 3d66842bf..b4401d22f 100644 --- a/locales/mobile/default/ru.json +++ b/locales/mobile/default/ru.json @@ -1,7 +1,6 @@ { "operation.add_feeds_to_category": "Переместить в категорию", "operation.change_to_other_view": "Изменить на другой вид", - "operation.copy_link": "Копировать ссылку", "operation.delete_category": "Удалить категорию", "operation.edit": "Редактировать", "operation.error_since": "Ошибка с", diff --git a/locales/mobile/default/tr.json b/locales/mobile/default/tr.json index 8eafe4e69..93e0b3e2c 100644 --- a/locales/mobile/default/tr.json +++ b/locales/mobile/default/tr.json @@ -1,6 +1,5 @@ { "operation.change_to_other_view": "Diğer görünüme geç", - "operation.copy_link": "Bağlantıyı kopyala", "operation.delete_category": "Kategoriyi sil", "operation.edit": "Düzenle", "operation.error_since": "Hata başlangıcı", diff --git a/locales/mobile/default/zh-CN.json b/locales/mobile/default/zh-CN.json index f43346c3b..4ff483e60 100644 --- a/locales/mobile/default/zh-CN.json +++ b/locales/mobile/default/zh-CN.json @@ -23,7 +23,6 @@ "onboarding.welcome_title": "欢迎使用 Folo!", "operation.add_feeds_to_category": "移动至分类", "operation.change_to_other_view": "更改为其他视图", - "operation.copy_link": "复制链接", "operation.delete_category": "删除分类", "operation.edit": "编辑", "operation.error_since": "源失效:", diff --git a/locales/mobile/default/zh-HK.json b/locales/mobile/default/zh-HK.json index 3b4fe1ce7..5c6b244de 100644 --- a/locales/mobile/default/zh-HK.json +++ b/locales/mobile/default/zh-HK.json @@ -23,7 +23,6 @@ "onboarding.welcome_title": "歡迎使用 Folo!", "operation.add_feeds_to_category": "移至分類", "operation.change_to_other_view": "切換到其他視圖", - "operation.copy_link": "複製連結", "operation.delete_category": "刪除分類", "operation.edit": "編輯", "operation.error_since": "錯誤始於", diff --git a/locales/mobile/default/zh-TW.json b/locales/mobile/default/zh-TW.json index 4ff5a65de..61e7c1d00 100644 --- a/locales/mobile/default/zh-TW.json +++ b/locales/mobile/default/zh-TW.json @@ -23,7 +23,6 @@ "onboarding.welcome_title": "歡迎使用 Folo!", "operation.add_feeds_to_category": "新增 RSS 摘要到類別", "operation.change_to_other_view": "切換到其他視圖", - "operation.copy_link": "複製連結", "operation.delete_category": "刪除類別", "operation.edit": "編輯", "operation.error_since": "RSS 摘要失效:",