-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds disclaimers for dapps, swap and exchanges
- Loading branch information
Showing
72 changed files
with
822 additions
and
90 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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
16 changes: 0 additions & 16 deletions
16
...res/Exchange/useCases/CreateExchangeOrderScreen/ShowDisclaimer/ShowDisclaimer.stories.tsx
This file was deleted.
Oops, something went wrong.
67 changes: 0 additions & 67 deletions
67
...rc/features/Exchange/useCases/CreateExchangeOrderScreen/ShowDisclaimer/ShowDisclaimer.tsx
This file was deleted.
Oops, something went wrong.
125 changes: 125 additions & 0 deletions
125
apps/wallet-mobile/src/features/Legal/Disclaimer/ShowDisclaimer.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,125 @@ | ||
import {useNavigation} from '@react-navigation/native' | ||
import {useTheme} from '@yoroi/theme' | ||
import React from 'react' | ||
import {useIntl} from 'react-intl' | ||
import {StyleSheet, View} from 'react-native' | ||
import Markdown from 'react-native-markdown-display' | ||
|
||
import {Button, ButtonType} from '../../../components/Button/Button' | ||
import {Checkbox} from '../../../components/Checkbox/Checkbox' | ||
import {useModal} from '../../../components/Modal/ModalContext' | ||
import globalMessages, {actionMessages, confirmationMessages} from '../../../kernel/i18n/global-messages' | ||
import {useLanguage} from '../../../kernel/i18n/LanguageProvider' | ||
import {useWalletNavigation} from '../../../kernel/navigation' | ||
import {loadText} from './loadText' | ||
import {Disclaimer} from './types' | ||
import {useDisclaimerState} from './useDisclaimerState' | ||
|
||
type Props = { | ||
type: Disclaimer | ||
disabled?: boolean | ||
} | ||
|
||
export const ShowDisclaimer = ({type, disabled}: Props) => { | ||
const {languageCode} = useLanguage() | ||
const {openModal, closeModal} = useModal() | ||
const styles = useStyles() | ||
const strings = useStrings() | ||
const {resetToTxHistory} = useWalletNavigation() | ||
const navigation = useNavigation() | ||
const [showed, setShowed] = React.useState(false) | ||
const [accepted, setAccepted] = useDisclaimerState(type) | ||
|
||
React.useEffect(() => { | ||
if (!disabled && !accepted && showed === false) { | ||
openModal({ | ||
title: strings.disclaimer, | ||
content: ( | ||
<View style={styles.container}> | ||
{/* @ts-expect-error old react */} | ||
<Markdown style={styles}>{loadText(type, languageCode)}</Markdown> | ||
|
||
<Check text={strings.accept} /> | ||
</View> | ||
), | ||
footer: ( | ||
<View style={styles.actions}> | ||
<Button type={ButtonType.Secondary} title={strings.cancel} onPress={resetToTxHistory} /> | ||
|
||
<Proceed | ||
title={strings.proceed} | ||
onPress={() => { | ||
setAccepted(true) | ||
closeModal() | ||
}} | ||
/> | ||
</View> | ||
), | ||
height: 700, | ||
canDiscard: false, | ||
}) | ||
setShowed(true) | ||
} | ||
}, [ | ||
accepted, | ||
closeModal, | ||
disabled, | ||
languageCode, | ||
navigation, | ||
openModal, | ||
resetToTxHistory, | ||
setAccepted, | ||
showed, | ||
strings.accept, | ||
strings.cancel, | ||
strings.disclaimer, | ||
strings.proceed, | ||
styles, | ||
type, | ||
]) | ||
return null | ||
} | ||
|
||
const Check = ({text}: {text: string}) => { | ||
const {canContinue = false, setCanContinue} = useModal() | ||
return <Checkbox text={text} checked={canContinue} onChange={() => setCanContinue(!canContinue)} /> | ||
} | ||
|
||
const Proceed = ({title, onPress}: {title: string; onPress: () => void}) => { | ||
const {canContinue = false} = useModal() | ||
|
||
return <Button title={title} onPress={onPress} disabled={!canContinue} /> | ||
} | ||
|
||
const useStyles = () => { | ||
const {atoms, color} = useTheme() | ||
const styles = StyleSheet.create({ | ||
container: { | ||
...atoms.px_lg, | ||
...atoms.pb_lg, | ||
}, | ||
// eslint-disable-next-line react-native/no-unused-styles | ||
body: { | ||
...atoms.body_1_lg_regular, | ||
...atoms.py_sm, | ||
color: color.gray_max, | ||
}, | ||
actions: { | ||
...atoms.flex, | ||
...atoms.flex_row, | ||
...atoms.gap_lg, | ||
}, | ||
}) | ||
|
||
return styles | ||
} | ||
const useStrings = () => { | ||
const intl = useIntl() | ||
|
||
return { | ||
disclaimer: intl.formatMessage(globalMessages.disclaimer), | ||
cancel: intl.formatMessage(globalMessages.cancel), | ||
proceed: intl.formatMessage(actionMessages.proceed), | ||
accept: intl.formatMessage(confirmationMessages.commonButtons.iUnderstandButton), | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
apps/wallet-mobile/src/features/Legal/Disclaimer/dapp/bn-BD.md
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,8 @@ | ||
By clicking "Proceed," you acknowledge that you will be dealing with the third-party decentralized applications (DApps) offering multiple services. You may be required to agree to the terms, conditions, and privacy policies of DApps to deal with them. Yoroi Wallet does not control, endorse, or assume responsibility for the content, security, policies, or services provided by DApps. | ||
|
||
**Please note:** | ||
|
||
1. Yoroi Wallet is not liable for any losses, delays, or errors that may occur while using the third-party service. | ||
2. Transactions may be subject to restrictions based on your geographic location, applicable laws, financial institution policies, or the service provider's limitations. | ||
3. Ensure you review and understand the third party's terms, as your interactions are solely governed by their agreements. | ||
4. Yoroi Wallet does not collect or store any personal or financial data submitted through the third-party platform. |
8 changes: 8 additions & 0 deletions
8
apps/wallet-mobile/src/features/Legal/Disclaimer/dapp/cs-CZ.md
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,8 @@ | ||
By clicking "Proceed," you acknowledge that you will be dealing with the third-party decentralized applications (DApps) offering multiple services. You may be required to agree to the terms, conditions, and privacy policies of DApps to deal with them. Yoroi Wallet does not control, endorse, or assume responsibility for the content, security, policies, or services provided by DApps. | ||
|
||
**Please note:** | ||
|
||
1. Yoroi Wallet is not liable for any losses, delays, or errors that may occur while using the third-party service. | ||
2. Transactions may be subject to restrictions based on your geographic location, applicable laws, financial institution policies, or the service provider's limitations. | ||
3. Ensure you review and understand the third party's terms, as your interactions are solely governed by their agreements. | ||
4. Yoroi Wallet does not collect or store any personal or financial data submitted through the third-party platform. |
8 changes: 8 additions & 0 deletions
8
apps/wallet-mobile/src/features/Legal/Disclaimer/dapp/de-DE.md
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,8 @@ | ||
By clicking "Proceed," you acknowledge that you will be dealing with the third-party decentralized applications (DApps) offering multiple services. You may be required to agree to the terms, conditions, and privacy policies of DApps to deal with them. Yoroi Wallet does not control, endorse, or assume responsibility for the content, security, policies, or services provided by DApps. | ||
|
||
**Please note:** | ||
|
||
1. Yoroi Wallet is not liable for any losses, delays, or errors that may occur while using the third-party service. | ||
2. Transactions may be subject to restrictions based on your geographic location, applicable laws, financial institution policies, or the service provider's limitations. | ||
3. Ensure you review and understand the third party's terms, as your interactions are solely governed by their agreements. | ||
4. Yoroi Wallet does not collect or store any personal or financial data submitted through the third-party platform. |
8 changes: 8 additions & 0 deletions
8
apps/wallet-mobile/src/features/Legal/Disclaimer/dapp/el-GR.md
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,8 @@ | ||
By clicking "Proceed," you acknowledge that you will be dealing with the third-party decentralized applications (DApps) offering multiple services. You may be required to agree to the terms, conditions, and privacy policies of DApps to deal with them. Yoroi Wallet does not control, endorse, or assume responsibility for the content, security, policies, or services provided by DApps. | ||
|
||
**Please note:** | ||
|
||
1. Yoroi Wallet is not liable for any losses, delays, or errors that may occur while using the third-party service. | ||
2. Transactions may be subject to restrictions based on your geographic location, applicable laws, financial institution policies, or the service provider's limitations. | ||
3. Ensure you review and understand the third party's terms, as your interactions are solely governed by their agreements. | ||
4. Yoroi Wallet does not collect or store any personal or financial data submitted through the third-party platform. |
Oops, something went wrong.