Skip to content

Latest commit

 

History

History

catalyst_voices

Catalyst Voices

This repository contains the Catalyst Voices app and packages.

Requirements

❗️We recommend using Visual Studio Code as the default editor for this project.

Getting Started

Bootstrapping

git clone https://github.com/input-output-hk/catalyst-voices.git
cd catalyst_voices
just bootstrap

Packages

Package Description Example
catalyst_voices_assets Assets used in Catalyst Voices example
catalyst_voices_blocs State management of Catalyst Voices example
catalyst_voices_localization Localization files for Catalyst Voices example
catalyst_voices_models Models example
catalyst_voices_repositories Repositories example
catalyst_voices_services Services example
catalyst_voices_shared Shared code example
catalyst_voices_view_models ViewModels example

Flavors

This project contains four flavors:

  • dev
  • qa
  • preprod
  • prod

To run the desired flavor, either use the launch configuration in VSCode/Android Studio or use the following commands:

# Development
flutter run --flavor dev --target apps/voices/lib/configs/main_dev.dart

# QA
flutter run --flavor qa --target apps/voices/lib/configs/main_qa.dart

# Pre-Production
flutter run --flavor preprod --target apps/voices/lib/configs/main_preprod.dart

# Production
flutter run --flavor prod --target apps/voices/lib/configs/main_prod.dart

Catalyst Voices works on the Web only. We plan to add support for other targets later.

Environment variables

We use dart defines to manage environment variables.

For example if you need to pass SENTRY_DSN as environment variable, you can use the following command:

flutter build web --target apps/voices/lib/configs/main_web.dart --dart-define SENTRY_DSN=REPLACE_WITH_SENTRY_DSN_URL

Code Generation

This project utilizes automatic code generation for the following components:

  • Catalyst Gateway OpenAPI
  • Localization files
  • Asset files
  • Navigation route files

Running Code Generation

Basic Generation

To generate code, run the following command in the root directory: earthly ./catalyst_voices+code-generator

Local Saving

To save the generated code locally, use the --save_locally flag: earthly ./catalyst_voices+code-generator --save_locally=true

GitHub Token / PAT Setup

Important A valid GITHUB_TOKEN/ PAT is required to run the earthly target.

Token Configuration:

  1. Locate the .secret.template file in the root directory
  2. Create a copy of this file and name it .secret
  3. Add your GITHUB_TOKEN to the .secret file

Security Notes

  • The .secret file should be included in .gitignore
  • Verify that git does not track the .secret file before committing

Running Tests

To run all unit and widget tests use the following command:

flutter test --coverage --test-randomize-ordering-seed random

To view the generated coverage report you can use lcov.

# Generate Coverage Report
genhtml coverage/lcov.info -o coverage/

# Open Coverage Report
open coverage/index.html

Common issues

  1. Mixed dependencies from a hosted repository and local path:
Because every version of catalyst_cardano_web from path depends on catalyst_cardano_serialization
  from hosted and catalyst_voices depends on catalyst_cardano_serialization from path,
  catalyst_cardano_web from path is forbidden.
So, because catalyst_voices depends on catalyst_cardano_web from path, version solving failed.

Solution:

When adding a new local dependency, hosted repository (i.e. pub.dev) should be preferred over local paths. However to make it easier to depend on local changes use melos bootstrap to generate pubspec_overrides.yaml. This allows to publish the source code on remote repository that points to official dependency versions but use local changes during regular development.

The issue appears if you have added a new dependency or pulled code that adds dependency and you haven't run melos bootstrap.

See Melos.