Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: v4 web app warning #6038

Merged
merged 2 commits into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions packages/components/src/locale/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -3001,5 +3001,6 @@
"wallet__hardware_wallet": "محفظة الأجهزة",
"wallet__imported_accounts": "حسابات سلسلة واحدة",
"wallet__wallet": "محفظة",
"wallet__watched_accounts": "حسابات مراقب"
}
"wallet__watched_accounts": "حسابات مراقب",
"v4_to_v5_banner_text": "أنت حاليًا على OneKey v4، الذي لم يعد مدعومًا. انتقل إلى <tag>OneKey v5</tag> للاستمتاع بالميزات والتحسينات الجديدة!"
}
5 changes: 3 additions & 2 deletions packages/components/src/locale/bn.json
Original file line number Diff line number Diff line change
Expand Up @@ -3001,5 +3001,6 @@
"wallet__hardware_wallet": "হার্ডওয়্যার ওয়ালেট",
"wallet__imported_accounts": "একক-চেইন অ্যাকাউন্ট",
"wallet__wallet": "ওয়ালেট",
"wallet__watched_accounts": "অ্যাকাউন্ট দেখা"
}
"wallet__watched_accounts": "অ্যাকাউন্ট দেখা",
"v4_to_v5_banner_text": "আপনি বর্তমানে OneKey v4 ব্যবহার করছেন, যা আর সমর্থিত নয়। নতুন বৈশিষ্ট্য এবং উন্নতিগুলি উপভোগ করতে <tag>OneKey v5</tag> এ স্যুইচ করুন!"
}
5 changes: 3 additions & 2 deletions packages/components/src/locale/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -3001,5 +3001,6 @@
"wallet__hardware_wallet": "Hardware-Geldbörse",
"wallet__imported_accounts": "Single-Chain-Konten",
"wallet__wallet": "Brieftasche",
"wallet__watched_accounts": "Beobachtete Konten"
}
"wallet__watched_accounts": "Beobachtete Konten",
"v4_to_v5_banner_text": "Sie verwenden derzeit OneKey v4, das nicht mehr unterstützt wird. Wechseln Sie zu <tag>OneKey v5</tag>, um neue Funktionen und Verbesserungen zu genießen!"
}
5 changes: 3 additions & 2 deletions packages/components/src/locale/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -3001,5 +3001,6 @@
"wallet__hardware_wallet": "Hardware Wallet",
"wallet__imported_accounts": "Single-chain Accounts",
"wallet__wallet": "Wallet",
"wallet__watched_accounts": "Watch-only Accounts"
}
"wallet__watched_accounts": "Watch-only Accounts",
"v4_to_v5_banner_text": "You’re currently on OneKey v4, which is no longer supported. Switch to <tag>OneKey v5</tag> to enjoy new features and improvements!"
}
5 changes: 3 additions & 2 deletions packages/components/src/locale/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -3001,5 +3001,6 @@
"wallet__hardware_wallet": "Billetera física",
"wallet__imported_accounts": "Cuentas de cadena única",
"wallet__wallet": "Billetera",
"wallet__watched_accounts": "Cuentas vigiladas"
}
"wallet__watched_accounts": "Cuentas vigiladas",
"v4_to_v5_banner_text": "Actualmente estás en OneKey v4, que ya no está soportado. Cambia a <tag>OneKey v5</tag> para disfrutar de nuevas funciones y mejoras."
}
5 changes: 3 additions & 2 deletions packages/components/src/locale/fil.json
Original file line number Diff line number Diff line change
Expand Up @@ -3001,5 +3001,6 @@
"wallet__hardware_wallet": "Hardware Wallet",
"wallet__imported_accounts": "Mga Single-chain na Account",
"wallet__wallet": "wallet",
"wallet__watched_accounts": "Mga Napanood na Account"
}
"wallet__watched_accounts": "Mga Napanood na Account",
"v4_to_v5_banner_text": "Kasalukuyan kang gumagamit ng OneKey v4, na hindi na sinusuportahan. Lumipat sa <tag>OneKey v5</tag> upang ma-enjoy ang mga bagong tampok at pagpapabuti!"
}
5 changes: 3 additions & 2 deletions packages/components/src/locale/fr_FR.json
Original file line number Diff line number Diff line change
Expand Up @@ -3001,5 +3001,6 @@
"wallet__hardware_wallet": "Portefeuille matériel",
"wallet__imported_accounts": "Comptes à chaîne unique",
"wallet__wallet": "Portefeuille",
"wallet__watched_accounts": "Comptes surveillés"
}
"wallet__watched_accounts": "Comptes surveillés",
"v4_to_v5_banner_text": "Vous utilisez actuellement OneKey v4, qui n'est plus pris en charge. Passez à <tag>OneKey v5</tag> pour profiter de nouvelles fonctionnalités et améliorations !"
}
5 changes: 3 additions & 2 deletions packages/components/src/locale/hi_IN.json
Original file line number Diff line number Diff line change
Expand Up @@ -3001,5 +3001,6 @@
"wallet__hardware_wallet": "हार्डवेयर वॉलेट",
"wallet__imported_accounts": "एकल-श्रृंखला खाते",
"wallet__wallet": "बटुआ",
"wallet__watched_accounts": "देखे गए खाते"
}
"wallet__watched_accounts": "देखे गए खाते",
"v4_to_v5_banner_text": "आप वर्तमान में OneKey v4 पर हैं, जो अब समर्थित नहीं है। नए फीचर्स और सुधारों का आनंद लेने के लिए <tag>OneKey v5</tag> पर स्विच करें!"
}
5 changes: 3 additions & 2 deletions packages/components/src/locale/id.json
Original file line number Diff line number Diff line change
Expand Up @@ -3001,5 +3001,6 @@
"wallet__hardware_wallet": "Dompet Perangkat Keras",
"wallet__imported_accounts": "Akun rantai tunggal",
"wallet__wallet": "Dompet",
"wallet__watched_accounts": "Akun khusus tontonan"
}
"wallet__watched_accounts": "Akun khusus tontonan",
"v4_to_v5_banner_text": "Anda saat ini menggunakan OneKey v4, yang tidak lagi didukung. Beralihlah ke <tag>OneKey v5</tag> untuk menikmati fitur dan peningkatan baru!"
}
5 changes: 3 additions & 2 deletions packages/components/src/locale/it_IT.json
Original file line number Diff line number Diff line change
Expand Up @@ -3001,5 +3001,6 @@
"wallet__hardware_wallet": "Portafoglio hardware",
"wallet__imported_accounts": "Conti a catena singola",
"wallet__wallet": "Portafoglio",
"wallet__watched_accounts": "Conti guardati"
}
"wallet__watched_accounts": "Conti guardati",
"v4_to_v5_banner_text": "Attualmente stai utilizzando OneKey v4, che non è più supportato. Passa a <tag>OneKey v5</tag> per usufruire di nuove funzionalità e miglioramenti!"
}
5 changes: 3 additions & 2 deletions packages/components/src/locale/ja_JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -3001,5 +3001,6 @@
"wallet__hardware_wallet": "ハードウェアウォレット",
"wallet__imported_accounts": "シングルチェーンアカウント",
"wallet__wallet": "ウォレット",
"wallet__watched_accounts": "閲覧用アカウント"
}
"wallet__watched_accounts": "閲覧用アカウント",
"v4_to_v5_banner_text": "現在、サポートが終了したOneKey v4を使用しています。新機能と改善を楽しむために、<tag>OneKey v5</tag>に切り替えてください!"
}
5 changes: 3 additions & 2 deletions packages/components/src/locale/ko_KR.json
Original file line number Diff line number Diff line change
Expand Up @@ -3001,5 +3001,6 @@
"wallet__hardware_wallet": "하드웨어 지갑",
"wallet__imported_accounts": "단일 체인 계정",
"wallet__wallet": "지갑",
"wallet__watched_accounts": "시청 계정"
}
"wallet__watched_accounts": "시청 계정",
"v4_to_v5_banner_text": "현재 사용 중인 OneKey v4는 더 이상 지원되지 않습니다. 새로운 기능과 개선 사항을 즐기려면 <tag>OneKey v5</tag>로 전환하세요!"
}
5 changes: 3 additions & 2 deletions packages/components/src/locale/mn_MN.json
Original file line number Diff line number Diff line change
Expand Up @@ -3001,5 +3001,6 @@
"wallet__hardware_wallet": "Техник хангамжийн түрийвч",
"wallet__imported_accounts": "Нэг хэлхээтэй дансууд",
"wallet__wallet": "Түрийвч",
"wallet__watched_accounts": "Үзсэн бүртгэлүүд"
}
"wallet__watched_accounts": "Үзсэн бүртгэлүүд",
"v4_to_v5_banner_text": "Та одоогоор дэмжлэггүй болсон OneKey v4 дээр байна. Шинэ боломжууд болон сайжруулалтуудыг ашиглахын тулд <tag>OneKey v5</tag> руу шилжээрэй!"
}
5 changes: 3 additions & 2 deletions packages/components/src/locale/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -3001,5 +3001,6 @@
"wallet__hardware_wallet": "Carteira de Hardware",
"wallet__imported_accounts": "Contas de cadeia única",
"wallet__wallet": "Carteira",
"wallet__watched_accounts": "Contas monitoradas"
}
"wallet__watched_accounts": "Contas monitoradas",
"v4_to_v5_banner_text": "Você está atualmente no OneKey v4, que não é mais suportado. Mude para <tag>OneKey v5</tag> para aproveitar novos recursos e melhorias!"
}
5 changes: 3 additions & 2 deletions packages/components/src/locale/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -3001,5 +3001,6 @@
"wallet__hardware_wallet": "Аппаратный кошелек",
"wallet__imported_accounts": "Счета с одной цепью",
"wallet__wallet": "Бумажник",
"wallet__watched_accounts": "Просмотренные аккаунты"
}
"wallet__watched_accounts": "Просмотренные аккаунты",
"v4_to_v5_banner_text": "Вы используете OneKey v4, который больше не поддерживается. Переключитесь на <tag>OneKey v5</tag>, чтобы воспользоваться новыми функциями и улучшениями!"
}
5 changes: 3 additions & 2 deletions packages/components/src/locale/th_TH.json
Original file line number Diff line number Diff line change
Expand Up @@ -3001,5 +3001,6 @@
"wallet__hardware_wallet": "กระเป๋าเงินฮาร์ดแวร์",
"wallet__imported_accounts": "บัญชีโซ่เดียว",
"wallet__wallet": "กระเป๋าสตางค์",
"wallet__watched_accounts": "ดูบัญชี"
}
"wallet__watched_accounts": "ดูบัญชี",
"v4_to_v5_banner_text": "คุณกำลังใช้ OneKey v4 ซึ่งไม่ได้รับการสนับสนุนอีกต่อไป เปลี่ยนไปใช้ <tag>OneKey v5</tag> เพื่อเพลิดเพลินกับฟีเจอร์ใหม่และการปรับปรุง!"
}
5 changes: 3 additions & 2 deletions packages/components/src/locale/uk_UA.json
Original file line number Diff line number Diff line change
Expand Up @@ -3001,5 +3001,6 @@
"wallet__hardware_wallet": "Апаратний гаманець",
"wallet__imported_accounts": "Одноланцюгові облікові записи",
"wallet__wallet": "гаманець",
"wallet__watched_accounts": "Переглянуті акаунти"
}
"wallet__watched_accounts": "Переглянуті акаунти",
"v4_to_v5_banner_text": "Ви зараз використовуєте OneKey v4, яка більше не підтримується. Перейдіть на <tag>OneKey v5</tag>, щоб насолоджуватися новими функціями та покращеннями!"
}
5 changes: 3 additions & 2 deletions packages/components/src/locale/vi.json
Original file line number Diff line number Diff line change
Expand Up @@ -3001,5 +3001,6 @@
"wallet__hardware_wallet": "Ví phần cứng",
"wallet__imported_accounts": "Tài khoản chuỗi đơn",
"wallet__wallet": "Cái ví",
"wallet__watched_accounts": "Tài khoản đã theo dõi"
}
"wallet__watched_accounts": "Tài khoản đã theo dõi",
"v4_to_v5_banner_text": "Bạn hiện đang sử dụng OneKey v4, phiên bản này không còn được hỗ trợ. Hãy chuyển sang <tag>OneKey v5</tag> để tận hưởng các tính năng và cải tiến mới!"
}
5 changes: 3 additions & 2 deletions packages/components/src/locale/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -3001,5 +3001,6 @@
"wallet__hardware_wallet": "硬件钱包",
"wallet__imported_accounts": "单链账户",
"wallet__wallet": "钱包",
"wallet__watched_accounts": "观察账户"
}
"wallet__watched_accounts": "观察账户",
"v4_to_v5_banner_text": "当前版本为 OneKey v4,此版本已不再维护。立即前往 <tag>OneKey v5</tag>,体验更安全、更丰富的功能!"
}
5 changes: 3 additions & 2 deletions packages/components/src/locale/zh_HK.json
Original file line number Diff line number Diff line change
Expand Up @@ -3001,5 +3001,6 @@
"wallet__hardware_wallet": "硬件錢包",
"wallet__imported_accounts": "單鏈賬戶",
"wallet__wallet": "錢包",
"wallet__watched_accounts": "觀察賬戶"
}
"wallet__watched_accounts": "觀察賬戶",
"v4_to_v5_banner_text": "目前版本為 OneKey v4,此版本已不再維護。立即前往 <tag>OneKey v5</tag>,體驗更安全、更豐富的功能!"
}
64 changes: 62 additions & 2 deletions packages/kit/src/views/Wallet/index.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
import type { FC } from 'react';
import { memo, useCallback, useMemo, useRef } from 'react';
import { memo, useCallback, useMemo, useRef, useState } from 'react';

import { useIntl } from 'react-intl';

import type { ForwardRefHandle } from '@onekeyhq/app/src/views/NestedTabView/NestedTabView';
import { Box, useIsVerticalLayout, useUserDevice } from '@onekeyhq/components';
import {
Box,
Button,
Text,
useIsVerticalLayout,
useUserDevice,
} from '@onekeyhq/components';
import { Tabs } from '@onekeyhq/components/src/CollapsibleTabView';
import Link from '@onekeyhq/components/src/Link';
import { isAllNetworks } from '@onekeyhq/engine/src/managers/network';
import { useActiveWalletAccount } from '@onekeyhq/kit/src/hooks';
import { MAX_PAGE_CONTAINER_WIDTH } from '@onekeyhq/shared/src/config/appConfig';
Expand Down Expand Up @@ -289,10 +296,63 @@ function WalletPreCheck() {
}
const WalletPreCheckMemo = memo(WalletPreCheck);

const storageKey = '$onekey-webapp-v4-warning-closed-time';
function V4Warning() {
const intl = useIntl();
const closedTime = localStorage.getItem(storageKey);
const [show, setShow] = useState(
// 检查是否显示警告:
// 如果没有关闭时间记录,或者上次关闭时间距今超过24小时,则显示警告
!closedTime || Date.now() - Number(closedTime) > 1000 * 60 * 60 * 24,
);
const renderLink = useCallback(
(chunks: string) => (
<Link href="https://1key.so/" color="text-highlight" fontWeight="bold">
{chunks}
</Link>
),
[],
);
if (!show) {
return null;
}
return (
<Box
backgroundColor="surface-highlight-default"
display="flex"
flexDirection="row"
justifyContent="space-between"
alignItems="center"
px={8}
py={2}
>
<Text color="text-highlight">
{intl.formatMessage(
{ id: 'v4_to_v5_banner_text' },
{
tag: renderLink,
},
)}
</Text>
<Button
type="plain"
size="sm"
onPress={() => {
setShow(false);
localStorage.setItem(storageKey, Date.now().toString());
}}
>
{intl.formatMessage({ id: 'action__close' })}
</Button>
</Box>
);
}

const Wallet = () => (
<>
<WalletPreCheckMemo />
<Box flex={1}>
{platformEnv.isWeb ? <V4Warning /> : null}
<IdentityAssertion>
<WalletTabsMemo />
</IdentityAssertion>
Expand Down
Loading