Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sam/sepa info done button overlap redo PR #5291

Merged
merged 3 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Unreleased

- fixed: Fixed obscured "done" button display bug on Sepa info display scene for small-screen devices

## 4.15.0

- added: Add Maya Protocol
Expand Down
9 changes: 3 additions & 6 deletions src/plugins/gui/fiatPlugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,9 @@ import { datelog } from '../../util/utils'
import {
FiatDirection,
FiatPaymentType,
FiatPluginAddressFormParams,
FiatPluginListModalParams,
FiatPluginPermissions,
FiatPluginRegionCode,
FiatPluginSepaFormParams,
FiatPluginSepaTransferParams,
FiatPluginStartParams,
FiatPluginUi,
FiatPluginUtils,
Expand Down Expand Up @@ -173,7 +170,7 @@ export const executePlugin = async (params: {
maybeNavigateToCorrectTabScene()
navigation.navigate('guiPluginEnterAmount', params)
},
addressForm: async (params: FiatPluginAddressFormParams) => {
addressForm: async params => {
const { countryCode, headerTitle, headerIconUri, onSubmit } = params
return await new Promise((resolve, reject) => {
maybeNavigateToCorrectTabScene()
Expand Down Expand Up @@ -208,7 +205,7 @@ export const executePlugin = async (params: {
maybeNavigateToCorrectTabScene()
navigation.navigate('rewardsCardWelcome', params)
},
sepaForm: async (params: FiatPluginSepaFormParams) => {
sepaForm: async params => {
const { headerTitle, headerIconUri, doneLabel, onDone } = params
return await new Promise((resolve, reject) => {
maybeNavigateToCorrectTabScene()
Expand All @@ -226,7 +223,7 @@ export const executePlugin = async (params: {
})
})
},
sepaTransferInfo: async (params: FiatPluginSepaTransferParams) => {
sepaTransferInfo: async params => {
return await new Promise((resolve, reject) => {
const { headerTitle, headerIconUri, promptMessage, transferInfo, onDone } = params
maybeNavigateToCorrectTabScene()
Expand Down
26 changes: 3 additions & 23 deletions src/plugins/gui/fiatPluginTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@ import { GuiPlugin } from '../../types/GuiPluginTypes'
import { AppParamList } from '../../types/routerTypes'
import { EdgeAsset } from '../../types/types'
import { BuyConversionValues, SellConversionValues, TrackingEventName } from '../../util/tracking'
import { FiatPluginAddressFormParams } from './scenes/AddressFormScene'
import { FiatPluginOpenWebViewParams } from './scenes/FiatPluginWebView'
import { FiatPluginSepaTransferParams } from './scenes/InfoDisplayScene'
import { RewardsCardDashboardParams } from './scenes/RewardsCardDashboardScene'
import { RewardsCardWelcomeParams } from './scenes/RewardsCardWelcomeScene'
import { FiatPluginSepaFormParams } from './scenes/SepaFormScene'

export const asFiatDirection = asValue('buy', 'sell')
export type FiatDirection = ReturnType<typeof asFiatDirection>
Expand Down Expand Up @@ -46,22 +49,7 @@ export const asFiatPaymentType = asValue(
)
export type FiatPaymentType = ReturnType<typeof asFiatPaymentType>

export interface FiatPluginAddressFormParams {
countryCode: string
headerTitle: string
headerIconUri?: string
onSubmit: (homeAddress: HomeAddress) => Promise<void>
onClose: () => void
}

export type LinkHandler = (url: FiatProviderLink) => void
export interface FiatPluginSepaFormParams {
headerTitle: string
doneLabel: string
headerIconUri?: string
onDone: (sepaInfo: SepaInfo) => Promise<void>
onClose: () => void
}

export interface FiatPluginSepaTransferInfo {
input: {
Expand All @@ -82,14 +70,6 @@ export interface FiatPluginSepaTransferInfo {
}
}

export interface FiatPluginSepaTransferParams {
headerTitle: string
promptMessage: string
transferInfo: FiatPluginSepaTransferInfo
headerIconUri?: string
onDone: () => Promise<void>
}

export interface FiatPluginListModalParams {
title: string
items: Array<{ icon: string | number | React.ReactNode; name: string; text?: string }> // Icon strings are image uri, numbers are local files
Expand Down
8 changes: 8 additions & 0 deletions src/plugins/gui/scenes/AddressFormScene.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ import { getDiskletFormData, setDiskletForm } from '../../../util/formUtils'
import { makePeriodicTask } from '../../../util/PeriodicTask'
import { GuiFormField } from '../components/GuiFormField'

export interface FiatPluginAddressFormParams {
countryCode: string
headerTitle: string
headerIconUri?: string
onSubmit: (homeAddress: HomeAddress) => Promise<void>
onClose: () => void
}

interface Props extends EdgeSceneProps<'guiPluginAddressForm'> {}

const FUZZY_SEARCH_INTERVAL = 2000
Expand Down
23 changes: 16 additions & 7 deletions src/plugins/gui/scenes/InfoDisplayScene.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,24 @@ import * as React from 'react'
import { View } from 'react-native'

import { Fontello } from '../../../assets/vector/index'
import { SceneButtons } from '../../../components/buttons/SceneButtons'
import { EdgeTouchableOpacity } from '../../../components/common/EdgeTouchableOpacity'
import { SceneWrapper } from '../../../components/common/SceneWrapper'
import { cacheStyles, Theme, useTheme } from '../../../components/services/ThemeContext'
import { EdgeText } from '../../../components/themed/EdgeText'
import { MainButton } from '../../../components/themed/MainButton'
import { SceneHeader } from '../../../components/themed/SceneHeader'
import { SceneHeaderUi4 } from '../../../components/themed/SceneHeaderUi4'
import { useHandler } from '../../../hooks/useHandler'
import { lstrings } from '../../../locales/strings'
import { EdgeSceneProps } from '../../../types/routerTypes'
import { FiatPluginSepaTransferInfo } from '../fiatPluginTypes'

export interface FiatPluginSepaTransferParams {
headerTitle: string
promptMessage: string
transferInfo: FiatPluginSepaTransferInfo
headerIconUri?: string
onDone: () => Promise<void>
}

interface InfoDisplayGroup {
groupTitle: string
Expand Down Expand Up @@ -123,21 +132,21 @@ export const InfoDisplayScene = React.memo((props: Props) => {
))

return (
<SceneWrapper scroll hasNotifications>
<SceneHeader title={headerTitle} underline withTopMargin />
<SceneWrapper hasTabs scroll hasNotifications padding={theme.rem(0.5)}>
<SceneHeaderUi4 title={headerTitle} />
<View style={styles.promptContainer}>
<EdgeText numberOfLines={12}>{promptMessage}</EdgeText>
</View>
{renderGroups()}
<MainButton label={lstrings.string_done_cap} marginRem={[4, 0, 1]} type="secondary" onPress={handleDone} />
<SceneButtons primary={{ label: lstrings.string_done_cap, onPress: handleDone }} />
</SceneWrapper>
)
})

const getStyles = cacheStyles((theme: Theme) => ({
groupContainer: {
marginTop: theme.rem(1),
marginHorizontal: theme.rem(1),
marginHorizontal: theme.rem(0.5),
borderWidth: theme.thinLineWidth,
borderColor: theme.cardBorderColor,
borderRadius: theme.rem(0.5)
Expand Down Expand Up @@ -174,6 +183,6 @@ const getStyles = cacheStyles((theme: Theme) => ({
flexWrap: 'wrap'
},
promptContainer: {
margin: theme.rem(1)
margin: theme.rem(0.5)
}
}))
8 changes: 8 additions & 0 deletions src/plugins/gui/scenes/SepaFormScene.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ import { EdgeSceneProps } from '../../../types/routerTypes'
import { getDiskletFormData, setDiskletForm } from '../../../util/formUtils'
import { GuiFormField } from '../components/GuiFormField'

export interface FiatPluginSepaFormParams {
headerTitle: string
doneLabel: string
headerIconUri?: string
onDone: (sepaInfo: SepaInfo) => Promise<void>
onClose: () => void
}

interface Props extends EdgeSceneProps<'guiPluginSepaForm'> {}

export const SepaFormScene = React.memo((props: Props) => {
Expand Down
4 changes: 3 additions & 1 deletion src/types/routerTypes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,13 @@ import type { WcConnectionsParams } from '../components/scenes/WcConnectionsScen
import type { WcConnectParams } from '../components/scenes/WcConnectScene'
import type { WcDisconnectParams } from '../components/scenes/WcDisconnectScene'
import type { WebViewSceneParams } from '../components/scenes/WebViewScene'
import type { FiatPluginAddressFormParams, FiatPluginSepaFormParams, FiatPluginSepaTransferParams } from '../plugins/gui/fiatPluginTypes'
import type { FiatPluginAddressFormParams } from '../plugins/gui/scenes/AddressFormScene'
import type { FiatPluginEnterAmountParams } from '../plugins/gui/scenes/FiatPluginEnterAmountScene'
import type { FiatPluginOpenWebViewParams } from '../plugins/gui/scenes/FiatPluginWebView'
import type { FiatPluginSepaTransferParams } from '../plugins/gui/scenes/InfoDisplayScene'
import type { RewardsCardDashboardParams } from '../plugins/gui/scenes/RewardsCardDashboardScene'
import type { RewardsCardWelcomeParams } from '../plugins/gui/scenes/RewardsCardWelcomeScene'
import type { FiatPluginSepaFormParams } from '../plugins/gui/scenes/SepaFormScene'

// -------------------------------------------------------------------------
// Router types
Expand Down
Loading