diff options
Diffstat (limited to 'src/view')
-rw-r--r-- | src/view/com/auth/login/LoginForm.tsx | 2 | ||||
-rw-r--r-- | src/view/com/auth/onboarding/RecommendedFeedsItem.tsx | 3 | ||||
-rw-r--r-- | src/view/com/posts/Feed.tsx | 2 | ||||
-rw-r--r-- | src/view/com/posts/FeedItem.tsx | 5 | ||||
-rw-r--r-- | src/view/screens/ProfileFeed.tsx | 6 | ||||
-rw-r--r-- | src/view/screens/ProfileList.tsx | 20 |
6 files changed, 23 insertions, 15 deletions
diff --git a/src/view/com/auth/login/LoginForm.tsx b/src/view/com/auth/login/LoginForm.tsx index 365f2e253..a39d0d9bf 100644 --- a/src/view/com/auth/login/LoginForm.tsx +++ b/src/view/com/auth/login/LoginForm.tsx @@ -120,8 +120,6 @@ export const LoginForm = ({ } else { setError(cleanError(errMsg)) } - } finally { - track('Sign In', {resumedSession: false}) } } diff --git a/src/view/com/auth/onboarding/RecommendedFeedsItem.tsx b/src/view/com/auth/onboarding/RecommendedFeedsItem.tsx index 7417e5b06..fcc4572af 100644 --- a/src/view/com/auth/onboarding/RecommendedFeedsItem.tsx +++ b/src/view/com/auth/onboarding/RecommendedFeedsItem.tsx @@ -17,6 +17,7 @@ import { useRemoveFeedMutation, } from '#/state/queries/preferences' import {logger} from '#/logger' +import {useAnalytics} from '#/lib/analytics/analytics' export function RecommendedFeedsItem({ item, @@ -36,6 +37,7 @@ export function RecommendedFeedsItem({ variables: removedFeed, reset: resetRemoveFeed, } = useRemoveFeedMutation() + const {track} = useAnalytics() if (!item || !preferences) return null @@ -56,6 +58,7 @@ export function RecommendedFeedsItem({ try { await pinFeed({uri: item.uri}) resetPinFeed() + track('Onboarding:CustomFeedAdded') } catch (e) { Toast.show('There was an issue contacting your server') logger.error('Failed to pin feed', {error: e}) diff --git a/src/view/com/posts/Feed.tsx b/src/view/com/posts/Feed.tsx index 113436e73..371f73b87 100644 --- a/src/view/com/posts/Feed.tsx +++ b/src/view/com/posts/Feed.tsx @@ -294,7 +294,7 @@ let Feed = ({ scrollEventThrottle={scrollEventThrottle} indicatorStyle={theme.colorScheme === 'dark' ? 'white' : 'black'} onEndReached={onEndReached} - onEndReachedThreshold={2} + onEndReachedThreshold={2} // number of posts left to trigger load more removeClippedSubviews={true} contentOffset={{x: 0, y: headerOffset * -1}} extraData={extraData} diff --git a/src/view/com/posts/FeedItem.tsx b/src/view/com/posts/FeedItem.tsx index b6c509e92..df4728a54 100644 --- a/src/view/com/posts/FeedItem.tsx +++ b/src/view/com/posts/FeedItem.tsx @@ -25,7 +25,6 @@ import {PostSandboxWarning} from '../util/PostSandboxWarning' import {PreviewableUserAvatar} from '../util/UserAvatar' import {s} from 'lib/styles' import {usePalette} from 'lib/hooks/usePalette' -import {useAnalytics} from 'lib/analytics/analytics' import {sanitizeDisplayName} from 'lib/strings/display-names' import {sanitizeHandle} from 'lib/strings/handles' import {makeProfileLink} from 'lib/routes/links' @@ -102,7 +101,6 @@ let FeedItemInner = ({ }): React.ReactNode => { const {openComposer} = useComposerControls() const pal = usePalette('default') - const {track} = useAnalytics() const [limitLines, setLimitLines] = useState( () => countLines(richText.text) >= MAX_POST_LINES, ) @@ -121,7 +119,6 @@ let FeedItemInner = ({ }, [record?.reply]) const onPressReply = React.useCallback(() => { - track('FeedItem:PostReply') openComposer({ replyTo: { uri: post.uri, @@ -134,7 +131,7 @@ let FeedItemInner = ({ }, }, }) - }, [post, record, track, openComposer]) + }, [post, record, openComposer]) const onPressShowMore = React.useCallback(() => { setLimitLines(false) diff --git a/src/view/screens/ProfileFeed.tsx b/src/view/screens/ProfileFeed.tsx index 155df6480..f803930d1 100644 --- a/src/view/screens/ProfileFeed.tsx +++ b/src/view/screens/ProfileFeed.tsx @@ -571,7 +571,7 @@ function AboutSection({ const scrollHandler = useAnimatedScrollHandler(onScroll) const [likeUri, setLikeUri] = React.useState(feedInfo.likeUri) const {hasSession} = useSession() - + const {track} = useAnalytics() const {mutateAsync: likeFeed, isPending: isLikePending} = useLikeMutation() const {mutateAsync: unlikeFeed, isPending: isUnlikePending} = useUnlikeMutation() @@ -586,9 +586,11 @@ function AboutSection({ if (isLiked && likeUri) { await unlikeFeed({uri: likeUri}) + track('CustomFeed:Unlike') setLikeUri('') } else { const res = await likeFeed({uri: feedInfo.uri, cid: feedInfo.cid}) + track('CustomFeed:Like') setLikeUri(res.uri) } } catch (err) { @@ -597,7 +599,7 @@ function AboutSection({ ) logger.error('Failed up toggle like', {error: err}) } - }, [likeUri, isLiked, feedInfo, likeFeed, unlikeFeed]) + }, [likeUri, isLiked, feedInfo, likeFeed, unlikeFeed, track]) return ( <ScrollView diff --git a/src/view/screens/ProfileList.tsx b/src/view/screens/ProfileList.tsx index 3e568c8cc..f50c6afb3 100644 --- a/src/view/screens/ProfileList.tsx +++ b/src/view/screens/ProfileList.tsx @@ -62,6 +62,7 @@ import { useUnpinFeedMutation, } from '#/state/queries/preferences' import {logger} from '#/logger' +import {useAnalytics} from '#/lib/analytics/analytics' const SECTION_TITLES_CURATE = ['Posts', 'About'] const SECTION_TITLES_MOD = ['About'] @@ -267,6 +268,7 @@ function Header({rkey, list}: {rkey: string; list: AppBskyGraphDefs.ListView}) { useUnpinFeedMutation() const isPending = isPinPending || isUnpinPending const {data: preferences} = usePreferencesQuery() + const {track} = useAnalytics() const isPinned = preferences?.feeds?.pinned?.includes(list.uri) @@ -297,6 +299,7 @@ function Header({rkey, list}: {rkey: string; list: AppBskyGraphDefs.ListView}) { try { await listMuteMutation.mutateAsync({uri: list.uri, mute: true}) Toast.show('List muted') + track('Lists:Mute') } catch { Toast.show( 'There was an issue. Please check your internet connection and try again.', @@ -307,18 +310,19 @@ function Header({rkey, list}: {rkey: string; list: AppBskyGraphDefs.ListView}) { closeModal() }, }) - }, [openModal, closeModal, list, listMuteMutation, _]) + }, [openModal, closeModal, list, listMuteMutation, track, _]) const onUnsubscribeMute = useCallback(async () => { try { await listMuteMutation.mutateAsync({uri: list.uri, mute: false}) Toast.show('List unmuted') + track('Lists:Unmute') } catch { Toast.show( 'There was an issue. Please check your internet connection and try again.', ) } - }, [list, listMuteMutation]) + }, [list, listMuteMutation, track]) const onSubscribeBlock = useCallback(() => { openModal({ @@ -332,6 +336,7 @@ function Header({rkey, list}: {rkey: string; list: AppBskyGraphDefs.ListView}) { try { await listBlockMutation.mutateAsync({uri: list.uri, block: true}) Toast.show('List blocked') + track('Lists:Block') } catch { Toast.show( 'There was an issue. Please check your internet connection and try again.', @@ -342,18 +347,19 @@ function Header({rkey, list}: {rkey: string; list: AppBskyGraphDefs.ListView}) { closeModal() }, }) - }, [openModal, closeModal, list, listBlockMutation, _]) + }, [openModal, closeModal, list, listBlockMutation, track, _]) const onUnsubscribeBlock = useCallback(async () => { try { await listBlockMutation.mutateAsync({uri: list.uri, block: false}) Toast.show('List unblocked') + track('Lists:Unblock') } catch { Toast.show( 'There was an issue. Please check your internet connection and try again.', ) } - }, [list, listBlockMutation]) + }, [list, listBlockMutation, track]) const onPressEdit = useCallback(() => { openModal({ @@ -370,6 +376,7 @@ function Header({rkey, list}: {rkey: string; list: AppBskyGraphDefs.ListView}) { async onPressConfirm() { await listDeleteMutation.mutateAsync({uri: list.uri}) Toast.show('List deleted') + track('Lists:Delete') if (navigation.canGoBack()) { navigation.goBack() } else { @@ -377,7 +384,7 @@ function Header({rkey, list}: {rkey: string; list: AppBskyGraphDefs.ListView}) { } }, }) - }, [openModal, list, listDeleteMutation, navigation, _]) + }, [openModal, list, listDeleteMutation, navigation, track, _]) const onPressReport = useCallback(() => { openModal({ @@ -390,7 +397,8 @@ function Header({rkey, list}: {rkey: string; list: AppBskyGraphDefs.ListView}) { const onPressShare = useCallback(() => { const url = toShareUrl(`/profile/${list.creator.did}/lists/${rkey}`) shareUrl(url) - }, [list, rkey]) + track('Lists:Share') + }, [list, rkey, track]) const dropdownItems: DropdownItem[] = useMemo(() => { let items: DropdownItem[] = [ |