-
Notifications
You must be signed in to change notification settings - Fork 315
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FAT-128 FAT-120 FAT-121 Prompt language change after live language ch…
…ange (#1531)
- Loading branch information
1 parent
5098746
commit 52ecc41
Showing
165 changed files
with
1,326 additions
and
359 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"ledger-live-desktop": minor | ||
--- | ||
|
||
Adds prompts suggesting the user to update their device language according to a few set of conditions |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
import { getEnv } from "@ledgerhq/live-common/env"; | ||
import { Language } from "@ledgerhq/types-live"; | ||
|
||
export type Locale = | ||
| "de" | ||
| "el" | ||
| "en" | ||
| "es" | ||
| "fi" | ||
| "fr" | ||
| "hu" | ||
| "it" | ||
| "ja" | ||
| "ko" | ||
| "nl" | ||
| "no" | ||
| "pl" | ||
| "pt" | ||
| "ru" | ||
| "sr" | ||
| "sv" | ||
| "tr" | ||
| "zh"; | ||
|
||
/** | ||
* This maps the supported locales from live to theiur equivalent languages on the device. | ||
* It is to be used for suggesting the user to change their device language according to their Live | ||
* language. | ||
*/ | ||
export const localeIdToDeviceLanguage: { [key in Locale]?: Language } = { | ||
en: "english", | ||
fr: "french", | ||
es: "spanish", | ||
}; | ||
|
||
export const allLanguages: Locale[] = [ | ||
"de", | ||
"el", | ||
"en", | ||
"es", | ||
"fi", | ||
"fr", | ||
"hu", | ||
"it", | ||
"ja", | ||
"ko", | ||
"nl", | ||
"no", | ||
"pl", | ||
"pt", | ||
"ru", | ||
"sr", | ||
"sv", | ||
"tr", | ||
"zh", | ||
]; | ||
|
||
export const prodStableLanguages: Locale[] = ["en", "fr", "es", "ru", "zh", "de", "tr", "ja", "ko"]; | ||
|
||
/** | ||
* List of languages that should be prompted to existing users once if they are | ||
* using LL in english. | ||
* */ | ||
export const pushedLanguages: Locale[] = ["fr", "es", "ru", "zh", "de", "tr", "ja", "ko", "pt"]; | ||
|
||
export const getLanguages = () => | ||
getEnv("EXPERIMENTAL_LANGUAGES") ? allLanguages : prodStableLanguages; | ||
|
||
export const defaultLocaleForLanguage = { | ||
de: "de-DE", | ||
el: "el-GR", | ||
en: "en-US", | ||
es: "es-ES", | ||
fi: "fi-FI", | ||
fr: "fr-FR", | ||
hu: "hu-HU", | ||
it: "it-IT", | ||
ja: "ja-JP", | ||
ko: "ko-KR", | ||
nl: "nl-NL", | ||
no: "no-NO", | ||
pl: "pl-PL", | ||
pt: "pt-PT", | ||
ru: "ru-RU", | ||
sr: "sr-SR", | ||
sv: "sv-SV", | ||
tr: "tr-TR", | ||
zh: "zh-CN", | ||
}; |
13 changes: 13 additions & 0 deletions
13
apps/ledger-live-desktop/src/internal/commands/getDeviceInfo.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { from, Observable } from "rxjs"; | ||
import { withDevice } from "@ledgerhq/live-common/hw/deviceAccess"; | ||
import { DeviceInfo } from "@ledgerhq/types-live"; | ||
import getDeviceInfo from "@ledgerhq/live-common/hw/getDeviceInfo"; | ||
|
||
type Input = { | ||
deviceId: string; | ||
}; | ||
|
||
const cmd = ({ deviceId }: Input): Observable<DeviceInfo> => | ||
withDevice(deviceId)(transport => from(getDeviceInfo(transport))); | ||
|
||
export default cmd; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
apps/ledger-live-desktop/src/renderer/components/ChangeDeviceLanguageAction.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import React from "react"; | ||
|
||
import { command } from "~/renderer/commands"; | ||
import { createAction } from "@ledgerhq/live-common/hw/actions/installLanguage"; | ||
import { getEnv } from "@ledgerhq/live-common/env"; | ||
import { mockedEventEmitter } from "~/renderer/components/debug/DebugMock"; | ||
import DeviceAction from "./DeviceAction"; | ||
import { Language } from "@ledgerhq/types-live"; | ||
import { useTranslation } from "react-i18next"; | ||
import { BoxedIcon, Flex, Icons, Text } from "@ledgerhq/react-ui"; | ||
import { withV3StyleProvider } from "~/renderer/styles/StyleProviderV3"; | ||
|
||
const installLanguageExec = command("installLanguage"); | ||
const action = createAction(getEnv("MOCK") ? mockedEventEmitter : installLanguageExec); | ||
|
||
const DeviceLanguageInstalled = ({ language }: { language: Language }) => { | ||
const { t } = useTranslation(); | ||
|
||
return ( | ||
<Flex | ||
flex={1} | ||
flexDirection="column" | ||
alignItems="center" | ||
justifyContent="center" | ||
data-test-id="language-installed" | ||
> | ||
<BoxedIcon Icon={Icons.CheckAloneMedium} iconColor="success.c100" size={64} iconSize={24} /> | ||
<Text variant="large" alignSelf="stretch" mx={16} mt={10} textAlign="center" fontSize={24}> | ||
{t("deviceLocalization.languageInstalled", { | ||
language: t(`deviceLocalization.languages.${language}`), | ||
})} | ||
</Text> | ||
</Flex> | ||
); | ||
}; | ||
|
||
type Props = { | ||
language: Language; | ||
onResult?: () => void; | ||
onError?: (error: Error) => void; | ||
onSuccess: () => void; | ||
}; | ||
|
||
const ChangeDeviceLanguageAction: React.FC<Props> = ({ language, onError, onSuccess }) => { | ||
return ( | ||
<DeviceAction | ||
action={action} | ||
request={language} | ||
onResult={onSuccess} | ||
Result={() => <DeviceLanguageInstalled language={language} />} | ||
onError={onError} | ||
/> | ||
); | ||
}; | ||
|
||
export default withV3StyleProvider(ChangeDeviceLanguageAction); |
48 changes: 48 additions & 0 deletions
48
apps/ledger-live-desktop/src/renderer/components/ChangeDeviceLanguagePrompt.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import React from "react"; | ||
import { withV3StyleProvider } from "../styles/StyleProviderV3"; | ||
import { Flex, Text, Button, Divider } from "@ledgerhq/react-ui"; | ||
|
||
import { useTranslation } from "react-i18next"; | ||
import { DeviceModelId } from "@ledgerhq/devices"; | ||
import DeviceIllustration from "./DeviceIllustration"; | ||
|
||
type Props = { | ||
onSkip: () => void; | ||
onConfirm: () => void; | ||
descriptionWording: string; | ||
titleWording: string; | ||
deviceModelId: DeviceModelId; | ||
}; | ||
|
||
const ChangeDeviceLanguagePrompt: React.FC<Props> = ({ | ||
onSkip, | ||
onConfirm, | ||
titleWording, | ||
descriptionWording, | ||
deviceModelId, | ||
}) => { | ||
const { t } = useTranslation(); | ||
|
||
return ( | ||
<Flex flexDirection="column" flex={1} alignSelf="stretch"> | ||
<Flex alignItems="center" justifyContent="center" flexDirection="column" flex={1} px={12}> | ||
<DeviceIllustration width={251} height={200} deviceId={deviceModelId} /> | ||
<Text variant="large" fontSize={20} mt={12}> | ||
{titleWording} | ||
</Text> | ||
<Text variant="body" textAlign="center" color="neutral.c80" mt={2}> | ||
{descriptionWording} | ||
</Text> | ||
</Flex> | ||
<Divider variant="light" /> | ||
<Flex alignSelf="flex-end" justifySelf="flex-end" columnGap={5} py={8} px={12}> | ||
<Button onClick={onSkip}>{t("common.cancel")}</Button> | ||
<Button data-test-id="install-language-button" variant="main" onClick={onConfirm}> | ||
{t("deviceLocalization.changeLanguage")} | ||
</Button> | ||
</Flex> | ||
</Flex> | ||
); | ||
}; | ||
|
||
export default withV3StyleProvider(ChangeDeviceLanguagePrompt); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
52ecc41
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⏲ 16min 31s ✅ 2 txs ❌ 4 txs ($46.67) for [Bot] Ethereum on Staging
❌ 4 mutation errors
Portfolio ($46.67) – Details of the 5 currencies
Performance ⏲ 16min 31s
Time spent for each spec: (total across mutations)
52ecc41
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⏲ 6min 31s ✅ 36 txs ❌ 2 txs ($100.67) for [Bot] Bitcoin on Staging
❌ 2 mutation errors
Portfolio ($100.67) – Details of the 17 currencies
Performance ⏲ 6min 31s
Time spent for each spec: (total across mutations)
52ecc41
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⏲ 64min 7s ✅ 109 txs ❌ 12 txs ($402.68) for [Bot] non-reg on develop with 'Phosphore'
❌ 12 mutation errors
Portfolio ($402.68) – Details of the 42 currencies
Performance ⏲ 64min 7s
Time spent for each spec: (total across mutations)