mirror of
https://github.com/status-im/status-app.git
synced 2026-09-02 10:01:13 +00:00
feat(@desktop/wallet): move accounts to cpp
created skeleton for wallet_section added getAccounts api fixes #4750
This commit is contained in:
committed by
Khushboo-dev-cpp
parent
0acfd9b50c
commit
42da8a2408
@@ -1,45 +1,65 @@
|
||||
#include "module.h"
|
||||
#include "controller.h"
|
||||
#include "singleton.h"
|
||||
#include "view.h"
|
||||
#include <QDebug>
|
||||
#include <QObject>
|
||||
#include <QQmlContext>
|
||||
#include <QVariant>
|
||||
|
||||
#include "module.h"
|
||||
#include "singleton.h"
|
||||
#include "modules/main/wallet/module.h"
|
||||
|
||||
namespace Modules
|
||||
{
|
||||
namespace Main
|
||||
{
|
||||
Module::Module(AppControllerDelegate* delegate)
|
||||
: m_delegate(delegate)
|
||||
Module::Module(std::shared_ptr<Wallets::ServiceInterface> walletsService)
|
||||
{
|
||||
m_controller = new Controller(this);
|
||||
m_view = new View(this);
|
||||
m_controllerPtr = std::make_unique<Controller>();
|
||||
m_viewPtr = std::make_unique<View>();
|
||||
|
||||
// Submodules
|
||||
m_walletModulePtr = std::make_unique<Modules::Main::Wallet::Module>(walletsService);
|
||||
|
||||
m_moduleLoaded = false;
|
||||
connect();
|
||||
}
|
||||
|
||||
Module::~Module()
|
||||
void Module::connect()
|
||||
{
|
||||
delete m_controller;
|
||||
delete m_view;
|
||||
QObject::connect(m_viewPtr.get(), &View::viewLoaded, this, &Module::viewDidLoad);
|
||||
QObject::connect(dynamic_cast<QObject*>(m_walletModulePtr.get()), SIGNAL(loaded()), this, SLOT(walletDidLoad()));
|
||||
}
|
||||
|
||||
void Module::load()
|
||||
{
|
||||
Global::Singleton::instance()->engine()->rootContext()->setContextProperty("mainModule", m_view);
|
||||
m_controller->init();
|
||||
m_view->load();
|
||||
Global::Singleton::instance()->engine()->rootContext()->setContextProperty("mainModule", m_viewPtr.get());
|
||||
m_controllerPtr->init();
|
||||
m_viewPtr->load();
|
||||
|
||||
m_walletModulePtr->load();
|
||||
}
|
||||
|
||||
void Module::checkIfModuleDidLoad()
|
||||
{
|
||||
m_delegate->mainDidLoad();
|
||||
if(!m_walletModulePtr->isLoaded())
|
||||
{
|
||||
return;
|
||||
}
|
||||
m_moduleLoaded = true;
|
||||
emit loaded();
|
||||
}
|
||||
|
||||
void Module::viewDidLoad()
|
||||
{
|
||||
Module::checkIfModuleDidLoad();
|
||||
Module::checkIfModuleDidLoad();
|
||||
}
|
||||
|
||||
void Module::walletDidLoad()
|
||||
{
|
||||
Module::checkIfModuleDidLoad();
|
||||
}
|
||||
|
||||
bool Module::isLoaded()
|
||||
{
|
||||
return m_moduleLoaded;
|
||||
}
|
||||
|
||||
} // namespace Main
|
||||
} // namespace Modules
|
||||
} // namespace Modules
|
||||
|
||||
Reference in New Issue
Block a user