diff --git a/.config/dictionaries/project.dic b/.config/dictionaries/project.dic
index 4ed180b5659..f07f6deb191 100644
--- a/.config/dictionaries/project.dic
+++ b/.config/dictionaries/project.dic
@@ -320,5 +320,8 @@ xcodeproj
xctest
xctestrun
xcworkspace
+xprv
+xpub
+xpublic
xvfb
yoroi
diff --git a/.earthlyignore b/.earthlyignore
index 9cc8aa7e850..c0dad16a97f 100644
--- a/.earthlyignore
+++ b/.earthlyignore
@@ -11,6 +11,7 @@
**/*.iml
**/coverage/
**/test_reports/
+**/*.log
# node related
diff --git a/.github/workflows/build-flutter-web.yml b/.github/workflows/build-flutter-web.yml
deleted file mode 100644
index c7bfff78407..00000000000
--- a/.github/workflows/build-flutter-web.yml
+++ /dev/null
@@ -1,69 +0,0 @@
-name: Deploy Catalyst Voices Web App
-
-on:
- push:
- branches:
- - main
-
-permissions:
- contents: write
- pull-requests: write
- id-token: write
-
-concurrency:
- group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
- cancel-in-progress: true
-
-env:
- AWS_REGION: eu-central-1
- AWS_ROLE_ARN: arn:aws:iam::332405224602:role/ci
- EARTHLY_TARGET: docker
- ECR_REGISTRY: 332405224602.dkr.ecr.eu-central-1.amazonaws.com
-
-jobs:
- deploy-voices-web-app:
- name: Deploy Catalyst Voices Web App
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v4
-
- - name: Setup CI
- uses: input-output-hk/catalyst-ci/actions/setup@master
- with:
- aws_role_arn: ${{ env.AWS_ROLE_ARN }}
- aws_region: ${{ env.AWS_REGION }}
- earthly_runner_secret: ${{ secrets.EARTHLY_RUNNER_SECRET }}
-
- - name: Build Flutter Web
- uses: input-output-hk/catalyst-ci/actions/run@master
- if: always()
- continue-on-error: false
- with:
- earthfile: ./catalyst_voices/
- flags: --allow-privileged
- targets: build-web
- target_flags: --RUN_ON_PR=false --SENTRY_DSN=${{ secrets.SENTRY_DSN }}
- runner_address: ${{ secrets.EARTHLY_SATELLITE_ADDRESS }}
- artifact: "true"
-
- - name: Package Flutter Web
- uses: input-output-hk/catalyst-ci/actions/run@master
- if: always()
- continue-on-error: false
- with:
- earthfile: ./catalyst_voices/
- flags: --allow-privileged
- targets: package
- runner_address: ${{ secrets.EARTHLY_SATELLITE_ADDRESS }}
- artifact: "true"
-
- - name: Publish Flutter Web
- uses: input-output-hk/catalyst-ci/actions/run@master
- if: always()
- continue-on-error: false
- with:
- earthfile: ./catalyst_voices/
- flags: --allow-privileged
- targets: publish
- runner_address: ${{ secrets.EARTHLY_SATELLITE_ADDRESS }}
- artifact: "true"
diff --git a/.vscode/launch.recommended.json b/.vscode/launch.recommended.json
index b9de6a4e6e4..1230be7f0ca 100644
--- a/.vscode/launch.recommended.json
+++ b/.vscode/launch.recommended.json
@@ -22,7 +22,12 @@
"program": "lib/configs/main_web.dart",
"args": [
"--dart-define",
- "SENTRY_DSN=REPLACE_WITH_SENTRY_DSN_URL"
+ "SENTRY_DSN=REPLACE_WITH_SENTRY_DSN_URL",
+ // flutter_rust_bridge: https://cjycode.com/flutter_rust_bridge/manual/miscellaneous/web-cross-origin#when-flutter-run
+ "--web-header",
+ "Cross-Origin-Opener-Policy=same-origin",
+ "--web-header",
+ "Cross-Origin-Embedder-Policy=require-corp"
]
},
{
diff --git a/Earthfile b/Earthfile
index 4898523c5ff..99b54f456cb 100644
--- a/Earthfile
+++ b/Earthfile
@@ -1,8 +1,8 @@
VERSION 0.8
-IMPORT github.com/input-output-hk/catalyst-ci/earthly/mdlint:v3.2.23 AS mdlint-ci
-IMPORT github.com/input-output-hk/catalyst-ci/earthly/cspell:v3.2.23 AS cspell-ci
-IMPORT github.com/input-output-hk/catalyst-ci/earthly/postgresql:v3.2.23 AS postgresql-ci
+IMPORT github.com/input-output-hk/catalyst-ci/earthly/mdlint:v3.2.24 AS mdlint-ci
+IMPORT github.com/input-output-hk/catalyst-ci/earthly/cspell:v3.2.24 AS cspell-ci
+IMPORT github.com/input-output-hk/catalyst-ci/earthly/postgresql:v3.2.24 AS postgresql-ci
FROM debian:stable-slim
diff --git a/catalyst-gateway/Earthfile b/catalyst-gateway/Earthfile
index 96ee8ec7243..1cde02848f7 100644
--- a/catalyst-gateway/Earthfile
+++ b/catalyst-gateway/Earthfile
@@ -1,6 +1,6 @@
VERSION 0.8
-IMPORT github.com/input-output-hk/catalyst-ci/earthly/rust:v3.2.23 AS rust-ci
+IMPORT github.com/input-output-hk/catalyst-ci/earthly/rust:v3.2.24 AS rust-ci
#cspell: words rustfmt toolsets USERARCH stdcfgs
diff --git a/catalyst-gateway/event-db/Earthfile b/catalyst-gateway/event-db/Earthfile
index 79bc5a5a20e..dac2e2647ca 100644
--- a/catalyst-gateway/event-db/Earthfile
+++ b/catalyst-gateway/event-db/Earthfile
@@ -3,7 +3,7 @@
# the database and its associated software.
VERSION 0.8
-IMPORT github.com/input-output-hk/catalyst-ci/earthly/postgresql:v3.2.23 AS postgresql-ci
+IMPORT github.com/input-output-hk/catalyst-ci/earthly/postgresql:v3.2.24 AS postgresql-ci
# cspell: words
diff --git a/catalyst-gateway/rustfmt.toml b/catalyst-gateway/rustfmt.toml
index b0f20832c9f..fa6d8c2e906 100644
--- a/catalyst-gateway/rustfmt.toml
+++ b/catalyst-gateway/rustfmt.toml
@@ -36,7 +36,7 @@ max_width = 100
# Comments:
normalize_comments = true
-normalize_doc_attributes = true
+normalize_doc_attributes = false
wrap_comments = true
comment_width = 90 # small excess is okay but prefer 80
format_code_in_doc_comments = true
@@ -65,4 +65,4 @@ condense_wildcard_suffixes = true
hex_literal_case = "Upper"
# Ignored files:
-ignore = []
+ignore = []
\ No newline at end of file
diff --git a/catalyst-gateway/tests/Earthfile b/catalyst-gateway/tests/Earthfile
index d5b0f76de80..979773202f8 100644
--- a/catalyst-gateway/tests/Earthfile
+++ b/catalyst-gateway/tests/Earthfile
@@ -1,5 +1,5 @@
VERSION 0.8
-IMPORT github.com/input-output-hk/catalyst-ci/earthly/spectral:v3.2.23 AS spectral-ci
+IMPORT github.com/input-output-hk/catalyst-ci/earthly/spectral:v3.2.24 AS spectral-ci
# cspell: words oapi
# test-lint-openapi - OpenAPI linting from an artifact
diff --git a/catalyst-gateway/tests/api_tests/Earthfile b/catalyst-gateway/tests/api_tests/Earthfile
index 40551a40233..e0bb11a20cb 100644
--- a/catalyst-gateway/tests/api_tests/Earthfile
+++ b/catalyst-gateway/tests/api_tests/Earthfile
@@ -1,6 +1,6 @@
VERSION 0.8
-IMPORT github.com/input-output-hk/catalyst-ci/earthly/python:v3.2.23 AS python-ci
+IMPORT github.com/input-output-hk/catalyst-ci/earthly/python:v3.2.24 AS python-ci
builder:
FROM python-ci+python-base
diff --git a/catalyst_voices/.earthlyignore b/catalyst_voices/.earthlyignore
index 9cc8aa7e850..c0dad16a97f 100644
--- a/catalyst_voices/.earthlyignore
+++ b/catalyst_voices/.earthlyignore
@@ -11,6 +11,7 @@
**/*.iml
**/coverage/
**/test_reports/
+**/*.log
# node related
diff --git a/catalyst_voices/.gitignore b/catalyst_voices/.gitignore
index ac235143a1b..a77786aa472 100644
--- a/catalyst_voices/.gitignore
+++ b/catalyst_voices/.gitignore
@@ -1,6 +1,26 @@
### Dart ###
# See https://www.dartlang.org/guides/libraries/private-files
+# Generated files from code generation tools
+*.g.dart
+*.freezed.dart
+*.chopper.dart
+*.swagger.dart
+*.openapi.dart
+*.gen.dart
+
+# Un-ignore generated files in public packages
+!**/packages/libs/**/*.g.dart
+!**/packages/libs/**/*.freezed.dart
+!**/packages/libs/**/*.chopper.dart
+!**/packages/libs/**/*.swagger.dart
+!**/packages/libs/**/*.openapi.dart
+!**/packages/libs/**/*.gen.dart
+
+# Localization (l10n) generated files
+packages/internal/catalyst_voices_localization/lib/generated/catalyst_voices_localizations_*.dart
+packages/internal/catalyst_voices_localization/lib/generated/catalyst_voices_localizations.dart
+
# Files and directories created by pub
.dart_tool/
.packages
diff --git a/catalyst_voices/.idea/.name b/catalyst_voices/.idea/.name
deleted file mode 100644
index 8482e6c4500..00000000000
--- a/catalyst_voices/.idea/.name
+++ /dev/null
@@ -1 +0,0 @@
-catalyst_voices
\ No newline at end of file
diff --git a/catalyst_voices/.idea/libraries/Dart_Packages.xml b/catalyst_voices/.idea/libraries/Dart_Packages.xml
deleted file mode 100644
index aeb7850fae9..00000000000
--- a/catalyst_voices/.idea/libraries/Dart_Packages.xml
+++ /dev/null
@@ -1,668 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/catalyst_voices/.idea/libraries/Dart_SDK.xml b/catalyst_voices/.idea/libraries/Dart_SDK.xml
deleted file mode 100644
index 3b3c0ad641e..00000000000
--- a/catalyst_voices/.idea/libraries/Dart_SDK.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/catalyst_voices/.idea/libraries/Flutter_Plugins.xml b/catalyst_voices/.idea/libraries/Flutter_Plugins.xml
deleted file mode 100644
index b0f697111e2..00000000000
--- a/catalyst_voices/.idea/libraries/Flutter_Plugins.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/catalyst_voices/.idea/misc.xml b/catalyst_voices/.idea/misc.xml
deleted file mode 100644
index 469b00f42fa..00000000000
--- a/catalyst_voices/.idea/misc.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/catalyst_voices/.idea/modules.xml b/catalyst_voices/.idea/modules.xml
deleted file mode 100644
index 3bdcc0b0a8e..00000000000
--- a/catalyst_voices/.idea/modules.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/catalyst_voices/.idea/runConfigurations/melos_bootstrap.xml b/catalyst_voices/.idea/runConfigurations/melos_bootstrap.xml
deleted file mode 100644
index d5715306fb6..00000000000
--- a/catalyst_voices/.idea/runConfigurations/melos_bootstrap.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
diff --git a/catalyst_voices/.idea/runConfigurations/melos_clean.xml b/catalyst_voices/.idea/runConfigurations/melos_clean.xml
deleted file mode 100644
index f45d4362496..00000000000
--- a/catalyst_voices/.idea/runConfigurations/melos_clean.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
diff --git a/catalyst_voices/.idea/runConfigurations/melos_run_format_check.xml b/catalyst_voices/.idea/runConfigurations/melos_run_format_check.xml
deleted file mode 100644
index 08ebebf1f5b..00000000000
--- a/catalyst_voices/.idea/runConfigurations/melos_run_format_check.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
diff --git a/catalyst_voices/.idea/runConfigurations/melos_run_metrics.xml b/catalyst_voices/.idea/runConfigurations/melos_run_metrics.xml
deleted file mode 100644
index 3e62682eadc..00000000000
--- a/catalyst_voices/.idea/runConfigurations/melos_run_metrics.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
diff --git a/catalyst_voices/.idea/runConfigurations/melos_run_test.xml b/catalyst_voices/.idea/runConfigurations/melos_run_test.xml
deleted file mode 100644
index a4f0c21a950..00000000000
--- a/catalyst_voices/.idea/runConfigurations/melos_run_test.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
diff --git a/catalyst_voices/.idea/runConfigurations/melos_run_test_select.xml b/catalyst_voices/.idea/runConfigurations/melos_run_test_select.xml
deleted file mode 100644
index 7d5400cbf64..00000000000
--- a/catalyst_voices/.idea/runConfigurations/melos_run_test_select.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
diff --git a/catalyst_voices/.idea/vcs.xml b/catalyst_voices/.idea/vcs.xml
deleted file mode 100644
index 6c0b8635858..00000000000
--- a/catalyst_voices/.idea/vcs.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/catalyst_voices/.idea/workspace.xml b/catalyst_voices/.idea/workspace.xml
deleted file mode 100644
index 0e2110b31b3..00000000000
--- a/catalyst_voices/.idea/workspace.xml
+++ /dev/null
@@ -1,67 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {
- "keyToString": {
- "RunOnceActivity.OpenProjectViewOnStart": "true",
- "RunOnceActivity.ShowReadmeOnStart": "true",
- "RunOnceActivity.cidr.known.project.marker": "true",
- "cidr.known.project.marker": "true",
- "dart.analysis.tool.window.visible": "false",
- "last_opened_file_path": "/Users/minikin/IOG/Code/temp-catalyst-voices/catalyst_voices",
- "settings.editor.selected.configurable": "AndroidSdkUpdater",
- "show.migrate.to.gradle.popup": "false"
- }
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 1694788208043
-
-
- 1694788208043
-
-
-
-
\ No newline at end of file
diff --git a/catalyst_voices/Earthfile b/catalyst_voices/Earthfile
index 82dbe168a08..1a854036125 100644
--- a/catalyst_voices/Earthfile
+++ b/catalyst_voices/Earthfile
@@ -1,13 +1,12 @@
VERSION 0.8
IMPORT ../catalyst-gateway AS catalyst-gateway
-IMPORT github.com/input-output-hk/catalyst-ci/earthly/flutter:v3.2.23 AS flutter-ci
+IMPORT github.com/input-output-hk/catalyst-ci/earthly/flutter:v3.2.24 AS flutter-ci
# repo-catalyst-voices - Creates artifacts of all configuration files,
# packages and folders related to catalyst_voices frontend.
repo-catalyst-voices:
FROM scratch
-
WORKDIR /repo
COPY --dir . .
@@ -20,17 +19,28 @@ builder:
DO flutter-ci+BOOTSTRAP
# Generates flutter code.
-# Based on Catalyst Gateway OpenAPI specifications generates models, clients
-# and serialization logic.
+# Generates codes for Catalyst Gateway OpenAPI, Voices Localization and
+# VoicesAssets and other packages that depend on code-generator.
# It accepts [save_locally] ARG that when true place the artifacts in the
-# proper folder of `catalyst_voices_services` local code.
+# proper folders
code-generator:
ARG save_locally=false
-
+ FROM +builder
LET gen_code_path = lib/generated/catalyst_gateway
LET local_gen_code_path = packages/internal/catalyst_voices_services/lib/generated/catalyst_gateway/
- FROM +builder
+ RUN melos l10n
+ RUN melos build_runner
+
+ IF [ $save_locally = true ]
+ RUN find . \( -name "*.g.dart" -o -name "*.freezed.dart" -o -name "*.chopper.dart" -o -name "*.swagger.dart" -o -name "*.openapi.dart" -o -name "*.gen.dart" -o -name "catalyst_voices_localizations*.dart" \)
+
+ FOR generated_file IN $(find . \( -name "*.g.dart" -o -name "*.freezed.dart" -o -name "*.chopper.dart" -o -name "*.swagger.dart" -o -name "*.openapi.dart" -o -name "*.gen.dart" -o -name "catalyst_voices_localizations*.dart" \))
+ SAVE ARTIFACT $generated_file AS LOCAL $generated_file
+ END
+ ELSE
+ SAVE ARTIFACT .
+ END
WORKDIR packages/internal/catalyst_voices_services
COPY catalyst-gateway+build/doc/cat-gateway-api.json openapi/cat-gateway-api.json
DO flutter-ci+OPENAPI_CODE_GEN \
@@ -38,20 +48,12 @@ code-generator:
--GEN_CODE_PATH=$gen_code_path \
--LOCAL_GEN_CODE_PATH=$local_gen_code_path
-# Tests that the code generation is consistent
-# with the generated code currently in the repo.
-# This MUST be a test target because it requires artifacts from build targets.
-test-flutter-code-generator:
- FROM +code-generator
- # Copy generated files in the local file tree to a temporary folder
- COPY packages/internal/catalyst_voices_services/lib/generated/catalyst_gateway /tmp/repo_generated
- # Check diff between local code and earthly artifacts
- RUN diff /tmp/repo_generated lib/generated/catalyst_gateway
+
# Runs static analysis on the code.
check-static-analysis:
- FROM +builder
- DO flutter-ci+ANALYZE
+ FROM +code-generator
+ DO flutter-ci+ANALYZE
# Runs code formatting checks.
check-code-formatting:
@@ -70,12 +72,12 @@ check-license:
# Run unit tests
test-unit:
- FROM +builder
+ FROM +code-generator
DO flutter-ci+UNIT_TESTS
# Build web version of Catalyst Voices
build-web:
- FROM +builder
+ FROM +code-generator
ARG RUN_ON_PR=true
ARG SENTRY_DSN
diff --git a/catalyst_voices/README.md b/catalyst_voices/README.md
index 831b18ad42d..9871aab483a 100644
--- a/catalyst_voices/README.md
+++ b/catalyst_voices/README.md
@@ -11,6 +11,10 @@ This repository contains the Catalyst Voices app and packages.
* [Packages](#packages)
* [Flavors](#flavors)
* [Environment variables](#environment-variables)
+ * [Code Generation](#code-generation)
+ * [Running Code Generation](#running-code-generation)
+ * [GitHub Token / PAT Setup](#github-token--pat-setup)
+ * [Security Notes](#security-notes)
* [Running Tests](#running-tests)
* [Common issues](#common-issues)
@@ -97,6 +101,42 @@ 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:
diff --git a/catalyst_voices/apps/voices/integration_test/Earthfile b/catalyst_voices/apps/voices/integration_test/Earthfile
index d4df74940d6..822e0559415 100644
--- a/catalyst_voices/apps/voices/integration_test/Earthfile
+++ b/catalyst_voices/apps/voices/integration_test/Earthfile
@@ -3,7 +3,7 @@ VERSION 0.8
IMPORT ../../.. AS catalyst-voices
integration-test-web:
- FROM catalyst-voices+build-web
+ FROM catalyst-voices+code-generator
ARG TARGETARCH
ARG browser
LET driver_port = 4444
@@ -21,6 +21,9 @@ integration-test-web:
# IF [ $browser = "edge" && $TARGETARCH = "amd64" ]]
# LET driver = "msedgedriver"
# END
+
+ WORKDIR /frontend/apps/voices
+
RUN ($driver --port=$driver_port > $driver.log &) && \
sleep 5 && \
flutter drive --driver=test_driver/integration_tests.dart \
@@ -35,6 +38,7 @@ integration-test-web:
WAIT
SAVE ARTIFACT $driver.log AS LOCAL $driver.log
END
+
IF [ -f fail ]
RUN --no-cache echo ""$browser" integration test failed" && \
echo "Printing "$driver" logs..." && \
diff --git a/catalyst_voices/apps/voices/lib/configs/bootstrap.dart b/catalyst_voices/apps/voices/lib/configs/bootstrap.dart
index 3c5b9a0a97e..764087cb9dc 100644
--- a/catalyst_voices/apps/voices/lib/configs/bootstrap.dart
+++ b/catalyst_voices/apps/voices/lib/configs/bootstrap.dart
@@ -1,5 +1,6 @@
import 'dart:async';
+import 'package:catalyst_key_derivation/catalyst_key_derivation.dart';
import 'package:catalyst_voices/app/app.dart';
import 'package:catalyst_voices/configs/app_bloc_observer.dart';
import 'package:catalyst_voices/configs/sentry_service.dart';
@@ -90,6 +91,9 @@ Future bootstrap() async {
await Dependencies.instance.init();
+ // Key derivation needs to be initialized before it can be used
+ await CatalystKeyDerivation.init();
+
final router = AppRouter.init(
guards: const [
MilestoneGuard(),
diff --git a/catalyst_voices/apps/voices/lib/dependency/dependencies.dart b/catalyst_voices/apps/voices/lib/dependency/dependencies.dart
index 681a569e3f0..e93ed705f77 100644
--- a/catalyst_voices/apps/voices/lib/dependency/dependencies.dart
+++ b/catalyst_voices/apps/voices/lib/dependency/dependencies.dart
@@ -1,6 +1,7 @@
import 'dart:async';
import 'package:catalyst_cardano/catalyst_cardano.dart';
+import 'package:catalyst_key_derivation/catalyst_key_derivation.dart';
import 'package:catalyst_voices_blocs/catalyst_voices_blocs.dart';
import 'package:catalyst_voices_repositories/catalyst_voices_repositories.dart';
import 'package:catalyst_voices_services/catalyst_voices_services.dart';
@@ -66,7 +67,8 @@ final class Dependencies extends DependencyProvider {
void _registerServices() {
registerLazySingleton(() => const SecureStorage());
- registerLazySingleton(KeyDerivation.new);
+ registerLazySingleton(CatalystKeyDerivation.new);
+ registerLazySingleton(() => KeyDerivation(get()));
registerLazySingleton(VaultKeychainProvider.new);
registerLazySingleton(SecureDummyAuthStorage.new);
registerLazySingleton(Downloader.new);
diff --git a/catalyst_voices/apps/voices/lib/pages/registration/wallet_link/stage/rbac_transaction_panel.dart b/catalyst_voices/apps/voices/lib/pages/registration/wallet_link/stage/rbac_transaction_panel.dart
index b894dbd1801..11e4598ee23 100644
--- a/catalyst_voices/apps/voices/lib/pages/registration/wallet_link/stage/rbac_transaction_panel.dart
+++ b/catalyst_voices/apps/voices/lib/pages/registration/wallet_link/stage/rbac_transaction_panel.dart
@@ -118,7 +118,7 @@ class _BlocSummary extends StatelessWidget {
},
builder: (context, state) {
if (state == null) {
- return const Offstage();
+ return const _SummaryPlaceholder();
}
return _Summary(
@@ -131,6 +131,20 @@ class _BlocSummary extends StatelessWidget {
}
}
+class _SummaryPlaceholder extends StatelessWidget {
+ const _SummaryPlaceholder();
+
+ @override
+ Widget build(BuildContext context) {
+ return const Center(
+ child: Padding(
+ padding: EdgeInsets.all(32),
+ child: CircularProgressIndicator(),
+ ),
+ );
+ }
+}
+
class _Summary extends StatelessWidget {
final Set roles;
final WalletInfo walletInfo;
diff --git a/catalyst_voices/apps/voices/lib/pages/treasury/campaign_builder_panel.dart b/catalyst_voices/apps/voices/lib/pages/treasury/campaign_builder_panel.dart
deleted file mode 100644
index 6fe8cb7e341..00000000000
--- a/catalyst_voices/apps/voices/lib/pages/treasury/campaign_builder_panel.dart
+++ /dev/null
@@ -1,73 +0,0 @@
-import 'package:catalyst_voices/pages/treasury/campaign_segment_controller.dart';
-import 'package:catalyst_voices/pages/treasury/treasury_campaign_builder_ext.dart';
-import 'package:catalyst_voices/widgets/widgets.dart';
-import 'package:catalyst_voices_localization/catalyst_voices_localization.dart';
-import 'package:catalyst_voices_models/catalyst_voices_models.dart';
-import 'package:flutter/material.dart';
-
-class CampaignBuilderPanel extends StatelessWidget {
- final TreasuryCampaignBuilder builder;
-
- const CampaignBuilderPanel({
- super.key,
- required this.builder,
- });
-
- @override
- Widget build(BuildContext context) {
- return SpaceSidePanel(
- isLeft: true,
- name: context.l10n.treasuryCampaignBuilder,
- onCollapseTap: () {},
- tabs: [
- if (builder.segments.isNotEmpty)
- SpaceSidePanelTab(
- name: context.l10n.treasuryCampaignBuilderSegments,
- body: Column(
- children: builder.segments.map(
- (segment) {
- return _CampaignSegmentBody(
- key: ValueKey('CampaignSegment${segment.id}Key'),
- segment: segment,
- controller: CampaignControllerScope.of(
- context,
- id: segment.id,
- ),
- );
- },
- ).toList(),
- ),
- ),
- ],
- );
- }
-}
-
-class _CampaignSegmentBody extends StatelessWidget {
- final TreasuryCampaignSegment segment;
- final VoicesNodeMenuController? controller;
-
- const _CampaignSegmentBody({
- super.key,
- required this.segment,
- this.controller,
- });
-
- @override
- Widget build(BuildContext context) {
- final l10n = context.l10n;
-
- return VoicesNodeMenu(
- name: segment.localizedName(l10n),
- controller: controller,
- items: segment.steps.map(
- (step) {
- return VoicesNodeMenuItem(
- id: step.id,
- label: step.localizedName(l10n),
- );
- },
- ).toList(),
- );
- }
-}
diff --git a/catalyst_voices/apps/voices/lib/pages/treasury/campaign_details.dart b/catalyst_voices/apps/voices/lib/pages/treasury/campaign_details.dart
deleted file mode 100644
index ad0ba654280..00000000000
--- a/catalyst_voices/apps/voices/lib/pages/treasury/campaign_details.dart
+++ /dev/null
@@ -1,144 +0,0 @@
-import 'package:catalyst_voices/pages/treasury/campaign_segment_controller.dart';
-import 'package:catalyst_voices/pages/treasury/treasury_campaign_builder_ext.dart';
-import 'package:catalyst_voices/widgets/widgets.dart';
-import 'package:catalyst_voices_localization/catalyst_voices_localization.dart';
-import 'package:catalyst_voices_models/catalyst_voices_models.dart';
-import 'package:catalyst_voices_shared/catalyst_voices_shared.dart';
-import 'package:flutter/material.dart';
-
-class CampaignDetails extends StatelessWidget {
- final TreasuryCampaignBuilder builder;
-
- const CampaignDetails({
- super.key,
- required this.builder,
- });
-
- @override
- Widget build(BuildContext context) {
- return ListView.builder(
- padding: const EdgeInsets.only(top: 10),
- itemCount: builder.segments.length,
- itemBuilder: (context, index) {
- final segment = builder.segments[index];
-
- return _ListenableSegmentDetails(
- key: ValueKey('ListenableSegment${segment.id}DetailsKey'),
- segment: segment,
- controller: CampaignControllerScope.of(
- context,
- id: segment.id,
- ),
- );
- },
- );
- }
-}
-
-class _ListenableSegmentDetails extends StatelessWidget {
- final TreasuryCampaignSegment segment;
- final VoicesNodeMenuController controller;
-
- const _ListenableSegmentDetails({
- super.key,
- required this.segment,
- required this.controller,
- });
-
- @override
- Widget build(BuildContext context) {
- return ValueListenableBuilder(
- valueListenable: controller,
- builder: (context, value, _) {
- return _SegmentDetails(
- key: ValueKey('Segment${segment.id}DetailsKey'),
- name: segment.localizedName(context.l10n),
- steps: segment.steps,
- selected: controller.selected,
- isExpanded: controller.isExpanded,
- onChevronTap: () {
- controller.isExpanded = !controller.isExpanded;
- },
- );
- },
- );
- }
-}
-
-class _SegmentDetails extends StatelessWidget {
- final String name;
- final List steps;
- final int? selected;
- final bool isExpanded;
- final VoidCallback? onChevronTap;
-
- const _SegmentDetails({
- super.key,
- required this.name,
- required this.steps,
- this.selected,
- this.isExpanded = false,
- this.onChevronTap,
- });
-
- @override
- Widget build(BuildContext context) {
- return Column(
- children: [
- SegmentHeader(
- leading: ChevronExpandButton(
- onTap: onChevronTap,
- isExpanded: isExpanded,
- ),
- name: name,
- isSelected: isExpanded,
- ),
- if (isExpanded)
- ...steps.map(
- (step) {
- return _StepDetails(
- key: ValueKey('WorkspaceStep${step.id}TileKey'),
- id: step.id,
- name: step.localizedName(context.l10n),
- desc: step.tempDescription(),
- isSelected: step.id == selected,
- isEditable: step.isEditable,
- );
- },
- ),
- ].separatedBy(const SizedBox(height: 12)).toList(),
- );
- }
-}
-
-class _StepDetails extends StatelessWidget {
- const _StepDetails({
- super.key,
- required this.id,
- required this.name,
- required this.desc,
- this.isSelected = false,
- this.isEditable = false,
- });
-
- final int id;
- final String name;
- final String desc;
- final bool isSelected;
- final bool isEditable;
-
- @override
- Widget build(BuildContext context) {
- return WorkspaceTextTileContainer(
- name: name,
- isSelected: isSelected,
- headerActions: [
- VoicesTextButton(
- onTap: isEditable ? () {} : null,
- child: Text(context.l10n.stepEdit),
- ),
- ],
- content: desc,
- );
- }
-}
diff --git a/catalyst_voices/apps/voices/lib/pages/treasury/campaign_segment_controller.dart b/catalyst_voices/apps/voices/lib/pages/treasury/campaign_segment_controller.dart
deleted file mode 100644
index d0ae60abadf..00000000000
--- a/catalyst_voices/apps/voices/lib/pages/treasury/campaign_segment_controller.dart
+++ /dev/null
@@ -1,117 +0,0 @@
-// ignore_for_file: prefer_asserts_with_message
-
-import 'package:catalyst_voices/widgets/menu/voices_node_menu.dart';
-import 'package:flutter/material.dart';
-
-typedef CampaignControllerBuilder = CampaignController Function(Object id);
-
-final class CampaignControllerStateData extends VoicesNodeMenuStateData {
- const CampaignControllerStateData({
- super.selectedItemId,
- super.isExpanded,
- });
-}
-
-/// Direct extension of [VoicesNodeMenuController].
-/// Probably we'll need extend controller with additional fields.
-final class CampaignController extends VoicesNodeMenuController {
- CampaignController(CampaignControllerStateData super._value);
-}
-
-/// Keeps together [CampaignControllerStateData] tied to ids.
-class CampaignControllerScope extends StatefulWidget {
- final CampaignControllerBuilder builder;
- final Widget child;
-
- const CampaignControllerScope({
- super.key,
- required this.builder,
- required this.child,
- });
-
- /// The closes instance of [CampaignControllerScope]
- /// that encloses the given context, or null if none found.
- ///
- /// Uses [builder] with given [id] to build [CampaignController]
- /// if none already created for this [id].
- static CampaignController? maybeOf(
- BuildContext context, {
- required Object id,
- }) {
- return context
- .findAncestorStateOfType<_CampaignControllerScopeState>()
- ?._getSegmentController(id);
- }
-
- /// Wrapper on [maybeOf] but forcing null unwrapping.
- static CampaignController of(
- BuildContext context, {
- required Object id,
- }) {
- final controller = maybeOf(context, id: id);
-
- assert(
- controller != null,
- 'Unable to find CampaignControllerScope as parent widget',
- );
-
- return controller!;
- }
-
- @override
- State createState() {
- return _CampaignControllerScopeState();
- }
-}
-
-class _CampaignControllerScopeState extends State {
- final _cache =