diff --git a/app/src/@types/env.d.ts b/app/src/@types/env.d.ts index 28d3c70aa..2b6e9d3d5 100644 --- a/app/src/@types/env.d.ts +++ b/app/src/@types/env.d.ts @@ -9,7 +9,6 @@ declare module '@env' { export const FIREBASE_appId: string export const FIREBASE_measurementId: string export const FIREBASE_databaseURL: string - export const FIREBASE_smas_databaseURL: string export const FIREBASE_CLOUD_URL: string export const MAPS_API: string export const IOS_MAPS_API_KEY: string @@ -26,7 +25,6 @@ declare module '@env' { export const PROD_FIREBASE_appId: string export const PROD_FIREBASE_measurementId: string export const PROD_FIREBASE_CLOUD_URL: string - export const PROD_FIREBASE_smas_databaseURL: string export const PROD_ALGOLIA_ID: string export const PROD_ALGOLIA_KEY: string export const PROD_AUTH_ANDROID_CLIENT_ID: string diff --git a/app/src/contexts/SmasContext/index.tsx b/app/src/contexts/SmasContext/index.tsx deleted file mode 100644 index 16fad5642..000000000 --- a/app/src/contexts/SmasContext/index.tsx +++ /dev/null @@ -1,55 +0,0 @@ -import React, { createContext, useCallback, useMemo, useState } from 'react' - -import { useUtils } from '@newutils/useUtils' - -import { SmasContextType, SmasDataContext, SmasProviderProps } from './types' - -const { objectValuesAreEquals } = useUtils() - -const initialValue = { - smasDataContext: { - NIS: '', - name: '', - motherName: '', - dateOfBirth: '', - anonymizedCpf: '' - }, - clearSmasDataContext: () => { }, - getNumberOfMissingInfo: () => 0, - setSmasDataOnContext: (data: SmasDataContext) => { }, -} - -const SmasContext = createContext(initialValue) - -function SmasProvider({ children }: SmasProviderProps) { - const [smasDataContext, setSmasDataContext] = useState(initialValue.smasDataContext) - - const setSmasDataOnContext = useCallback(async (data: SmasDataContext) => { - if (objectValuesAreEquals(smasDataContext, data)) return - setSmasDataContext({ ...smasDataContext, ...data }) - }, [smasDataContext]) - - const getNumberOfMissingInfo = useCallback(() => { - const storagedInfo = [smasDataContext.motherName, smasDataContext.dateOfBirth, smasDataContext.anonymizedCpf] - return 3 - storagedInfo.filter((data) => data).length - }, [smasDataContext]) - - const clearSmasDataContext = useCallback(() => { - setSmasDataContext(initialValue.smasDataContext) - }, []) - - const smasProviderData = useMemo(() => ({ - smasDataContext, - clearSmasDataContext, - getNumberOfMissingInfo, - setSmasDataOnContext, - }), [smasDataContext]) - - return ( - - {children} - - ) -} - -export { SmasProvider, SmasContext } diff --git a/app/src/contexts/SmasContext/types.ts b/app/src/contexts/SmasContext/types.ts deleted file mode 100644 index a156a6fc2..000000000 --- a/app/src/contexts/SmasContext/types.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { ReactNode } from 'react' - -import { SmasRecoveryNISData } from '@domain/smas/entity/types' - -export interface SmasProviderProps { - children: ReactNode -} - -export type SmasDataContext = Partial - -export type SmasContextType = { - smasDataContext: SmasDataContext - clearSmasDataContext: () => void - getNumberOfMissingInfo: () => number - setSmasDataOnContext: (data: SmasDataContext) => void -} diff --git a/app/src/data/shared/storageKeys/localStorageKeys.ts b/app/src/data/shared/storageKeys/localStorageKeys.ts index 7045f3334..97b07c3c7 100644 --- a/app/src/data/shared/storageKeys/localStorageKeys.ts +++ b/app/src/data/shared/storageKeys/localStorageKeys.ts @@ -1,5 +1,4 @@ const LOCAL_USER_REPOSITORY_KEY = 'corre.user' -const LOCAL_SMAS_REPOSITORY_KEY = 'corre.smas' const LOCAL_OFFLINE_POSTS_REPOSITORY_KEY = 'corre.offlinePosts' const LOCAL_CACHE_IMAGE_CONTROL_KEY = 'corre.cacheImage' const LOCAL_OFFLINE_CITIZEN_REGISTERS_KEY = 'corre.citizenRegisters' @@ -7,7 +6,6 @@ const LOCAL_OFFLINE_CITIZEN_REGISTRATION_PROGRESS_KEY = 'corre.citizenRegisterIn export { LOCAL_USER_REPOSITORY_KEY, - LOCAL_SMAS_REPOSITORY_KEY, LOCAL_OFFLINE_POSTS_REPOSITORY_KEY, LOCAL_CACHE_IMAGE_CONTROL_KEY, LOCAL_OFFLINE_CITIZEN_REGISTERS_KEY, diff --git a/app/src/data/smas/SmasRepositoryInterface.ts b/app/src/data/smas/SmasRepositoryInterface.ts deleted file mode 100644 index 290275a4c..000000000 --- a/app/src/data/smas/SmasRepositoryInterface.ts +++ /dev/null @@ -1,13 +0,0 @@ -interface SmasRepositoryInterface { - localStorage: { - getNisValue: () => Promise - saveNisValue: (nis: string) => Promise - clearNisValue: () => Promise - } - remoteStorage: { - getNotificationTokenByNis: (nis: string) => Promise - updateSmasTokenNotification: (nis: string, tokenNotification: string) => Promise - } -} - -export { SmasRepositoryInterface } diff --git a/app/src/data/smas/localRepository/methods.ts b/app/src/data/smas/localRepository/methods.ts deleted file mode 100644 index 07cbff3a6..000000000 --- a/app/src/data/smas/localRepository/methods.ts +++ /dev/null @@ -1,42 +0,0 @@ -import AsyncStorage from '@react-native-async-storage/async-storage' - -import { LOCAL_SMAS_REPOSITORY_KEY } from '@data/shared/storageKeys/localStorageKeys' - -async function getNisValue() { - try { - const storedNis = await AsyncStorage.getItem(LOCAL_SMAS_REPOSITORY_KEY) - - if (storedNis) { - const storedNisObject = JSON.parse(storedNis) - return storedNisObject.nis - } - - return '' - } catch (error) { - console.log(error) - return '' - } -} - -async function saveNisValue(nis: string) { - try { - const nisObject = { nis } - await AsyncStorage.setItem(LOCAL_SMAS_REPOSITORY_KEY, JSON.stringify(nisObject)) - return true - } catch (error) { - console.log(error) - return false - } -} - -async function clearNisValue() { - try { - await AsyncStorage.removeItem(LOCAL_SMAS_REPOSITORY_KEY) - return true - } catch (error) { - console.log(error) - return false - } -} - -export { getNisValue, saveNisValue, clearNisValue } diff --git a/app/src/data/smas/remoteRepository/getNotificationTokenByNis.ts b/app/src/data/smas/remoteRepository/getNotificationTokenByNis.ts deleted file mode 100644 index e10e4de67..000000000 --- a/app/src/data/smas/remoteRepository/getNotificationTokenByNis.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { get } from '@react-native-firebase/database' - -import { firebaseSmasDatabase } from '@infrastructure/firebase/index' - -async function getNotificationTokenByNis(nis: string) { - try { - const realTimeDatabaseRef = firebaseSmasDatabase.ref(`${nis}`) - const snapshot = await get(realTimeDatabaseRef) - const token: string = snapshot.val() || '' - return token - } catch (error) { - console.log(error) - return false - } -} - -export { getNotificationTokenByNis } diff --git a/app/src/data/smas/remoteRepository/updateSmasTokenNotification.ts b/app/src/data/smas/remoteRepository/updateSmasTokenNotification.ts deleted file mode 100644 index 7b8a2e1e0..000000000 --- a/app/src/data/smas/remoteRepository/updateSmasTokenNotification.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { set } from '@react-native-firebase/database' - -import { firebaseSmasDatabase } from '@infrastructure/firebase/index' - -async function updateSmasTokenNotification(nis: string, userId: string) { - try { - const dbRef = firebaseSmasDatabase.ref(`${nis}`) - await set(dbRef, userId) - return true - } catch (error) { - console.log(error) - return false - } -} - -export { updateSmasTokenNotification } diff --git a/app/src/data/smas/useSmasRepository.ts b/app/src/data/smas/useSmasRepository.ts deleted file mode 100644 index 144426dda..000000000 --- a/app/src/data/smas/useSmasRepository.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { clearNisValue, getNisValue, saveNisValue } from './localRepository/methods' -import { getNotificationTokenByNis } from './remoteRepository/getNotificationTokenByNis' -import { updateSmasTokenNotification } from './remoteRepository/updateSmasTokenNotification' -import { SmasRepositoryInterface } from './SmasRepositoryInterface' - -function useSmasRepository(): SmasRepositoryInterface { - return { - localStorage: { - getNisValue: getNisValue, - saveNisValue: saveNisValue, - clearNisValue: clearNisValue - }, - remoteStorage: { - getNotificationTokenByNis: getNotificationTokenByNis, - updateSmasTokenNotification: updateSmasTokenNotification - } - } -} - -export { useSmasRepository } diff --git a/app/src/domain/post/PostDomainInterface.ts b/app/src/domain/post/PostDomainInterface.ts index d5eda93a9..bdd2dc21b 100644 --- a/app/src/domain/post/PostDomainInterface.ts +++ b/app/src/domain/post/PostDomainInterface.ts @@ -4,8 +4,6 @@ import { PostRepositoryInterface } from '@data/post/PostRepositoryInterface' import { PostEntity } from './entity/types' -import { CloudFunctionServiceInterface } from '@services/cloudFunctions/CloudFunctionServiceInterface' - import { PostRangeLocation } from './core/updatePostsLocation' interface PostDomainInterface { @@ -27,12 +25,10 @@ interface PostDomainInterface { updateLocationDataOnPosts(userId: string, newPostRangeLocation: PostRangeLocation, subscriptionDowngrade?: boolean): Promise savePost( usePostRepository: () => PostRepositoryInterface, - useCloudFunctionService: () => CloudFunctionServiceInterface, userSubscriptionRange: UserSubscription['subscriptionRange'], storedPostData: PostEntity, newPostData: PostEntity, - unsavedPostPictures: string[], - notifyUsersByLocation?: boolean + unsavedPostPictures: string[] ): Promise<{ newPost: PostEntity }> approvePost(usePostRepository: () => PostRepositoryInterface, postData: PostEntity): Promise rejectPost(usePostRepository: () => PostRepositoryInterface, postData: PostEntity): Promise diff --git a/app/src/domain/post/methods/savePostDM.ts b/app/src/domain/post/methods/savePostDM.ts index 46470104a..54e5f4413 100644 --- a/app/src/domain/post/methods/savePostDM.ts +++ b/app/src/domain/post/methods/savePostDM.ts @@ -3,9 +3,6 @@ import { UserSubscription } from '@domain/user/entity/types' import { PostRepositoryInterface } from '@data/post/PostRepositoryInterface' import { PostEntity } from '../entity/types' -import { NotifyUsersByLocationParams } from '@services/cloudFunctions/types/types' - -import { CloudFunctionServiceInterface } from '@services/cloudFunctions/CloudFunctionServiceInterface' import { mediaUrlUpdatedDM } from '../core/editPostValidationDM' import { postLocationChangedDM } from '../core/postLocationChangedDM' @@ -13,18 +10,13 @@ import { updateLocationDataOnPostsDM } from './updateLocationDataOnPostsDM' async function savePostDM( usePostRepository: () => PostRepositoryInterface, - useCloudFunctionService: () => CloudFunctionServiceInterface, userSubscriptionRange: UserSubscription['subscriptionRange'], // REFACTOR Validar internamente com nova consulta de user storedPostData: PostEntity, newPostData: PostEntity, - unsavedPostPictures: string[], - notifyUsersByLocation?: boolean + unsavedPostPictures: string[] ) { - const { notifyUsersOnLocation } = useCloudFunctionService() const { remoteStorage } = usePostRepository() - const owner = { ...newPostData.owner } - const postLocationIsOutsideSubscriptionRange = await postLocationChangedDM( userSubscriptionRange, storedPostData, @@ -88,19 +80,6 @@ async function savePostDM( const newStoredPost = await remoteStorage.createPost(newPostWithUploadedPictures as PostEntity) - if (notifyUsersByLocation) { - await notifyUsersOnLocation({ - state: newPostData.unapprovedData?.location?.state as string, - city: newPostData.unapprovedData?.location?.city as string, - district: newPostData.unapprovedData?.location?.district as string, - postRange: newPostData.unapprovedData?.range as NotifyUsersByLocationParams['postRange'] - }, { - postDescription: newPostData.unapprovedData?.description || 'Nova postagem', - userId: owner.userId, - userName: owner.name - }) - } - return { newPost: { ...newStoredPost } as PostEntity } } diff --git a/app/src/domain/smas/SmasDomainInterface.ts b/app/src/domain/smas/SmasDomainInterface.ts deleted file mode 100644 index 4f3b8e2f9..000000000 --- a/app/src/domain/smas/SmasDomainInterface.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { Id } from '@domain/globalTypes' -import { QueryBeeResult, QueryCadunicoResult, QueryPbfResult, SmasService } from '@domain/smas/entity/types' - -import { SmasRepositoryInterface } from '@data/smas/SmasRepositoryInterface' - -interface SmasDomainInterface { - validateNIS: (NISValue: string) => boolean - validateName: (name: string) => boolean - treatSmasApiResponse: (apiResponse: any, smasService: SmasService) => QueryBeeResult | QueryPbfResult | QueryCadunicoResult | { nisNotFound: boolean } - setNisOnLocalRepository: (nis: string, useSmasRepository: () => SmasRepositoryInterface) => Promise - getNisFromLocalRepository: (useSmasRepository: () => SmasRepositoryInterface) => Promise - smasNisHasLinkedWithUser: (nis: string, useSmasRepository: () => SmasRepositoryInterface) => Promise - setSmasPushNotificationState: (state: boolean, nis: string, userId: Id, useSmasRepository: () => SmasRepositoryInterface) => Promise -} - -export { SmasDomainInterface } diff --git a/app/src/domain/smas/core/checkSmasApiResponseStatus.ts b/app/src/domain/smas/core/checkSmasApiResponseStatus.ts deleted file mode 100644 index 3e45965ff..000000000 --- a/app/src/domain/smas/core/checkSmasApiResponseStatus.ts +++ /dev/null @@ -1,8 +0,0 @@ -function checkSmasApiResponseStatus(apiResponse: any) { - if (apiResponse === 404) return [{ nisNotFound: true }, true] - if (apiResponse === 500) return [{ serverError: true }, true] - - return [{ ...apiResponse }, false] -} - -export { checkSmasApiResponseStatus } diff --git a/app/src/domain/smas/core/structureBeeObject.ts b/app/src/domain/smas/core/structureBeeObject.ts deleted file mode 100644 index 5d476d918..000000000 --- a/app/src/domain/smas/core/structureBeeObject.ts +++ /dev/null @@ -1,55 +0,0 @@ -import { BEE, Binary } from '@domain/smas/entity/types' - -import { DateFnsAdapter } from '@infrastructure/Date/DateAdapter' - -function benefitWasRequested(benefitRequested: Binary) { - return benefitRequested === '1' -} - -function getBenefitGranted(foodCardGranted: Binary, accountDepositGranted: Binary) { - return foodCardGranted === '1' - ? 'cartão alimentação' - : accountDepositGranted === '1' - ? 'depósito em conta' - : '' -} - -function benefitUnderAnalysis(benefitNotGranted: Binary, foodCardGranted: Binary, accountDepositGranted: Binary) { - return benefitNotGranted === '0' && foodCardGranted === '0' && accountDepositGranted === '0' -} - -function generateExpectReleaseDate(dateStr: string, daysAhead?: boolean) { - try { - const { addDays, format } = DateFnsAdapter() - - const regex = /^(\d{1,2})\/(\d{1,2})\/(\d{4})$/ - const match = dateStr.match(regex) - if (!match) return null - const [, dia, mes, ano] = match.map(Number) - - const formatedDay = dia < 10 ? `0${dia}` : dia.toString() - const formatedMonth = mes < 10 ? `0${mes}` : mes.toString() - const formatedStringDate = `${formatedDay}/${formatedMonth}/${ano}` - - const date = new Date(`${ano}-${formatedMonth}-${formatedDay}`) - const newDate = addDays(date, 10) - const newDateStr = format(newDate, 'dd/MM/yyyy') - return daysAhead ? newDateStr : formatedStringDate - } catch (err) { - console.log(err) - return null - } -} - -function structureBeeObject(responseData: BEE) { - return { - NIS: responseData.nis, - benefitRequested: benefitWasRequested(responseData.solicitacao_beneficio), - benefitGranted: getBenefitGranted(responseData.cartao_alimentacao_concedido, responseData.deposito_conta_concedido), - inAnalysis: benefitUnderAnalysis(responseData.beneficio_nao_concedido, responseData.cartao_alimentacao_concedido, responseData.deposito_conta_concedido), - grantDate: generateExpectReleaseDate(responseData.data_concedido) || responseData || 'data indisponível', - expectedDate: generateExpectReleaseDate(responseData.data_concedido, true) || 'data indisponível', - } -} - -export { structureBeeObject } diff --git a/app/src/domain/smas/core/structureCadunicoObject.ts b/app/src/domain/smas/core/structureCadunicoObject.ts deleted file mode 100644 index 69b1757cc..000000000 --- a/app/src/domain/smas/core/structureCadunicoObject.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { CADUNICO } from '@domain/smas/entity/types' - -function structureCadunicoObject(responseData: CADUNICO) { - return { - NIS: responseData.nis, - name: responseData.nome, - expirationDate: responseData.vencimento_previsto, - status: responseData.condicao, - lastUpdate: responseData.data_ultima_atualizacao - } -} - -export { structureCadunicoObject } diff --git a/app/src/domain/smas/core/structurePbfObject.ts b/app/src/domain/smas/core/structurePbfObject.ts deleted file mode 100644 index abdf1eb07..000000000 --- a/app/src/domain/smas/core/structurePbfObject.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { PBF } from '@domain/smas/entity/types' - -function structurePbfObject(responseData: PBF) { - return { - NIS: responseData.nis, - status: responseData.status, - familyBagName: responseData.nome, - familyBagValue: responseData.valor - } -} - -export { structurePbfObject } diff --git a/app/src/domain/smas/core/validatSmasInfo.ts b/app/src/domain/smas/core/validatSmasInfo.ts deleted file mode 100644 index 2427ec238..000000000 --- a/app/src/domain/smas/core/validatSmasInfo.ts +++ /dev/null @@ -1,12 +0,0 @@ -const validateNIS = (NISValue: string) => { - const cleanValue = NISValue.trim() - const NISNumbers = cleanValue.match(/\d+/g) - return NISNumbers ? NISNumbers.join('').length === 11 : false -} - -const validateName = (NISValue: string) => { - const cleanName = NISValue.replace(/[^a-zA-Z]/g, '') - return /^[a-zA-Z]+$/.test(cleanName) -} - -export { validateNIS, validateName } diff --git a/app/src/domain/smas/entity/index.ts b/app/src/domain/smas/entity/index.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/app/src/domain/smas/entity/types.ts b/app/src/domain/smas/entity/types.ts deleted file mode 100644 index 21a274df0..000000000 --- a/app/src/domain/smas/entity/types.ts +++ /dev/null @@ -1,67 +0,0 @@ -export type SmasService = 'BEE' | 'PBF' | 'CADUNICO' | 'ANONIMIZADO' - -export type Binary = '0' | '1' -type BeeType = 'cartão alimentação' | 'depósito em conta' -type PbfStatus = 'Liberado' | 'Suspenso' | 'Bloqueado' -type CadunicoStatus = 'Atualizado' | 'Desatualizado' - -export type BEE = { - nis: string - nome: string - solicitacao_beneficio: Binary - deposito_conta_concedido: Binary - cartao_alimentacao_concedido: Binary - beneficio_nao_concedido: Binary - data_concedido: string -} - -export type PBF = { - nis: string - nome: string - status: PbfStatus - valor: string -} - -export type CADUNICO = { - nis: string - nome: string - data_ultima_atualizacao: string - condicao: CadunicoStatus - vencimento_previsto: string -} - -export interface SmasRecoveryNISData { - NIS: string - name: string - motherName: string - dateOfBirth: string - anonymizedCpf: string -} - -export type QueryBeeResult = { - nisNotFound?: boolean - serverError?: boolean - benefitRequested: boolean - inAnalysis: boolean - benefitGranted: BeeType - grantDate: string - expectedDate: string -} - -export type QueryPbfResult = { - nisNotFound?: boolean - serverError?: boolean - NIS: string - status: PbfStatus - familyBagName: string - familyBagValue: string -} - -export type QueryCadunicoResult = { - nisNotFound?: boolean - serverError?: boolean - NIS: string // Obsoleto - name: string // Obsoleto - status: CadunicoStatus - lastUpdate: string -} diff --git a/app/src/domain/smas/methods/getNisFromLocalRepositoryDM.ts b/app/src/domain/smas/methods/getNisFromLocalRepositoryDM.ts deleted file mode 100644 index 7d4b28a40..000000000 --- a/app/src/domain/smas/methods/getNisFromLocalRepositoryDM.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { SmasRepositoryInterface } from '@data/smas/SmasRepositoryInterface' - -async function getNisFromLocalRepositoryDM(useSmasRepository: () => SmasRepositoryInterface) { - const { localStorage } = useSmasRepository() - return localStorage.getNisValue() -} - -export { getNisFromLocalRepositoryDM } diff --git a/app/src/domain/smas/methods/setNisOnLocalRepositoryDM.ts b/app/src/domain/smas/methods/setNisOnLocalRepositoryDM.ts deleted file mode 100644 index c370f6297..000000000 --- a/app/src/domain/smas/methods/setNisOnLocalRepositoryDM.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { SmasRepositoryInterface } from '@data/smas/SmasRepositoryInterface' - -async function setNisOnLocalRepositoryDM(nis: string, useSmasRepository: () => SmasRepositoryInterface) { - const { localStorage } = useSmasRepository() - return localStorage.saveNisValue(nis) -} - -export { setNisOnLocalRepositoryDM } diff --git a/app/src/domain/smas/methods/setSmasPushNotificationStateDM.ts b/app/src/domain/smas/methods/setSmasPushNotificationStateDM.ts deleted file mode 100644 index 5aba2ae6e..000000000 --- a/app/src/domain/smas/methods/setSmasPushNotificationStateDM.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { Id } from '@domain/globalTypes' - -import { SmasRepositoryInterface } from '@data/smas/SmasRepositoryInterface' - -async function setSmasPushNotificationStateDM(state: boolean, nis: string, userId: Id, useSmasRepository: () => SmasRepositoryInterface) { - const { remoteStorage } = useSmasRepository() - - try { - if (state) { - await remoteStorage.updateSmasTokenNotification(nis, userId) - } else { - await remoteStorage.updateSmasTokenNotification(nis, '') // REFACTOR trocar por método delete quando onis chegar vazio, para remover resquícios do realtime database - } - } catch (err) { - console.log(err) - } -} - -export { setSmasPushNotificationStateDM } diff --git a/app/src/domain/smas/methods/smasNisHasLinkedWithUserDM.ts b/app/src/domain/smas/methods/smasNisHasLinkedWithUserDM.ts deleted file mode 100644 index 4548b09be..000000000 --- a/app/src/domain/smas/methods/smasNisHasLinkedWithUserDM.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { SmasRepositoryInterface } from '@data/smas/SmasRepositoryInterface' - -async function smasNisHasLinkedWithUserDM(nis: string, useSmasRepository: () => SmasRepositoryInterface) { - const { localStorage, remoteStorage } = useSmasRepository() - - const linkedNis = nis || await localStorage.getNisValue() - - if (!linkedNis) return false - - const smasTokenNotification = await remoteStorage.getNotificationTokenByNis(linkedNis) - return !!smasTokenNotification -} - -export { smasNisHasLinkedWithUserDM } diff --git a/app/src/domain/smas/methods/treatSmasApiResponseDM.ts b/app/src/domain/smas/methods/treatSmasApiResponseDM.ts deleted file mode 100644 index af3827ece..000000000 --- a/app/src/domain/smas/methods/treatSmasApiResponseDM.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { SmasService } from '@domain/smas/entity/types' - -import { checkSmasApiResponseStatus } from '../core/checkSmasApiResponseStatus' -import { structureBeeObject } from '../core/structureBeeObject' -import { structureCadunicoObject } from '../core/structureCadunicoObject' -import { structurePbfObject } from '../core/structurePbfObject' - -const treatSmasApiResponseDM = (apiResponse: any, smasService: SmasService) => { - const [responseData, hasError] = checkSmasApiResponseStatus(apiResponse) - - if (hasError) return responseData - - switch (smasService) { - case 'BEE': return structureBeeObject(responseData) - case 'PBF': return structurePbfObject(responseData) - case 'CADUNICO': return structureCadunicoObject(responseData) - default: return { nisNotFound: true } - } -} - -export { treatSmasApiResponseDM } diff --git a/app/src/domain/smas/methods/validateNISDM.ts b/app/src/domain/smas/methods/validateNISDM.ts deleted file mode 100644 index 779c64cf4..000000000 --- a/app/src/domain/smas/methods/validateNISDM.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { validateNIS } from '../core/validatSmasInfo' - -const validateNISDM = (NISValue: string) => { - return validateNIS(NISValue) -} - -export { validateNISDM } diff --git a/app/src/domain/smas/methods/validateNameDM.ts b/app/src/domain/smas/methods/validateNameDM.ts deleted file mode 100644 index 23cc8b60b..000000000 --- a/app/src/domain/smas/methods/validateNameDM.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { validateName } from '../core/validatSmasInfo' - -const validateNameDM = (NISValue: string) => { - return validateName(NISValue) -} - -export { validateNameDM } diff --git a/app/src/domain/smas/useSmasDomain.ts b/app/src/domain/smas/useSmasDomain.ts deleted file mode 100644 index 3671c3476..000000000 --- a/app/src/domain/smas/useSmasDomain.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { getNisFromLocalRepositoryDM } from './methods/getNisFromLocalRepositoryDM' -import { setNisOnLocalRepositoryDM } from './methods/setNisOnLocalRepositoryDM' -import { setSmasPushNotificationStateDM } from './methods/setSmasPushNotificationStateDM' -import { smasNisHasLinkedWithUserDM } from './methods/smasNisHasLinkedWithUserDM' -import { treatSmasApiResponseDM } from './methods/treatSmasApiResponseDM' -import { validateNameDM } from './methods/validateNameDM' -import { validateNISDM } from './methods/validateNISDM' -import { SmasDomainInterface } from './SmasDomainInterface' - -function useSmasDomain(): SmasDomainInterface { - return { - validateNIS: validateNISDM, - validateName: validateNameDM, - treatSmasApiResponse: treatSmasApiResponseDM, - setNisOnLocalRepository: setNisOnLocalRepositoryDM, - getNisFromLocalRepository: getNisFromLocalRepositoryDM, - smasNisHasLinkedWithUser: smasNisHasLinkedWithUserDM, - setSmasPushNotificationState: setSmasPushNotificationStateDM - } -} - -export { useSmasDomain } diff --git a/app/src/infrastructure/environment/index.ts b/app/src/infrastructure/environment/index.ts index ce241e902..92f58d8b4 100644 --- a/app/src/infrastructure/environment/index.ts +++ b/app/src/infrastructure/environment/index.ts @@ -10,8 +10,6 @@ import { FIREBASE_appId, FIREBASE_measurementId, FIREBASE_databaseURL, - FIREBASE_smas_databaseURL, - PROD_FIREBASE_smas_databaseURL, FIREBASE_CLOUD_URL, AUTH_ANDROID_CLIENT_ID, AUTH_IOS_CLIENT_ID, @@ -58,7 +56,6 @@ type EnvironmentVars = { FIREBASE_appId: string FIREBASE_measurementId: string FIREBASE_databaseURL: string - FIREBASE_smas_databaseURL: string FIREBASE_CLOUD_URL: string MAPS_API: string IOS_MAPS_API_KEY: string @@ -100,7 +97,6 @@ const ENV = { FIREBASE_appId, FIREBASE_measurementId, FIREBASE_databaseURL, - FIREBASE_smas_databaseURL, FIREBASE_CLOUD_URL, MAPS_API, IOS_MAPS_API_KEY, @@ -123,7 +119,6 @@ const ENV = { FIREBASE_appId: PROD_FIREBASE_appId, FIREBASE_measurementId: PROD_FIREBASE_measurementId, FIREBASE_databaseURL: PROD_FIREBASE_databaseURL, - FIREBASE_smas_databaseURL: PROD_FIREBASE_smas_databaseURL, FIREBASE_CLOUD_URL: PROD_FIREBASE_CLOUD_URL, MAPS_API: PROD_MAPS_API, IOS_MAPS_API_KEY: PROD_IOS_MAPS_API_KEY, diff --git a/app/src/infrastructure/firebase/index.ts b/app/src/infrastructure/firebase/index.ts index b387fd2a4..458793336 100644 --- a/app/src/infrastructure/firebase/index.ts +++ b/app/src/infrastructure/firebase/index.ts @@ -10,10 +10,6 @@ import firestore from '@react-native-firebase/firestore' import functions from '@react-native-firebase/functions' import storage from '@react-native-firebase/storage' -import { getEnvVars } from '@infrastructure/environment' - -const { FIREBASE_smas_databaseURL } = getEnvVars() - firebase.setReactNativeAsyncStorage(AsyncStorage) export const firebaseAuth = auth() @@ -22,8 +18,6 @@ export const firebaseStorage = storage() export const firebaseDatabase = database() export const firebaseAnalytics = analytics() export const firebaseFunctions = firebase.app().functions('southamerica-east1') || functions() -// -export const firebaseSmasDatabase = firebase.app().database(FIREBASE_smas_databaseURL) export const authProviders = { PhoneAuthProvider: auth.PhoneAuthProvider, diff --git a/app/src/newutils/methods/analyticsEvents.ts b/app/src/newutils/methods/analyticsEvents.ts index f0905a8a2..6a67bdb97 100644 --- a/app/src/newutils/methods/analyticsEvents.ts +++ b/app/src/newutils/methods/analyticsEvents.ts @@ -7,7 +7,7 @@ import { MacroCategoriesType } from '@utils/postMacroCategories/types' import { firebaseAnalytics } from '@infrastructure/firebase' -type EventName = 'opened_app' | 'opened_auth_screen' | 'user_authed' | 'user_posted' | 'chat_started' | 'reported_impact' | 'user_opened_screen' | 'user_subscribed' | 'smas_search' | 'recovery_nis' | 'visualized_post' | 'visualized_petition' | 'visualized_poll' +type EventName = 'opened_app' | 'opened_auth_screen' | 'user_authed' | 'user_posted' | 'chat_started' | 'reported_impact' | 'user_opened_screen' | 'user_subscribed' | 'visualized_post' | 'visualized_petition' | 'visualized_poll' interface EventObject extends Record { // deviceId?: string @@ -26,8 +26,6 @@ interface EventObject extends Record - - - - - diff --git a/app/src/presentation/assets/icons/recycle-white.svg b/app/src/presentation/assets/icons/recycle-white.svg deleted file mode 100644 index 915af8cb5..000000000 --- a/app/src/presentation/assets/icons/recycle-white.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/app/src/presentation/components/AdsCarousel/index.tsx b/app/src/presentation/components/AdsCarousel/index.tsx index 438a9381d..9a679d2ba 100644 --- a/app/src/presentation/components/AdsCarousel/index.tsx +++ b/app/src/presentation/components/AdsCarousel/index.tsx @@ -9,18 +9,16 @@ import { relativeScreenHeight } from '@common/screenDimensions' import { theme } from '@common/theme' import { OptionButton } from '@components/_buttons/OptionButton' -import { PublicServicesAdButton } from '@components/_buttons/PublicServicesAdButton' import { SubscriptionButton } from '@components/_buttons/SubscriptionButton' import { CustomCarousel } from '@components/CustomCarousel' interface AdsCarouselProps { onPressCorreAd?: () => void onPressUserLocationAd?: () => void - onPressPublicServicesAd?: () => void onPressEventCalendarAd?: () => void } -function AdsCarousel({ onPressCorreAd, onPressUserLocationAd, onPressPublicServicesAd, onPressEventCalendarAd }: AdsCarouselProps) { +function AdsCarousel({ onPressCorreAd, onPressUserLocationAd, onPressEventCalendarAd }: AdsCarouselProps) { const userRange = checkFreeTrialRange('city') const navigation = useNavigation() @@ -35,11 +33,6 @@ function AdsCarousel({ onPressCorreAd, onPressUserLocationAd, onPressPublicServi return ( - - onPressPublicServicesAd && onPressPublicServicesAd()} - /> - {/* // SMAS */} {/* onPressUserLocationAd && onPressUserLocationAd()} /> diff --git a/app/src/presentation/components/EditPost/index.tsx b/app/src/presentation/components/EditPost/index.tsx index 106a6a8d6..569afa1e0 100644 --- a/app/src/presentation/components/EditPost/index.tsx +++ b/app/src/presentation/components/EditPost/index.tsx @@ -13,12 +13,10 @@ import { usePostRepository } from '@data/post/usePostRepository' import { useAlertContext } from '@contexts/AlertContext' import { useAuthContext } from '@contexts/AuthContext' -import { useCloudFunctionService } from '@services/cloudFunctions/useCloudFunctionService' import { checkFreeTrialRange } from '@services/stripe/checkFreeTrialRange' import { getNetworkStatus } from '@utils/deviceNetwork' import { Body, BodyPadding, Container, Header, PostCardContainer, SaveButtonContainer } from './styles' -// import BellWhiteIcon from '@assets/icons/bell-white.svg' // SMAS import CheckWhiteIcon from '@assets/icons/check-white.svg' import HandOnMoneyWhiteIcon from '@assets/icons/handOnMoney-white.svg' import PlusWhiteIcon from '@assets/icons/plus-white.svg' @@ -99,7 +97,6 @@ function EditPost({ const [defaultConfirmationModalIsVisible, setDefaultConfirmationModalIsVisible] = useState(false) const [offlinePostAlertModalIsVisible, setOfflinePostAlertModalIsVisible] = useState(false) const [networkConnectionIsValid, setNetworkConnectionIsValid] = useState(false) - // const [notifyUsersEnabled, setNotifyUsersEnabled] = useState(false) // SMAS const { editDataContext } = editContext const { userDataContext } = userContext @@ -194,12 +191,10 @@ function EditPost({ const { newPost } = await savePost( usePostRepository, - useCloudFunctionService, range, initialPostData, postWithUnapprovedData, postWithUnapprovedData.unapprovedData?.picturesUrl || [] - // notifyUsersEnabled ) addUserPost(newPost) @@ -238,11 +233,6 @@ function EditPost({ editContext.setEditDataOnContext(newEditState) } - // const userHasGovernmentProfileSeal = () => { - // return userDataContext.verified - // && (userDataContext.verified.type === 'government' || userDataContext.verified.admin) - // } - const cancelAllChangesAndGoBack = () => { if ((!Object.keys(editDataContext.unsaved).length) && !offlinePost && !unsavedPost) { navigateBackwards() @@ -260,10 +250,6 @@ function EditPost({ setOfflinePostAlertModalIsVisible((previousState) => !previousState) } - // const toggleNotifyUsers = () => { - // setNotifyUsersEnabled(!notifyUsersEnabled) - // } - const userSubscribeIsValid = () => { // REFACTOR domain const { betweenRange, range } = checkFreeTrialRange('country') if (betweenRange) return range @@ -370,23 +356,6 @@ function EditPost({ ? : ( - {/* { // SMAS - userHasGovernmentProfileSeal() && unsavedPost && ( - - ) - } */} diff --git a/app/src/presentation/components/_buttons/PublicServicesAdButton/index.tsx b/app/src/presentation/components/_buttons/PublicServicesAdButton/index.tsx deleted file mode 100644 index 205672c15..000000000 --- a/app/src/presentation/components/_buttons/PublicServicesAdButton/index.tsx +++ /dev/null @@ -1,37 +0,0 @@ -import React from 'react' -import { useTheme } from 'styled-components/native' - -import PublicServicesWhiteIcon from '@assets/icons/publicServices-white.svg' -import { relativeScreenHeight } from '@common/screenDimensions' - -import { OptionButton } from '../OptionButton' - -interface PublicServicesAdButtonProps { - customTitle?: string - onPress: () => void -} - -function PublicServicesAdButton({ customTitle = '', onPress }: PublicServicesAdButtonProps) { - const theme = useTheme() - - return ( - - ) -} - -export { PublicServicesAdButton } diff --git a/app/src/presentation/components/_modals/InsertNisModal/index.tsx b/app/src/presentation/components/_modals/InsertNisModal/index.tsx deleted file mode 100644 index e6b7ddc52..000000000 --- a/app/src/presentation/components/_modals/InsertNisModal/index.tsx +++ /dev/null @@ -1,48 +0,0 @@ -import React from 'react' - -import PublicServicesWhiteIcon from '@assets/icons/publicServices-white.svg' - -import { CustomModal } from '../CustomModal' - -interface InsertNisModalProps { - initialInputValue: string - visibility: boolean - validateNis: (nis: string) => boolean - closeModal: () => void - onPressButton: (value?: string) => void -} - -function InsertNisModal({ - initialInputValue, - visibility, - validateNis, - closeModal, - onPressButton -}: InsertNisModalProps) { - return ( - - ) -} - -export { InsertNisModal } diff --git a/app/src/presentation/routes/Stack/HomeStack/index.tsx b/app/src/presentation/routes/Stack/HomeStack/index.tsx index 6ac84a0ad..d80e45adb 100644 --- a/app/src/presentation/routes/Stack/HomeStack/index.tsx +++ b/app/src/presentation/routes/Stack/HomeStack/index.tsx @@ -17,8 +17,6 @@ import { Profile } from '@screens/profileScreens/Profile' import { SocialMediaManagement } from '@screens/profileScreens/SocialMediaManagement' import { PostView } from '@screens/viewPostScreens/PostView' -import { PublicServicesStack } from '../PublicServicesStack' - const Stack = createStackNavigator() export function HomeStack({ route, navigation }: any) { // REFACTOR Type Routes @@ -49,7 +47,6 @@ export function HomeStack({ route, navigation }: any) { // REFACTOR Type Routes - ) diff --git a/app/src/presentation/routes/Stack/HomeStack/screenProps.ts b/app/src/presentation/routes/Stack/HomeStack/screenProps.ts index aa96b77d5..f2f23b54a 100644 --- a/app/src/presentation/routes/Stack/HomeStack/screenProps.ts +++ b/app/src/presentation/routes/Stack/HomeStack/screenProps.ts @@ -12,5 +12,3 @@ export type SearchResultScreenProps = NativeStackScreenProps export type PostViewHomeScreenProps = NativeStackScreenProps export type SocialMediaManagementHomeScreenProps = NativeStackScreenProps - -export type PublicServicesStackScreenProps = NativeStackScreenProps diff --git a/app/src/presentation/routes/Stack/HomeStack/types.ts b/app/src/presentation/routes/Stack/HomeStack/types.ts index 01f76752e..217c793d6 100644 --- a/app/src/presentation/routes/Stack/HomeStack/types.ts +++ b/app/src/presentation/routes/Stack/HomeStack/types.ts @@ -17,5 +17,4 @@ export type HomeStackParamList = { PostViewHome: { postData: PostEntity, redirectedPostId: string } SocialMediaManagementHome: { socialMedias?: SocialMedia[], isAuthor?: boolean } - PublicServicesStack: undefined } & UserStackParamList diff --git a/app/src/presentation/routes/Stack/ProfileStack/index.tsx b/app/src/presentation/routes/Stack/ProfileStack/index.tsx index 469eb0339..0750c4c97 100644 --- a/app/src/presentation/routes/Stack/ProfileStack/index.tsx +++ b/app/src/presentation/routes/Stack/ProfileStack/index.tsx @@ -16,7 +16,6 @@ import { HelpUs } from '@screens/configurationScreens/HelpUs' import { InsertCellNumberLinkAccount } from '@screens/configurationScreens/InsertCellNumberLinkAccount' import { InsertConfirmationCodeLinkAccount } from '@screens/configurationScreens/InsertConfirmationCodeLinkAccount' import { LinkingAccountResult } from '@screens/configurationScreens/LinkingAccountResult' -import { NotificationPublicServicesSettings } from '@screens/configurationScreens/NotificationPublicServicesSettings' import { NotificationSettings } from '@screens/configurationScreens/NotificationtSettings' import { PrivacyAndSecurity } from '@screens/configurationScreens/PrivacyAndSecurity' import { UserDataConfigurations } from '@screens/configurationScreens/UserDataConfigurations' @@ -92,7 +91,6 @@ export function ProfileStack({ route, navigation }: any) { // REFACTOR type rout - diff --git a/app/src/presentation/routes/Stack/ProfileStack/screenProps.ts b/app/src/presentation/routes/Stack/ProfileStack/screenProps.ts index c8d456db5..d209d745e 100644 --- a/app/src/presentation/routes/Stack/ProfileStack/screenProps.ts +++ b/app/src/presentation/routes/Stack/ProfileStack/screenProps.ts @@ -36,5 +36,4 @@ export type ContactUsSuccessScreenProps = NativeStackScreenProps export type UserDataConfigurationsScreenProps = NativeStackScreenProps export type NotificationSettingsScreenProps = NativeStackScreenProps -export type NotificationPublicServicesSettingsScreenProps = NativeStackScreenProps export type PostViewScreenProps = NativeStackScreenProps diff --git a/app/src/presentation/routes/Stack/ProfileStack/types.ts b/app/src/presentation/routes/Stack/ProfileStack/types.ts index 4e4a07b86..ab1cb5205 100644 --- a/app/src/presentation/routes/Stack/ProfileStack/types.ts +++ b/app/src/presentation/routes/Stack/ProfileStack/types.ts @@ -41,7 +41,6 @@ export type ProfileStackParamList = { PrivacyAndSecurity: undefined UserDataConfigurations: undefined NotificationSettings: undefined - NotificationPublicServicesSettings: undefined PostView: any } & UserStackParamList diff --git a/app/src/presentation/routes/Stack/PublicServicesStack/index.tsx b/app/src/presentation/routes/Stack/PublicServicesStack/index.tsx deleted file mode 100644 index 36dd1529e..000000000 --- a/app/src/presentation/routes/Stack/PublicServicesStack/index.tsx +++ /dev/null @@ -1,51 +0,0 @@ -import 'react-native-gesture-handler' -import { createStackNavigator, TransitionPresets } from '@react-navigation/stack' -import React from 'react' - -import { SmasProvider } from '@contexts/SmasContext' - -import { PublicServiceStackParamList } from './types' - -import { NotificationPublicServicesSettings } from '@screens/configurationScreens/NotificationPublicServicesSettings' -import { InsertMotherNameNIS } from '@screens/smasScreens/InserMotherNameNIS' -import { InsertAnonymizedCpfNIS } from '@screens/smasScreens/InsertAnonymizedCpfNIS' -import { InsertNameNIS } from '@screens/smasScreens/InsertNameNIS' -import { InsertNIS } from '@screens/smasScreens/InsertNIS' -import { InsertDateOfBirthNIS } from '@screens/smasScreens/InsetDateOfBirthNIS' -import { QueryBeeByNISResult } from '@screens/smasScreens/QueryBeeByNISResult' -import { QueryCadunicoByNISResult } from '@screens/smasScreens/QueryCadunicoByNISResult' -import { QueryNISResult } from '@screens/smasScreens/QueryNISResult' -import { QueryPbfByNISResult } from '@screens/smasScreens/QueryPbfByNISResult' -import { SelectNISQueryData } from '@screens/smasScreens/SelectNISQueryData' -import { SelectPublicService } from '@screens/smasScreens/SelectPublicService' - -const Stack = createStackNavigator() - -export function PublicServicesStack() { - return ( - - - - - - - - - - - - - - - - - - ) -} diff --git a/app/src/presentation/routes/Stack/PublicServicesStack/screenProps.ts b/app/src/presentation/routes/Stack/PublicServicesStack/screenProps.ts deleted file mode 100644 index da9e1477a..000000000 --- a/app/src/presentation/routes/Stack/PublicServicesStack/screenProps.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { NativeStackScreenProps } from '@react-navigation/native-stack' - -import { PublicServiceStackParamList } from './types' - -export type SelectPublicServiceScreenProps = NativeStackScreenProps -export type InsertNISScreenProps = NativeStackScreenProps -export type InsertNameNISScreenProps = NativeStackScreenProps -export type SelectNISQueryDataScreenProps = NativeStackScreenProps -export type InsertMotherNameNISScreenProps = NativeStackScreenProps -export type InsertDateOfBirthNISScreenProps = NativeStackScreenProps -export type InsertAnonymizedCpfNISScreenProps = NativeStackScreenProps -export type QueryNISResultScreenProps = NativeStackScreenProps -export type QueryBeeByNISResultScreenProps = NativeStackScreenProps -export type QueryPbfByNISResultScreenProps = NativeStackScreenProps -export type QueryCadunicoByNISResultScreenProps = NativeStackScreenProps -export type NotificationPublicServicesSettingsPublicServicesScreenProps = NativeStackScreenProps diff --git a/app/src/presentation/routes/Stack/PublicServicesStack/types.ts b/app/src/presentation/routes/Stack/PublicServicesStack/types.ts deleted file mode 100644 index ad5a20cc6..000000000 --- a/app/src/presentation/routes/Stack/PublicServicesStack/types.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { QueryBeeResult, QueryCadunicoResult, QueryPbfResult, SmasService } from '@domain/smas/entity/types' - -import { UserStackParamList } from '../UserStack/types' - -export type PublicServiceStackParamList = { - SelectPublicService: undefined - InsertNIS: { smasService: SmasService } - InsertNameNIS: undefined - SelectNISQueryData: undefined - InsertMotherNameNIS: undefined - InsertDateOfBirthNIS: undefined - InsertAnonymizedCpfNIS: undefined - QueryNISResult: { NIS: string, status: number } - QueryBeeByNISResult: QueryBeeResult - QueryPbfByNISResult: QueryPbfResult - QueryCadunicoByNISResult: QueryCadunicoResult - NotificationPublicServicesSettingsPublicServices: undefined -} & UserStackParamList diff --git a/app/src/presentation/screens/configurationScreens/Configurations/index.tsx b/app/src/presentation/screens/configurationScreens/Configurations/index.tsx index 16f3dd952..130158ce1 100644 --- a/app/src/presentation/screens/configurationScreens/Configurations/index.tsx +++ b/app/src/presentation/screens/configurationScreens/Configurations/index.tsx @@ -25,7 +25,6 @@ import CheckWhiteIcon from "@assets/icons/check-white.svg"; import DescriptionAlertWhiteIcon from "@assets/icons/description-alert-white.svg"; import DescriptionWhiteIcon from "@assets/icons/description-white.svg"; import EyeDashedWhiteIcon from "@assets/icons/eyeDashed-white.svg"; -// import PublicServicesWhiteIcon from '@assets/icons/publicServices-white.svg' // SMAS import QuestionMarkWhiteIcon from "@assets/icons/questionMark-white.svg"; import ShareWhiteIcon from "@assets/icons/share-white.svg"; import XWhiteIcon from "@assets/icons/x-white.svg"; @@ -162,19 +161,6 @@ function Configurations({ navigation }: ConfigurationsScreenProps) { leftSideWidth={"22%"} onPress={() => navigateToScreen("NotificationSettings")} /> - {/* // SMAS */} - {/* - navigateToScreen('NotificationPublicServicesSettings')} - /> */} { - checkNotificationStates() - }, []) - - const navigateBackwards = () => navigation.goBack() - - const checkNotificationStates = async () => { - setIsLoading(true) - await checkSmasMessagesState() - await checkGovernmentNotificationState() - setIsLoading(false) - } - - const checkSmasMessagesState = async (nis?: string) => { - const currentNis = nis || await getNisFromLocalRepository(useSmasRepository) - const smasMessagesState = await smasNisHasLinkedWithUser(currentNis, useSmasRepository) - - setSmasMessagesIsEnabled(smasMessagesState) - setUserNis(currentNis) - } - - const checkGovernmentNotificationState = async () => { - const privateUserLocation = await remoteStorage.getPrivateLocation(userDataContext.userId) - setGovernmentNotificationIsEnabled(!!(privateUserLocation && privateUserLocation.visibleToGovernment)) - } - - const toggleMessagesSmasState = async (inputedNis?: string) => { - const newState = !smasMessagesIsEnabled - - try { - setIsLoading(true) - - if (newState) { - if (!inputedNis || (inputedNis && inputedNis.trim().length !== 11)) throw new Error('NIS inválido!') - setSmasPushNotificationState(newState, inputedNis || userNis, userDataContext.userId, useSmasRepository) - setUserNis(inputedNis) - await setPushNotificationState(true) - await setNisOnLocalRepository(inputedNis, useSmasRepository) - } else { - setSmasPushNotificationState(newState, inputedNis || userNis, userDataContext.userId, useSmasRepository) - setUserNis('') - await setNisOnLocalRepository('', useSmasRepository) - } - - setSmasMessagesIsEnabled(newState) - setIsLoading(false) - } catch (err) { - console.log(err) - setIsLoading(false) - } - } - - const toggleGovernmentNotifications = async () => { - try { - setIsLoading(true) - const newNotificationState = !governmentNotificationIsEnabled - - await remoteStorage.updatePrivateLocation( - userDataContext.userId, - { visibleToGovernment: newNotificationState } - ) - await setPushNotificationState(true) - - setGovernmentNotificationIsEnabled(newNotificationState) - setIsLoading(false) - } catch (err) { - console.log(err) - setIsLoading(false) - } - } - - const toggleInsertNisModalVisibility = () => setInsertNisModalIsVisible(!insertNisModalIsVisible) - - return ( - - - - - - - - - - - { - isLoading - ? ( - - ) - : ( - <> - - - - ) - } - - - ) -} - -export { NotificationPublicServicesSettings } diff --git a/app/src/presentation/screens/configurationScreens/NotificationPublicServicesSettings/styles.ts b/app/src/presentation/screens/configurationScreens/NotificationPublicServicesSettings/styles.ts deleted file mode 100644 index 6fbe9c499..000000000 --- a/app/src/presentation/screens/configurationScreens/NotificationPublicServicesSettings/styles.ts +++ /dev/null @@ -1,9 +0,0 @@ -import styled from 'styled-components/native' - -export const Container = styled.KeyboardAvoidingView` - flex: 1; -` - -export const HeaderLinkCardContainer = styled.View` - width: 85%; -` diff --git a/app/src/presentation/screens/homeScreens/Home/index.tsx b/app/src/presentation/screens/homeScreens/Home/index.tsx index ba083df9d..78302b606 100644 --- a/app/src/presentation/screens/homeScreens/Home/index.tsx +++ b/app/src/presentation/screens/homeScreens/Home/index.tsx @@ -302,10 +302,6 @@ function Home({ navigation }: HomeScreenProps) { navigation.navigate('EditUserLocation' as any, { initialCoordinates: null }) } - const navigateToPublicServices = () => { - navigation.navigate('PublicServicesStack') - } - const navigateToEventCalendar = () => { navigation.navigate('EventsCalendar') } @@ -347,7 +343,6 @@ function Home({ navigation }: HomeScreenProps) { setSubscriptionModalIsVisible(true)} - onPressPublicServicesAd={navigateToPublicServices} onPressUserLocationAd={navigateToEditUserLocation} onPressEventCalendarAd={navigateToEventCalendar} /> diff --git a/app/src/presentation/screens/homeScreens/ViewPostsByPostType/index.tsx b/app/src/presentation/screens/homeScreens/ViewPostsByPostType/index.tsx index 5ffeb4072..350499dbe 100644 --- a/app/src/presentation/screens/homeScreens/ViewPostsByPostType/index.tsx +++ b/app/src/presentation/screens/homeScreens/ViewPostsByPostType/index.tsx @@ -18,7 +18,6 @@ import CultureWhiteIcon from '@assets/icons/culture-white.svg' import HandOnHeartWhiteIcon from '@assets/icons/handOnHeart-white.svg' import HeartAndPersonWhiteIcon from '@assets/icons/heartAndPerson-white.svg' import PeperInfoWhiteIcon from '@assets/icons/paperInfo-white.svg' -// import PublicServicesWhiteIcon from '@assets/icons/publicServices-white.svg' // SMAS import SaleWhiteIcon from '@assets/icons/sale-white.svg' import ServiceWhiteIcon from '@assets/icons/service-white.svg' import SocialImpactWhiteIcon from '@assets/icons/socialImpact-white.svg' @@ -154,11 +153,10 @@ function ViewPostsByPostType({ navigation }: ViewPostsByPostTypeScreenProps) { /> ) case 'socialImpact': return ( - // SMAS navigateToPostSubcatery(macroCategory)} /> ) @@ -166,12 +164,7 @@ function ViewPostsByPostType({ navigation }: ViewPostsByPostTypeScreenProps) { } } - const navigateToPostSubcatery = (macroCategory: MacroCategoriesType | 'publicServices') => { - if (macroCategory === 'publicServices') { - navigation.navigate('PublicServicesStack') - return - } - + const navigateToPostSubcatery = (macroCategory: MacroCategoriesType) => { if (macroCategory === 'event') { return navigation.navigate('EventsCalendar') } diff --git a/app/src/presentation/screens/profileScreens/OfflinePostsManagement/index.tsx b/app/src/presentation/screens/profileScreens/OfflinePostsManagement/index.tsx index cc8546ae9..c82486c44 100644 --- a/app/src/presentation/screens/profileScreens/OfflinePostsManagement/index.tsx +++ b/app/src/presentation/screens/profileScreens/OfflinePostsManagement/index.tsx @@ -13,7 +13,6 @@ import { AuthContext } from '@contexts/AuthContext' import { OfflinePostsManagementScreenProps } from '@routes/Stack/UserStack/screenProps' -import { useCloudFunctionService } from '@services/cloudFunctions/useCloudFunctionService' import { getNetworkStatus } from '@utils/deviceNetwork' import { Body, Container, Header, SaveButtonContainer } from './styles' @@ -87,7 +86,6 @@ function OfflinePostsManagement({ navigation }: OfflinePostsManagementScreenProp try { const { newPost } = await savePost( usePostRepository, - useCloudFunctionService, userDataContext.subscription?.subscriptionRange, postData, postData, diff --git a/app/src/presentation/screens/smasScreens/InserMotherNameNIS/index.tsx b/app/src/presentation/screens/smasScreens/InserMotherNameNIS/index.tsx deleted file mode 100644 index cc1093e20..000000000 --- a/app/src/presentation/screens/smasScreens/InserMotherNameNIS/index.tsx +++ /dev/null @@ -1,87 +0,0 @@ -import React, { useContext, useEffect, useState } from 'react' -import { Keyboard, StatusBar } from 'react-native' - -import { SmasRecoveryNISData } from '@domain/smas/entity/types' -import { useSmasDomain } from '@domain/smas/useSmasDomain' - -import { SmasContext } from '@contexts/SmasContext' - -import { InsertMotherNameNISScreenProps } from '@routes/Stack/PublicServicesStack/screenProps' - -import { useCloudFunctionService } from '@services/cloudFunctions/useCloudFunctionService' - -import { theme } from '@common/theme' - -import { PostInputText } from '@components/_onboarding/PostInputText' - -const { validateName } = useSmasDomain() - -const { getNisByUserData } = useCloudFunctionService() - -function InsertMotherNameNIS({ navigation }: InsertMotherNameNISScreenProps) { - const { smasDataContext, setSmasDataOnContext, getNumberOfMissingInfo } = useContext(SmasContext) - - const [isLoading, setIsLoading] = React.useState(false) - const [keyboardOpened, setKeyboardOpened] = useState(false) - - useEffect(() => { - const unsubscribe = navigation.addListener('focus', () => { - Keyboard.addListener('keyboardDidShow', () => setKeyboardOpened(true)) - Keyboard.addListener('keyboardDidHide', () => setKeyboardOpened(false)) - }) - return unsubscribe - }, [navigation]) - - const validateInputName = (name: string) => { - const isValid = validateName(name) - return isValid && !keyboardOpened - } - - const saveMotherNameNIS = async (motherName: string) => { - try { - setSmasDataOnContext({ motherName }) - - if (getNumberOfMissingInfo() === 2) { - setIsLoading(true) - const res = await getNisByUserData({ ...smasDataContext, motherName } as SmasRecoveryNISData, 'ANONIMIZADO') - setIsLoading(false) - - return navigation.push('QueryNISResult', res) - } - - navigation.push('SelectNISQueryData') - } catch (err) { - console.log(err) - setIsLoading(false) - } - } - - const getProgressBarState = () => { - if (!getNumberOfMissingInfo()) return 3 - return 5 - getNumberOfMissingInfo() - } - - return ( - <> - - navigation.goBack()} - saveTextData={saveMotherNameNIS} - /> - - ) -} - -export { InsertMotherNameNIS } diff --git a/app/src/presentation/screens/smasScreens/InsertAnonymizedCpfNIS/index.tsx b/app/src/presentation/screens/smasScreens/InsertAnonymizedCpfNIS/index.tsx deleted file mode 100644 index 852e001fc..000000000 --- a/app/src/presentation/screens/smasScreens/InsertAnonymizedCpfNIS/index.tsx +++ /dev/null @@ -1,186 +0,0 @@ -import React, { useContext, useEffect, useRef, useState } from 'react' -import { Keyboard, Platform, StatusBar, TextInput } from 'react-native' - -import { SmasRecoveryNISData } from '@domain/smas/entity/types' - -import { SmasContext } from '@contexts/SmasContext' - -import { InsertAnonymizedCpfNISScreenProps } from '@routes/Stack/PublicServicesStack/screenProps' - -import { useCloudFunctionService } from '@services/cloudFunctions/useCloudFunctionService' - -import { ButtonContainer, Container, InputsContainer, InstructionButtonContainer } from './styles' -import CheckWhiteIcon from '@assets/icons/check-white.svg' -import { filterLeavingOnlyNumbers } from '@common/auxiliaryFunctions' -import { relativeScreenHeight } from '@common/screenDimensions' -import { theme } from '@common/theme' - -import { BackButton } from '@components/_buttons/BackButton' -import { PrimaryButton } from '@components/_buttons/PrimaryButton' -import { InstructionCard } from '@components/_cards/InstructionCard' -import { DefaultHeaderContainer } from '@components/_containers/DefaultHeaderContainer' -import { FormContainer } from '@components/_containers/FormContainer' -import { DefaultInput } from '@components/_inputs/DefaultInput' -import { VerticalSpacing } from '@components/_space/VerticalSpacing' -import { Loader } from '@components/Loader' -import { ProgressBar } from '@components/ProgressBar' - -const { getNisByUserData } = useCloudFunctionService() - -function InsertAnonymizedCpfNIS({ navigation }: InsertAnonymizedCpfNISScreenProps) { - const { smasDataContext, getNumberOfMissingInfo, setSmasDataOnContext } = useContext(SmasContext) - - const [firstCpfValues, setFirstCpfValues] = useState('') - const [lastCpfValues, setLastCpfValues] = useState('') - const [firstCpfValuesIsValid, setFirstCpfValuesIsValid] = useState(false) - const [lastCpfValuesIsValid, setLastCpfValuesIsValid] = useState(false) - - const [isLoading, setIsLoading] = React.useState(false) - const [keyboardOpened, setKeyboardOpened] = useState(false) - - const inputRefs = { - firstCpfValuesRef: useRef(null), - lastCpfValuesRef: useRef(null) - } - - useEffect(() => { - const unsubscribe = navigation.addListener('focus', () => { - Keyboard.addListener('keyboardDidShow', () => setKeyboardOpened(true)) - Keyboard.addListener('keyboardDidHide', () => setKeyboardOpened(false)) - }) - return unsubscribe - }, [navigation]) - - useEffect(() => { - setFirstCpfValuesIsValid(validateFirstCpfValues(firstCpfValues)) - setLastCpfValuesIsValid(validateLastCpfValues(lastCpfValues)) - }, [firstCpfValues, lastCpfValues, keyboardOpened]) - - const validateFirstCpfValues = (text: string) => { // TODO Domain? - const cleanText = filterLeavingOnlyNumbers(text) - return cleanText.length === 3 - } - - const validateLastCpfValues = (text: string) => { - const cleanText = filterLeavingOnlyNumbers(text) - return cleanText.length === 2 - } - - const saveDateOfBirthNIS = async () => { - try { - const anonymizedCpf = `${firstCpfValues}${lastCpfValues}` - if (anonymizedCpf.length !== 5) return - - setSmasDataOnContext({ anonymizedCpf }) - - if (getNumberOfMissingInfo() === 2) { - setIsLoading(true) - const res = await getNisByUserData({ ...smasDataContext, anonymizedCpf } as SmasRecoveryNISData, 'ANONIMIZADO') - setIsLoading(false) - - return navigation.push('QueryNISResult', res) - } - navigation.push('SelectNISQueryData') - } catch (err) { - console.log(err) - setIsLoading(false) - } - } - - const navigateBackwards = () => navigation.goBack() - - const getProgressBarState = () => { - if (!getNumberOfMissingInfo()) return 3 - return 5 - getNumberOfMissingInfo() - } - - return ( - - - - - - - - - - - - - - - - - validateFirstCpfValues(text)} - onChangeText={(text: string) => setFirstCpfValues(text)} - /> - validateLastCpfValues(text)} - onChangeText={(text: string) => setLastCpfValues(text)} - /> - - - { - isLoading - ? - : firstCpfValuesIsValid && lastCpfValuesIsValid && !keyboardOpened && ( - - ) - } - - - - ) -} - -export { InsertAnonymizedCpfNIS } diff --git a/app/src/presentation/screens/smasScreens/InsertAnonymizedCpfNIS/styles.ts b/app/src/presentation/screens/smasScreens/InsertAnonymizedCpfNIS/styles.ts deleted file mode 100644 index 26d9d3281..000000000 --- a/app/src/presentation/screens/smasScreens/InsertAnonymizedCpfNIS/styles.ts +++ /dev/null @@ -1,30 +0,0 @@ -import styled from 'styled-components/native' - -import { relativeScreenWidth } from '@common/screenDimensions' - -export const Container = styled.KeyboardAvoidingView` - flex: 1; -` - -export const InputsContainer = styled.View` - width: 100%; - min-height: 52px; - flex-direction: row; - justify-content: space-between; - align-items: center; - margin-bottom: 50px; -` - -export const ButtonContainer = styled.View` - width: 100%; -` - -interface InstructionButtonContainerProps { - withPaddingLeft?: boolean -} - -export const InstructionButtonContainer = styled.View` - padding-left: ${({ withPaddingLeft }) => (withPaddingLeft ? relativeScreenWidth(15.5) : '0')}px; - flex-direction: row; - align-items: center; -` diff --git a/app/src/presentation/screens/smasScreens/InsertNIS/index.tsx b/app/src/presentation/screens/smasScreens/InsertNIS/index.tsx deleted file mode 100644 index 41f737081..000000000 --- a/app/src/presentation/screens/smasScreens/InsertNIS/index.tsx +++ /dev/null @@ -1,116 +0,0 @@ -import React, { useEffect } from 'react' - -import { sendEvent } from '@newutils/methods/analyticsEvents' - -import { QueryBeeResult, QueryCadunicoResult, QueryPbfResult } from '@domain/smas/entity/types' -import { useSmasDomain } from '@domain/smas/useSmasDomain' - -import { useSmasRepository } from '@data/smas/useSmasRepository' - -import { useAuthContext } from '@contexts/AuthContext' - -import { InsertNISScreenProps } from '@routes/Stack/PublicServicesStack/screenProps' - -import { useCloudFunctionService } from '@services/cloudFunctions/useCloudFunctionService' - -import QuestionMarkWhiteIcon from '@assets/icons/questionMark-white.svg' -import { theme } from '@common/theme' - -import { PrimaryButton } from '@components/_buttons/PrimaryButton' -import { PostInputText } from '@components/_onboarding/PostInputText' - -const { getBenefitDataSmasByNis } = useCloudFunctionService() -const { getNisFromLocalRepository, treatSmasApiResponse, validateNIS } = useSmasDomain() - -function InsertNIS({ route, navigation }: InsertNISScreenProps) { - const { userDataContext } = useAuthContext() - - const [isLoading, setIsLoading] = React.useState(false) - const [storagedNis, setStoragedNis] = React.useState('') - - const { smasService } = route.params - - useEffect(() => { - const unsubscribe = navigation.addListener('focus', () => { - loadStoragedNis() - }) - return unsubscribe - }, [navigation]) - - const loadStoragedNis = async () => { - const nis = await getNisFromLocalRepository(useSmasRepository) - if (nis) { - storagedNis !== nis && setStoragedNis('') - setStoragedNis(nis) - } - } - - const searchByNIS = async (NISValue: string) => { - try { - setIsLoading(true) - const response = await getBenefitDataSmasByNis(NISValue.trim(), smasService, userDataContext.userId) - - const queryResult = treatSmasApiResponse(response, smasService) - - setIsLoading(false) - if (smasService === 'BEE') return navigation.navigate('QueryBeeByNISResult', { ...queryResult } as QueryBeeResult) - if (smasService === 'PBF') return navigation.navigate('QueryPbfByNISResult', { ...queryResult, NIS: NISValue } as QueryPbfResult) - if (smasService === 'CADUNICO') return navigation.navigate('QueryCadunicoByNISResult', { ...queryResult, NIS: NISValue } as QueryCadunicoResult) - } catch (error) { - setIsLoading(false) - sendEvent('smas_search', { smasService: smasService as any, smasResponse: 'failed' }) - console.log(error) - } - } - - const getContextTitle = () => { - switch (smasService) { - case 'BEE': return 'consultar benefício emergencial' - case 'PBF': return 'consultar bolsa família' - case 'CADUNICO': return 'veja se seu cadastro único está atualizado' - } - } - - const getContextHighlightedWords = () => { - switch (smasService) { - case 'BEE': return ['benefício', 'emergencial'] - case 'PBF': return ['bolsa', 'família'] - case 'CADUNICO': return ['cadastro', 'único', 'atualizado'] - } - } - - const navigateToQueryNIS = () => { - navigation.navigate('InsertNameNIS') - } - - return ( - <> - navigation.goBack()} - saveTextData={searchByNIS} - > - - - - ) -} - -export { InsertNIS } diff --git a/app/src/presentation/screens/smasScreens/InsertNameNIS/index.tsx b/app/src/presentation/screens/smasScreens/InsertNameNIS/index.tsx deleted file mode 100644 index 5ef9080c7..000000000 --- a/app/src/presentation/screens/smasScreens/InsertNameNIS/index.tsx +++ /dev/null @@ -1,68 +0,0 @@ -import React, { useContext, useEffect, useState } from 'react' -import { Keyboard, StatusBar } from 'react-native' - -import { useSmasDomain } from '@domain/smas/useSmasDomain' - -import { SmasContext } from '@contexts/SmasContext' - -import { InsertNameNISScreenProps } from '@routes/Stack/PublicServicesStack/screenProps' - -import { theme } from '@common/theme' - -import { PostInputText } from '@components/_onboarding/PostInputText' - -const { validateName } = useSmasDomain() - -function InsertNameNIS({ navigation }: InsertNameNISScreenProps) { - const { setSmasDataOnContext, clearSmasDataContext } = useContext(SmasContext) - - const [keyboardOpened, setKeyboardOpened] = useState(false) - - useEffect(() => { - const unsubscribe = navigation.addListener('focus', () => { - clearSmasDataContext() - }) - return unsubscribe - }) - - useEffect(() => { - const unsubscribe = navigation.addListener('focus', () => { - Keyboard.addListener('keyboardDidShow', () => setKeyboardOpened(true)) - Keyboard.addListener('keyboardDidHide', () => setKeyboardOpened(false)) - }) - return unsubscribe - }, [navigation]) - - const validateInputName = (name: string) => { - const isValid = validateName(name) - return isValid && !keyboardOpened - } - - const saveNameNIS = async (name: string) => { - setSmasDataOnContext({ name }) - navigation.navigate('SelectNISQueryData') - } - - return ( - <> - - navigation.goBack()} - saveTextData={saveNameNIS} - /> - - ) -} - -export { InsertNameNIS } diff --git a/app/src/presentation/screens/smasScreens/InsetDateOfBirthNIS/index.tsx b/app/src/presentation/screens/smasScreens/InsetDateOfBirthNIS/index.tsx deleted file mode 100644 index 02db77e74..000000000 --- a/app/src/presentation/screens/smasScreens/InsetDateOfBirthNIS/index.tsx +++ /dev/null @@ -1,233 +0,0 @@ -import React, { useContext, useEffect, useRef, useState } from 'react' -import { Keyboard, Platform, StatusBar, TextInput } from 'react-native' - -import { SmasRecoveryNISData } from '@domain/smas/entity/types' - -import { SmasContext } from '@contexts/SmasContext' - -import { InsertDateOfBirthNISScreenProps } from '@routes/Stack/PublicServicesStack/screenProps' - -import { useCloudFunctionService } from '@services/cloudFunctions/useCloudFunctionService' - -import { ButtonContainer, Container, InputsContainer, InstructionButtonContainer } from './styles' -import CheckWhiteIcon from '@assets/icons/check-white.svg' -import { filterLeavingOnlyNumbers } from '@common/auxiliaryFunctions' -import { theme } from '@common/theme' - -import { BackButton } from '@components/_buttons/BackButton' -import { PrimaryButton } from '@components/_buttons/PrimaryButton' -import { InstructionCard } from '@components/_cards/InstructionCard' -import { DefaultHeaderContainer } from '@components/_containers/DefaultHeaderContainer' -import { FormContainer } from '@components/_containers/FormContainer' -import { DefaultInput } from '@components/_inputs/DefaultInput' -import { VerticalSpacing } from '@components/_space/VerticalSpacing' -import { Loader } from '@components/Loader' -import { ProgressBar } from '@components/ProgressBar' - -const { getNisByUserData } = useCloudFunctionService() - -function InsertDateOfBirthNIS({ navigation }: InsertDateOfBirthNISScreenProps) { - const { smasDataContext, setSmasDataOnContext, getNumberOfMissingInfo } = useContext(SmasContext) - - const [day, setDay] = useState('') - const [month, setMonth] = useState('') - const [year, setYear] = useState('') - - const [dayIsValid, setDayIsValid] = useState(false) - const [monthIsValid, setMonthIsValid] = useState(false) - const [yearIsValid, setYearIsValid] = useState(false) - const [invalidDateAfterSubmit, setInvalidDateAfterSubmit] = useState(false) - - const [isLoading, setIsLoading] = useState(false) - const [keyboardOpened, setKeyboardOpened] = useState(false) - - const inputRefs = { - dayInput: useRef(null), - monthInput: useRef(null), - yearInput: useRef(null) - } - - useEffect(() => { - const unsubscribe = navigation.addListener('focus', () => { - Keyboard.addListener('keyboardDidShow', () => setKeyboardOpened(true)) - Keyboard.addListener('keyboardDidHide', () => setKeyboardOpened(false)) - }) - return unsubscribe - }, [navigation]) - - useEffect(() => { - const dayValidation = validateDay(day) - const monthValidation = validateMonth(month) - const yearValidation = validateYear(year) - setDayIsValid(dayValidation) - setMonthIsValid(monthValidation) - setYearIsValid(yearValidation) - }, [day, month, year, keyboardOpened]) - - const validateDay = (text: string) => { - return text.length === 2 && parseInt(text) <= 31 && parseInt(text) > 0 - } - - const validateMonth = (text: string) => { - return text.length === 2 && parseInt(text) <= 12 && parseInt(text) > 0 - } - - const validateYear = (text: string) => { - return text.length === 4 - } - - const allFiedsIsValid = () => (dayIsValid && monthIsValid && yearIsValid) - - const existsThisDayOnMonth = () => { - if (!allFiedsIsValid()) return true - return numberOfDaysOfMonth() >= parseInt(day) - } - - const numberOfDaysOfMonth = () => { - const data = new Date(parseInt(year), parseInt(month), 0) - return data.getDate() - } - - const saveDateOfBirthNIS = async () => { - try { - const formatedDate = `${day}/${month}/${year}` - setSmasDataOnContext({ dateOfBirth: formatedDate }) - - if (getNumberOfMissingInfo() === 2) { - setIsLoading(true) - const res = await getNisByUserData({ ...smasDataContext, dateOfBirth: formatedDate } as SmasRecoveryNISData, 'ANONIMIZADO') - setIsLoading(false) - - return navigation.push('QueryNISResult', res) - } - - navigation.push('SelectNISQueryData') - } catch (err) { - console.log(err) - setIsLoading(false) - } - } - - const navigateBackwards = () => navigation.goBack() - - const getProgressBarState = () => { - if (!getNumberOfMissingInfo()) return 3 - return 5 - getNumberOfMissingInfo() - } - - return ( - - - - - - - - - - - - - - - - - validateDay(text)} - onChangeText={(text: string) => { - setDay(text) - invalidDateAfterSubmit && setInvalidDateAfterSubmit(false) - }} - /> - validateMonth(text)} - onChangeText={(text: string) => { - setMonth(text) - invalidDateAfterSubmit && setInvalidDateAfterSubmit(false) - }} - /> - validateYear(text)} - onChangeText={(text: string) => { - setYear(text) - invalidDateAfterSubmit && setInvalidDateAfterSubmit(false) - }} - /> - - - { - isLoading - ? - : allFiedsIsValid() && !keyboardOpened && existsThisDayOnMonth() - && ( - - ) - } - - - - ) -} - -export { InsertDateOfBirthNIS } diff --git a/app/src/presentation/screens/smasScreens/InsetDateOfBirthNIS/styles.ts b/app/src/presentation/screens/smasScreens/InsetDateOfBirthNIS/styles.ts deleted file mode 100644 index 65ee09da3..000000000 --- a/app/src/presentation/screens/smasScreens/InsetDateOfBirthNIS/styles.ts +++ /dev/null @@ -1,30 +0,0 @@ -import styled from 'styled-components/native' - -import { relativeScreenWidth } from '@common/screenDimensions' - -export const Container = styled.KeyboardAvoidingView` - flex: 1; -` - -export const InputsContainer = styled.View` - width: 100%; - min-height: 52px; - flex-direction: row; - justify-content: space-between; - align-items: center; - margin-bottom: 50px; -` - -export const ButtonContainer = styled.View` - width: 100%; -` - -interface InstructionButtonContainerProps { - withPaddingLeft?: boolean -} - -export const InstructionButtonContainer = styled.View` - padding-left: ${({ withPaddingLeft }) => (withPaddingLeft ? relativeScreenWidth(15.5) : '0')}px; - flex-direction: row; - align-items: center; -` diff --git a/app/src/presentation/screens/smasScreens/QueryBeeByNISResult/index.tsx b/app/src/presentation/screens/smasScreens/QueryBeeByNISResult/index.tsx deleted file mode 100644 index 3ec139ae0..000000000 --- a/app/src/presentation/screens/smasScreens/QueryBeeByNISResult/index.tsx +++ /dev/null @@ -1,180 +0,0 @@ -import React, { useState } from 'react' -import { Platform, StatusBar } from 'react-native' - -import { useSmasDomain } from '@domain/smas/useSmasDomain' - -import { useSmasRepository } from '@data/smas/useSmasRepository' - -import { QueryBeeByNISResultScreenProps } from '@routes/Stack/PublicServicesStack/screenProps' - -import { Container, InstructionButtonContainer } from './styles' -import CheckWhiteIcon from '@assets/icons/check-white.svg' -import QuestionMarkWhiteIcon from '@assets/icons/questionMark-white.svg' -import RecycleWhiteIcon from '@assets/icons/recycle-white.svg' -import { theme } from '@common/theme' - -import { BackButton } from '@components/_buttons/BackButton' -import { PrimaryButton } from '@components/_buttons/PrimaryButton' -import { InstructionCard } from '@components/_cards/InstructionCard' -import { DefaultHeaderContainer } from '@components/_containers/DefaultHeaderContainer' -import { FormContainer } from '@components/_containers/FormContainer' -import { AlertNotificationModal } from '@components/_modals/AlertNotificationModal' -import { VerticalSpacing } from '@components/_space/VerticalSpacing' - -const { smasNisHasLinkedWithUser } = useSmasDomain() - -function QueryBeeByNISResult({ route, navigation }: QueryBeeByNISResultScreenProps) { - const [notificationModalIsVisible, setNotificationModalIsVisible] = useState(false) - - const { nisNotFound, serverError, benefitRequested, benefitGranted, inAnalysis, grantDate, expectedDate } = route.params - - const navigateBackwards = () => navigation.goBack() - - const backToInitialStackScreen = () => { - navigation.goBack() - navigation.goBack() - } - - const navigateToConfigScreen = () => { - setNotificationModalIsVisible(false) - navigation.navigate('NotificationPublicServicesSettingsPublicServices') - } - - const smasNotificationIsEnable = async (nis?: string) => { - return smasNisHasLinkedWithUser(nis || '', useSmasRepository) - } - - const handleContinueButton = async () => { - if (await smasNotificationIsEnable()) { - return backToInitialStackScreen() - } - - setNotificationModalIsVisible(true) - } - - const navigateToQueryNIS = () => { - navigation.navigate('InsertNameNIS') - } - - const getCustomResponseText = () => { - return `benefício ${benefitGranted} foi concedido na data: \n\n${grantDate} \n\nprevisão de liberação até: \n\n${expectedDate} \n\npor favor, consulte ${benefitGranted === 'cartão alimentação' ? 'o aplicativo BKBanking' : 'sua conta bancária'}` - } - - const getResponseHighlightedWords = () => { - return ['cartão', 'alimentação', 'depósito', 'em', 'conta', 'emergencial', 'foi', 'concedido', `\n\n${grantDate}`, '\n\nprevisão', 'de', 'liberação', `\n\n${expectedDate}`, 'consulte', 'cartão alimentação', 'o', 'aplicativo', 'BKBanking', 'sua', 'conta', 'bancária'] - } - - const getBenefitStatusMessage = () => { - if (serverError) return 'opa! \n\nalgo deu errado ao realizar a busca, verifique sua conexão com a internet e tente novamente em alguns instantes' - if (nisNotFound) return 'opa! \n\ntem algo errado com esse NIS \n\nentre em contato com o CRAS mais próximo da sua residência \n\nou tente uma das alternativas abaixo' - if (!benefitRequested) return 'solicitação não foi localizada' - if (inAnalysis) return 'sua solicitação ainda está sendo analisada' - if (!benefitGranted) return 'não foi concedido' - - return 'opa! \n\ntem algo errado com esse NIS' - } - - const getBenefitStatusMessageHighlighted = () => { - if (serverError) return ['opa!', 'de', 'verifique', 'sua', 'conexão', 'com', 'a', 'internet'] - if (nisNotFound) return ['algo', 'de', 'errado', 'NIS', 'CRAS', 'alternativas'] - if (!benefitRequested) return ['solicitação', 'não', 'foi', 'localizada'] - if (inAnalysis) return ['ainda', 'está', 'sendo', 'analisada'] - if (!benefitGranted) return ['não foi concedido'] - - return ['algo', 'de', 'errado', 'NIS'] - } - - const checkResponseStatus = () => { - return inAnalysis || benefitGranted - } - - return ( - - - setNotificationModalIsVisible(false)} - onCloseModal={() => setNotificationModalIsVisible(false)} - onPressButton={navigateToConfigScreen} - /> - - - - - - - { - benefitGranted - ? ( - - - - ) - : ( - - - - ) - } - - < FormContainer - backgroundColor={theme.colors.white[3]} - justifyContent={'center'} - > - { - nisNotFound ? ( - <> - - - - - ) : ( - - ) - } - - - ) -} - -export { QueryBeeByNISResult } diff --git a/app/src/presentation/screens/smasScreens/QueryBeeByNISResult/styles.ts b/app/src/presentation/screens/smasScreens/QueryBeeByNISResult/styles.ts deleted file mode 100644 index a0bb93356..000000000 --- a/app/src/presentation/screens/smasScreens/QueryBeeByNISResult/styles.ts +++ /dev/null @@ -1,17 +0,0 @@ -import styled from 'styled-components/native' - -import { relativeScreenWidth } from '@common/screenDimensions' - -export const Container = styled.KeyboardAvoidingView` - flex: 1; -` - -interface InstructionButtonContainerProps { - withPaddingLeft?: boolean -} - -export const InstructionButtonContainer = styled.View` - padding-left: ${({ withPaddingLeft }) => (withPaddingLeft ? relativeScreenWidth(15.5) : '0')}px; - flex-direction: row; - align-items: center; -` diff --git a/app/src/presentation/screens/smasScreens/QueryCadunicoByNISResult/index.tsx b/app/src/presentation/screens/smasScreens/QueryCadunicoByNISResult/index.tsx deleted file mode 100644 index 09830fc4a..000000000 --- a/app/src/presentation/screens/smasScreens/QueryCadunicoByNISResult/index.tsx +++ /dev/null @@ -1,148 +0,0 @@ -import React, { useState } from 'react' -import { Platform, StatusBar } from 'react-native' - -import { useSmasDomain } from '@domain/smas/useSmasDomain' - -import { useSmasRepository } from '@data/smas/useSmasRepository' - -import { QueryCadunicoByNISResultScreenProps } from '@routes/Stack/PublicServicesStack/screenProps' - -import { Container, InstructionButtonContainer } from './styles' -import CheckWhiteIcon from '@assets/icons/check-white.svg' -import QuestionMarkWhiteIcon from '@assets/icons/questionMark-white.svg' -import RecycleWhiteIcon from '@assets/icons/recycle-white.svg' -import { theme } from '@common/theme' - -import { BackButton } from '@components/_buttons/BackButton' -import { PrimaryButton } from '@components/_buttons/PrimaryButton' -import { InstructionCard } from '@components/_cards/InstructionCard' -import { DefaultHeaderContainer } from '@components/_containers/DefaultHeaderContainer' -import { FormContainer } from '@components/_containers/FormContainer' -import { AlertNotificationModal } from '@components/_modals/AlertNotificationModal' -import { VerticalSpacing } from '@components/_space/VerticalSpacing' - -const { smasNisHasLinkedWithUser } = useSmasDomain() - -function QueryCadunicoByNISResult({ route, navigation }: QueryCadunicoByNISResultScreenProps) { - const [notificationModalIsVisible, setNotificationModalIsVisible] = useState(false) - - const { status, serverError, nisNotFound, lastUpdate } = route.params - - const navigateBackwards = () => navigation.goBack() - - const backToInitialStackScreen = () => { - navigation.goBack() - navigation.goBack() - } - - const navigateToConfigScreen = () => { - setNotificationModalIsVisible(false) - navigation.navigate('NotificationPublicServicesSettingsPublicServices') - } - - const navigateToQueryNIS = () => { - navigation.navigate('InsertNameNIS') - } - - const smasNotificationIsEnable = async (nis?: string) => { - return smasNisHasLinkedWithUser(nis || '', useSmasRepository) - } - - const handleContinueButton = async () => { - if (await smasNotificationIsEnable()) { - return backToInitialStackScreen() - } - - setNotificationModalIsVisible(true) - } - - const getCustomResponseText = () => { - if (serverError) return 'opa! \n\nalgo deu errado ao realizar a busca, verifique sua conexão com a internet e tente novamente em alguns instantes' - if (nisNotFound) return 'opa! \n\ntem algo de errado com esse NIS \n\nconsulte o aplicativo do Cadastro Único \n\nou entre em contato com o CRAS mais próximo da sua residência\n' - return `Desde a data deste sistema ${lastUpdate}, o cadastro consta como ${status.toUpperCase()}. \n\nCaso já tenha comparecido a uma unidade após esta data, ligue para central: \n\n (43) 33780476` - } - - const getResponseHighlightedWords = () => { - if (serverError) return ['opa!', 'de', 'verifique', 'sua', 'conexão', 'com', 'a', 'internet'] - if (nisNotFound) return ['algo', 'de', 'errado', 'NIS', 'Cadastro', 'Único', 'CRAS'] - return [status.toUpperCase(), 'ligue', lastUpdate, 'para', 'central:', '(43)', '33780476'] - } - - return ( - - - setNotificationModalIsVisible(false)} - onCloseModal={() => setNotificationModalIsVisible(false)} - onPressButton={navigateToConfigScreen} - /> - - - - - - - - - - - < FormContainer - backgroundColor={theme.colors.white[3]} - justifyContent={'center'} - > - { - nisNotFound ? ( - <> - - - - - ) : ( - - ) - } - - - ) -} - -export { QueryCadunicoByNISResult } diff --git a/app/src/presentation/screens/smasScreens/QueryCadunicoByNISResult/styles.ts b/app/src/presentation/screens/smasScreens/QueryCadunicoByNISResult/styles.ts deleted file mode 100644 index a0bb93356..000000000 --- a/app/src/presentation/screens/smasScreens/QueryCadunicoByNISResult/styles.ts +++ /dev/null @@ -1,17 +0,0 @@ -import styled from 'styled-components/native' - -import { relativeScreenWidth } from '@common/screenDimensions' - -export const Container = styled.KeyboardAvoidingView` - flex: 1; -` - -interface InstructionButtonContainerProps { - withPaddingLeft?: boolean -} - -export const InstructionButtonContainer = styled.View` - padding-left: ${({ withPaddingLeft }) => (withPaddingLeft ? relativeScreenWidth(15.5) : '0')}px; - flex-direction: row; - align-items: center; -` diff --git a/app/src/presentation/screens/smasScreens/QueryNISResult/index.tsx b/app/src/presentation/screens/smasScreens/QueryNISResult/index.tsx deleted file mode 100644 index 9a587e407..000000000 --- a/app/src/presentation/screens/smasScreens/QueryNISResult/index.tsx +++ /dev/null @@ -1,122 +0,0 @@ -import React, { useContext, useState } from 'react' -import { Platform, StatusBar } from 'react-native' - -import { useSmasDomain } from '@domain/smas/useSmasDomain' - -import { useSmasRepository } from '@data/smas/useSmasRepository' - -import { SmasContext } from '@contexts/SmasContext' - -import { QueryNISResultScreenProps } from '@routes/Stack/PublicServicesStack/screenProps' - -import { Container, InstructionButtonContainer } from './styles' -import CheckWhiteIcon from '@assets/icons/check-white.svg' -import XWhiteIcon from '@assets/icons/x-white.svg' -import { relativeScreenHeight } from '@common/screenDimensions' -import { theme } from '@common/theme' - -import { BackButton } from '@components/_buttons/BackButton' -import { PrimaryButton } from '@components/_buttons/PrimaryButton' -import { InstructionCard } from '@components/_cards/InstructionCard' -import { DefaultHeaderContainer } from '@components/_containers/DefaultHeaderContainer' -import { FormContainer } from '@components/_containers/FormContainer' -import { VerticalSpacing } from '@components/_space/VerticalSpacing' - -const { setNisOnLocalRepository } = useSmasDomain() - -function QueryNISResult({ route, navigation }: QueryNISResultScreenProps) { - const { setSmasDataOnContext } = useContext(SmasContext) - - const [nisIsSaved, setNisIsSaved] = useState(false) - - const { status, NIS } = route.params - - const navigateBackwards = () => navigation.goBack() - - const backToInicialStackScreen = () => { - navigation.pop(6) - } - - const saveNis = () => { - if (nisIsSaved) { - return backToInicialStackScreen() - } - - setSmasDataOnContext({ NIS }) - setNisOnLocalRepository(NIS, useSmasRepository) - setNisIsSaved(true) - } - - const getCustomResponseText = () => { - if (nisIsSaved) return 'seu NIS foi salvo!' - if (status === 200) return `seu NIS é: ${NIS} \n\ngostaria de salvar seu NIS aqui no aplicativo?` - if (status === 500) return 'opa! \n\nalgo deu errado ao realizar a busca, verifique sua conexão com a internet e tente novamente em alguns instantes' - if (status === 404) return 'não encontramos seu NIS, confira os dados ou procure a unidade de CRAS mais próxima de sua residência \n\nou consulte o aplicativo do Cadastro Único\n' - return '' - } - - const getCustomHighlightedWords = () => { - if (nisIsSaved) return ['NIS'] - if (status === 200) return ['NIS', 'salvar', 'no', 'aplicativo', `${NIS}`] - if (status === 404) return ['não', 'encontramos', 'seu', 'NIS,', 'CRAS', 'Cadastro', 'Único'] - if (status === 500) return ['opa!', 'de', 'verifique', 'sua', 'conexão', 'com', 'a', 'internet'] - return ['não', 'encontramos', 'seu', 'NIS', 'CRAS'] - } - - return ( - - - - - - - - - - - - - < FormContainer backgroundColor={theme.colors.white[3]}> - { - status === 200 && !nisIsSaved - ? ( - - ) - : <> - } - - - - ) -} - -export { QueryNISResult } diff --git a/app/src/presentation/screens/smasScreens/QueryNISResult/styles.ts b/app/src/presentation/screens/smasScreens/QueryNISResult/styles.ts deleted file mode 100644 index a0bb93356..000000000 --- a/app/src/presentation/screens/smasScreens/QueryNISResult/styles.ts +++ /dev/null @@ -1,17 +0,0 @@ -import styled from 'styled-components/native' - -import { relativeScreenWidth } from '@common/screenDimensions' - -export const Container = styled.KeyboardAvoidingView` - flex: 1; -` - -interface InstructionButtonContainerProps { - withPaddingLeft?: boolean -} - -export const InstructionButtonContainer = styled.View` - padding-left: ${({ withPaddingLeft }) => (withPaddingLeft ? relativeScreenWidth(15.5) : '0')}px; - flex-direction: row; - align-items: center; -` diff --git a/app/src/presentation/screens/smasScreens/QueryPbfByNISResult/index.tsx b/app/src/presentation/screens/smasScreens/QueryPbfByNISResult/index.tsx deleted file mode 100644 index 44a0795f9..000000000 --- a/app/src/presentation/screens/smasScreens/QueryPbfByNISResult/index.tsx +++ /dev/null @@ -1,128 +0,0 @@ -import React, { useState } from 'react' -import { Platform, StatusBar } from 'react-native' - -import { useSmasDomain } from '@domain/smas/useSmasDomain' - -import { useSmasRepository } from '@data/smas/useSmasRepository' - -import { QueryPbfByNISResultScreenProps } from '@routes/Stack/PublicServicesStack/screenProps' - -import { Container, InstructionButtonContainer } from './styles' -import CheckWhiteIcon from '@assets/icons/check-white.svg' -import { theme } from '@common/theme' - -import { BackButton } from '@components/_buttons/BackButton' -import { PrimaryButton } from '@components/_buttons/PrimaryButton' -import { InstructionCard } from '@components/_cards/InstructionCard' -import { DefaultHeaderContainer } from '@components/_containers/DefaultHeaderContainer' -import { FormContainer } from '@components/_containers/FormContainer' -import { AlertNotificationModal } from '@components/_modals/AlertNotificationModal' -import { VerticalSpacing } from '@components/_space/VerticalSpacing' - -const { smasNisHasLinkedWithUser } = useSmasDomain() - -function QueryPbfByNISResult({ route, navigation }: QueryPbfByNISResultScreenProps) { - const [notificationModalIsVisible, setNotificationModalIsVisible] = useState(false) - - const { status, NIS, nisNotFound, serverError, familyBagName, familyBagValue } = route.params - - const navigateBackwards = () => navigation.goBack() - - const backToInitialStackScreen = () => { - navigation.goBack() - navigation.goBack() - } - - const navigateToConfigScreen = () => { - setNotificationModalIsVisible(false) - navigation.navigate('NotificationPublicServicesSettingsPublicServices') - } - - const smasNotificationIsEnable = async (nis?: string) => { - return smasNisHasLinkedWithUser(nis || '', useSmasRepository) - } - - const handleContinueButton = async () => { - if (await smasNotificationIsEnable()) { - return backToInitialStackScreen() - } - - setNotificationModalIsVisible(true) - } - - const getCustomResponseText = () => { - if (serverError) return 'opa! \n\nalgo deu errado ao realizar a busca, verifique sua conexão com a internet e tente novamente em alguns instantes' - if (nisNotFound) return `este NIS(${NIS}) não consta na folha de pagamento de Londrina \n\nconsulte o aplicativo do bolsa família \n` - if (status === 'Liberado') return `benefício ${status.toUpperCase()} no valor de: ${familyBagValue} para ${familyBagName}, ao NIS ${NIS}` - if (status === 'Bloqueado' || status === 'Suspenso') return `benefício ${status.toUpperCase()} \n\n ${familyBagName} \n ${NIS} \n\nconsulte o aplicativo do bolsa família \n` - - return 'não foi possível identificar o estado do seu benefício' - } - - const getResponseHighlightedWords = () => { - if (serverError) return ['opa!', 'de', 'verifique', 'sua', 'conexão', 'com', 'a', 'internet'] - if (nisNotFound) return [`NIS(${NIS})`, 'não', 'consta', 'na', 'folha', 'de', 'pagamento', 'de', 'Londrina', 'aplicativo', 'do', 'bolsa', 'família'] - if (status === 'Liberado') return ['benefício', status.toUpperCase(), 'NIS', NIS, ...familyBagName.split(' '), familyBagValue] - if (status === 'Bloqueado' || status === 'Suspenso') return [status.toUpperCase(), ...familyBagName.split(' '), `${NIS}`, 'aplicativo', 'do', 'bolsa', 'família'] - - return [] - } - - return ( - - - setNotificationModalIsVisible(false)} - onCloseModal={() => { - setNotificationModalIsVisible(false) - navigateBackwards() - }} - onPressButton={navigateToConfigScreen} - /> - - - - - - - - - - - < FormContainer - backgroundColor={theme.colors.white[3]} - justifyContent={'center'} - > - - - - ) -} - -export { QueryPbfByNISResult } diff --git a/app/src/presentation/screens/smasScreens/QueryPbfByNISResult/styles.ts b/app/src/presentation/screens/smasScreens/QueryPbfByNISResult/styles.ts deleted file mode 100644 index a0bb93356..000000000 --- a/app/src/presentation/screens/smasScreens/QueryPbfByNISResult/styles.ts +++ /dev/null @@ -1,17 +0,0 @@ -import styled from 'styled-components/native' - -import { relativeScreenWidth } from '@common/screenDimensions' - -export const Container = styled.KeyboardAvoidingView` - flex: 1; -` - -interface InstructionButtonContainerProps { - withPaddingLeft?: boolean -} - -export const InstructionButtonContainer = styled.View` - padding-left: ${({ withPaddingLeft }) => (withPaddingLeft ? relativeScreenWidth(15.5) : '0')}px; - flex-direction: row; - align-items: center; -` diff --git a/app/src/presentation/screens/smasScreens/SelectNISQueryData/index.tsx b/app/src/presentation/screens/smasScreens/SelectNISQueryData/index.tsx deleted file mode 100644 index f462a0d7d..000000000 --- a/app/src/presentation/screens/smasScreens/SelectNISQueryData/index.tsx +++ /dev/null @@ -1,103 +0,0 @@ -import React, { useContext } from 'react' -import { Platform } from 'react-native' - -import { SmasContext } from '@contexts/SmasContext' - -import { SelectNISQueryDataScreenProps } from '@routes/Stack/PublicServicesStack/screenProps' -import { PublicServiceStackParamList } from '@routes/Stack/PublicServicesStack/types' - -import { Container, InstructionButtonContainer } from './styles' -import CalendarTodayWhiteIcon from '@assets/icons/calendarToday-white.svg' -import DescriptionWhiteIcon from '@assets/icons/description-white.svg' -import EyeDashedWhiteIcon from '@assets/icons/eyeDashed-white.svg' -import { relativeScreenHeight } from '@common/screenDimensions' -import { theme } from '@common/theme' - -import { BackButton } from '@components/_buttons/BackButton' -import { PrimaryButton } from '@components/_buttons/PrimaryButton' -import { InstructionCard } from '@components/_cards/InstructionCard' -import { DefaultHeaderContainer } from '@components/_containers/DefaultHeaderContainer' -import { FormContainer } from '@components/_containers/FormContainer' -import { VerticalSpacing } from '@components/_space/VerticalSpacing' - -function SelectNISQueryData({ navigation }: SelectNISQueryDataScreenProps) { - const { smasDataContext, getNumberOfMissingInfo } = useContext(SmasContext) - - const navigateBackwards = () => navigation.goBack() - - const navigateToInputScreen = (inputScreenName: keyof PublicServiceStackParamList) => { - navigation.push(inputScreenName) - } - - const numberOfMissingInfoRequested = () => { - return getNumberOfMissingInfo() === 2 ? 'uma informação adicional' : 'duas informações adicionais' - } - - return ( - - - - - - - - - - - - - { - !smasDataContext.motherName ? ( - navigateToInputScreen('InsertMotherNameNIS')} - /> - ) : <> - } - { - !smasDataContext.dateOfBirth ? ( - navigateToInputScreen('InsertDateOfBirthNIS')} - /> - ) : <> - } - { - !smasDataContext.anonymizedCpf ? ( - navigateToInputScreen('InsertAnonymizedCpfNIS')} - /> - ) : <> - } - - - ) -} - -export { SelectNISQueryData } diff --git a/app/src/presentation/screens/smasScreens/SelectNISQueryData/styles.ts b/app/src/presentation/screens/smasScreens/SelectNISQueryData/styles.ts deleted file mode 100644 index a0bb93356..000000000 --- a/app/src/presentation/screens/smasScreens/SelectNISQueryData/styles.ts +++ /dev/null @@ -1,17 +0,0 @@ -import styled from 'styled-components/native' - -import { relativeScreenWidth } from '@common/screenDimensions' - -export const Container = styled.KeyboardAvoidingView` - flex: 1; -` - -interface InstructionButtonContainerProps { - withPaddingLeft?: boolean -} - -export const InstructionButtonContainer = styled.View` - padding-left: ${({ withPaddingLeft }) => (withPaddingLeft ? relativeScreenWidth(15.5) : '0')}px; - flex-direction: row; - align-items: center; -` diff --git a/app/src/presentation/screens/smasScreens/SelectPublicService/index.tsx b/app/src/presentation/screens/smasScreens/SelectPublicService/index.tsx deleted file mode 100644 index cd928f48b..000000000 --- a/app/src/presentation/screens/smasScreens/SelectPublicService/index.tsx +++ /dev/null @@ -1,73 +0,0 @@ -import React from 'react' -import { StatusBar } from 'react-native' - -import { SmasService } from '@domain/smas/entity/types' - -import { SelectPublicServiceScreenProps } from '@routes/Stack/PublicServicesStack/screenProps' - -import { Container, Header } from './styles' -import PublicServicesWhiteIcon from '@assets/icons/publicServices-white.svg' -import { theme } from '@common/theme' - -import { OptionButton } from '@components/_buttons/OptionButton' -import { FormContainer } from '@components/_containers/FormContainer' -import { VerticalSpacing } from '@components/_space/VerticalSpacing' -import { DefaultPostViewHeader } from '@components/DefaultPostViewHeader' - -function SelectPublicService({ navigation }: SelectPublicServiceScreenProps) { - const navigateToSmasServices = (smasService: SmasService) => { - navigation.navigate('InsertNIS', { smasService }) - } - - return ( - - -
- navigation.goBack()} - /> -
- - - navigateToSmasServices('BEE')} - /> - navigateToSmasServices('PBF')} - /> - navigateToSmasServices('CADUNICO')} - /> - - -
- ) -} - -export { SelectPublicService } diff --git a/app/src/presentation/screens/smasScreens/SelectPublicService/styles.ts b/app/src/presentation/screens/smasScreens/SelectPublicService/styles.ts deleted file mode 100644 index aebe506d0..000000000 --- a/app/src/presentation/screens/smasScreens/SelectPublicService/styles.ts +++ /dev/null @@ -1,14 +0,0 @@ -import styled from 'styled-components/native' - -import { relativeScreenDensity } from '@common/screenDimensions' - -export const Container = styled.View` - flex: 1; -` - -export const Header = styled.View` - justify-content: space-between; - width: 100%; - background-color: ${({ theme }) => theme.colors.white[3]}; - padding: ${relativeScreenDensity(12)}px; -` diff --git a/app/src/services/cloudFunctions/CloudFunctionServiceInterface.ts b/app/src/services/cloudFunctions/CloudFunctionServiceInterface.ts index b0623b9ed..283f29143 100644 --- a/app/src/services/cloudFunctions/CloudFunctionServiceInterface.ts +++ b/app/src/services/cloudFunctions/CloudFunctionServiceInterface.ts @@ -1,7 +1,6 @@ import { FeedPosts } from '@domain/post/entity/types' -import { SmasRecoveryNISData, SmasService } from '@domain/smas/entity/types' -import { RequestData, NotifyUsersByLocationParams, FeedSearchParams } from './types/types' +import { FeedSearchParams } from './types/types' // TODO Type functions return @@ -9,10 +8,6 @@ interface CloudFunctionServiceInterface { checkUserPhoneAlreadyRegistredCloud: (phoneNumber: string) => Promise getPostsByLocationCloud: (searchParams: FeedSearchParams, userId: string) => Promise searchPostsCloud: (searchText: string, searchParams: FeedSearchParams, searchByRange: boolean, userId: string) => Promise - - getNisByUserData: (searchParams: SmasRecoveryNISData, smasService: SmasService) => Promise<{ NIS: string, status: number }> - getBenefitDataSmasByNis: (nis: string, smasService: SmasService, userId: string) => Promise - notifyUsersOnLocation: (searchParams: NotifyUsersByLocationParams, requestData: RequestData) => Promise } export { CloudFunctionServiceInterface } diff --git a/app/src/services/cloudFunctions/methods/getBenefitDataSmasByNis.ts b/app/src/services/cloudFunctions/methods/getBenefitDataSmasByNis.ts deleted file mode 100644 index 22677f410..000000000 --- a/app/src/services/cloudFunctions/methods/getBenefitDataSmasByNis.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { sendEvent } from '@newutils/methods/analyticsEvents' -import axios from 'axios' - -import { SmasService } from '@domain/smas/entity/types' - -import { getEnvVars } from '@infrastructure/environment' - -const { FIREBASE_CLOUD_URL } = getEnvVars() - -async function getBenefitDataSmasByNis(nis: string, smasService: SmasService, userId: string) { - return axios.post( - `${FIREBASE_CLOUD_URL}/smasAPI`, - { nis, queryType: smasService }, - { - headers: { - userId: userId, - }, - } - ) - .then((res) => { - sendEvent('smas_search', { smasService, smasResponse: 'success' }) - return res.data - }) - .catch((err) => { - if (err.response.status === 404) { - sendEvent('smas_search', { smasService, smasResponse: 'not_found' }) - return 404 - } - if (err.response.status !== 200) { - sendEvent('smas_search', { smasService, smasResponse: 'failed' }) - return 500 - } - - sendEvent('smas_search', { smasService, smasResponse: 'failed' }) - return 500 - }) -} - -export { getBenefitDataSmasByNis } diff --git a/app/src/services/cloudFunctions/methods/getNisByUserData.ts b/app/src/services/cloudFunctions/methods/getNisByUserData.ts deleted file mode 100644 index 25952d4af..000000000 --- a/app/src/services/cloudFunctions/methods/getNisByUserData.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { sendEvent } from '@newutils/methods/analyticsEvents' -import axios from 'axios' - -import { SmasRecoveryNISData, SmasService } from '@domain/smas/entity/types' - -import { getEnvVars } from '@infrastructure/environment' - -const { FIREBASE_CLOUD_URL } = getEnvVars() - -async function getNisByUserData(searchParams: SmasRecoveryNISData, smasService: SmasService) { - return axios.post(`${FIREBASE_CLOUD_URL}/smasAPI`, { ...searchParams, queryType: smasService }) - .then((res) => { - sendEvent('recovery_nis', { smasResponse: 'success' }) - return { NIS: res.data.toString(), status: 200 } - }) - .catch((err) => { - if (err.response.status === 404) { - sendEvent('recovery_nis', { smasResponse: 'not_found' }) - return { NIS: '', status: 404 } - } - - if (err.response.status !== 200) { - sendEvent('recovery_nis', { smasResponse: 'failed' }) - return { NIS: '', status: 500 } - } - - sendEvent('recovery_nis', { smasResponse: 'failed' }) - return { NIS: '', status: 500 } - }) -} - -export { getNisByUserData } diff --git a/app/src/services/cloudFunctions/methods/notifyUsersOnLocation.ts b/app/src/services/cloudFunctions/methods/notifyUsersOnLocation.ts deleted file mode 100644 index 422306ef5..000000000 --- a/app/src/services/cloudFunctions/methods/notifyUsersOnLocation.ts +++ /dev/null @@ -1,15 +0,0 @@ -import axios from 'axios' - -import { RequestData, NotifyUsersByLocationParams } from '../types/types' - -import { getEnvVars } from '@infrastructure/environment' - -const { FIREBASE_CLOUD_URL } = getEnvVars() - -async function notifyUsersOnLocation(searchParams: NotifyUsersByLocationParams, requestData: RequestData) { - return axios.post(`${FIREBASE_CLOUD_URL}/notifyUsersOnLocation`, { searchParams, requestData }) - .then((res) => console.log(res.status)) - .catch((err) => console.log(err)) -} - -export { notifyUsersOnLocation } diff --git a/app/src/services/cloudFunctions/types/types.ts b/app/src/services/cloudFunctions/types/types.ts index e366582ec..4f1e7e5a2 100644 --- a/app/src/services/cloudFunctions/types/types.ts +++ b/app/src/services/cloudFunctions/types/types.ts @@ -15,21 +15,3 @@ export type FeedSearchParams = { coordinates: LatLong // Não existem geohashes: string[] } - -export type NotifyUsersByLocationParams = { - state: string - city: string - district: string - postRange: 'near' | 'city' -} - -export type RequestData = { - userId: string - userName: string - postDescription: string -} - -export type RequestBody = { - searchParams: NotifyUsersByLocationParams - requestData: RequestData -} diff --git a/app/src/services/cloudFunctions/useCloudFunctionService.ts b/app/src/services/cloudFunctions/useCloudFunctionService.ts index 38bbb0b56..e91c977e9 100644 --- a/app/src/services/cloudFunctions/useCloudFunctionService.ts +++ b/app/src/services/cloudFunctions/useCloudFunctionService.ts @@ -1,20 +1,13 @@ import { CloudFunctionServiceInterface } from './CloudFunctionServiceInterface' import { checkUserPhoneAlreadyRegistredCloud } from './methods/checkUserPhoneAlreadyRegistred' -import { getBenefitDataSmasByNis } from './methods/getBenefitDataSmasByNis' -import { getNisByUserData } from './methods/getNisByUserData' import { getPostsByLocationCloud } from './methods/getPostsByLocationCloud' -import { notifyUsersOnLocation } from './methods/notifyUsersOnLocation' import { searchPostsCloud } from './methods/searchPostsCloud' function useCloudFunctionService(): CloudFunctionServiceInterface { return { checkUserPhoneAlreadyRegistredCloud: checkUserPhoneAlreadyRegistredCloud, getPostsByLocationCloud: getPostsByLocationCloud, - searchPostsCloud: searchPostsCloud, - - getNisByUserData: getNisByUserData, - getBenefitDataSmasByNis: getBenefitDataSmasByNis, - notifyUsersOnLocation: notifyUsersOnLocation + searchPostsCloud: searchPostsCloud } }