Repository navigation
Commit 2a0ae79
authored
refactor(analytics): send every event through FlipcashAnalytics.track (#1554)
* refactor(analytics): add the track interface beside the legacy service
* refactor(analytics): convert Android domain types for the shared builders
* refactor(analytics): move chat events onto the shared builders
* refactor(analytics): move transfer events onto the shared builders
Every transfer call site now tracks a TransferEvents builder. The amount
conversion follows the type each caller already had (LocalFiat, or the
scanned Fiat on a failed grab), so the property block is unchanged.
Grab Time now goes out as a number instead of a string.
The session delegate tests assert the event each grab, give, claim and
cash-link share sends. TippingCoordinator lost its transfer call in #1463;
only its unused Analytics import goes here.
* refactor(analytics): move add money events onto the shared builders
Every add-money call site now tracks an AddMoneyEvents builder instead of
the legacy Analytics.AddMoney enums and FlipcashAnalyticsService methods.
Fiat/LocalFiat amounts and thrown errors go through their .analytics
converters, so each property block is unchanged except numbers going out
as numbers instead of strings. Analytics.AddMoneySource, AddMoneyMethod,
the AddMoneyEvent sealed interface, and the Mixpanel delegate overrides
are dead now that every caller uses the shared builder, so they are removed.
* refactor(analytics): move onramp events onto the shared builders
The five contact-verification screens now track OnrampEvents.step(...)
from the same LaunchedEffect. The events carry no properties, and a new
test pins each step to the name the screens sent before.
openOnramp, onrampPurchase, OnrampSource, OnrampPurchaseStep and their
eight events had no callers and are deleted.
* refactor(analytics): move wallet events onto the shared builders
Wallet connect/request-amount/failed/cancel in SwapViewModel now go
through WalletEvents instead of the bespoke FlipcashAnalyticsService
methods, so amounts and providers convert through .analytics like the
other builder call sites. transactionSubmittedToWallet had no caller
and is deleted along with its event and property mapping.
* refactor(analytics): move token info events onto the shared builders
TokenInfoEntry.Discovery, Chat and ChatGate used to report as
"Token Info: Opened From Wallet". They now send Opened From Discovery,
Chat and Chat Gate, so the Wallet count drops by what those three
entries carried. Deeplink and Wallet are unchanged. The mapping has no
else branch, so a new TokenInfoEntry fails to compile until it is mapped.
TokenInfoSource.Give and its event have had no caller since 6419a95
and are deleted.
* refactor(analytics): move buy and sell events onto the shared builders
SwapViewModel.trackTransaction now calls the generated SwapEvents.purchase
and SwapEvents.sell builders instead of the ad-hoc Analytics.buy/sell path,
dropping the local Analytics.SwapMethod/PurchaseMethod enums and the
TokenTransactionEvent sealed hierarchy they drove. Fee is sent as a decimal
(events.toml already defines it as `type = "decimal"`) instead of a string.
* refactor(analytics): move scan events onto the shared builders
Gallery scan (Scanner.kt), tip card scan (CodeScanDelegate) and tip card
present (TipCardDelegate) now call analytics.track(ScanEvents.*) instead
of the FlipcashAnalyticsService methods, which are deleted along with
their Events.kt classes and MixpanelAnalyticsDelegate wiring. Tier, Zoom
and Time go out as numbers and Exhausted as a flag, matching the shared
builder; Scanner.kt has no test harness so its three call sites are
reviewed by diff only.
CodeScanDelegateTest and TipCardDelegateTest now assert against
RecordingAnalytics with ScanEvents builders instead of verifying the
legacy methods.
* refactor(analytics): move deeplink events onto the shared builders
App.kt, Scanner.kt and CashLinkDelegate.kt track the DeeplinkEvents
builders instead of the legacy service methods. Two values change:
- Type comes from DeeplinkType.analytics, an explicit string per
subclass, instead of javaClass.simpleName. The strings match the
source class names, but no keep rule covers DeeplinkType, so a
minified release build may have sent R8-renamed names until now.
- The parse-failure Error carries the URL without its query or
fragment, which can hold secrets.
CashLinkDelegateTest asserts the routed event, with the type as a
string literal, on each early return and on success.
* refactor(analytics): move display name events onto the shared builders
Replaces FlipcashAnalyticsService.displayNameSubmitted(source, hadPreviousName)
with DisplayNameEvents.set/updated from the generated builder, called directly
from NameEntryViewModel. Deletes the old DisplayNameEvent.Set/Updated sealed
classes from Events.kt, the interface/stub method from Analytics.kt, and the
Mixpanel override, since nothing else referenced them.
NameEntryViewModel now takes a DispatcherProvider (wired to BaseViewModel's
defaultDispatcher) so its CheckName pipeline runs deterministically under a
test dispatcher, matching WalletViewModel's existing pattern; needed to cover
the branch through NameEntryViewModelTest with RecordingAnalytics.
* refactor(analytics): move error modal events onto the shared builders
NavMessagingEntryDecorator.kt tracks ErrorModalEvents.displayed instead
of the legacy displayedErrorModal method. Name, keys (Title, Message,
Screen, Call Site) and value types are unchanged; Screen and Call Site
still drop from the map when null, matching :libs:analytics-events'
ErrorModalEventsTest, which already pins that exact name and property
map. The decorator has no test harness, so the call site was reviewed
by diff against that existing builder test rather than given a new one.
Deletes displayedErrorModal from FlipcashAnalyticsService,
StubFlipcashAnalytics and MixpanelAnalyticsDelegate, and
ErrorModalDisplayed from Events.kt. No dead declarations in this
domain.
* refactor(analytics): move button and account events onto the shared builders
Button taps track ButtonEvents.tapped with the shared Button enum, and
the account actions and paidForAccount track AccountEvents. Every event
name is unchanged; Create Account Payment's Fiat goes out as a number.
Actions.kt is gone, along with Button.AllowCamera and Button.Sell, which
had no callers. Compose callers read the service through
rememberAnalytics(), since LocalAnalytics is typed as the base service
without track().
The login tests assert the tracked button events with RecordingAnalytics
instead of verifying action() on a mock.
* refactor(analytics): delete the legacy analytics service
Every caller now goes through FlipcashAnalytics.track/increment, so
FlipcashAnalyticsService, StubFlipcashAnalytics, Events.kt and
:libs:analytics have no users left. LocalAnalytics moves into the
Flipcash analytics module, typed as FlipcashAnalytics, with previews
providing FlipcashAnalytics.None.
The delegate's app-start trace went with the lifecycle hooks it lived in;
nothing called those hooks.
* test(chat): pin State: Failure on a failed chat send
code/cash left successful at its default on this path, so a failed Sent Cash / Sent Tip reported State: Success; this branch sends Failure and the test keeps it that way.
* refactor(analytics): move RecordingAnalytics into test fixtures
It sat in the main source set, so it shipped in the app and production
code could inject it. It now lives in the analytics module's
testFixtures, which the nine modules whose tests use it pull in with
testImplementation(testFixtures(...)), the same way :libs:coroutines and
:ui:resources share their fakes. The fixture compilation needs the
Compose BOM and ui on its classpath because the module applies the
Compose compiler.
* refactor(tipping): drop the unused analytics dependency from TippingCoordinator
TippingCoordinator took a FlipcashAnalytics it never called, both before
and after the track() migration. Remove the constructor parameter and the
module's dependency on :apps:flipcash:shared:analytics.
* test(messenger): run the chat send-failure test on the test dispatcher
ChatViewModel dispatched events on the real Dispatchers.Default, so
ChatSendFailureAnalyticsTest polled for up to 5s and could leave the send
handler running after the test returned. CI then failed
ReportViewModelTest, the next messenger test, with
UncaughtExceptionsBeforeTest, which is how kotlinx-coroutines-test reports
an exception thrown by an earlier test's leftover coroutine. It did not
reproduce locally.
Inject DispatcherProvider into ChatViewModel, as NameEntryViewModel does,
and pass the test's dispatcher so no work outlives the test. Production
still gets Dispatchers.Default.1 parent 3e097f8 commit 2a0ae79
87 files changed
Lines changed: 1767 additions & 1559 deletions
File tree
- apps/flipcash
- app/src/main/kotlin/com/flipcash/app
- internal/ui
- features
- balance
- src
- main/kotlin/com/flipcash/app/balance/internal
- test/kotlin/com/flipcash/app/balance/internal
- cash
- src
- main/kotlin/com/flipcash/app/cash/internal
- test/kotlin/com/flipcash/app/cash/internal
- contact-verification/src
- main/kotlin/com/flipcash/app/contact/verification
- email
- internal
- phone
- phone
- test/kotlin/com/flipcash/app/contact/verification
- deposit/src/main/kotlin/com/flipcash/app/deposit/internal
- login
- src
- main/kotlin/com/flipcash/app/login
- internal
- router
- test/kotlin/com/flipcash/app/login
- internal
- router
- messenger
- src
- main/kotlin/com/flipcash/app/messenger/internal
- test/kotlin/com/flipcash/app/messenger/internal
- scanner/src/main/kotlin/com/flipcash/app/scanner/internal
- tokens
- src
- main/kotlin/com/flipcash/app/tokens
- test/kotlin/com/flipcash/app/tokens
- user-profile
- src
- main/kotlin/com/flipcash/app/userprofile/internal/name
- test/kotlin/com/flipcash/app/userprofile/internal/name
- withdrawal/src
- main/kotlin/com/flipcash/app/withdrawal
- test/kotlin/com/flipcash/app/withdrawal
- libs/analytics
- src/main/kotlin/com/getcode/libs/analytics
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
52 | | - | |
| 52 | + | |
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| |||
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
121 | | - | |
| 121 | + | |
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
| |||
241 | 241 | | |
242 | 242 | | |
243 | 243 | | |
244 | | - | |
| 244 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
40 | 41 | | |
| 42 | + | |
41 | 43 | | |
42 | 44 | | |
43 | 45 | | |
| |||
117 | 119 | | |
118 | 120 | | |
119 | 121 | | |
120 | | - | |
| 122 | + | |
121 | 123 | | |
122 | 124 | | |
123 | 125 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
46 | 47 | | |
47 | 48 | | |
48 | 49 | | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
54 | 57 | | |
55 | 58 | | |
56 | 59 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
38 | | - | |
| 39 | + | |
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
| |||
176 | 177 | | |
177 | 178 | | |
178 | 179 | | |
179 | | - | |
| 180 | + | |
180 | 181 | | |
181 | 182 | | |
182 | 183 | | |
| |||
243 | 244 | | |
244 | 245 | | |
245 | 246 | | |
246 | | - | |
| 247 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
5 | 7 | | |
6 | 8 | | |
7 | 9 | | |
| |||
55 | 57 | | |
56 | 58 | | |
57 | 59 | | |
| 60 | + | |
| 61 | + | |
58 | 62 | | |
59 | 63 | | |
60 | 64 | | |
61 | 65 | | |
62 | 66 | | |
63 | 67 | | |
64 | 68 | | |
65 | | - | |
| 69 | + | |
66 | 70 | | |
67 | 71 | | |
68 | 72 | | |
| |||
83 | 87 | | |
84 | 88 | | |
85 | 89 | | |
| 90 | + | |
86 | 91 | | |
87 | 92 | | |
88 | 93 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
| 70 | + | |
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
58 | 59 | | |
59 | 60 | | |
60 | 61 | | |
61 | | - | |
| 62 | + | |
62 | 63 | | |
63 | 64 | | |
64 | 65 | | |
| |||
289 | 290 | | |
290 | 291 | | |
291 | 292 | | |
292 | | - | |
| 293 | + | |
293 | 294 | | |
294 | 295 | | |
295 | 296 | | |
| |||
340 | 341 | | |
341 | 342 | | |
342 | 343 | | |
343 | | - | |
| 344 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
5 | 7 | | |
6 | 8 | | |
7 | 9 | | |
| |||
51 | 53 | | |
52 | 54 | | |
53 | 55 | | |
| 56 | + | |
| 57 | + | |
54 | 58 | | |
55 | 59 | | |
56 | 60 | | |
| |||
79 | 83 | | |
80 | 84 | | |
81 | 85 | | |
82 | | - | |
| 86 | + | |
83 | 87 | | |
84 | 88 | | |
85 | 89 | | |
| |||
266 | 270 | | |
267 | 271 | | |
268 | 272 | | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
269 | 295 | | |
0 commit comments