Skip to content

Commit

Permalink
Merge branch 'develop' into bump/rn73
Browse files Browse the repository at this point in the history
  • Loading branch information
jorbuedo committed May 30, 2024
2 parents 03a0e10 + e2439ad commit 1f0d042
Show file tree
Hide file tree
Showing 84 changed files with 981 additions and 688 deletions.
4 changes: 3 additions & 1 deletion apps/wallet-mobile/.env
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ COMMIT=093dec95a
BUILD_VARIANT=STAGING
SENTRY_DSN=https://[email protected]/4505319746764800

DISABLE_LOGBOX=true
DISABLE_LOGBOX=false

WALLET_1_MNEMONIC=abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon address
WALLET_1_NETWORK_ID=300
Expand All @@ -20,3 +20,5 @@ FRONTEND_FEE_ADDRESS_MAINNET=addr1q9ry6jfdgm0lcrtfpgwrgxg7qfahv80jlghhrthy6w8hmy
FRONTEND_FEE_ADDRESS_PREPROD=addr_test1qrgpjmyy8zk9nuza24a0f4e7mgp9gd6h3uayp0rqnjnkl54v4dlyj0kwfs0x4e38a7047lymzp37tx0y42glslcdtzhqzp57km

UNSTOPPABLE_API_KEY=czsajliz-wxgu6tujd1zqq7hey_pclfqhdjsqolsxjfsurgh

LOGGER_FILTER=
2 changes: 1 addition & 1 deletion apps/wallet-mobile/.storybook/storybook.requires.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions apps/wallet-mobile/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1560,7 +1560,7 @@ SPEC CHECKSUMS:
amplitude-react-native: 1ea3d5e1f80ccc357dd178c55c29e51c89f1cd11
boost: d3f49c53809116a5d38da093a8aa78bf551aed09
BVLinearGradient: e3aad03778a456d77928f594a649e96995f1c872
DoubleConversion: fea03f2699887d960129cc54bba7e52542b6f953
DoubleConversion: 5189b271737e1565bdce30deb4a08d647e3f5f54
EXApplication: d8f53a7eee90a870a75656280e8d4b85726ea903
EXBarCodeScanner: 8e23fae8d267dbef9f04817833a494200f1fce35
EXCamera: 0fbfa338a3776af2722d626a3437abe33f708aad
Expand All @@ -1577,7 +1577,7 @@ SPEC CHECKSUMS:
FBLazyVector: 12ea01e587c9594e7b144e1bfc86ac4d9ac28fde
FBReactNativeSpec: faca7d16c37626ca5780a87adef703817722fe61
fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9
glog: c5d68082e772fa1c511173d6b30a9de2c05a69a2
glog: 04b94705f318337d7ead9e6d17c019bd9b1f6b1b
hermes-engine: d7cc127932c89c53374452d6f93473f1970d8e88
libaom: 144606b1da4b5915a1054383c3a4459ccdb3c661
libavif: 84bbb62fb232c3018d6f1bab79beea87e35de7b7
Expand Down
2 changes: 1 addition & 1 deletion apps/wallet-mobile/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
"@types/pbkdf2": "^3.1.2",
"@yoroi/api": "1.5.1",
"@yoroi/common": "1.5.2",
"@yoroi/exchange": "2.0.1",
"@yoroi/exchange": "2.1.0",
"@yoroi/explorers": "1.0.0",
"@yoroi/links": "1.5.4",
"@yoroi/portfolio": "1.0.0",
Expand Down
10 changes: 7 additions & 3 deletions apps/wallet-mobile/src/YoroiApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {SelectedWalletProvider} from './features/WalletManager/context/SelectedW
import {SelectedWalletMetaProvider} from './features/WalletManager/context/SelectedWalletMetaContext'
import {WalletManagerProvider} from './features/WalletManager/context/WalletManagerContext'
import {InitApp} from './InitApp'
import {disableLogbox} from './kernel/env'
import {disableLogbox, loggerFilter} from './kernel/env'
import {LanguageProvider} from './kernel/i18n'
import {useSetupLogger} from './kernel/logger/hooks/useSetupLogger'
import {makeMetricsManager, MetricsProvider} from './kernel/metrics/metricsManager'
Expand All @@ -29,7 +29,11 @@ import {useThemeStorageMaker} from './yoroi-wallets/hooks'
enableScreens(true)
enableFreeze(true)

if (disableLogbox) LogBox.ignoreAllLogs()
if (disableLogbox) {
LogBox.ignoreAllLogs()
} else {
LogBox.ignoreLogs(['Require cycle:'])
}

const queryClient = new QueryClient()
const metricsManager = makeMetricsManager()
Expand Down Expand Up @@ -74,7 +78,7 @@ const Yoroi = () => {
}

export const YoroiApp = () => {
const isReady = useSetupLogger()
const isReady = useSetupLogger(loggerFilter)

if (!isReady) return null

Expand Down
6 changes: 3 additions & 3 deletions apps/wallet-mobile/src/components/AmountItem/AmountItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export type AmountItemProps = {
wallet: YoroiWallet
amount: Balance.Amount
style?: ViewProps['style']
isPrivacyOff?: boolean
isPrivacyActive?: boolean
status?: string
inWallet?: boolean
variant?: 'swap'
Expand All @@ -25,7 +25,7 @@ export type AmountItemProps = {
}

export const AmountItem = ({
isPrivacyOff,
isPrivacyActive,
wallet,
style,
amount,
Expand Down Expand Up @@ -84,7 +84,7 @@ export const AmountItem = ({
{priceImpactRisk === 'high' && <Icon.Warning size={24} color={priceImpactRiskTextColor} />}

<Text style={[styles.quantity, {color: priceImpactRiskTextColor}]}>
{isPrivacyOff ? '**.*******' : formattedQuantity}
{isPrivacyActive ? '**.*******' : formattedQuantity}
</Text>
</View>
)}
Expand Down
10 changes: 9 additions & 1 deletion apps/wallet-mobile/src/components/Button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export type ButtonProps = TouchableOpacityProps & {
textStyles?: TextStyle
isCopying?: boolean
copiedText?: string
testId?: string
}

export const Button = (props: ButtonProps) => {
Expand All @@ -38,13 +39,20 @@ export const Button = (props: ButtonProps) => {
textStyles,
isCopying,
copiedText,
testId,
...rest
} = props

const {styles} = useStyles()

return (
<TouchableOpacity onPress={onPress} style={[block && styles.block, containerStyle]} activeOpacity={0.5} {...rest}>
<TouchableOpacity
onPress={onPress}
style={[block && styles.block, containerStyle]}
activeOpacity={0.5}
testID={testId}
{...rest}
>
{isCopying && (
<Animated.View layout={LinearTransition} entering={FadeInDown} exiting={FadeOutDown} style={styles.isCopying}>
<Text style={styles.copiedText}>{copiedText}</Text>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ type Props = TextProps & {
}

export const HideableText = ({text, ...props}: Props) => {
const {isPrivacyOn} = usePrivacyMode()
const children = isPrivacyOn ? text : text?.replaceAll(/./g, '\u25CF')
const {isPrivacyActive} = usePrivacyMode()
const children = !isPrivacyActive ? text : text?.replaceAll(/./g, '\u25CF')

return <Text {...props}>{children}</Text>
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,17 @@ export const PairedBalance = React.forwardRef<ResetErrorRef, Props>(({amount, te
const Price = ({amount, textStyle, ignorePrivacy}: Props) => {
const styles = useStyles()
const wallet = useSelectedWallet()
const {isPrivacyOff, privacyPlaceholder} = usePrivacyMode()
const {isPrivacyActive, privacyPlaceholder} = usePrivacyMode()
const {currency, config} = useCurrencyContext()
const rate = useExchangeRate({wallet, to: currency})

const price = React.useMemo(() => {
if (rate == null) return `... ${currency}`

return isPrivacyOff || ignorePrivacy
return !isPrivacyActive || ignorePrivacy === true
? `${amountBreakdown(amount).bn.times(rate).toFormat(config.decimals)} ${currency}`
: `${privacyPlaceholder} ${currency}`
}, [amount, config.decimals, currency, ignorePrivacy, isPrivacyOff, privacyPlaceholder, rate])
}, [amount, config.decimals, currency, ignorePrivacy, isPrivacyActive, privacyPlaceholder, rate])

return (
<Text style={[styles.pairedBalanceText, textStyle]} testID="pairedTotalText">
Expand Down
24 changes: 0 additions & 24 deletions apps/wallet-mobile/src/features/Exchange/common/useNavigateTo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,5 @@ export const useNavigateTo = () => {
return useRef({
exchangeSelectBuyProvider: () => navigation.navigate('exchange-select-buy-provider'),
exchangeSelectSellProvider: () => navigation.navigate('exchange-select-sell-provider'),
exchangeOpenOrder: () =>
navigation.reset({
index: 0,
routes: [
{
name: 'manage-wallets',
state: {
routes: [
{name: 'wallet-selection'},
{
name: 'main-wallet-routes',
state: {
routes: [
{
name: 'history-list',
},
],
},
},
],
},
},
],
}),
}).current
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {Space} from '../../../../components/Space/Space'
import {Warning} from '../../../../components/Warning'
import {banxaTestWallet} from '../../../../kernel/env'
import {useMetrics} from '../../../../kernel/metrics/metricsManager'
import {useWalletNavigation} from '../../../../kernel/navigation'
import {useTokenInfo} from '../../../../yoroi-wallets/hooks'
import {Quantities} from '../../../../yoroi-wallets/utils'
import {useSelectedWallet} from '../../../WalletManager/context/SelectedWalletContext'
Expand All @@ -31,6 +32,7 @@ export const CreateExchangeOrderScreen = () => {
const styles = useStyles()
const {track} = useMetrics()
const wallet = useSelectedWallet()
const walletNavigation = useWalletNavigation()
const [contentHeight, setContentHeight] = React.useState(0)

const navigateTo = useNavigateTo()
Expand Down Expand Up @@ -88,7 +90,7 @@ export const CreateExchangeOrderScreen = () => {
if (referralLink.toString() !== '') {
Linking.openURL(referralLink.toString())
track.exchangeSubmitted({ramp_type: orderType === 'sell' ? 'Sell' : 'Buy', ada_amount: orderAmount})
navigateTo.exchangeOpenOrder()
walletNavigation.navigateToTxHistory()
}
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ export const TokenAmountItem = ({
orderType,
}: TokenAmountItemProps) => {
const {styles, colors} = useStyles()
const {privacyPlaceholder, isPrivacyOff} = usePrivacyMode()
const {privacyPlaceholder, isPrivacyActive} = usePrivacyMode()
const priceImpactRiskTheme = usePriceImpactRiskTheme(priceImpactRisk ?? 'none')

const {info} = amount
const isPrimary = isPrimaryToken(info)
const detail = isPrimary ? info.description : info.fingerprint
const name = infoExtractName(info)

const formattedQuantity = isPrivacyOff || ignorePrivacy ? amountFormatter()(amount) : privacyPlaceholder
const formattedQuantity = !isPrivacyActive && ignorePrivacy == true ? amountFormatter()(amount) : privacyPlaceholder

const showSwapDetails = !isPrimary && variant === 'swap'
const priceImpactRiskTextColor = orderType === 'market' ? priceImpactRiskTheme.text : colors.text
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const ApplicationSettingsScreen = () => {
const {languageCode, supportedLanguages} = useLanguage()
const language = supportedLanguages.find((lang) => lang.code === languageCode) ?? defaultLanguage

const {isTogglePrivacyModeLoading, isPrivacyOff} = usePrivacyMode()
const {isTogglePrivacyModeLoading, isPrivacyActive} = usePrivacyMode()
const {currency} = useCurrencyContext()
const {enabled: crashReportEnabled} = useCrashReports()

Expand Down Expand Up @@ -119,7 +119,7 @@ export const ApplicationSettingsScreen = () => {
label={strings.privacyMode}
info={strings.privacyModeInfo}
>
<PrivacyModeSwitch isPrivacyOff={isPrivacyOff} />
<PrivacyModeSwitch isPrivacyActive={isPrivacyActive} />
</SettingsItem>

<SettingsItem
Expand Down Expand Up @@ -164,9 +164,9 @@ export const ApplicationSettingsScreen = () => {
}

// to avoid switch jumps
const PrivacyModeSwitch = ({isPrivacyOff}: {isPrivacyOff: boolean}) => {
const PrivacyModeSwitch = ({isPrivacyActive}: {isPrivacyActive: boolean}) => {
const {setPrivacyModeOn, setPrivacyModeOff, isTogglePrivacyModeLoading} = usePrivacyMode()
const [isLocalPrivacyOff, setIsLocalPrivacyOff] = React.useState(isPrivacyOff)
const [isLocalPrivacyActive, setIsLocalPrivacyOff] = React.useState(isPrivacyActive)

const onTogglePrivacyMode = () => {
setIsLocalPrivacyOff((prevState) => {
Expand All @@ -182,7 +182,7 @@ const PrivacyModeSwitch = ({isPrivacyOff}: {isPrivacyOff: boolean}) => {

return (
<SettingsSwitch
value={isLocalPrivacyOff}
value={isLocalPrivacyActive}
onValueChange={onTogglePrivacyMode}
disabled={isTogglePrivacyModeLoading}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,14 +187,14 @@ type ActionableAmountProps = {
}
const ActionableAmount = ({amount, onRemove, wallet, collateralId, disabled}: ActionableAmountProps) => {
const {styles} = useStyles()
const {isPrivacyOff} = usePrivacyMode()
const {isPrivacyActive} = usePrivacyMode()

const handleRemove = () => onRemove()

return (
<View style={styles.amountItem} testID="amountItem">
<Left>
<AmountItem amount={amount} wallet={wallet} isPrivacyOff={isPrivacyOff} />
<AmountItem amount={amount} wallet={wallet} isPrivacyActive={isPrivacyActive} />
</Left>

{collateralId !== '' && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ export const usePrivacyMode = () => {
const writePrivacyMode = useWritePrivacyMode()

return {
isPrivacyOff: privacyMode === 'HIDDEN',
isPrivacyOn: privacyMode === 'SHOWN',
isPrivacyActive: privacyMode === 'HIDDEN',
privacyMode,
togglePrivacyMode,
isTogglePrivacyModeLoading,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import * as React from 'react'
import {defineMessages, useIntl} from 'react-intl'

import {defaultStackNavigationOptions, WalletInitRoutes} from '../../kernel/navigation'
import {PreparingWalletScreen} from './common/PreparingWalletScreen/PreparingWalletScreen'
import {CheckNanoXScreen} from './legacy/CheckNanoX/CheckNanoXScreen'
import {ConnectNanoXScreen} from './legacy/ConnectNanoX/ConnectNanoXScreen'
import {ImportReadOnlyWalletScreen} from './legacy/ImportReadOnlyWallet/ImportReadOnlyWalletScreen'
Expand Down Expand Up @@ -134,6 +135,12 @@ export const SetupWalletNavigator = () => {
component={VerifyRecoveryPhraseScreen}
options={{title: strings.createWalletTitle}}
/>

<Stack.Screen
name="setup-wallet-preparing-wallet"
component={PreparingWalletScreen}
options={{headerShown: false}}
/>
</Stack.Navigator>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,18 @@ type ButtonCardProps = {
subTitle?: string
icon?: React.ReactNode
onPress: () => void
testId?: string
}

export const ButtonCard = ({title, subTitle, icon = null, onPress}: ButtonCardProps) => {
export const ButtonCard = ({title, subTitle, icon = null, onPress, testId}: ButtonCardProps) => {
const {styles, colors} = useStyles()

return (
<TouchableOpacity
activeOpacity={0.5}
style={[styles.container, icon !== null && styles.justifySpaceBetween]}
onPress={onPress}
testID={testId}
>
<LinearGradient
style={[StyleSheet.absoluteFill, {opacity: 1}]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ type CardAboutPhraseProps = {
includeSpacing?: boolean
checksumImage?: string
checksumLine?: number
testId?: string
}

export const CardAboutPhrase = ({
Expand All @@ -22,6 +23,7 @@ export const CardAboutPhrase = ({
includeSpacing,
checksumImage,
checksumLine,
testId,
}: CardAboutPhraseProps) => {
const {styles, colors} = useStyles(includeSpacing, showBackgroundColor)

Expand All @@ -38,7 +40,9 @@ export const CardAboutPhrase = ({

{title !== undefined && (
<>
<Text style={styles.title}>{title}</Text>
<Text style={styles.title} testID={testId}>
{title}
</Text>

<Space height="sm" />
</>
Expand Down
Loading

0 comments on commit 1f0d042

Please sign in to comment.