Skip to content

fylein/fyle-mobile-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Fyle Mobile App

This repository holds the codebase for the Fyle Mobile App. This document provides the tools and guidelines to set up, develop, test, and deploy the app efficiently. Built using the Ionic Framework, it supports both Android and iOS platforms.

πŸ“‘ Table of Contents


πŸ”§ Prerequisites

  • Node.js: Install Node.js (v14.17.2 or higher) using nvm.

  • Ionic CLI: Follow the instructions here and Install Ionic globally with npm by running:

  npm install -g @ionic/cli

✨ Quick Setup

Follow the following steps to run the app locally in your browser:

  1. Clone the repository:
git clone https://github.com/fylein/fyle-mobile-app.git
cd fyle-mobile-app
  1. Install dependencies:
npm install
  1. Set Environment Variables: Add the environment files corresponding to the build you want in the environment folder. (Follow Environment Setup)

  2. Run Locally: Use the following command to run the application locally:

ionic serve -c [env_name]

Note

Replace env_name with the name of the environment file you want to use. For example, if you > have an environment file named staging, you would run:

ionic serve -c staging

πŸ‘€ Environment Setup

For setting environment variables

  • Environment Files: Ping the mobile app team and get the necessary environment files (environment.[env_name].ts).
  • Place them inside the /src/environments folder

Important

Do not make any changes to the environment.ts file - this is a template folder for creating > configurations. Also, make sure not to put staging environments in this file.


❓ Troubleshooting

Here are some common issues and how to fix them:

  1. If you encounter any similar error like this: Property 'LIVE_UPDATE_APP_VERSION' does not exist on type ...
  Property 'LIVE_UPDATE_APP_VERSION' does not exist on type
  '{ production: boolean; NAME: string; CLUSTER_DOMAIN: string; ROOT_URL: string; ROUTER_API_ENDPOINT: string;
  ANDROID_CLIENT_ID: string; IP_FIND_KEY: string; GOOGLE_MAPS_API_KEY: string; FRESHCHAT_TOKEN: string;
  SENTRY_DSN: string; REFINER_NPS_FORM_ID: string; }'

Solution:

Ensure that you have the latest environment.staging.ts file. This file might have been updated with new properties that are missing in your current version.

  1. Error: Cannot GET / when running the app locally in the browser

This error typically occurs when some of the dependencies listed in package.json are not installed properly.

Solution:

  • Delete the node_modules folder by running:
rm -rf node_modules
  • Reinstall the dependencies by running:
npm install

This will ensure that all required packages are correctly installed, resolving the issue.

  1. Unable to create PR

Solution:

  • Ping the mobile app team for write access to the repository

πŸ“‚ Project Structure

.
β”œβ”€β”€ .angular/                        # Angular-related configuration
β”œβ”€β”€ .github/                         # GitHub-specific configuration (e.g., workflows)
β”œβ”€β”€ .husky/                          # Git hooks for pre-commit, etc.
β”œβ”€β”€ android/                         # Android-specific configuration and source files
β”œβ”€β”€ coverage/                        # Code coverage reports
β”œβ”€β”€ e2e/                             # End-to-end tests
β”œβ”€β”€ eslint-custom-rules/             # Custom ESLint rules
β”œβ”€β”€ hooks/                           # Custom hooks for the project
β”œβ”€β”€ ios/                             # iOS-specific configuration and source files
β”œβ”€β”€ node_modules/                    # Installed Node.js dependencies
β”œβ”€β”€ resources/                       # Shared resources like images, fonts, etc.
β”œβ”€β”€ src/                             # Main source code of the app
β”‚   β”œβ”€β”€ app/                         # Application core
β”‚   β”‚   β”œβ”€β”€ auth/                    # Authentication module
β”‚   β”‚   β”œβ”€β”€ core/                    # Core application utilities and services
β”‚   β”‚   β”œβ”€β”€ deep-link-redirection/   # Deep link handling module
β”‚   β”‚   β”œβ”€β”€ fyle/                    # Fyle-specific features or modules
β”‚   β”‚   β”œβ”€β”€ post-verification/       # Post-verification module
β”‚   β”‚   β”œβ”€β”€ shared/                  # Shared components, directives, services, or icons
β”‚   β”‚   β”œβ”€β”€ app-routing.module.ts    # Routing configuration for the app
β”‚   β”‚   β”œβ”€β”€ app.component.html       # Main HTML template for the app
β”‚   β”‚   β”œβ”€β”€ app.component.scss       # Main SCSS styles for the app
β”‚   β”‚   β”œβ”€β”€ app.component.spec.ts    # Unit tests for the main app component
β”‚   β”‚   β”œβ”€β”€ app.component.ts         # Main app component logic
β”‚   β”‚   β”œβ”€β”€ app.module.ts            # Root module of the app
β”‚   β”‚   β”œβ”€β”€ constants.ts             # Application-wide constants
β”‚   β”œβ”€β”€ assets/                      # Static assets like images, icons, font, etc.
β”‚   β”œβ”€β”€ environments/                # Environment file-specific configuration
β”‚   β”œβ”€β”€ theme/                       # Application themes (scss)
β”‚   β”œβ”€β”€ global.scss                  # Global styles for the app
β”‚   β”œβ”€β”€ index.html                   # Main HTML file of the application
β”‚   β”œβ”€β”€ main.ts                      # Main entry point for Angular app
β”‚   β”œβ”€β”€ polyfills.ts                 # Polyfills needed by Angular to load before the app
β”‚   β”œβ”€β”€ test.ts                      # File is required by karma.conf.js and loads recursively all the .spec
β”‚   β”œβ”€β”€ zone-flags.ts                # Zone.js configuration flags
β”œβ”€β”€ .eslintrc.json                   # configuration file for ESLin
β”œβ”€β”€ .gitignore                       # Files and folders ignored by Git
β”œβ”€β”€ .npmrc                           # NPM configuration
β”œβ”€β”€ .prettierignore                  # Files ignored by Prettier
β”œβ”€β”€ angular.json                     # Angular workspace configuration
β”œβ”€β”€ appflow.config.json              # Configuration for Appflow
β”œβ”€β”€ browserslist                     # Browser compatibility configuration
β”œβ”€β”€ build_appflow.sh                 # Shell script for Appflow build
β”œβ”€β”€ build_prod.sh                    # Shell script for production build
β”œβ”€β”€ build_staging.sh                 # Shell script for staging build
β”œβ”€β”€ capacitor.config.ts              # Capacitor configuration
β”œβ”€β”€ ionic.config.json                # Ionic CLI configuration
β”œβ”€β”€ karma.conf.js                    # Karma test runner configuration
β”œβ”€β”€ LICENSE                          # License file
β”œβ”€β”€ package-lock.json                # Lockfile for NPM dependencies
β”œβ”€β”€ package.json                     # Project dependencies and scripts
β”œβ”€β”€ README.md                        # Documentation for the project
β”œβ”€β”€ tsconfig.app.json                # TypeScript configuration for the app
β”œβ”€β”€ tsconfig.json                    # Base TypeScript configuration
β”œβ”€β”€ tsconfig.spec.json               # TypeScript configuration for tests
└── ...

πŸ§ͺ Testing

  • Run unit tests:
npm run test
  • For non-parallel execution (Recommended method for preventing excessive CPU utilization and memory hogging.):
npm run test:no-parallel

Viewing Coverage Reports

After running the tests, you can view the test coverage report by following these steps:

  • Open the generated index.html file present in the app/coverage/index.html.
  • Metrics Explanation: In this file, you will see 4 metrics for the files you have changed:
  • Statements: Percentage of executed statements
  • Branches: Percentage of executed branches (e.g., conditions in if, else, switch statements, &&, ||, ? operators)
  • Functions: Percentage of executed functions
  • Lines: Percentage of executed lines of code
  • To increase code coverage, write additional test cases to cover the missing metrics.

πŸ“± Running on Devices

Android

For running the app directly on an Android device for staging

  1. Build and sync the app:
ionic capacitor run android -l --external --configuration=staging
  1. It will open Android Studio, and let it build index files and Gradle build for some time. Then check that the studio recognized the right device in the top bar. Press the run button. After every change, you make in the src directory. It will automatically build the app on the device.

iOS

For running the app directly on an ios device for staging

  • Add .env file to project (ping mobile app team for the file)
  • Install Xcode from the App Store
  • Build and sync:
ionic build --staging
npx cap sync
npx cap open ios
  • Open Xcode, select the connected device from the top bar and click on the run button.

πŸ“Š Deployment

Running Appflow workflow manually on a private branch

  • Go to the GitHub Actions tab.
  • From Workflows List, Select Manual Workflow - Appflow
  • On the right-hand side, you can see the list of workflow runs.
  • In the list view you can see a Run Workflow button. Click on that button
  • Select the branch on which you want to run the workflow from the dropdown available for Use workflow from
  • Click on Run Workflow
  • This will now run the workflow on your private branch, and the Diawi APK and IPA links will be shared on Slack

πŸ™ Further Help

For access to environment files or repository write permissions, contact the mobile app team.

For additional documentation, refer to the Ionic Framework Docs.