Skip to content

Commit

Permalink
Merge branch 'develop' into feat/dapp-cip-30
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeljscript committed Apr 29, 2024
2 parents e67d556 + c0bdb00 commit dba0d8a
Show file tree
Hide file tree
Showing 108 changed files with 608 additions and 585 deletions.
4 changes: 2 additions & 2 deletions apps/wallet-mobile/.storybook/storybook.requires.js

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

Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {defineMessages, useIntl} from 'react-intl'
import {useQuery} from 'react-query'

import {useStakingInfo} from '../../Dashboard/StakePoolInfos'
import {features} from '../../features'
import {useSelectedWallet} from '../../features/WalletManager/Context'
import {YoroiWallet} from '../../yoroi-wallets/cardano/types'
import {asQuantity, Quantities} from '../../yoroi-wallets/utils'
Expand Down Expand Up @@ -39,7 +40,7 @@ export const usePoolTransition = () => {
retry: false,
staleTime: 20 * 1000,
queryKey: [wallet.id, 'poolTransition', currentPoolId],
queryFn: () => poolInfoApi.getTransition(currentPoolId),
queryFn: () => (features.poolTransition ? poolInfoApi.getTransition(currentPoolId) : null),
})

const poolTransition = poolTransitionQuery.data ?? null
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed apps/wallet-mobile/src/assets/img/dApp/book.png
Binary file not shown.
Binary file removed apps/wallet-mobile/src/assets/img/dApp/book@2x.png
Binary file not shown.
Binary file removed apps/wallet-mobile/src/assets/img/dApp/book@3x.png
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed apps/wallet-mobile/src/assets/img/dApp/cns.png
Binary file not shown.
Binary file removed apps/wallet-mobile/src/assets/img/dApp/cns@2x.png
Binary file not shown.
Binary file removed apps/wallet-mobile/src/assets/img/dApp/cns@3x.png
Binary file not shown.
Binary file removed apps/wallet-mobile/src/assets/img/dApp/djed.png
Binary file not shown.
Binary file removed apps/wallet-mobile/src/assets/img/dApp/djed@2x.png
Binary file not shown.
Binary file removed apps/wallet-mobile/src/assets/img/dApp/djed@3x.png
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed apps/wallet-mobile/src/assets/img/dApp/hunter.png
Binary file not shown.
Binary file removed apps/wallet-mobile/src/assets/img/dApp/hunter@2x.png
Diff not rendered.
Diff not rendered.
Binary file removed apps/wallet-mobile/src/assets/img/dApp/iagon.png
Diff not rendered.
Binary file removed apps/wallet-mobile/src/assets/img/dApp/iagon@2x.png
Diff not rendered.
Binary file removed apps/wallet-mobile/src/assets/img/dApp/iagon@3x.png
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Binary file removed apps/wallet-mobile/src/assets/img/dApp/jpg-store.png
Diff not rendered.
Diff not rendered.
Diff not rendered.
Binary file removed apps/wallet-mobile/src/assets/img/dApp/lenfi.png
Diff not rendered.
Binary file removed apps/wallet-mobile/src/assets/img/dApp/lenfi@2x.png
Diff not rendered.
Binary file removed apps/wallet-mobile/src/assets/img/dApp/lenfi@3x.png
Diff not rendered.
Binary file removed apps/wallet-mobile/src/assets/img/dApp/levvy.png
Diff not rendered.
Binary file removed apps/wallet-mobile/src/assets/img/dApp/levvy@2x.png
Diff not rendered.
Binary file removed apps/wallet-mobile/src/assets/img/dApp/levvy@3x.png
Diff not rendered.
Binary file removed apps/wallet-mobile/src/assets/img/dApp/liqwid.png
Diff not rendered.
Binary file removed apps/wallet-mobile/src/assets/img/dApp/liqwid@2x.png
Diff not rendered.
Diff not rendered.
Binary file removed apps/wallet-mobile/src/assets/img/dApp/minswap.png
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Binary file removed apps/wallet-mobile/src/assets/img/dApp/nucast.png
Diff not rendered.
Binary file removed apps/wallet-mobile/src/assets/img/dApp/nucast@2x.png
Diff not rendered.
Binary file removed apps/wallet-mobile/src/assets/img/dApp/nucast@3x.png
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Binary file removed apps/wallet-mobile/src/assets/img/dApp/pxlz.png
Diff not rendered.
Binary file removed apps/wallet-mobile/src/assets/img/dApp/pxlz@2x.png
Diff not rendered.
Binary file removed apps/wallet-mobile/src/assets/img/dApp/pxlz@3x.png
Diff not rendered.
Binary file removed apps/wallet-mobile/src/assets/img/dApp/summon.png
Diff not rendered.
Binary file removed apps/wallet-mobile/src/assets/img/dApp/summon@2x.png
Diff not rendered.
Binary file removed apps/wallet-mobile/src/assets/img/dApp/summon@3x.png
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Binary file removed apps/wallet-mobile/src/assets/img/dApp/taptools.png
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
25 changes: 25 additions & 0 deletions apps/wallet-mobile/src/components/Icon/Google.tsx

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions apps/wallet-mobile/src/components/Icon/Icon.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,8 @@ storiesOf('Icon', module).add('Gallery', () => {
<Item icon={<Icon.Reload />} title="Reload" />

<Item icon={<Icon.Square />} title="Square" />

<Item icon={<Icon.Google />} title="Google" />
</ScrollView>
</FilterProvider>
)
Expand Down
2 changes: 2 additions & 0 deletions apps/wallet-mobile/src/components/Icon/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import {Forward} from './Forward'
import {Gear} from './Gear'
import {Github} from './Github'
import {Globe} from './Globe'
import {Google} from './Google'
import {Governance} from './Governance'
import {HardwareWallet} from './HardwareWallet'
import {Image} from './Image'
Expand Down Expand Up @@ -242,4 +243,5 @@ export const Icon = {
Share2,
Reload,
Square,
Google,
}
32 changes: 1 addition & 31 deletions apps/wallet-mobile/src/features/Discover/BrowserNavigator.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
import {createStackNavigator} from '@react-navigation/stack'
import {useAsyncStorage} from '@yoroi/common'
import {connectionStorageMaker, dappConnectorMaker, DappConnectorProvider, ResolverWallet} from '@yoroi/dapp-connector'
import {useTheme} from '@yoroi/theme'
import {App} from '@yoroi/types'
import * as React from 'react'
import {Alert, StyleSheet} from 'react-native'
import {StyleSheet} from 'react-native'
import {SafeAreaView} from 'react-native-safe-area-context'
import {BrowserRoutes} from 'src/navigation'

import {YoroiWallet} from '../../yoroi-wallets/cardano/types'
import {useSelectedWallet} from '../WalletManager/Context'
import {BrowseDappScreen} from './useCases/BrowseDapp/BrowseDappScreen'
import {SearchDappInBrowserScreen} from './useCases/SearchDappInBrowser/SearchDappInBrowserScreen'

Expand All @@ -18,12 +13,7 @@ const Tab = createStackNavigator<BrowserRoutes>()
export const BrowserNavigator = () => {
const {styles} = useStyles()

const appStorage = useAsyncStorage()
const wallet = useSelectedWallet()
const manager = React.useMemo(() => createDappConnector(appStorage, wallet), [appStorage, wallet])

return (
<DappConnectorProvider manager={manager}>
<SafeAreaView edges={['left', 'right', 'top']} style={styles.root}>
<Tab.Navigator
screenOptions={{
Expand All @@ -36,29 +26,9 @@ export const BrowserNavigator = () => {
<Tab.Screen name="discover-search-dapp-in-browser" component={SearchDappInBrowserScreen} />
</Tab.Navigator>
</SafeAreaView>
</DappConnectorProvider>
)
}

const createDappConnector = (appStorage: App.Storage, wallet: YoroiWallet) => {
const handlerWallet: ResolverWallet = {
id: wallet.id,
networkId: wallet.networkId,
getBalance: (tokenId) => wallet.getBalance(tokenId),
confirmConnection: async (origin: string) => {
return new Promise<boolean>((resolve) => {
// TODO: Use modal with translations here instead of alert
Alert.alert('Confirm connection', `Do you want to connect to ${origin}?`, [
{text: 'Cancel', style: 'cancel', onPress: () => resolve(false)},
{text: 'OK', onPress: () => resolve(true)},
])
})
},
}
const storage = connectionStorageMaker({storage: appStorage.join('dapp-connections/')})
return dappConnectorMaker(storage, handlerWallet)
}

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

Expand Down
50 changes: 32 additions & 18 deletions apps/wallet-mobile/src/features/Discover/DiscoverNavigator.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
import {createStackNavigator} from '@react-navigation/stack'
import {useAsyncStorage} from '@yoroi/common'
import {DappConnectorProvider} from '@yoroi/dapp-connector'
import {useTheme} from '@yoroi/theme'
import * as React from 'react'

import {LoadingBoundary} from '../../components'
import {defaultStackNavigationOptions, DiscoverRoutes} from '../../navigation'
import {useSelectedWallet} from '../WalletManager/Context'
import {BrowserNavigator} from './BrowserNavigator'
import {BrowserProvider} from './common/BrowserProvider'
import {createDappConnector} from './common/helpers'
import {useStrings} from './common/useStrings'
import {ListSkeleton} from './useCases/SelectDappFromList/ListSkeleton'
import {SelectDappFromListScreen} from './useCases/SelectDappFromList/SelectDappFromListScreen'

const Stack = createStackNavigator<DiscoverRoutes>()
Expand All @@ -14,25 +20,33 @@ export const DiscoverNavigator = () => {
const {theme} = useTheme()
const strings = useStrings()

const appStorage = useAsyncStorage()
const wallet = useSelectedWallet()
const manager = React.useMemo(() => createDappConnector(appStorage, wallet), [appStorage, wallet])

return (
<BrowserProvider>
<Stack.Navigator
screenOptions={{
...defaultStackNavigationOptions(theme),
headerLeft: () => null,
detachPreviousScreen: false /* https://github.com/react-navigation/react-navigation/issues/9883 */,
gestureEnabled: true,
}}
initialRouteName="discover-select-dapp-from-list"
>
<Stack.Screen
name="discover-select-dapp-from-list"
component={SelectDappFromListScreen}
options={{title: strings.discoverTitle}}
/>
<DappConnectorProvider manager={manager}>
<BrowserProvider>
<Stack.Navigator
screenOptions={{
...defaultStackNavigationOptions(theme),
headerLeft: () => null,
detachPreviousScreen: false /* https://github.com/react-navigation/react-navigation/issues/9883 */,
gestureEnabled: true,
}}
initialRouteName="discover-select-dapp-from-list"
>
<Stack.Screen name="discover-select-dapp-from-list" options={{title: strings.discoverTitle}}>
{() => (
<LoadingBoundary fallback={<ListSkeleton />}>
<SelectDappFromListScreen />
</LoadingBoundary>
)}
</Stack.Screen>

<Stack.Screen name="discover-browser" component={BrowserNavigator} options={{headerShown: false}} />
</Stack.Navigator>
</BrowserProvider>
<Stack.Screen name="discover-browser" component={BrowserNavigator} options={{headerShown: false}} />
</Stack.Navigator>
</BrowserProvider>
</DappConnectorProvider>
)
}

0 comments on commit dba0d8a

Please sign in to comment.