diff --git a/app.config.ts b/app.config.ts index 80c75a95..9770bc20 100644 --- a/app.config.ts +++ b/app.config.ts @@ -3,6 +3,49 @@ import * as dotenv from 'dotenv' dotenv.config() +// 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 + +// 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', 'https://binarapps.online'] + +/*** + * ██████ ██ ██ ███ ██ █████ ███ ███ ██ ██████ + * ██ ██ ██ ██ ████ ██ ██ ██ ████ ████ ██ ██ + * ██ ██ ████ ██ ██ ██ ███████ ██ ████ ██ ██ ██ + * ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ + * ██████ ██ ██ ████ ██ ██ ██ ██ ██ ██████ + * + * + * ██████ ██████ ███ ██ ███████ ██ ██████ + * ██ ██ ██ ████ ██ ██ ██ ██ + * ██ ██ ██ ██ ██ ██ █████ ██ ██ ███ + * ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ + * ██████ ██████ ██ ████ ██ ██ ██████ + * + */ +// Please make sure you know what are you doing when you make some changes on the bottom + const environments = { prod: 'production', stg: 'staging', @@ -16,22 +59,12 @@ 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 type Setup = { [key in Environments]: string } + export const EAS_ENV_CONFIG: { [key: string]: Setup } = { adaptiveIconBackgroundColor: { production: APP_CONFIG.adaptiveIconBackgroundColor, @@ -75,43 +108,84 @@ 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 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 + 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`) } + 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, 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, - ...process.env, - universalLinks: [], + ENVIRONMENT_NAME, + universalLinks, + ...(environmentVariables || {}), }, - icon: EAS_ENV_CONFIG.appIcon[ENVIRONMENT], + icon: EAS_ENV_CONFIG.appIcon[ENVIRONMENT_NAME], ios: { ...config.ios, - bundleIdentifier: EAS_ENV_CONFIG.iosBundleIdentifier[ENVIRONMENT], + associatedDomains, + 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], + plugins, + 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/app.json b/app.json index 5e5ab2d1..c123b240 100644 --- a/app.json +++ b/app.json @@ -2,16 +2,19 @@ "expo": { "android": { "jsEngine": "hermes", - "versionCode": 10, + "versionCode": 15, "softwareKeyboardLayoutMode": "pan", "googleServicesFile": "./google-services.json" }, "assetBundlePatterns": ["**/*"], "ios": { "jsEngine": "hermes", - "buildNumber": "10", + "buildNumber": "15", "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", 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) 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. 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. -
                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 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 diff --git a/docs/docs/deploy/DEPLOY_IOS.md b/docs/docs/deploy/DEPLOY_IOS.md deleted file mode 100644 index 7fa3618d..00000000 --- a/docs/docs/deploy/DEPLOY_IOS.md +++ /dev/null @@ -1,299 +0,0 @@ ---- -id: deploy-ios -slug: /deploy/ios -title: Build & deploy the iOS app -sidebar_position: 3 -tags: - - Deploy - - iOS app - - Mobile development - - React native -description: Build & deploy the iOS app ---- - -# Build & deploy the iOS app - -1.Build first iOS binary 🕐 / 📱 - -
                    -
                  1. Check if you are already logged in to your eas/expo account
                  2. - -```bash -eas whoami -``` - -If not please log in to your account before proceeding to the next step. - -
                  3. In the terminal run the build command (choose the proper environment (qa/staging/production).
                  4. - -```bash -yarn build:[qa/staging/production]:ios -``` - -
                  5. You will be asked to log in to your Apple account, please log in.
                  6. -
                  7. Choose your team and provider (possible binarapps if you deploy qa app).
                  8. -
                  9. - If it will be your first build of the iOS app, you will be prompted to generate a new Apple Distribution Certificate." - If it is a new app please select y, otherwise, if you have Apple Distribution Certificate (.p12 file) you can press n and provide a path to .p12 certificate. -
                  10. -
                  11. - If it will be your first build of the iOS app, you will be prompted to generate a new Provisioning Profile. - - - If you do not have Provisioning Profile please select y to generate a new one, otherwise, if you have Provisioning Profile (.mobileprovision file) you can press n and provide a path to .mobileprovision certificate. -
                  12. -
                  13. - If it will be your first build of an iOS app, you will be asked to set Push Notifications for your project. - - - You can select y in case later you could need it, and generate a new Apple Push key. -
                  14. -
                  - -CONGRATULATION !! 🥳🥳 You just started your first IOS build of the QA app version! - -2.Deploy the first iOS app version for tests in TestFlight. 🕐 / 📱 - -
                    -
                  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. - -
                      -
                    1. Log in to App Store Connect to the account you were logged in to while building the app in the previous step.
                    2. -
                    3. -Create a new app. - -1.Got to the Apps tab. - -![Apps tab](../../static/img/deploy_apps.png) -2.Click on the +button to create a new app. - -![Create new app](../../static/img/deploy_add_button.png) -3.Select New app from the popup. - -![Select new app](../../static/img/deploy_new_app.png) - -4.Fill out the questionnaire about the newly created app. - -![Fill out the questionnaire](../../static/img/deploy_new_form.png) - -Fields description: - -1)Choose the platform which you want to support (probably only iOS). - -2)Add your app name. Depending on the type of your app, you are creating: - -a)your app name (qa) - -b)your app name (staging) - -c)your app name - -3)Choose your primary language (English, Polish, or some other). - -4)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) - -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 - -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 - -
                    4. -
                    5. Create and go through step ii again to cover qa/staging/production app depending on your strategy.
                    6. -
                    -
                  2. -
                  3. -Submit the app to the Test Flight. -
                      -
                    1. -Configure eas.json file. - -```json -"submit": { - "production": { - "ios": { - "ascAppId": "your_appStore_app_id", - "appleTeamId": "your_apple_team_id", - "appName": "your_app_name" - } - }, - "staging": { - "ios": { - "ascAppId": "your_appStore_app_id", - "appleTeamId": "your_apple_team_id", - "appName": "your_app_name" - } - }, - "qa": { - "ios": { - "ascAppId": "your_appStore_app_id", - "appleTeamId": "your_apple_team_id", - "appName": "your_app_name" - } - } - } -``` - -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. - -
                    2. -
                    3. - The first submission - authenticate the app submission process. - - - You can authenticate your builds in two different ways: - -1.App Store Connect API Key. - -To use this method you will need access to the App Store Connect account with the role of Account Holder. If you do not have such access, please authenticate with method - -
                        -
                      1. Generate API key - follow the instruction.
                      2. -
                      3. Save AuthKey.p8 file, key ID, and Issuer ID.
                      4. -
                      5. -Ensure that the build you want to submit is completed correctly. - -In project dir terminal run: - -```bash -eas build:list --channel [qa/staging/production] -``` - -And check the last build. (choose the proper channel depending on your build/app environment) - -
                      6. -
                      7. -Start the submission process, in project dir run the following command: - -```bash -eas submit -p ios --latest -``` - -If you want to submit a different build than the latest one, you can run: - -```bash -eas submit -p ios --id your_build_id -``` - -Where in place of your_build_id you could pass the id of the build from the build list (previous step). - -For the first submission you will need to go through the following questions: - -- Select what to use for your project: Add a new ASC API Key -- Generate a new App Store Connect API Key: no -- Path to App Store Connect API Key: AuthKey_YOUR-KEY-ID.p8 -- Key ID: YOUR-KEY-ID (to be get from the instruction) -- Issuer ID: YOUR-ISSUER-ID (to be get from the instruction) - -After applying this data submission process will start. CONGRATULATIONS !! 🥳🥳 You have just started your first iOS build submission! - -
                      8. -
                      -
                    4. -
                    -
                  4. -
                  - -2.Apple App-Specific Password. - -
                    -
                  1. -Generate App-Specific Password - follow the instruction. - -You can name your App-specific password for example as EAS submit. - -
                  2. -
                  3. Copy the newly generated password. (if not copied, please create a new App-Specific Password, and remove the previous one).
                  4. -
                  5. -Store password in expo service (we will name it → EXPO_APPLE_APP_SPECIFIC_PASSWORD). - -In project dir terminal run: - -```bash -eas secret:create --scope project --name EXPO_APPLE_APP_SPECIFIC_PASSWORD --value YOUR_GENERATED_APP_SPECIFIC_PASSWORD --type string -``` - -In place of YOUR_GENERATED_APP_SPECIFIC_PASSWORD provide your generated password. - -
                  6. -
                  7. -Configure eas.json file, to authenticate the submission process with your App-Specific Password. - -Add the following lines (do not remove existing configuration added in 4.b.i step). - -``` -"submit": { - "production": { - "ios": { - "appleId": "your_apple_id", - } - }, - "staging": { - "ios": { - "appleId": "your_apple_id", - } - }, - "qa": { - "ios": { - "appleId": "your_apple_id", - } - } -} -``` - -Where your_apple_id is your apple ID with access to App Store Connect. (for example m.baumruck@binarapps.com) - -
                  8. -
                  9. -Store your apple account password as an expo secret in the expo service. - -To allow other users and CI to submit the app to the store, and sign in with an app-specific password, you need to allow expo services to authenticate with your account. To do that, expo service will log in to your apple account with your apple id (provided in eas.json in the previous step and apple password (stored as a secret on the expo service). - -In project dir terminal run: - -```bash -eas secret:create --scope project --name EXPO_APPLE_PASSWORD --value YOUR_APPLE_PASSWORD --type string -``` - -In place of YOUR_APPLE_PASSWORD provide your apple password. - -
                  10. -
                  11. -Start the submission process, in project dir run the following command: - -```bash -eas submit -p ios --latest -``` - -If you want to submit a different build than the latest one, you can run: - -```bash -eas submit -p ios --id your_build_id -``` - -Where in place of your_build_id you could pass the id of the build from the build list (previous step). - -CONGRATULATIONS !! 🥳🥳 You have just started your first iOS build submission! - -
                  12. -
                  - -3.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) - -In project dir run in terminal: - -```bash -yarn deploy:[qa/staging/production]:ios -``` - -Choose the proper app version depending on the environment for which you want to create a build. diff --git a/docs/docs/deploy/DEPLOY_IOS.mdx b/docs/docs/deploy/DEPLOY_IOS.mdx new file mode 100644 index 00000000..3a507bb2 --- /dev/null +++ b/docs/docs/deploy/DEPLOY_IOS.mdx @@ -0,0 +1,296 @@ +--- +id: deploy-ios +slug: /deploy/ios +title: Build & deploy the iOS app +sidebar_position: 3 +tags: + - Deploy + - iOS app + - Mobile development + - React native +description: Build & deploy the iOS app +--- + +import Details from '@site/src/components/Details' + +# Build & deploy the iOS app + +--- + +## Build first iOS binary 🕐 / 📱 + +
                    +
                  1. Check if you are already logged in to your eas/expo account
                  2. + +```bash +eas whoami +``` + +If not please log in to your account before proceeding to the next step. + +
                  3. + In the terminal run the build command (choose the proper environment (qa/staging/production). +
                  4. + +```bash +yarn build:[qa/staging/production]:ios +``` + +
                  5. You will be asked to log in to your Apple account, please log in.
                  6. +
                  7. Choose your team and provider (possible binarapps if you deploy qa app).
                  8. +
                  9. + If it will be your first build of the iOS app, you will be prompted to generate a new Apple Distribution Certificate." + If it is a new app please select y, otherwise, if you have Apple Distribution Certificate (.p12 file) you can press n and provide a path to .p12 certificate. +
                  10. +
                  11. + If it will be your first build of the iOS app, you will be prompted to generate a new Provisioning Profile. + + + If you do not have Provisioning Profile please select y to generate a new one, otherwise, if you have Provisioning Profile (.mobileprovision file) you can press n and provide a path to .mobileprovision certificate. +
                  12. +
                  13. + If it will be your first build of an iOS app, you will be asked to set Push Notifications for your project. + + + You can select y in case later you could need it, and generate a new Apple Push key. +
                  14. +
                  + +CONGRATULATION !! 🥳🥳 You just started your first IOS build of the QA app version! + +--- + +## Deploy the first iOS app version for tests in TestFlight. 🕐 / 📱 + +### 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. + +
                    +
                  1. Log in to App Store Connect to the account you were logged in to while building the app in the previous step.
                  2. +
                  3. +Create a new app: + +- Go to the Apps tab. + + ![Apps tab](../../static/img/deploy_apps.png) + +- Click on the `+` button to create a new app. + + ![Create new app](../../static/img/deploy_add_button.png) + +- Select New app from the popup. + + ![Select new app](../../static/img/deploy_new_app.png) + +- Fill out the questionnaire about the newly created app. + + ![Fill out the questionnaire](../../static/img/deploy_new_form.png) + +Fields description: + +- `Platforms` - Choose the platform which you want to support (probably only iOS). + +- `Name` - Add your app name Depending on the type of your app, you are creating: + + - your app name (qa) + - your app name (staging) + - your app name + +- `Primary Language` - Choose your primary language (English, Polish, or some other). + +- `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) + +- `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 + +- `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 + +
                  4. +
                  5. Create and go through step `ii` again to cover qa/staging/production app depending on your strategy.
                  6. +
                  +### 2. Submit the app to the Test Flight. +
                    +
                  1. +Configure eas.json file. + +```json +"submit": { + "production": { + "ios": { + "ascAppId": "your_appStore_app_id", + "appleTeamId": "your_apple_team_id", + "appName": "your_app_name" + } + }, + "staging": { + "ios": { + "ascAppId": "your_appStore_app_id", + "appleTeamId": "your_apple_team_id", + "appName": "your_app_name" + } + }, + "qa": { + "ios": { + "ascAppId": "your_appStore_app_id", + "appleTeamId": "your_apple_team_id", + "appName": "your_app_name" + } + } + } +``` + +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. + +
                  2. +
                  3. + The first submission - authenticate the app submission process. + + You can authenticate your builds in two different ways: + +
                    + +To use this method you will need access to the App Store Connect account with the role of Account Holder. If you do not have such access, please authenticate with method + +
                      +
                    1. Generate API key - follow the instruction.
                    2. +
                    3. Save AuthKey.p8 file, key ID, and Issuer ID.
                    4. +
                    5. +Ensure that the build you want to submit is completed correctly. + +In project dir terminal run: + +```bash +eas build:list --channel [qa/staging/production] +``` + +And check the last build. (choose the proper channel depending on your build/app environment) + +
                    6. +
                    7. +Start the submission process, in project dir run the following command: + +```bash +eas submit -p ios --latest +``` + +If you want to submit a different build than the latest one, you can run: + +```bash +eas submit -p ios --id your_build_id +``` + +Where in place of your_build_id you could pass the id of the build from the build list (previous step). + +For the first submission you will need to go through the following questions: + +- Select what to use for your project: Add a new ASC API Key +- Generate a new App Store Connect API Key: no +- Path to App Store Connect API Key: AuthKey_YOUR-KEY-ID.p8 +- Key ID: YOUR-KEY-ID (to be get from the instruction) +- Issuer ID: YOUR-ISSUER-ID (to be get from the instruction) + +After applying this data submission process will start. CONGRATULATIONS !! 🥳🥳 You have just started your first iOS build submission! + +
                    8. +
                    +
                    + +
                    + +1. Generate App-Specific Password - [follow the instruction.](https://github.com/expo/fyi/blob/main/apple-app-specific-password.md) + + You can name your App-specific password for example as EAS submit. + +2. Copy the newly generated password. (if not copied, please create a new App-Specific Password, and remove the previous one). +3. Store password in expo service (we will name it → EXPO_APPLE_APP_SPECIFIC_PASSWORD). + + In project dir terminal run: + + ```bash + eas secret:create --scope project --name EXPO_APPLE_APP_SPECIFIC_PASSWORD --value YOUR_GENERATED_APP_SPECIFIC_PASSWORD --type string + ``` + + In place of YOUR_GENERATED_APP_SPECIFIC_PASSWORD provide your generated password. + +4. Configure eas.json file, to authenticate the submission process with your App-Specific Password. + + Add the following lines (do not remove existing configuration added in 4.b.i step). + + ``` + "submit": { + "production": { + "ios": { + "appleId": "your_apple_id", + } + }, + "staging": { + "ios": { + "appleId": "your_apple_id", + } + }, + "qa": { + "ios": { + "appleId": "your_apple_id", + } + } + } + ``` + + Where your_apple_id is your apple ID with access to App Store Connect. (for example m.baumruck@binarapps.com) + +5. Store your apple account password as an expo secret in the expo service. + + To allow other users and CI to submit the app to the store, and sign in with an app-specific password, you need to allow expo services to authenticate with your account. To do that, expo service will log in to your apple account with your apple id (provided in eas.json in the previous step and apple password (stored as a secret on the expo service). + + In project dir terminal run: + + ```bash + eas secret:create --scope project --name EXPO_APPLE_PASSWORD --value YOUR_APPLE_PASSWORD --type string + ``` + + In place of YOUR_APPLE_PASSWORD provide your apple password. + + You can also add `EXPO_APPLE_PASSWORD` to `.env` file and when doing deploy it will be added automatically + +6. Start the submission process, in project dir run the following command: + + ```bash + eas submit -p ios --latest + ``` + + If you want to submit a different build than the latest one, you can run: + + ```bash + eas submit -p ios --id your_build_id + ``` + + Where in place of your_build_id you could pass the id of the build from the build list (previous step). + +**CONGRATULATIONS !! 🥳🥳 You have just started your first iOS build submission!** + +
                    + +
                  4. + +
                  + +--- + +## 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) + +In project dir run in terminal: + +```bash +yarn deploy:[qa/staging/production]:ios +``` + +Choose the proper app version depending on the environment for which you want to create a build. 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] + +``` 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 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. + + diff --git a/eas.json b/eas.json index c5db3eaa..17ed199e 100644 --- a/eas.json +++ b/eas.json @@ -3,35 +3,30 @@ "production": { "android": { "autoIncrement": true, - "buildType": "apk" + "buildType": "app-bundle" }, "channel": "production", "distribution": "store", "ios": { "autoIncrement": "buildNumber" - } + }, + "node": "18.15.0" }, "staging": { "android": { "autoIncrement": true, "buildType": "apk" }, - "channel": "staging", - "distribution": "store", - "ios": { - "autoIncrement": "buildNumber" - } + "extends": "production", + "channel": "staging" }, "qa": { "android": { "autoIncrement": true, "buildType": "apk" }, - "channel": "qa", - "distribution": "store", - "ios": { - "autoIncrement": "buildNumber" - } + "extends": "production", + "channel": "qa" } }, "cli": { @@ -52,7 +47,10 @@ "submit": { "production": { "android": {}, - "ios": {} + "ios": { + "ascAppId": "6478398699", + "appleTeamId": "5764GC687R" + } }, "staging": { "android": {}, @@ -63,4 +61,4 @@ "ios": {} } } -} \ No newline at end of file +} diff --git a/package.json b/package.json index 2f3221fc..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 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 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", @@ -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", 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}'` ) } diff --git a/public/.well-known/apple-app-site-association b/public/.well-known/apple-app-site-association index d7756d9b..51151ac7 100644 --- a/public/.well-known/apple-app-site-association +++ b/public/.well-known/apple-app-site-association @@ -1,44 +1,54 @@ { "applinks": { + "apps": [], "details": [ { "appIDs": [ - "ABCDE12345.online.binarapps" + "5764GC687R.com.binarapps.baca" ], "components": [ { - "#": "no_universal_links", + "/": "*", + "?": { + "$web_only": "true" + }, "exclude": true, - "comment": "Matches any URL with a fragment that equals no_universal_links and instructs the system not to open it as a universal link." + "comment": "Matches any URL whose path is * and which has a query item with name '$web_only' and value 'true' and instructs the system NOT to open it as a Universal link" }, { - "/": "/buy/*", - "comment": "Matches any URL with a path that starts with /buy/." + "/": "*", + "?": { + "%24web_only": "true" + }, + "exclude": true, + "comment": "Matches any URL whose path is * and which has a query item with name '%24web_only' and value 'true' and instructs the system NOT to open it as a Universal link" }, { - "/": "/help/website/*", - "exclude": true, - "comment": "Matches any URL with a path that starts with /help/website/ and instructs the system not to open it as a universal link." + "/": "*", + "comment": "Matches any URL whose path is * and instructs the system to open it as a Universal link" }, { - "/": "/help/*", - "?": { - "articleNumber": "????" - }, - "comment": "Matches any URL with a path that starts with /help/ and that has a query item with name 'articleNumber' and a value of exactly four characters." + "/": "/", + "comment": "Matches any URL whose path is / and instructs the system to open it as a Universal link" } ] + }, + { + "appID": "5764GC687R.com.binarapps.baca", + "paths": [ + "/*" + ] } ] }, - "webcredentials": { + "activitycontinuation": { "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" ] } } 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 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..5b9ebe63 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, - EAS_PROJECT_ID: 'ac562c27-4a4e-4532-869f-fe6f9447bee6', // FIXME: Move it to .env + ENVIRONMENT_NAME: Constants?.expoConfig?.extra?.ENVIRONMENT_NAME, + EAS_PROJECT_ID: Constants.expoConfig?.extra?.eas?.projectId, } 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 (