Skip to content

Commit 957d4ce

Browse files
committed
Add missing dispatch invocations for logEvent
1 parent 90f3a9e commit 957d4ce

File tree

7 files changed

+25
-13
lines changed

7 files changed

+25
-13
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## Unreleased (develop)
44

5+
- fixed: Fixed broken `logEvent` tracking calls by adding the needed `dispatch`.
56
- removed: Remove change quote tracking.
67

78
## 4.38.0 (staging)

src/actions/AccountReferralActions.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,13 +123,13 @@ function createAccountReferral(): ThunkAction<Promise<void>> {
123123
referral.accountAppleAdsAttribution = isFirstOpenEmpty
124124
? await getAppleAdsAttribution()
125125
: firstOpenAttrib
126-
logEvent('AAA_Success')
126+
dispatch(logEvent('AAA_Success'))
127127
} else {
128128
referral.accountAppleAdsAttribution = await getAppleAdsAttribution()
129129
if (referral.accountAppleAdsAttribution == null) {
130-
logEvent('AAA_Failed')
130+
dispatch(logEvent('AAA_Failed'))
131131
} else {
132-
logEvent('AAA_Success')
132+
dispatch(logEvent('AAA_Success'))
133133
}
134134
}
135135
} catch (e) {}

src/components/scenes/RampCreateScene.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ export const RampCreateScene: React.FC<Props> = (props: Props) => {
525525

526526
// Log the quote event only when the scene is focused
527527
useFocusEffect(() => {
528-
logEvent(direction === 'buy' ? 'Buy_Quote' : 'Sell_Quote')
528+
dispatch(logEvent(direction === 'buy' ? 'Buy_Quote' : 'Sell_Quote'))
529529
})
530530

531531
//
@@ -619,7 +619,9 @@ export const RampCreateScene: React.FC<Props> = (props: Props) => {
619619
}
620620
}
621621

622-
logEvent(direction === 'buy' ? 'Buy_Quote_Next' : 'Sell_Quote_Next')
622+
dispatch(
623+
logEvent(direction === 'buy' ? 'Buy_Quote_Next' : 'Sell_Quote_Next')
624+
)
623625

624626
navigation.navigate('rampSelectOption', {
625627
rampQuoteRequest

src/components/themed/WalletListCreateRow.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,12 +240,12 @@ function createAndSelectToken({
240240
)
241241

242242
await wallet.changeEnabledTokenIds([...wallet.enabledTokenIds, tokenId])
243-
if (trackingEventSuccess != null) logEvent(trackingEventSuccess)
243+
if (trackingEventSuccess != null) dispatch(logEvent(trackingEventSuccess))
244244
return wallet
245245
} catch (error: any) {
246246
showError(error)
247247
if (trackingEventFailed != null)
248-
logEvent(trackingEventFailed, { error: String(error) })
248+
dispatch(logEvent(trackingEventFailed, { error: String(error) }))
249249
}
250250
}
251251
}

src/plugins/gui/amountQuotePlugin.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import {
1313
} from '../../util/CurrencyInfoHelpers'
1414
import { getHistoricalFiatRate } from '../../util/exchangeRates'
1515
import { infoServerData } from '../../util/network'
16-
import { logEvent } from '../../util/tracking'
1716
import {
1817
DECIMAL_PRECISION,
1918
fuzzyTimeout,
@@ -134,7 +133,14 @@ async function getInitialFiatValue(
134133
export const amountQuoteFiatPlugin: FiatPluginFactory = async (
135134
params: FiatPluginFactoryArgs
136135
) => {
137-
const { account, guiPlugin, longPress = false, pluginUtils, showUi } = params
136+
const {
137+
account,
138+
guiPlugin,
139+
longPress = false,
140+
pluginUtils,
141+
showUi,
142+
onLogEvent
143+
} = params
138144
const { pluginId } = guiPlugin
139145
const isLightAccount = account.username == null
140146

@@ -352,7 +358,7 @@ export const amountQuoteFiatPlugin: FiatPluginFactory = async (
352358
const isBuy = direction === 'buy'
353359
const disableInput = requireCrypto ? 1 : requireFiat ? 2 : undefined
354360

355-
logEvent(isBuy ? 'Buy_Quote' : 'Sell_Quote')
361+
onLogEvent(isBuy ? 'Buy_Quote' : 'Sell_Quote')
356362

357363
const startingFiatAmount = isLightAccount
358364
? DEFAULT_FIAT_AMOUNT_LIGHT_ACCOUNT
@@ -776,7 +782,7 @@ export const amountQuoteFiatPlugin: FiatPluginFactory = async (
776782
}
777783
}
778784

779-
logEvent(isBuy ? 'Buy_Quote_Next' : 'Sell_Quote_Next')
785+
onLogEvent(isBuy ? 'Buy_Quote_Next' : 'Sell_Quote_Next')
780786
await bestQuote.approveQuote({ showUi, coreWallet })
781787
}
782788
}

src/plugins/gui/fiatPlugin.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,8 @@ export const executePlugin = async (params: {
461461
longPress,
462462
guiPlugin,
463463
pluginUtils,
464-
showUi
464+
showUi,
465+
onLogEvent
465466
})
466467
if (plugin == null) {
467468
throw new Error(`pluginId ${pluginId} not found`)

src/plugins/gui/fiatPluginTypes.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ import type {
2929
import type {
3030
BuyConversionValues,
3131
SellConversionValues,
32-
TrackingEventName
32+
TrackingEventName,
33+
TrackingValues
3334
} from '../../util/tracking'
3435
import type { FiatPluginAddressFormParams } from './scenes/AddressFormScene'
3536
import type { FiatPluginOpenWebViewParams } from './scenes/FiatPluginWebView'
@@ -220,6 +221,7 @@ export interface FiatPluginFactoryArgs {
220221
guiPlugin: GuiPlugin
221222
showUi: FiatPluginUi
222223
pluginUtils: FiatPluginUtils
224+
onLogEvent: (event: TrackingEventName, values?: TrackingValues) => void
223225
}
224226

225227
export interface FiatPluginRegionCode {

0 commit comments

Comments
 (0)