Skip to content

Commit

Permalink
feature/9221-Binny-UpdateInAppReviewEventLocations (#9251)
Browse files Browse the repository at this point in the history
  • Loading branch information
dumathane authored Aug 9, 2024
1 parent bd14580 commit da88f18
Show file tree
Hide file tree
Showing 17 changed files with 51 additions and 10 deletions.
2 changes: 2 additions & 0 deletions VAMobile/src/api/contactInformation/deleteEmail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Events, UserAnalytics } from 'constants/analytics'
import { Params as APIParams, EditResponseData, del } from 'store/api'
import { logAnalyticsEvent, logNonFatalErrorToFirebase, setAnalyticsUserProperty } from 'utils/analytics'
import { isErrorObject } from 'utils/common'
import { registerReviewEvent } from 'utils/inAppReviews'

import { contactInformationKeys } from './queryKeys'

Expand All @@ -27,6 +28,7 @@ export const useDeleteEmail = () => {
setAnalyticsUserProperty(UserAnalytics.vama_uses_profile())
logAnalyticsEvent(Events.vama_prof_update_email())
queryClient.invalidateQueries({ queryKey: contactInformationKeys.contactInformation })
registerReviewEvent()
},
onError: (error) => {
if (isErrorObject(error)) {
Expand Down
2 changes: 2 additions & 0 deletions VAMobile/src/api/contactInformation/saveAddress.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Events, UserAnalytics } from 'constants/analytics'
import { Params as APIParams, EditResponseData, post, put } from 'store/api'
import { logAnalyticsEvent, logNonFatalErrorToFirebase, setAnalyticsUserProperty } from 'utils/analytics'
import { isErrorObject } from 'utils/common'
import { registerReviewEvent } from 'utils/inAppReviews'

import { contactInformationKeys } from './queryKeys'
import { validateAddress } from './validateAddress'
Expand Down Expand Up @@ -39,6 +40,7 @@ export const useSaveAddress = () => {
setAnalyticsUserProperty(UserAnalytics.vama_uses_profile())
logAnalyticsEvent(Events.vama_prof_update_address())
queryClient.invalidateQueries({ queryKey: contactInformationKeys.contactInformation })
registerReviewEvent()
},
onError: (error) => {
if (isErrorObject(error)) {
Expand Down
2 changes: 2 additions & 0 deletions VAMobile/src/api/contactInformation/saveEmail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Events, UserAnalytics } from 'constants/analytics'
import { Params as APIParams, EditResponseData, post, put } from 'store/api'
import { logAnalyticsEvent, logNonFatalErrorToFirebase, setAnalyticsUserProperty } from 'utils/analytics'
import { isErrorObject } from 'utils/common'
import { registerReviewEvent } from 'utils/inAppReviews'

import { contactInformationKeys } from './queryKeys'

Expand Down Expand Up @@ -33,6 +34,7 @@ export const useSaveEmail = () => {
setAnalyticsUserProperty(UserAnalytics.vama_uses_profile())
logAnalyticsEvent(Events.vama_prof_update_email())
queryClient.invalidateQueries({ queryKey: contactInformationKeys.contactInformation })
registerReviewEvent()
},
onError: (error) => {
if (isErrorObject(error)) {
Expand Down
2 changes: 2 additions & 0 deletions VAMobile/src/api/contactInformation/savePhoneNumber.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Events, UserAnalytics } from 'constants/analytics'
import { Params as APIParams, EditResponseData, post, put } from 'store/api'
import { logAnalyticsEvent, logNonFatalErrorToFirebase, setAnalyticsUserProperty } from 'utils/analytics'
import { isErrorObject } from 'utils/common'
import { registerReviewEvent } from 'utils/inAppReviews'

import { contactInformationKeys } from './queryKeys'

Expand Down Expand Up @@ -33,6 +34,7 @@ export const useSavePhoneNumber = () => {
setAnalyticsUserProperty(UserAnalytics.vama_uses_profile())
logAnalyticsEvent(Events.vama_prof_update_phone())
queryClient.invalidateQueries({ queryKey: contactInformationKeys.contactInformation })
registerReviewEvent()
},
onError: (error) => {
if (isErrorObject(error)) {
Expand Down
3 changes: 2 additions & 1 deletion VAMobile/src/api/decisionLetters/downloadDecisionLetter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import store from 'store'
import { DEMO_MODE_LETTER_ENDPOINT, DEMO_MODE_LETTER_NAME } from 'store/api/demo/letters'
import getEnv from 'utils/env'
import { downloadDemoFile, downloadFile } from 'utils/filesystem'
import { registerReviewEvent } from 'utils/inAppReviews'

import { decisionLettersKeys } from './queryKeys'

Expand All @@ -21,7 +22,7 @@ const downloadDecisionLetter = async (id: string): Promise<boolean | undefined>
? await downloadDemoFile(DEMO_MODE_LETTER_ENDPOINT, DEMO_MODE_LETTER_NAME)
: await downloadFile('GET', decisionLettersEndpoint, 'decision_letter.pdf', undefined, 3)
if (filePath) {
await FileViewer.open(filePath)
await FileViewer.open(filePath, { onDismiss: () => registerReviewEvent() })
return true
}
}
Expand Down
2 changes: 2 additions & 0 deletions VAMobile/src/api/demographics/updateGenderIdentity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Events, UserAnalytics } from 'constants/analytics'
import { put } from 'store/api'
import { logAnalyticsEvent, logNonFatalErrorToFirebase, setAnalyticsUserProperty } from 'utils/analytics'
import { isErrorObject } from 'utils/common'
import { registerReviewEvent } from 'utils/inAppReviews'

import { demographicsKeys } from './queryKeys'

Expand All @@ -26,6 +27,7 @@ export const useUpdateGenderIdentity = () => {
setAnalyticsUserProperty(UserAnalytics.vama_uses_profile())
logAnalyticsEvent(Events.vama_gender_id_success())
queryClient.invalidateQueries({ queryKey: demographicsKeys.demographics })
registerReviewEvent()
},
onError: (error) => {
if (isErrorObject(error)) {
Expand Down
2 changes: 2 additions & 0 deletions VAMobile/src/api/demographics/updatePreferredName.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Events, UserAnalytics } from 'constants/analytics'
import { put } from 'store/api'
import { logAnalyticsEvent, logNonFatalErrorToFirebase, setAnalyticsUserProperty } from 'utils/analytics'
import { isErrorObject } from 'utils/common'
import { registerReviewEvent } from 'utils/inAppReviews'

import { demographicsKeys } from './queryKeys'

Expand All @@ -29,6 +30,7 @@ export const useUpdatePreferredName = () => {
setAnalyticsUserProperty(UserAnalytics.vama_uses_preferred_name())
logAnalyticsEvent(Events.vama_pref_name_success())
queryClient.invalidateQueries({ queryKey: demographicsKeys.demographics })
registerReviewEvent()
},
onError: (error) => {
if (isErrorObject(error)) {
Expand Down
2 changes: 2 additions & 0 deletions VAMobile/src/api/directDeposit/updateBankInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { DemoState } from 'store/slices/demoSlice'
import { logAnalyticsEvent, logNonFatalErrorToFirebase, setAnalyticsUserProperty } from 'utils/analytics'
import { isErrorObject } from 'utils/common'
import { getErrorKeys } from 'utils/errors'
import { registerReviewEvent } from 'utils/inAppReviews'

import { directDepositKeys } from './queryKeys'

Expand Down Expand Up @@ -46,6 +47,7 @@ export const useUpdateBankInfo = () => {
} else {
queryClient.invalidateQueries({ queryKey: directDepositKeys.directDeposit })
}
registerReviewEvent()
},
onError: async (error) => {
if (isErrorObject(error)) {
Expand Down
2 changes: 2 additions & 0 deletions VAMobile/src/api/prescriptions/requestRefills.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Events, UserAnalytics } from 'constants/analytics'
import { put } from 'store/api'
import { logAnalyticsEvent, logNonFatalErrorToFirebase, setAnalyticsUserProperty } from 'utils/analytics'
import { isErrorObject } from 'utils/common'
import { registerReviewEvent } from 'utils/inAppReviews'

import { prescriptionKeys } from './queryKeys'

Expand Down Expand Up @@ -39,6 +40,7 @@ export const useRequestRefills = () => {
const prescriptionIds = variables.map((prescription) => prescription.id)
logAnalyticsEvent(Events.vama_rx_refill_success(prescriptionIds))
queryClient.invalidateQueries({ queryKey: prescriptionKeys.prescriptions })
registerReviewEvent()
},
onError: (error, variables) => {
const prescriptionIds = variables.map((prescription) => prescription.id)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'
import { useTranslation } from 'react-i18next'

import { useNavigation } from '@react-navigation/native'
import { useFocusEffect, useNavigation } from '@react-navigation/native'

import { DateTime } from 'luxon'
import { map } from 'underscore'
Expand All @@ -28,6 +28,7 @@ import { a11yLabelVA } from 'utils/a11yLabel'
import getEnv from 'utils/env'
import { capitalizeFirstLetter, displayedTextPhoneNumber } from 'utils/formattingUtils'
import { useDowntime, useTheme } from 'utils/hooks'
import { registerReviewEvent } from 'utils/inAppReviews'
import { screenContentAllowed } from 'utils/waygateConfig'

import NoDisabilityRatings from './NoDisabilityRatings/NoDisabilityRatings'
Expand All @@ -50,6 +51,12 @@ function DisabilityRatingsScreen() {
enabled: screenContentAllowed('WG_DisabilityRatings'),
})

useFocusEffect(
React.useCallback(() => {
registerReviewEvent()
}, []),
)

const individualRatingsList: Array<IndividualRatingData> = ratingData?.individualRatings || []
const totalCombinedRating = ratingData?.combinedDisabilityRating

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { a11yLabelVA } from 'utils/a11yLabel'
import { logAnalyticsEvent, setAnalyticsUserProperty } from 'utils/analytics'
import getEnv from 'utils/env'
import { useDestructiveActionSheet, useDowntime, useExternalLink, useRouteNavigation, useTheme } from 'utils/hooks'
import { registerReviewEvent } from 'utils/inAppReviews'

import { RefillTag, getDateTextAndLabel, getRxNumberTextAndLabel } from '../PrescriptionCommon'
import DetailsTextSections from './DetailsTextSections'
Expand Down Expand Up @@ -59,6 +60,7 @@ function PrescriptionDetails({ route, navigation }: PrescriptionDetailsProps) {
useFocusEffect(
React.useCallback(() => {
setAnalyticsUserProperty(UserAnalytics.vama_uses_rx())
registerReviewEvent()
}, []),
)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react'
import { useTranslation } from 'react-i18next'

import { useFocusEffect } from '@react-navigation/native'
import { StackScreenProps } from '@react-navigation/stack'

import { useTrackingInfo } from 'api/prescriptions'
Expand All @@ -26,6 +27,7 @@ import { a11yLabelID, a11yLabelVA } from 'utils/a11yLabel'
import { logAnalyticsEvent } from 'utils/analytics'
import getEnv from 'utils/env'
import { useBeforeNavBackListener, useDowntime, useTheme } from 'utils/hooks'
import { registerReviewEvent } from 'utils/inAppReviews'
import { screenContentAllowed } from 'utils/waygateConfig'

import { HealthStackParamList } from '../../HealthStackScreens'
Expand Down Expand Up @@ -72,6 +74,12 @@ function RefillTrackingDetails({ route, navigation }: RefillTrackingDetailsProps
logAnalyticsEvent(Events.vama_rx_trackdet_close(prescription.id))
})

useFocusEffect(
React.useCallback(() => {
registerReviewEvent()
}, []),
)

const renderOtherPrescription = (otherPrescriptions: Array<PrescriptionTrackingInfoOtherItem>) => {
const noOtherPrescriptions = !otherPrescriptions || otherPrescriptions.length === 0
let otherPrescriptionItems
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import { States } from 'constants/states'
import { GenerateAddressMessages } from 'translations/en/functions'
import { showSnackBar } from 'utils/common'
import { useAlert, useAppDispatch, useBeforeNavBackListener, useDestructiveActionSheet, useTheme } from 'utils/hooks'
import { registerReviewEvent } from 'utils/inAppReviews'
import { getAddressDataPayload } from 'utils/personalInformation'

import { profileAddressOptions } from '../AddressSummary'
Expand Down Expand Up @@ -282,7 +281,6 @@ function EditAddressScreen({ navigation, route }: IEditAddressScreen) {
if (data?.confirmedSuggestedAddresses) {
setShowAddressValidation(true)
} else {
registerReviewEvent()
setAddressValidated(true)
showSnackBar(snackbarMessages.successMsg, dispatch, undefined, true, false, true)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import { NAMESPACE } from 'constants/namespaces'
import { HomeStackParamList } from 'screens/HomeScreen/HomeStackScreens'
import { isErrorObject, showSnackBar } from 'utils/common'
import { useAlert, useAppDispatch, useBeforeNavBackListener, useDestructiveActionSheet, useTheme } from 'utils/hooks'
import { registerReviewEvent } from 'utils/inAppReviews'

type EditEmailScreenProps = StackScreenProps<HomeStackParamList, 'EditEmail'>

Expand Down Expand Up @@ -93,7 +92,6 @@ function EditEmailScreen({ navigation }: EditEmailScreenProps) {

const mutateOptions = {
onSuccess: () => {
registerReviewEvent()
showSnackBar(saveSnackbarMessages.successMsg, dispatch, undefined, true, false, true)
},
onError: (error: unknown) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import { HomeStackParamList } from 'screens/HomeScreen/HomeStackScreens'
import { getFormattedPhoneNumber, isErrorObject, showSnackBar } from 'utils/common'
import { formatPhoneNumber, getNumbersFromString } from 'utils/formattingUtils'
import { useAlert, useAppDispatch, useBeforeNavBackListener, useDestructiveActionSheet, useTheme } from 'utils/hooks'
import { registerReviewEvent } from 'utils/inAppReviews'

type IEditPhoneNumberScreen = StackScreenProps<HomeStackParamList, 'EditPhoneNumber'>

Expand Down Expand Up @@ -123,7 +122,6 @@ function EditPhoneNumberScreen({ navigation, route }: IEditPhoneNumberScreen) {
const save = (): void => {
const mutateOptions = {
onSuccess: () => {
registerReviewEvent()
showSnackBar(saveSnackbarMessages.successMsg, dispatch, undefined, true, false, true)
},
onError: (error: unknown) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,16 @@ import {
import { NAMESPACE } from 'constants/namespaces'
import { HomeStackParamList } from 'screens/HomeScreen/HomeStackScreens'
import { darkTheme } from 'styles/themes/colorSchemes'
import { useOrientation, useTheme } from 'utils/hooks'
import { useBeforeNavBackListener, useOrientation, useTheme } from 'utils/hooks'
import { registerReviewEvent } from 'utils/inAppReviews'

import { displayedTextPhoneNumber } from '../../../utils/formattingUtils'

// import PhotoUpload from 'components/PhotoUpload'

type VeteranStatusScreenProps = StackScreenProps<HomeStackParamList, 'VeteranStatus'>

function VeteranStatusScreen({}: VeteranStatusScreenProps) {
function VeteranStatusScreen({ navigation }: VeteranStatusScreenProps) {
const { data: militaryServiceHistoryAttributes } = useServiceHistory()
const serviceHistory = militaryServiceHistoryAttributes?.serviceHistory || ([] as ServiceHistoryData)
const mostRecentBranch = militaryServiceHistoryAttributes?.mostRecentBranch
Expand All @@ -48,6 +49,10 @@ function VeteranStatusScreen({}: VeteranStatusScreenProps) {
? t('disabilityRating.combinePercent', { combinedPercent: ratingPercent })
: undefined

useBeforeNavBackListener(navigation, () => {
registerReviewEvent()
})

const getPeriodOfService: React.ReactNode = map(serviceHistory, (service: ServiceData) => {
const branch = t('militaryInformation.branch', { branch: service.branchOfService })
return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import React from 'react'
import { useTranslation } from 'react-i18next'

import { useFocusEffect } from '@react-navigation/native'
import { StackScreenProps } from '@react-navigation/stack'

import { Box, FeatureLandingTemplate, LinkWithAnalytics, TextArea, TextView } from 'components'
import { DIRECT_DEPOSIT } from 'constants/common'
import { NAMESPACE } from 'constants/namespaces'
import { formatDateUtc } from 'utils/formattingUtils'
import { useRouteNavigation, useTheme } from 'utils/hooks'
import { registerReviewEvent } from 'utils/inAppReviews'

import { PaymentsStackParamList } from '../../PaymentsStackScreens'

Expand All @@ -19,6 +21,12 @@ function PaymentDetailsScreen({ navigation, route }: PaymentDetailsScreenProps)
const theme = useTheme()
const navigateTo = useRouteNavigation()

useFocusEffect(
React.useCallback(() => {
registerReviewEvent()
}, []),
)

const placeHolder = t('noneNoted')
const { standardMarginBetween, contentMarginTop, contentMarginBottom, gutter } = theme.dimensions
const { date, paymentType, paymentMethod, bank, account, amount } = payment?.attributes
Expand Down

0 comments on commit da88f18

Please sign in to comment.