Add basic analytics (#89)
* Add basic analytics * Fix: add mock for analytics
This commit is contained in:
parent
f36c956536
commit
21f5f4de15
9 changed files with 190 additions and 14 deletions
|
|
@ -11,6 +11,7 @@ import {
|
|||
import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'
|
||||
import * as EmailValidator from 'email-validator'
|
||||
import {sessionClient as AtpApi, SessionServiceClient} from '@atproto/api'
|
||||
import {useAnalytics} from '@segment/analytics-react-native'
|
||||
import {LogoTextHero} from './Logo'
|
||||
import {Text} from '../util/text/Text'
|
||||
import {UserAvatar} from '../util/UserAvatar'
|
||||
|
|
@ -149,6 +150,7 @@ const ChooseAccountForm = ({
|
|||
onSelectAccount: (account?: AccountData) => void
|
||||
onPressBack: () => void
|
||||
}) => {
|
||||
const {track} = useAnalytics()
|
||||
const pal = usePalette('default')
|
||||
const [isProcessing, setIsProcessing] = React.useState(false)
|
||||
|
||||
|
|
@ -156,6 +158,7 @@ const ChooseAccountForm = ({
|
|||
if (account.accessJwt && account.refreshJwt) {
|
||||
setIsProcessing(true)
|
||||
if (await store.session.resumeSession(account)) {
|
||||
track('Sign In', {resumedSession: true})
|
||||
setIsProcessing(false)
|
||||
return
|
||||
}
|
||||
|
|
@ -255,6 +258,7 @@ const LoginForm = ({
|
|||
onPressBack: () => void
|
||||
onPressForgotPassword: () => void
|
||||
}) => {
|
||||
const {track} = useAnalytics()
|
||||
const pal = usePalette('default')
|
||||
const [isProcessing, setIsProcessing] = useState<boolean>(false)
|
||||
const [handle, setHandle] = useState<string>(initialHandle)
|
||||
|
|
@ -295,6 +299,7 @@ const LoginForm = ({
|
|||
handle: fullHandle,
|
||||
password,
|
||||
})
|
||||
track('Sign In', {resumedSession: false})
|
||||
} catch (e: any) {
|
||||
const errMsg = e.toString()
|
||||
store.log.warn('Failed to login', e)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue