-
Notifications
You must be signed in to change notification settings - Fork 350
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support(llm): flush analytics events when putting the app in background
- Loading branch information
1 parent
95fbec9
commit 7ef2a7d
Showing
4 changed files
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"live-mobile": patch | ||
--- | ||
|
||
LLM - Flushes all analytics events when the app goes in the background |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
apps/ledger-live-mobile/src/analytics/useFlushInBackground.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { useEffect } from "react"; | ||
import useIsAppInBackground from "../components/useIsAppInBackground"; | ||
import { flush } from "./segment"; | ||
|
||
export default function useFlushInBackground() { | ||
const isAppInBakcground = useIsAppInBackground(); | ||
|
||
useEffect(() => { | ||
if (isAppInBakcground) { | ||
flush(); | ||
} | ||
}, [isAppInBakcground]); | ||
} |