7603f24372
This commit brings a separation of concerns for the UI components involved in dApp interactions. Issue: The UI components depend on the WalletConnectService and also on its dependencies like DAppsRequestHAndler. As a result the UI components have a hard dependency on the WalletConnect specifics and are incompatible with BC. This results in duplication of logic. Issue: The UI components operate on WalletConnect specific JSON object. E.g. session objects, session proposal etc. As a result the UI is built around the WalletConnect message format. Issue: The UI components operate on ListModel items received through functions and stored internally. Any change in the model would result in a crash. Solution: Remove the WalletConnectService dependency from DAppsWorkflow. The DAppsWorkflow now operates with models, signals and functions. This is the first step in the broader refactoring. Moving the logic into the service itself will allow us to further refactor the WC and BC. How does it work now: Dependencies - The UI components have a dependency on models. SessionRequestsModel and DAppsModel. Pairing - The pairing is initiated in the UI. On user input a pairingValidationRequested signal is emitted and the result is received as a function pairingValidated. If the url is valid the UI requests a pairingRequested. When the WalletConnectService is refactored we can go further and request only pairingRequested and to receive a pairingResult call as a function with the result. In the current implementation on pairingRequested we'll receive a connectDApp request. Connecting dApps - The flow is initiated with connectDApp function. This call currently contains all the needed info as args. In the next step it could be replaced with a ConnectionRequests model. The connectDApp call triggered a connection popup if we're not currently showing one to the user. If we're currently showing one it will be queued (corner case). The connection can be accepted with connectionAccepted and rejected with connectionDeclined. Once the connection is accepted we're expecting a result connectionSuccessful or connectionFailed. The connectionSuccessful also expects a new id for the established connection. Signing - The signing flow orbits around the SessionRequestsModel. Each item from the model will generate a popup showing the sign details to the user. Sign can be accepted or rejected using signRequestAccepted or signRequestRejected. No response is currently expected. The model is expected to remove the sign request item. |
||
---|---|---|
.. | ||
pages | ||
qmlTests | ||
src | ||
stubs | ||
tests | ||
CMakeLists.txt | ||
README.md | ||
StoryBook.pro | ||
cachecleaner.cpp | ||
cachecleaner.h | ||
directorieswatcher.cpp | ||
directorieswatcher.h | ||
directoryfileswatcher.cpp | ||
directoryfileswatcher.h | ||
figmaio.cpp | ||
figmaio.h | ||
figmalinks.cpp | ||
figmalinks.h | ||
figmalinksmodel.cpp | ||
figmalinksmodel.h | ||
main.cpp | ||
main.qml | ||
modelutils.cpp | ||
modelutils.h | ||
pagesmodel.cpp | ||
pagesmodel.h | ||
sectionsdecoratormodel.cpp | ||
sectionsdecoratormodel.h | ||
storybook-resources.qrc | ||
systemutils.cpp | ||
systemutils.h | ||
testsrunner.cpp | ||
testsrunner.h | ||
validator_main.cpp |
README.md
Building Storybook
For regular usage of Storybook it's enough to open status-desktop/storybook/CMakeLists.txt
in QtCreator. Please do not use StoryBook.pro
which is intended for WebAssembly builds. Please make sure that selected run target is Storybook
.
Building Storybook with Webassembly and Qt 5.14
Configuring the environment
Install Emscripten v1.38.27
# Get the emsdk repo
git clone https://github.com/emscripten-core/emsdk.git
#go to emsdk folder
cd emsdk
#install Emscripten v1.38.27
./emsdk install emscripten-1.38.27
#activate emscripten-1.38.27
./emsdk activate emscripten-1.38.27
#install Fastcomp backend
./emsdk install fastcomp-clang-tag-e1.38.27-64bit
#activate Fastcomp backend
./emsdk activate fastcomp-clang-tag-e1.38.27-64bit
#add emsdk tools to env variables
#this can be done by following instructions received from previous activate command
#there are two options:
#1. Configure the env variables for the current shell only:
source emsdk_env.sh
#2. Configure the env variables using the shell startup script:
echo 'source "[path to emsdk folder]/emsdk_env.sh"' >> $HOME/.zprofile
#WARNING: this will configure the environment to use the emsdk compiler
#Ex:"which clang" command will now point to the emscripten clang instead of the system clang
#to disable the env configuration comment the source command added earlier in ~/.zprofile
#check environment
#python needs to be installed. The emsdk scripts state that it should work with pyton 2 and 3
#make sure python command can be resolved
which python
em++ --version
emcc --version
#clang should point to fastcomp-clang-tag-e1.38.27-64bit
which clang
which clang++
More documentation: https://emscripten.org/docs/getting_started/downloads.html
Configure QtCreator (optional)
Newer versions of QtCreator won't support Qt5.14 with Webassembly. Latest version found to support Qt5.14 with WebAssembly is 4.14.2 Download: https://download.qt.io/archive/qtcreator/4.14/
Adding the Emscripten compilers (emcc and em++) Details here: https://doc.qt.io/qtcreator/creator-tool-chains.html
Adding Qt version 5.14: https://doc.qt.io/qtcreator/creator-project-qmake.html
Adding Qt5.14 for Webassembly kit: https://doc.qt.io/qtcreator/creator-targets.html
Open StoryBook.pro in Qt Creator and configure it using the new kit.
Qt creator might not set the env paths correctly. In this case manually set build environment variables (Projects -> 5.14.2 kit -> Build -> Build Environment -> Batch edit). Ex:
EMSCRIPTEN=~/Repos/emsdk/emscripten/1.38.27
EMSDK=~/Repos/emsdk
EMSDK_NODE=~/Repos/emsdk/node/14.18.2_64bit/bin/node
EMSDK_PYTHON=~/Repos/emsdk/python/3.9.2_64bit/bin/python3
EM_CONFIG=~/Repos/emsdk/.emscripten
LLVM_ROOT=~/Repos/emsdk/fastcomp-clang/tag-e1.38.27/build_tag-e1.38.27_64/bin
PATH=[check echo $PATH]
Running qmake (without qt Creator)
#create build folder
mkdir buildStoryBook
#go to folder
cd buildStoryBook
#run qmake (add CONFIG+=debug CONFIG+=qml_debug to qmake command for debug build)
~/Qt/5.14.2/wasm_32/bin/qmake [path to StoryBook.pro] -spec wasm-emscripten && /usr/bin/make qmake_all
#build (add -j[nb of cores] for parallel execution)
make
#run
emrun StoryBook.html