Skip to content

Commit

Permalink
Merge pull request #5195 from EdgeApp/paul/coinhubFixes2
Browse files Browse the repository at this point in the history
Paul/coinhub fixes2
  • Loading branch information
paullinator authored Aug 13, 2024
2 parents e3e716e + a140981 commit fb93f9d
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 33 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
## Unreleased

- added: App distribution via Zealot
- added: Add disableSurveyModal option
- changed: Disable Home scene swap and FIO cards if configured
- changed: Allow some chains to be disabled in env.json
- fixed: FIO OBT data not showing in received transaction memos

## 4.11.0
Expand Down
2 changes: 1 addition & 1 deletion src/actions/LoginActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ export function initializeAccount(navigation: NavigationBase, account: EdgeAccou
showError(error)
}

if (!newAccount && !hideSurvey && !getDeviceSettings().isSurveyDiscoverShown) {
if (!newAccount && !hideSurvey && !getDeviceSettings().isSurveyDiscoverShown && config.disableSurveyModal !== true) {
// Show the survey modal once per app install, only if this isn't the
// first login of a newly created account and the user didn't get any
// other modals or scene changes immediately after login.
Expand Down
57 changes: 33 additions & 24 deletions src/components/scenes/HomeScene.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { useSafeAreaFrame } from 'react-native-safe-area-context'

import { getCountryCodeByIp } from '../../actions/AccountReferralActions'
import { SCROLL_INDICATOR_INSET_FIX } from '../../constants/constantSettings'
import { ENV } from '../../env'
import { useAsyncEffect } from '../../hooks/useAsyncEffect'
import { useHandler } from '../../hooks/useHandler'
import { lstrings } from '../../locales/strings'
Expand Down Expand Up @@ -119,6 +120,8 @@ export const HomeScene = (props: Props) => {
const fioIcon = React.useMemo(() => ({ uri: getUi4ImageUri(theme, 'cardBackgrounds/bg-fio') }), [theme])
const tradeCryptoIcon = React.useMemo(() => ({ uri: getUi4ImageUri(theme, 'cardBackgrounds/bg-trade') }), [theme])
const homeRowStyle = React.useMemo(() => [styles.homeRowContainer, { height: cardSize }], [styles, cardSize])
const hideFio = ENV.FIO_INIT == null || ENV.FIO_INIT === false
const hideSwap = config.disableSwaps === true

return (
<SceneWrapper hasNotifications hasTabs>
Expand Down Expand Up @@ -162,30 +165,36 @@ export const HomeScene = (props: Props) => {
onPress={handleSellPress}
/>
</EdgeAnim>
<EdgeAnim style={homeRowStyle} enter={fadeInUp60}>
<HomeTileCard
title={lstrings.fio_web3}
footer={lstrings.fio_web3_footer}
gradientBackground={theme.fioCardGradient}
nodeBackground={
<View style={styles.backroundImageContainer}>
<FastImage source={fioIcon} style={styles.backgroundImage} resizeMode="stretch" />
</View>
}
onPress={handleFioPress}
/>
<HomeTileCard
title={lstrings.swap_crypto}
footer={lstrings.swap_crypto_footer}
gradientBackground={theme.swapCardGradient}
nodeBackground={
<View style={styles.backroundImageContainer}>
<FastImage source={tradeCryptoIcon} style={styles.backgroundImage} resizeMode="stretch" />
</View>
}
onPress={handleSwapPress}
/>
</EdgeAnim>
{!hideFio || !hideSwap ? (
<EdgeAnim style={homeRowStyle} enter={fadeInUp60}>
{hideFio ? null : (
<HomeTileCard
title={lstrings.fio_web3}
footer={lstrings.fio_web3_footer}
gradientBackground={theme.fioCardGradient}
nodeBackground={
<View style={styles.backroundImageContainer}>
<FastImage source={fioIcon} style={styles.backgroundImage} resizeMode="stretch" />
</View>
}
onPress={handleFioPress}
/>
)}
{hideSwap ? null : (
<HomeTileCard
title={lstrings.swap_crypto}
footer={lstrings.swap_crypto_footer}
gradientBackground={theme.swapCardGradient}
nodeBackground={
<View style={styles.backroundImageContainer}>
<FastImage source={tradeCryptoIcon} style={styles.backgroundImage} resizeMode="stretch" />
</View>
}
onPress={handleSwapPress}
/>
)}
</EdgeAnim>
) : null}
</>
{blogPosts == null || blogPosts.length === 0 ? null : (
<>
Expand Down
8 changes: 7 additions & 1 deletion src/envConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@ export const asEnvConfig = asObject({
// Core plugin options:
ARBITRUM_INIT: asCorePluginInit(asEvmApiKeys),
AMOY_INIT: asCorePluginInit(asEvmApiKeys),
ALGORAND_INIT: asOptional(asBoolean, true),
AVALANCHE_INIT: asCorePluginInit(asEvmApiKeys),
AXELAR_INIT: asOptional(asBoolean, true),
BASE_INIT: asCorePluginInit(asEvmApiKeys),
BINANCE_SMART_CHAIN_INIT: asCorePluginInit(asEvmApiKeys),
BITCOIN_INIT: asCorePluginInit(
Expand Down Expand Up @@ -156,6 +158,7 @@ export const asEnvConfig = asObject({
}).withRest
),
COREUM_INIT: asCorePluginInit(asBoolean),
COSMOSHUB_INIT: asCorePluginInit(asBoolean),
DASH_INIT: asCorePluginInit(
asObject({
nowNodeApiKey: asOptional(asString, '')
Expand Down Expand Up @@ -188,6 +191,7 @@ export const asEnvConfig = asObject({
freeRegRefCode: asOptional(asString, '')
}).withRest
),
FILECOINFEVM_INIT: asOptional(asBoolean, true),
FILECOIN_INIT: asCorePluginInit(
asObject({
glifApiKey: asOptional(asString, '')
Expand All @@ -204,6 +208,8 @@ export const asEnvConfig = asObject({
}).withRest
),
HOLESKY_INIT: asCorePluginInit(asEvmApiKeys),
HEDERA_INIT: asOptional(asBoolean, true),
LIBERLAND_INIT: asOptional(asBoolean, true),
LIFI_INIT: asCorePluginInit(
asObject({
affiliateFeeBasis: asOptional(asString, '50'),
Expand All @@ -229,7 +235,7 @@ export const asEnvConfig = asObject({
OPTIMISM_INIT: asCorePluginInit(asEvmApiKeys),
OSMOSIS_INIT: asCorePluginInit(asBoolean),
PULSECHAIN_INIT: asCorePluginInit(asEvmApiKeys),

POLKADOT_INIT: asOptional(asBoolean, true),
POLYGON_INIT: asCorePluginInit(asEvmApiKeys),
RANGO_INIT: asCorePluginInit(
asObject({
Expand Down
1 change: 1 addition & 0 deletions src/types/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ export interface AppConfig {
termsOfServiceSite: string
website: string
disableSwaps?: boolean
disableSurveyModal?: boolean
extraTab?: {
webviewUrl: string
tabType: 'edgeProvider' | 'webview'
Expand Down
14 changes: 7 additions & 7 deletions src/util/corePlugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ export const currencyPlugins: EdgeCorePluginsInit = {
// edge-currency-accountbased:
amoy: ENV.AMOY_INIT,
arbitrum: ENV.ARBITRUM_INIT,
algorand: true,
algorand: ENV.ALGORAND_INIT,
avalanche: ENV.AVALANCHE_INIT,
axelar: true,
axelar: ENV.AXELAR_INIT,
base: ENV.BASE_INIT,
binance: true,
binancesmartchain: ENV.BINANCE_SMART_CHAIN_INIT,
Expand All @@ -17,24 +17,24 @@ export const currencyPlugins: EdgeCorePluginsInit = {
cardanotestnet: false, // ENV.CARDANO_INIT,
celo: true,
coreum: ENV.COREUM_INIT,
cosmoshub: true,
cosmoshub: ENV.COSMOSHUB_INIT,
eos: true,
ethereum: ENV.ETHEREUM_INIT,
ethereumclassic: true,
ethereumpow: ENV.ETHEREUM_POW_INIT,
fantom: ENV.FANTOM_INIT,
filecoin: ENV.FILECOIN_INIT,
filecoinfevm: true,
filecoinfevm: ENV.FILECOINFEVM_INIT,
filecoinfevmcalibration: true,
fio: ENV.FIO_INIT,
hedera: true,
hedera: ENV.HEDERA_INIT,
holesky: ENV.HOLESKY_INIT,
liberland: true,
liberland: ENV.LIBERLAND_INIT,
liberlandtestnet: false,
optimism: ENV.OPTIMISM_INIT,
osmosis: ENV.OSMOSIS_INIT,
piratechain: true,
polkadot: true,
polkadot: ENV.POLKADOT_INIT,
polygon: ENV.POLYGON_INIT,
pulsechain: ENV.PULSECHAIN_INIT,
ripple: true,
Expand Down

0 comments on commit fb93f9d

Please sign in to comment.