Skip to content

Commit

Permalink
chore: Remove old CeloGoldHistoryChart (#5307)
Browse files Browse the repository at this point in the history
### Description

- Usage of CeloGoldHistoryChart removed
- exchangeHistorySelector usage replaced with
token.historicalPricesUsd.lastDay
- sage/reducer/action cleaned up
- exchange folder remaned to celoNews

### Test plan

builds, root state schema updated

### Related issues

- Fixes #ACT-1039

### Backwards compatibility

Yes

### Network scalability

If a new NetworkId and/or Network are added in the future, the changes
in this PR will:

- N/A
  • Loading branch information
finnian0826 committed Apr 29, 2024
1 parent 3846796 commit 90233b9
Show file tree
Hide file tree
Showing 33 changed files with 254 additions and 1,361 deletions.
10 changes: 8 additions & 2 deletions e2e/src/usecases/Assets.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import { generateMnemonic } from '@celo/cryptographic-utils'
import { DEFAULT_RECIPIENT_ADDRESS, SAMPLE_BACKUP_KEY } from '../utils/consts'
import { launchApp } from '../utils/retries'
import { quickOnboarding, waitForElementByIdAndTap, waitForElementId } from '../utils/utils'
import {
quickOnboarding,
waitForElementByIdAndTap,
waitForElementId,
scrollIntoViewByTestId,
} from '../utils/utils'

async function validateSendFlow(tokenSymbol) {
// navigate to send amount screen to ensure the expected token symbol is pre-selected
Expand Down Expand Up @@ -151,13 +156,14 @@ export default Assets = () => {

if (learnMore) {
it('learn more navigates to coingecko page', async () => {
await scrollIntoViewByTestId('TokenDetails/LearnMore', 'TokenDetailsScrollView')
await waitForElementByIdAndTap('TokenDetails/LearnMore')
await waitForElementId('RNWebView')
await waitFor(element(by.text('www.coingecko.com')))
.toBeVisible()
.withTimeout(10 * 1000)
await element(by.id('WebViewScreen/CloseButton')).tap()
await waitForElementId('TokenDetails/AssetValue')
await waitForElementId('TokenBalanceItem')
})
}

Expand Down
16 changes: 16 additions & 0 deletions e2e/src/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,22 @@ export async function scrollIntoView(scrollTo, scrollIn, speed = 350, direction
} catch {}
}

/**
* Scrolls to an element by testID within another
* @param {string} scrollTo - The element to scroll to by testID.
* @param {string} scrollIn - The element to scroll within to by testID.
* @param {number} [speed=350] - The speed at which to scroll
* @param {string} [direction='down'] - The direction of which to scroll
*/
export async function scrollIntoViewByTestId(scrollTo, scrollIn, speed = 350, direction = 'down') {
try {
await waitFor(element(by.id(scrollTo)))
.toBeVisible()
.whileElement(by.id(scrollIn))
.scroll(speed, direction)
} catch {}
}

export function getDeviceModel() {
return device.name.split(/\s(.+)/)[1].replace(/[(]|[)]/g, '')
}
Expand Down
3 changes: 2 additions & 1 deletion src/account/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { parsePhoneNumber } from '@celo/phone-utils'
import { ADDRESS_LENGTH } from 'src/exchange/reducer'

const ADDRESS_LENGTH = 42 // TODO(ACT-1173): see if this can be replaced with a viem helper

export const isAddressFormat = (content: string): boolean => {
return content.startsWith('0x') && content.length === ADDRESS_LENGTH
Expand Down
6 changes: 1 addition & 5 deletions src/alert/reducer.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Action } from '@reduxjs/toolkit'
import { Actions, ActionTypes, AlertTypes } from 'src/alert/actions'
import { ErrorMessages } from 'src/app/ErrorMessages'
import { ActionTypes as ExchangeActionTypes } from 'src/exchange/actions'
import { RootState } from 'src/redux/reducers'

export enum ErrorDisplayType {
Expand All @@ -24,10 +23,7 @@ type State = Alert | null

const initialState = null

export const reducer = (
state: State = initialState,
action: ActionTypes | ExchangeActionTypes
): State => {
export const reducer = (state: State = initialState, action: ActionTypes): State => {
switch (action.type) {
case Actions.SHOW:
return {
Expand Down
4 changes: 0 additions & 4 deletions src/analytics/Events.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -351,11 +351,7 @@ export enum TransactionEvents {
}

export enum CeloExchangeEvents {
celo_home_info = 'celo_home_info',

celo_withdraw_completed = 'celo_withdraw_completed',

celo_chart_tapped = 'celo_chart_tapped',
}

export enum FiatExchangeEvents {
Expand Down
2 changes: 0 additions & 2 deletions src/analytics/Properties.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -697,11 +697,9 @@ interface TransactionEventsProperties {
}

interface CeloExchangeEventsProperties {
[CeloExchangeEvents.celo_home_info]: undefined
[CeloExchangeEvents.celo_withdraw_completed]: {
amount: string
}
[CeloExchangeEvents.celo_chart_tapped]: undefined
}

interface FiatExchangeEventsProperties {
Expand Down
4 changes: 2 additions & 2 deletions src/analytics/docs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -360,9 +360,7 @@ export const eventDocs: Record<AnalyticsEventType, string> = {
[TransactionEvents.transaction_confirmed]: `when a transaction is confirmed by the blockchain`,
[TransactionEvents.transaction_error]: `when a transaction submission emits an error (only for contract-kit)`,
[TransactionEvents.transaction_exception]: `when a transaction submission throws`,
[CeloExchangeEvents.celo_home_info]: `when the (i) next to Celo Gold price is clicked, launching education (not pictured)`,
[CeloExchangeEvents.celo_withdraw_completed]: `when the transaction for the withdrawal is completed`,
[CeloExchangeEvents.celo_chart_tapped]: `when user clicks the chart on exchange screen`,

// The CICO landing page accessible from the Settings Menu
[FiatExchangeEvents.cico_landing_token_balance]: `User taps to view detailed token balance`,
Expand Down Expand Up @@ -604,6 +602,8 @@ export const eventDocs: Record<AnalyticsEventType, string> = {
// [CeloExchangeEvents.celo_withdraw_cancel]: `when ’cancel’ is clicked on the review screen`,
// [CeloExchangeEvents.celo_withdraw_confirm]: `when ‘withdraw’ is clicked on the review screen`,
// [CeloExchangeEvents.celo_withdraw_error]: `when there's an error on the withdrawal transaction`,
// [CeloExchangeEvents.celo_home_info]: `when the (i) next to Celo Gold price is clicked, launching education (not pictured)`,
// [CeloExchangeEvents.celo_chart_tapped]: `when user clicks the chart on exchange screen`,
// [NftEvents.nft_gallery_screen_open]: `When the gallery screen is mounted`,
// [PhoneVerificationEvents.phone_verification_input_help_skip]: `when the user presses skip on the help dialog to skip verification`,
// [PhoneVerificationEvents.phone_verification_skip]: `when skip is pressed in the phone number input screen`,
Expand Down
2 changes: 1 addition & 1 deletion src/app/reducers.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Platform } from 'react-native'
import { BIOMETRY_TYPE } from 'react-native-keychain'
import { Actions, ActionTypes, AppState, MultichainBetaStatus } from 'src/app/actions'
import { CeloNewsConfig } from 'src/celoNews/types'
import { SuperchargeTokenConfigByToken } from 'src/consumerIncentives/types'
import { CeloNewsConfig } from 'src/exchange/types'
import { REMOTE_CONFIG_VALUES_DEFAULTS } from 'src/firebase/remoteConfigValuesDefaults'
import { Screens } from 'src/navigator/Screens'
import { getRehydratePayload, REHYDRATE, RehydrateAction } from 'src/redux/persist-helper'
Expand Down
14 changes: 7 additions & 7 deletions src/app/saga.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@ import { findBestAvailableLanguage } from 'react-native-localize'
import { eventChannel } from 'redux-saga'
import { e164NumberSelector } from 'src/account/selectors'
import { AppEvents, InviteEvents } from 'src/analytics/Events'
import { HooksEnablePreviewOrigin } from 'src/analytics/types'
import ValoraAnalytics from 'src/analytics/ValoraAnalytics'
import { HooksEnablePreviewOrigin } from 'src/analytics/types'
import {
Actions,
OpenDeepLink,
OpenUrlAction,
SetAppState,
androidMobileServicesAvailabilityChecked,
appLock,
inAppReviewRequested,
inviteLinkConsumed,
minAppVersionDetermined,
OpenDeepLink,
openDeepLink,
OpenUrlAction,
phoneNumberVerificationMigrated,
SetAppState,
setAppState,
setSupportedBiometryType,
updateRemoteConfigValues,
Expand All @@ -38,13 +38,13 @@ import {
sentryNetworkErrorsSelector,
shouldRunVerificationMigrationSelector,
} from 'src/app/selectors'
import { CeloNewsConfig } from 'src/celoNews/types'
import { DEFAULT_APP_LANGUAGE, FETCH_TIMEOUT_DURATION, isE2EEnv } from 'src/config'
import { claimRewardsSuccess } from 'src/consumerIncentives/slice'
import { SuperchargeTokenConfigByToken } from 'src/consumerIncentives/types'
import { handleDappkitDeepLink } from 'src/dappkit/dappkit'
import { CeloNewsConfig } from 'src/exchange/types'
import { FiatAccountSchemaCountryOverrides } from 'src/fiatconnect/types'
import { FiatExchangeFlow } from 'src/fiatExchanges/utils'
import { FiatAccountSchemaCountryOverrides } from 'src/fiatconnect/types'
import { appVersionDeprecationChannel, fetchRemoteConfigValues } from 'src/firebase/firebase'
import { initI18n } from 'src/i18n'
import {
Expand All @@ -70,9 +70,9 @@ import { getFeatureGate, patchUpdateStatsigUser, setupOverridesFromLaunchArgs }
import { StatsigFeatureGates } from 'src/statsig/types'
import { swapSuccess } from 'src/swap/slice'
import { NetworkId } from 'src/transactions/types'
import Logger from 'src/utils/Logger'
import { ensureError } from 'src/utils/ensureError'
import { isDeepLink, navigateToURI } from 'src/utils/linking'
import Logger from 'src/utils/Logger'
import { safely } from 'src/utils/safely'
import { ONE_DAY_IN_MILLIS } from 'src/utils/time'
import { isWalletConnectEnabled } from 'src/walletConnect/saga'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import React from 'react'
import { Provider } from 'react-redux'
import { CeloNewsEvents } from 'src/analytics/Events'
import ValoraAnalytics from 'src/analytics/ValoraAnalytics'
import CeloNewsFeed from 'src/exchange/CeloNewsFeed'
import { CeloNewsArticles } from 'src/exchange/types'
import CeloNewsFeed from 'src/celoNews/CeloNewsFeed'
import { CeloNewsArticles } from 'src/celoNews/types'
import { navigate } from 'src/navigator/NavigationService'
import { Screens } from 'src/navigator/Screens'
import networkConfig from 'src/web3/networkConfig'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ import { FlatList, ListRenderItemInfo, StyleSheet, Text, View } from 'react-nati
import { CeloNewsEvents } from 'src/analytics/Events'
import ValoraAnalytics from 'src/analytics/ValoraAnalytics'
import { celoNewsConfigSelector } from 'src/app/selectors'
import CeloNewsFeedItem from 'src/celoNews/CeloNewsFeedItem'
import { CeloNewsArticle, CeloNewsArticles } from 'src/celoNews/types'
import Button, { BtnSizes, BtnTypes } from 'src/components/Button'
import EmptyView from 'src/components/EmptyView'
import CeloNewsFeedItem from 'src/exchange/CeloNewsFeedItem'
import { CeloNewsArticle, CeloNewsArticles } from 'src/exchange/types'
import { navigate } from 'src/navigator/NavigationService'
import { Screens } from 'src/navigator/Screens'
import { useSelector } from 'src/redux/hooks'
import colors from 'src/styles/colors'
import { typeScale } from 'src/styles/fonts'
import { Spacing } from 'src/styles/styles'
import { fetchWithTimeout } from 'src/utils/fetchWithTimeout'
import Logger from 'src/utils/Logger'
import { fetchWithTimeout } from 'src/utils/fetchWithTimeout'
import networkConfig from 'src/web3/networkConfig'

const TAG = 'exchange/CeloNewsFeed'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { fireEvent, render } from '@testing-library/react-native'
import React from 'react'
import { CeloNewsEvents } from 'src/analytics/Events'
import ValoraAnalytics from 'src/analytics/ValoraAnalytics'
import CeloNewsFeedItem from 'src/exchange/CeloNewsFeedItem'
import CeloNewsFeedItem from 'src/celoNews/CeloNewsFeedItem'
import { navigate } from 'src/navigator/NavigationService'
import { Screens } from 'src/navigator/Screens'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import * as React from 'react'
import { Image, StyleSheet, Text, View } from 'react-native'
import { CeloNewsEvents } from 'src/analytics/Events'
import ValoraAnalytics from 'src/analytics/ValoraAnalytics'
import { CeloNewsArticle } from 'src/celoNews/types'
import SkeletonPlaceholder from 'src/components/SkeletonPlaceholder'
import Touchable from 'src/components/Touchable'
import { CeloNewsArticle } from 'src/exchange/types'
import { navigate } from 'src/navigator/NavigationService'
import { Screens } from 'src/navigator/Screens'
import colors from 'src/styles/colors'
Expand Down
File renamed without changes.
91 changes: 0 additions & 91 deletions src/exchange/CeloGoldHistoryChart.test.tsx

This file was deleted.

Loading

0 comments on commit 90233b9

Please sign in to comment.