From a85d3d0af3a36146552b81cfdcc0ea9f7234661f Mon Sep 17 00:00:00 2001 From: Mateusz Rostkowski Date: Fri, 22 Mar 2024 12:14:27 +0100 Subject: [PATCH 01/29] chore: add comments to app.config file --- app.config.ts | 55 +++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 53 insertions(+), 2 deletions(-) diff --git a/app.config.ts b/app.config.ts index 80c75a95..d44a373b 100644 --- a/app.config.ts +++ b/app.config.ts @@ -32,6 +32,20 @@ const IS_DEV = process.env.IS_DEV === '1' const runtimeVersion = { policy: IS_DEV ? 'sdkVersion' : 'appVersion' } as const type Setup = { [key in Environments]: string } + +// https://patorjk.com/software/taag/#p=display&h=0&v=0&c=c&f=ANSI%20Regular&t=CONFIG +/*** + * ██████ ██████ ███ ██ ███████ ██ ██████ + * ██ ██ ██ ████ ██ ██ ██ ██ + * ██ ██ ██ ██ ██ ██ █████ ██ ██ ███ + * ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ + * ██████ ██████ ██ ████ ██ ██ ██████ + * + * + */ + +// CONFIG: You can change the values below to adjust app +// You can also run `yarn bootstrap` script to make this steps more safety export const EAS_ENV_CONFIG: { [key: string]: Setup } = { adaptiveIconBackgroundColor: { production: APP_CONFIG.adaptiveIconBackgroundColor, @@ -75,7 +89,42 @@ export const EAS_ENV_CONFIG: { [key: string]: Setup } = { }, } as const -// CONFIG: Add your eas build config here !! More details about the following parameters, and other available configs -> https://docs.expo.dev/build-reference/eas-json/ +const universalLinks = [ + 'https://r.pl', + 'https://biletyczarterowe.r.pl', + // Uncomment this when testing, you can add your own domain for testing purposes + // 'https://chic-queijadas-4c3b2c.netlify.app' +] + +/*** + * ██████ ██ ██ ███ ██ █████ ███ ███ ██ ██████ + * ██ ██ ██ ██ ████ ██ ██ ██ ████ ████ ██ ██ + * ██ ██ ████ ██ ██ ██ ███████ ██ ████ ██ ██ ██ + * ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ + * ██████ ██ ██ ████ ██ ██ ██ ██ ██ ██████ + * + * + * ██████ ██████ ███ ██ ███████ ██ ██████ + * ██ ██ ██ ████ ██ ██ ██ ██ + * ██ ██ ██ ██ ██ ██ █████ ██ ██ ███ + * ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ + * ██████ ██████ ██ ████ ██ ██ ██████ + * + * + */ +// Please make sure you know what are you doing when you make some changes on the bottom + +const associatedDomains = universalLinks.map((link) => link.replace('https://', 'applinks:')) +const intentFilters = universalLinks.map((link) => ({ + action: 'VIEW', + autoVerify: true, + data: [''].map(() => ({ + scheme: 'https', + host: link.replace('https://', ''), + })), + category: ['BROWSABLE', 'DEFAULT'], +})) + export default ({ config }: ConfigContext): Partial => { const ENVIRONMENT = (process.env.ENVIRONMENT || 'qa') as Environments @@ -92,16 +141,18 @@ export default ({ config }: ConfigContext): Partial => { foregroundImage: EAS_ENV_CONFIG.adaptiveIcon[ENVIRONMENT], }, package: EAS_ENV_CONFIG.androidPackageName[ENVIRONMENT], + intentFilters, }, extra: { eas: { projectId: APP_CONFIG.easProjectId }, ENVIRONMENT, + universalLinks, ...process.env, - universalLinks: [], }, icon: EAS_ENV_CONFIG.appIcon[ENVIRONMENT], ios: { ...config.ios, + associatedDomains, bundleIdentifier: EAS_ENV_CONFIG.iosBundleIdentifier[ENVIRONMENT], }, name: EAS_ENV_CONFIG.appName[ENVIRONMENT], From 81d07e698e0f31359ea7a4bdb934ee0a9774ce4d Mon Sep 17 00:00:00 2001 From: Mateusz Rostkowski Date: Fri, 22 Mar 2024 12:16:40 +0100 Subject: [PATCH 02/29] fix: rename ENVIRONMENT to ENVIRONMENT_NAME --- app.config.ts | 24 ++++++++++++------------ scripts/README.md | 6 +++--- scripts/upload_env.sh | 2 +- src/constants/env.ts | 2 +- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/app.config.ts b/app.config.ts index d44a373b..b0b73530 100644 --- a/app.config.ts +++ b/app.config.ts @@ -126,10 +126,10 @@ const intentFilters = universalLinks.map((link) => ({ })) export default ({ config }: ConfigContext): Partial => { - const ENVIRONMENT = (process.env.ENVIRONMENT || 'qa') as Environments + const ENVIRONMENT_NAME = (process.env.ENVIRONMENT_NAME || 'qa') as Environments - if (!envValues.includes(ENVIRONMENT)) { - throw Error(`${ENVIRONMENT} setup missing`) + if (!envValues.includes(ENVIRONMENT_NAME)) { + throw Error(`${ENVIRONMENT_NAME} setup missing`) } return { @@ -137,32 +137,32 @@ export default ({ config }: ConfigContext): Partial => { android: { ...config.android, adaptiveIcon: { - backgroundColor: EAS_ENV_CONFIG.adaptiveIconBackgroundColor[ENVIRONMENT], - foregroundImage: EAS_ENV_CONFIG.adaptiveIcon[ENVIRONMENT], + backgroundColor: EAS_ENV_CONFIG.adaptiveIconBackgroundColor[ENVIRONMENT_NAME], + foregroundImage: EAS_ENV_CONFIG.adaptiveIcon[ENVIRONMENT_NAME], }, - package: EAS_ENV_CONFIG.androidPackageName[ENVIRONMENT], + package: EAS_ENV_CONFIG.androidPackageName[ENVIRONMENT_NAME], intentFilters, }, extra: { eas: { projectId: APP_CONFIG.easProjectId }, - ENVIRONMENT, + ENVIRONMENT_NAME, universalLinks, ...process.env, }, - icon: EAS_ENV_CONFIG.appIcon[ENVIRONMENT], + icon: EAS_ENV_CONFIG.appIcon[ENVIRONMENT_NAME], ios: { ...config.ios, associatedDomains, - bundleIdentifier: EAS_ENV_CONFIG.iosBundleIdentifier[ENVIRONMENT], + bundleIdentifier: EAS_ENV_CONFIG.iosBundleIdentifier[ENVIRONMENT_NAME], }, - name: EAS_ENV_CONFIG.appName[ENVIRONMENT], + name: EAS_ENV_CONFIG.appName[ENVIRONMENT_NAME], owner: config.owner || 'binarapps', runtimeVersion, - scheme: EAS_ENV_CONFIG.scheme[ENVIRONMENT], + scheme: EAS_ENV_CONFIG.scheme[ENVIRONMENT_NAME], updates: { url: `https://u.expo.dev/${APP_CONFIG.easProjectId}` }, web: { ...config.web, - favicon: EAS_ENV_CONFIG.favicon[ENVIRONMENT], + favicon: EAS_ENV_CONFIG.favicon[ENVIRONMENT_NAME], }, } } diff --git a/scripts/README.md b/scripts/README.md index cb481bef..a4332363 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -10,7 +10,7 @@ 1.1. Create `.env` files corresponding to the environment (`.env.production`,`.env.qa`,`.env.staging`) -1.2. Each of newly created files should consist at least one variable `ENVIRONMENT`. +1.2. Each of newly created files should consist at least one variable `ENVIRONMENT_NAME`. Accordingly to environment value should be `production`,`qa` or `staging` @@ -18,9 +18,9 @@ Accordingly to environment value should be `production`,`qa` or `staging` You should pass environment variables to files provided in 1.1. which follow `.env` file rules -Each `.env` file has included `ENVIRONMENT` variable to allow use proper configuration in build process. +Each `.env` file has included `ENVIRONMENT_NAME` variable to allow use proper configuration in build process. -Values of the `ENVIRONMENT` variable should always be passed to `.env` file and have following values depending of environment `production`, `qa` or `staging`. +Values of the `ENVIRONMENT_NAME` variable should always be passed to `.env` file and have following values depending of environment `production`, `qa` or `staging`. ### 1.3. Running `generate_dotenv.sh` script diff --git a/scripts/upload_env.sh b/scripts/upload_env.sh index 9dc8dc43..ff3aafee 100755 --- a/scripts/upload_env.sh +++ b/scripts/upload_env.sh @@ -5,7 +5,7 @@ green="$bold$(tput setaf 2)" # bright green text darkcyan=$(tput setaf 6) # dim cyan text echo "${darkcyan}[START] Generating build and submit credentials" -echo ${ENVIRONMENT} +echo ${ENVIRONMENT_NAME} eas secret:push --scope project --env-file .env --force diff --git a/src/constants/env.ts b/src/constants/env.ts index a54eb9f9..24516a12 100644 --- a/src/constants/env.ts +++ b/src/constants/env.ts @@ -2,6 +2,6 @@ import Constants from 'expo-constants' export const ENV = { API_URL: Constants?.expoConfig?.extra?.API_URL, - ENVIRONMENT: Constants?.expoConfig?.extra?.ENVIRONMENT, + ENVIRONMENT_NAME: Constants?.expoConfig?.extra?.ENVIRONMENT_NAME, EAS_PROJECT_ID: 'ac562c27-4a4e-4532-869f-fe6f9447bee6', // FIXME: Move it to .env } From 976a69f0914b7ff2d7025fe65df56917ca57632f Mon Sep 17 00:00:00 2001 From: Mateusz Rostkowski Date: Fri, 22 Mar 2024 12:17:48 +0100 Subject: [PATCH 03/29] chore: update universal links array --- app.config.ts | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/app.config.ts b/app.config.ts index b0b73530..22824b9d 100644 --- a/app.config.ts +++ b/app.config.ts @@ -89,12 +89,7 @@ export const EAS_ENV_CONFIG: { [key: string]: Setup } = { }, } as const -const universalLinks = [ - 'https://r.pl', - 'https://biletyczarterowe.r.pl', - // Uncomment this when testing, you can add your own domain for testing purposes - // 'https://chic-queijadas-4c3b2c.netlify.app' -] +const universalLinks = ['https://baca-six.vercel.app'] /*** * ██████ ██ ██ ███ ██ █████ ███ ███ ██ ██████ From 386914ee62bb4a69886fb5f16d02edb2fd9cc361 Mon Sep 17 00:00:00 2001 From: Mateusz Rostkowski Date: Sat, 23 Mar 2024 16:37:25 +0100 Subject: [PATCH 04/29] chore: update withDebugKeystore plugin --- {plugin => plugins}/withDebugKeystore.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) rename {plugin => plugins}/withDebugKeystore.js (88%) diff --git a/plugin/withDebugKeystore.js b/plugins/withDebugKeystore.js similarity index 88% rename from plugin/withDebugKeystore.js rename to plugins/withDebugKeystore.js index 1c21eeb5..d0b79e3d 100644 --- a/plugin/withDebugKeystore.js +++ b/plugins/withDebugKeystore.js @@ -4,6 +4,11 @@ const fs = require('fs') module.exports = function withDebugKeystore(mainConfig, props) { const { storePassword, keyAlias, keyPassword } = props || {} + + if (!storePassword || !keyAlias || !keyPassword) { + return + } + const appBuildGradle = withAppBuildGradle(mainConfig, async (config) => { config.modResults.contents = config.modResults.contents.replace( "storeFile file('debug.keystore')", @@ -13,21 +18,21 @@ module.exports = function withDebugKeystore(mainConfig, props) { if (storePassword) { config.modResults.contents = config.modResults.contents.replace( "storePassword 'android'", - `storePassword '2d4a995df1b18f0e16f1352eb227bee1'` + `storePassword '${storePassword}'` ) } if (keyAlias) { config.modResults.contents = config.modResults.contents.replace( "keyAlias 'androiddebugkey'", - `keyAlias 'd163cbc4fe503964637c6dc4601a56ab'` + `keyAlias '${keyAlias}'` ) } if (keyPassword) { config.modResults.contents = config.modResults.contents.replace( "keyPassword 'android'", - `keyPassword '9139334a6da1fcd2fdba63dfa74967f'` + `keyPassword '${keyPassword}'` ) } From afbdccb64682353ec8549d726ae9ae61f66eeb22 Mon Sep 17 00:00:00 2001 From: Mateusz Rostkowski Date: Sat, 23 Mar 2024 16:38:16 +0100 Subject: [PATCH 05/29] chore: update web deeplinks files --- public/.well-known/apple-app-site-association | 6 +++--- public/.well-known/assetlinks.json | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/public/.well-known/apple-app-site-association b/public/.well-known/apple-app-site-association index d7756d9b..aa57b9b6 100644 --- a/public/.well-known/apple-app-site-association +++ b/public/.well-known/apple-app-site-association @@ -3,7 +3,7 @@ "details": [ { "appIDs": [ - "ABCDE12345.online.binarapps" + "5764GC687R.com.binarapps.baca" ], "components": [ { @@ -33,12 +33,12 @@ }, "webcredentials": { "apps": [ - "ABCDE12345.online.binarapps" + "5764GC687R.com.binarapps.baca" ] }, "appclips": { "apps": [ - "ABCED12345.online.binarapps" + "5764GC687R.com.binarapps.baca" ] } } diff --git a/public/.well-known/assetlinks.json b/public/.well-known/assetlinks.json index de78d5f7..e4012cb9 100644 --- a/public/.well-known/assetlinks.json +++ b/public/.well-known/assetlinks.json @@ -3,9 +3,10 @@ "relation": ["delegate_permission/common.handle_all_urls"], "target": { "namespace": "android_app", - "package_name": "online.binarapps", + "package_name": "com.binarapps.baca", "sha256_cert_fingerprints": [ - "B9:77:35:F2:94:7B:EC:53:F9:60:5F:32:1C:12:5C:E9:4E:27:9E:E2:A7:EE:6F:62:A4:77:21:98:AD:11:2A:B1" + "BC:32:97:EA:93:CE:17:FA:FD:66:FC:67:9F:AD:70:71:D1:D9:50:FB:B8:E5:1D:92:49:EE:F7:F0:DE:29:D8:09", + "9A:3B:31:10:84:96:07:EC:3C:77:84:91:F5:80:7A:53:23:C0:B6:C3:25:D8:60:E8:EE:16:6B:75:0A:0A:25:8B" ] } } From 4f296488d97f316a3cd4fb6e6d4f29f106bc60ef Mon Sep 17 00:00:00 2001 From: Mateusz Rostkowski Date: Sat, 23 Mar 2024 16:38:56 +0100 Subject: [PATCH 06/29] chore: update package.json scripts --- package.json | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 2f3221fc..d5ed3a8e 100644 --- a/package.json +++ b/package.json @@ -59,9 +59,9 @@ "prebuild:android": "IS_DEV=1 npx expo prebuild --clean -p android", "prebuild:ios": "IS_DEV=1 npx expo prebuild --clean -p ios", "prepare:env_file": "cp ./templates/doppler_variables_template.sh ./scripts/doppler_variables.sh", - "prepare:production": "yarn && yarn generate:env:production && yarn generate:google-services-config", - "prepare:qa": "yarn && yarn generate:env:qa && yarn generate:google-services-config", - "prepare:staging": "yarn && yarn generate:env:staging && yarn generate:google-services-config", + "prepare:production": "yarn && yarn upload:env && yarn generate:env:production && yarn generate:google-services-config", + "prepare:qa": "yarn && yarn upload:env && yarn generate:env:qa && yarn generate:google-services-config", + "prepare:staging": "yarn && yarn upload:env && yarn generate:env:staging && yarn generate:google-services-config", "prepare": "husky install", "prettier:write": "prettier --write ./src", "start:prod": "yarn generate:env:production && IS_DEV=1 IS_EXPO_GO=1 expo start -c -g", @@ -82,10 +82,12 @@ "update:staging:ios": "yarn prepare:staging && eas update --branch staging --platform ios", "update:staging": "yarn prepare:staging && eas update --branch staging --message=\"ENV: Staging\"", "updateSnapshots": "jest -u --coverage=false", - "upload": "yarn upload:ios && yarn upload:android", + "upload:env": "./scripts/upload_env.sh", "web:build": "expo export:web", "web": "cross-env IS_DEV=1 expo start --web", - "whoami": "expo whoami" + "whoami": "expo whoami", + "android": "expo run:android", + "ios": "expo run:ios" }, "dependencies": { "@bacons/react-views": "^1.1.3", From da5affef305f6af3e08bde645fa9a571ed5f4bdf Mon Sep 17 00:00:00 2001 From: Mateusz Rostkowski Date: Sat, 23 Mar 2024 16:40:38 +0100 Subject: [PATCH 07/29] chore: remove wrongly usage of withDebugKeystore plugin --- app.json | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app.json b/app.json index 5e5ab2d1..4ba25945 100644 --- a/app.json +++ b/app.json @@ -11,7 +11,10 @@ "jsEngine": "hermes", "buildNumber": "10", "supportsTablet": true, - "googleServicesFile": "./GoogleService-Info.plist" + "googleServicesFile": "./GoogleService-Info.plist", + "config": { + "usesNonExemptEncryption": false + } }, "name": "Template", "orientation": "portrait", @@ -32,8 +35,7 @@ "expo-font", "expo-localization", "expo-secure-store", - "expo-router", - "./plugin/withDebugKeystore.js" + "expo-router" ], "web": { "output": "single", From cefcf64858ae36263ddb7bceccb240bbb2e72477 Mon Sep 17 00:00:00 2001 From: Mateusz Rostkowski Date: Sat, 23 Mar 2024 16:41:03 +0100 Subject: [PATCH 08/29] chore: update eas.json --- eas.json | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/eas.json b/eas.json index c5db3eaa..7404aff7 100644 --- a/eas.json +++ b/eas.json @@ -3,13 +3,14 @@ "production": { "android": { "autoIncrement": true, - "buildType": "apk" + "buildType": "app-bundle" }, "channel": "production", "distribution": "store", "ios": { "autoIncrement": "buildNumber" - } + }, + "node": "18.15.0" }, "staging": { "android": { @@ -20,7 +21,8 @@ "distribution": "store", "ios": { "autoIncrement": "buildNumber" - } + }, + "node": "18.15.0" }, "qa": { "android": { @@ -31,7 +33,8 @@ "distribution": "store", "ios": { "autoIncrement": "buildNumber" - } + }, + "node": "18.15.0" } }, "cli": { @@ -52,7 +55,10 @@ "submit": { "production": { "android": {}, - "ios": {} + "ios": { + "ascAppId": "6478398699", + "appleTeamId": "5764GC687R" + } }, "staging": { "android": {}, @@ -63,4 +69,4 @@ "ios": {} } } -} \ No newline at end of file +} From ffe43156c58147faca10e2bb54028e5f6e0f67e8 Mon Sep 17 00:00:00 2001 From: Mateusz Rostkowski Date: Sat, 23 Mar 2024 18:19:24 +0100 Subject: [PATCH 09/29] chore: update app.config.ts --- app.config.ts | 93 +++++++++++++++++++++++++++++++++------------------ 1 file changed, 60 insertions(+), 33 deletions(-) diff --git a/app.config.ts b/app.config.ts index 22824b9d..4c1307e9 100644 --- a/app.config.ts +++ b/app.config.ts @@ -16,17 +16,6 @@ const adaptiveIconPath = './assets/icons/android/adaptive-icon-' const appIconPath = './assets/icons/ios/icon-' const faviconPath = './assets/icons/web/favicon-' -// APP_CONFIG_START -export const APP_CONFIG = { - androidPackageName: 'online.binarapps', // CONFIG: Add your android package name here - appName: 'Template', // CONFIG: Add your app name here - easProjectId: 'ac562c27-4a4e-4532-869f-fe6f9447bee6', // CONFIG: Add your eas project ID here - iosBundleIdentifier: 'online.binarapps', // CONFIG: Add your ios bundle identifier here - scheme: 'yourUrlScheme', // CONFIG: Add your url scheme to link to your app - adaptiveIconBackgroundColor: '#2E7AF0CC', // CONFIG: Add your android adaptive icon background color here -} as const -// APP_CONFIG_END - const IS_DEV = process.env.IS_DEV === '1' const runtimeVersion = { policy: IS_DEV ? 'sdkVersion' : 'appVersion' } as const @@ -41,11 +30,41 @@ type Setup = { [key in Environments]: string } * ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ * ██████ ██████ ██ ████ ██ ██ ██████ * - * */ // CONFIG: You can change the values below to adjust app // You can also run `yarn bootstrap` script to make this steps more safety + +// APP_CONFIG_START +export const APP_CONFIG = { + androidPackageName: 'com.binarapps.baca', // CONFIG: Add your android package name here + appName: 'BACA', // CONFIG: Add your app name here + easProjectId: 'ac562c27-4a4e-4532-869f-fe6f9447bee6', // CONFIG: Add your eas project ID here + iosBundleIdentifier: 'com.binarapps.baca', // CONFIG: Add your ios bundle identifier here + scheme: 'baca', // CONFIG: Add your url scheme to link to your app + adaptiveIconBackgroundColor: '#2E7AF0CC', // CONFIG: Add your android adaptive icon background color here +} as const +// APP_CONFIG_END + +const universalLinks = ['https://baca-six.vercel.app'] + +/*** + * ██████ ██ ██ ███ ██ █████ ███ ███ ██ ██████ + * ██ ██ ██ ██ ████ ██ ██ ██ ████ ████ ██ ██ + * ██ ██ ████ ██ ██ ██ ███████ ██ ████ ██ ██ ██ + * ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ + * ██████ ██ ██ ████ ██ ██ ██ ██ ██ ██████ + * + * + * ██████ ██████ ███ ██ ███████ ██ ██████ + * ██ ██ ██ ████ ██ ██ ██ ██ + * ██ ██ ██ ██ ██ ██ █████ ██ ██ ███ + * ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ + * ██████ ██████ ██ ████ ██ ██ ██████ + * + */ +// Please make sure you know what are you doing when you make some changes on the bottom + export const EAS_ENV_CONFIG: { [key: string]: Setup } = { adaptiveIconBackgroundColor: { production: APP_CONFIG.adaptiveIconBackgroundColor, @@ -89,26 +108,6 @@ export const EAS_ENV_CONFIG: { [key: string]: Setup } = { }, } as const -const universalLinks = ['https://baca-six.vercel.app'] - -/*** - * ██████ ██ ██ ███ ██ █████ ███ ███ ██ ██████ - * ██ ██ ██ ██ ████ ██ ██ ██ ████ ████ ██ ██ - * ██ ██ ████ ██ ██ ██ ███████ ██ ████ ██ ██ ██ - * ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ - * ██████ ██ ██ ████ ██ ██ ██ ██ ██ ██████ - * - * - * ██████ ██████ ███ ██ ███████ ██ ██████ - * ██ ██ ██ ████ ██ ██ ██ ██ - * ██ ██ ██ ██ ██ ██ █████ ██ ██ ███ - * ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ - * ██████ ██████ ██ ████ ██ ██ ██████ - * - * - */ -// Please make sure you know what are you doing when you make some changes on the bottom - const associatedDomains = universalLinks.map((link) => link.replace('https://', 'applinks:')) const intentFilters = universalLinks.map((link) => ({ action: 'VIEW', @@ -126,6 +125,33 @@ export default ({ config }: ConfigContext): Partial => { if (!envValues.includes(ENVIRONMENT_NAME)) { throw Error(`${ENVIRONMENT_NAME} setup missing`) } + const { + KEYSTORE_KEY_ALIAS = '', + KEYSTORE_KEY_PASSWORD = '', + KEYSTORE_STORE_PASSWORD = '', + ...environmentVariables + } = process.env || {} + + // This is used to make usable keystore file in debug + // It's usefull because thanks to that you can test in prebuilded app native functionalities like: + // - push notifications + // - maps + // - google / facebook sign in + // - deeplinks + const keystorePlugin: Partial['plugins'] = IS_DEV + ? [ + [ + './plugins/withDebugKeystore', + { + storePassword: KEYSTORE_STORE_PASSWORD, + keyAlias: KEYSTORE_KEY_ALIAS, + keyPassword: KEYSTORE_KEY_PASSWORD, + }, + ], + ] + : [] + + const plugins = [...(config?.plugins ?? []), ...keystorePlugin] return { ...config, @@ -142,7 +168,7 @@ export default ({ config }: ConfigContext): Partial => { eas: { projectId: APP_CONFIG.easProjectId }, ENVIRONMENT_NAME, universalLinks, - ...process.env, + ...(environmentVariables || {}), }, icon: EAS_ENV_CONFIG.appIcon[ENVIRONMENT_NAME], ios: { @@ -153,6 +179,7 @@ export default ({ config }: ConfigContext): Partial => { name: EAS_ENV_CONFIG.appName[ENVIRONMENT_NAME], owner: config.owner || 'binarapps', runtimeVersion, + plugins, scheme: EAS_ENV_CONFIG.scheme[ENVIRONMENT_NAME], updates: { url: `https://u.expo.dev/${APP_CONFIG.easProjectId}` }, web: { From 5c5a24a450ae967bb4e1ba57c9a4f622738cdb81 Mon Sep 17 00:00:00 2001 From: Mateusz Rostkowski Date: Sat, 23 Mar 2024 18:19:48 +0100 Subject: [PATCH 10/29] chore: improve deploy ios docs --- docs/docs/deploy/DEPLOY_IOS.md | 64 +++++++++++++++++++--------------- 1 file changed, 35 insertions(+), 29 deletions(-) diff --git a/docs/docs/deploy/DEPLOY_IOS.md b/docs/docs/deploy/DEPLOY_IOS.md index 7fa3618d..f2a9435b 100644 --- a/docs/docs/deploy/DEPLOY_IOS.md +++ b/docs/docs/deploy/DEPLOY_IOS.md @@ -13,7 +13,9 @@ description: Build & deploy the iOS app # Build & deploy the iOS app -1.Build first iOS binary 🕐 / 📱 +--- + +## Build first iOS binary 🕐 / 📱
  1. Check if you are already logged in to your eas/expo account
  2. @@ -52,9 +54,11 @@ yarn build:[qa/staging/production]:ios CONGRATULATION !! 🥳🥳 You just started your first IOS build of the QA app version! -2.Deploy the first iOS app version for tests in TestFlight. 🕐 / 📱 +--- -
      +## Deploy the first iOS app version for tests in TestFlight. 🕐 / 📱 + +
      1. Creating new apps in App Store Connect @@ -63,47 +67,47 @@ When you created an iOS binary (your build is in progress or at least you've gen
        1. Log in to App Store Connect to the account you were logged in to while building the app in the previous step.
        2. -Create a new app. +Create a new app: -1.Got to the Apps tab. +- Go to the Apps tab. -![Apps tab](../../static/img/deploy_apps.png) -2.Click on the +button to create a new app. + ![Apps tab](../../static/img/deploy_apps.png) -![Create new app](../../static/img/deploy_add_button.png) -3.Select New app from the popup. +- Click on the `+` button to create a new app. -![Select new app](../../static/img/deploy_new_app.png) + ![Create new app](../../static/img/deploy_add_button.png) -4.Fill out the questionnaire about the newly created app. +- Select New app from the popup. -![Fill out the questionnaire](../../static/img/deploy_new_form.png) + ![Select new app](../../static/img/deploy_new_app.png) -Fields description: +- Fill out the questionnaire about the newly created app. -1)Choose the platform which you want to support (probably only iOS). + ![Fill out the questionnaire](../../static/img/deploy_new_form.png) -2)Add your app name. Depending on the type of your app, you are creating: +Fields description: -a)your app name (qa) +- `Platforms` - Choose the platform which you want to support (probably only iOS). -b)your app name (staging) +- `Name` - Add your app name Depending on the type of your app, you are creating: -c)your app name + - your app name (qa) + - your app name (staging) + - your app name -3)Choose your primary language (English, Polish, or some other). +- `Primary Language` - Choose your primary language (English, Polish, or some other). -4)Choose your bundle id. +- `BundleId` - Choose your bundle id. -When you went through the building app process correctly you should be able to choose the bundle id created for your app for example: -binarappsYOURAPPNAME 344h234g234d23423f4234 - com.binarapps.yourappname - last part is your app bundle id, you should choose accurate to the app version (qa/staging/production) + When you went through the building app process correctly you should be able to choose the bundle id created for your app for example: + binarappsYOURAPPNAME 344h234g234d23423f4234 - com.binarapps.yourappname - last part is your app bundle id, you should choose accurate to the app version (qa/staging/production) -5)You need to pass a unique ID that will not be visible in the store, it could be your bundle id for example com.binarapps.yourappname.qa +- `SKU` - You need to pass a unique ID that will not be visible in the store, it could be your bundle id for example com.binarapps.yourappname.qa -6)You could choose limited access, only accounts with the role: Admins, Finance, and Reports, and people you add access will see the app in the App Store account +- `User Access` - You could choose limited access, only accounts with the role: Admins, Finance, and Reports, and people you add access will see the app in the App Store account
        3. -
        4. Create and go through step ii again to cover qa/staging/production app depending on your strategy.
        5. +
        6. Create and go through step `ii` again to cover qa/staging/production app depending on your strategy.
      2. @@ -140,9 +144,9 @@ Configure eas.json file. Where: -- your_appStore_app_id should be taken in that way. -- your_apple_team_id should be taken from Apple Developer Portal in that way. -- your_app_name should be your app name from App Store Connect. +- `your_appStore_app_id` should be taken in that way. +- `your_apple_team_id` should be taken from Apple Developer Portal in that way. +- `your_app_name` should be your app name from App Store Connect.
      3. @@ -286,7 +290,9 @@ CONGRATULATIONS !! 🥳🥳 You have just started your first iOS build submissio
      -3.Build and deploy the next versions of the app to TestFlight. 🕐 / 📱 +--- + +## Build and deploy the next versions of the app to TestFlight. 🕐 / 📱 To run this step, ensure that you already have built and deployed the first version of the app (it means, that you need to go through steps 3 and 4 for qa/staging/production version of the app depending on your needs) From dc74d2ef4ad884a7e8d2d956fcf36a6a121e6d36 Mon Sep 17 00:00:00 2001 From: Mateusz Rostkowski Date: Sat, 23 Mar 2024 18:20:34 +0100 Subject: [PATCH 11/29] chore: add deeplinking setup docs temp file --- docs/docs/tutorials/DEEPLINKING_SETUP.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 docs/docs/tutorials/DEEPLINKING_SETUP.md diff --git a/docs/docs/tutorials/DEEPLINKING_SETUP.md b/docs/docs/tutorials/DEEPLINKING_SETUP.md new file mode 100644 index 00000000..8117ecb4 --- /dev/null +++ b/docs/docs/tutorials/DEEPLINKING_SETUP.md @@ -0,0 +1,19 @@ +--- +id: deeplinking +slug: /deeplinking +title: Deeplinking setup +sidebar_position: 5 +tags: + - Deeplinking + - Deeplinks + - Expo + - React + - React Native +description: Deeplinking - check how to setup it from scratch +--- + +# Deeplinking configuration guide + +Deeplinking is almost fully ready to work with your app. + + From 7ba230e5672fa1ec56e49e43511da9927eaf3919 Mon Sep 17 00:00:00 2001 From: Mateusz Rostkowski Date: Sat, 23 Mar 2024 18:22:01 +0100 Subject: [PATCH 12/29] chore: add checklist as docs - will be improved in future --- docs/docs/tutorials/CHECKLIST.mdx | 67 +++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 docs/docs/tutorials/CHECKLIST.mdx diff --git a/docs/docs/tutorials/CHECKLIST.mdx b/docs/docs/tutorials/CHECKLIST.mdx new file mode 100644 index 00000000..74f95bf8 --- /dev/null +++ b/docs/docs/tutorials/CHECKLIST.mdx @@ -0,0 +1,67 @@ +--- +id: checklist +slug: /checklist +title: Checklist +sidebar_position: 3 +tags: + - Checklist + - Getting started + - Project structure +description: Bootstrap checklist +--- + +# Checklist 🕐 + +> This list is in development, we are working hard to finish it :) + +## 1. Initial setup + +- [ ] setup git repository +- [ ] create app on expo +- [ ] create app on doppler + +## Deployment + +- [ ] get apple developer access +- [ ] get play store access + +## Deeplinking + +- [ ] iOS configuration file - apple-app-site-association + - [ ] verify content-type +- [ ] android configuration file - assetlinks.json + + - [ ] verify content-type + - [ ] verify sha256_cert_fingerprints + +- Content type verification + - go to page- https://webpage.com/.well-known/apple-app-site-association / https://webpage.com/.well-known/assetlinks.json + - open dev tools + - open network tab + - click on assetlinks.json + - check content-type + - it should contain `application/json;` + +{/* - TODO: Sha256 verification */} + +## Testing + +### Android + +- [ ] Push notifications (test it to some specified page - like /settings) + - [ ] Killed app + - [ ] Forgrounded app + - [ ] Opened app +- [ ] Deeplinks (test it to some specified page - like /settings) + - [ ] Killed app + - [ ] Forgrounded app + +### iOS + +- [ ] Push notifications (test it to some specified page - like /settings) + - [ ] Killed app + - [ ] Forgrounded app + - [ ] Opened app +- [ ] Deeplinks (test it to some specified page - like /settings) + - [ ] Killed app + - [ ] Forgrounded app From b70a427ec45653cb0ef32c672ca04279308cb05d Mon Sep 17 00:00:00 2001 From: Mateusz Rostkowski Date: Sat, 23 Mar 2024 18:23:26 +0100 Subject: [PATCH 13/29] fix: add proper setup to get push token --- src/screens/ApplicationInfoScreen.tsx | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/screens/ApplicationInfoScreen.tsx b/src/screens/ApplicationInfoScreen.tsx index f3af3a26..ffb81e77 100644 --- a/src/screens/ApplicationInfoScreen.tsx +++ b/src/screens/ApplicationInfoScreen.tsx @@ -1,4 +1,4 @@ -import { isExpoGo } from '@baca/constants' +import { ENV, isExpoGo } from '@baca/constants' import { Box, Button, Text } from '@baca/design-system' import { useCallback, @@ -10,13 +10,10 @@ import { // TODO: there are tons of more interesting methods there! import * as Application from 'expo-application' import * as Clipboard from 'expo-clipboard' -import Constants from 'expo-constants' import * as Notifications from 'expo-notifications' import { useRouter } from 'expo-router' import { ScrollView, StyleSheet } from 'react-native' -const projectId = Constants.expoConfig?.extra?.eas?.projectId - export const ApplicationInfoScreen = (): JSX.Element => { const { i18n, t } = useTranslation() const { bottom } = useSafeAreaInsets() @@ -36,7 +33,7 @@ export const ApplicationInfoScreen = (): JSX.Element => { const handleCopyPushToken = useCallback(async () => { try { - if (!isExpoGo && !projectId) { + if (!isExpoGo && !ENV.EAS_PROJECT_ID) { throw new Error( 'You must set `projectId` in eas build then value will be available from Constants?.expoConfig?.extra?.eas?.projectId' ) @@ -45,7 +42,7 @@ export const ApplicationInfoScreen = (): JSX.Element => { await Notifications.getExpoPushTokenAsync( !isExpoGo ? { - projectId, + projectId: ENV.EAS_PROJECT_ID, } : {} ) @@ -56,8 +53,15 @@ export const ApplicationInfoScreen = (): JSX.Element => { alert('Copied push token to clipboard.') } catch (error) { console.log('error', error) + alert( + JSON.stringify({ + message: 'There was an error when copying push token', + error, + }) + ) } }, []) + return (
    --- From 6f4fdaa1bca4d51859a66fe3ef6ac6262a7b1749 Mon Sep 17 00:00:00 2001 From: Mateusz Rostkowski Date: Sun, 24 Mar 2024 11:39:33 +0100 Subject: [PATCH 17/29] chore: improve deploy expo go docs --- docs/docs/deploy/DEPLOY_EXPO_GO.md | 47 +++++++++++++----------------- 1 file changed, 20 insertions(+), 27 deletions(-) diff --git a/docs/docs/deploy/DEPLOY_EXPO_GO.md b/docs/docs/deploy/DEPLOY_EXPO_GO.md index 6e72cb0c..12e56f8c 100644 --- a/docs/docs/deploy/DEPLOY_EXPO_GO.md +++ b/docs/docs/deploy/DEPLOY_EXPO_GO.md @@ -13,25 +13,21 @@ description: Testing in Expo Go # Testing in Expo Go 🕐 -When to use the Expo Go app: +> **Note!** If you encounter any troubles with building and publishing an app please contact with **[Mateusz Rostkowski](https://www.github.com/MateuszRostkowski)** or **[Michał Baumruck](https://github.com/micbaumr)** + +## When to use the Expo Go app: - If you are developing an app - for other developers and for fast internal testing - If you are developing an app, and do not have access to App Store and Google Play Store - for internal and external testing When not to use the Expo Go app: -
      -
    • - If you have applied native features to an app for example - one-signal (libraries that need to apply native code to the app with expo-plugins) -
        -
      • in that case, you could use expo-dev-client to create your own Expo Go app with injected native code into it
      • -
      -
    • -
    +- If you have applied native features to an app for example - one-signal (libraries that need to apply native code to the app with expo-plugins) + - in that case, you could use expo-dev-client to create your own Expo Go app with injected native code into it -### Process: +## How to deploy? -1.Deploy app for tests in expo go. +### 1. Deploy app for tests in expo go. The easiest way to allow testers to test an app on physical devices is to deploy the app to Expo Go. @@ -43,7 +39,7 @@ In terminal run: yarn update:expo_go ``` -2.Test the app on the physical device +### 2. Test the app on the physical device
    1. @@ -59,18 +55,15 @@ yarn update:expo_go ### Summary: -
        -
      • You should have in mind that testing in the Expo Go app is limited to apps that do not apply native features for example - one-signal (libraries that need to apply native code to an app with expo-plugins).
      • -
      • - Testing inside the Expo Go app is divided by a branch (git branch) from which are generated builds (updates) - could be done for example - for every feature branch -
          -
        • you can easily switch between different branches - for example - test multiple features from code review just in one place (Expo Go)
        • -
        -
      • -
      • - If multiple builds (updates) are generated for the same branch, in the Expo Go app you can switch between each build -
          -
        • you can easily switch between different builds (on the same feature branch) for example -to check when something was broken
        • -
        -
      • -
      +- You should have in mind that testing in the Expo Go app is limited to apps that do not apply native features for example + + - one-signal (libraries that need to apply native code to an app with expo-plugins). + - firebase analytics + +- Testing inside the Expo Go app is divided by a branch (git branch) from which are generated builds (updates) - could be done for example - for every feature branch + + - you can easily switch between different branches - for example - test multiple features from code review just in one place (Expo Go) + +- If multiple builds (updates) are generated for the same branch, in the Expo Go app you can switch between each build + + - you can easily switch between different builds (on the same feature branch) for example -to check when something was broken From 9403134dadac85eefe4059fb03a7cb6e33d6f172 Mon Sep 17 00:00:00 2001 From: Mateusz Rostkowski Date: Sun, 24 Mar 2024 11:39:58 +0100 Subject: [PATCH 18/29] chore: improve deploy_intro docs --- docs/docs/deploy/DEPLOY_INTRO.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/deploy/DEPLOY_INTRO.md b/docs/docs/deploy/DEPLOY_INTRO.md index d841faf3..89b0ae83 100644 --- a/docs/docs/deploy/DEPLOY_INTRO.md +++ b/docs/docs/deploy/DEPLOY_INTRO.md @@ -20,7 +20,7 @@ description: Intro to app deployment - Required to deploy an app - 📱 - Nice to have - 🌈 -> **Note!** If you encounter any troubles with building and publishing an app please add a comment and address it to **Michał Baumruck** or **Mateusz Rostkowski** +> **Note!** If you encounter any troubles with building and publishing an app please contact with **[Mateusz Rostkowski](https://www.github.com/MateuszRostkowski)** or **[Michał Baumruck](https://github.com/micbaumr)** ### When and how to: build, submit, and update an app From 4b06880c69ff4f069bdb73946f004ae5f3b51237 Mon Sep 17 00:00:00 2001 From: Mateusz Rostkowski Date: Sun, 24 Mar 2024 11:40:35 +0100 Subject: [PATCH 19/29] chore: fix typo in deploy ios docs --- docs/docs/deploy/DEPLOY_IOS.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/deploy/DEPLOY_IOS.mdx b/docs/docs/deploy/DEPLOY_IOS.mdx index 09dfd1ad..3a507bb2 100644 --- a/docs/docs/deploy/DEPLOY_IOS.mdx +++ b/docs/docs/deploy/DEPLOY_IOS.mdx @@ -62,7 +62,7 @@ CONGRATULATION !! 🥳🥳 You just started your first IOS build of the QA app v ## Deploy the first iOS app version for tests in TestFlight. 🕐 / 📱 -### Creating new apps in App Store Connect +### 1. Creating new apps in App Store Connect When you created an iOS binary (your build is in progress or at least you've generated Distribution Certificate (.p12 file) and Provisioning Profile (.mobileprovision file)), you are ready to create and configure apps in App Store Connect. From 1d307ca9a00fc2d4b00f2ad1ec9b26050e45a6b1 Mon Sep 17 00:00:00 2001 From: Mateusz Rostkowski Date: Sun, 24 Mar 2024 19:06:09 +0100 Subject: [PATCH 20/29] chore: improve deploy_android docs --- docs/docs/deploy/DEPLOY_ANDROID.md | 73 ++++++++++++++++-------------- 1 file changed, 39 insertions(+), 34 deletions(-) diff --git a/docs/docs/deploy/DEPLOY_ANDROID.md b/docs/docs/deploy/DEPLOY_ANDROID.md index 60722e9c..83773d37 100644 --- a/docs/docs/deploy/DEPLOY_ANDROID.md +++ b/docs/docs/deploy/DEPLOY_ANDROID.md @@ -13,9 +13,11 @@ description: Build & deploy your react native android mobile app # Build & deploy the Android app -1.Build first Android binary 🕐 / 📱 +--- + +## Build first Android binary 🕐 / 📱 -
        +
        1. Select the proper build type @@ -71,21 +73,23 @@ CONGRATULATION !! 🥳🥳 You just started the first Android build of your app!
        -2.Deploy the first version of the Android app for tests in Google Play Store. (internal testing) ?? / ?? +--- + +## Deploy the first version of the Android app for tests in Google Play Store. (internal testing) 🕐 / 📱 The first submission to Google Play Store needs to be done manually. -
          -
        1. Log in to Play Developer Console.
        2. -
        3. -Choose your developer account (if you have more than one): +### Step 1 - Log in to Play Developer Console. + +[Play developer console link](https://play.google.com/console/u/0) + +### Step 2 - Choose your developer account (if you have more than one): ![Choose account](../../static/img/android_account.png) -
        4. -
        5. -Create new app -
            +### Step 3 - Create new app + +
            1. Press Create App button on the right @@ -99,17 +103,17 @@ Fill out the form for creating about new App. Fields description: -1)Add your app name. Depending on the type of your app, you are creating: +1. Add your app name. Depending on the type of your app, you are creating: -a)your app name (qa) + - your app name (qa) -b)your app name (staging) + - your app name (staging) -c)your app name + - your app name -2)Choose your primary language (English, Polish, or some other). +2. Choose your primary language (English, Polish, or some other). -3)Confirm Developer Programme Polices and US export laws +3. Confirm Developer Programme Polices and US export laws
            2. @@ -119,11 +123,10 @@ You should create a new app for each environment you need to use (e.g. qa, stagi
            - -
          1. -Download your build file (apk or app-bundle) from the expo dev console. -
              +### Step 4 - Download your build file (apk or app-bundle) from the expo dev console. + +
              1. Log in to the expo dev console.
              2. Choose your organization from the dropdown in the top left corner.
              3. Choose your project from the left sidebar.
              4. @@ -152,10 +155,10 @@ If you downloaded an app-bundle file, it will be used in the next step.
              - -
            1. -Prepare the internal test. -
                + +### Step 5 - Prepare the internal test. + +
                1. Go to the Internal testing tab from the menu on the left (ensure you are working on the proper app - the app name is visible in the right top corner) @@ -211,10 +214,10 @@ CONGRATULATION !! 🥳🥳 You just released the first version of the app for in
                - -
              1. -Invite testers to test your app. -
                  + +### Step 6 - Invite testers to test your app. + +
                  1. Go to the internal testing tab (7.e.i)
                  2. Enter Testers tab @@ -261,10 +264,10 @@ CONGRATULATION !! 🥳🥳 You just invited the first tester of the app for inte
                  - -
                -3.Build and deploy the next versions of the app to the Google Play Store. 🌈 / 🕐 / 📱 +--- + +## Build and deploy the next versions of the app to the Google Play Store. 🌈 / 🕐 / 📱 To run this step, ensure that you already have built and deployed the first version of the app (it means, that you need to go through steps 6 and 7 for qa / staging / production version of the app depending of your needs) @@ -272,14 +275,16 @@ Only the first submission of the Android app needs to be done manually. Every ne To make it possible, Google Service Account key file needs to be provided. -
                  +
                  1. Generate Google Service Account key → follow the instruction. To generate the above you will need to contact with account owner of your project.
                  2. -
                  3. Put generated Google Service Account key in the root dir of your project.
                  4. +
                  5. +Put generated Google Service Account key in the root dir of your project. +
                  6. Add Google Service Account key to .gitignore file. From 72cf99ba0b3e48ce5ab6b2d2c61550953d8840df Mon Sep 17 00:00:00 2001 From: Mateusz Rostkowski Date: Mon, 25 Mar 2024 09:38:43 +0100 Subject: [PATCH 21/29] chore: update app.config.ts --- app.config.ts | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/app.config.ts b/app.config.ts index 4c1307e9..61b4cc59 100644 --- a/app.config.ts +++ b/app.config.ts @@ -3,25 +3,6 @@ import * as dotenv from 'dotenv' dotenv.config() -const environments = { - prod: 'production', - stg: 'staging', - qa: 'qa', -} as const - -export const envValues = Object.values(environments) -export type Environments = (typeof envValues)[number] - -const adaptiveIconPath = './assets/icons/android/adaptive-icon-' -const appIconPath = './assets/icons/ios/icon-' -const faviconPath = './assets/icons/web/favicon-' - -const IS_DEV = process.env.IS_DEV === '1' - -const runtimeVersion = { policy: IS_DEV ? 'sdkVersion' : 'appVersion' } as const - -type Setup = { [key in Environments]: string } - // https://patorjk.com/software/taag/#p=display&h=0&v=0&c=c&f=ANSI%20Regular&t=CONFIG /*** * ██████ ██████ ███ ██ ███████ ██ ██████ @@ -65,6 +46,25 @@ const universalLinks = ['https://baca-six.vercel.app'] */ // Please make sure you know what are you doing when you make some changes on the bottom +const environments = { + prod: 'production', + stg: 'staging', + qa: 'qa', +} as const + +export const envValues = Object.values(environments) +export type Environments = (typeof envValues)[number] + +const adaptiveIconPath = './assets/icons/android/adaptive-icon-' +const appIconPath = './assets/icons/ios/icon-' +const faviconPath = './assets/icons/web/favicon-' + +const IS_DEV = process.env.IS_DEV === '1' + +const runtimeVersion = { policy: IS_DEV ? 'sdkVersion' : 'appVersion' } as const + +type Setup = { [key in Environments]: string } + export const EAS_ENV_CONFIG: { [key: string]: Setup } = { adaptiveIconBackgroundColor: { production: APP_CONFIG.adaptiveIconBackgroundColor, From 5bf0568cafd5440e0b3de9966ba922b54f3a405c Mon Sep 17 00:00:00 2001 From: Mateusz Rostkowski Date: Mon, 25 Mar 2024 18:01:49 +0100 Subject: [PATCH 22/29] chore: improve deploy_both docs --- docs/docs/deploy/DEPLOY_BOTH.md | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/docs/docs/deploy/DEPLOY_BOTH.md b/docs/docs/deploy/DEPLOY_BOTH.md index eccaaac8..0672872e 100644 --- a/docs/docs/deploy/DEPLOY_BOTH.md +++ b/docs/docs/deploy/DEPLOY_BOTH.md @@ -14,9 +14,9 @@ description: Build and deploy both Android and iOS apps # Build & deploy both Android and iOS apps -
                      -
                    1. - Build and deploy the next version of Android and iOS simultaneously. 🌈 / 🕐 /📱 +> **NOTE** You need to go through [iOS](docs/deploy/ios) and [android](docs/deploy/android) tutorials to make this working. + +Build and deploy the next version of Android and iOS simultaneously. 🌈 / 🕐 /📱 If you automated the submission process for Android and iOS (step build and deploy iOS app and step build and deploy Android app) you can build and upload both Android and iOS apps with just one command. @@ -29,6 +29,3 @@ yarn deploy:[qa/staging/production] Choose the proper app version depending on the environment for which you want to create a build. CONGRATULATION !! 🥳🥳 You have just learned how to run the build and deploy process with just one command for both Android and iOS! - -
                    2. -
                    From 9e99c526ac8a1e8b3e963f3a0e7a7b7d1e6a9fae Mon Sep 17 00:00:00 2001 From: Mateusz Rostkowski Date: Tue, 26 Mar 2024 18:59:59 +0100 Subject: [PATCH 23/29] chore: improve deploy_intro --- docs/docs/bootstrap/BOOTSTRAP_INTRO.mdx | 36 ++++++++++++------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/docs/docs/bootstrap/BOOTSTRAP_INTRO.mdx b/docs/docs/bootstrap/BOOTSTRAP_INTRO.mdx index 29546e0d..226de4bf 100644 --- a/docs/docs/bootstrap/BOOTSTRAP_INTRO.mdx +++ b/docs/docs/bootstrap/BOOTSTRAP_INTRO.mdx @@ -20,7 +20,7 @@ Bootstrap project structure, that is needed to start development --- -### 1. Setup repository +### Step 1. Setup repository ```bash git clone git@github.com:binarapps/baca-react-native-template.git name_of_your_app @@ -52,7 +52,7 @@ npx create-expo-app --template=@binarapps/baca-react-native-template name_of_you --- -### 2. Login / register to expo +### Step 2. Login / register to expo If you have expo account → go login with it @@ -82,35 +82,35 @@ eas whoami --- -### 3. Create project on expo.dev +### Step 3. Create project on expo.dev -a. Sign in to the expo dev console (account created in the first step of repo configuration). +1. Sign in to the expo dev console (account created in the first step of repo configuration). -b. Select the proper organization you are working for from a dropdown: +2. Select the proper organization you are working for from a dropdown: -![Select organization](../../static/img/expo_select.jpg) + ![Select organization](../../static/img/expo_select.jpg) -Ideally, it will be an organization created by the client (especially for production builds), to easily pass access after the end of development. + Ideally, it will be an organization created by the client (especially for production builds), to easily pass access after the end of development. -c. Create a new Project in the organization. +3. Create a new Project in the organization. -I. From the sidebar menu click **All projects** button: + - From the sidebar menu click **All projects** button: -![All projects](../../static/img/expo_all.png) + ![All projects](../../static/img/expo_all.png) -II. On the page with the list of projects click **+New Project** button: + - On the page with the list of projects click **+New Project** button: -![New project](../../static/img/expo_new.png) + ![New project](../../static/img/expo_new.png) -III. Apply **display name** and **slug** of your project. + - Apply **display name** and **slug** of your project. -Display name is a name that will be visible in the Expo Dev Console. + Display name is a name that will be visible in the Expo Dev Console. -Slug is the name that will link your Expo application with your code. + Slug is the name that will link your Expo application with your code. -## ![Project create](../../static/img/expo_create.png) + ![Project create](../../static/img/expo_create.png) -### 4.Sync project with code. +### Step 4.Sync project with code. Synchronize the newly created Expo Project to your app. @@ -130,4 +130,4 @@ In `app.json` file please insert the following: --- -### 5. Make environment setup - [tutorial](/docs/doppler-config) +### Step 5. Make environment variables setup - [tutorial](/docs/doppler-config) From 97b35cf7a26ecf8900d84d40ffadf0f9a419129e Mon Sep 17 00:00:00 2001 From: Mateusz Rostkowski Date: Tue, 26 Mar 2024 19:00:28 +0100 Subject: [PATCH 24/29] chore: improve deploy_web --- docs/docs/deploy/DEPLOY_WEB.md | 57 ++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 docs/docs/deploy/DEPLOY_WEB.md diff --git a/docs/docs/deploy/DEPLOY_WEB.md b/docs/docs/deploy/DEPLOY_WEB.md new file mode 100644 index 00000000..94652684 --- /dev/null +++ b/docs/docs/deploy/DEPLOY_WEB.md @@ -0,0 +1,57 @@ +--- +id: deploy-web +slug: /deploy/web +title: Deploy web +sidebar_position: 6 +tags: + - Deploy + - react native web app + - web app + - Mobile development + - React native +description: Build and deploy web app +--- + +# Build & deploy web app + +Build and deploy the next version of web app. 🌈 / 🕐 /📱 + +## Build web app + +```bash +npx expo export -p web +``` + +## Deploy + +This starter comes with automatically vercel deplyoment so to deploy it you can just run this command: + +```bash +vercel --prod +``` + +You can also follow [expo docs](https://docs.expo.dev/distribution/publishing-websites/) to check how differently you can deploy web app. + +## Resolving issues + +1. 404 on deployed app + +There could be an issue like this: https://stackoverflow.com/questions/58065603/netlify-renders-404-on-page-refresh-using-react-and-react-router + +This was resolved by adding `_redirects` file to public folder. + +For some servers this could not work so you should do this additional setup: + +- configure `htaccess` on the server like this: + +``` + +RewriteEngine On +RewriteBase /subdirectory +RewriteRule ^index\.html$ - [L] +RewriteCond %{REQUEST_FILENAME} !-f +RewriteCond %{REQUEST_FILENAME} !-d +RewriteCond %{REQUEST_FILENAME} !-l +RewriteRule . /index.html [L] + +``` From e55bfc28ca02bf7990c76741cf377852436feed7 Mon Sep 17 00:00:00 2001 From: Mateusz Rostkowski Date: Tue, 26 Mar 2024 19:00:55 +0100 Subject: [PATCH 25/29] chore: add redirects file to public folder --- public/_redirects | 1 + 1 file changed, 1 insertion(+) create mode 100644 public/_redirects diff --git a/public/_redirects b/public/_redirects new file mode 100644 index 00000000..a54e2e89 --- /dev/null +++ b/public/_redirects @@ -0,0 +1 @@ + /* /index.html 200 \ No newline at end of file From 0e78d3b72e557a9fcabca374c121dc5ca9198e9f Mon Sep 17 00:00:00 2001 From: Mateusz Rostkowski Date: Tue, 26 Mar 2024 19:01:31 +0100 Subject: [PATCH 26/29] feat: add binarapps.online as new deeplinking site --- app.config.ts | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/app.config.ts b/app.config.ts index 61b4cc59..9770bc20 100644 --- a/app.config.ts +++ b/app.config.ts @@ -27,7 +27,7 @@ export const APP_CONFIG = { } as const // APP_CONFIG_END -const universalLinks = ['https://baca-six.vercel.app'] +const universalLinks = ['https://baca-six.vercel.app', 'https://binarapps.online'] /*** * ██████ ██ ██ ███ ██ █████ ███ ███ ██ ██████ @@ -108,16 +108,17 @@ export const EAS_ENV_CONFIG: { [key: string]: Setup } = { }, } as const -const associatedDomains = universalLinks.map((link) => link.replace('https://', 'applinks:')) -const intentFilters = universalLinks.map((link) => ({ - action: 'VIEW', - autoVerify: true, - data: [''].map(() => ({ - scheme: 'https', - host: link.replace('https://', ''), - })), - category: ['BROWSABLE', 'DEFAULT'], -})) +const associatedDomains = universalLinks.map((link) => link.replace('https://', 'applinks:')) || [] +const intentFilters = + universalLinks.map((link) => ({ + action: 'VIEW', + autoVerify: true, + data: [''].map(() => ({ + scheme: 'https', + host: link.replace('https://', ''), + })), + category: ['BROWSABLE', 'DEFAULT'], + })) || [] export default ({ config }: ConfigContext): Partial => { const ENVIRONMENT_NAME = (process.env.ENVIRONMENT_NAME || 'qa') as Environments From e44e4c522c1091e4e2b88ea1e1200e323f1ab74c Mon Sep 17 00:00:00 2001 From: Mateusz Rostkowski Date: Wed, 27 Mar 2024 20:45:24 +0100 Subject: [PATCH 27/29] chore: add extention in eas config --- eas.json | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/eas.json b/eas.json index 7404aff7..17ed199e 100644 --- a/eas.json +++ b/eas.json @@ -17,24 +17,16 @@ "autoIncrement": true, "buildType": "apk" }, - "channel": "staging", - "distribution": "store", - "ios": { - "autoIncrement": "buildNumber" - }, - "node": "18.15.0" + "extends": "production", + "channel": "staging" }, "qa": { "android": { "autoIncrement": true, "buildType": "apk" }, - "channel": "qa", - "distribution": "store", - "ios": { - "autoIncrement": "buildNumber" - }, - "node": "18.15.0" + "extends": "production", + "channel": "qa" } }, "cli": { From 973c131fa505f0c198c33f20ffaa3dfedf89e0bb Mon Sep 17 00:00:00 2001 From: Mateusz Rostkowski Date: Wed, 27 Mar 2024 20:45:53 +0100 Subject: [PATCH 28/29] fix: properly setup prepare env scripts --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index d5ed3a8e..9855d8f4 100644 --- a/package.json +++ b/package.json @@ -59,9 +59,9 @@ "prebuild:android": "IS_DEV=1 npx expo prebuild --clean -p android", "prebuild:ios": "IS_DEV=1 npx expo prebuild --clean -p ios", "prepare:env_file": "cp ./templates/doppler_variables_template.sh ./scripts/doppler_variables.sh", - "prepare:production": "yarn && yarn upload:env && yarn generate:env:production && yarn generate:google-services-config", - "prepare:qa": "yarn && yarn upload:env && yarn generate:env:qa && yarn generate:google-services-config", - "prepare:staging": "yarn && yarn upload:env && yarn generate:env:staging && yarn generate:google-services-config", + "prepare:production": "yarn && yarn generate:env:production && yarn upload:env && yarn generate:google-services-config", + "prepare:qa": "yarn && yarn generate:env:qa && yarn upload:env && yarn generate:google-services-config", + "prepare:staging": "yarn && yarn generate:env:staging && yarn upload:env && yarn generate:google-services-config", "prepare": "husky install", "prettier:write": "prettier --write ./src", "start:prod": "yarn generate:env:production && IS_DEV=1 IS_EXPO_GO=1 expo start -c -g", From c82a4a20edb3530b8f585ef58c05a16c16aa2aab Mon Sep 17 00:00:00 2001 From: Mateusz Rostkowski Date: Wed, 27 Mar 2024 20:46:18 +0100 Subject: [PATCH 29/29] chore: use eas project id from env variables --- src/constants/env.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/constants/env.ts b/src/constants/env.ts index 24516a12..5b9ebe63 100644 --- a/src/constants/env.ts +++ b/src/constants/env.ts @@ -3,5 +3,5 @@ import Constants from 'expo-constants' export const ENV = { API_URL: Constants?.expoConfig?.extra?.API_URL, ENVIRONMENT_NAME: Constants?.expoConfig?.extra?.ENVIRONMENT_NAME, - EAS_PROJECT_ID: 'ac562c27-4a4e-4532-869f-fe6f9447bee6', // FIXME: Move it to .env + EAS_PROJECT_ID: Constants.expoConfig?.extra?.eas?.projectId, }