diff --git a/src/components/dms/MessageProfileButton.tsx b/src/components/dms/MessageProfileButton.tsx
index 7e4422a6..7f440d62 100644
--- a/src/components/dms/MessageProfileButton.tsx
+++ b/src/components/dms/MessageProfileButton.tsx
@@ -5,6 +5,7 @@ import {msg} from '@lingui/macro'
import {useLingui} from '@lingui/react'
import {useMaybeConvoForUser} from '#/state/queries/messages/get-convo-for-members'
+import {logEvent} from 'lib/statsig/statsig'
import {atoms as a, useTheme} from '#/alf'
import {Message_Stroke2_Corner0_Rounded as Message} from '../icons/Message'
import {Link} from '../Link'
@@ -18,7 +19,14 @@ export function MessageProfileButton({
const {_} = useLingui()
const t = useTheme()
- const {data: convoId, isPending} = useMaybeConvoForUser(profile.did)
+ const {data: convo, isPending} = useMaybeConvoForUser(profile.did)
+
+ const onPress = React.useCallback(() => {
+ if (convo && !convo.lastMessage) {
+ logEvent('chat:create', {logContext: 'ProfileHeader'})
+ }
+ logEvent('chat:open', {logContext: 'ProfileHeader'})
+ }, [convo])
if (isPending) {
// show pending state based on declaration
@@ -48,7 +56,7 @@ export function MessageProfileButton({
}
}
- if (convoId) {
+ if (convo) {
return (
+ to={`/messages/${convo.id}`}
+ style={[a.justify_center, {width: 36, height: 36}]}
+ onPress={onPress}>
{
onNewChat(data.convo.id)
+
+ if (!data.convo.lastMessage) {
+ logEvent('chat:create', {logContext: 'NewChatDialog'})
+ }
+ logEvent('chat:open', {logContext: 'NewChatDialog'})
},
onError: error => {
Toast.show(error.message)
diff --git a/src/lib/statsig/events.ts b/src/lib/statsig/events.ts
index 660a37d2..fe4c9e65 100644
--- a/src/lib/statsig/events.ts
+++ b/src/lib/statsig/events.ts
@@ -125,6 +125,13 @@ export type LogEvents = {
| 'ProfileHeaderSuggestedFollows'
| 'ProfileMenu'
| 'ProfileHoverCard'
+ | 'Chat'
+ }
+ 'chat:create': {
+ logContext: 'ProfileHeader' | 'NewChatDialog'
+ }
+ 'chat:open': {
+ logContext: 'ProfileHeader' | 'NewChatDialog' | 'ChatsList'
}
'test:all:always': {}
diff --git a/src/screens/Messages/Conversation/MessageInput.tsx b/src/screens/Messages/Conversation/MessageInput.tsx
index bb55bd3a..c690c8ec 100644
--- a/src/screens/Messages/Conversation/MessageInput.tsx
+++ b/src/screens/Messages/Conversation/MessageInput.tsx
@@ -46,7 +46,6 @@ export function MessageInput({
const {height: keyboardHeight} = useReanimatedKeyboardAnimation()
const maxHeight = useSharedValue(undefined)
const isInputScrollable = useSharedValue(false)
- // const [isInputScrollable, setIsInputScrollable] = React.useState(false)
const inputStyles = useSharedInputStyles()
const [isFocused, setIsFocused] = React.useState(false)
diff --git a/src/screens/Messages/List/ChatListItem.tsx b/src/screens/Messages/List/ChatListItem.tsx
index 314bd475..682a2197 100644
--- a/src/screens/Messages/List/ChatListItem.tsx
+++ b/src/screens/Messages/List/ChatListItem.tsx
@@ -1,5 +1,5 @@
import React, {useCallback, useState} from 'react'
-import {View} from 'react-native'
+import {GestureResponderEvent, View} from 'react-native'
import {
AppBskyActorDefs,
ChatBskyConvoDefs,
@@ -13,6 +13,7 @@ import {isNative} from '#/platform/detection'
import {useProfileShadow} from '#/state/cache/profile-shadow'
import {useModerationOpts} from '#/state/preferences/moderation-opts'
import {useSession} from '#/state/session'
+import {logEvent} from 'lib/statsig/statsig'
import {sanitizeDisplayName} from 'lib/strings/display-names'
import {TimeElapsed} from '#/view/com/util/TimeElapsed'
import {UserAvatar} from '#/view/com/util/UserAvatar'
@@ -120,6 +121,18 @@ function ChatListItemReady({
setShowActions(true)
}, [])
+ const onPress = useCallback(
+ (e: GestureResponderEvent) => {
+ if (isDeletedAccount) {
+ e.preventDefault()
+ return false
+ } else {
+ logEvent('chat:open', {logContext: 'ChatsList'})
+ }
+ },
+ [isDeletedAccount],
+ )
+
const onLongPress = useCallback(() => {
menuControl.open()
}, [menuControl])
@@ -148,21 +161,14 @@ function ChatListItemReady({
]
: undefined
}
+ onPress={onPress}
+ onLongPress={isNative ? menuControl.open : undefined}
onAccessibilityAction={onLongPress}
- onPress={
- isDeletedAccount
- ? e => {
- e.preventDefault()
- return false
- }
- : undefined
- }
style={[
web({
cursor: isDeletedAccount ? 'default' : 'pointer',
}),
- ]}
- onLongPress={isNative ? menuControl.open : undefined}>
+ ]}>
{({hovered, pressed, focused}) => (
({success: null}))
if (convo.success) {
- return convo.data.convo.id
+ return convo.data.convo
} else {
return null
}