Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into feature/tx-review
Browse files Browse the repository at this point in the history
  • Loading branch information
banklesss committed Oct 2, 2024
2 parents 02d93af + 7ae330b commit e643e9a
Show file tree
Hide file tree
Showing 17 changed files with 67 additions and 173 deletions.
1 change: 0 additions & 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.

1 change: 0 additions & 1 deletion apps/wallet-mobile/src/WalletNavigator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ const WalletTabNavigator = () => {
),
tabBarLabel: strings.menuTabBarLabel,
tabBarTestID: 'menuTabBarButton',
headerTitle: ({children}) => <NetworkTag>{children}</NetworkTag>,
}}
/>
</Tab.Navigator>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,7 @@ import {useDappConnector} from '@yoroi/dapp-connector'
import {useTheme} from '@yoroi/theme'
import {Image} from 'expo-image'
import * as React from 'react'
import {
Alert,
Linking,
StyleSheet,
Text,
TouchableOpacity,
TouchableWithoutFeedback,
useWindowDimensions,
View,
} from 'react-native'
import {Alert, Linking, StyleSheet, Text, TouchableOpacity, TouchableWithoutFeedback, View} from 'react-native'
import {useSafeAreaInsets} from 'react-native-safe-area-context'
import uuid from 'uuid'

Expand Down Expand Up @@ -46,13 +37,7 @@ export const DAppListItem = ({dApp, connected, onPress}: Props) => {
const {manager} = useDappConnector()
const {track} = useMetrics()

const HEIGHT_SCREEN = useWindowDimensions().height

// For devices like iPhone SE wuth logical pixel height < 700, we need a bottom sheet with more height
const heightDialogByHeightScreen =
HEIGHT_SCREEN < 700
? (HEIGHT_SCREEN * (dApp.isSingleAddress ? 70 : 50)) / 100
: (HEIGHT_SCREEN * (dApp.isSingleAddress ? 50 : 40)) / 100
const heightDialogByHeightScreen = dApp.isSingleAddress ? 460 : 340

const heightDialogByInit = INIT_DIALOG_DAPP_ACTIONS_HEIGHT + insets.bottom
const dialogHeight = heightDialogByInit < heightDialogByHeightScreen ? heightDialogByHeightScreen : heightDialogByInit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,13 @@ export const MediaPreview = ({

{loading && (
<View style={[styles.skeletonWrapper, {width, height}]}>
<SkeletonPlaceholder enabled borderRadius={blurRadius} highlightColor={color.gray_200} speed={1000}>
<SkeletonPlaceholder
enabled
borderRadius={blurRadius}
backgroundColor={color.gray_100}
highlightColor={color.gray_200}
speed={1000}
>
<View style={{width, height}} />
</SkeletonPlaceholder>
</View>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const InsufficientFundsModal = () => {
const primaryBalance = usePortfolioPrimaryBalance({wallet})
const fmtMinPrimaryBalance = formatter({
info: wallet.portfolioPrimaryTokenInfo,
quantity: catalystConfig.displayedMinAda,
quantity: catalystConfig.minAda,
})
const fmtPrimaryBalance = formatter(primaryBalance)

Expand Down

This file was deleted.

25 changes: 0 additions & 25 deletions apps/wallet-mobile/src/features/Scan/common/CodeScannerButton.tsx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,6 @@ export const usePrivacyMode = () => {
isTogglePrivacyModeLoading,
setPrivacyModeOff: () => writePrivacyMode('HIDDEN'),
setPrivacyModeOn: () => writePrivacyMode('SHOWN'),
privacyPlaceholder: '*.******',
privacyPlaceholder: '******',
}
}
51 changes: 10 additions & 41 deletions apps/wallet-mobile/src/features/Transactions/TxHistoryNavigator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import {ThemedPalette, useTheme} from '@yoroi/theme'
import {Resolver} from '@yoroi/types'
import React from 'react'
import {defineMessages, useIntl} from 'react-intl'
import {StyleSheet, View, ViewProps} from 'react-native'
import {TouchableOpacity} from 'react-native'

import {Boundary} from '../../components/Boundary/Boundary'
import {Spacer} from '../../components/Spacer/Spacer'
import {Icon} from '../../components/Icon'
import {unstoppableApiKey} from '../../kernel/env'
import {
BackButton,
Expand All @@ -28,7 +28,6 @@ import {ReceiveProvider} from '../Receive/common/ReceiveProvider'
import {DescribeSelectedAddressScreen} from '../Receive/useCases/DescribeSelectedAddressScreen'
import {ListMultipleAddressesScreen} from '../Receive/useCases/ListMultipleAddressesScreen'
import {RequestSpecificAmountScreen} from '../Receive/useCases/RequestSpecificAmountScreen'
import {CodeScannerButton} from '../Scan/common/CodeScannerButton'
import {ScanCodeScreen} from '../Scan/useCases/ScanCodeScreen'
import {ShowCameraPermissionDeniedScreen} from '../Scan/useCases/ShowCameraPermissionDeniedScreen/ShowCameraPermissionDeniedScreen'
import {FailedTxScreen} from '../Send/useCases/ConfirmTx/FailedTx/FailedTxScreen'
Expand Down Expand Up @@ -86,9 +85,6 @@ export const TxHistoryNavigator = () => {
})
}, [wallet.externalAddresses, wallet.networkManager.tokenManager, wallet.portfolioPrimaryTokenInfo])

// navigator components
const headerRightHistory = React.useCallback(() => <HeaderRightHistory />, [])

// exchange
const exchangeManager = React.useMemo(() => {
const api = exchangeApiMaker({
Expand Down Expand Up @@ -129,7 +125,7 @@ export const TxHistoryNavigator = () => {
options={{
title: meta.name,
headerTransparent: true,
headerRight: headerRightHistory,
...(!meta.isReadOnly && {headerRight: () => <HeaderRightHistory />}),
}}
/>

Expand Down Expand Up @@ -528,45 +524,18 @@ const useStrings = () => {
}

const HeaderRightHistory = React.memo(() => {
const {meta} = useSelectedWallet()
const navigation = useNavigation<TxHistoryRouteNavigation>()
const {styles, colors} = useStyles()
const {color} = useTheme()

return (
<Row style={styles.row}>
{!meta.isReadOnly && (
<>
<CodeScannerButton
onPress={() => navigation.navigate('scan-start', {insideFeature: 'scan'})}
color={colors.gray}
/>

<Spacer width={10} />
</>
)}
</Row>
<TouchableOpacity
onPress={() => navigation.navigate('scan-start', {insideFeature: 'scan'})}
style={{paddingRight: 8}}
>
<Icon.Qr color={color.gray_max} />
</TouchableOpacity>
)
})
const Row = ({children, style, ...rest}: ViewProps) => (
<View style={[style, {flexDirection: 'row'}]} {...rest}>
{children}
</View>
)

const useStyles = () => {
const {color} = useTheme()

const styles = StyleSheet.create({
row: {
paddingStart: 8,
},
})

return {
styles,
colors: {gray: color.gray_max},
} as const
}

const sendOptions = (navigationOptions: StackNavigationOptions, color: ThemedPalette) => ({
...navigationOptions,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@ import {freeze} from 'immer'
import {cardanoConfig} from './cardano-config'

export const catalystConfig = freeze({
minAda: 450n * cardanoConfig.denominations.ada,
displayedMinAda: 500n * cardanoConfig.denominations.ada,
minAda: 25n * cardanoConfig.denominations.ada,
} as const)
11 changes: 3 additions & 8 deletions apps/wallet-mobile/src/hooks/useStatusBar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {Platform, StatusBar, StatusBarStyle} from 'react-native'
type StatusBarColor = {
bgColorAndroid: Color
statusBarStyle: StatusBarStyle | undefined
translucent: boolean
}
export const useStatusBar = (currentRouteName: string | undefined) => {
const {color, isDark} = useTheme()
Expand All @@ -22,8 +21,8 @@ export const useStatusBar = (currentRouteName: string | undefined) => {
const style = getStatusBarStyleByRoute({currentRouteName, isDark, color})
statusBarStyleByRoute.current = style
if (Platform.OS === 'android') {
StatusBar.setBackgroundColor(style.bgColorAndroid, true)
StatusBar.setTranslucent(style.translucent)
StatusBar.setBackgroundColor(style.bgColorAndroid)
StatusBar.setTranslucent(true)
}
style.statusBarStyle !== undefined && StatusBar.setBarStyle(style.statusBarStyle, true)
}
Expand All @@ -44,27 +43,23 @@ const getStatusBarStyleByRoute = ({
if (currentRouteName) {
if (currentRouteName === 'history-list') {
return {
translucent: true,
bgColorAndroid: 'rgba(0,0,0,0)', // transparent
statusBarStyle: undefined,
}
} else if (oldBlueRoutes.includes(currentRouteName)) {
return {
translucent: false,
// old blue, not present in the current theming
bgColorAndroid: '#254BC9',
statusBarStyle: 'light-content',
}
} else if (currentRouteName === 'scan-start') {
return {
translucent: false,
bgColorAndroid: color.white_static,
bgColorAndroid: color.black_static,
statusBarStyle: 'dark-content',
}
}
}
return {
translucent: false,
bgColorAndroid: isDark ? color.bg_color_max : color.white_static,
statusBarStyle: isDark ? 'light-content' : 'dark-content',
}
Expand Down
2 changes: 0 additions & 2 deletions apps/wallet-mobile/src/kernel/navigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ export const defaultMaterialTopTabNavigationOptions = (
// ROUTES
export type WalletTabRoutes = {
history: NavigatorScreenParams<TxHistoryRoutes>
'staking-dashboard': NavigatorScreenParams<DashboardRoutes>
portfolio: NavigatorScreenParams<Portfolio2Routes>
discover: NavigatorScreenParams<DiscoverRoutes>
menu: NavigatorScreenParams<MenuRoutes>
Expand Down Expand Up @@ -648,7 +647,6 @@ const routesWithTabBar: Record<keyof WalletTabRoutes, string[]> = {
portfolio: ['dashboard-portfolio'],
discover: ['discover-select-dapp-from-list'],
menu: ['_menu'],
'staking-dashboard': ['staking-dashboard-main'],
}

const getFocusedRouteName = (state: Partial<NavigationState> | NavigationState['routes'][0]['state']): string[] => {
Expand Down
15 changes: 3 additions & 12 deletions apps/wallet-mobile/src/legacy/Dashboard/DashboardNavigator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export const DashboardNavigator = () => {
<Stack.Navigator
screenOptions={{
...defaultStackNavigationOptions(atoms, color),
title: strings.title,
headerTitle: ({children}) => <NetworkTag>{children}</NetworkTag>,
}}
>
Expand All @@ -35,27 +36,17 @@ export const DashboardNavigator = () => {
component={Dashboard}
options={{
title: meta.name,
headerTitle: ({children}) => <NetworkTag>{children}</NetworkTag>,
}}
/>

<Stack.Screen //
name="staking-center"
component={StakingCenter}
options={{title: strings.title, headerTitle: ({children}) => <NetworkTag>{children}</NetworkTag>}}
/>

<Stack.Screen
name="delegation-confirmation"
component={DelegationConfirmation}
options={{title: strings.title, headerTitle: ({children}) => <NetworkTag>{children}</NetworkTag>}}
/>
<Stack.Screen name="delegation-confirmation" component={DelegationConfirmation} />

<Stack.Screen
name="delegation-failed-tx"
component={FailedTxScreen}
options={{title: strings.title, headerTitle: ({children}) => <NetworkTag>{children}</NetworkTag>}}
/>
<Stack.Screen name="delegation-failed-tx" component={FailedTxScreen} />
</Stack.Navigator>
</GovernanceProvider>
)
Expand Down
6 changes: 3 additions & 3 deletions apps/wallet-mobile/src/legacy/Dashboard/UserSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export const UserSummary = ({totalAdaSum, totalRewards, totalDelegated, onWithdr
? totalAdaSum != null
? formatAdaWithText(asQuantity(totalAdaSum), wallet.portfolioPrimaryTokenInfo)
: '-'
: '**.******'}
: '******'}
</Text>
</View>
</View>
Expand All @@ -82,7 +82,7 @@ export const UserSummary = ({totalAdaSum, totalRewards, totalDelegated, onWithdr
? totalRewards != null
? formatAdaWithText(asQuantity(totalRewards), wallet.portfolioPrimaryTokenInfo)
: '-'
: '**.******'}
: '******'}
</Text>
</View>
</View>
Expand All @@ -109,7 +109,7 @@ export const UserSummary = ({totalAdaSum, totalRewards, totalDelegated, onWithdr
? totalDelegated != null
? formatAdaWithText(asQuantity(totalDelegated), wallet.portfolioPrimaryTokenInfo)
: '-'
: '**.******'}
: '******'}
</Text>
</View>
</View>
Expand Down
Loading

0 comments on commit e643e9a

Please sign in to comment.