### Install Dependencies Source: https://github.com/archethic-foundation/archethic-wallet/blob/dev/README.md Fetches project dependencies using Flutter's package manager. ```bash flutter pub get ``` -------------------------------- ### Patrol Installation for Flutter Testing Source: https://github.com/archethic-foundation/archethic-wallet/blob/dev/README.md Instructions for installing and using the Patrol package within a Flutter project for integration testing. It mentions that the package can be installed via `flutter pub get` and provides a link to a README file for detailed usage information within the project. ```bash flutter pub get Full patrol using on this project can be found [here](integration_test/README.md) ``` -------------------------------- ### Installation Rules for Bundle Source: https://github.com/archethic-foundation/archethic-wallet/blob/dev/linux/CMakeLists.txt Configures the installation process to create a relocatable bundle, including setting the install prefix, cleaning the bundle directory, and installing the executable, ICU data, Flutter library, and bundled plugin libraries. ```cmake set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle") if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) endif() install(CODE " file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") " COMPONENT Runtime) set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES}) install(FILES "${bundled_library}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endforeach(bundled_library) # Fully re-copy the assets directory on each build to avoid having stale files ``` -------------------------------- ### Installation Rules Source: https://github.com/archethic-foundation/archethic-wallet/blob/dev/windows/CMakeLists.txt Configures the installation process for the Archethic Wallet executable and associated files. It sets the installation prefix, defines directories for data and libraries, and installs the executable, ICU data, Flutter library, bundled plugin libraries, native assets, and assets directory. The AOT library is installed only for Profile and Release builds. ```cmake set(BUILD_BUNDLE_DIR "$") set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) endif() set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) if(PLUGIN_BUNDLED_LIBRARIES) install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endif() set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/windows/") install(DIRECTORY "${NATIVE_ASSETS_DIR}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) set(FLUTTER_ASSET_DIR_NAME "flutter_assets") install(CODE " file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") " COMPONENT Runtime) install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" CONFIGURATIONS Profile;Release COMPONENT Runtime) ``` -------------------------------- ### CMake Project Setup and Configuration Source: https://github.com/archethic-foundation/archethic-wallet/blob/dev/linux/CMakeLists.txt Sets up the minimum CMake version, project name, executable name, and application ID. It also configures modern CMake behaviors and library loading paths. ```cmake cmake_minimum_required(VERSION 3.10) project(runner LANGUAGES CXX) set(BINARY_NAME "archethic_wallet") set(APPLICATION_ID "net.archethic.archethic_wallet") cmake_policy(SET CMP0063 NEW) set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") ``` -------------------------------- ### Install Xcode Command Line Tools Source: https://github.com/archethic-foundation/archethic-wallet/blob/dev/fastlane/README.md Ensures the latest version of Xcode command line tools are installed, which is a prerequisite for using fastlane. ```sh xcode-select --install ``` -------------------------------- ### Flutter Library Setup Source: https://github.com/archethic-foundation/archethic-wallet/blob/dev/windows/flutter/CMakeLists.txt Configures the Flutter library, including its DLL, header files, and ICU data. It sets up include directories and links the necessary library for the 'flutter' target. ```cmake set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") # Published to parent scope for install step. set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) list(APPEND FLUTTER_LIBRARY_HEADERS "flutter_export.h" "flutter_windows.h" "flutter_messenger.h" "flutter_plugin_registrar.h" "flutter_texture_registrar.h" ) list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/") add_library(flutter INTERFACE) target_include_directories(flutter INTERFACE "${EPHEMERAL_DIR}" ) target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib") add_dependencies(flutter flutter_assemble) ``` -------------------------------- ### Flutter Library Setup (CMake) Source: https://github.com/archethic-foundation/archethic-wallet/blob/dev/linux/flutter/CMakeLists.txt Configures the Flutter library by finding necessary packages (PkgConfig, GTK, GLIB, GIO), setting library paths, and defining include directories and link libraries for the Flutter interface target. ```cmake cmake_minimum_required(VERSION 3.10) set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") # Configuration provided via flutter tool. include(${EPHEMERAL_DIR}/generated_config.cmake) # === Flutter Library === # System-level dependencies. find_package(PkgConfig REQUIRED) pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0) pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0) set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so") # Published to parent scope for install step. set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE) list(APPEND FLUTTER_LIBRARY_HEADERS "fl_basic_message_channel.h" "fl_binary_codec.h" "fl_binary_messenger.h" "fl_dart_project.h" "fl_engine.h" "fl_json_message_codec.h" "fl_json_method_codec.h" "fl_message_codec.h" "fl_method_call.h" "fl_method_channel.h" "fl_method_codec.h" "fl_method_response.h" "fl_plugin_registrar.h" "fl_plugin_registry.h" "fl_standard_message_codec.h" "fl_standard_method_codec.h" "fl_string_codec.h" "fl_value.h" "fl_view.h" "flutter_linux.h" ) list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/") add_library(flutter INTERFACE) target_include_directories(flutter INTERFACE "${EPHEMERAL_DIR}" ) target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}") target_link_libraries(flutter INTERFACE PkgConfig::GTK PkgConfig::GLIB PkgConfig::GIO ) add_dependencies(flutter flutter_assemble) ``` -------------------------------- ### Install Flutter Assets Source: https://github.com/archethic-foundation/archethic-wallet/blob/dev/linux/CMakeLists.txt This snippet installs the Flutter assets directory into the application bundle. It first removes any existing directory to ensure a clean installation and then copies the new assets. This is a core part of setting up the application's UI and resources. ```cmake set(FLUTTER_ASSET_DIR_NAME "flutter_assets") install(CODE " file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") " COMPONENT Runtime) install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) ``` -------------------------------- ### CMake Project Setup and Configuration Source: https://github.com/archethic-foundation/archethic-wallet/blob/dev/windows/CMakeLists.txt Sets the minimum CMake version, project name, and executable name. It also defines build configuration types (Debug, Profile, Release) based on whether the generator is multi-config. Settings for the Profile build mode are explicitly defined to match Release settings. ```cmake cmake_minimum_required(VERSION 3.14) project(archethic_wallet LANGUAGES CXX) set(BINARY_NAME "archethic_wallet") cmake_policy(VERSION 3.14...3.25) get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) if(IS_MULTICONFIG) set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release" CACHE STRING "" FORCE) else() if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Flutter build mode" FORCE) set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Profile" "Release") endif() endif() set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}") set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}") set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}") set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}") ``` -------------------------------- ### Install AOT Library (Non-Debug Builds) Source: https://github.com/archethic-foundation/archethic-wallet/blob/dev/linux/CMakeLists.txt This snippet conditionally installs the Ahead-of-Time (AOT) compiled library. The library is only installed on builds that are not of type 'Debug', ensuring optimized performance for release versions of the wallet. ```cmake if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endif() ``` -------------------------------- ### Patrol Dart Test Example Source: https://github.com/archethic-foundation/archethic-wallet/blob/dev/integration_test/README.md An example of a Dart test case using Patrol's `patrolTest` function. It demonstrates native automation, interacting with UI elements, and using native actions like pressing the home button and opening the app. ```dart void main() { patrolTest( 'counter state is the same after going to Home and switching apps', nativeAutomation: true, nativeAutomatorConfig: NativeAutomatorConfig( packageName: 'pl.leancode.patrol.example', bundleId: 'pl.leancode.patrol.Example', ), (\) async { await $.pumpWidget(ExampleApp()); await $(FloatingActionButton).tap(); expect($(#counterText).text, '1'); await $.native.pressHome(); await $.native.openApp(); expect($(#counterText).text, '1'); await $(FloatingActionButton).tap(); expect($(#counterText).text, '2'); }, ); } ``` -------------------------------- ### Build and Package for Windows Source: https://github.com/archethic-foundation/archethic-wallet/blob/dev/scripts/build.txt Builds the Windows application using Flutter and creates an MSIX package using the msix plugin. ```bash flutter build windows flutter pub run msix:create -c windows/certificates/archethic_wallet.pfx -p password12345 flutter pub run msix:create ``` -------------------------------- ### Build and Deploy for iOS Source: https://github.com/archethic-foundation/archethic-wallet/blob/dev/scripts/build.txt Builds the iOS application for beta release using Flutter and deploys it using Fastlane. ```bash cd ios flutter build ios fastlane beta ``` -------------------------------- ### Build and Deploy Web Application Source: https://github.com/archethic-foundation/archethic-wallet/blob/dev/scripts/build.txt Builds the web application using a script and deploys it to Firebase Hosting. ```bash scripts/build_webapp.sh firebase deploy ``` -------------------------------- ### Build and Package for Linux (AppImage) Source: https://github.com/archethic-foundation/archethic-wallet/blob/dev/scripts/build.txt Builds the Linux application using Flutter and creates an AppImage using appimagetool. ```bash flutter build linux export PATH=$PATH:/home/xxx/archethic-wallet/linux/appimage/appimagetool appimagetool-x86_64.AppImage linux/appimage/AppDir/ build/linux/archethic_wallet.AppImage ``` -------------------------------- ### Build and Deploy for macOS Source: https://github.com/archethic-foundation/archethic-wallet/blob/dev/scripts/build.txt Builds the macOS application using Flutter and provides instructions for notarization, archiving, and distribution via Xcode. ```bash cd macos flutter build macos # Xcode : notarize App : Archive/Distribute app/Deveoper ID/Upload/Automatically sign ``` -------------------------------- ### Run Application Source: https://github.com/archethic-foundation/archethic-wallet/blob/dev/README.md Builds and runs the Flutter application on a connected device or emulator. ```bash flutter run ``` -------------------------------- ### Build Chrome Extension Source: https://github.com/archethic-foundation/archethic-wallet/blob/dev/scripts/build.txt Builds the Chrome extension using a provided script. ```bash scripts/build_chrome_extension.sh ``` -------------------------------- ### Daunused - List Unused Files Source: https://github.com/archethic-foundation/archethic-wallet/blob/dev/scripts/preparePackage.txt Commands for adding, running, and removing the daunused package to identify and list unused files in the project. ```dart dart pub add --dev daunused flutter pub run daunused:daunused.dart . dart pub remove daunused ``` -------------------------------- ### Basic Flutter Project Management Source: https://github.com/archethic-foundation/archethic-wallet/blob/dev/scripts/preparePackage.txt Commands for updating outdated packages, validating dependencies, generating localization files, fetching packages, formatting code, and applying code fixes. ```flutter flutter pub outdated flutter pub run dependency_validator flutter gen-l10n flutter pub get dart format lib packages dart fix --dry-run ``` -------------------------------- ### Dependency Validator Usage Source: https://github.com/archethic-foundation/archethic-wallet/blob/dev/scripts/preparePackage.txt Commands for adding, running, and removing the dependency_validator package to check for unused dependencies. ```dart dart pub add --dev dependency_validator flutter pub run dependency_validator dart pub remove dependency_validator ``` -------------------------------- ### Build for Android Source: https://github.com/archethic-foundation/archethic-wallet/blob/dev/scripts/build.txt Builds an Android APK split by Application Binary Interface (ABI) using Flutter. ```bash flutter build apk --split-per-abi ``` -------------------------------- ### Archethic Wallet Libraries and Technical Choices Source: https://github.com/archethic-foundation/archethic-wallet/blob/dev/CONTRIBUTING.md Overview of the key libraries and technologies used in the Archethic Wallet project, including Riverpod for state management and dependency injection, and GetIt for specific DI needs. ```dart // State Management & Dependency Injection: // Uses Riverpod for managing application state and dependencies. // Example using Riverpod: // final userProvider = Provider((ref) => UserService(ref.read(userRepositoryProvider))); // Dependency Injection: // Primarily uses Riverpod, with some parts relying on GetIt. // Example using GetIt: // final GetIt getIt = GetIt.instance; // void setupLocator() { // getIt.registerLazySingleton(() => UserRepositoryImpl()); // } ``` ```dart // Blockchain Interaction: // Utilizes the 'archethic_lib_dart' package for blockchain interactions. // Example usage (conceptual): // import 'package:archethic_lib_dart/archethic_lib_dart.dart'; // // Future sendTransaction() async { // final archethic = Archethic(network: Network.TESTNET); // final wallet = await archethic.getWallet('your_private_key'); // final tx = await wallet.sendTransaction(...); // print('Transaction sent: ${tx.hash}'); // } ``` -------------------------------- ### Application Executable Definition Source: https://github.com/archethic-foundation/archethic-wallet/blob/dev/linux/CMakeLists.txt Defines the main executable target 'archethic_wallet' with its source files, including the generated plugin registrant. ```cmake add_executable(${BINARY_NAME} "main.cc" "my_application.cc" "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" ) apply_standard_settings(${BINARY_NAME}) ``` -------------------------------- ### Translations Cleaner Usage Source: https://github.com/archethic-foundation/archethic-wallet/blob/dev/scripts/preparePackage.txt Commands for adding, running, and removing the translations_cleaner package to clean localization (arb) files. ```dart dart pub add --dev translations_cleaner dart run translations_cleaner clean-translations dart pub remove translations_cleaner ``` -------------------------------- ### Android Build Gradle Configuration Source: https://github.com/archethic-foundation/archethic-wallet/blob/dev/integration_test/README.md Configuration snippet for the `android/app/build.gradle` file to set up the test instrumentation runner for Patrol tests on Android. ```json android { // ... defaultConfig { //... testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } } dependencies { testImplementation "junit:junit:4.13.2" } ``` -------------------------------- ### Flutter Native Splash Screen Generation Source: https://github.com/archethic-foundation/archethic-wallet/blob/dev/scripts/preparePackage.txt Command to generate native splash screens using the flutter_native_splash package. ```flutter flutter pub run flutter_native_splash:create --path=flutter_native_splash.yaml ``` -------------------------------- ### Fastlane Mac Beta Source: https://github.com/archethic-foundation/archethic-wallet/blob/dev/fastlane/README.md Command to push a new release build to TestFlight for the Mac platform using fastlane. ```sh [bundle exec] fastlane mac beta ``` -------------------------------- ### Run Patrol Tests Source: https://github.com/archethic-foundation/archethic-wallet/blob/dev/integration_test/README.md Commands to execute tests using the Patrol CLI. This includes running all tests, targeting specific test files, and driving tests on a particular device. ```bash > patrol devices > patrol test > patrol test --target integration_test/_test.dart > patrol drive -D > patrol update ``` -------------------------------- ### Archethic Wallet Versioning and Deployment Source: https://github.com/archethic-foundation/archethic-wallet/blob/dev/README.md This documentation outlines the process for updating the Archethic Wallet's version and deploying new builds. It covers updating the `pubspec.yaml` file, executing a script to propagate version changes across configuration files, and creating changelog entries for Android releases. ```APIDOC Versionning: - in `pubspec.yaml` update the version of the app `M.m.p+build` (ex: `version: 2.3.8+528`) - Execute `scripts/update_version.sh` to update versions in other conf files - in `pubspec.yaml` section `msix_config` - in `/web_chrome_extension/public/manifest.json` Changelog: - Create a new changelog file `build.txt` in `/fastlane/metadata/android/en-US/changelogs/` . Build app: - For iOS, macOS, android → cmd `Fastlane` - For Linux, Windows, Chrome Extension → Github actions on new github version ``` -------------------------------- ### Archethic Wallet Application Build Configuration Source: https://github.com/archethic-foundation/archethic-wallet/blob/dev/windows/runner/CMakeLists.txt Configures the main application executable for the Archethic Wallet project using CMake. It specifies source files, standard build settings, preprocessor definitions for versioning, and links necessary libraries and include directories. It also ensures the Flutter build artifacts are included as a dependency. ```cmake cmake_minimum_required(VERSION 3.14) project(runner LANGUAGES CXX) # Define the application target. To change its name, change BINARY_NAME in the # top-level CMakeLists.txt, not the value here, or `flutter run` will no longer # work. # # Any new source files that you add to the application should be added here. add_executable(${BINARY_NAME} WIN32 "flutter_window.cpp" "main.cpp" "utils.cpp" "win32_window.cpp" "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" "Runner.rc" "runner.exe.manifest" ) # Apply the standard set of build settings. This can be removed for applications # that need different build settings. apply_standard_settings(${BINARY_NAME}) # Add preprocessor definitions for the build version. target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"") target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}") target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}") target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}") target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}") # Disable Windows macros that collide with C++ standard library functions. target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") # Add dependency libraries and include directories. Add any application-specific # dependencies here. target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) target_link_libraries(${BINARY_NAME} PRIVATE "dwmapi.lib") target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") # Run the Flutter tool portions of the build. This must not be removed. add_dependencies(${BINARY_NAME} flutter_assemble) ``` -------------------------------- ### Executable Runtime Output Directory Source: https://github.com/archethic-foundation/archethic-wallet/blob/dev/linux/CMakeLists.txt Sets the runtime output directory for the executable to a subdirectory to ensure correct resource loading. ```cmake set_target_properties(${BINARY_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run" ) ``` -------------------------------- ### System Dependencies (GTK) Source: https://github.com/archethic-foundation/archethic-wallet/blob/dev/linux/CMakeLists.txt Finds and checks for the GTK+ 3.0 package using PkgConfig and makes its imported target available. ```cmake find_package(PkgConfig REQUIRED) pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") ``` -------------------------------- ### Fastlane iOS Beta Source: https://github.com/archethic-foundation/archethic-wallet/blob/dev/fastlane/README.md Command to push a new release build to TestFlight for the iOS platform using fastlane. ```sh [bundle exec] fastlane ios beta ``` -------------------------------- ### Archethic Wallet API - Web Hosting Source: https://github.com/archethic-foundation/archethic-wallet/blob/dev/scripts/test_nft.txt This section details the API endpoints for managing web hosting within the Archethic Wallet. It includes information on accessing hosted content and potential operations related to it. ```APIDOC API Endpoint: /api/web_hosting/ Description: Provides access to web hosting functionalities within the Archethic Wallet. Example Usage: Accessing hosted content might involve a specific path structure, potentially including a unique identifier or hash. GET /api/web_hosting/{hash}/{filename} - Retrieves a specific file from the web hosting service. - Parameters: - hash: The unique identifier for the hosted content (e.g., a transaction hash or content hash). - filename: The name of the file to retrieve. - Returns: The content of the requested file. Example Path: https://testnet.archethic.net/api/web_hosting/000054d8107419c8e8586a39083e15a7bac57e02ce7755eecf5233909dfa306c46ac/1.png - This example shows how to access a file named '1.png' associated with the hash '000054d8107419c8e8586a39083e15a7bac57e02ce7755eecf5233909dfa306c46ac'. ``` -------------------------------- ### Generated Plugin Rules Source: https://github.com/archethic-foundation/archethic-wallet/blob/dev/linux/CMakeLists.txt Includes the CMake script for managing generated plugin build rules. ```cmake include(flutter/generated_plugins.cmake) ``` -------------------------------- ### C++ Wrapper for Plugins Source: https://github.com/archethic-foundation/archethic-wallet/blob/dev/windows/flutter/CMakeLists.txt Builds a static C++ library for the Flutter plugin wrapper. It includes core implementation files and plugin-specific source files, sets visibility to hidden, and links against the Flutter library. ```cmake list(APPEND CPP_WRAPPER_SOURCES_CORE "core_implementations.cc" "standard_codec.cc" ) list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/ữa") list(APPEND CPP_WRAPPER_SOURCES_PLUGIN "plugin_registrar.cc" ) list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/ữa") # Wrapper sources needed for a plugin. add_library(flutter_wrapper_plugin STATIC ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} ) apply_standard_settings(flutter_wrapper_plugin) set_target_properties(flutter_wrapper_plugin PROPERTIES POSITION_INDEPENDENT_CODE ON) set_target_properties(flutter_wrapper_plugin PROPERTIES CXX_VISIBILITY_PRESET hidden) target_link_libraries(flutter_wrapper_plugin PUBLIC flutter) target_include_directories(flutter_wrapper_plugin PUBLIC "${WRAPPER_ROOT}/include" ) add_dependencies(flutter_wrapper_plugin flutter_assemble) ``` -------------------------------- ### Flutter Tool Backend Integration Source: https://github.com/archethic-foundation/archethic-wallet/blob/dev/windows/flutter/CMakeLists.txt Sets up a custom command to execute the Flutter tool backend. This command is responsible for generating build artifacts like the Flutter library and wrapper sources, ensuring it runs whenever necessary. ```cmake # _phony_ is a non-existent file to force this command to run every time, since currently there's no way to get a full input/output list from the flutter tool. set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_") set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE) add_custom_command( OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} ${CPP_WRAPPER_SOURCES_APP} ${PHONY_OUTPUT} COMMAND ${CMAKE_COMMAND} -E env ${FLUTTER_TOOL_ENVIRONMENT} "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" ${FLUTTER_TARGET_PLATFORM} $ VERBATIM ) add_custom_target(flutter_assemble DEPENDS "${FLUTTER_LIBRARY}" ${FLUTTER_LIBRARY_HEADERS} ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} ${CPP_WRAPPER_SOURCES_APP} ) ``` -------------------------------- ### Linking Libraries and Dependencies Source: https://github.com/archethic-foundation/archethic-wallet/blob/dev/linux/CMakeLists.txt Links the application executable against the Flutter library and GTK, and adds a dependency on the Flutter assemble target. ```cmake target_link_libraries(${BINARY_NAME} PRIVATE flutter) target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) add_dependencies(${BINARY_NAME} flutter_assemble) ``` -------------------------------- ### Standard Compilation Settings Function Source: https://github.com/archethic-foundation/archethic-wallet/blob/dev/linux/CMakeLists.txt Defines a function `APPLY_STANDARD_SETTINGS` to apply common compilation features and options, including C++14 standard, warnings, optimization levels, and NDEBUG definition. ```cmake function(APPLY_STANDARD_SETTINGS TARGET) target_compile_features(${TARGET} PUBLIC cxx_std_14) target_compile_options(${TARGET} PRIVATE -Wall -Werror) target_compile_options(${TARGET} PRIVATE "$<$>:-O3>") target_compile_definitions(${TARGET} PRIVATE "$<$>:NDEBUG>") endfunction() ``` -------------------------------- ### Flutter Service Worker Initialization Source: https://github.com/archethic-foundation/archethic-wallet/blob/dev/web_browser/index.html This JavaScript code snippet demonstrates how the Archethic Wallet application, built with Flutter, loads its main entry point ('main.dart.js') and initializes the service worker. It handles the asynchronous loading and initialization process, ensuring the Flutter engine and application are ready to run. ```javascript const serviceWorkerVersion = null; window.addEventListener('load', function (ev) { // Download main.dart.js _flutter.loader.loadEntrypoint({ entrypointUrl: "main.dart.js?v=" + serviceWorkerVersion, serviceWorker: { serviceWorkerVersion: serviceWorkerVersion, } }).then(function (engineInitializer) { return engineInitializer.initializeEngine(); }).then(function (appRunner) { return appRunner.runApp(); }); }); ``` -------------------------------- ### C++ Wrapper for Application Runner Source: https://github.com/archethic-foundation/archethic-wallet/blob/dev/windows/flutter/CMakeLists.txt Builds a static C++ library for the application runner wrapper. It includes core implementation files and application-specific source files, linking against the Flutter library. ```cmake list(APPEND CPP_WRAPPER_SOURCES_CORE "core_implementations.cc" "standard_codec.cc" ) list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/ữa") list(APPEND CPP_WRAPPER_SOURCES_APP "flutter_engine.cc" "flutter_view_controller.cc" ) list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/ữa") # Wrapper sources needed for the runner. add_library(flutter_wrapper_app STATIC ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_APP} ) apply_standard_settings(flutter_wrapper_app) target_link_libraries(flutter_wrapper_app PUBLIC flutter) target_include_directories(flutter_wrapper_app PUBLIC "${WRAPPER_ROOT}/include" ) add_dependencies(flutter_wrapper_app flutter_assemble) ``` -------------------------------- ### Build Archethic Wallet with Flutter Source: https://github.com/archethic-foundation/archethic-wallet/blob/dev/scripts/update_g_cmd.txt This command is used to build the Flutter project for the Archethic Wallet. It leverages the build_runner package to generate necessary code and assets, and the --delete-conflicting-outputs flag ensures that any old generated files are removed before the new ones are created, preventing potential conflicts. ```bash flutter packages pub run build_runner build --delete-conflicting-outputs ``` -------------------------------- ### Flutter Integration Source: https://github.com/archethic-foundation/archethic-wallet/blob/dev/linux/CMakeLists.txt Includes the Flutter managed directory and adds it as a subdirectory for build integration. ```cmake set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") add_subdirectory(${FLUTTER_MANAGED_DIR}) ```