From 98cb2afea7324cb00e38827e446fd77697fcc53d Mon Sep 17 00:00:00 2001 From: sudjoao Date: Thu, 26 Oct 2023 19:23:12 -0300 Subject: [PATCH] feat: create eas config --- app/app.config.js | 6 ++--- app/app.json | 18 +++++++++++--- app/eas.json | 35 +++++++++++++++------------ app/src/config/envVariables.js | 4 +-- app/src/services/Firebase.js | 10 +++++--- app/src/store/contexts/userContext.js | 4 +-- 6 files changed, 46 insertions(+), 31 deletions(-) diff --git a/app/app.config.js b/app/app.config.js index 07d630fd7..08b0c9cca 100644 --- a/app/app.config.js +++ b/app/app.config.js @@ -1,5 +1,5 @@ -const { MAPS_API_KEY } = process.env; +const { MAPS_API_KEY, GOOGLE_SERVICES_JSON } = process.env; export default ({ config }) => { return { @@ -15,13 +15,13 @@ export default ({ config }) => { 'READ_PHONE_STATE', 'WRITE_EXTERNAL_STORAGE', ], - googleServicesFile: './google-services.json', + googleServicesFile: GOOGLE_SERVICES_JSON, config: { googleMaps: { apiKey: MAPS_API_KEY, }, }, - versionCode: 220, + versionCode: 303, }, }; }; diff --git a/app/app.json b/app/app.json index 2e3f678c7..3c7d5910c 100644 --- a/app/app.json +++ b/app/app.json @@ -3,13 +3,21 @@ "name": "Mia Ajuda", "slug": "miaajuda", "privacy": "public", - "platforms": ["android", "ios"], + "platforms": [ + "android", + "ios" + ], "notification": { "icon": "./assets/images/logo.png", "color": "#4b8ab9", "androidMode": "default" }, - "version": "2.2.0 Mutt", + "extra": { + "eas": { + "projectId": "" + } + }, + "version": "3.0.3 Corgi", "orientation": "portrait", "icon": "./assets/images/logo.png", "splash": { @@ -20,7 +28,9 @@ "updates": { "fallbackToCacheTimeout": 0 }, - "assetBundlePatterns": ["**/*"], + "assetBundlePatterns": [ + "**/*" + ], "ios": { "supportsTablet": true, "bundleIdentifier": "com.miaajuda.app" @@ -42,4 +52,4 @@ ] } } -} +} \ No newline at end of file diff --git a/app/eas.json b/app/eas.json index 300f4ac88..970b23578 100644 --- a/app/eas.json +++ b/app/eas.json @@ -1,19 +1,22 @@ { - "cli": { - "version": ">= 0.57.0" + "cli": { + "version": ">= 5.5.0" + }, + "build": { + "development": { + "developmentClient": true, + "distribution": "internal" }, - "submit": { - "production": { - "android": { - "serviceAccountKeyPath": "./serviceAccountKey.json", - "track": "production" - } - }, - "alpha_test": { - "android": { - "serviceAccountKeyPath": "./serviceAccountKey.json", - "track": "alpha" - } - } + "preview": { + "distribution": "internal" + }, + "production": { + "android": { + "buildType": "apk" + } } -} + }, + "submit": { + "production": {} + } +} \ No newline at end of file diff --git a/app/src/config/envVariables.js b/app/src/config/envVariables.js index a431548af..5155a5c36 100644 --- a/app/src/config/envVariables.js +++ b/app/src/config/envVariables.js @@ -2,8 +2,8 @@ import Constants from 'expo-constants'; import { IP_ADDRESS, HOMOLOG_API } from '@env'; const prodUrl = 'http://164.41.92.25:8000/'; -const homologUrl = `https://${HOMOLOG_API}/`; -const devUrl = `http://${IP_ADDRESS}:8000/`; +const homologUrl = 'http://164.41.92.25:8000/' +const devUrl = 'http://164.41.92.25:8000/' const ENV = { dev: { diff --git a/app/src/services/Firebase.js b/app/src/services/Firebase.js index cc0defc77..b3ee9b3ea 100644 --- a/app/src/services/Firebase.js +++ b/app/src/services/Firebase.js @@ -10,14 +10,16 @@ import { onAuthStateChanged, } from 'firebase/auth'; import Constants from 'expo-constants'; -import authConfig from '../config/authmiaajuda-firebase'; -import authConfigDev from '../config/authmiaajuda-firebase-dev'; +const { AUTH_CONFIG_JSON, AUTH_DEV_CONFIG_JSON } = process.env +console.log(process.env) +// console.log(AUTH_CONFIG_JSON) +// const authConfig = JSON.parse(AUTH_CONFIG_JSON); +// const authConfigDev = JSON.parse(AUTH_DEV_CONFIG_JSON); class FirebaseService { constructor() { const env = Constants.manifest.releaseChannel; - const { apiKey, authDomain, projectId } = - env == 'prod' ? authConfig : authConfigDev; + const { apiKey, authDomain, projectId } = {}; this.app = initializeApp({ apiKey, authDomain, diff --git a/app/src/store/contexts/userContext.js b/app/src/store/contexts/userContext.js index 7e967c862..8f685c647 100644 --- a/app/src/store/contexts/userContext.js +++ b/app/src/store/contexts/userContext.js @@ -7,7 +7,7 @@ import actions from '../actions'; import env from '../../config/envVariables'; import { - getCurrentPositionAsync, + getLastKnownPositionAsync, requestForegroundPermissionsAsync, } from 'expo-location'; import callService from '../../services/callService'; @@ -42,7 +42,7 @@ export const UserContextProvider = (props) => { async function getLocation() { const { granted } = await requestForegroundPermissionsAsync(); if (granted) { - const { coords } = await getCurrentPositionAsync({ + const { coords } = await getLastKnownPositionAsync({ enableHighAccuracy: true, }); const { latitude, longitude } = coords;