diff --git a/CMakeLists.txt b/CMakeLists.txt index db484e04..baaaa89a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -141,6 +141,13 @@ set(Views_SRCS Views/STATE_ID_SCR_ADD_TREZOR.cpp Views/STATE_ID_SCR_ADD_TREZOR_ASK.cpp Views/STATE_ID_SCR_SELECT_WALLET_CO_SIGN_POLICE.cpp + Views/STATE_ID_SCR_EDIT_YOUR_INHERITANCE_PLAN.cpp + Views/STATE_ID_SCR_SHARE_YOUR_SECRETS.cpp + Views/STATE_ID_SCR_ADD_COLDCARD.cpp + Views/STATE_ID_SCR_ADD_COLDCARD_ASK.cpp + Views/STATE_ID_SCR_ADD_COLDCARD_EXIST.cpp + Views/STATE_ID_SCR_ADD_LEDGER_EXIST.cpp + Views/STATE_ID_SCR_ADD_TREZOR_EXIST.cpp ) set(Views_MOCS diff --git a/Images/Device_Icons/Ledger.svg b/Images/Device_Icons/Ledger.svg new file mode 100644 index 00000000..b76d6b15 --- /dev/null +++ b/Images/Device_Icons/Ledger.svg @@ -0,0 +1,4 @@ + + + + diff --git a/Images/calendar-dark.png b/Images/calendar-dark.png new file mode 100644 index 00000000..cf33bbf3 Binary files /dev/null and b/Images/calendar-dark.png differ diff --git a/Images/calendar-dark.svg b/Images/calendar-dark.svg new file mode 100644 index 00000000..841681d6 --- /dev/null +++ b/Images/calendar-dark.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/Images/change-password-dark.svg b/Images/change-password-dark.svg new file mode 100644 index 00000000..ea139659 --- /dev/null +++ b/Images/change-password-dark.svg @@ -0,0 +1,3 @@ + + + diff --git a/Images/close-24px.svg b/Images/close-24px.svg new file mode 100644 index 00000000..24d8c035 --- /dev/null +++ b/Images/close-24px.svg @@ -0,0 +1,3 @@ + + + diff --git a/Images/coldcard-illustration.svg b/Images/coldcard-illustration.svg new file mode 100644 index 00000000..d943a3b7 --- /dev/null +++ b/Images/coldcard-illustration.svg @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Images/inheritance_backup_password.svg b/Images/inheritance_backup_password.svg new file mode 100644 index 00000000..b9e349c6 --- /dev/null +++ b/Images/inheritance_backup_password.svg @@ -0,0 +1,254 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Images/more-horizontal-dark.svg b/Images/more-horizontal-dark.svg new file mode 100644 index 00000000..1718d712 --- /dev/null +++ b/Images/more-horizontal-dark.svg @@ -0,0 +1,3 @@ + + + diff --git a/Images/star-dark.png b/Images/star-dark.png new file mode 100644 index 00000000..489ac5ac Binary files /dev/null and b/Images/star-dark.png differ diff --git a/Images/star-dark.svg b/Images/star-dark.svg new file mode 100644 index 00000000..7c7ac6d4 --- /dev/null +++ b/Images/star-dark.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/Images/trezor-illustration.svg b/Images/trezor-illustration.svg new file mode 100644 index 00000000..55022697 --- /dev/null +++ b/Images/trezor-illustration.svg @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Images/wallet-brand-icon.svg b/Images/wallet-brand-icon.svg new file mode 100644 index 00000000..25bcad63 --- /dev/null +++ b/Images/wallet-brand-icon.svg @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Models/AppModel.cpp b/Models/AppModel.cpp index 3b67ecf7..9d602b75 100644 --- a/Models/AppModel.cpp +++ b/Models/AppModel.cpp @@ -27,6 +27,8 @@ #include #include "Chats/matrixbrigde.h" #include "utils/enumconverter.hpp" +#include "Chats/QUserWallets.h" +#include "ServiceSetting.h" AppModel::AppModel(): inititalized_{false}, walletList_(QWalletListModelPtr(new WalletListModel())), @@ -54,16 +56,21 @@ AppModel::AppModel(): inititalized_{false}, newKeySignMessage_("") { QQmlEngine::setObjectOwnership(this, QQmlEngine::CppOwnership); - connect(&timerRefreshHealthCheck_, SIGNAL(timeout()), this, SLOT(timerHealthCheckTimeHandle())); - timerRefreshHealthCheck_.start(60000); // Every 1' - connect(&timerFeeRates_, SIGNAL(timeout()), this, SLOT(timerFeeRatesHandle())); - timerFeeRates_.start(300000); // Every 5' - connect(&timerCheckAuthorized_, SIGNAL(timeout()), this, SLOT(timerCheckAuthorizedHandle())); + connect(&timerRefreshHealthCheck_, &QTimer::timeout, this, &AppModel::timerHealthCheckTimeHandle, Qt::QueuedConnection); + connect(&timerFeeRates_, &QTimer::timeout, this, &AppModel::timerFeeRatesHandle, Qt::QueuedConnection); + connect(&timerCheckAuthorized_, &QTimer::timeout, this, &AppModel::timerCheckAuthorizedHandle, Qt::QueuedConnection); + connect(this, &AppModel::forwardToast, this, &AppModel::recieveToast, Qt::QueuedConnection); + + timerRefreshHealthCheck_.start(60000); // Every 1' + timerFeeRates_.start(300000); // Every 5' qrExported_.clear(); suggestMnemonics_.clear(); - connect(qApp, &QCoreApplication::aboutToQuit, this, [] { - DBG_INFO << "APPLICATION ABOUT TO QUIT"; + connect(qApp, &QCoreApplication::aboutToQuit, this, [this] { + DBG_INFO << "APPLICATION ABOUT TO QUIT" << QThreadPool::globalInstance()->activeThreadCount(); + QThreadPool::globalInstance()->clear(); + QThreadPool::globalInstance()->waitForDone(); + this->disconnect(); bridge::stopNunchuk(); }); } @@ -212,9 +219,11 @@ bool AppModel::makeInstanceForAccount(const QVariant msg, const QString &dbPassp if((int)EWARNING::WarningType::NONE_MSG == nunchukMsg.type()){ ret = true; QString device_id = QString("%1%2").arg(Draco::instance()->deviceId()).arg(Draco::instance()->chatId()); +#if 0 //FIXME Performance Draco::instance()->getMe(); - Draco::instance()->getCurrentUserSubscription(); +#endif AppModel::instance()->timerFeeRatesHandle(); + QUserWallets::instance()->newRequestToAddKey(); timeoutHandler(1000,[account, device_id](){ CLIENT_INSTANCE->requestLogin(); CLIENT_INSTANCE->saveStayLoggedInData(); @@ -462,9 +471,9 @@ void AppModel::setSoftwareSignerDeviceList(const QDeviceListModelPtr &value) QString AppModel::hourFeeCurrency() const { - double exRates = exchangeRates()/100000000; double fee = (double)hourFee_/1000; - double feeCurrency = exRates*fee*140; + double btcRate = btcRates()/100000000; + double feeCurrency = btcRate*fee*140; QLocale locale(QLocale::English); return locale.toString(feeCurrency, 'f', 2); } @@ -486,9 +495,9 @@ void AppModel::setHourFee(qint64 fee) QString AppModel::minFeeCurrency() const { - double exRates = exchangeRates()/100000000; + double btcRate = btcRates()/100000000; double fee = (double)minFee_/1000; - double feeCurrency = exRates*fee*140; + double feeCurrency = btcRate*fee*140; QLocale locale(QLocale::English); return locale.toString(feeCurrency, 'f', 2); } @@ -520,9 +529,9 @@ void AppModel::resetSignersChecked() QString AppModel::halfHourFeeCurrency() const { - double exRates = exchangeRates()/100000000; + double btcRate = btcRates()/100000000; double fee = (double)halfHourFee_/1000; - double feeCurrency = exRates*fee*140; + double feeCurrency = btcRate*fee*140; QLocale locale(QLocale::English); return locale.toString(feeCurrency, 'f', 2); } @@ -544,9 +553,9 @@ void AppModel::setHalfHourFee(qint64 fee) QString AppModel::fastestFeeCurrency() const { - double exRates = exchangeRates()/100000000; + double btcRate = btcRates()/100000000; double fee = (double)fastestFee_/1000; - double feeCurrency = exRates*fee*140; + double feeCurrency = btcRate*fee*140; QLocale locale(QLocale::English); return locale.toString(feeCurrency, 'f', 2); } @@ -646,23 +655,14 @@ int AppModel::walletListCurrentIndex() const return walletListCurrentIndex_; } -void AppModel::setWalletListCurrentIndex(int walletListCurrentIndex) +void AppModel::setWalletListCurrentIndex(int index) { - DBG_INFO << walletListCurrentIndex; - if(walletListCurrentIndex == -1){ - walletListCurrentIndex_ = 0; - } - else{ - walletListCurrentIndex_ = walletListCurrentIndex; - } - setWalletInfoByIndex(walletListCurrentIndex_); - if(walletInfo()){ - QString wallet_id = walletInfo()->id(); - QtConcurrent::run([wallet_id]() { - bridge::nunchukSetSelectedWallet(wallet_id); - }); + if(walletListCurrentIndex_ != index){ + walletListCurrentIndex_ = index; } + DBG_INFO << "FIXME" << index; emit walletListCurrentIndexChanged(); + setWalletInfoByIndex(walletListCurrentIndex_); } AppModel *AppModel::instance() { @@ -674,12 +674,9 @@ void AppModel::requestInitialData() { if(ONLINE_MODE == bridge::nunchukCurrentMode()){ requestCreateUserWallets(); + } else { + startReloadUserDb(); } - QtConcurrent::run([this]() { - startReloadWallets(); - startReloadMasterSigners(); - startReloadRemoteSigners(); - }); } void AppModel::requestSyncWalletDb(const QString &wallet_id) @@ -691,141 +688,98 @@ void AppModel::requestSyncWalletDb(const QString &wallet_id) void AppModel::requestCreateUserWallets() { - if(CLIENT_INSTANCE->getSubCur().isEmpty()) return; - QJsonObject data = Draco::instance()->getAssistedWallets(); - if(!data.isEmpty()){ - QJsonArray wallets = data["wallets"].toArray(); - mUserWallets.clear(); - for(QJsonValue jv_wallet : wallets){ - QJsonObject js_wallet = jv_wallet.toObject(); - QString wallet_id = js_wallet["local_id"].toString(); - QString status = js_wallet["status"].toString(); - if (status == "ACTIVE") { - mUserWallets.append(wallet_id); - } - if(status == "ACTIVE" && !bridge::nunchukHasWallet(wallet_id)){ - QJsonArray signers = js_wallet["signers"].toArray(); - for(QJsonValue jv_signer : signers){ - QJsonObject js_signer = jv_signer.toObject(); - QJsonObject tapsigner = js_signer["tapsigner"].toObject(); - QString name = js_signer["name"].toString(); - QString xfp = js_signer["xfp"].toString(); - if(!tapsigner.isEmpty()){ - QString card_id = tapsigner["card_id"].toString(); - QString version = tapsigner["version"].toString(); - int birth_height = tapsigner["birth_height"].toInt(); - bool is_testnet = tapsigner["is_testnet"].toBool(); - bridge::AddTapsigner(card_id,xfp,name,version,birth_height,is_testnet); - } - else { - QString xpub = js_signer["xpub"].toString(); - QString pubkey = js_signer["pubkey"].toString(); - QString derivation_path = js_signer["derivation_path"].toString(); - QString type = js_signer["type"].toString(); - nunchuk::SingleSigner signer(name.toStdString(), xpub.toStdString(), pubkey.toStdString(), derivation_path.toStdString(), xfp.toStdString(), std::time(0)); - if(!bridge::nunchukHasSinger(signer)){ - bridge::nunchukCreateSigner(name, xpub, pubkey, derivation_path, xfp, type); - } - } - } - QWarningMessage msg; - QString bsms = js_wallet["bsms"].toString(); - nunchuk::Wallet w = qUtils::ParseWalletDescriptor(bsms,msg); - QString name = js_wallet["name"].toString(); - QString description = js_wallet["description"].toString(); - w.set_name(name.toStdString()); - w.set_description(description.toStdString()); - bridge::nunchukCreateWallet(w, true,msg); - } else if (status == "DELETED" && bridge::nunchukHasWallet(wallet_id)){ - QWarningMessage msgwarning; - /*bool ret = */bridge::nunchukDeleteWallet(wallet_id, msgwarning); - } - QWarningMessage msg; - nunchuk::Wallet w = nunchukiface::instance()->GetWallet(wallet_id.toStdString(), msg); - std::vector local_signers = w.get_signers(); - QJsonArray signers = js_wallet["signers"].toArray(); - for(QJsonValue jv_signer : signers){ - QJsonObject js_signer = jv_signer.toObject(); - QString xfp = js_signer["xfp"].toString(); - QJsonArray wtags = js_signer["tags"].toArray(); - std::vector::iterator local_signer = std::find_if(local_signers.begin(), local_signers.end(), [&](const nunchuk::SingleSigner &local){ - return local.get_master_fingerprint() == xfp.toStdString(); - }); - if(wtags.size() != 0){ - QWarningMessage msgIn; - if (local_signer != local_signers.end() && local_signer->has_master_signer()) { - nunchuk::MasterSigner m = nunchukiface::instance()->GetMasterSigner(local_signer->get_master_signer_id(),msgIn); - std::vector tags; // get tags from api signer.tags - for (QJsonValue tag : wtags) { - QString js_tag = tag.toString(); - tags.push_back(SignerTagFromStr(js_tag.toStdString())); - } - // Do update - m.set_tags(tags); - nunchukiface::instance()->UpdateMasterSigner(m,msgIn); - } else { - // update for single signer - // skip for now - } - } - } - - if (!wallet_id.isEmpty()) { - auto syncTransaction = [&]() { - QJsonObject data = Draco::instance()->assistedWalletGetListTx(wallet_id); - QJsonArray transactions = data.value("transactions").toArray(); - for(QJsonValue js_value : transactions){ - QJsonObject transaction = js_value.toObject(); - QString status_ = transaction.value("status").toString(); - QString psbt = transaction.value("psbt").toString(); - QString note = transaction.value("note").toString(); - QString type = transaction.value("type").toString(); - if (status_ == "READY_TO_BROADCAST" || status_ == "PENDING_SIGNATURES" ) { - QWarningMessage _msg; - QTransactionPtr tran = bridge::nunchukImportPsbt(wallet_id, psbt, _msg); - if(tran && (int)EWARNING::WarningType::NONE_MSG == _msg.type()){ - bridge::nunchukUpdateTransactionMemo(wallet_id, - tran->txid(), - note); - long int broadcast_time_milis = static_cast(transaction.value("broadcast_time_milis").toInt()); - // honey badger feature: schedule broadcast - long int current_time_stamp_milis = static_cast(std::time(nullptr)) * 1000; - - if(type == "SCHEDULED" && broadcast_time_milis > current_time_stamp_milis) { - bridge::nunchukUpdateTransactionSchedule(wallet_id, tran->txid(), broadcast_time_milis/1000,msg); + if(CLIENT_INSTANCE->getSubCur().isEmpty()) { + startReloadUserDb(); + return; + } + QtConcurrent::run([this]() { + QJsonObject data = Draco::instance()->getAssistedWallets(); + if(!data.isEmpty()){ + QJsonArray wallets = data["wallets"].toArray(); + mUserWallets.clear(); + for(QJsonValue jv_wallet : wallets){ + QJsonObject js_wallet = jv_wallet.toObject(); + QString wallet_id = js_wallet["local_id"].toString(); + QString status = js_wallet["status"].toString(); + if (status == "ACTIVE") { + mUserWallets.append(wallet_id); + if(!bridge::nunchukHasWallet(wallet_id)){ + QJsonArray signers = js_wallet["signers"].toArray(); + for(QJsonValue jv_signer : signers){ + QJsonObject js_signer = jv_signer.toObject(); + QJsonObject tapsigner = js_signer["tapsigner"].toObject(); + QString name = js_signer["name"].toString(); + QString xfp = js_signer["xfp"].toString(); + if(!tapsigner.isEmpty()){ + QString card_id = tapsigner["card_id"].toString(); + QString version = tapsigner["version"].toString(); + int birth_height = tapsigner["birth_height"].toInt(); + bool is_testnet = tapsigner["is_testnet"].toBool(); + bridge::AddTapsigner(card_id,xfp,name,version,birth_height,is_testnet); + } + else { + QString xpub = js_signer["xpub"].toString(); + QString pubkey = js_signer["pubkey"].toString(); + QString derivation_path = js_signer["derivation_path"].toString(); + QString type = js_signer["type"].toString(); + nunchuk::SingleSigner signer(name.toStdString(), xpub.toStdString(), pubkey.toStdString(), derivation_path.toStdString(), xfp.toStdString(), std::time(0)); + if(!bridge::nunchukHasSinger(signer)){ + bridge::nunchukCreateSigner(name, xpub, pubkey, derivation_path, xfp, type); } } } + QWarningMessage msg; + QString bsms = js_wallet["bsms"].toString(); + nunchuk::Wallet w = qUtils::ParseWalletDescriptor(bsms,msg); + QString name = js_wallet["name"].toString(); + QString description = js_wallet["description"].toString(); + w.set_name(name.toStdString()); + w.set_description(description.toStdString()); + bridge::nunchukCreateWallet(w, true,msg); + } + QWarningMessage msg; + nunchuk::Wallet w = nunchukiface::instance()->GetWallet(wallet_id.toStdString(), msg); + std::vector local_signers = w.get_signers(); + nunchukiface::instance()->UpdateWallet(w, msg); + for (nunchuk::SingleSigner s : local_signers) + { + nunchukiface::instance()->UpdateRemoteSigner(s, msg); } - }; - auto lockDown = [&]() { - int offset = 0; - const int limit = 10; - while (true) { - QJsonObject data = Draco::instance()->assistedWalletDeleteListTx(wallet_id, offset, limit); - QJsonArray transactions = data.value("transactions").toArray(); - for (QJsonValue js_value : transactions) { - QJsonObject transaction = js_value.toObject(); - QString wallet_local_id = transaction.value("wallet_local_id").toString(); - QString transaction_id = transaction.value("transaction_id").toString(); - if (!bridge::nunchukDeleteTransaction(wallet_local_id, transaction_id)) { - DBG_INFO << "not remove "; - return; // exit while loop + QJsonArray signers = js_wallet["signers"].toArray(); + for(QJsonValue jv_signer : signers){ + QJsonObject js_signer = jv_signer.toObject(); + QString xfp = js_signer["xfp"].toString(); + QJsonArray wtags = js_signer["tags"].toArray(); + std::vector::iterator local_signer = std::find_if(local_signers.begin(), local_signers.end(), [&](const nunchuk::SingleSigner &local){ + return local.get_master_fingerprint() == xfp.toStdString(); + }); + if(wtags.size() != 0){ + QWarningMessage msgIn; + if (local_signer != local_signers.end() && local_signer->has_master_signer()) { + nunchuk::MasterSigner m = nunchukiface::instance()->GetMasterSigner(local_signer->get_master_signer_id(),msgIn); + std::vector tags; // get tags from api signer.tags + for (QJsonValue tag : wtags) { + QString js_tag = tag.toString(); + tags.push_back(SignerTagFromStr(js_tag.toStdString())); + } + // Do update + m.set_tags(tags); + nunchukiface::instance()->UpdateMasterSigner(m,msgIn); } } - if (transactions.size() == 0 || transactions.size() < limit) { - return; // exit while loop - } - offset += transactions.size(); } - }; - //===================== - syncTransaction(); - lockDown(); + } + else if (status == "DELETED" && bridge::nunchukHasWallet(wallet_id)){ + QWarningMessage msgwarning; + bridge::nunchukDeleteWallet(wallet_id, msgwarning); + } + else{} } + requestAssistedWalletsSetuped(); + emit walletListChanged(); } - } - DBG_INFO << mUserWallets; + startReloadUserDb(); + }); } void AppModel::requestSyncSharedWallets() @@ -865,6 +819,25 @@ void AppModel::requestSyncSharedWallets() } } +void AppModel::requestAssistedWalletsSetuped() +{ + QStringList setuped {}; + for (QString id : mUserWallets) { + QJsonObject response; + QString errormsg; + bool ret = Draco::instance()->inheritanceGetPlan(id, response, errormsg); + if (ret) { + QJsonObject inheritance = response.value("inheritance").toObject(); + QString status = inheritance.value("status").toString(); + if (status == "ACTIVE") { + setuped.append(id); + } + } + } + ServiceSetting::instance()->setAssistedSetuped(setuped); + DBG_INFO << mUserWallets << setuped; +} + void AppModel::requestClearData() { if(walletList()){ @@ -876,6 +849,7 @@ void AppModel::requestClearData() if(remoteSignerList()){ remoteSignerList()->cleardata(); } + setWalletListCurrentIndex(-1); AppSetting::instance()->setSyncPercent(0); } @@ -900,7 +874,7 @@ QDeviceListModelPtr AppModel::deviceListPtr() const void AppModel::setWalletList(const QWalletListModelPtr &d){ walletList_ = d; if(walletList_){ - walletList_.data()->requestSort(WalletListModel::WalletRoles::wallet_Name_Role, Qt::AscendingOrder); + walletList_.data()->requestSort(WalletListModel::WalletRoles::wallet_createDate_Role, Qt::AscendingOrder); } emit walletListChanged(); } @@ -1073,9 +1047,14 @@ void AppModel::setWalletInfo(const QWalletPtr &d) if(d && 0 != QString::compare(d.data()->id(), walletInfo_->id(), Qt::CaseInsensitive)){ walletInfo_ = d; if(walletInfo_){ - timeoutHandler(2000, [this]() { - requestSyncWalletDb(walletInfo_->id()); - }); + DBG_INFO << "FIXME" << walletInfo_.data()->name(); + QString wallet_id = walletInfo_.data()->id(); + if(wallet_id != ""){ + requestSyncWalletDb(wallet_id); + QtConcurrent::run([wallet_id]() { + bridge::nunchukSetSelectedWallet(wallet_id); + }); + } } emit walletInfoChanged(); } @@ -1083,12 +1062,17 @@ void AppModel::setWalletInfo(const QWalletPtr &d) void AppModel::setWalletInfoByIndex(const int index) { - if(walletList_){ - QWalletPtr newWallet = walletList_.data()->getWalletByIndex(index); - if(!newWallet){ - newWallet = QWalletPtr(new Wallet()); + if(index == -1){ + setWalletInfo(QWalletPtr(new Wallet())); + } + else{ + if(walletList_){ + QWalletPtr newWallet = walletList_.data()->getWalletByIndex(index); + if(!newWallet){ + newWallet = QWalletPtr(new Wallet()); + } + setWalletInfo(newWallet); } - setWalletInfo(newWallet); } } @@ -1189,7 +1173,7 @@ void AppModel::timerFeeRatesHandle() void AppModel::timerCheckAuthorizedHandle() { Draco::instance()->getMe(); - Draco::instance()->getCurrentUserSubscription(); + QUserWallets::instance()->newRequestToAddKey(); } QString AppModel::parseKeystoneSigner(QString qr) @@ -1210,7 +1194,7 @@ bool AppModel::parseKeystoneWallet(const QString name, const QString desc, const walletImported.data()->setCreationMode((int)Wallet::CreationMode::CREATE_BY_IMPORT_QRCODE); walletList()->addWallet(walletImported); resetSignersChecked(); - walletList()->requestSort(WalletListModel::WalletRoles::wallet_Name_Role, Qt::AscendingOrder); + walletList()->requestSort(WalletListModel::WalletRoles::wallet_createDate_Role, Qt::AscendingOrder); int index = walletList()->getWalletIndexById(walletImported.data()->id()); if(-1 != index){ setWalletListCurrentIndex(index); @@ -1410,14 +1394,7 @@ void AppModel::setBtcRates(double btcRates) } void AppModel::showToast(int code, const QString &what, EWARNING::WarningType type, const QString& explain, POPUP::PopupType popup){ - timeoutHandler(500, [this, code, what, type, explain, popup]() { - if(!warningMessage()){ - setWarningMessage(QWarningMessagePtr(new QWarningMessage())); - } - warningMessage()->setWarningMessage(code, what, type, explain); - warningMessage()->setPopupType((int)popup); - QQuickViewer::instance()->sendEvent(E::EVT_SHOW_TOAST_MESSAGE); - }); + emit forwardToast(code, what, type, explain, popup); } void AppModel::setToast(int code, const QString &what, EWARNING::WarningType type, const QString &explain, POPUP::PopupType popup) @@ -1429,3 +1406,15 @@ void AppModel::setToast(int code, const QString &what, EWARNING::WarningType typ warningMessage()->setPopupType((int)popup); emit signalShowToast(); } + +void AppModel::recieveToast(int code, const QString &what, EWARNING::WarningType type, const QString &explain, POPUP::PopupType popup) +{ + timeoutHandler(500, [this, code, what, type, explain, popup]() { + if(!warningMessage()){ + setWarningMessage(QWarningMessagePtr(new QWarningMessage())); + } + warningMessage()->setWarningMessage(code, what, type, explain); + warningMessage()->setPopupType((int)popup); + QQuickViewer::instance()->sendEvent(E::EVT_SHOW_TOAST_MESSAGE); + }); +} diff --git a/Models/AppModel.h b/Models/AppModel.h index 5bcd10a2..567aa1a1 100644 --- a/Models/AppModel.h +++ b/Models/AppModel.h @@ -75,7 +75,7 @@ class AppModel final : public Controller Q_PROPERTY(QString newKeySignMessage READ newKeySignMessage NOTIFY newKeySignMessageChanged) Q_PROPERTY(QString newKeySignMessageSHA256 READ newKeySignMessageSHA256 NOTIFY newKeySignMessageChanged) Q_PROPERTY(int addSignerWizard READ addSignerWizard WRITE setAddSignerWizard NOTIFY addSignerWizardChanged) - + DECLARE_PROPERTY(bool, IsPremiumUser, {}, {}) public: static AppModel *instance(); AppModel(AppModel &other) = delete; @@ -85,6 +85,7 @@ class AppModel final : public Controller void requestSyncWalletDb(const QString& wallet_id); void requestCreateUserWallets(); void requestSyncSharedWallets(); + void requestAssistedWalletsSetuped(); void requestClearData(); WalletListModel *walletList() const; @@ -147,7 +148,7 @@ class AppModel final : public Controller void setDestinationList(const QDestinationListModelPtr &destinationList); int walletListCurrentIndex() const; - void setWalletListCurrentIndex(int walletListCurrentIndex); + void setWalletListCurrentIndex(int index); int chainTip() const; void setChainTip(int chainTip); @@ -342,6 +343,7 @@ class AppModel final : public Controller void newKeySignMessageChanged(); void btcRatesChanged(); void addSignerWizardChanged(); + void forwardToast(int code, const QString &what, EWARNING::WarningType type, const QString &explain, POPUP::PopupType popup); public slots: void timerHealthCheckTimeHandle(); @@ -360,6 +362,7 @@ public slots: bool updateSettingRestartRequired(); QString getFilePath(const QString in); bool enableDatabaseEncryption(const QString in); + void recieveToast(int code, const QString &what, EWARNING::WarningType type, const QString &explain, POPUP::PopupType popup); }; #endif // APPMODEL_H diff --git a/Models/AppSetting.h b/Models/AppSetting.h index 370a5979..ab0f289c 100644 --- a/Models/AppSetting.h +++ b/Models/AppSetting.h @@ -32,8 +32,9 @@ #define TOR_PORT 9050 #define CORERPC_MAINNET_PORT 8332 #define CORERPC_TESTNET_PORT 18332 -#define BLOCKSTREAM_TESTNET "https://blockstream.info/testnet/tx/" -#define BLOCKSTREAM_MAINNET "https://blockstream.info/tx/" +#define EXPLORER_MAINNET "https://mempool.space/tx/" +#define EXPLORER_TESTNET "https://mempool.space/testnet/tx/" +#define EXPLORER_SIGNNET "https://mempool.space/signet/tx/" #define GLOBAL_SIGNET_EXPLORER "https://explorer.bc-2.jp/" diff --git a/Models/Chats/ClientController.cpp b/Models/Chats/ClientController.cpp index e2b93168..c43c3058 100755 --- a/Models/Chats/ClientController.cpp +++ b/Models/Chats/ClientController.cpp @@ -38,6 +38,7 @@ #include #include #include +#include "Chats/QUserWallets.h" using Quotient::NetworkAccessManager; using Quotient::Settings; @@ -359,6 +360,7 @@ void ClientController::requestSignout() if(contacts()){ contacts()->removeAll(); } + QUserWallets::instance()->newRequestToAddKey(); qApp->restoreOverrideCursor(); } @@ -487,7 +489,7 @@ QVariant ClientController::user() const if(plan.isEmpty() == false){ QString slug = plan["slug"].toString(); maps["plan_slug"] = slug; - maps["isPremiumUser"] = slug == "iron_hand" || slug == "honey_badger" ; + maps["isPremiumUser"] = slug == "iron_hand" || slug == "honey_badger" || slug == "honey_badger_testnet"; }else{ maps["plan_slug"] = ""; maps["isPremiumUser"] = false; @@ -590,10 +592,12 @@ void ClientController::setSubCur(const QJsonObject &sub) QJsonObject plan = m_subCur["plan"].toObject(); if (plan.isEmpty() == false) { QString slug = plan["slug"].toString(); - bool isPremiumUser = slug == "iron_hand" || slug == "honey_badger" ; + bool isPremiumUser = slug == "iron_hand" || slug == "honey_badger" || slug == "honey_badger_testnet"; setAttachmentEnable(isPremiumUser); + AppModel::instance()->setIsPremiumUser(isPremiumUser); } else { setAttachmentEnable(false); + AppModel::instance()->setIsPremiumUser(false); } } diff --git a/Models/Chats/ClientController.h b/Models/Chats/ClientController.h index 79158373..6fdd5384 100755 --- a/Models/Chats/ClientController.h +++ b/Models/Chats/ClientController.h @@ -57,6 +57,7 @@ class ClientController final : public QObject Q_PROPERTY(QVariant user READ user NOTIFY userChanged) Q_PROPERTY(bool attachmentEnable READ attachmentEnable NOTIFY attachmentEnableChanged) Q_PROPERTY(bool readySupport READ readySupport NOTIFY readySupportChanged) + private: ClientController(); ~ClientController(); diff --git a/Models/Chats/QNunchukRoomModel.cpp b/Models/Chats/QNunchukRoomModel.cpp index 02a0ddf7..00749b19 100755 --- a/Models/Chats/QNunchukRoomModel.cpp +++ b/Models/Chats/QNunchukRoomModel.cpp @@ -38,6 +38,7 @@ #include "Draco.h" #include "localization/STR_CPP.h" #include +#include "QUserWallets.h" QNunchukRoom::QNunchukRoom(Room *r): m_room(r), @@ -59,6 +60,13 @@ QNunchukRoom::QNunchukRoom(Room *r): if(m_room){ QQmlEngine::setObjectOwnership(m_room, QQmlEngine::CppOwnership); } + + connect(this, SIGNAL(finishConsumeEvent()), this, SLOT(slotFinishConsumeEvent())); +#if 0 //FIXME performance + connect(&m_timeSyncDb, SIGNAL(timeout()), this, SLOT(slotSyncWalletDb())); + m_timeSyncDb.setSingleShot(true); + m_timeSyncDb.start(2000); +#endif qmlRegisterType(); qRegisterMetaType(); } @@ -263,7 +271,7 @@ QString QNunchukRoom::postEvent(const QString& eventType, const QJsonObject& con } else {} if(m_room && evt){ - if(this->isNunchukSyncRoom() && !AppSetting::instance()->enableMultiDeviceSync()){ + if(isNunchukSyncRoom() && !AppSetting::instance()->enableMultiDeviceSync()){ return ""; } txnId = m_room->postEvent(evt); @@ -293,13 +301,13 @@ void QNunchukRoom::slotFinishedDownloadTransaction(nunchuk::RoomTransaction room if(tx.get_txid() != ""){ QTransactionPtr rawtx = bridge::convertTransaction(tx, wallet_id); if(rawtx){ - rawtx.data()->setRoomId(this->id()); + rawtx.data()->setRoomId(id()); rawtx.data()->setInitEventId(QString::fromStdString(room_tx.get_init_event_id())); target.data()->setTransaction(rawtx); } } - if(!this->isDownloaded()){ - this->startGetPendingTxs(); + if(!isDownloaded()){ + startGetPendingTxs(); } if(conversation()){ conversation()->updateTransaction(cons, target); @@ -338,6 +346,17 @@ void QNunchukRoom::slotUpdateInitEventId(const Conversation cons) } } +void QNunchukRoom::slotFinishConsumeEvent() +{ + m_timeSyncDb.stop(); + m_timeSyncDb.start(2000); +} + +void QNunchukRoom::slotSyncWalletDb() +{ + AppModel::instance()->startReloadUserDb(); +} + void QNunchukRoom::sendMessage(const QString &message) { if(m_room && conversation() && message != ""){ @@ -353,8 +372,8 @@ void QNunchukRoom::sendMessage(const QString &message) cons.txnId = txnId; conversation()->addMessage(cons); conversation()->requestSortByTimeAscending(); - this->setLastMessage(cons); - this->setLasttimestamp(cons); + setLastMessage(cons); + setLasttimestamp(cons); } else{ DBG_INFO << "SEND FALSE"; @@ -410,7 +429,7 @@ void QNunchukRoom::sendFile(const QString& description, const QString localFile) }); QObject::connect( m_room, &Room::fileTransferProgress, [=](QString id, qint64 progress, qint64 total) { if (id == txnId) { - qDebug() << "fileTransferProgress:" << progress << total; + DBG_INFO << "fileTransferProgress:" << progress << total; } }); @@ -438,8 +457,8 @@ void QNunchukRoom::sendFile(const QString& description, const QString localFile) } conversation()->addMessage(cons); conversation()->requestSortByTimeAscending(); - this->setLastMessage(cons); - this->setLasttimestamp(cons); + setLastMessage(cons); + setLasttimestamp(cons); } } } @@ -481,11 +500,15 @@ bool QNunchukRoom::joinWalletWithMasterSigner(const QString &id, bool &needXpub) ENUNCHUCK::WalletType walletType = roomWallet()->walletEscrow() ? ENUNCHUCK::WalletType::ESCROW : roomWallet()->walletN() > 1 ? ENUNCHUCK::WalletType::MULTI_SIG : ENUNCHUCK::WalletType::SINGLE_SIG; + ENUNCHUCK::AddressType addressType = (ENUNCHUCK::AddressType)roomWallet()->walletAddressType().toInt(); + QMasterSignerPtr it = AppModel::instance()->masterSignerList()->getMasterSignerById(id); QWarningMessage msgWarning; - QSingleSignerPtr signer = bridge::nunchukGetUnusedSignerFromMasterSigner(id, - walletType, - (ENUNCHUCK::AddressType)roomWallet()->walletAddressType().toInt(), - msgWarning); + QSingleSignerPtr signer {nullptr}; + if (AppModel::instance()->getIsPremiumUser() && (int)ENUNCHUCK::SignerType::NFC == it.data()->signerType()) { + signer = bridge::nunchukGetDefaultSignerFromMasterSigner(id, walletType, addressType, msgWarning); + } else { + signer = bridge::nunchukGetUnusedSignerFromMasterSigner(id, walletType, addressType, msgWarning); + } if(signer && msgWarning.type() == (int)EWARNING::WarningType::NONE_MSG){ msgWarning.resetWarningMessage(); matrixbrigde::JoinWallet(this->id(), signer, msgWarning); @@ -516,7 +539,7 @@ bool QNunchukRoom::joinWalletWithSingleSigner(const QString &xfp) QSingleSignerPtr signer = AppModel::instance()->remoteSignerList()->getSingleSignerByFingerPrint(xfp); if(signer){ QWarningMessage msgWarning; - matrixbrigde::JoinWallet(this->id(), signer, msgWarning); + matrixbrigde::JoinWallet(id(), signer, msgWarning); if((int)EWARNING::WarningType::NONE_MSG == msgWarning.type()){ ret = true; } @@ -530,13 +553,13 @@ bool QNunchukRoom::joinWalletWithSingleSigner(const QString &xfp) return ret; } -bool QNunchukRoom::joinWalletUseSignerFromWalletImport(const QString &id, const QString &xfp) +bool QNunchukRoom::joinWalletUseSignerFromWalletImport(const QString &signer_id, const QString &xfp) { bool ret = false; nunchuk::SingleSigner signer; for(nunchuk::SingleSigner s : m_walletImport.get_signers()){ - if((s.get_master_signer_id() != "" && (s.get_master_signer_id() == id.toStdString() || s.get_master_signer_id() == xfp.toStdString())) - || (s.get_master_fingerprint() != "" && (s.get_master_fingerprint() == id.toStdString() || s.get_master_fingerprint() == xfp.toStdString()))){ + if((s.get_master_signer_id() != "" && (s.get_master_signer_id() == signer_id.toStdString() || s.get_master_signer_id() == xfp.toStdString())) + || (s.get_master_fingerprint() != "" && (s.get_master_fingerprint() == signer_id.toStdString() || s.get_master_fingerprint() == xfp.toStdString()))){ signer = s; break; } @@ -544,7 +567,7 @@ bool QNunchukRoom::joinWalletUseSignerFromWalletImport(const QString &id, const QSingleSignerPtr signerPtr = QSingleSignerPtr(new QSingleSigner(signer)); if(signerPtr && bridge::nunchukHasSinger(signer)){ QWarningMessage msgWarning; - matrixbrigde::JoinWallet(this->id(), signerPtr, msgWarning); + matrixbrigde::JoinWallet(id(), signerPtr, msgWarning); if((int)EWARNING::WarningType::NONE_MSG == msgWarning.type()){ ret = true; } @@ -607,7 +630,7 @@ bool QNunchukRoom::extractNunchukEvent(const QString &matrixType, const QString QString init_event_id = init_event["event_id"].toString(); QString xfp = ""; QWarningMessage joinmsg; - QNunchukMatrixEvent nunJoinEvent = matrixbrigde::GetEvent(this->id(), join_event_id, joinmsg); + QNunchukMatrixEvent nunJoinEvent = matrixbrigde::GetEvent(id(), join_event_id, joinmsg); if((int)EWARNING::WarningType::NONE_MSG == joinmsg.type()){ QJsonObject joinjson = matrixbrigde::stringToJson(nunJoinEvent.get_content()); xfp = joinjson["body"].toObject()["key"].toString().split('/')[0].remove('['); @@ -686,9 +709,9 @@ bool QNunchukRoom::extractNunchukEvent(const QString &matrixType, const QString cons.init_event_json = json; } else if(0 == QString::compare(msgtype, NUNCHUK_MSG_TX_RECEIVE, Qt::CaseInsensitive)){ - if(matrixbrigde::HasRoomWallet(this->id()) == false) return false; + if(matrixbrigde::HasRoomWallet(id()) == false) return false; QWarningMessage roomTxWarning; - QString tx_id = matrixbrigde::GetTransactionId(this->id(), init_event_id, roomTxWarning); + QString tx_id = matrixbrigde::GetTransactionId(id(), init_event_id, roomTxWarning); if((int)EWARNING::WarningType::NONE_MSG == roomTxWarning.type() && tx_id != ""){ cons.init_event_id = tx_id; cons.message = STR_CPP_020; @@ -699,7 +722,7 @@ bool QNunchukRoom::extractNunchukEvent(const QString &matrixType, const QString else { return false; } - downloadTransactionThread(cons, this->id()); + downloadTransactionThread(cons, id()); } else if(0 == QString::compare(matrixType, NUNCHUK_EVENT_EXCEPTION, Qt::CaseInsensitive)){ QJsonObject body = json["body"].toObject(); @@ -756,7 +779,7 @@ void QNunchukRoom::downloadTransactionThread(Conversation cons, const QString &r if(cons.init_event_id != ""){ // FIXME FOR CHECK DUP RECIEVED TX EVT QtConcurrent::run([this, cons, roomid]() { if(cons.messageType == (int)ENUNCHUCK::ROOM_EVT::TX_RECEIVE){ - QString wallet_id = this->roomWallet() ? this->roomWallet()->get_wallet_id() : ""; + QString wallet_id = roomWallet() ? roomWallet()->get_wallet_id() : ""; QString tx_id = cons.init_event_id; QWarningMessage txWarning; nunchuk::Transaction tx = bridge::nunchukGetOriginTransaction(wallet_id, @@ -775,6 +798,14 @@ void QNunchukRoom::downloadTransactionThread(Conversation cons, const QString &r nunchuk::RoomTransaction room_tx = matrixbrigde::GetOriginRoomTransaction(roomid, cons.init_event_id, roomTxWarning); +#if 0 //FIXME + if(cons.messageType == (int)ENUNCHUCK::ROOM_EVT::TX_CANCEL){ + QWarningMessage msggetevt; + QNunchukMatrixEvent evt = matrixbrigde::GetEvent(roomid, cons.init_event_id, msggetevt); + DBG_INFO << "FIXME" + << evt.get_content(); + } +#endif if((int)EWARNING::WarningType::NONE_MSG == roomTxWarning.type() && room_tx.get_wallet_id() != ""){ QWarningMessage txWarning; room_tx.set_room_id(id().toStdString()); @@ -797,7 +828,7 @@ bool QNunchukRoom::leaveWallet(const QString &xfp) QString join_id = roomWallet()->walletSigners()->getJoinEventId(xfp); if("" != join_id){ QWarningMessage msgWarning; - matrixbrigde::LeaveWallet(this->id(), join_id, STR_CPP_008, msgWarning); + matrixbrigde::LeaveWallet(id(), join_id, STR_CPP_008, msgWarning); if((int)EWARNING::WarningType::NONE_MSG == msgWarning.type()){ ret = true; } @@ -1006,7 +1037,10 @@ void QNunchukRoom::downloadHistorical() if(!m_room) return; else{ if(isServerNoticeRoom()){ - // TODO + //FIXME - DEBUG +// for (auto e = m_room->messageEvents().rbegin(); e != m_room->messageEvents().rend(); ++e){ +// nunchukNoticeEvent(**e); // FIXME +// } } else if(isNunchukSyncRoom()){ QtConcurrent::run([this]() { @@ -1036,8 +1070,8 @@ void QNunchukRoom::downloadHistorical() } } conversation()->requestSortByTimeAscending(false); - this->setLastMessage(conversation()->lastMessage()); - this->setLasttimestamp(conversation()->lastTime()); + setLastMessage(conversation()->lastMessage()); + setLasttimestamp(conversation()->lastTime()); if(conversation()->lastIndex() == 0){ if(allHisLoaded() == false){ getMoreContents(10); @@ -1050,7 +1084,7 @@ void QNunchukRoom::downloadHistorical() roomWallet()->setIsCreator(isCreator); } } - this->startGetPendingTxs(); + startGetPendingTxs(); m_downloaded = true; }); } @@ -1083,7 +1117,7 @@ void QNunchukRoom::connectRoomSignals() connect(this, &QNunchukRoom::signalFinishFinalizeWallet, this, &QNunchukRoom::slotFinishFinalizeWallet); connect(this, &QNunchukRoom::signalFinishCancelWallet, this, &QNunchukRoom::slotFinishCancelWallet); connect(this, &QNunchukRoom::signalFinishedGetPendingTxs, this, &QNunchukRoom::slotFinishedGetPendingTxs); - this->downloadHistorical(); + downloadHistorical(); } } @@ -1092,6 +1126,7 @@ void QNunchukRoom::connectRoomServiceSignals() if(m_room){ connect(this, &QNunchukRoom::noticeService, ClientController::instance(), &ClientController::refreshContacts); connect(m_room, &Room::addedMessages, ClientController::instance(), &ClientController::refreshContacts); + connect(m_room, &Room::addedMessages, this, &QNunchukRoom::addedMessages); } } @@ -1203,7 +1238,7 @@ void QNunchukRoom::transactionChanged(const QString &tx_id, const int status, co if(conversation()){ conversation()->transactionChanged(tx_id, status, height); } - this->startGetPendingTxs(); + startGetPendingTxs(); } void QNunchukRoom::updateTransactionMemo(const QString &tx_id, const QString &memo) @@ -1215,10 +1250,10 @@ void QNunchukRoom::updateTransactionMemo(const QString &tx_id, const QString &me void QNunchukRoom::startGetPendingTxs() { - if(matrixbrigde::HasRoomWallet(this->id())){ + if(matrixbrigde::HasRoomWallet(id())){ QtConcurrent::run([this]() { - QRoomTransactionModelPtr ret = matrixbrigde::GetPendingTransactions(this->id()); - emit this->signalFinishedGetPendingTxs(ret); + QRoomTransactionModelPtr ret = matrixbrigde::GetPendingTransactions(id()); + emit signalFinishedGetPendingTxs(ret); }); } } @@ -1378,8 +1413,15 @@ void QNunchukRoom::aboutToAddNewMessages(RoomEventsRange events) void QNunchukRoom::addedMessages(int fromIndex, int toIndex) { + DBG_INFO << fromIndex << toIndex << isServerNoticeRoom(); if(isServerNoticeRoom()){ emit noticeService(); + for (auto e = m_room->messageEvents().rbegin(); e != m_room->messageEvents().rend(); ++e){ + if(fromIndex <= e->index() && toIndex >= e->index()){ + const RoomEvent* lastEvent = e->get(); + nunchukNoticeEvent(*lastEvent); + } + } } else if(isNunchukSyncRoom()){ QtConcurrent::run([=]() { @@ -1389,9 +1431,7 @@ void QNunchukRoom::addedMessages(int fromIndex, int toIndex) nunchukConsumeSyncEvent(*lastEvent); } } - AppModel::instance()->startReloadWallets(); - AppModel::instance()->startReloadMasterSigners(); - AppModel::instance()->startReloadRemoteSigners(); + emit finishConsumeEvent(); }); } else{ @@ -1504,7 +1544,7 @@ void QNunchukRoom::eventToConversation(const RoomEvent& evt, Conversation &resul }, [=](const RoomMemberEvent& e) { // FIXME: Rewind to the name that was at the time of this event - auto subjectName = this->m_room->user(e.userId())->displayname(room()); + auto subjectName = m_room->user(e.userId())->displayname(room()); QString content = ""; // The below code assumes senderName output in AuthorRole switch (e.membership()) { @@ -1675,10 +1715,10 @@ void QNunchukRoom::receiveMessage(int fromIndex, int toIndex) } pos++; if(cons.messageType == (int)ENUNCHUCK::ROOM_EVT::WALLET_CANCEL){ - this->updateCancelWallet(cons.init_event_id); + updateCancelWallet(cons.init_event_id); } if(cons.messageType == (int)ENUNCHUCK::ROOM_EVT::TX_CANCEL){ - this->updateCancelTransaction(cons); + updateCancelTransaction(cons); } } } @@ -1690,8 +1730,8 @@ void QNunchukRoom::receiveMessage(int fromIndex, int toIndex) emit roomNameChanged(); } conversation()->requestSortByTimeAscending(); - this->setLastMessage(conversation()->lastMessage()); - this->setLasttimestamp(conversation()->lastTime()); + setLastMessage(conversation()->lastMessage()); + setLasttimestamp(conversation()->lastTime()); } } @@ -1766,6 +1806,35 @@ void QNunchukRoom::nunchukConsumeSyncEvent(const RoomEvent &evt) } } +void QNunchukRoom::nunchukNoticeEvent(const RoomEvent &evt) +{ + if (CLIENT_INSTANCE->isNunchukLoggedIn() && CLIENT_INSTANCE->isMatrixLoggedIn()) { + QString matrixType = evt.matrixType(); + DBG_INFO << "FIXME" << evt.contentJson(); + if(0 == QString::compare(matrixType, NUNCHUK_ROOM_MESSAGE, Qt::CaseInsensitive)) + { + QString msgtype = evt.contentJson()["msgtype"].toString(); + DBG_INFO << "FIXME" << msgtype; + if (msgtype.toLower().contains("io.nunchuk.custom.draft_wallet")) { + QUserWallets::instance()->newRequestToAddKey(); + } + else if (msgtype.toLower().contains("io.nunchuk.custom.wallet_created")) { + AppModel::instance()->requestCreateUserWallets(); + } + else if(msgtype.toLower().contains("io.nunchuk.custom.transaction")){ + QString wallet_id = evt.fullJson()["content"].toObject()["wallet_local_id"].toString(); + if(AppModel::instance()->walletList()){ + QWalletPtr wallet = AppModel::instance()->walletList()->getWalletById(wallet_id); + if(wallet && wallet.data()->isAssistedWallet()){ + AppModel::instance()->startSyncWalletDb(wallet_id); + } + } + } + else{} + } + } +} + QConversationModel *QNunchukRoom::conversation() const { return m_conversation.data(); @@ -2030,10 +2099,10 @@ void QNunchukRoomListModel::downloadRooms() else{ AppModel::instance()->startMultiDeviceSync(false); } - synchonizesUserData(); emit finishedDownloadRoom(); CLIENT_INSTANCE->setReadySupport(true); downloadRoomWallets(); + synchonizesUserData(); }); }); } @@ -2087,6 +2156,7 @@ void QNunchukRoomListModel::setCurrentRoom(const QNunchukRoomPtr ¤tRoom) m_currentRoom = currentRoom; if(m_currentRoom){ m_currentRoom.data()->setDisplayed(true); + m_currentRoom.data()->startGetPendingTxs(); if(m_currentRoom->conversation()){ if(m_currentRoom->conversation()->unreadLastIndex() + 10 > m_currentRoom->conversation()->count()){ m_currentRoom.data()->conversation()->setCurrentIndex(m_currentRoom.data()->conversation()->rowCount() - 1); @@ -2158,6 +2228,7 @@ void QNunchukRoomListModel::doAddRoom(QNunchukRoomPtr r) m_servive.append(r); if(r.data()->isServerNoticeRoom()){ r.data()->connectRoomServiceSignals(); +// r.data()->downloadHistorical();//FIXME - DEBUG } if(r.data()->isNunchukSyncRoom()){ r.data()->connectRoomSignals(); @@ -2179,9 +2250,10 @@ void QNunchukRoomListModel::doAddRoom(QNunchukRoomPtr r) connect(r.data()->room(), &Room::unreadMessagesChanged, this, [this, r] { refresh(r); }); connect(r.data()->room(), &Room::typingChanged, this, [this, r] { refresh(r); }); connect(r.data()->room(), &Room::unreadMessagesChanged, this, &QNunchukRoomListModel::totalUnreadChanged); + connect(r.data(), &QNunchukRoom::pendingTxsChanged, this, [this, r] { refresh(r); }); } } - emit this->countChanged(); + emit countChanged(); } void QNunchukRoomListModel::removeRoomByIndex(const int index) @@ -2240,9 +2312,7 @@ void QNunchukRoomListModel::leaveCurrentRoom() auto* job = currentRoom()->room()->leaveRoom(); connect(job, &BaseJob::success, this, [this] { removeRoomByIndex(currentIndex()); - AppModel::instance()->startReloadWallets(); - AppModel::instance()->startReloadMasterSigners(); - AppModel::instance()->startReloadRemoteSigners(); + AppModel::instance()->startReloadUserDb(); }); emit countChanged(); } @@ -2560,11 +2630,8 @@ void QNunchukRoomListModel::roomNeedTobeLeaved(const QString &id) void QNunchukRoomListModel::synchonizesUserDataFinished() { - DBG_INFO; AppModel::instance()->closePromtNunchukSync(); - AppModel::instance()->startReloadWallets(); - AppModel::instance()->startReloadMasterSigners(); - AppModel::instance()->startReloadRemoteSigners(); + AppModel::instance()->startReloadUserDb(); } bool sortRoomListTimeAscending(const QNunchukRoomPtr &v1, const QNunchukRoomPtr &v2) diff --git a/Models/Chats/QNunchukRoomModel.h b/Models/Chats/QNunchukRoomModel.h index a6efee0e..af781559 100755 --- a/Models/Chats/QNunchukRoomModel.h +++ b/Models/Chats/QNunchukRoomModel.h @@ -216,17 +216,19 @@ class QNunchukRoom: public QObject QRoomTransaction *m_pinTransaction; nunchuk::Wallet m_walletImport; bool m_IsEncrypted; + QTimer m_timeSyncDb; private: bool validatePendingEvent(const QString& txnId); bool extractNunchukEvent(const RoomEvent& evt, Conversation &cons) ; void eventToConversation(const RoomEvent& evt, Conversation &result, Qt::TextFormat format = Qt::RichText); void receiveMessage(int fromIndex, int toIndex); - Conversation createConversation(const RoomEvent& evt) ; - void nunchukConsumeEvent(const RoomEvent& evt) ; - void nunchukConsumeSyncEvent(const RoomEvent& evt) ; + Conversation createConversation(const RoomEvent& evt); + void nunchukConsumeEvent(const RoomEvent& evt); + void nunchukConsumeSyncEvent(const RoomEvent& evt); + void nunchukNoticeEvent(const RoomEvent& evt); bool joinWalletWithMasterSigner(const QString& id, bool &needXpub); bool joinWalletWithSingleSigner(const QString& xfp); - bool joinWalletUseSignerFromWalletImport(const QString& id,const QString& xfp); + bool joinWalletUseSignerFromWalletImport(const QString& signer_id,const QString& xfp); public slots: void highlightCountChanged(); @@ -247,6 +249,8 @@ public slots: void slotFinishCancelWallet(QString what, int type, int code); void slotFinishedGetPendingTxs(QRoomTransactionModelPtr txs); void slotUpdateInitEventId(const Conversation cons); + void slotFinishConsumeEvent(); + void slotSyncWalletDb(); signals: void userCountChanged(); void userNamesChanged(); @@ -275,6 +279,7 @@ public slots: void signalFinishedGetPendingTxs(QRoomTransactionModelPtr txs); void pinTransactionChanged(); void roomNeedTobeLeaved(const QString& id); + void finishConsumeEvent(); }; Q_DECLARE_METATYPE(Conversation) Q_DECLARE_METATYPE(nunchuk::RoomTransaction) diff --git a/Models/Chats/QRoomTransaction.cpp b/Models/Chats/QRoomTransaction.cpp index 06fe3894..37140e8d 100644 --- a/Models/Chats/QRoomTransaction.cpp +++ b/Models/Chats/QRoomTransaction.cpp @@ -292,8 +292,18 @@ QSharedPointer QRoomTransactionModel::clone() const { QRoomTransactionModelPtr clone = QRoomTransactionModelPtr(new QRoomTransactionModel()); for (QRoomTransactionPtr tx : m_data) { - QRoomTransactionPtr ret = QRoomTransactionPtr(new QRoomTransaction(tx.data()->roomTransaction())); - clone.data()->addTransaction(ret); + if(tx){ + QRoomTransactionPtr ret = QRoomTransactionPtr(new QRoomTransaction(tx.data()->roomTransaction())); + QTransactionPtr nunchukTx = tx.data()->transactionPtr(); + if(nunchukTx){ + QTransactionPtr rawtx = QTransactionPtr(new Transaction()); + rawtx.data()->setNunchukTransaction(nunchukTx.data()->nunchukTransaction()); + rawtx.data()->setInitEventId(nunchukTx.data()->initEventId()); + rawtx.data()->setRoomId(nunchukTx.data()->roomId()); + ret.data()->setTransaction(rawtx); + } + clone.data()->addTransaction(ret); + } } return clone; } diff --git a/Models/Chats/QUserWallets.cpp b/Models/Chats/QUserWallets.cpp index d97b942c..36a023bd 100644 --- a/Models/Chats/QUserWallets.cpp +++ b/Models/Chats/QUserWallets.cpp @@ -75,6 +75,11 @@ bool QUserWallets::requestServerKeyVerifyPassword(const QString &password) return requestVerifyPassword(password,(int)TARGET_ACTION::UPDATE_SERVER_KEY); } +bool QUserWallets::requestInheritancePlanVerifyPassword(const QString &password) +{ + return requestVerifyPassword(password,(int)TARGET_ACTION::UPDATE_INHERITANCE_PLAN); +} + QTransactionPtr QUserWallets::getDummyTx(const QString& wallet_id, const QString& period_id) { QWarningMessage msgWallet; @@ -219,7 +224,7 @@ bool QUserWallets::secQuesAnswer() } } -QVariantList QUserWallets::lockdownPeriods() +QVariantList QUserWallets::periods() { return m_periods; } @@ -274,11 +279,11 @@ bool QUserWallets::lockdownByAnswerSecQues() QString errormsg; QString until_time; bool ret = Draco::instance()->lockdownByAnswerSecQues(m_passwordToken, - m_secQuesToken, - m_period_id, - m_wallet_id, - until_time, - errormsg); + m_secQuesToken, + m_period_id, + m_wallet_id, + until_time, + errormsg); if (!ret) { //show toast AppModel::instance()->showToast(0, @@ -297,11 +302,11 @@ bool QUserWallets::lockdownBySignDummyTx() QString errormsg; QString until_time; bool ret = Draco::instance()->lockdownBySignDummyTx(signatures, - m_passwordToken, - m_period_id, - m_wallet_id, - until_time, - errormsg); + m_passwordToken, + m_period_id, + m_wallet_id, + until_time, + errormsg); if (!ret) { //show toast AppModel::instance()->showToast(0, @@ -442,35 +447,59 @@ int QUserWallets::inheritanceCheck(const QString& magic, const QString& environm } } -bool QUserWallets::inheritanceGetPlan(const QString& magic_inpputed, const QString &wallet_id) +bool QUserWallets::inheritanceGetPlan(const QString &wallet_id) { - // Assisted wallet being used to sign test message or dummy transaction - QJsonObject result; + QStringList ids {}; + if (m_periods.size() == 0) { + inheritancePlanCreatePeriods(); + } + for (QVariant var : m_periods) { + QMap map = var.toMap(); + ids.append(map.value("id").toString()); + } + QJsonObject response; QString errormsg; - bool ret = Draco::instance()->inheritanceGetPlan(wallet_id, result, errormsg); + bool ret = Draco::instance()->inheritanceGetPlan(wallet_id, response, errormsg); if(ret){ //HANDLE RESULT - QJsonObject inheritance = result["inheritance"].toObject(); - QString magic = inheritance["magic"].toString(); - if(0 == QString::compare(magic, magic_inpputed, Qt::CaseInsensitive)){ - // HANDLE RESULT - return true; + QJsonObject inheritance = response["inheritance"].toObject(); + qInfo() << "inheritanceGetPlan" << inheritance; + long int activation_time_milis = static_cast(inheritance.value("activation_time_milis").toDouble()/1000); + if (activation_time_milis > 0) { + ServiceSetting::instance()->setInheritanceActivationDate(QDateTime::fromTime_t(activation_time_milis).date().toString("MM/dd/yyyy")); + } else { + ServiceSetting::instance()->setInheritanceActivationDate(""); } - else{ - AppModel::instance()->showToast(0, - STR_CPP_116, - EWARNING::WarningType::ERROR_MSG, - STR_CPP_116); - return false; + ServiceSetting::instance()->setInheritanceNote(inheritance.value("note").toString()); + QJsonArray emails = inheritance.value("notification_emails").toArray(); + QStringList emailList; + for (QJsonValue js : emails) { + emailList.append(js.toString()); + } + QString email = emailList.join(","); + ServiceSetting::instance()->setInheritanceEmail(email); + ServiceSetting::instance()->setInheritanceMagic(inheritance.value("magic").toString()); + QJsonObject buffer_period = inheritance["buffer_period"].toObject(); + if (!buffer_period.isEmpty()) { + QString id = buffer_period.value("id").toString(); + if (ids.contains(id)) { + ServiceSetting::instance()->setInheritancePeriod(buffer_period.value("display_name").toString()); + ServiceSetting::instance()->setInheritancePeriodId(id); + } + } else { + ServiceSetting::instance()->setInheritancePeriod(""); + ServiceSetting::instance()->setInheritancePeriodId(""); } + ServiceSetting::instance()->inheritanceDataChanged(); + ServiceSetting::instance()->setViewInheritanceIsEdit(false); } else { AppModel::instance()->showToast(0, errormsg, EWARNING::WarningType::ERROR_MSG, STR_CPP_112); - return false; } + return ret; } int QUserWallets::inheritanceDownloadBackup(const QString &magic, const QString &backup_password) @@ -491,6 +520,7 @@ int QUserWallets::inheritanceDownloadBackup(const QString &magic, const QString std::vector base64vec(base64bin.begin(), base64bin.end()); QString backupkey = backup_password; //Inputted from user QString keyname = result["key_name"].toString(); + mInheritance.derivation_path = result["derivation_path"].toString(); QWarningMessage msg; QMasterSignerPtr masterSigner = bridge::ImportTapsignerMasterSigner(base64vec, backupkey, keyname, false, msg); if (masterSigner && NONE_MSG == msg.type()) { @@ -513,7 +543,7 @@ int QUserWallets::inheritanceDownloadBackup(const QString &magic, const QString QJsonDocument doc(data); QString user_data(doc.toJson()); //[SIGN_MESSAGE] flow - nunchuk::SingleSigner signer = nunchukiface::instance()->GetDefaultSignerFromMasterSigner(masterSigner->id().toStdString(),msg); + nunchuk::SingleSigner signer = nunchukiface::instance()->GetSignerFromMasterSigner(masterSigner->id().toStdString(), mInheritance.derivation_path.toStdString(), msg); if (NONE_MSG == msg.type()) { QString messages_to_sign = qUtils::GetHealthCheckMessage(user_data,msg); // user_data in json string if (NONE_MSG == msg.type()) { @@ -581,7 +611,7 @@ bool QUserWallets::inheritanceClaimRequest(const nunchuk::Wallet wallet, const n QString status = transaction.value("status").toString(); QString psbt = transaction.value("psbt").toString(); if (status == "PENDING_CONFIRMATION" || - status == "CONFIRMED"){ + status == "CONFIRMED"){ QWarningMessage _msg; bridge::nunchukImportPsbt(QString::fromStdString(mInheritance.wallet.get_id()), psbt, _msg); QString id = transaction.value("id").toString(); @@ -669,7 +699,7 @@ bool QUserWallets::inheritanceCreateTx(const nunchuk::SingleSigner& signer, cons AppModel::instance()->setTransactionInfo(trans); QList states = QQuickViewer::instance()->getCurrentStates(); if(!states.isEmpty() && states.last() == E::STATE_ID_SCR_INHERITANCE_WITHDRAW_BALANCE){ - DBG_INFO << "Entry here "; + DBG_INFO << "Entry here "; QQuickViewer::instance()->sendEvent(E::EVT_INHERITANCE_CONFIRM_TRANSACTION_REQUEST); } } @@ -720,7 +750,7 @@ void QUserWallets::inheritanceCreateDraftTransaction(double fee_rate) QString user_data(doc.toJson()); QWarningMessage msg; //[SIGN_MESSAGE] flow - nunchuk::SingleSigner signer = nunchukiface::instance()->GetDefaultSignerFromMasterSigner(mInheritance.masterSignerId.toStdString(),msg); + nunchuk::SingleSigner signer = nunchukiface::instance()->GetSignerFromMasterSigner(mInheritance.masterSignerId.toStdString(), mInheritance.derivation_path.toStdString(), msg); if (NONE_MSG == msg.type()) { QString messages_to_sign = qUtils::GetHealthCheckMessage(user_data,msg); // user_data in json string if (NONE_MSG == msg.type()) { @@ -762,6 +792,108 @@ void QUserWallets::inheritanceSignTransaction() } } +QJsonObject QUserWallets::inheritancePlanBody() +{ + QJsonObject body; + body["wallet"] = ServiceSetting::instance()->getInheritanceWalletId(); + body["note"] = ServiceSetting::instance()->getInheritanceNote(); + body["buffer_period_id"] = ServiceSetting::instance()->getInheritancePeriodId(); + QString email = ServiceSetting::instance()->getInheritanceEmail(); + QStringList emails = email.split(","); + QJsonArray arrays; + for (QString e : emails) { + if (e != "None") { + arrays.append(e); + } + } + body["notification_emails"] = arrays; + body["notify_today"] = ServiceSetting::instance()->getInheritanceIsNotify(); + long int t = qUtils::GetTimeSecond(ServiceSetting::instance()->getInheritanceActivationDate()); + body["activation_time_milis"] = (double)t*1000; + return body; +} + +void QUserWallets::inheritancePlanFinalizeChanges() +{ + long int activeTime = qUtils::GetTimeSecond(ServiceSetting::instance()->getInheritanceActivationDate()); + long int currentTime = qUtils::GetCurrentTimeSecond(); + if (activeTime < currentTime) { + AppModel::instance()->showToast(0, + STR_CPP_120, + EWARNING::WarningType::ERROR_MSG, + STR_CPP_120); + return; + } + QJsonObject body_data = inheritancePlanBody(); + QString errormsg = ""; + bool ret = Draco::instance()->inheritancePlanRequiredSignatures(body_data, required_question, errormsg); + DBG_INFO << errormsg << body_data; + if (ret) { + if (required_question.type == (int)REQUIRED_SIGNATURE_TYPE_INT::SECURITY_QUESTION) { + QUserWallets::instance()->createSecurityQuestions(); + } else if (required_question.type == (int)REQUIRED_SIGNATURE_TYPE_INT::SIGN_DUMMY_TX) { + //Show popup support in moble + emit inheritanceDummyTransactionAlert(); + } else { + } + } else { + emit inheritanceInvalidActivationDateAlert(); + } + return; +} + +void QUserWallets::inheritancePlanUpdate() +{ + QJsonObject data; + data["nonce"] = Draco::instance()->randomNonce(); + data["body"] = inheritancePlanBody(); + QStringList authorizations; + QJsonObject output; + QString errormsg = ""; + DBG_INFO << m_passwordToken << m_secQuesToken << data; + bool ret = Draco::instance()->inheritancePlanUpdate(m_passwordToken, m_secQuesToken, authorizations, data, output, errormsg); + DBG_INFO << errormsg << output; + if (ret) { + emit securityQuestionClosed(); + AppModel::instance()->showToast(0, + errormsg, + EWARNING::WarningType::SUCCESS_MSG, + STR_CPP_119); + } else { + AppModel::instance()->showToast(0, + errormsg, + EWARNING::WarningType::ERROR_MSG, + STR_CPP_112); + } +} + +bool QUserWallets::inheritancePlanCreatePeriods() +{ + m_periods.clear(); + QJsonArray periods; + QString errormsg; + bool ret = Draco::instance()->inheritancePlanBufferPeriod(periods, errormsg); + if (!ret) { + return false; + } else { + for (auto v : periods) { + QJsonObject it = v.toObject(); + DBG_INFO << it.toVariantMap(); + m_periods.append(it.toVariantMap()); + } + QJsonObject notNeed; + notNeed["id"] = ""; + notNeed["display_name"] = "I don’t need a buffer period"; + notNeed["is_recommended"] = false; + m_periods.append(notNeed.toVariantMap()); + if (m_periods.size() == 0) { + errormsg = "There no period"; + return false; + } + } + return true; +} + bool QUserWallets::serverKeyGetCurrentPolicies(const QString& wallet_id) { QWarningMessage msgWallet; @@ -895,3 +1027,134 @@ QUserWallets::inheritance_t QUserWallets::inheritance() const return mInheritance; } +void QUserWallets::newRequestToAddKey() +{ + QtConcurrent::run([this]() { + QJsonObject data = Draco::instance()->assistedWalletGetListKey(); + m_requests = data.value("requests").toArray(); + setLedgerNeed(exist("LEDGER")); + setTrezorNeed(exist("TREZOR")); + setColdCardNeed(exist("COLDCARD")); + }); +} + +void QUserWallets::addKeyRequested() +{ + QMasterSignerPtr signer = AppModel::instance()->masterSignerInfoPtr(); + QString request_id = ""; + QString key = ""; + int key_index = -1; + QJsonObject data; + DBG_INFO << !signer.isNull(); + QWarningMessage warningmsg; + if (!signer.isNull()) { + QJsonArray tags; + if (mLedgerNeed && signer->deviceType() == "ledger") { + key = "LEDGER"; + } + if (mTrezorNeed && signer->deviceType() == "trezor") { + key = "TREZOR"; + } + if (mColdCardNeed && signer->deviceType() == "coldcard") { + key = "COLDCARD"; + } + DBG_INFO << signer->deviceType() << key; + if (!key.isEmpty()) { + tags.append(key); + request_id = getRequestId(key); + key_index = getKeyIndex(key); + } + QSingleSignerPtr ptr = bridge::nunchukGetDefaultSignerFromMasterSigner(signer->id(), + ENUNCHUCK::WalletType::MULTI_SIG, + ENUNCHUCK::AddressType::NATIVE_SEGWIT , + warningmsg); + if (!request_id.isEmpty() && !ptr.isNull()) { + data["name"] = signer->name(); + data["xfp"] = signer->fingerPrint(); + data["derivation_path"] = ptr->derivationPath(); + data["xpub"] = ptr->xpub(); + data["pubkey"] = ptr->publickey(); + data["type"] = qUtils::GetSignerTypeString(ptr->singleSigner().get_type()); + data["tags"] = tags; + data["tapsigner"] = {}; + if (key_index >= 0) { + data["key_index"] = key_index; + } else { + data["key_index"] = {}; + } + bool ret = Draco::instance()->assistedWalletAddKey(request_id, data); + qInfo() << request_id << data << ret; + if (ret) { + AppModel::instance()->setAddSignerWizard(3); + emit addHardwareSuccessAlert(); + return; + } + } else { + QString errormsg = "request id empty or get default error"; + AppModel::instance()->showToast(0, + errormsg, + EWARNING::WarningType::ERROR_MSG, + errormsg); + } + } + AppModel::instance()->setAddSignerWizard(0); + emit addHardwareAlert(); +} + +QJsonObject QUserWallets::getRequest(const QString &key) const +{ + if (m_requests.size() > 0) { + for (QJsonValue request : m_requests) { + QJsonObject requestObj = request.toObject(); + QString status = requestObj.value("status").toString(); + QJsonArray tags = requestObj.value("tags").toArray(); + if (tags.contains(key) && status == "PENDING") { + return requestObj; + } + } + } + return {}; +} + +QString QUserWallets::getRequestId(const QString &key) const +{ + QJsonObject request = getRequest(key); + if (request.empty()) { + return {}; + } else { + return request.value("id").toString(); + } +} + +int QUserWallets::getKeyIndex(const QString &key) const +{ + QJsonObject request = getRequest(key); + if (request.empty()) { + return -1; + } else { + return request.value("key_index").toInt(-1); + } +} + +bool QUserWallets::exist(const QString &key) const +{ + return !getRequest(key).empty(); +} + +void QUserWallets::cancelRequest(const QString& key) +{ + QString request_id = getRequestId(key); + if (!request_id.isEmpty()) { + DBG_INFO << key; + Draco::instance()->assistedWalletRemoveId(request_id); + newRequestToAddKey(); + } +} + +void QUserWallets::additionalGetWalletConfig() +{ + QJsonObject config = Draco::instance()->assistedGetWalletConfig(); + DBG_INFO << config; + int remaining_wallet_count = config.value("remaining_wallet_count").toInt(); + ServiceSetting::instance()->setRemainingAssistedWalletCount(remaining_wallet_count); +} diff --git a/Models/Chats/QUserWallets.h b/Models/Chats/QUserWallets.h index 55eb3213..13019f10 100644 --- a/Models/Chats/QUserWallets.h +++ b/Models/Chats/QUserWallets.h @@ -29,11 +29,14 @@ class QUserWallets : public QObject { Q_OBJECT - Q_PROPERTY(QVariantList securityQuestions READ securityQuestions NOTIFY securityQuestionChanged) - Q_PROPERTY(QVariantList lockdownPeriods READ lockdownPeriods CONSTANT) - Q_PROPERTY(QString untilTime READ untilTime WRITE setUntilTime NOTIFY untilTimeChanged) - Q_PROPERTY(QVariantList tapsigners READ tapsigners NOTIFY tapsignersChanged) - Q_PROPERTY(QMasterSigner* signer READ signer CONSTANT) + Q_PROPERTY(QVariantList securityQuestions READ securityQuestions NOTIFY securityQuestionChanged) + Q_PROPERTY(QVariantList periods READ periods CONSTANT) + Q_PROPERTY(QString untilTime READ untilTime NOTIFY untilTimeChanged) + Q_PROPERTY(QVariantList tapsigners READ tapsigners NOTIFY tapsignersChanged) + Q_PROPERTY(QMasterSigner* signer READ signer CONSTANT) + DECLARE_PROPERTY(bool, LedgerNeed, { if (val == false) { cancelRequest("LEDGER"); } }, {}) + DECLARE_PROPERTY(bool, TrezorNeed, { if (val == false) { cancelRequest("TREZOR"); } }, {}) + DECLARE_PROPERTY(bool, ColdCardNeed, { if (val == false) { cancelRequest("COLDCARD"); } }, {}) public: struct inheritance_t { @@ -44,6 +47,7 @@ class QUserWallets : public QObject nunchuk::Wallet wallet = {}; nunchuk::Transaction tx = {}; double balance = {0.0}; + QString derivation_path = {}; }; QUserWallets(); ~QUserWallets(); @@ -57,6 +61,7 @@ class QUserWallets : public QObject bool requestLockDownVerifyPassword(const QString &password); bool requestRecoverKeyVerifyPassword(const QString &password); bool requestServerKeyVerifyPassword(const QString &password); + bool requestInheritancePlanVerifyPassword(const QString &password); QTransactionPtr getDummyTx(const QString &wallet_id, const QString &period_id); void signDummyTx(const QString& xfp); @@ -68,7 +73,7 @@ class QUserWallets : public QObject Q_INVOKABLE void secQuesAnswer(const QString &id, const QString &answer); bool secQuesAnswer(); - QVariantList lockdownPeriods(); + QVariantList periods(); bool createLockdownPeriods(); bool lockdownRequired(const QString &period_id); int lockdownType(); @@ -89,7 +94,7 @@ class QUserWallets : public QObject QMasterSigner *signer() const; //Inheritance Q_INVOKABLE int inheritanceCheck(const QString& magic = "", const QString& environment = "PRODUCTION"); - bool inheritanceGetPlan(const QString &magic_inpputed, const QString& wallet_id); + bool inheritanceGetPlan(const QString& wallet_id); int inheritanceDownloadBackup(const QString& magic, const QString& backup_password); bool inheritanceClaimRequest(const nunchuk::Wallet wallet, const nunchuk::Transaction txSigned, const QString& magic); int inheritanceClaimStatus(const QJsonObject& data, const QString& autho); @@ -98,6 +103,10 @@ class QUserWallets : public QObject void setInheritanceAddressNewTransaction(const QString& address); void inheritanceCreateDraftTransaction(double fee_rate = 1000.0); void inheritanceSignTransaction(); + QJsonObject inheritancePlanBody(); + void inheritancePlanFinalizeChanges(); + void inheritancePlanUpdate(); + Q_INVOKABLE bool inheritancePlanCreatePeriods(); // For co-signing policies bool serverKeyGetCurrentPolicies(const QString& wallet_id); @@ -106,6 +115,17 @@ class QUserWallets : public QObject bool serverKeyUpdatePoliciesSucceed(); inheritance_t inheritance() const; + // For draft-wallets + void newRequestToAddKey(); + Q_INVOKABLE void addKeyRequested(); + QJsonObject getRequest(const QString& key) const; + QString getRequestId(const QString& key) const; + int getKeyIndex(const QString& key) const; + bool exist(const QString& key) const; + void cancelRequest(const QString& key); + + // Get additional wallet + Q_INVOKABLE void additionalGetWalletConfig(); signals: void verifyPasswordTokenAlert(const QString& errormsg); void lockdownPeriodsAlert(const QString& errormsg); @@ -121,6 +141,12 @@ class QUserWallets : public QObject void serverKeyDummyTransactionAlert(); void securityQuestionClosed(); void thereNoAssistedWalletAlert(); + void addHardwareAlert(); + void addHardwareSuccessAlert(); + + void inheritanceDummyTransactionAlert(); + void inheritanceInvalidActivationDateAlert(); + void inheritanceDiscardChangeAlert(); private: QString m_passwordToken; QString m_secQuesToken; @@ -145,6 +171,9 @@ class QUserWallets : public QObject nunchuk::SingleSigner m_server_key = {}; }; co_signing_t mCoSigning = {}; + bool m_ledgerNeed {false}; + bool m_trezorNeed {false}; + QJsonArray m_requests {}; }; #endif // QUSERWALLETS_H diff --git a/Models/DeviceModel.cpp b/Models/DeviceModel.cpp index 0805a292..f2bb31fe 100644 --- a/Models/DeviceModel.cpp +++ b/Models/DeviceModel.cpp @@ -74,15 +74,17 @@ bool QDevice::needsPinSent() const { return m_device.needs_pin_sent(); } -bool QDevice::usableToAdd() +bool QDevice::usableToAdd() const { bool used = false; if(AppModel::instance()->masterSignerList()){ used = AppModel::instance()->masterSignerList()->containsFingerPrint(masterFingerPrint()); } +#if 0 //Able to upgrade to master signer if(!used && AppModel::instance()->remoteSignerList()){ used = AppModel::instance()->remoteSignerList()->containsFingerPrint(masterFingerPrint()); } +#endif return !used; } @@ -276,7 +278,7 @@ QDevicePtr DeviceListModel::getDeviceNeedPinSent(){ return QDevicePtr(NULL); } -bool DeviceListModel::containsFingerPrint(const QString &xfp) +bool DeviceListModel::containsFingerPrint(const QString &xfp) const { foreach (QDevicePtr it, d_) { if(0 == QString::compare(xfp, it.data()->masterFingerPrint(), Qt::CaseInsensitive)){ diff --git a/Models/DeviceModel.h b/Models/DeviceModel.h index ede10e59..09574baf 100644 --- a/Models/DeviceModel.h +++ b/Models/DeviceModel.h @@ -51,7 +51,7 @@ class QDevice : public QObject bool connected() const; bool needsPassPhraseSent() const; bool needsPinSent() const; - bool usableToAdd(); + bool usableToAdd() const; QString masterSignerId() const; QString cardId() const; void setCardId(const QString &card_id); @@ -110,7 +110,7 @@ class DeviceListModel : public QAbstractListModel device_usableToAdd_role, device_master_signer_id_role, }; - bool containsFingerPrint(const QString& xfp); + bool containsFingerPrint(const QString& xfp) const; // For verify addr QStringList getXFPList(); diff --git a/Models/MasterSignerModel.cpp b/Models/MasterSignerModel.cpp index fc666716..af2d4a7e 100644 --- a/Models/MasterSignerModel.cpp +++ b/Models/MasterSignerModel.cpp @@ -40,6 +40,12 @@ QMasterSigner::~QMasterSigner(){ } +void QMasterSigner::convert(const nunchuk::MasterSigner &src) +{ + isDraft = false; + masterSigner_ = src; +} + QString QMasterSigner::id() const{ if(isDraft){ return id_; diff --git a/Models/MasterSignerModel.h b/Models/MasterSignerModel.h index 90838bbd..3f704cdc 100644 --- a/Models/MasterSignerModel.h +++ b/Models/MasterSignerModel.h @@ -51,6 +51,8 @@ class QMasterSigner : public QObject { QMasterSigner(const nunchuk::MasterSigner &signer); ~QMasterSigner(); + void convert(const nunchuk::MasterSigner& src); + QString id() const; void setId(const QString& d); diff --git a/Models/ServiceSetting.cpp b/Models/ServiceSetting.cpp index ad327e59..3ba03a23 100644 --- a/Models/ServiceSetting.cpp +++ b/Models/ServiceSetting.cpp @@ -128,3 +128,26 @@ QVariantList ServiceSetting::keyCoSigningIntervals() } return m_keyCoSigningIntervals; } + +int ServiceSetting::assistedSize() const +{ + return AppModel::instance()->getUserWallets().size(); +} + +bool ServiceSetting::existKeyType(const QString &type) +{ + for (QMasterSignerPtr ptr : AppModel::instance()->masterSignerList()->fullList()) { + if (ptr && ptr->deviceType() == type) return true; + } + return false; +} + +void ServiceSetting::inheritanceDataChanged() +{ + QJsonObject body = QUserWallets::instance()->inheritancePlanBody(); + if (mInheritancePlanBody != body) + { + mInheritancePlanBody = body; + setViewInheritanceIsEdit(true); + } +} diff --git a/Models/ServiceSetting.h b/Models/ServiceSetting.h index 44e16c0f..87cb82a3 100644 --- a/Models/ServiceSetting.h +++ b/Models/ServiceSetting.h @@ -3,17 +3,36 @@ #include #include +#include "QCommonDefines.h" +#include class ServiceSetting : public QObject { Q_OBJECT - Q_PROPERTY(bool isSubscriber READ isSubscriber WRITE setIsSubscriber NOTIFY isSubscriberChanged) - Q_PROPERTY(int claimInheritanceFlow READ claimInheritanceFlow WRITE setClaimInheritanceFlow NOTIFY claimInheritanceFlowChanged) - Q_PROPERTY(int claimInheritanceStatus READ claimInheritanceStatus WRITE setClaimInheritanceStatus NOTIFY claimInheritanceStatusChanged) - Q_PROPERTY(QString claimInheritancePeriod READ claimInheritancePeriod WRITE setClaimInheritancePeriod NOTIFY claimInheritancePeriodChanged) - Q_PROPERTY(QVariant inheritance READ inheritance NOTIFY inheritanceChanged) - Q_PROPERTY(QVariant keyCoSigning READ keyCoSigning WRITE setKeyCoSigning NOTIFY keyCoSigningChanged) - Q_PROPERTY(QVariantList keyCoSigningIntervals READ keyCoSigningIntervals CONSTANT) + Q_PROPERTY(bool isSubscriber READ isSubscriber WRITE setIsSubscriber NOTIFY isSubscriberChanged) + Q_PROPERTY(int claimInheritanceFlow READ claimInheritanceFlow WRITE setClaimInheritanceFlow NOTIFY claimInheritanceFlowChanged) + Q_PROPERTY(int claimInheritanceStatus READ claimInheritanceStatus WRITE setClaimInheritanceStatus NOTIFY claimInheritanceStatusChanged) + Q_PROPERTY(QString claimInheritancePeriod READ claimInheritancePeriod WRITE setClaimInheritancePeriod NOTIFY claimInheritancePeriodChanged) + Q_PROPERTY(QVariant inheritance READ inheritance NOTIFY inheritanceChanged) + Q_PROPERTY(QVariant keyCoSigning READ keyCoSigning WRITE setKeyCoSigning NOTIFY keyCoSigningChanged) + Q_PROPERTY(QVariantList keyCoSigningIntervals READ keyCoSigningIntervals CONSTANT) + Q_PROPERTY(int assistedSize READ assistedSize CONSTANT) + + DECLARE_PROPERTY(QString, InheritanceWalletName, {}, {}) + DECLARE_PROPERTY(QString, InheritanceWalletId, {}, {}) + DECLARE_PROPERTY(int, InheritancePlan, {}, {}) + DECLARE_PROPERTY(QString, InheritanceActivationDate, {inheritanceDataChanged();}, {}) + DECLARE_PROPERTY(QString, InheritanceNote, {inheritanceDataChanged();}, {}) + DECLARE_PROPERTY(QString, InheritanceMagic, {}, {}) + DECLARE_PROPERTY(QString, InheritancePeriod, {inheritanceDataChanged();}, {}) + DECLARE_PROPERTY(QString, InheritancePeriodId, {}, {}) + DECLARE_PROPERTY(bool, InheritanceIsNotify, {}, {}) + DECLARE_PROPERTY(QString, InheritanceEmail, {inheritanceDataChanged();}, {}) + DECLARE_PROPERTY(QString, InheritanceSecret, {}, {}) + + DECLARE_PROPERTY(int, RemainingAssistedWalletCount, {}, {}) + DECLARE_PROPERTY(QStringList, AssistedSetuped, {}, {}) + DECLARE_PROPERTY(bool, ViewInheritanceIsEdit, {}, {}) public: Q_ENUMS(CIWithDraw) enum class CIWithDraw { @@ -29,6 +48,14 @@ class ServiceSetting : public QObject CI_IS_VALID, CI_IS_ERROR }; + Q_ENUMS(InheritanceEdit) + enum class InheritanceEdit { + IE_NONE, + IE_ACTIVATION_DATE, + IE_LEAVE_MESSAGE, + IE_BUFFER_PERIOD, + IE_NOTIFICATION + }; explicit ServiceSetting(QObject *parent = nullptr); static ServiceSetting *instance(); ServiceSetting(ServiceSetting &other) = delete; @@ -56,6 +83,10 @@ class ServiceSetting : public QObject QVariantList keyCoSigningIntervals(); + int assistedSize() const; + + Q_INVOKABLE bool existKeyType(const QString& type); + void inheritanceDataChanged(); signals: void isSubscriberChanged(); void claimInheritanceFlowChanged(); @@ -71,6 +102,7 @@ class ServiceSetting : public QObject QString m_claimInheritancePeriod {}; QVariant m_keyCoSigning; QVariantList m_keyCoSigningIntervals; + QJsonObject mInheritancePlanBody {}; }; #endif // SERVICESETTING_H diff --git a/Models/SingleSignerModel.cpp b/Models/SingleSignerModel.cpp index 11794a72..902e7b3f 100644 --- a/Models/SingleSignerModel.cpp +++ b/Models/SingleSignerModel.cpp @@ -24,9 +24,9 @@ #include #include "utils/enumconverter.hpp" -QSingleSigner::QSingleSigner() : - isPrimaryKey_(false), - isDraft(true) +QSingleSigner::QSingleSigner() + : isPrimaryKey_(false) + , isDraft(true) { QQmlEngine::setObjectOwnership(this, QQmlEngine::CppOwnership); } @@ -46,6 +46,12 @@ QSingleSigner::QSingleSigner(const nunchuk::SingleSigner& singleKey): QSingleSigner::~QSingleSigner() {} +void QSingleSigner::convert(const nunchuk::SingleSigner &src) +{ + isDraft = false; + singleSigner_ = src; +} + nunchuk::SingleSigner QSingleSigner::originSingleSigner() const { return singleSigner_; @@ -124,7 +130,7 @@ void QSingleSigner::setDerivationPath(const QString &d) { } } -QString QSingleSigner::masterFingerPrint() { +QString QSingleSigner::masterFingerPrint() const { if(isDraft){ return master_fingerprint_; } @@ -182,9 +188,14 @@ void QSingleSigner::setSignerSigned(const bool d) } } -bool QSingleSigner::needTopUpXpub() const +bool QSingleSigner::needTopUpXpub() { - return needTopUpXpub_; + if((int)ENUNCHUCK::SignerType::HARDWARE == signerType() || (int)ENUNCHUCK::SignerType::SOFTWARE == signerType()){ + return needTopUpXpub_; + } + else{ + return false; + } } void QSingleSigner::setNeedTopUpXpub(bool needTopUpXpub) @@ -247,7 +258,7 @@ void QSingleSigner::setChecked(const bool checked) } } -bool QSingleSigner::readyToSign() +bool QSingleSigner::readyToSign() const { bool signAble = false; if((int)ENUNCHUCK::SignerType::HARDWARE == signerType() || (int)ENUNCHUCK::SignerType::COLDCARD_NFC == signerType()){ @@ -341,6 +352,11 @@ void QSingleSigner::setCardId(const QString &card_id) cardId_ = card_id; } +nunchuk::SingleSigner QSingleSigner::singleSigner() const +{ + return singleSigner_; +} + QString QSingleSigner::timeGapCalculationShort(QDateTime in) { QDateTime today = QDateTime::currentDateTime(); @@ -796,6 +812,15 @@ QList SingleSignerListModel::fullList() const return d_; } +std::vector SingleSignerListModel::signers() const +{ + std::vector signerList; + for (QSingleSignerPtr p : d_) { + signerList.push_back(p->originSingleSigner()); + } + return signerList; +} + QSharedPointer SingleSignerListModel::clone() const { QSharedPointer clone = QSharedPointer(new SingleSignerListModel()); diff --git a/Models/SingleSignerModel.h b/Models/SingleSignerModel.h index 1d38f5b4..3f4d32cd 100644 --- a/Models/SingleSignerModel.h +++ b/Models/SingleSignerModel.h @@ -51,6 +51,8 @@ class QSingleSigner : public QObject { ~QSingleSigner(); + void convert(const nunchuk::SingleSigner& src); + nunchuk::SingleSigner originSingleSigner() const; void setOriginSingleSigner(const nunchuk::SingleSigner signer); @@ -69,7 +71,7 @@ class QSingleSigner : public QObject { QString derivationPath(); void setDerivationPath(const QString& d); - QString masterFingerPrint(); + QString masterFingerPrint() const; void setMasterFingerPrint(const QString& d); QString masterSignerId(); @@ -84,7 +86,7 @@ class QSingleSigner : public QObject { bool signerSigned() const; void setSignerSigned(const bool d); - bool needTopUpXpub() const; + bool needTopUpXpub(); void setNeedTopUpXpub(bool needTopUpXpub); QString message() const; @@ -100,7 +102,7 @@ class QSingleSigner : public QObject { bool checked() const; void setChecked(const bool checked); - bool readyToSign(); + bool readyToSign() const; bool isColdCard(); @@ -114,6 +116,7 @@ class QSingleSigner : public QObject { QString cardId(); void setCardId(const QString &card_id); + nunchuk::SingleSigner singleSigner() const; private: QString xpub_ = ""; QString public_key_ = ""; @@ -230,6 +233,7 @@ class SingleSignerListModel : public QAbstractListModel }; void requestSort(int role, int order); QList fullList() const; + std::vector signers() const; QSharedPointer clone() const; void cleardata(); public slots: diff --git a/Models/TransactionModel.cpp b/Models/TransactionModel.cpp index de2f0780..78f5dfe9 100644 --- a/Models/TransactionModel.cpp +++ b/Models/TransactionModel.cpp @@ -295,6 +295,10 @@ QString Transaction::psbt() const return QString::fromStdString(m_transaction.get_psbt()); } +time_t Transaction::scheduleTime(){ + return m_transaction.get_schedule_time(); +} + bool Transaction::hasChange() const { int index_change = m_transaction.get_change_index(); if(index_change >= 0 && index_change < (int)m_transaction.get_outputs().size()) { @@ -474,8 +478,15 @@ void Transaction::setNunchukTransaction(const nunchuk::Transaction &tx) m_transaction = tx; } -QString Transaction::roomId() const +QString Transaction::roomId() { + if(AppModel::instance()->walletList()){ + QWalletPtr wallet = AppModel::instance()->walletList()->getWalletById(walletId()); + if(wallet){ + m_roomId = wallet.data()->roomId(); + } + } + DBG_INFO << m_roomId; return m_roomId; } @@ -533,6 +544,20 @@ void Transaction::setServerKeyMessage(const QJsonObject &data) } } +QString Transaction::packageFeeRate() +{ + return QString::number((double)m_packageFeeRate/1000, 'f', 2); +} + +void Transaction::setPackageFeeRate(int satvKB) +{ + if (m_packageFeeRate == satvKB) + return; + + m_packageFeeRate = satvKB; + emit packageFeeRateChanged(); +} + QString Transaction::destination() { QString ret = ""; @@ -552,6 +577,19 @@ QString Transaction::destination() return ret; } +bool Transaction::isCpfp() +{ + bool ret = false; + QWarningMessage msg; + nunchuk::Amount packageFeeRate{0}; + if (nunchukiface::instance()->IsCPFP(walletId().toStdString(), nunchukTransaction(), packageFeeRate, msg)) { + ret = true; + } + setPackageFeeRate(packageFeeRate); + DBG_INFO << ret << packageFeeRate; + return ret; +} + TransactionListModel::TransactionListModel() { QQmlEngine::setObjectOwnership(this, QQmlEngine::CppOwnership); } @@ -717,6 +755,7 @@ bool TransactionListModel::contains(const QString &tx_id) void TransactionListModel::requestSort(int role, int order) { + DBG_INFO << role << order; beginResetModel(); if(m_data.count() > 1){ switch (role) { @@ -755,9 +794,11 @@ void TransactionListModel::requestSort(int role, int order) break; case transaction_blocktime_role: { - qSort(m_data.begin(), m_data.end(), sortTXsByBlocktimeAscending); if(Qt::DescendingOrder == order){ - qSort(m_data.begin(), m_data.end(), sortTXsByBlocktimeDescendingSkipZero); + qSort(m_data.begin(), m_data.end(), sortTXsByBlocktimeDescending); + } + else{ + qSort(m_data.begin(), m_data.end(), sortTXsByBlocktimeAscending); } linkingReplacedTransactions(); } @@ -826,17 +867,35 @@ int TransactionListModel::count() const bool sortTXsByBlocktimeAscending(const QTransactionPtr &v1, const QTransactionPtr &v2) { - return v1.data()->blocktime() < v2.data()->blocktime(); + if(v1.data()->blocktime() <= 0 && v2.data()->blocktime() <= 0){ + if(v1.data()->status() == v2.data()->status()){ + return (v1.data()->totalSats() > v2.data()->totalSats()); + } + else if(v1.data()->status() < v2.data()->status()){ + return (true); + } + else{ + return v1.data()->blocktime() < v2.data()->blocktime(); + } + } + else if(v1.data()->blocktime() <= 0 && v2.data()->blocktime() > 0){ return true;} + else if(v1.data()->blocktime() > 0 && v2.data()->blocktime() <= 0){ return false;} + else {return v1.data()->blocktime() < v2.data()->blocktime();} } bool sortTXsByBlocktimeDescending(const QTransactionPtr &v1, const QTransactionPtr &v2) { - return v1.data()->blocktime() > v2.data()->blocktime(); -} - -bool sortTXsByBlocktimeDescendingSkipZero(const QTransactionPtr &v1, const QTransactionPtr &v2) -{ - if(v1.data()->blocktime() <= 0 && v2.data()->blocktime() <= 0){ return v1.data()->blocktime() < v2.data()->blocktime();} + if(v1.data()->blocktime() <= 0 && v2.data()->blocktime() <= 0){ + if(v1.data()->status() == v2.data()->status()){ + return (v1.data()->totalSats() > v2.data()->totalSats()); + } + else if(v1.data()->status() < v2.data()->status()){ + return (true); + } + else{ + return v1.data()->blocktime() < v2.data()->blocktime(); + } + } else if(v1.data()->blocktime() <= 0 && v2.data()->blocktime() > 0){ return true;} else if(v1.data()->blocktime() > 0 && v2.data()->blocktime() <= 0){ return false;} else {return v1.data()->blocktime() > v2.data()->blocktime();} diff --git a/Models/TransactionModel.h b/Models/TransactionModel.h index 302d1fcd..843f81be 100644 --- a/Models/TransactionModel.h +++ b/Models/TransactionModel.h @@ -116,7 +116,9 @@ class Transaction : public QObject { Q_PROPERTY(bool createByMe READ createByMe NOTIFY createByMeChanged) Q_PROPERTY(QString psbt READ psbt NOTIFY psbtChanged) Q_PROPERTY(QString serverKeyMessage READ serverKeyMessage NOTIFY serverKeyMessageChanged) + Q_PROPERTY(QString packageFeeRate READ packageFeeRate NOTIFY packageFeeRateChanged) Q_PROPERTY(QString destination READ destination NOTIFY destinationListChanged) + Q_PROPERTY(bool isCpfp READ isCpfp CONSTANT) public: Transaction(); ~Transaction(); @@ -178,7 +180,7 @@ class Transaction : public QObject { nunchuk::Transaction nunchukTransaction() const; void setNunchukTransaction(const nunchuk::Transaction &tx); - QString roomId() const; + QString roomId(); void setRoomId(const QString &roomId); QString initEventId() const; void setInitEventId(const QString &initEventId); @@ -186,8 +188,12 @@ class Transaction : public QObject { void setCreateByMe(bool createByMe); QString serverKeyMessage() const; void setServerKeyMessage(const QJsonObject &data); + QString packageFeeRate() ; + void setPackageFeeRate(int satvKB); QString destination(); + bool isCpfp(); + time_t scheduleTime(); private: QDestinationListModelPtr m_destinations; QSingleSignerListModelPtr m_signers; @@ -199,6 +205,7 @@ class Transaction : public QObject { QString m_initEventId; bool m_createByMe; QString m_serverKeyMessage; + int m_packageFeeRate {0}; signals: void txidChanged(); @@ -226,6 +233,7 @@ class Transaction : public QObject { void walletIdChanged(); void psbtChanged(); void serverKeyMessageChanged(); + void packageFeeRateChanged(); }; typedef OurSharedPointer QTransactionPtr; @@ -253,6 +261,7 @@ class TransactionListModel : public QAbstractListModel void linkingReplacedTransactions(); void cleardata(); int count() const; + bool contains(const QString &tx_id); enum TransactionRoles { transaction_txid_role, @@ -280,7 +289,6 @@ class TransactionListModel : public QAbstractListModel void countChanged(); private: - bool contains(const QString &tx_id); QList m_data; }; typedef OurSharedPointer QTransactionListModelPtr; diff --git a/Models/UTXOModel.cpp b/Models/UTXOModel.cpp index 90c902e0..a787b3d9 100644 --- a/Models/UTXOModel.cpp +++ b/Models/UTXOModel.cpp @@ -19,7 +19,9 @@ **************************************************************************/ #include "UTXOModel.h" #include "AppSetting.h" +#include "AppModel.h" #include "qUtils.h" +#include #include UTXO::UTXO (const QString &txid, @@ -27,14 +29,16 @@ UTXO::UTXO (const QString &txid, const QString &address, const qint64 amount, const int height, - const QString &memo): + const QString &memo, + const int status): txid_(txid), vout_(vout), address_(address), amount_(amount), height_(height), memo_(memo), - selected_(false) + selected_(false), + status_(status) { QQmlEngine::setObjectOwnership(this, QQmlEngine::CppOwnership); } @@ -45,7 +49,11 @@ UTXO::UTXO() : txid_(""), amount_(0), height_(-1), memo_(""), - selected_(false){} + selected_(false), + status_(0) +{ + +} UTXO::~UTXO() { } @@ -162,6 +170,19 @@ void UTXO::setMemo(const QString &memo) } } +int UTXO::status() const +{ + return status_; +} + +void UTXO::setStatus(int status) +{ + if(status_ != status){ + status_ = status; + emit statusChanged(); + } +} + UTXOListModel::UTXOListModel(){ QQmlEngine::setObjectOwnership(this, QQmlEngine::CppOwnership); } @@ -189,6 +210,14 @@ QVariant UTXOListModel::data(const QModelIndex &index, int role) const{ return d_[index.row()]->selected(); case utxo_memo_role: return d_[index.row()]->memo(); + case utxo_confirmed_role: + { + qint64 conf = 0; + if((int)nunchuk::CoinStatus::CONFIRMED == d_[index.row()]->status()){ + conf = std::max(0, (AppModel::instance()->chainTip() - d_[index.row()]->height())+1); + } + return conf; + } default: return QVariant(); } @@ -211,14 +240,21 @@ QHash UTXOListModel::roleNames() const { roles[utxo_amount_role] = "utxo_amount"; roles[utxo_height_role] = "utxo_height"; roles[utxo_selected_role] = "utxo_selected"; + roles[utxo_confirmed_role] = "utxo_confirmed"; roles[utxo_memo_role] = "utxo_memo"; return roles; } -void UTXOListModel::addUTXO(const QString &txid, const int vout, const QString &address, const qint64 amount, const int height, const QString &memo) +void UTXOListModel::addUTXO(const QString &txid, + const int vout, + const QString &address, + const qint64 amount, + const int height, + const QString &memo, + const int status ) { beginResetModel(); - d_.append(QUTXOPtr(new UTXO(txid, vout, address, amount, height, memo))); + d_.append(QUTXOPtr(new UTXO(txid, vout, address, amount, height, memo, status))); endResetModel(); } diff --git a/Models/UTXOModel.h b/Models/UTXOModel.h index 034c3900..3eed354d 100644 --- a/Models/UTXOModel.h +++ b/Models/UTXOModel.h @@ -35,8 +35,15 @@ class UTXO : public QObject{ Q_PROPERTY(QString scriptPublickey READ scriptPublickey NOTIFY scriptPublickeyChanged) Q_PROPERTY(int height READ height NOTIFY heightChanged) Q_PROPERTY(QString memo READ memo NOTIFY memoChanged) + Q_PROPERTY(QString status READ status NOTIFY statusChanged) public: - UTXO(const QString &txid, const int vout, const QString &address, const qint64 amount, const int height, const QString &memo); + UTXO(const QString &txid, + const int vout, + const QString &address, + const qint64 amount, + const int height, + const QString &memo, + const int status); UTXO(); ~UTXO(); @@ -65,6 +72,9 @@ class UTXO : public QObject{ QString memo() const; void setMemo(const QString &memo); + int status() const; + void setStatus(int status); + private: QString txid_; int vout_; @@ -73,6 +83,7 @@ class UTXO : public QObject{ int height_; QString memo_; bool selected_; + int status_; signals: void txidChanged(); void voutChanged(); @@ -82,6 +93,7 @@ class UTXO : public QObject{ void selectedChanged(); void scriptPublickeyChanged(); void memoChanged(); + void statusChanged(); }; typedef QSharedPointer QUTXOPtr; @@ -101,7 +113,8 @@ class UTXOListModel : public QAbstractListModel const QString& address, const qint64 amount, const int height, - const QString &memo); + const QString &memo, + const int status); QUTXOPtr getUTXOByIndex(const int index); void updateSelected(const QString &txid, const int vout); qint64 getAmount(const QString &txid, const int vout); @@ -115,6 +128,7 @@ class UTXOListModel : public QAbstractListModel utxo_amount_role, utxo_height_role, utxo_selected_role, + utxo_confirmed_role, utxo_memo_role }; diff --git a/Models/WalletModel.cpp b/Models/WalletModel.cpp index 42457e69..8de709bc 100644 --- a/Models/WalletModel.cpp +++ b/Models/WalletModel.cpp @@ -23,70 +23,53 @@ #include "AppModel.h" #include #include "bridgeifaces.h" +#include "Draco.h" Wallet::Wallet() : - m_id(""), - m_m(0), - n_n(0), - m_nShared(0), - m_name(""), m_addressType(QString::number((int)ENUNCHUCK::AddressType::NATIVE_SEGWIT)), // Default is NATIVE_SEGWIT - m_balance(0), m_createDate(QDateTime::currentDateTime()), - m_escrow(false), m_signers(QSingleSignerListModelPtr(new SingleSignerListModel())), m_transactionHistory(QTransactionListModelPtr(new TransactionListModel())), - m_capableCreate(true), - m_description(""), - m_descriptior(""), - m_creationMode((int)CreationMode::CREATE_NEW_WALLET), - m_isSharedWallet(false), - m_roomId(""), - m_initEventId("") + m_creationMode((int)CreationMode::CREATE_NEW_WALLET) { QQmlEngine::setObjectOwnership(this, QQmlEngine::CppOwnership); } -Wallet::Wallet(const QString &pr_id, - const int pr_m, - const int pr_n, - const QString &pr_name, - const QString &pr_addrType, - const qint64 pr_balance, - const QDateTime &pr_createDate, - const bool pr_escrow, - const QSingleSignerListModelPtr& pr_signers, - const QString &pr_description) : - m_id(pr_id), - m_m(pr_m), - n_n(pr_n), - m_nShared(0), - m_name(pr_name), - m_addressType(pr_addrType), - m_balance(pr_balance), - m_createDate(pr_createDate), - m_escrow(pr_escrow), - m_signers(pr_signers), - m_transactionHistory(QTransactionListModelPtr(new TransactionListModel())), - m_address("There is no unused address"), - m_capableCreate(true), - m_description(pr_description), - m_descriptior(""), - m_creationMode((int)CreationMode::CREATE_NEW_WALLET), - m_isSharedWallet(false), - m_roomId(""), - m_initEventId("") +Wallet::Wallet(const nunchuk::Wallet &w) : m_wallet(w) { - m_unUsedAddressList.clear(); - m_usedAddressList.clear(); - m_usedChangeAddressList.clear(); - m_unUsedChangedAddressList.clear(); + QQmlEngine::setObjectOwnership(this, QQmlEngine::CppOwnership); } Wallet::~Wallet(){ } +void Wallet::convert(const Wallet *w) +{ + if (w) { + m_wallet = w->wallet(); + } +} + +void Wallet::convert(const nunchuk::Wallet &w) +{ + setId(QString::fromStdString(w.get_id())); + setM(w.get_m()); + setN(w.get_n()); + setName(QString::fromStdString(w.get_name())); + setAddressType(QString::number((int)w.get_address_type())); + setBalance(w.get_unconfirmed_balance()); + setCreateDate(QDateTime::fromTime_t(w.get_create_date())); + setEscrow(w.is_escrow()); + setGapLimit(w.get_gap_limit()); + setDescription(QString::fromStdString(w.get_description())); + m_signers->cleardata(); + for (nunchuk::SingleSigner signer : w.get_signers()) { + QSingleSignerPtr ret = QSingleSignerPtr(new QSingleSigner(signer)); + m_signers->addSingleSigner(ret); + } +} + QString Wallet::id() const {return m_id;} int Wallet::m() const { return m_m;} @@ -432,6 +415,74 @@ void Wallet::setGapLimit(int gap_limit) } } +nunchuk::Wallet Wallet::wallet() const +{ + return m_wallet; +} + +void Wallet::syncAissistedTxs() +{ + if(isAssistedWallet()){ + QString wallet_id = id(); + QJsonObject data = Draco::instance()->assistedWalletGetListTx(wallet_id); + QJsonArray transactions = data.value("transactions").toArray(); + for(QJsonValue js_value : transactions){ + QJsonObject transaction = js_value.toObject(); + QString status = transaction.value("status").toString(); + QString psbt = transaction.value("psbt").toString(); + QString note = transaction.value("note").toString(); + QString memo = (note != "")? note : "--"; + QString type = transaction.value("type").toString(); + QString transaction_id = transaction.value("transaction_id").toString(); + if (status == "READY_TO_BROADCAST" || status == "PENDING_SIGNATURES" ) { + QWarningMessage _msg; + QTransactionPtr tran = bridge::nunchukImportPsbt(wallet_id, psbt, _msg); + if(tran && (int)EWARNING::WarningType::NONE_MSG == _msg.type()){ + if(transactionHistory()){ + QTransactionPtr tx = transactionHistory()->getTransactionByTxid(transaction_id); + if(tx && 0 != QString::compare(memo, tx.data()->memo(), Qt::CaseInsensitive)){ + bridge::nunchukUpdateTransactionMemo(wallet_id, transaction_id, memo); + } + } + long int broadcast_time_milis = static_cast(transaction.value("broadcast_time_milis").toDouble()); + // honey badger feature: schedule broadcast + long int current_time_stamp_milis = static_cast(std::time(nullptr)) * 1000; + if(type == "SCHEDULED" && broadcast_time_milis > current_time_stamp_milis) { + bridge::nunchukUpdateTransactionSchedule(wallet_id, transaction_id, broadcast_time_milis/1000,_msg); + } + } + } + } + //Remove cancelled txs + syncAissistedCancelledTxs(); + } +} + +void Wallet::syncAissistedCancelledTxs() +{ + if(isAssistedWallet()){ + int offset = 0; + const int limit = 10; + QString wallet_id = id(); + while (true) { + QJsonObject data = Draco::instance()->assistedWalletDeleteListTx(wallet_id, offset, limit); + QJsonArray transactions = data.value("transactions").toArray(); + for (QJsonValue js_value : transactions) { + QJsonObject transaction = js_value.toObject(); + QString wallet_local_id = transaction.value("wallet_local_id").toString(); + QString transaction_id = transaction.value("transaction_id").toString(); + if(transactionHistory() && transactionHistory()->contains(transaction_id)){ + bridge::nunchukDeleteTransaction(wallet_local_id, transaction_id); + } + } + if (transactions.size() == 0 || transactions.size() < limit) { + return; // exit while loop + } + offset += transactions.size(); + } + } +} + WalletListModel::WalletListModel(){ QQmlEngine::setObjectOwnership(this, QQmlEngine::CppOwnership); } @@ -515,24 +566,6 @@ QHash WalletListModel::roleNames() const{ return roles; } -void WalletListModel::addWallet(const QString &pr_id, - const int pr_m, - const int pr_n, - const QString &pr_name, - const QString &pr_addrType, - const qint64 pr_balance, - const QDateTime &pr_createDate, - const bool pr_escrow, - QSingleSignerListModelPtr pr_signers, - const QString &pr_description) -{ - beginResetModel(); - if(!containsId(pr_id)){ - d_.append(QWalletPtr(new Wallet(pr_id, pr_m, pr_n, pr_name, pr_addrType, pr_balance, pr_createDate, pr_escrow, pr_signers, pr_description))); - } - endResetModel(); -} - void WalletListModel::addWallet(const QWalletPtr &wallet) { if(wallet && !containsId(wallet.data()->id())){ @@ -571,6 +604,7 @@ void WalletListModel::addSharedWallet(const QWalletPtr &wallet) void WalletListModel::updateBalance(const QString &walletId, const qint64 balance) { + DBG_INFO << walletId << balance; for (int i = 0; i < d_.count(); i++) { if(d_.at(i).data() && 0 == QString::compare(walletId, d_.at(i)->id(), Qt::CaseInsensitive)){ d_.at(i)->setBalance(balance); @@ -746,7 +780,7 @@ void WalletListModel::requestSort(int role, int order) beginResetModel(); if(d_.count() > 1){ switch (role) { - case wallet_Name_Role: + case wallet_createDate_Role: { if(Qt::DescendingOrder == order){ qSort(d_.begin(), d_.end(), sortWalletByNameDescending); @@ -812,10 +846,10 @@ void WalletListModel::cleardata() bool sortWalletByNameAscending(const QWalletPtr &v1, const QWalletPtr &v2) { - return (QString::compare((v1.data()->name()), (v2.data()->name())) < 0); + return v1.data()->createDateDateTime() < v2.data()->createDateDateTime(); } bool sortWalletByNameDescending(const QWalletPtr &v1, const QWalletPtr &v2) { - return (QString::compare((v1.data()->name()), (v2.data()->name())) > 0); + return v1.data()->createDateDateTime() > v2.data()->createDateDateTime(); } diff --git a/Models/WalletModel.h b/Models/WalletModel.h index 431a03d6..1136c878 100644 --- a/Models/WalletModel.h +++ b/Models/WalletModel.h @@ -58,16 +58,7 @@ class Wallet : public QObject Q_PROPERTY(int gapLimit READ gapLimit NOTIFY gapLimitChanged) public: Wallet(); - Wallet(const QString &pr_id, - const int pr_m, - const int pr_n, - const QString &pr_name, - const QString &pr_addrType, - const qint64 pr_balance, - const QDateTime &pr_createDate, - const bool pr_escrow, - const QSingleSignerListModelPtr &pr_signers, - const QString &pr_description); + Wallet(const nunchuk::Wallet &w); ~Wallet(); enum class CreationMode : int { CREATE_NEW_WALLET, @@ -77,6 +68,9 @@ class Wallet : public QObject CREATE_BY_IMPORT_QRCODE }; + void convert(const Wallet *w); + void convert(const nunchuk::Wallet &w); + QString id() const; int m() const; int n() ; @@ -138,35 +132,40 @@ class Wallet : public QObject bool isAssistedWallet() const; int gapLimit() const; void setGapLimit(int gap_limit); + nunchuk::Wallet wallet() const; + + //Assisted + void syncAissistedTxs(); + void syncAissistedCancelledTxs(); private: - QString m_id; - int m_m; - int n_n; - int m_nShared; - QString m_name; - QString m_addressType; - qint64 m_balance; - QDateTime m_createDate; - bool m_escrow; + QString m_id {}; + int m_m {}; + int n_n {}; + int m_nShared {}; + QString m_name {}; + QString m_addressType {}; + qint64 m_balance {}; + QDateTime m_createDate {}; + bool m_escrow {}; QSingleSignerListModelPtr m_signers; QTransactionListModelPtr m_transactionHistory; // Additional member QString m_address; - QStringList m_usedAddressList; - QStringList m_unUsedAddressList; - QStringList m_usedChangeAddressList; - QStringList m_unUsedChangedAddressList; + QStringList m_usedAddressList {}; + QStringList m_unUsedAddressList {}; + QStringList m_usedChangeAddressList {}; + QStringList m_unUsedChangedAddressList {}; // capable to create wallet - bool m_capableCreate; - QString m_description; - QString m_descriptior; - int m_creationMode; - bool m_isSharedWallet; - QString m_roomId; - QString m_initEventId; + bool m_capableCreate {true}; + QString m_description {}; + QString m_descriptior {}; + int m_creationMode {}; + bool m_isSharedWallet {}; + QString m_roomId {}; + QString m_initEventId {}; int m_gapLimit {0}; - + nunchuk::Wallet m_wallet {false}; signals: void idChanged(); void mChanged(); @@ -195,7 +194,7 @@ class Wallet : public QObject void isAssistedWalletChanged(); void gapLimitChanged(); }; -typedef QSharedPointer QWalletPtr; +typedef OurSharedPointer QWalletPtr; bool sortWalletByNameAscending(const QWalletPtr &v1, const QWalletPtr &v2); bool sortWalletByNameDescending(const QWalletPtr &v1, const QWalletPtr &v2); @@ -210,16 +209,6 @@ class WalletListModel : public QAbstractListModel QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole); QHash roleNames() const; - void addWallet(const QString& pr_id, - const int pr_m, - const int pr_n, - const QString& pr_name, - const QString& pr_addrType, - const qint64 pr_balance, - const QDateTime& pr_createDate, - const bool pr_escrow, - QSingleSignerListModelPtr pr_signers, - const QString &pr_description); void addWallet(const QWalletPtr &wallet); void replaceWallet(const QWalletPtr &wallet); void addSharedWallet(const QWalletPtr &wallet); @@ -265,6 +254,6 @@ class WalletListModel : public QAbstractListModel private: QList d_; }; -typedef QSharedPointer QWalletListModelPtr; +typedef OurSharedPointer QWalletListModelPtr; #endif // WALLETLISTMODEL_H diff --git a/Models/Worker.cpp b/Models/Worker.cpp index dec9e419..f66656c7 100644 --- a/Models/Worker.cpp +++ b/Models/Worker.cpp @@ -24,6 +24,7 @@ #include "QQuickViewer.h" #include "Draco.h" #include "localization/STR_CPP.h" +#include "Chats/QUserWallets.h" Worker *Worker::mInstance = NULL; Worker::Worker() @@ -315,7 +316,10 @@ void Worker::slotStartBalanceChanged(const QString &id, if(AppModel::instance()->walletList()){ AppModel::instance()->walletList()->updateBalance(id, balance); } -// emit finishBalanceChanged(id, balance); //FIXME FOR IMPROVEMENT + if(AppModel::instance()->walletInfo() && 0 == QString::compare(id, AppModel::instance()->walletInfo()->id(), Qt::CaseInsensitive)){ + AppModel::instance()->walletInfo()->setBalance(balance); + } + emit finishBalanceChanged(id, balance); } void Worker::slotStartTransactionChanged(const QString &tx_id, @@ -374,12 +378,10 @@ void Worker::slotStartGetUnusedAddresses(const QString wallet_id) void Worker::slotStartGetTransactionHistory(const QString wallet_id) { - qApp->setOverrideCursor(Qt::WaitCursor); if(wallet_id != ""){ std::vector trans_result = bridge::nunchukGetOriginTransactionHistory(wallet_id); emit finishGetTransactionHistory(wallet_id, trans_result); } - qApp->restoreOverrideCursor(); } void Worker::slotStartGetEstimatedFee() @@ -462,6 +464,26 @@ void Worker::slotStartMultiDeviceSync(const bool state) } } +void Worker::slotStartReloadUserDb() +{ + FuncTime f(__PRETTY_FUNCTION__); + QWarningMessage msg; + std::vector wallets = bridge::nunchukGetOriginWallets(msg); + if((int)EWARNING::WarningType::NONE_MSG == msg.type()){ + emit finishReloadWallets(wallets); + } + + std::vector masters = bridge::nunchukGetOriginMasterSigners(msg); + if((int)EWARNING::WarningType::NONE_MSG == msg.type()){ + emit finishReloadMasterSigners(masters); + } + + std::vector remotes = bridge::nunchukGetOriginRemoteSigners(msg); + if((int)EWARNING::WarningType::NONE_MSG == msg.type()){ + emit finishReloadRemoteSigners(remotes); + } +} + void Worker::slotStartReloadWallets() { QWarningMessage msg; @@ -492,6 +514,9 @@ void Worker::slotStartReloadRemoteSigners() void Worker::slotStartSyncWalletDb(const QString &wallet_id) { if(wallet_id != ""){ + std::vector trans_result = bridge::nunchukGetOriginTransactionHistory(wallet_id); + emit finishGetTransactionHistory(wallet_id, trans_result); + QStringList used_addr = bridge::nunchukGetUsedAddresses(wallet_id, false); QStringList used_change_addr = bridge::nunchukGetUsedAddresses(wallet_id, true); @@ -514,9 +539,13 @@ void Worker::slotStartSyncWalletDb(const QString &wallet_id) wallet.data()->setUsedChangeAddressList(used_change_addr); wallet.data()->setunUsedAddressList(unused_addr); wallet.data()->setUnUsedChangeddAddressList(unsued_chabge_addr); + if(wallet && wallet.data()->isAssistedWallet()){ + QtConcurrent::run([wallet]() { + wallet.data()->syncAissistedTxs(); + AppModel::instance()->startGetTransactionHistory(wallet.data()->id()); + }); + } } - std::vector trans_result = bridge::nunchukGetOriginTransactionHistory(wallet_id); - emit finishGetTransactionHistory(wallet_id, trans_result); } emit finishSyncWalletDb(wallet_id); } @@ -627,6 +656,8 @@ Controller::Controller() { connect(this, &Controller::startMultiDeviceSync, worker, &Worker::slotStartMultiDeviceSync, Qt::QueuedConnection); + connect(this, &Controller::startReloadUserDb, worker, &Worker::slotStartReloadUserDb, Qt::QueuedConnection); + connect(this, &Controller::startReloadWallets, worker, &Worker::slotStartReloadWallets, Qt::QueuedConnection); connect(worker, &Worker::finishReloadWallets, this, &Controller::slotFinishReloadWallets, Qt::QueuedConnection); @@ -645,7 +676,7 @@ Controller::Controller() { Controller::~Controller() { if(workerThread.isRunning()){ workerThread.quit(); - workerThread.wait(); + workerThread.wait(5); } this->disconnect(); } @@ -674,13 +705,19 @@ void Controller::slotFinishCreateMasterSigner(const QMasterSignerPtr ret, QMasterSignerPtr newsigner = AppModel::instance()->masterSignerList()->getMasterSignerByXfp(ret.data()->fingerPrint()); AppModel::instance()->setMasterSignerInfo(newsigner); } - if(QQuickViewer::instance()->getCurrentStates().last() == E::STATE_ID_SCR_ADD_HARDWARE_SIGNER){ + int last = QQuickViewer::instance()->getCurrentStates().last(); + if(last == E::STATE_ID_SCR_ADD_HARDWARE_SIGNER){ QQuickViewer::instance()->sendEvent(E::EVT_ADD_MASTER_SIGNER_RESULT); - } - else{ + } else if (last == E::STATE_ID_SCR_ADD_HARDWARE_SIGNER_TO_WALLET){ QQuickViewer::instance()->sendEvent(E::EVT_ADD_HARDWARE_SIGNER_TO_WALLET_MASTER_SIGNER_RESULT); + } else if (last == E::STATE_ID_SCR_ADD_LEDGER || + last == E::STATE_ID_SCR_ADD_TREZOR || + last == E::STATE_ID_SCR_ADD_COLDCARD){ + QUserWallets::instance()->addKeyRequested(); } - if (AppModel::instance()->addSignerWizard() != 3) { + + if (last == E::STATE_ID_SCR_ADD_HARDWARE_SIGNER || + last == E::STATE_ID_SCR_ADD_HARDWARE_SIGNER_TO_WALLET) { AppModel::instance()->showToast(0, STR_CPP_057, EWARNING::WarningType::SUCCESS_MSG, @@ -692,6 +729,12 @@ void Controller::slotFinishCreateMasterSigner(const QMasterSignerPtr ret, what, (EWARNING::WarningType)type, STR_CPP_060); + int last = QQuickViewer::instance()->getCurrentStates().last(); + if (last == E::STATE_ID_SCR_ADD_LEDGER || + last == E::STATE_ID_SCR_ADD_TREZOR || + last == E::STATE_ID_SCR_ADD_COLDCARD){ + QQuickViewer::instance()->sendEvent(E::EVT_ONLINE_ONS_CLOSE_REQUEST); + } } AppModel::instance()->setAddSignerStep(-1); } @@ -783,7 +826,10 @@ void Controller::slotFinishSigningTransaction(const QString &walletId, QString tx_id = QString::fromStdString(result.get_txid()); QWalletPtr wallet = AppModel::instance()->walletList()->getWalletById(walletId); if(wallet && wallet->isAssistedWallet()){ - QJsonObject data = Draco::instance()->assistedWalletSignTx(walletId,tx_id,QString::fromStdString(result.get_psbt()),QString::fromStdString(result.get_memo())); + QJsonObject data = Draco::instance()->assistedWalletSignTx(walletId, + tx_id, + QString::fromStdString(result.get_psbt()), + QString::fromStdString(result.get_memo())); QJsonObject transaction = data.value("transaction").toObject(); QString status = transaction.value("status").toString(); QString psbt = transaction.value("psbt").toString(); @@ -1006,26 +1052,12 @@ void Controller::slotFinishCreateWallet(nunchuk::Wallet ret, int type, int code) { + DBG_INFO << "walletListCurrentIndex"; if(type != (int)EWARNING::WarningType::EXCEPTION_MSG){ - QSingleSignerListModelPtr signersAssinged( new SingleSignerListModel); - for (nunchuk::SingleSigner signer : ret.get_signers()) { - QSingleSignerPtr ret = QSingleSignerPtr(new QSingleSigner(signer)); - signersAssinged.data()->addSingleSigner(ret); - } - QWalletPtr wallet_result = QWalletPtr(new Wallet(QString::fromStdString(ret.get_id()), - ret.get_m(), - ret.get_n(), - QString::fromStdString(ret.get_name()), - QString::number((int)ret.get_address_type()), - ret.get_unconfirmed_balance(), - QDateTime::fromTime_t(ret.get_create_date()), - ret.is_escrow(), - signersAssinged, - QString::fromStdString(ret.get_description()))); QString wallet_id = QString::fromStdString(ret.get_id()); - AppModel::instance()->walletList()->addWallet(wallet_result); + AppModel::instance()->walletList()->addWallet(bridge::convertWallet(ret)); AppModel::instance()->resetSignersChecked(); - AppModel::instance()->walletList()->requestSort(WalletListModel::WalletRoles::wallet_Name_Role, Qt::AscendingOrder); + AppModel::instance()->walletList()->requestSort(WalletListModel::WalletRoles::wallet_createDate_Role, Qt::AscendingOrder); int index = AppModel::instance()->walletList()->getWalletIndexById(wallet_id); if(-1 != index){ AppModel::instance()->setWalletListCurrentIndex(index); @@ -1055,11 +1087,7 @@ void Controller::slotFinishBackupWallet(QString what, void Controller::slotFinishBalanceChanged(const QString &id, const qint64 balance) { - if(AppModel::instance()->walletList()){ - AppModel::instance()->walletList()->updateBalance(id, balance); - AppModel::instance()->startGetUsedAddresses(id); - AppModel::instance()->startGetUnusedAddresses(id); - } + startSyncWalletDb(id); } void Controller::slotFinishTransactionChanged(const QString &tx_id, @@ -1122,7 +1150,6 @@ void Controller::slotFinishGetUnusedAddresses(const QString& wallet_id, void Controller::slotFinishGetTransactionHistory(const QString wallet_id, std::vector ret) { - qApp->setOverrideCursor(Qt::WaitCursor); QWalletPtr wallet = NULL; if(AppModel::instance()->walletInfo()){ if(0 == QString::compare(AppModel::instance()->walletInfo()->id(), wallet_id, Qt::CaseInsensitive)){ @@ -1139,11 +1166,11 @@ void Controller::slotFinishGetTransactionHistory(const QString wallet_id, for (auto it = ret.begin(); it != ret.end(); ++it) { const nunchuk::Transaction &element = *it; QTransactionPtr tx = bridge::convertTransaction(element, wallet_id); - trans_ret.data()->addTransaction(tx); + wallet.data()->transactionHistory()->updateTransaction(tx.data()->txid(), tx); } - wallet.data()->setTransactionHistory(trans_ret); + wallet.data()->transactionHistory()->requestSort(TransactionListModel::TransactionRoles::transaction_blocktime_role, Qt::DescendingOrder); + emit wallet.data()->transactionHistoryChanged(); } - qApp->restoreOverrideCursor(); emit finishedGetTransactionHistory(); } @@ -1263,14 +1290,18 @@ void Controller::slotFinishReloadWallets(std::vector wallets) QWalletListModelPtr ret = bridge::nunchukConvertWallets(wallets); if(ret){ AppModel::instance()->setWalletList(ret); - if(ret->rowCount() > 0){ + if(-1 == AppModel::instance()->walletListCurrentIndex() && ret->rowCount() > 0){ QString lastWalletId = bridge::nunchukGetSelectedWallet(); int lastIndex = -1; if(lastWalletId != ""){ lastIndex = AppModel::instance()->walletList()->getWalletIndexById(lastWalletId); } - AppModel::instance()->setWalletListCurrentIndex(lastIndex); + else{ + lastIndex = 0; + } + AppModel::instance()->setWalletListCurrentIndex(lastIndex == -1 ? 0 : lastIndex); } + AppModel::instance()->walletListCurrentIndexChanged(); } if(ONLINE_MODE == bridge::nunchukCurrentMode()){ if(CLIENT_INSTANCE->isNunchukLoggedIn() && CLIENT_INSTANCE->isMatrixLoggedIn()){ diff --git a/Models/Worker.h b/Models/Worker.h index d3630350..d9d26faf 100644 --- a/Models/Worker.h +++ b/Models/Worker.h @@ -122,6 +122,8 @@ public slots: void slotStartMultiDeviceSync(const bool state); + void slotStartReloadUserDb(); + void slotStartReloadWallets(); void slotStartReloadMasterSigners(); @@ -408,6 +410,8 @@ public slots: void startRemoveAllSigners(); + void startReloadUserDb(); + void startReloadWallets(); void startReloadMasterSigners(); diff --git a/QAppEngine/QOutlog/QOutlog.h b/QAppEngine/QOutlog/QOutlog.h index 0ba7703e..9b001509 100644 --- a/QAppEngine/QOutlog/QOutlog.h +++ b/QAppEngine/QOutlog/QOutlog.h @@ -37,6 +37,7 @@ #include #include #include +#include #include enum class LOG_LEVEL : int @@ -194,7 +195,11 @@ class QOutlog inline QOutlog &operator<<(std::nullptr_t) { mStream << "(nullptr)" << ' ';; return *this; } inline QOutlog &operator<<(const void * t) { mStream << t << ' '; return *this; } - inline QOutlog &operator<<(const QJsonObject & t) { return operator<<(t.toVariantMap()); } + inline QOutlog &operator<<(const QJsonObject & t) { + QJsonDocument doc(t); + QString strJson(doc.toJson(QJsonDocument::Compact)); + return operator<<(strJson); + } inline QOutlog &operator<<(QUrl t) { mStream << t.toString() << ' '; return *this; } template @@ -254,7 +259,9 @@ class FuncTime ~FuncTime() { +#ifndef RELEASE_MODE DBG_INFO << QString("%1 takes %2 ms").arg(mFunc).arg(mTime.elapsed()); +#endif } private: QString mFunc; diff --git a/QAppEngine/QQuickViewer/Common/QCommonDefines.h b/QAppEngine/QQuickViewer/Common/QCommonDefines.h index 923f01c7..308c57c9 100644 --- a/QAppEngine/QQuickViewer/Common/QCommonDefines.h +++ b/QAppEngine/QQuickViewer/Common/QCommonDefines.h @@ -36,5 +36,22 @@ #define JS_POPUPS_TRANSITION_FUNCTION "load_Popup" #define JS_TOASTS_TRANSITION_FUNCTION "load_Toast" +#define DECLARE_PROPERTY(TYPE, NAME, WRITE_NAME, READ_NAME) \ +private: \ + Q_PROPERTY(TYPE q##NAME READ get##NAME WRITE set##NAME NOTIFY NAME##Changed) \ + TYPE m##NAME {}; \ +Q_SIGNALS: void NAME##Changed(); \ +public: \ + TYPE get##NAME() { \ + READ_NAME \ + return m##NAME; \ + } \ + void set##NAME(TYPE val) { \ + if (m##NAME == val) \ + return; \ + m##NAME = val; \ + emit NAME##Changed(); \ + WRITE_NAME \ + } \ #endif // COMMONDEFINES_H diff --git a/QAppEngine/QQuickViewer/QQuickViewer.cpp b/QAppEngine/QQuickViewer/QQuickViewer.cpp index de78769d..c2d8cbfa 100644 --- a/QAppEngine/QQuickViewer/QQuickViewer.cpp +++ b/QAppEngine/QQuickViewer/QQuickViewer.cpp @@ -33,7 +33,7 @@ QQuickViewer::QQuickViewer() : m_viewer(new QQuickView()), m_scrMng(NULL), m_pop m_PopupTriger.clear(); } QQmlEngine::setObjectOwnership(this, QQmlEngine::CppOwnership); - connect(this, &QQuickViewer::signalNotifySendEvent, this, &QQuickViewer::sendEvent); + connect(this, &QQuickViewer::signalNotifySendEvent, this, &QQuickViewer::sendEvent, Qt::QueuedConnection); } QQuickViewer::~QQuickViewer() diff --git a/Qml/Components/customizes/Buttons/QAssistedWalletDelegate.qml b/Qml/Components/customizes/Buttons/QAssistedWalletDelegate.qml new file mode 100644 index 00000000..ccef2f50 --- /dev/null +++ b/Qml/Components/customizes/Buttons/QAssistedWalletDelegate.qml @@ -0,0 +1,124 @@ +/************************************************************************** + * This file is part of the Nunchuk software (https://nunchuk.io/) * + * Copyright (C) 2020-2022 Enigmo * + * Copyright (C) 2022 Nunchuk * + * * + * This program is free software; you can redistribute it and/or * + * modify it under the terms of the GNU General Public License * + * as published by the Free Software Foundation; either version 3 * + * of the License, or (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + * * + **************************************************************************/ +import QtQuick 2.4 +import QtGraphicalEffects 1.0 +import DataPool 1.0 +import "../../origins" +import "../../customizes/Texts" +import "../../customizes/Buttons" +import "../../../../localization/STR_QML.js" as STR + +QLinearGradient { + id: wldlg + width: 304 + height: 92 + property string walletName : "Name" + property string walletBalance : "0.0000000" + property string walletCurrency : "0.0000000" + property string walletM: "0" + property string walletN: "0" + Column{ + anchors { + verticalCenter: parent.verticalCenter + left: parent.left + leftMargin: 24 + } + QLato{ + font.weight: Font.Bold + text: walletName + color: "#FFFFFF" + } + QLato{ + font.weight: Font.Bold + text: walletBalance + RoomWalletData.unitValue + color: "#FFFFFF" + } + QLato{ + text: qsTr("(%1 %2)").arg(AppSetting.currency).arg(walletCurrency) + color: "#FFFFFF" + } + } + + Item { + width: 80 + height: childrenRect.height + anchors { + right: parent.right + rightMargin: 24 + bottom: parent.bottom + bottomMargin: 24 + } + Column { + width: parent.width + spacing: 4 + Item { + width: parent.width + height: 16 + Rectangle{ + width: 70 + height: parent.height + radius: 20 + color: "#EAEAEA" + anchors.verticalCenter: parent.verticalCenter + anchors.right: parent.right + Row { + anchors.centerIn: parent + spacing: 4 + QImage { + width: 12 + height: 12 + source: "qrc:/Images/Images/OnlineMode/Joint wallet_031F2B.png" + } + QText{ + font.family: "Lato" + font.pixelSize: 10 + color: "#031F2B" + text: STR.STR_QML_679 + font.weight: Font.Bold + anchors.verticalCenter: parent.verticalCenter + } + } + } + } + Rectangle { + width: parent.width + height: 16 + radius: 20 + color: "#EAEAEA" + QText { + anchors.centerIn: parent + text: walletN === "1" ? STR.STR_QML_070 : qsTr("%1/%2 %3").arg(walletM).arg(walletN).arg(STR.STR_QML_069); + color: "#031F2B" + font.weight: Font.Bold + font.pixelSize: 10 + } + } + } + } + + + signal buttonClicked() + MouseArea { + id: walletmouse + hoverEnabled: true + anchors.fill: parent + onClicked: wldlg.buttonClicked() + } +} diff --git a/Qml/Components/customizes/Buttons/QCheckBoxButton.qml b/Qml/Components/customizes/Buttons/QCheckBoxButton.qml new file mode 100644 index 00000000..5cb9e698 --- /dev/null +++ b/Qml/Components/customizes/Buttons/QCheckBoxButton.qml @@ -0,0 +1,54 @@ +/************************************************************************** + * This file is part of the Nunchuk software (https://nunchuk.io/) * + * Copyright (C) 2020-2022 Enigmo * + * Copyright (C) 2022 Nunchuk * + * * + * This program is free software; you can redistribute it and/or * + * modify it under the terms of the GNU General Public License * + * as published by the Free Software Foundation; either version 3 * + * of the License, or (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + * * + **************************************************************************/ +import QtQuick 2.4 +import QtGraphicalEffects 1.0 +import "../../origins" +import "../../customizes/Texts" + +Item { + width: 539 + height: 24 + property string label: "" + property bool checked: false + QLato { + id: text + text: label + font.weight: Font.Bold + anchors.verticalCenter: parent.verticalCenter + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + } + QImage { + id: _check + width: 24 + height: 24 + anchors.verticalCenter: text.verticalCenter + anchors.right: parent.right + source: checked ? "qrc:/Images/Images/checkbox-checked-dark.svg" : "qrc:/Images/Images/checkbox-dark.svg" + } + MouseArea { + id: mouse + anchors.fill: _check + hoverEnabled: true + cursorShape: Qt.PointingHandCursor + onClicked: { checked = !checked; buttonClicked() } + } + signal buttonClicked() +} diff --git a/Qml/Components/customizes/Buttons/QLinearGradient.qml b/Qml/Components/customizes/Buttons/QLinearGradient.qml new file mode 100644 index 00000000..a819f75d --- /dev/null +++ b/Qml/Components/customizes/Buttons/QLinearGradient.qml @@ -0,0 +1,28 @@ +import QtQuick 2.0 +import QtGraphicalEffects 1.0 + +Item { + LinearGradient { + id: _area + visible: false + height: parent.height + width: parent.width + start: Qt.point(0, 0) + end: Qt.point(parent.width, 0) + gradient: Gradient { + GradientStop { position: 0.0; color: "#2F766D" } + GradientStop { position: 1.0; color: "#1C4A21" } + } + } + Rectangle { + id: mask + anchors.fill: parent + visible: false + radius: 12 + } + OpacityMask { + anchors.fill: parent + source: _area + maskSource: mask + } +} diff --git a/Qml/Components/customizes/Buttons/QRadioButtonTypeC.qml b/Qml/Components/customizes/Buttons/QRadioButtonTypeC.qml index d499adcd..a8cdc55d 100644 --- a/Qml/Components/customizes/Buttons/QRadioButtonTypeC.qml +++ b/Qml/Components/customizes/Buttons/QRadioButtonTypeC.qml @@ -36,7 +36,7 @@ Row { id: icon width: 24 height: 24 - source: selected ? "qrc:/Images/Images/RadioEnabled.png" : "qrc:/Images/Images/RadioDeselected.png" + source: selected ? "qrc:/Images/Images/radio-selected-dark.svg" : "qrc:/Images/Images/radio-dark.svg" anchors.verticalCenter: parent.verticalCenter MouseArea { id: mouse diff --git a/Qml/Components/customizes/Buttons/QRadioButtonTypeD.qml b/Qml/Components/customizes/Buttons/QRadioButtonTypeD.qml index d2737877..9ac077fe 100644 --- a/Qml/Components/customizes/Buttons/QRadioButtonTypeD.qml +++ b/Qml/Components/customizes/Buttons/QRadioButtonTypeD.qml @@ -27,8 +27,8 @@ Row { property string labelTop: "" property string labelCenter: "" property string labelBottom: "" - property string walletType: "" - property string walletIcon: "" + property string type: "" + property string icon: "" signal buttonClicked() spacing: 12 Column { @@ -52,10 +52,10 @@ Row { color: "#EAEAEA" } QBadge { - text: walletType - icon: walletIcon + text: type + icon: icon color: "#EAEAEA" - visible: walletIcon != "" + visible: icon !== "" } } } diff --git a/Qml/Components/customizes/Buttons/QRadioButtonTypeE.qml b/Qml/Components/customizes/Buttons/QRadioButtonTypeE.qml new file mode 100644 index 00000000..1eab770c --- /dev/null +++ b/Qml/Components/customizes/Buttons/QRadioButtonTypeE.qml @@ -0,0 +1,72 @@ +/************************************************************************** + * This file is part of the Nunchuk software (https://nunchuk.io/) * + * Copyright (C) 2020-2022 Enigmo * + * Copyright (C) 2022 Nunchuk * + * * + * This program is free software; you can redistribute it and/or * + * modify it under the terms of the GNU General Public License * + * as published by the Free Software Foundation; either version 3 * + * of the License, or (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + * * + **************************************************************************/ +import QtQuick 2.4 +import "../../origins" +import "../../customizes/Texts" + +Rectangle { + id: radioRoot + property bool selected: false + property string label: "" + property string fontFamily: "Lato" + property string textBadge: "" + property int fontPixelSize: 14 + property int fontWeight: Font.Bold + signal buttonClicked() + border.width: 2 + border.color: selected ? "#000000" : "#DEDEDE" + radius: 12 + Row { + anchors.fill: parent + anchors.margins: 20 + spacing: 8 + QImage { + id: icon + width: 24 + height: 24 + source: radioRoot.selected ? "qrc:/Images/Images/radio-selected-dark.svg" : "qrc:/Images/Images/radio-dark.svg" + anchors.verticalCenter: parent.verticalCenter + MouseArea { + id: mouse + anchors.fill: parent + hoverEnabled: true + cursorShape: Qt.PointingHandCursor + onClicked: { buttonClicked() } + } + } + QText { + id: text + text: label + font.family: fontFamily + font.pixelSize: fontPixelSize + font.weight: fontWeight + color: "#031F2B" + anchors.verticalCenter: parent.verticalCenter + width: paintedWidth + } + QBadge { + text: textBadge + color: "#EAEAEA" + visible: textBadge !== "" + } + } +} + + diff --git a/Qml/Components/customizes/Buttons/QRadioButtonTypeF.qml b/Qml/Components/customizes/Buttons/QRadioButtonTypeF.qml new file mode 100644 index 00000000..9a0c2c93 --- /dev/null +++ b/Qml/Components/customizes/Buttons/QRadioButtonTypeF.qml @@ -0,0 +1,73 @@ +/************************************************************************** + * This file is part of the Nunchuk software (https://nunchuk.io/) * + * Copyright (C) 2020-2022 Enigmo * + * Copyright (C) 2022 Nunchuk * + * * + * This program is free software; you can redistribute it and/or * + * modify it under the terms of the GNU General Public License * + * as published by the Free Software Foundation; either version 3 * + * of the License, or (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + * * + **************************************************************************/ +import QtQuick 2.4 +import "../../origins" +import "../../customizes/Texts" + +Rectangle { + id: radioRoot + property bool selected: false + property string labelTop: "" + property string labelBottom: "" + property int labelMaxWidth: 467 + signal buttonClicked() + border.width: 2 + border.color: selected ? "#000000" : "#DEDEDE" + radius: 12 + + Row { + anchors.fill: parent + anchors.margins: 18 + spacing: 12 + QImage { + id: icon + width: 24 + height: 24 + source: selected ? "qrc:/Images/Images/radio-selected-dark.svg" : "qrc:/Images/Images/radio-dark.svg" + anchors.verticalCenter: _top.verticalCenter + MouseArea { + id: mouse + anchors.fill: parent + hoverEnabled: true + cursorShape: Qt.PointingHandCursor + onClicked: { buttonClicked() } + } + } + Column { + id: info + spacing: 4 + QLato { + id: _top + text: labelTop + font.weight: Font.DemiBold + width: Math.min(labelMaxWidth, implicitWidth) + wrapMode: Text.WordWrap + } + QLato { + text: labelBottom + width: Math.min(labelMaxWidth, implicitWidth) + visible: labelBottom != "" + wrapMode: Text.WordWrap + lineHeight: 28 + lineHeightMode: Text.FixedHeight + } + } + } +} diff --git a/Qml/Components/customizes/Chats/QConversationInfo.qml b/Qml/Components/customizes/Chats/QConversationInfo.qml index 51e98a53..403367f2 100644 --- a/Qml/Components/customizes/Chats/QConversationInfo.qml +++ b/Qml/Components/customizes/Chats/QConversationInfo.qml @@ -361,13 +361,13 @@ Rectangle { height: 80 anchors.horizontalCenter: parent.horizontalCenter readonly property QtObject txObject: model.room_tx_transaction - property int tx_status: txObject ? txObject.status : -1 - property string tx_id: txObject ? txObject.txid : "" - property string to_addr: txObject ? txObject.destinationList.reciever : "" - property string tx_amount: txObject ? txObject.total + RoomWalletData.unitValue : "" - property int tx_m: txObject ? txObject.m : 0 - property int tx_signeds:txObject ? txObject.numberSigned : 0 - property int tx_pending_signatures: Math.max(0, iteminit.tx_m - iteminit.tx_signeds) + property int tx_status : txObject ? txObject.status : -1 + property string tx_id : txObject ? txObject.txid : "" + property string to_addr : txObject ? txObject.destinationList.reciever : "" + property string tx_amount : txObject ? txObject.total + RoomWalletData.unitValue : "" + property int tx_m : txObject ? txObject.m : 0 + property int tx_signeds : txObject ? txObject.numberSigned : 0 + property int tx_pending_signatures: Math.max(0, iteminit.tx_m - iteminit.tx_signeds) Rectangle { anchors.fill: parent diff --git a/Qml/Components/customizes/QAddAnExistingKey.qml b/Qml/Components/customizes/QAddAnExistingKey.qml new file mode 100644 index 00000000..a1a58f9a --- /dev/null +++ b/Qml/Components/customizes/QAddAnExistingKey.qml @@ -0,0 +1,139 @@ +/************************************************************************** + * This file is part of the Nunchuk software (https://nunchuk.io/) * + * Copyright (C) 2020-2022 Enigmo * + * Copyright (C) 2022 Nunchuk * + * * + * This program is free software; you can redistribute it and/or * + * modify it under the terms of the GNU General Public License * + * as published by the Free Software Foundation; either version 3 * + * of the License, or (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + * * + **************************************************************************/ +import QtQuick 2.4 +import QtQuick.Controls 2.3 +import QtGraphicalEffects 1.12 +import HMIEVENTS 1.0 +import EWARNING 1.0 +import NUNCHUCKTYPE 1.0 +import DataPool 1.0 +import "../../Components/origins" +import "../../Components/customizes" +import "../../Components/customizes/Chats" +import "../../Components/customizes/Texts" +import "../../Components/customizes/Buttons" +import "../../../localization/STR_QML.js" as STR + +Item { + property string keyType: "" + property string fingerPrint: "" + property string notice: "" + Column { + spacing: 24 + QLato { + text: notice + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + } + Rectangle { + width: 539 + height: 464 + border.width: 1 + border.color: "#EAEAEA" + radius: 8 + Column + { + anchors.fill: parent + Repeater { + model: AppModel.masterSignerList + Item { + width: 539 - 12 + visible: keyType === model.master_signer_deviceType + height: visible ? 92 : 0 + anchors{ + left: parent.left + leftMargin: 12 + } + Row{ + anchors.fill: parent + spacing: 8 + Rectangle { + width: 48 + height: 48 + radius: width + color: "#F5F5F5" + anchors.verticalCenter: parent.verticalCenter + QImage { + width: 24 + height: 24 + anchors.centerIn: parent + source: GlobalData.iconTypes(keyType, model.master_signer_type) + sourceSize.width: 100 + sourceSize.height: 100 + } + } + Item{ + width: 146 + height: 60 + anchors.verticalCenter: parent.verticalCenter + Column{ + spacing: 4 + QText { + width: 146 + height: 20 + text: model.master_signer_name + color: "#031F2B" + font.weight: Font.Normal + font.family: "Lato" + font.pixelSize: 16 + } + QBadge { + text: STR.STR_QML_898 + color: "#EAEAEA" + } + QText { + width: 146 + height: 20 + text: "XFP: " + model.master_signer_fingerPrint + color: "#595959" + font.weight: Font.Normal + font.capitalization: Font.AllUppercase + font.family: "Lato" + font.pixelSize: 12 + } + } + } + } + QImage { + width: 24 + height: 24 + source: fingerPrint === model.master_signer_fingerPrint ? "qrc:/Images/Images/radio-selected-dark.svg" : "qrc:/Images/Images/radio-dark.svg" + scale: primaryKeyMouse.containsMouse ? 1.1 : 1.0 + anchors{ + right: parent.right + rightMargin: 12 + verticalCenter: parent.verticalCenter + } + } + MouseArea { + id: primaryKeyMouse + hoverEnabled: true + cursorShape: Qt.PointingHandCursor + anchors.fill: parent + onClicked: { + fingerPrint = model.master_signer_fingerPrint + } + } + } + } + } + } + } +} diff --git a/Qml/Components/customizes/QAddAssistedWalletSigner.qml b/Qml/Components/customizes/QAddAssistedWalletSigner.qml index 99e316c1..7bb8161d 100644 --- a/Qml/Components/customizes/QAddAssistedWalletSigner.qml +++ b/Qml/Components/customizes/QAddAssistedWalletSigner.qml @@ -15,38 +15,50 @@ Rectangle { Item { anchors.fill: parent anchors.margins: 16 - Column { - spacing: 16 - QLato { - width: 257 - height: 28 - text: addTitle - horizontalAlignment: Text.AlignLeft - verticalAlignment: Text.AlignVCenter + QLato { + anchors { + top: parent.top + topMargin: 0 } - Row { - spacing: 16 - QTextButton { - width: 120 - height: 48 - label.text: STR.STR_QML_245 - label.font.pixelSize: 16 - type: eTypeM - onButtonClicked: { - cancel() - } + width: 257 + height: paintedHeight + text: addTitle + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + wrapMode: Text.WordWrap + lineHeight: 28 + lineHeightMode: Text.FixedHeight + } + Item { + anchors { + bottom: parent.bottom + bottomMargin: 0 + } + width: 257 + height: 48 + QTextButton { + width: label.paintedWidth + 12*2 + height: 48 + anchors.left: parent.left + label.text: STR.STR_QML_245 + label.font.pixelSize: 16 + type: eTypeM + onButtonClicked: { + cancel() } - QTextButton { - width: 120 - height: 48 - label.text: addText - label.font.pixelSize: 16 - type: eTypeN - onButtonClicked: { - add() - } + } + QTextButton { + width: label.paintedWidth + 12*2 + height: 48 + anchors.right: parent.right + label.text: addText + label.font.pixelSize: 16 + type: eTypeN + onButtonClicked: { + add() } } } + } } diff --git a/Qml/Components/customizes/QCreateTransaction.qml b/Qml/Components/customizes/QCreateTransaction.qml index 73b06334..7bc27e15 100644 --- a/Qml/Components/customizes/QCreateTransaction.qml +++ b/Qml/Components/customizes/QCreateTransaction.qml @@ -411,7 +411,7 @@ Item { anchors.verticalCenter: parent.verticalCenter } QText { - text: STR.STR_QML_220.arg(transactionInfo.m) + text: STR.str_QML_220(transactionInfo.m) font.pixelSize: 12 font.family: "Lato" color: indicatorStatus.color @@ -587,7 +587,7 @@ Item { font.pixelSize: 14 color: "#031F2B" horizontalAlignment: Text.AlignRight - text: Math.max(0, (AppModel.chainTip - utxo_height)+1) + text: utxo_confirmed//Math.max(0, (AppModel.chainTip - utxo_height)+1) } } Item { @@ -614,14 +614,27 @@ Item { Item { width: parent.width height: 36 - QText { - text: STR.STR_QML_225 - color: "#031F2B" - font.weight: Font.Bold - font.pixelSize: 16 - font.family: "Lato" + Column { + spacing: 4 anchors.left: parent.left anchors.verticalCenter: parent.verticalCenter + QText { + text: STR.STR_QML_225 + color: "#031F2B" + font.weight: Font.Bold + font.pixelSize: 16 + font.family: "Lato" + } + QText { + text: STR.STR_QML_895 + width: 250 + wrapMode: Text.WordWrap + color: "#595959" + font.pixelSize: 12 + font.family: "Lato" + verticalAlignment: Text.AlignVCenter + visible: manualfeesetting.switchOn && transactionInfo.isCpfp + } } QSwitchTypeB { id: manualfeesetting @@ -757,14 +770,12 @@ Item { } } Item {width: parent.width; height: 12; visible: !feeinput.validInput} - QText { + QLato { id: cpfptext color: "#595959" height: 28 - visible: false //FIXME - text: "Child fee rate: ? sat/vB" - font.pixelSize: 16 - font.family: "Lato" + text: STR.STR_QML_836.arg(transactionInfo.packageFeeRate) + visible: transactionInfo.isCpfp } } Column { diff --git a/Qml/Components/customizes/QOnScreenContent.qml b/Qml/Components/customizes/QOnScreenContent.qml index 9804f92e..ac73289f 100644 --- a/Qml/Components/customizes/QOnScreenContent.qml +++ b/Qml/Components/customizes/QOnScreenContent.qml @@ -36,6 +36,7 @@ Item { property alias bottomLeft: botLeft.sourceComponent property alias bottomRight: botRight.sourceComponent readonly property Item contentItem: contentInfo.item + readonly property Item rightItem: botRight.item property bool enableHeader: true property int offset: 36 signal closeClicked() diff --git a/Qml/Components/customizes/QPopupInfoVertical.qml b/Qml/Components/customizes/QPopupInfoVertical.qml index 3a6d98c3..1e8a7175 100644 --- a/Qml/Components/customizes/QPopupInfoVertical.qml +++ b/Qml/Components/customizes/QPopupInfoVertical.qml @@ -92,18 +92,18 @@ Popup { QTextButton { anchors.horizontalCenter: parent.horizontalCenter width: Math.max(lwidths[0],label.paintedWidth + 20*2) - height: 36 + height: 48 label.text: labels[0] - label.font.pixelSize: 12 + label.font.pixelSize: 16 type: eTypeE onButtonClicked: {confirmYes()} } QTextButton { anchors.horizontalCenter: parent.horizontalCenter width: Math.max(lwidths[1],label.paintedWidth + 10*2) - height: 36 + height: 48 label.text: labels[1] - label.font.pixelSize: 12 + label.font.pixelSize: 16 type: eTypeB onButtonClicked: {confirmNo()} } diff --git a/Qml/Components/customizes/QScreen.qml b/Qml/Components/customizes/QScreen.qml index 18b25b27..fd4c1470 100644 --- a/Qml/Components/customizes/QScreen.qml +++ b/Qml/Components/customizes/QScreen.qml @@ -17,6 +17,8 @@ * along with this program. If not, see . * * * **************************************************************************/ +import NUNCHUCKTYPE 1.0 +import HMIEVENTS 1.0 import QtQuick 2.4 import "../origins" @@ -43,4 +45,19 @@ Item { anchors.fill: parent onClicked: {root.focus = true} } + function closeTo(tab) { + switch(tab) { + case NUNCHUCKTYPE.WALLET_TAB: + QMLHandle.sendEvent(EVT.EVT_ONS_CLOSE_REQUEST) + break; + case NUNCHUCKTYPE.SERVICE_TAB: + QMLHandle.sendEvent(EVT.EVT_CLOSE_TO_SERVICE_SETTINGS_REQUEST) + break; + case NUNCHUCKTYPE.CHAT_TAB: + QMLHandle.sendEvent(EVT.EVT_ONLINE_ONS_CLOSE_REQUEST) + break; + case NUNCHUCKTYPE.SETTING_TAB: + break; + } + } } diff --git a/Qml/Components/customizes/QSendTransaction.qml b/Qml/Components/customizes/QSendTransaction.qml index ae64dd47..5a7164aa 100644 --- a/Qml/Components/customizes/QSendTransaction.qml +++ b/Qml/Components/customizes/QSendTransaction.qml @@ -99,7 +99,7 @@ Item { id: lstDestination model: transactionInfo.destinationList width: parent.width - height: count > 10 ? 400 : 40*count + height: count > 10 ? 400 : 60*count delegate: destDelegate clip: true cacheBuffer: 600 @@ -435,7 +435,7 @@ Item { anchors.verticalCenter: parent.verticalCenter } QText { - text: STR.STR_QML_220.arg(Math.max(0, (transactionInfo.m - transactionInfo.numberSigned))) + text: STR.str_QML_220(Math.max(0, (transactionInfo.m - transactionInfo.numberSigned))) font.pixelSize: 12 font.family: "Lato" color: indicatorStatus.color @@ -478,7 +478,7 @@ Item { color: "#595959" font.family: "Lato" font.pixelSize: 12 - text: STR.STR_QML_220.arg(Math.max(0, (transactionInfo.m - transactionInfo.numberSigned))) + text: STR.str_QML_220(Math.max(0, (transactionInfo.m - transactionInfo.numberSigned))) anchors.verticalCenter: parent.verticalCenter } } diff --git a/Qml/Components/customizes/Texts/QTextAreaBoxTypeA.qml b/Qml/Components/customizes/Texts/QTextAreaBoxTypeA.qml new file mode 100644 index 00000000..1822b5cd --- /dev/null +++ b/Qml/Components/customizes/Texts/QTextAreaBoxTypeA.qml @@ -0,0 +1,146 @@ +/************************************************************************** + * This file is part of the Nunchuk software (https://nunchuk.io/) * + * Copyright (C) 2020-2022 Enigmo * + * Copyright (C) 2022 Nunchuk * + * * + * This program is free software; you can redistribute it and/or * + * modify it under the terms of the GNU General Public License * + * as published by the Free Software Foundation; either version 3 * + * of the License, or (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + * * + **************************************************************************/ +import QtQuick 2.4 +import QtGraphicalEffects 1.0 +import "../../origins" + +Column { + id: textipboxType + property string label: "This is label" + property string optional: "" + property alias errorText: textErrorItem.text + property alias errorTextColor: textErrorItem.color + property alias textInputted: _input.text + property var textweight: Font.Bold + property alias length: _input.length + property bool enableLengthLimit: false + property int boxWidth: 338 + property int boxHeight: 48 + property bool isValid: true + property bool showError: false + signal typingFinished(var currentText) + property alias textBoxFocus: _input.focus + property alias input: _input + spacing: 4 + + signal downKeyRequest() + signal upKeyRequest() + signal enterKeyRequest() + signal pasteKeyRequest() + signal tabKeyRequest() + + Row { + width: parent.width + QText { + id:txt1 + width: paintedWidth + font.family: "Lato" + font.pixelSize: 16 + font.weight: textweight + color: "#031F2B" + text: label + visible: label != "" + anchors.bottom: parent.bottom + } + QText { + id:txt2 + width: paintedWidth + font.family: "Lato" + font.pixelSize: 12 + font.weight: textweight + color: "#595959" + text: optional + visible: optional != "" + anchors.verticalCenter: txt1.verticalCenter + } + QText { + width: textipboxType.width - txt1.width - txt2.width + font.family: "Lato" + font.pixelSize: 12 + color: "#031F2B" + text: textipboxType.length + "/" + textipboxType.maxLength + visible: textipboxType.enableLengthLimit + horizontalAlignment: Text.AlignRight + anchors.bottom: parent.bottom + } + } + Item { + width: myRectangle.width+2 + height: myRectangle.height+2 + Item { + id: _background + width: myRectangle.width+2 + height: myRectangle.height+2 + Rectangle { + id: myRectangle + anchors.centerIn: parent + width: boxWidth + height: boxHeight + radius: 8 + color: textipboxType.enabled ? (isValid ? "#FFFFFF" : "#FFD7D9") : "#EAEAEA" + border.color: isValid ? "#DEDEDE" : "#CF4018" + } + } + QTextArea { + id: _input + anchors.fill: parent + background: _background + color: "#031F2B" + font.pixelSize: 16 + clip: true + onTypingFinished: textipboxType.typingFinished(currentText) + Keys.onDownPressed: { downKeyRequest() } + Keys.onUpPressed: { upKeyRequest() } + Keys.onPressed: function (keyEvent) { + if (keyEvent.matches(StandardKey.Paste)) { pasteKeyRequest() } + if (keyEvent.key === Qt.Key_Tab) { keyEvent.accepted = false; tabKeyRequest() } + } + } + } + Item{ + width: myRectangle.width+2 + height: 28 + QImage { + id: alert + width: 20 + height: 20 + source: "qrc:/Images/Images/error_outline_24px.png" + anchors { + left: parent.left + leftMargin: 0 + verticalCenter: parent.verticalCenter + } + visible: !isValid && showError + } + QText { + id: textErrorItem + width: myRectangle.width+2 + font.family: "Lato" + font.pixelSize: 16 + color: "#CF4018" + anchors { + left: alert.right + leftMargin: 6 + verticalCenter: parent.verticalCenter + } + } + visible: !isValid && showError + } +} diff --git a/Qml/Components/customizes/Texts/QTextAreaBoxTypeB.qml b/Qml/Components/customizes/Texts/QTextAreaBoxTypeB.qml new file mode 100644 index 00000000..80b376e4 --- /dev/null +++ b/Qml/Components/customizes/Texts/QTextAreaBoxTypeB.qml @@ -0,0 +1,61 @@ +import QtQuick 2.0 +import "../../origins" +import "../../../../localization/STR_QML.js" as STR +Item { + property string icon: "" + property alias label: _label + property alias edit: _edit + property alias input: _input + property string textColor: "#FFFFFF" + signal textEditClicked() + height: 84 + Column { + anchors.fill: parent + spacing: 12 + Item { + width: parent.width + height: 24 + Row { + anchors.fill: parent + spacing: 12 + QImage { + width: sourceSize.width + height: sourceSize.height + anchors.verticalCenter: parent.verticalCenter + source: icon + visible: icon !== "" + } + QLato { + id: _label + font.weight: Font.Bold + font.pixelSize: 16 + color: textColor + text: STR.STR_QML_848 + anchors.verticalCenter: parent.verticalCenter + } + } + Row { + anchors.fill: parent + layoutDirection: Qt.RightToLeft + spacing: 12 + QTextLink { + id: _edit + width: 29 + height: 20 + text: STR.STR_QML_849 + color: textColor + anchors.verticalCenter: parent.verticalCenter + onTextClicked: { + textEditClicked() + } + } + } + } + QTextArea { + id: _input + width: parent.width + height: 48 + leftPadding: 12 + } + } +} diff --git a/Qml/Components/customizes/Texts/QTextAreaBoxTypeC.qml b/Qml/Components/customizes/Texts/QTextAreaBoxTypeC.qml new file mode 100644 index 00000000..464faa0c --- /dev/null +++ b/Qml/Components/customizes/Texts/QTextAreaBoxTypeC.qml @@ -0,0 +1,118 @@ +import QtQuick 2.0 +import "../../origins" +import "../../../../localization/STR_QML.js" as STR +Item { + property string icon: "" + property alias label: _label + property alias edit: _edit + property string textColor: "#FFFFFF" + property string leftText1: "" + property string rightText1: "" + property string leftText2: "" + property string rightText2: "" + property var rightList: rightText1.split(",") + + signal textEditClicked() + height: 64 + Math.max(1, rightList.length) * 20 + Column { + anchors.fill: parent + spacing: 12 + Item { + width: parent.width + height: 24 + Row { + anchors.fill: parent + spacing: 12 + QImage { + width: sourceSize.width + height: sourceSize.height + anchors.verticalCenter: parent.verticalCenter + source: icon + visible: icon !== "" + } + QLato { + id: _label + font.weight: Font.Bold + font.pixelSize: 16 + color: textColor + text: STR.STR_QML_852 + anchors.verticalCenter: parent.verticalCenter + } + } + Row { + anchors.fill: parent + layoutDirection: Qt.RightToLeft + spacing: 12 + QTextLink { + id: _edit + width: 29 + height: 20 + text: STR.STR_QML_849 + color: textColor + anchors.verticalCenter: parent.verticalCenter + onTextClicked: { + textEditClicked() + } + } + } + } + Rectangle { + width: 651 + height: 85 + Math.max(1, rightList.length) * 20 + radius: 12 + color: "#F5F5F5" + Column { + anchors.centerIn: parent + spacing: 16 + Item { + width: 619 + height: Math.max(1, rightList.length) * 20 + QLato { + width: 302 + height: 20 + anchors.left: parent.left + text: leftText1 + } + Column { + anchors.right: parent.right + spacing: 1 + Repeater { + model: rightList + QLato { + width: 302 + height: 20 + font.weight: Font.Bold + text: rightList[index] + color: rightList[index] === "None" ? "#CF4018" : "#031F2B" + horizontalAlignment: Text.AlignRight + } + } + } + } + Rectangle { + width: 311 + height: 1 + color: "#EAEAEA" + } + Item { + width: 619 + height: 20 + QLato { + width: 302 + height: 20 + anchors.left: parent.left + text: STR.STR_QML_868 + } + QLato { + width: 302 + height: 20 + font.weight: Font.Bold + anchors.right: parent.right + text: rightText2 + horizontalAlignment: Text.AlignRight + } + } + } + } + } +} diff --git a/Qml/Components/customizes/Texts/QTextInputBoxTypeB.qml b/Qml/Components/customizes/Texts/QTextInputBoxTypeB.qml index e5506abd..a4079385 100644 --- a/Qml/Components/customizes/Texts/QTextInputBoxTypeB.qml +++ b/Qml/Components/customizes/Texts/QTextInputBoxTypeB.qml @@ -27,20 +27,21 @@ Column { property string optional: "" property alias errorText: textErrorItem.text property alias errorTextColor: textErrorItem.color - property alias textInputted: input.text - property alias validator: input.validator - property alias acceptableInput : input.acceptableInput + property alias textInputted: _input.text + property alias validator: _input.validator + property alias acceptableInput : _input.acceptableInput property var textweight: Font.Bold - property alias echoMode: input.echoMode - property alias maxLength: input.maximumLength - property alias length: input.length + property alias echoMode: _input.echoMode + property alias maxLength: _input.maximumLength + property alias length: _input.length property bool enableLengthLimit: false property int boxWidth: 338 property int boxHeight: 48 property bool isValid: true property bool showError: false signal typingFinished(var currentText) - property alias textBoxFocus: input.focus + property alias textBoxFocus: _input.focus + property alias input: _input property bool isPassword: false spacing: 4 @@ -103,7 +104,7 @@ Column { } } QTextField { - id: input + id: _input anchors.fill: parent background: _background color: "#031F2B" @@ -129,7 +130,7 @@ Column { anchors.verticalCenter: parent.verticalCenter anchors.right: parent.right anchors.rightMargin: 12 - visible: (input.text !== "") && isPassword + visible: (_input.text !== "") && isPassword MouseArea { anchors.fill: parent onClicked: showpass.visiblity =! showpass.visiblity diff --git a/Qml/Components/customizes/Texts/QTextInputBoxTypeE.qml b/Qml/Components/customizes/Texts/QTextInputBoxTypeE.qml new file mode 100644 index 00000000..05f0d9e2 --- /dev/null +++ b/Qml/Components/customizes/Texts/QTextInputBoxTypeE.qml @@ -0,0 +1,62 @@ +import QtQuick 2.0 +import "../../origins" +import "../../../../localization/STR_QML.js" as STR +Item { + property string icon: "" + property alias label: _label + property alias edit: _edit + property alias input: _input + property string textColor: "#FFFFFF" + signal textEditClicked() + height: 84 + Column { + anchors.fill: parent + spacing: 12 + Item { + width: parent.width + height: 24 + Row { + anchors.fill: parent + spacing: 12 + QImage { + width: sourceSize.width + height: sourceSize.height + anchors.verticalCenter: parent.verticalCenter + source: icon + visible: icon !== "" + } + QLato { + id: _label + font.weight: Font.Bold + font.pixelSize: 16 + color: textColor + text: STR.STR_QML_848 + anchors.verticalCenter: parent.verticalCenter + } + } + Row { + anchors.fill: parent + layoutDirection: Qt.RightToLeft + spacing: 12 + QTextLink { + id: _edit + width: 29 + height: 20 + text: STR.STR_QML_849 + color: textColor + anchors.verticalCenter: parent.verticalCenter + onTextClicked: { + textEditClicked() + } + } + } + } + QTextField { + id: _input + width: parent.width + height: 48 + leftPadding: 12 + wrapMode: Text.WordWrap + } + } +} diff --git a/Qml/Components/customizes/Texts/QTextLink.qml b/Qml/Components/customizes/Texts/QTextLink.qml new file mode 100644 index 00000000..81b153be --- /dev/null +++ b/Qml/Components/customizes/Texts/QTextLink.qml @@ -0,0 +1,19 @@ +import QtQuick 2.0 +import "../../origins" + +QLato { + font.weight: Font.Bold + font.pixelSize: 16 + signal textClicked() + scale: btnMouse.containsMouse ? 1.1 : 1 + font.underline: true + MouseArea { + id: btnMouse + anchors.fill: parent + cursorShape: Qt.PointingHandCursor + acceptedButtons: Qt.LeftButton | Qt.RightButton + onClicked: { + textClicked() + } + } +} diff --git a/Qml/Components/customizes/services/QInheritanceDetails.qml b/Qml/Components/customizes/services/QInheritanceDetails.qml new file mode 100644 index 00000000..d7a45992 --- /dev/null +++ b/Qml/Components/customizes/services/QInheritanceDetails.qml @@ -0,0 +1,136 @@ +/************************************************************************** + * This file is part of the Nunchuk software (https://nunchuk.io/) * + * Copyright (C) 2020-2022 Enigmo * + * Copyright (C) 2022 Nunchuk * + * * + * This program is free software; you can redistribute it and/or * + * modify it under the terms of the GNU General Public License * + * as published by the Free Software Foundation; either version 3 * + * of the License, or (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + * * + **************************************************************************/ +import QtQuick 2.4 +import QtQuick.Controls 2.3 +import QtGraphicalEffects 1.12 +import HMIEVENTS 1.0 +import EWARNING 1.0 +import NUNCHUCKTYPE 1.0 +import DataPool 1.0 +import "../../origins" +import "../../customizes" +import "../../customizes/Texts" +import "../../../../localization/STR_QML.js" as STR + +Item { + property string title: STR.STR_QML_887 + property string magicPhrase: ServiceSetting.qInheritanceMagic + property string warning: STR.STR_QML_890 + width: 346 + height: 512 + Column { + width: parent.width + spacing: 16 + QLato { + width: parent.width + text: title + lineHeightMode: Text.FixedHeight + lineHeight: 28 + wrapMode: Text.WordWrap + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + } + Rectangle { + width: 346 + height: 88 + Row { + anchors.fill: parent + spacing: 12 + QImage { + width: 24 + height: 24 + source: "qrc:/Images/Images/1.Active.svg" + } + Column { + width: 310 + height: 88 + spacing: 12 + QLato { + width: 310 + text: STR.STR_QML_888 + horizontalAlignment: Text.AlignLeft + } + Rectangle { + width: 310 + height: 48 + color: "#F5F5F5" + radius: 12 + QLato { + width: 310 + text: magicPhrase + anchors.centerIn: parent + horizontalAlignment: Text.AlignHCenter + } + } + } + } + } + Rectangle { + width: 346 + height: 112 + Row { + anchors.fill: parent + spacing: 12 + QImage { + width: 24 + height: 24 + source: "qrc:/Images/Images/2.Active.svg" + } + QLato { + width: 310 + height: 112 + text: STR.STR_QML_889 + lineHeightMode: Text.FixedHeight + lineHeight: 28 + wrapMode: Text.WordWrap + horizontalAlignment: Text.AlignLeft + anchors.verticalCenter: parent.verticalCenter + } + } + } + Rectangle { + width: 346 + height: 164 + color: "#FDEBD2" + radius: 8 + Row { + anchors.fill: parent + anchors.margins: 12 + spacing: 12 + QImage { + width: 24 + height: 24 + source: "qrc:/Images/Images/warning-dark.svg" + anchors.verticalCenter: parent.verticalCenter + } + QLato { + width: 310 + height: 164 + text: warning + lineHeightMode: Text.FixedHeight + lineHeight: 28 + wrapMode: Text.WordWrap + horizontalAlignment: Text.AlignLeft + anchors.verticalCenter: parent.verticalCenter + } + } + } + } +} diff --git a/Qml/Components/customizes/services/QSelectAnAssistedWallet.qml b/Qml/Components/customizes/services/QSelectAnAssistedWallet.qml new file mode 100644 index 00000000..51c48749 --- /dev/null +++ b/Qml/Components/customizes/services/QSelectAnAssistedWallet.qml @@ -0,0 +1,55 @@ +import QtQuick 2.0 +import QtGraphicalEffects 1.0 +import DataPool 1.0 +import HMIEVENTS 1.0 +import "../../customizes/Texts" +import "../../customizes/Buttons" +import "../../customizes" +import "../../../../localization/STR_QML.js" as STR + +Item { + id: _id + function contains(id) { + for (var i = 0; i < ServiceSetting.qAssistedSetuped.length; i++) { + if (ServiceSetting.qAssistedSetuped[i] === id) + { + return true + } + } + return false + } + Column { + anchors.fill: parent + anchors.margins: 24 + spacing: 24 + QLato { + text: STR.STR_QML_837 + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + font.pixelSize: 28 + font.weight: Font.Bold + } + + + Repeater { + model: AppModel.walletList + QLinearGradient { + width: 651 + height: dele.visible ? 92 : 0 + QAssistedWalletDelegate { + id: dele + anchors.fill: parent + walletName: model.wallet_name + walletBalance: model.wallet_Balance + walletCurrency: model.wallet_Balance_Currency + walletM: model.wallet_M + walletN: model.wallet_N + visible: model.wallet_isAssistedWallet && _id.contains(model.wallet_id) + onButtonClicked: { + QMLHandle.sendEvent(EVT.EVT_SERVICE_SELECT_WALLET_REQUEST, model.wallet_id) + } + } + } + } + } +} diff --git a/Qml/Components/customizes/services/QViewInheritancePlaning.qml b/Qml/Components/customizes/services/QViewInheritancePlaning.qml new file mode 100644 index 00000000..59a80c50 --- /dev/null +++ b/Qml/Components/customizes/services/QViewInheritancePlaning.qml @@ -0,0 +1,348 @@ +/************************************************************************** + * This file is part of the Nunchuk software (https://nunchuk.io/) * + * Copyright (C) 2020-2022 Enigmo * + * Copyright (C) 2022 Nunchuk * + * * + * This program is free software; you can redistribute it and/or * + * modify it under the terms of the GNU General Public License * + * as published by the Free Software Foundation; either version 3 * + * of the License, or (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + * * + **************************************************************************/ +import QtQuick 2.12 +import QtQuick.Controls 2.1 +import QtQuick.Controls 1.4 +import QtGraphicalEffects 1.0 +import QtQuick.Controls.Styles 1.4 +import Qt.labs.platform 1.1 +import HMIEVENTS 1.0 +import NUNCHUCKTYPE 1.0 +import QRCodeItem 1.0 +import DataPool 1.0 +import DRACO_CODE 1.0 +import EWARNING 1.0 +import "../../origins" +import "../../customizes" +import "../../customizes/Chats" +import "../../customizes/Texts" +import "../../customizes/Buttons" +import "../../customizes/services" +import "../../../../localization/STR_QML.js" as STR + +Item { + property string dateString: { + if (ServiceSetting.qInheritanceActivationDate === "") { + ServiceSetting.qInheritanceActivationDate = Qt.formatDateTime(new Date(), "MM/dd/yyyy") + } + return ServiceSetting.qInheritanceActivationDate + } + Connections { + target: UserWallet + } + + QContextMenu { + id: optionMenu + menuWidth: 300 + icons: [ + "qrc:/Images/Images/close-24px.svg" + ] + labels: [ + STR.STR_QML_844 + ] + colors: [ + "#CF4018" + ] + onItemClicked: { + switch(index){ + case 0: + ServiceSetting.qInheritanceWalletName = "" + break; + default: + break; + } + } + } + Rectangle { + id: _img_bg + width: parent.width + height: parent.height * 0.5 + color: "#D0E2FF" + QIconButton{ + id:_more + anchors{ + top: parent.top + topMargin: 24 + right: parent.right + rightMargin: 24 + } + width: 48 + height: 48 + bgColor: parent.color + icon: "qrc:/Images/Images/more-horizontal-dark.svg" + onClicked: { + optionMenu.popup() + } + } + } + Column { + anchors.fill: parent + anchors.margins: 24 + spacing: 28 + Row { + height: 28 + spacing: 16 + QIconButton { + iconSize: 24 + icon: "qrc:/Images/Images/left-arrow-dark.svg" + visible: ServiceSetting.qAssistedSetuped.length > 1 + anchors.verticalCenter: parent.verticalCenter + onButtonClicked: { + ServiceSetting.qInheritanceWalletName = "" + } + bgColor: "transparent" + } + QText { + font.family: "Lato" + font.pixelSize: 28 + color: "#031F2B" + font.weight: Font.Bold + text: STR.STR_QML_843 + } + } + Rectangle { + width: parent.width + height: _img_bg.height * 0.75 + radius: 24 + color: "#2F466C" + Column { + anchors.fill: parent + anchors.margins: 24 + spacing: 24 + Item { + width: parent.width + height: 60 + Row { + anchors.fill: parent + spacing: 12 + QImage { + width: 60 + height: 60 + anchors.verticalCenter: parent.verticalCenter + source: "qrc:/Images/Images/wallet-brand-icon.svg" + } + Column { + width: 304 + height: 44 + anchors.verticalCenter: parent.verticalCenter + spacing: 4 + QLato { + font.weight: Font.Bold + font.pixelSize: 16 + color: "#FFFFFF" + text: STR.STR_QML_845 + } + QLato { + color: "#FFFFFF" + text: ServiceSetting.qInheritanceWalletName + } + } + } + Row { + anchors.fill: parent + layoutDirection: Qt.RightToLeft + spacing: 12 + QTextButton { + width: 162 + height: 48 + label.text: STR.STR_QML_847 + label.font.pixelSize: 16 + anchors.verticalCenter: parent.verticalCenter + type: eTypeC + onButtonClicked: { + QMLHandle.sendEvent(EVT.EVT_SHARE_YOUR_SECRET_REQUEST) + } + } + QTextLink { + width: 220 + height: 48 + font.weight: Font.Bold + font.pixelSize: 16 + color: "#FFFFFF" + text: STR.STR_QML_846 + anchors.verticalCenter: parent.verticalCenter + font.underline: false + onTextClicked: { + Qt.openUrlExternally("https://nunchuk.io/howtoclaim") + } + } + } + } + QTextInputBoxTypeE { + width: parent.width + icon: "qrc:/Images/Images/calendar-dark.png" + input.text: dateString + input.verticalAlignment: Text.AlignVCenter + onTextEditClicked: { + QMLHandle.sendEvent(EVT.EVT_EDIT_YOUR_INHERITANCE_PLAN_REQUEST, ServiceType.IE_ACTIVATION_DATE) + } + } + Item { + width: parent.width + height: 104 + Row { + spacing: 24 + QTextInputBoxTypeE { + width: 387 + height: 104 + icon: "qrc:/Images/Images/star-dark.png" + edit.visible: false + label.text: STR.STR_QML_749 + input.text: ServiceSetting.qInheritanceMagic + input.verticalAlignment: Text.AlignTop + input.height: 68 + } + QTextInputBoxTypeE { + width: 387 + height: 104 + icon: "qrc:/Images/Images/change-password-dark.svg" + edit.visible: false + label.text: STR.STR_QML_727 + input.text: STR.STR_QML_917 + input.verticalAlignment: Text.AlignTop + input.height: 68 + } + } + } + } + } + Item { + width: parent.width - 24 + height: parent.height * 0.58 - 24 + Flickable { + anchors.top: parent.top + anchors.topMargin: 12 + clip: true + width: 661 + height: 372 + contentWidth: width + contentHeight: _colum.childrenRect.height + 100 + ScrollBar.vertical: ScrollBar { active: true } + Column { + id: _colum + anchors.top: parent.top + anchors.topMargin: 24 + width: parent.width + spacing: 24 + QTextAreaBoxTypeB { + width: 651 + height: 128 + label.text: STR.STR_QML_850 + input.text: ServiceSetting.qInheritanceNote + input.backgroundColor: "#F5F5F5" + input.verticalAlignment: Text.AlignTop + input.height: 96 + input.readOnly: true + textColor: "#031F2B" + onTextEditClicked: { + QMLHandle.sendEvent(EVT.EVT_EDIT_YOUR_INHERITANCE_PLAN_REQUEST, ServiceType.IE_LEAVE_MESSAGE) + } + } + Rectangle { + height: 1 + width: 651 + color: "#EAEAEA" + } + QTextInputBoxTypeE { + width: 651 + height: 84 + label.text: STR.STR_QML_851 + input.text: ServiceSetting.qInheritancePeriodId === "" ? STR.STR_QML_921 : ServiceSetting.qInheritancePeriod + input.backgroundColor: "#F5F5F5" + input.height: 52 + input.readOnly: true + textColor: "#031F2B" + onTextEditClicked: { + if (UserWallet.inheritancePlanCreatePeriods()) { + QMLHandle.sendEvent(EVT.EVT_EDIT_YOUR_INHERITANCE_PLAN_REQUEST, ServiceType.IE_BUFFER_PERIOD) + } + } + } + Rectangle { + height: 1 + width: 651 + color: "#EAEAEA" + } + QTextAreaBoxTypeC { + width: 651 +// height: 137 + textColor: "#031F2B" + leftText1: STR.STR_QML_867 + rightText1: ServiceSetting.qInheritanceEmail === "" ? "None" : ServiceSetting.qInheritanceEmail + leftText2: STR.STR_QML_868 + rightText2: ServiceSetting.qInheritanceIsNotify ? STR.STR_QML_433 : STR.STR_QML_432 + onTextEditClicked: { + QMLHandle.sendEvent(EVT.EVT_EDIT_YOUR_INHERITANCE_PLAN_REQUEST, ServiceType.IE_NOTIFICATION) + } + } + } + } + } + } + Rectangle { + id: normalRect + height: 80 + anchors{ + left: parent.left + right: parent.right + bottom: parent.bottom + } + layer.enabled: true + layer.effect: DropShadow { + radius: 4 + samples: radius * 2 + source: normalRect + color: Qt.rgba(0, 0, 0, 0.5) + } + Row { + anchors{ + right: parent.right + rightMargin: 24 + bottom: parent.bottom + bottomMargin: 16 + } + spacing: 12 + layoutDirection: Qt.RightToLeft + QTextButton { + id: _save + width: 214 + height: 48 + label.text: STR.STR_QML_804 + label.font.pixelSize: 16 + type: eTypeE + enabled: ServiceSetting.qViewInheritanceIsEdit + onButtonClicked: { + QMLHandle.sendEvent(EVT.EVT_INHERITANCE_PLAN_FINALIZE_REQUEST, 1) + } + } + QTextButton { + width: 148 + height: 48 + label.text: STR.STR_QML_805 + label.font.pixelSize: 16 + type: eTypeF + enabled: ServiceSetting.qViewInheritanceIsEdit + onButtonClicked: { + QMLHandle.sendEvent(EVT.EVT_INHERITANCE_PLAN_FINALIZE_REQUEST, 2) + } + } + } + } +} diff --git a/Qml/Components/origins/QTextArea.qml b/Qml/Components/origins/QTextArea.qml new file mode 100644 index 00000000..111ae282 --- /dev/null +++ b/Qml/Components/origins/QTextArea.qml @@ -0,0 +1,54 @@ +/************************************************************************** + * This file is part of the Nunchuk software (https://nunchuk.io/) * + * Copyright (C) 2020-2022 Enigmo * + * Copyright (C) 2022 Nunchuk * + * * + * This program is free software; you can redistribute it and/or * + * modify it under the terms of the GNU General Public License * + * as published by the Free Software Foundation; either version 3 * + * of the License, or (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + * * + **************************************************************************/ +import QtQuick 2.12 +import QtQuick.Controls 2.1 + +TextArea { + id: textEdit + property var borderColor: "#DEDEDE" + property var backgroundColor: "#FFFFFF" + color: "#031F2B" + font.family: "Lato" + font.pixelSize: 16 + font.weight: Font.Medium + background: Rectangle { + anchors.fill: parent + radius: 8 + border.color: borderColor + color: backgroundColor + } + activeFocusOnTab : true + activeFocusOnPress: true + verticalAlignment: Text.AlignVCenter + cursorVisible: !readOnly && textEdit.activeFocus + selectByMouse: true + renderType: Text.QtRendering + wrapMode: Text.WrapAnywhere + signal typingFinished(var currentText) + onTextChanged: if(initialized === true) inputIdentify.restart() + + property bool initialized: false + Timer { + id: inputIdentify + interval: 250 + onTriggered: { if(textEdit.text !== "") typingFinished(textEdit.text) } + } + Component.onCompleted: initialized = true +} diff --git a/Qml/Components/origins/QTextField.qml b/Qml/Components/origins/QTextField.qml index 0fc86b5a..2825b4f8 100644 --- a/Qml/Components/origins/QTextField.qml +++ b/Qml/Components/origins/QTextField.qml @@ -22,12 +22,17 @@ import QtQuick.Controls 2.1 TextField { id: textEdit + property var borderColor: "#DEDEDE" + property var backgroundColor: "#FFFFFF" color: "#031F2B" + font.family: "Lato" + font.pixelSize: 16 + font.weight: Font.Medium background: Rectangle { anchors.fill: parent radius: 8 - border.color: "#DEDEDE" - color: "#FFFFFF" + border.color: borderColor + color: backgroundColor } activeFocusOnTab : true activeFocusOnPress: true @@ -35,6 +40,7 @@ TextField { cursorVisible: !readOnly && textEdit.activeFocus selectByMouse: true renderType: Text.QtRendering + wrapMode: Text.WrapAnywhere signal typingFinished(var currentText) onTextChanged: if(initialized === true) inputIdentify.restart() diff --git a/Qml/Global/QGlobal.qml b/Qml/Global/QGlobal.qml index 6f2680ac..91f38012 100644 --- a/Qml/Global/QGlobal.qml +++ b/Qml/Global/QGlobal.qml @@ -123,7 +123,7 @@ QtObject { case "trezor": img = "qrc:/Images/Images/Device_Icons/Trezor.svg"; break case "coldcard": img = "qrc:/Images/Images/Device_Icons/ColdCard.svg"; break case "bitbox02": img = "qrc:/Images/Images/Device_Icons/bitbox.png"; break - case "ledger": img = "qrc:/Images/Images/Device_Icons/ledger.png"; break + case "ledger": img = "qrc:/Images/Images/Device_Icons/Ledger.svg"; break case "software": img = "qrc:/Images/Images/Device_Icons/software_drak.svg"; break case "nfc" : img = "qrc:/Images/Images/Device_Icons/nfc-key-dark.svg"; break default: switch(intType){ @@ -146,6 +146,7 @@ QtObject { case NUNCHUCKTYPE.NFC: n = "NFC"; break case NUNCHUCKTYPE.COLDCARD_NFC: n = "COLDCARD-NFC"; break case NUNCHUCKTYPE.SERVER: n = "PLATFORM"; break + case NUNCHUCKTYPE.UNKNOWN: n = "UNKNOWN"; break default: n = "" } return n @@ -161,8 +162,22 @@ QtObject { case NUNCHUCKTYPE.NFC: name = STR.STR_QML_678; break case NUNCHUCKTYPE.COLDCARD_NFC: name = "COLDCARD-NFC"; break case NUNCHUCKTYPE.SERVER: name = "Platform"; break + case NUNCHUCKTYPE.UNKNOWN: name = "UNKNOWN"; break default: name = "" } return name } + + property int countRandom : 0 + property var generatedValues: [0, 1, 2] + function swapPositions() { + let temp = generatedValues[countRandom % 3]; + generatedValues[countRandom % 3] = generatedValues[(countRandom + 1) % 3]; + generatedValues[(countRandom + 1) % 3] = temp; + countRandom++; + if (countRandom > 5) { + countRandom = 0; + } + return generatedValues; + } } diff --git a/Qml/Screens/LocalMode/SCR_ADD_HARDWARE_SIGNER.qml b/Qml/Screens/LocalMode/SCR_ADD_HARDWARE_SIGNER.qml index 8def1b7c..6a5d2121 100644 --- a/Qml/Screens/LocalMode/SCR_ADD_HARDWARE_SIGNER.qml +++ b/Qml/Screens/LocalMode/SCR_ADD_HARDWARE_SIGNER.qml @@ -326,8 +326,10 @@ QScreen { onTagFound: { var jsonstring = ""; jsonstring = AppModel.parseQRSigners(qrscaner.tags) - signerinforInput.jsonProcess(jsonstring) - qrscaner.close() + if(jsonstring !== ""){ + signerinforInput.jsonProcess(jsonstring) + qrscaner.close() + } } } function jsonProcess(jsonstring){ diff --git a/Qml/Screens/LocalMode/SCR_ADD_NEW_SOFTWARE_SIGNER.qml b/Qml/Screens/LocalMode/SCR_ADD_NEW_SOFTWARE_SIGNER.qml index d786893b..74fbc8bf 100644 --- a/Qml/Screens/LocalMode/SCR_ADD_NEW_SOFTWARE_SIGNER.qml +++ b/Qml/Screens/LocalMode/SCR_ADD_NEW_SOFTWARE_SIGNER.qml @@ -49,7 +49,7 @@ QScreen { left: parent.left leftMargin: 36 top: parent.top - topMargin: 65 + topMargin: 65 + 24 } verticalAlignment: Text.AlignVCenter color: "#031F2B" @@ -65,7 +65,7 @@ QScreen { height: 500 anchors.horizontalCenter: parent.horizontalCenter anchors.top: parent.top - anchors.topMargin: 150 + anchors.topMargin: 150 + 24 columns: 6 spacing: 12 Repeater { diff --git a/Qml/Screens/LocalMode/SCR_ADD_REMOTE_SIGNER_RESULT.qml b/Qml/Screens/LocalMode/SCR_ADD_REMOTE_SIGNER_RESULT.qml index 2a570233..fe238d4f 100644 --- a/Qml/Screens/LocalMode/SCR_ADD_REMOTE_SIGNER_RESULT.qml +++ b/Qml/Screens/LocalMode/SCR_ADD_REMOTE_SIGNER_RESULT.qml @@ -62,42 +62,18 @@ QScreen { } } } - - Row{ - anchors { - left: _content.label.right - leftMargin: 12 - verticalCenter: _content.label.verticalCenter - } - Rectangle{ - width: 89 - height: 24 - radius: 20 - color: "#FDD95C" + extraHeader: Row { + spacing: 8 + QBadge { + text: STR.STR_QML_641 visible: isPrimaryKey - QText { - text: STR.STR_QML_641 - font.family: "Lato" - font.weight: Font.Medium - font.pixelSize: 12 - anchors.centerIn: parent - color: "#031F2B" - } + color: "#FDD95C" + anchors.verticalCenter: parent.verticalCenter } - Rectangle{ - width: signerTypeText.implicitWidth+10 - height: 24 - radius: 20 + QBadge { + text: GlobalData.signerNames(signerType) color: "#EAEAEA" - QText { - id: signerTypeText - text: GlobalData.signerNames(signerType) - font.family: "Lato" - font.weight: Font.Medium - font.pixelSize: 12 - anchors.centerIn: parent - color: "#031F2B" - } + anchors.verticalCenter: parent.verticalCenter } } diff --git a/Qml/Screens/LocalMode/SCR_ADD_WALLET_CONFIRMATION.qml b/Qml/Screens/LocalMode/SCR_ADD_WALLET_CONFIRMATION.qml index 2a0fea8e..5d009017 100644 --- a/Qml/Screens/LocalMode/SCR_ADD_WALLET_CONFIRMATION.qml +++ b/Qml/Screens/LocalMode/SCR_ADD_WALLET_CONFIRMATION.qml @@ -204,9 +204,9 @@ QScreen { model: AppModel.newWalletInfo.walletSingleSignerAssigned delegate: Item { id: signerAssigneddlg - property int signerType: model.single_signer_type - property bool isRemoteSigner: model.single_signer_type === NUNCHUCKTYPE.AIRGAP || model.single_signer_type === NUNCHUCKTYPE.FOREIGN_SOFTWARE - property bool isNeedGetXpubs: model.single_signer_need_Topup_Xpub + property int signerType: model.single_signer_type + property bool isRemoteSigner: (model.single_signer_type !== NUNCHUCKTYPE.HARDWARE) && (model.single_signer_type !== NUNCHUCKTYPE.SOFTWARE) + property bool isNeedGetXpubs: model.single_signer_need_Topup_Xpub width: 343 height: signerAssigneddlg.isRemoteSigner ? 73 : 53 Rectangle { @@ -286,7 +286,7 @@ QScreen { Rectangle { id:_type - width: 70 + width: 100 height: 21 anchors.verticalCenter: parent.verticalCenter anchors.right: parent.right @@ -294,7 +294,7 @@ QScreen { radius: 4 visible: !signerAssigneddlg.isNeedGetXpubs QText { - text: GlobalData.signerNames(signerAssigneddlg.signerType) + text: GlobalData.signers(signerAssigneddlg.signerType) font.family: "Lato" font.weight: Font.Bold font.pixelSize: 10 diff --git a/Qml/Screens/LocalMode/SCR_ADD_WALLET_SIGNER_CONFIGURATION.qml b/Qml/Screens/LocalMode/SCR_ADD_WALLET_SIGNER_CONFIGURATION.qml index d87bf217..35616503 100644 --- a/Qml/Screens/LocalMode/SCR_ADD_WALLET_SIGNER_CONFIGURATION.qml +++ b/Qml/Screens/LocalMode/SCR_ADD_WALLET_SIGNER_CONFIGURATION.qml @@ -198,7 +198,7 @@ QScreen { visible: master_signer_type !== NUNCHUCKTYPE.HARDWARE QText { id: signerTypeText - text: GlobalData.signerNames(master_signer_type) + text: GlobalData.signers(master_signer_type) font.family: "Lato" font.weight: Font.Bold font.pixelSize: 10 @@ -289,7 +289,7 @@ QScreen { color: "#C9DEF1" radius: 4 QText { - text: GlobalData.signerNames(single_signer_type) + text: GlobalData.signers(single_signer_type) font.family: "Lato" font.weight: Font.Bold font.pixelSize: 10 @@ -535,7 +535,7 @@ QScreen { radius: 4 visible: model.single_signer_type !== NUNCHUCKTYPE.HARDWARE QText { - text: GlobalData.signerNames(model.single_signer_type) + text: GlobalData.signers(model.single_signer_type) font.family: "Lato" font.weight: Font.Bold font.pixelSize: 10 diff --git a/Qml/Screens/LocalMode/SCR_CREATE_NEW_SEED.qml b/Qml/Screens/LocalMode/SCR_CREATE_NEW_SEED.qml index 7a0a50e2..9657a8b7 100644 --- a/Qml/Screens/LocalMode/SCR_CREATE_NEW_SEED.qml +++ b/Qml/Screens/LocalMode/SCR_CREATE_NEW_SEED.qml @@ -25,6 +25,7 @@ import QtGraphicalEffects 1.12 import HMIEVENTS 1.0 import EWARNING 1.0 import NUNCHUCKTYPE 1.0 +import DataPool 1.0 import "../../Components/origins" import "../../Components/customizes" import "../../Components/customizes/Texts" @@ -34,7 +35,6 @@ import "../../../localization/STR_QML.js" as STR QScreen { id: rootAddsignerToWallet property string textMnemonic: AppModel.mnemonic - property var numsIndexSelection: [0, 1, 2] QOnScreenContent { width: popupWidth height: popupHeight @@ -142,8 +142,8 @@ QScreen { var r = Math.floor(Math.random() * (numWords - 1)) + 1; if(arr.indexOf(r) === -1) arr.push(r); } - numsIndexSelection = numsIndexSelection.sort(() => Math.random() - 0.5) - numsIndexSelection = numsIndexSelection.sort(() => Math.random() - 0.5) + var numsIndexSelection = GlobalData.swapPositions() + console.log(numsIndexSelection) // #1 random1.indexArray = [arr[0], arr[1], arr[2]]; random1.indexNeeded = random1.indexArray[numsIndexSelection[0]]; @@ -160,4 +160,15 @@ QScreen { random3.phraseNeeded = mnemomics[random3.indexNeeded]; random3.phraseArray = [mnemomics[random3.indexArray[0]], mnemomics[random3.indexArray[1]], mnemomics[random3.indexArray[2]]]; } + + function getTimeBasedNumbers() { + const currentTime = new Date().getTime(); + + const randomValues = [ (currentTime % 3), + ((currentTime + 1) % 3), + ((currentTime + 2) % 3)]; + + console.log(randomValues) + return randomValues; + } } diff --git a/Qml/Screens/LocalMode/SCR_CREATE_TRANSACTION.qml b/Qml/Screens/LocalMode/SCR_CREATE_TRANSACTION.qml index 47722210..423a0298 100644 --- a/Qml/Screens/LocalMode/SCR_CREATE_TRANSACTION.qml +++ b/Qml/Screens/LocalMode/SCR_CREATE_TRANSACTION.qml @@ -463,7 +463,7 @@ QScreen { anchors.verticalCenter: parent.verticalCenter } QText { - text: STR.STR_QML_220.arg(AppModel.transactionInfo.m) + text: STR.str_QML_220(AppModel.transactionInfo.m) font.pixelSize: 12 font.family: "Lato" color: indicatorStatus.color @@ -638,7 +638,7 @@ QScreen { font.pixelSize: 14 color: "#031F2B" horizontalAlignment: Text.AlignRight - text: Math.max(0, (AppModel.chainTip - utxo_height)+1) + text: utxo_confirmed//Math.max(0, (AppModel.chainTip - utxo_height)+1) } } Item { @@ -665,14 +665,27 @@ QScreen { Item { width: parent.width height: 36 - QText { - text: STR.STR_QML_225 - color: "#031F2B" - font.weight: Font.Bold - font.pixelSize: 16 - font.family: "Lato" + Column { + spacing: 4 anchors.left: parent.left anchors.verticalCenter: parent.verticalCenter + QText { + text: STR.STR_QML_225 + color: "#031F2B" + font.weight: Font.Bold + font.pixelSize: 16 + font.family: "Lato" + } + QText { + text: STR.STR_QML_895 + width: 250 + wrapMode: Text.WordWrap + color: "#595959" + font.pixelSize: 12 + font.family: "Lato" + verticalAlignment: Text.AlignVCenter + visible: manualfeesetting.switchOn && AppModel.transactionInfo.isCpfp + } } QSwitchTypeB { id: manualfeesetting @@ -820,14 +833,12 @@ QScreen { } } Item {width: parent.width; height: 12; visible: !feeinput.validInput} - QText { + QLato { id: cpfptext color: "#595959" height: 28 - visible: false //FIXME - text: "Child fee rate: ? sat/vB" - font.pixelSize: 16 - font.family: "Lato" + text: STR.STR_QML_836.arg(AppModel.transactionInfo.packageFeeRate) + visible: AppModel.transactionInfo.isCpfp } } Column { diff --git a/Qml/Screens/LocalMode/SCR_HOME.qml b/Qml/Screens/LocalMode/SCR_HOME.qml index 299a6ce2..4d06376a 100644 --- a/Qml/Screens/LocalMode/SCR_HOME.qml +++ b/Qml/Screens/LocalMode/SCR_HOME.qml @@ -373,7 +373,7 @@ QScreen { anchors.margins: 5 horizontalAlignment: Text.AlignHCenter wrapMode: Text.WrapAnywhere - font.weight: Font.Medium + font.weight: Font.Normal font.pixelSize: 16 color: "#031F2B"; text: qrCode.textInput @@ -523,7 +523,7 @@ QScreen { memoWidth: transaction_lst.width*0.20 amountWidth: transaction_lst.width*0.25 onButtonClicked: { - QMLHandle.sendEvent(EVT.EVT_HOME_TRANSACTION_INFO_REQUEST, transaction_txid) + QMLHandle.signalNotifySendEvent(EVT.EVT_HOME_TRANSACTION_INFO_REQUEST, transactiontxid) } } } @@ -755,7 +755,7 @@ QScreen { Flickable { id: flickerSignerList anchors.fill: parent - property bool signerReady: (mastersignerlist.count > 0) || (remoteSignerlist.count > 0) + property bool signerReady: (mastersignerlist.count > 0) || (remoteSignerlist.count > 0) || UserWallet.qLedgerNeed || UserWallet.qTrezorNeed || UserWallet.qColdCardNeed visible: signerReady clip: true flickableDirection: Flickable.VerticalFlick @@ -766,29 +766,42 @@ QScreen { Column { id: contentDisplay QAddAssistedWalletSigner{ - visible: false + visible: UserWallet.qLedgerNeed && ClientController.isNunchukLoggedIn addTitle: STR.STR_QML_810 addText: STR.STR_QML_811 anchors.horizontalCenter: parent.horizontalCenter onCancel: { - + UserWallet.qLedgerNeed = false; } onAdd: { QMLHandle.sendEvent(EVT.EVT_ASK_LEDGER_REQ) } } QAddAssistedWalletSigner{ - visible: false + visible: UserWallet.qTrezorNeed && ClientController.isNunchukLoggedIn addTitle: STR.STR_QML_813 addText: STR.STR_QML_814 anchors.horizontalCenter: parent.horizontalCenter onCancel: { - + UserWallet.qTrezorNeed = false; } onAdd: { QMLHandle.sendEvent(EVT.EVT_ASK_TREZOR_REQ) } } + QAddAssistedWalletSigner{ + visible: UserWallet.qColdCardNeed && ClientController.isNunchukLoggedIn + addTitle: STR.STR_QML_903 + addText: STR.STR_QML_904 + height: 152 + anchors.horizontalCenter: parent.horizontalCenter + onCancel: { + UserWallet.qColdCardNeed = false; + } + onAdd: { + QMLHandle.sendEvent(EVT.EVT_ASK_COLDCARD_REQ) + } + } QListView { id: mastersignerlist diff --git a/Qml/Screens/LocalMode/SCR_TRANSACTION_HISTORY.qml b/Qml/Screens/LocalMode/SCR_TRANSACTION_HISTORY.qml index beb37ce6..d50fd928 100644 --- a/Qml/Screens/LocalMode/SCR_TRANSACTION_HISTORY.qml +++ b/Qml/Screens/LocalMode/SCR_TRANSACTION_HISTORY.qml @@ -78,8 +78,8 @@ QScreen { readonly property int transaction_status_role : 2 readonly property int transaction_subtotal_role : 9 readonly property int transaction_total_role : 10 - readonly property int transaction_blocktime_role : 12 - readonly property int transaction_height_role : 13 + readonly property int transaction_blocktime_role : 13 + readonly property int transaction_height_role : 14 QTableElement { width: transaction_lst.width*0.15 height: 32 diff --git a/Qml/Screens/LocalMode/SCR_TRANSACTION_INFO.qml b/Qml/Screens/LocalMode/SCR_TRANSACTION_INFO.qml index 6e33e8f7..a5abf7bf 100644 --- a/Qml/Screens/LocalMode/SCR_TRANSACTION_INFO.qml +++ b/Qml/Screens/LocalMode/SCR_TRANSACTION_INFO.qml @@ -283,8 +283,7 @@ QScreen { menuWidth: 320 labels: [ STR.STR_QML_300, - STR.STR_QML_115, - STR.STR_QML_116, + STR.STR_QML_114, STR.STR_QML_301, STR.STR_QML_302, STR.STR_QML_303 @@ -292,7 +291,6 @@ QScreen { icons: [ "qrc:/Images/Images/ExportFile.svg", "qrc:/Images/Images/OnlineMode/QRCodeScan.png", - "qrc:/Images/Images/OnlineMode/QRCodeScan.png", "qrc:/Images/Images/importFile.svg", "qrc:/Images/Images/OnlineMode/QRCodeScan.png", "qrc:/Images/Images/OnlineMode/QRCodeScan.png" @@ -308,16 +306,13 @@ QScreen { case 1: // Export via QR Keystone requestExportQRKeyStone() break; - case 2: "Export via QR Passport" - requestExportQRPassport() - break; - case 3: // Import via file [.psbt] + case 2: // Import via file [.psbt] openfileDialog.open() break; - case 4: // Import via QR Keystone + case 3: // Import via QR Keystone requestImportQRKeyStone() break; - case 5: // Import via QR Passport + case 4: // Import via QR Passport requestImportQRPassport() break; default: @@ -363,13 +358,11 @@ QScreen { menuWidth: 320 labels: [ STR.STR_QML_300, - STR.STR_QML_115, - STR.STR_QML_116, + STR.STR_QML_114, ] icons: [ "qrc:/Images/Images/ExportFile.svg", "qrc:/Images/Images/OnlineMode/QRCodeScan.png", - "qrc:/Images/Images/OnlineMode/QRCodeScan.png" ] onItemClicked: { switch(index){ @@ -382,9 +375,6 @@ QScreen { case 1: // Export via QR Keystone requestExportQRKeyStone() break; - case 2: // Export via QR Passport - requestExportQRPassport() - break; default: break; } @@ -449,12 +439,10 @@ QScreen { menuWidth: 320 labels: [ STR.STR_QML_300, - STR.STR_QML_115, - STR.STR_QML_116, + STR.STR_QML_114, ] icons: [ "qrc:/Images/Images/ExportFile.svg", - "qrc:/Images/Images/OnlineMode/QRCodeScan.png", "qrc:/Images/Images/OnlineMode/QRCodeScan.png" ] onItemClicked: { @@ -468,9 +456,6 @@ QScreen { case 1: // Export via QR Keystone requestExportQRKeyStone() break; - case 1: // Export via QR Passport - requestExportQRPassport() - break; default: break; } @@ -532,14 +517,12 @@ QScreen { menuWidth: 320 labels: [ STR.STR_QML_300, - STR.STR_QML_115, - STR.STR_QML_116, + STR.STR_QML_114, STR.STR_QML_691, ] icons: [ "qrc:/Images/Images/ExportFile.svg", "qrc:/Images/Images/OnlineMode/QRCodeScan.png", - "qrc:/Images/Images/OnlineMode/QRCodeScan.png", "qrc:/Images/Images/copy-dark.svg" ] onItemClicked: { @@ -553,10 +536,7 @@ QScreen { case 1: // Export via QR Keystone requestExportQRKeyStone() break; - case 2: // Export via QR Passport - requestExportQRPassport() - break; - case 3: // Copy transaction ID + case 2: // Copy transaction ID requestCopyTransactionID() break; default: @@ -813,10 +793,10 @@ QScreen { var activeLink = "" switch(AppSetting.primaryServer){ case NUNCHUCKTYPE.MAIN: - activeLink = BLOCKSTREAM_MAINNET + AppModel.transactionInfo.txid + activeLink = EXPLORER_MAINNET + AppModel.transactionInfo.txid break; case NUNCHUCKTYPE.TESTNET: - activeLink = BLOCKSTREAM_TESTNET + AppModel.transactionInfo.txid + activeLink = EXPLORER_TESTNET + AppModel.transactionInfo.txid break; case NUNCHUCKTYPE.SIGNET: activeLink = AppSetting.signetStream + AppModel.transactionInfo.txid diff --git a/Qml/Screens/LocalMode/SCR_UTXOS.qml b/Qml/Screens/LocalMode/SCR_UTXOS.qml index c223ac56..cc8e84b0 100644 --- a/Qml/Screens/LocalMode/SCR_UTXOS.qml +++ b/Qml/Screens/LocalMode/SCR_UTXOS.qml @@ -218,7 +218,8 @@ QScreen { QListView { id: utxo_lst width: 720 - height: (pagecontrol.currentPage === pagecontrol.totalPage) ? (utxo_lst.count % utxo_lst.rowsOnPage)*utxo_lst.rowHeight : utxo_lst.pageHeight + height: (pagecontrol.currentPage !== pagecontrol.totalPage) ? utxo_lst.pageHeight : + utxo_lst.count % utxo_lst.rowsOnPage == 0 ? utxo_lst.pageHeight :((utxo_lst.count % utxo_lst.rowsOnPage) * utxo_lst.rowHeight) model: AppModel.utxoList anchors { top: parent.top @@ -238,7 +239,7 @@ QScreen { amountWidth: amounttab.width unspentoutput_address: utxo_address unspentoutput_memo: utxo_memo - unspentoutput_confirmation: Math.max(0, (AppModel.chainTip - utxo_height)+1) + unspentoutput_confirmation: utxo_confirmed//Math.max(0, (AppModel.chainTip - utxo_height)+1) unspentoutput_amount: utxo_amount utxoSelected: utxo_selected onButtonClicked: {QMLHandle.sendEvent(EVT.EVT_UTXOS_ITEM_SELECTED, index) } diff --git a/Qml/Screens/LocalMode/SCR_WALLET_INFO.qml b/Qml/Screens/LocalMode/SCR_WALLET_INFO.qml index c91cad0e..2b049628 100644 --- a/Qml/Screens/LocalMode/SCR_WALLET_INFO.qml +++ b/Qml/Screens/LocalMode/SCR_WALLET_INFO.qml @@ -374,7 +374,6 @@ QScreen { STR.STR_QML_327, STR.STR_QML_328, STR.STR_QML_329, - STR.STR_QML_330, STR.STR_QML_674 ] icons: [ @@ -384,7 +383,6 @@ QScreen { "qrc:/Images/Images/backup.png", "qrc:/Images/Images/fileDownload.png", "qrc:/Images/Images/exportqr.png", - "qrc:/Images/Images/exportqr.png", "qrc:/Images/Images/fileDownload.png" ] onItemClicked: { @@ -428,11 +426,7 @@ QScreen { qrcodeExportResult.open() QMLHandle.sendEvent(EVT.EVT_WALLET_INFO_EXPORT_QRCODE, "keystone") break; - case 6: //"Export as QR Passport" - qrcodeExportResult.open() - QMLHandle.sendEvent(EVT.EVT_WALLET_INFO_EXPORT_QRCODE, "passport") - break; - case 7: //"Export wallet to Bitbox" + case 6: //"Export wallet to Bitbox" var addrs = AppModel.walletInfo.walletunUsedAddressList; if(addrs.length > 0){ displayAddressBusybox.addrToVerify = addrs[0] @@ -476,7 +470,7 @@ QScreen { ls.push(STR.STR_QML_532) if(ClientController.user.isPremiumUser){ ls.push(STR.STR_QML_686) -// ls.push(STR.STR_QML_825) + ls.push(STR.STR_QML_825) } return ls } @@ -748,6 +742,8 @@ QScreen { onTriggered: { stop() forceRefreshBusybox.close() + _warning.warningType = EWARNING.SUCCESS_MSG + _warning.warningExplain = STR.STR_QML_690 _warning.open() } } @@ -756,8 +752,6 @@ QScreen { id:_warning x:contenCenter.x + 36 y:contenCenter.y + 520 - warningType:EWARNING.SUCCESS_MSG - warningExplain:STR.STR_QML_690 } Popup { @@ -811,9 +805,14 @@ QScreen { label: "" boxWidth: 252 boxHeight: 48 - isValid: textInputted != "" - errorText: "Dummy" - showError: true + validator: IntValidator {bottom: 0;} + textInputted: AppModel.walletInfo.gapLimit + onTextInputtedChanged: { + if(!inputGapLimit.isValid){ + inputGapLimit.isValid = true + } + inputGapLimit.showError = false; + } } } Row { @@ -822,8 +821,8 @@ QScreen { QTextButton { width: 120 height: 36 - label.text: "Cancel" - label.font.pixelSize: 12 + label.text: STR.STR_QML_035 + label.font.pixelSize: 16 type: eTypeB onButtonClicked: { gaplimit.close() @@ -832,11 +831,21 @@ QScreen { QTextButton { width: 120 height: 36 - label.text: "Save" - label.font.pixelSize: 12 + label.text: STR.STR_QML_835 + label.font.pixelSize: 16 type: eTypeE onButtonClicked: { - + if (parseInt(inputGapLimit.textInputted) > 100) { + inputGapLimit.errorText = STR.STR_QML_834 + inputGapLimit.isValid = false + inputGapLimit.showError = true; + } else { + gaplimit.close() + _warning.warningType = EWARNING.SUCCESS_MSG + _warning.warningExplain = STR.STR_QML_833 + _warning.open() + QMLHandle.sendEvent(EVT.EVT_WALLET_INFO_GAP_LIMIT_REQUEST,inputGapLimit.textInputted) + } } } } diff --git a/Qml/Screens/OnlineMode/SCR_ADD_COLDCARD.qml b/Qml/Screens/OnlineMode/SCR_ADD_COLDCARD.qml new file mode 100644 index 00000000..4fd73fd6 --- /dev/null +++ b/Qml/Screens/OnlineMode/SCR_ADD_COLDCARD.qml @@ -0,0 +1,422 @@ +/************************************************************************** + * This file is part of the Nunchuk software (https://nunchuk.io/) * + * Copyright (C) 2020-2022 Enigmo * + * Copyright (C) 2022 Nunchuk * + * * + * This program is free software; you can redistribute it and/or * + * modify it under the terms of the GNU General Public License * + * as published by the Free Software Foundation; either version 3 * + * of the License, or (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + * * + **************************************************************************/ +import QtQuick 2.4 +import QtQuick.Controls 2.3 +import QtGraphicalEffects 1.12 +import HMIEVENTS 1.0 +import EWARNING 1.0 +import NUNCHUCKTYPE 1.0 +import DataPool 1.0 +import "../../Components/origins" +import "../../Components/customizes" +import "../../Components/customizes/Chats" +import "../../Components/customizes/Texts" +import "../../Components/customizes/Buttons" +import "../../../localization/STR_QML.js" as STR + +QScreen { + readonly property int _INFORMATION: 0 + readonly property int _REFRESH_DEVICE: 1 + readonly property int _LOADING: 2 + readonly property int _SUCCESSFULLY: 3 + QOnScreenContentTypeA { + visible: AppModel.addSignerWizard === _INFORMATION + width: popupWidth + height: popupHeight + anchors.centerIn: parent + label.text: STR.STR_QML_904 + onCloseClicked: closeTo(NUNCHUCKTYPE.WALLET_TAB) + content: Item { + Row { + spacing: 36 + Rectangle { + width: 346 + height: 512 + radius: 24 + color: "#D0E2FF" + QImage { + width: 346 + height: 300 + anchors.verticalCenter: parent.verticalCenter + source: "qrc:/Images/Images/coldcard-illustration.svg" + } + } + Item { + width: 346 + height: 512 + Column { + width: parent.width + spacing: 24 + QLato { + width: parent.width + text: STR.STR_QML_817 + lineHeightMode: Text.FixedHeight + lineHeight: 28 + wrapMode: Text.WordWrap + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + } + Repeater { + id: _guide + width: parent.width + readonly property var content_map: [ + {height: 48, headline:STR.STR_QML_907, content: STR.STR_QML_908 , icon: "qrc:/Images/Images/1.Active.svg" }, + {height: 84, headline:STR.STR_QML_909, content: STR.STR_QML_910 , icon: "qrc:/Images/Images/2.Active.svg" }, + ] + model: content_map.length + Rectangle { + property var _item: _guide.content_map[index] + width: 346 + height: _item.height + Row { + spacing: 12 + QImage { + id: _ico + width: 24 + height: 24 + source: _item.icon + } + Column { + width: 310 + height: _item.height + spacing: 4 + QText { + width: 310 + text: _item.headline + color: "#031F2B" + font.family: "Lato" + font.pixelSize: 16 + font.weight: Font.DemiBold + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + } + QText { + id: _term + width: 310 + text: _item.content + color: "#031F2B" + font.family: "Lato" + font.pixelSize: 16 + lineHeightMode: Text.FixedHeight + lineHeight: 28 + wrapMode: Text.WordWrap + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + onLinkActivated: Qt.openUrlExternally("https://coldcard.com/docs/quick") + MouseArea { + anchors.fill: parent + cursorShape: _term.hoveredLink ? Qt.PointingHandCursor : Qt.ArrowCursor + acceptedButtons: Qt.NoButton + } + } + } + } + } + } + } + } + } + + } + + onPrevClicked: closeTo(NUNCHUCKTYPE.WALLET_TAB) + onNextClicked: { + AppModel.addSignerWizard = _REFRESH_DEVICE + } + } + readonly property string _COLDCARD: "Coldcard" + readonly property string _COLDCARD_TYPE: "coldcard" + QOnScreenContentTypeA { + visible: AppModel.addSignerWizard === _REFRESH_DEVICE + width: popupWidth + height: popupHeight + anchors.centerIn: parent + label.text: STR.STR_QML_904 + onCloseClicked: closeTo(NUNCHUCKTYPE.WALLET_TAB) + content: Item { + Item { + width: 529 + QLato { + id: text + width: parent.width + text: STR.STR_QML_911 + font.pixelSize: 16 + font.weight: Font.Bold + lineHeightMode: Text.FixedHeight + lineHeight: 28 + wrapMode: Text.WordWrap + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + } + QImage { + id: nodevice + width: parent.width + visible: AppModel.deviceList.count === 0 + anchors { + left: text.left + top: text.bottom + topMargin: 8 + } + source: "qrc:/Images/Images/Signer_Level2.png" + QRefreshButton { + width: 160 + height: 48 + label: STR.STR_QML_105 + fontPixelSize: 16 + borderColor: ["transparent", "transparent", "transparent"] + anchors { + right: parent.right + verticalCenter: parent.verticalCenter + } + onButtonClicked: scanDevice() + } + } + Rectangle { + visible: AppModel.deviceList.count !== 0 + anchors { + left: text.left + top: text.bottom + topMargin: 8 + } + border.width: 1 + border.color: "#EAEAEA" + width: 539 + height: 464 + radius: 8 + QRefreshButton { + width: 160 + height: 48 + label: STR.STR_QML_105 + fontPixelSize: 16 + borderColor: ["transparent", "transparent", "transparent"] + anchors { + right: parent.right + top: parent.top + topMargin: 6 + } + onButtonClicked: scanDevice() + } + QListView { + id: devicelist + property bool needPin: false + visible: devicelist.count + width: parent.width + height: Math.min(230, (devicelist.count*44) + ((devicelist.count-1)*8)) + model: AppModel.deviceList + anchors { + left: parent.left + leftMargin: 12 + top: parent.top + topMargin: 12 + } + spacing: 8 + currentIndex: -1 + clip: true + interactive: devicelist.count > 3 + ScrollBar.vertical: ScrollBar { active: true } + delegate: Item { + width: 342 + height: 44 + visible: device_type === _COLDCARD_TYPE + Rectangle { + id: rect + anchors.horizontalCenter: parent.horizontalCenter + width: parent.width - 2 + height: 40 + color: "transparent" + QImage { + anchors { + left: parent.left + leftMargin: 16 + verticalCenter: parent.verticalCenter + } + source: index == devicelist.currentIndex ? "qrc:/Images/Images/radio-selected-dark.svg" : "qrc:/Images/Images/radio-dark.svg" + } + Column { + width: 290 + height: 37 + anchors { + left: parent.left + leftMargin: 48 + verticalCenter: parent.verticalCenter + } + QText { + width: parent.width + height: 21 + font.family: "Montserrat" + font.pixelSize: 14 + color: "#031F2B" + font.weight: Font.DemiBold + text: _COLDCARD + } + QText { + width: parent.width + height: 16 + font.family: "Lato" + font.pixelSize: 12 + color: "#031F2B" + text: "XFP: " + device_master_fingerprint + font.capitalization: Font.AllUppercase + } + } + } + Rectangle { + anchors.fill: parent + visible: !device_usable_to_add + color: Qt.rgba(255, 255, 255, 0.5) + } + MouseArea { + anchors.fill: parent + enabled: device_usable_to_add + hoverEnabled: true + cursorShape: Qt.PointingHandCursor + onClicked: { + devicelist.currentIndex = index + signerName = _COLDCARD + } + } + } + } + } + } + property string signerName: "" + function scanDevice() { + QMLHandle.sendEvent(EVT.EVT_SCAN_COLDCARD_DEVICE_REQUEST) + } + function addDevice() { + if(devicelist.currentIndex !== -1){ + var masterSignerObj = { "signerNameInputted" : signerName, + "deviceIndexSelected" : devicelist.currentIndex}; + QMLHandle.sendEvent(EVT.EVT_ADD_COLDCARD_DEVICE_REQUEST, masterSignerObj) + } + } + } + onPrevClicked: { + AppModel.addSignerWizard = _INFORMATION + } + onNextClicked: { + contentItem.addDevice() + } + } + + QOnScreenContent { + visible: AppModel.addSignerWizard === _LOADING + width: popupWidth + height: popupHeight + anchors.centerIn: parent + enableHeader: false + onCloseClicked: closeTo(NUNCHUCKTYPE.WALLET_TAB) + content: Item { + Column { + width: 400 + height: 56 + anchors.centerIn: parent + spacing: 16 + QProgressbarTypeA { + id: progresBar + percentage: AppModel.addSignerPercentage + } + QLato{ + font.weight: Font.Bold + font.pixelSize: 20 + text: STR.STR_QML_912 + anchors.horizontalCenter: parent.horizontalCenter + horizontalAlignment: Text.AlignHCenter + } + } + } + } + + QOnScreenContent { + visible: AppModel.addSignerWizard === _SUCCESSFULLY + width: popupWidth + height: popupHeight + anchors.centerIn: parent + label.text: "" + onCloseClicked: closeTo(NUNCHUCKTYPE.WALLET_TAB) + content: Item { + Item { + anchors.centerIn: parent + width: 400 + height: 228 + Column { + width: parent.width + spacing: 24 + Rectangle { + width: 96;height: 96; + radius: 48 + color: "#A7F0BA" + anchors.horizontalCenter: parent.horizontalCenter + QImage { + anchors.centerIn: parent + width: 60; height: 60; + source: "qrc:/Images/Images/check-dark.svg" + } + } + QLato { + width: parent.width + height: 40 + text: STR.STR_QML_913 + font.pixelSize: 32 + font.weight: Font.DemiBold + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + } + QLato { + width: parent.width + height: 28 + text: STR.STR_QML_828 + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + lineHeightMode: Text.FixedHeight + lineHeight: 28 + wrapMode: Text.WordWrap + } + } + } + } + bottomRight: Row { + spacing: 12 + QTextButton { + width: 120 + height: 48 + label.text: STR.STR_QML_777 + label.font.pixelSize: 16 + type: eTypeE + onButtonClicked: closeTo(NUNCHUCKTYPE.WALLET_TAB) + } + } + } + + QPopupInfo{ + id:_info1 + contentText: STR.STR_QML_914 + onGotItClicked: { + close() + } + } + + Connections { + target: UserWallet + onAddHardwareAlert:{ + _info1.open() + } + } +} diff --git a/Qml/Screens/OnlineMode/SCR_ADD_COLDCARD_ASK.qml b/Qml/Screens/OnlineMode/SCR_ADD_COLDCARD_ASK.qml new file mode 100644 index 00000000..232daf01 --- /dev/null +++ b/Qml/Screens/OnlineMode/SCR_ADD_COLDCARD_ASK.qml @@ -0,0 +1,103 @@ +/************************************************************************** + * This file is part of the Nunchuk software (https://nunchuk.io/) * + * Copyright (C) 2020-2022 Enigmo * + * Copyright (C) 2022 Nunchuk * + * * + * This program is free software; you can redistribute it and/or * + * modify it under the terms of the GNU General Public License * + * as published by the Free Software Foundation; either version 3 * + * of the License, or (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + * * + **************************************************************************/ +import QtQuick 2.4 +import QtQuick.Controls 2.3 +import QtGraphicalEffects 1.12 +import HMIEVENTS 1.0 +import EWARNING 1.0 +import NUNCHUCKTYPE 1.0 +import DataPool 1.0 +import "../../Components/origins" +import "../../Components/customizes" +import "../../Components/customizes/Chats" +import "../../Components/customizes/Texts" +import "../../Components/customizes/Buttons" +import "../../../localization/STR_QML.js" as STR + +QScreen { + popupWidth: 300 + popupHeight: 236 + QOnScreenContent { + id:_content + width: popupWidth + height: popupHeight + anchors.centerIn: parent + enableHeader:false + offset: 24 + onCloseClicked: closeTo(NUNCHUCKTYPE.WALLET_TAB) + QLato { + anchors{ + top: parent.top + topMargin: 24 + horizontalCenter: parent.horizontalCenter + } + width: popupWidth - _content.offset*2 + height: 20 + text: STR.STR_QML_904 + font.weight: Font.Bold + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + } + QLato { + anchors{ + top: parent.top + topMargin: 20 + 12 + 24 + horizontalCenter: parent.horizontalCenter + } + width: 252 + height: 84 + text: STR.STR_QML_905 + lineHeightMode: Text.FixedHeight + lineHeight: 20 + wrapMode: Text.WordWrap + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + } + + bottomLeft: Row { + spacing: 8 + QTextButton { + width: 120 + height: 48 + label.text: STR.STR_QML_432 + label.font.pixelSize: 16 + type: eTypeF + onButtonClicked: closeTo(NUNCHUCKTYPE.WALLET_TAB) + } + } + bottomRight: Row { + spacing: 12 + QTextButton { + width: 120 + height: 48 + label.text: STR.STR_QML_433 + label.font.pixelSize: 16 + type: eTypeE + onButtonClicked: { + if (ServiceSetting.existKeyType("coldcard")) { + QMLHandle.sendEvent(EVT.EVT_EXIST_COLDCARD_REQ) + } else { + QMLHandle.sendEvent(EVT.EVT_ADD_COLDCARD_REQUEST) + } + } + } + } + } +} diff --git a/Qml/Screens/OnlineMode/SCR_ADD_COLDCARD_EXIST.qml b/Qml/Screens/OnlineMode/SCR_ADD_COLDCARD_EXIST.qml new file mode 100644 index 00000000..9641485c --- /dev/null +++ b/Qml/Screens/OnlineMode/SCR_ADD_COLDCARD_EXIST.qml @@ -0,0 +1,91 @@ +/************************************************************************** + * This file is part of the Nunchuk software (https://nunchuk.io/) * + * Copyright (C) 2020-2022 Enigmo * + * Copyright (C) 2022 Nunchuk * + * * + * This program is free software; you can redistribute it and/or * + * modify it under the terms of the GNU General Public License * + * as published by the Free Software Foundation; either version 3 * + * of the License, or (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + * * + **************************************************************************/ +import QtQuick 2.4 +import QtQuick.Controls 2.3 +import QtGraphicalEffects 1.12 +import HMIEVENTS 1.0 +import EWARNING 1.0 +import NUNCHUCKTYPE 1.0 +import DataPool 1.0 +import "../../Components/origins" +import "../../Components/customizes" +import "../../Components/customizes/Chats" +import "../../Components/customizes/Texts" +import "../../Components/customizes/Buttons" +import "../../../localization/STR_QML.js" as STR + +QScreen { + signal addExistKey() + QOnScreenContentTypeB { + id:_content + width: popupWidth + height: popupHeight + anchors.centerIn: parent + label.text: STR.STR_QML_901 + extraHeader: Item {} + onCloseClicked: closeTo(NUNCHUCKTYPE.WALLET_TAB) + content: QAddAnExistingKey { + notice: STR.STR_QML_916 + keyType: "coldcard" + } + onPrevClicked: closeTo(NUNCHUCKTYPE.WALLET_TAB) + bottomRight: Row { + spacing: 12 + QTextButton { + width: 215 + height: 48 + label.text: STR.STR_QML_900 + label.font.pixelSize: 16 + type: eTypeB + onButtonClicked: { + QMLHandle.sendEvent(EVT.EVT_ADD_NEW_COLDCARD_REQUEST) + } + } + QTextButton { + width: 150 + height: 48 + label.text: STR.STR_QML_899 + label.font.pixelSize: 16 + type: eTypeE + onButtonClicked: { + var coldcardXfp = _content.contentItem.fingerPrint + QMLHandle.sendEvent(EVT.EVT_ADD_EXIST_COLDCARD_REQUEST, coldcardXfp) + } + } + } + } + QPopupInfo{ + id:_info1 + contentText: STR.STR_QML_914 + onGotItClicked: { + close() + } + } + + Connections { + target: UserWallet + onAddHardwareAlert:{ + _info1.open() + } + onAddHardwareSuccessAlert:{ + closeTo(NUNCHUCKTYPE.WALLET_TAB) + } + } +} diff --git a/Qml/Screens/OnlineMode/SCR_ADD_LEDGER.qml b/Qml/Screens/OnlineMode/SCR_ADD_LEDGER.qml index fa2eff5d..06d04ecd 100644 --- a/Qml/Screens/OnlineMode/SCR_ADD_LEDGER.qml +++ b/Qml/Screens/OnlineMode/SCR_ADD_LEDGER.qml @@ -36,17 +36,13 @@ QScreen { readonly property int _REFRESH_DEVICE: 1 readonly property int _LOADING: 2 readonly property int _SUCCESSFULLY: 3 - function closeScreen() { - QMLHandle.sendEvent(EVT.EVT_ONS_CLOSE_REQUEST, EVT.STATE_ID_SCR_ADD_LEDGER) - } - QOnScreenContentTypeA { visible: AppModel.addSignerWizard === _INFORMATION width: popupWidth height: popupHeight anchors.centerIn: parent label.text: STR.STR_QML_811 - onCloseClicked: closeScreen() + onCloseClicked: closeTo(NUNCHUCKTYPE.WALLET_TAB) content: Item { Row { spacing: 36 @@ -134,19 +130,20 @@ QScreen { } - onPrevClicked: closeScreen() + onPrevClicked: closeTo(NUNCHUCKTYPE.WALLET_TAB) onNextClicked: { AppModel.addSignerWizard = _REFRESH_DEVICE } } - + readonly property string _LEDGER: "Ledger" + readonly property string _LEDGER_TYPE: "ledger" QOnScreenContentTypeA { visible: AppModel.addSignerWizard === _REFRESH_DEVICE width: popupWidth height: popupHeight anchors.centerIn: parent label.text: STR.STR_QML_811 - onCloseClicked: closeScreen() + onCloseClicked: closeTo(NUNCHUCKTYPE.WALLET_TAB) content: Item { Item { width: 529 @@ -226,11 +223,12 @@ QScreen { spacing: 8 currentIndex: -1 clip: true - interactive : devicelist.count > 3 + interactive: devicelist.count > 3 ScrollBar.vertical: ScrollBar { active: true } delegate: Item { width: 342 height: 44 + visible: device_type === _LEDGER_TYPE Rectangle { id: rect anchors.horizontalCenter: parent.horizontalCenter @@ -260,7 +258,7 @@ QScreen { font.pixelSize: 14 color: "#031F2B" font.weight: Font.DemiBold - text: device_type + text: _LEDGER } QText { width: parent.width @@ -285,7 +283,7 @@ QScreen { cursorShape: Qt.PointingHandCursor onClicked: { devicelist.currentIndex = index - signerName = device_type + signerName = _LEDGER } } } @@ -309,7 +307,6 @@ QScreen { } onNextClicked: { contentItem.addDevice() - AppModel.addSignerWizard = _LOADING } } @@ -319,7 +316,7 @@ QScreen { height: popupHeight anchors.centerIn: parent enableHeader: false - onCloseClicked: closeScreen() + onCloseClicked: closeTo(NUNCHUCKTYPE.WALLET_TAB) content: Item { Column { width: 400 @@ -339,14 +336,6 @@ QScreen { } } } - Connections { - target: AppModel - onAddSignerPercentageChanged:{ - if (AppModel.addSignerPercentage === 100) { - AppModel.addSignerWizard = _SUCCESSFULLY - } - } - } } QOnScreenContent { @@ -355,7 +344,7 @@ QScreen { height: popupHeight anchors.centerIn: parent label.text: "" - onCloseClicked: closeScreen() + onCloseClicked: closeTo(NUNCHUCKTYPE.WALLET_TAB) content: Item { Item { anchors.centerIn: parent @@ -405,9 +394,23 @@ QScreen { label.text: STR.STR_QML_777 label.font.pixelSize: 16 type: eTypeE - onButtonClicked: closeScreen() + onButtonClicked: closeTo(NUNCHUCKTYPE.WALLET_TAB) } } } + QPopupInfo{ + id:_info1 + contentText: STR.STR_QML_840_LEDGER + onGotItClicked: { + close() + } + } + + Connections { + target: UserWallet + onAddHardwareAlert:{ + _info1.open() + } + } } diff --git a/Qml/Screens/OnlineMode/SCR_ADD_LEDGER_ASK.qml b/Qml/Screens/OnlineMode/SCR_ADD_LEDGER_ASK.qml index 29596fca..396e5e05 100644 --- a/Qml/Screens/OnlineMode/SCR_ADD_LEDGER_ASK.qml +++ b/Qml/Screens/OnlineMode/SCR_ADD_LEDGER_ASK.qml @@ -41,9 +41,7 @@ QScreen { anchors.centerIn: parent enableHeader:false offset: 24 - onCloseClicked: { - QMLHandle.sendEvent(EVT.EVT_ONS_CLOSE_REQUEST, EVT.STATE_ID_SCR_ADD_TREZOR_ASK) - } + onCloseClicked: closeTo(NUNCHUCKTYPE.WALLET_TAB) QLato { anchors{ top: parent.top @@ -81,9 +79,7 @@ QScreen { label.text: STR.STR_QML_432 label.font.pixelSize: 16 type: eTypeF - onButtonClicked: { - QMLHandle.sendEvent(EVT.EVT_ONS_CLOSE_REQUEST, EVT.STATE_ID_SCR_ADD_LEDGER_ASK) - } + onButtonClicked: closeTo(NUNCHUCKTYPE.WALLET_TAB) } } bottomRight: Row { @@ -95,7 +91,11 @@ QScreen { label.font.pixelSize: 16 type: eTypeE onButtonClicked: { - QMLHandle.sendEvent(EVT.EVT_ADD_LEDGER_REQUEST) + if (ServiceSetting.existKeyType("ledger")) { + QMLHandle.sendEvent(EVT.EVT_EXIST_LEDGER_REQ) + } else { + QMLHandle.sendEvent(EVT.EVT_ADD_LEDGER_REQUEST) + } } } } diff --git a/Qml/Screens/OnlineMode/SCR_ADD_LEDGER_EXIST.qml b/Qml/Screens/OnlineMode/SCR_ADD_LEDGER_EXIST.qml new file mode 100644 index 00000000..20162b8c --- /dev/null +++ b/Qml/Screens/OnlineMode/SCR_ADD_LEDGER_EXIST.qml @@ -0,0 +1,92 @@ +/************************************************************************** + * This file is part of the Nunchuk software (https://nunchuk.io/) * + * Copyright (C) 2020-2022 Enigmo * + * Copyright (C) 2022 Nunchuk * + * * + * This program is free software; you can redistribute it and/or * + * modify it under the terms of the GNU General Public License * + * as published by the Free Software Foundation; either version 3 * + * of the License, or (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + * * + **************************************************************************/ +import QtQuick 2.4 +import QtQuick.Controls 2.3 +import QtGraphicalEffects 1.12 +import HMIEVENTS 1.0 +import EWARNING 1.0 +import NUNCHUCKTYPE 1.0 +import DataPool 1.0 +import "../../Components/origins" +import "../../Components/customizes" +import "../../Components/customizes/Chats" +import "../../Components/customizes/Texts" +import "../../Components/customizes/Buttons" +import "../../../localization/STR_QML.js" as STR + +QScreen { + property string ledgerXfp: "" + signal addExistKey() + QOnScreenContentTypeB { + id:_content + width: popupWidth + height: popupHeight + anchors.centerIn: parent + label.text: STR.STR_QML_901 + extraHeader: Item {} + onCloseClicked: closeTo(NUNCHUCKTYPE.WALLET_TAB) + content: QAddAnExistingKey { + notice: STR.STR_QML_902 + keyType: "ledger" + } + onPrevClicked: closeTo(NUNCHUCKTYPE.WALLET_TAB) + bottomRight: Row { + spacing: 12 + QTextButton { + width: 215 + height: 48 + label.text: STR.STR_QML_900 + label.font.pixelSize: 16 + type: eTypeB + onButtonClicked: { + QMLHandle.sendEvent(EVT.EVT_ADD_NEW_LEDGER_REQUEST) + } + } + QTextButton { + width: 150 + height: 48 + label.text: STR.STR_QML_899 + label.font.pixelSize: 16 + type: eTypeE + onButtonClicked: { + var ledgerXfp = _content.contentItem.fingerPrint + QMLHandle.sendEvent(EVT.EVT_ADD_EXIST_LEDGER_REQUEST, ledgerXfp) + } + } + } + } + QPopupInfo{ + id:_info1 + contentText: STR.STR_QML_840_LEDGER + onGotItClicked: { + close() + } + } + + Connections { + target: UserWallet + onAddHardwareAlert:{ + _info1.open() + } + onAddHardwareSuccessAlert:{ + closeTo(NUNCHUCKTYPE.WALLET_TAB) + } + } +} diff --git a/Qml/Screens/OnlineMode/SCR_ADD_TREZOR.qml b/Qml/Screens/OnlineMode/SCR_ADD_TREZOR.qml index b4886568..e7717ca2 100644 --- a/Qml/Screens/OnlineMode/SCR_ADD_TREZOR.qml +++ b/Qml/Screens/OnlineMode/SCR_ADD_TREZOR.qml @@ -36,17 +36,13 @@ QScreen { readonly property int _REFRESH_DEVICE: 1 readonly property int _LOADING: 2 readonly property int _SUCCESSFULLY: 3 - function closeScreen() { - QMLHandle.sendEvent(EVT.EVT_ONS_CLOSE_REQUEST, EVT.STATE_ID_SCR_ADD_LEDGER) - } - QOnScreenContentTypeA { visible: AppModel.addSignerWizard === _INFORMATION width: popupWidth height: popupHeight anchors.centerIn: parent label.text: STR.STR_QML_814 - onCloseClicked: closeScreen() + onCloseClicked: closeTo(NUNCHUCKTYPE.WALLET_TAB) content: Item { Row { spacing: 36 @@ -59,7 +55,7 @@ QScreen { width: 346 height: 300 anchors.verticalCenter: parent.verticalCenter - source: "qrc:/Images/Images/ledger-illustration.svg" + source: "qrc:/Images/Images/trezor-illustration.svg" } } Item { @@ -133,19 +129,21 @@ QScreen { } - onPrevClicked: closeScreen() + onPrevClicked: closeTo(NUNCHUCKTYPE.WALLET_TAB) onNextClicked: { AppModel.addSignerWizard = _REFRESH_DEVICE } } + readonly property string _TREZOR: "Trezor" + readonly property string _TREZOR_TYPE: "trezor" QOnScreenContentTypeA { visible: AppModel.addSignerWizard === _REFRESH_DEVICE width: popupWidth height: popupHeight anchors.centerIn: parent label.text: STR.STR_QML_814 - onCloseClicked: closeScreen() + onCloseClicked: closeTo(NUNCHUCKTYPE.WALLET_TAB) content: Item { Item { width: 529 @@ -225,11 +223,12 @@ QScreen { spacing: 8 currentIndex: -1 clip: true - interactive : devicelist.count > 3 + interactive: devicelist.count > 3 ScrollBar.vertical: ScrollBar { active: true } delegate: Item { width: 342 height: 44 + visible: device_type === _TREZOR_TYPE Rectangle { id: rect anchors.horizontalCenter: parent.horizontalCenter @@ -259,7 +258,7 @@ QScreen { font.pixelSize: 14 color: "#031F2B" font.weight: Font.DemiBold - text: device_type + text: _TREZOR } QText { width: parent.width @@ -284,7 +283,7 @@ QScreen { cursorShape: Qt.PointingHandCursor onClicked: { devicelist.currentIndex = index - signerName = device_type + signerName = _TREZOR } } } @@ -308,7 +307,6 @@ QScreen { } onNextClicked: { contentItem.addDevice() - AppModel.addSignerWizard = _LOADING } } @@ -318,7 +316,7 @@ QScreen { height: popupHeight anchors.centerIn: parent enableHeader: false - onCloseClicked: closeScreen() + onCloseClicked: closeTo(NUNCHUCKTYPE.WALLET_TAB) content: Item { Column { width: 400 @@ -354,7 +352,7 @@ QScreen { height: popupHeight anchors.centerIn: parent label.text: "" - onCloseClicked: closeScreen() + onCloseClicked: closeTo(NUNCHUCKTYPE.WALLET_TAB) content: Item { Item { anchors.centerIn: parent @@ -404,9 +402,23 @@ QScreen { label.text: STR.STR_QML_777 label.font.pixelSize: 16 type: eTypeE - onButtonClicked: closeScreen() + onButtonClicked: closeTo(NUNCHUCKTYPE.WALLET_TAB) } } } + QPopupInfo{ + id:_info1 + contentText: STR.STR_QML_840 + onGotItClicked: { + close() + } + } + + Connections { + target: UserWallet + onAddHardwareAlert:{ + _info1.open() + } + } } diff --git a/Qml/Screens/OnlineMode/SCR_ADD_TREZOR_ASK.qml b/Qml/Screens/OnlineMode/SCR_ADD_TREZOR_ASK.qml index 68f4d82a..e30acf72 100644 --- a/Qml/Screens/OnlineMode/SCR_ADD_TREZOR_ASK.qml +++ b/Qml/Screens/OnlineMode/SCR_ADD_TREZOR_ASK.qml @@ -41,9 +41,7 @@ QScreen { anchors.centerIn: parent enableHeader:false offset: 24 - onCloseClicked: { - QMLHandle.sendEvent(EVT.EVT_ONS_CLOSE_REQUEST, EVT.STATE_ID_SCR_ADD_TREZOR_ASK) - } + onCloseClicked: closeTo(NUNCHUCKTYPE.WALLET_TAB) QLato { anchors{ top: parent.top @@ -81,9 +79,7 @@ QScreen { label.text: STR.STR_QML_432 label.font.pixelSize: 16 type: eTypeF - onButtonClicked: { - QMLHandle.sendEvent(EVT.EVT_ONS_CLOSE_REQUEST, EVT.STATE_ID_SCR_ADD_TREZOR_ASK) - } + onButtonClicked: closeTo(NUNCHUCKTYPE.WALLET_TAB) } } bottomRight: Row { @@ -95,7 +91,11 @@ QScreen { label.font.pixelSize: 16 type: eTypeE onButtonClicked: { - QMLHandle.sendEvent(EVT.EVT_ADD_TREZOR_REQUEST) + if (ServiceSetting.existKeyType("trezor")) { + QMLHandle.sendEvent(EVT.EVT_EXIST_TREZOR_REQ) + } else { + QMLHandle.sendEvent(EVT.EVT_ADD_TREZOR_REQUEST) + } } } } diff --git a/Qml/Screens/OnlineMode/SCR_ADD_TREZOR_EXIST.qml b/Qml/Screens/OnlineMode/SCR_ADD_TREZOR_EXIST.qml new file mode 100644 index 00000000..72c538ae --- /dev/null +++ b/Qml/Screens/OnlineMode/SCR_ADD_TREZOR_EXIST.qml @@ -0,0 +1,92 @@ +/************************************************************************** + * This file is part of the Nunchuk software (https://nunchuk.io/) * + * Copyright (C) 2020-2022 Enigmo * + * Copyright (C) 2022 Nunchuk * + * * + * This program is free software; you can redistribute it and/or * + * modify it under the terms of the GNU General Public License * + * as published by the Free Software Foundation; either version 3 * + * of the License, or (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + * * + **************************************************************************/ +import QtQuick 2.4 +import QtQuick.Controls 2.3 +import QtGraphicalEffects 1.12 +import HMIEVENTS 1.0 +import EWARNING 1.0 +import NUNCHUCKTYPE 1.0 +import DataPool 1.0 +import "../../Components/origins" +import "../../Components/customizes" +import "../../Components/customizes/Chats" +import "../../Components/customizes/Texts" +import "../../Components/customizes/Buttons" +import "../../../localization/STR_QML.js" as STR + +QScreen { + property string ledgerXfp: "" + signal addExistKey() + QOnScreenContentTypeB { + id:_content + width: popupWidth + height: popupHeight + anchors.centerIn: parent + label.text: STR.STR_QML_901 + extraHeader: Item {} + onCloseClicked: closeTo(NUNCHUCKTYPE.WALLET_TAB) + content: QAddAnExistingKey { + notice: STR.STR_QML_915 + keyType: "trezor" + } + onPrevClicked: closeTo(NUNCHUCKTYPE.WALLET_TAB) + bottomRight: Row { + spacing: 12 + QTextButton { + width: 215 + height: 48 + label.text: STR.STR_QML_900 + label.font.pixelSize: 16 + type: eTypeB + onButtonClicked: { + QMLHandle.sendEvent(EVT.EVT_ADD_NEW_TREZOR_REQUEST) + } + } + QTextButton { + width: 150 + height: 48 + label.text: STR.STR_QML_899 + label.font.pixelSize: 16 + type: eTypeE + onButtonClicked: { + var trezorXfp = _content.contentItem.fingerPrint + QMLHandle.sendEvent(EVT.EVT_ADD_EXIST_TREZOR_REQUEST, trezorXfp) + } + } + } + } + QPopupInfo{ + id:_info1 + contentText: STR.STR_QML_840 + onGotItClicked: { + close() + } + } + + Connections { + target: UserWallet + onAddHardwareAlert:{ + _info1.open() + } + onAddHardwareSuccessAlert:{ + closeTo(NUNCHUCKTYPE.WALLET_TAB) + } + } +} diff --git a/Qml/Screens/OnlineMode/SCR_DUMMY_TRANSACTION_INFO.qml b/Qml/Screens/OnlineMode/SCR_DUMMY_TRANSACTION_INFO.qml index 432fe7bd..2ba9754b 100644 --- a/Qml/Screens/OnlineMode/SCR_DUMMY_TRANSACTION_INFO.qml +++ b/Qml/Screens/OnlineMode/SCR_DUMMY_TRANSACTION_INFO.qml @@ -461,7 +461,7 @@ QScreen { anchors.verticalCenter: parent.verticalCenter } QText { - text: STR.STR_QML_220.arg(Math.max(0, (AppModel.transactionInfo.m - AppModel.transactionInfo.numberSigned))) + text: STR.str_QML_220(Math.max(0, (AppModel.transactionInfo.m - AppModel.transactionInfo.numberSigned))) font.pixelSize: 12 font.family: "Lato" color: indicatorStatus.color @@ -501,7 +501,7 @@ QScreen { color: "#595959" font.family: "Lato" font.pixelSize: 12 - text: STR.STR_QML_220.arg(Math.max(0, (AppModel.transactionInfo.m - AppModel.transactionInfo.numberSigned))) + text: STR.str_QML_220(Math.max(0, (AppModel.transactionInfo.m - AppModel.transactionInfo.numberSigned))) anchors.verticalCenter: parent.verticalCenter } } @@ -991,10 +991,10 @@ QScreen { var activeLink = "" switch(AppSetting.primaryServer){ case NUNCHUCKTYPE.MAIN: - activeLink = BLOCKSTREAM_MAINNET + AppModel.transactionInfo.txid + activeLink = EXPLORER_MAINNET + AppModel.transactionInfo.txid break; case NUNCHUCKTYPE.TESTNET: - activeLink = BLOCKSTREAM_TESTNET + AppModel.transactionInfo.txid + activeLink = EXPLORER_TESTNET + AppModel.transactionInfo.txid break; case NUNCHUCKTYPE.SIGNET: activeLink = AppSetting.signetStream + AppModel.transactionInfo.txid diff --git a/Qml/Screens/OnlineMode/SCR_EDIT_YOUR_INHERITANCE_PLAN.qml b/Qml/Screens/OnlineMode/SCR_EDIT_YOUR_INHERITANCE_PLAN.qml new file mode 100644 index 00000000..c88740c3 --- /dev/null +++ b/Qml/Screens/OnlineMode/SCR_EDIT_YOUR_INHERITANCE_PLAN.qml @@ -0,0 +1,449 @@ +/************************************************************************** + * This file is part of the Nunchuk software (https://nunchuk.io/) * + * Copyright (C) 2020-2022 Enigmo * + * Copyright (C) 2022 Nunchuk * + * * + * This program is free software; you can redistribute it and/or * + * modify it under the terms of the GNU General Public License * + * as published by the Free Software Foundation; either version 3 * + * of the License, or (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + * * + **************************************************************************/ +import QtQuick 2.4 +import QtQuick.Controls 2.3 +import QtQuick.Controls 1.4 +import QtGraphicalEffects 1.12 +import QtQuick.Controls.Styles 1.4 +import HMIEVENTS 1.0 +import EWARNING 1.0 +import NUNCHUCKTYPE 1.0 +import DataPool 1.0 +import "../../Components/origins" +import "../../Components/customizes" +import "../../Components/customizes/Chats" +import "../../Components/customizes/Texts" +import "../../Components/customizes/Buttons" +import "../../../localization/STR_QML.js" as STR + +QScreen { + function fclose() { + QMLHandle.sendEvent(EVT.EVT_CLOSE_TO_SERVICE_SETTINGS_REQUEST, EVT.STATE_ID_SCR_EDIT_YOUR_INHERITANCE_PLAN) + } + property string dateString: ServiceSetting.qInheritanceActivationDate !== "" ? ServiceSetting.qInheritanceActivationDate : Qt.formatDateTime(new Date(), "MM/dd/yyyy") + property string message: ServiceSetting.qInheritanceNote + property string period: "" + property string period_id: ServiceSetting.qInheritancePeriodId + property string email: ServiceSetting.qInheritanceEmail + property bool isNotify: ServiceSetting.qInheritanceIsNotify + + QOnScreenContentTypeB { + id: _Activation + visible: ServiceSetting.qInheritancePlan === ServiceType.IE_ACTIVATION_DATE + width: popupWidth + height: popupHeight + anchors.centerIn: parent + label.text: STR.STR_QML_854 + onCloseClicked: fclose() + content: Item { + Column { + anchors.fill: parent + anchors.top: parent.top + anchors.topMargin: -16 + spacing: 24 + QLato { + width: 539 + height: 56 + text: STR.STR_QML_855 + anchors.left: parent.left + font.weight: Font.Normal + wrapMode: Text.WrapAnywhere + lineHeight: 28 + lineHeightMode: Text.FixedHeight + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + } + Item { + width: 539 + height: 72 + QTextInputBoxTypeB { + label: STR.STR_QML_848 + width: 539 + height: 72 + boxWidth: 539 + boxHeight: 48 + isValid: true + textInputted: dateString + } + MouseArea { + anchors.fill: parent + hoverEnabled: true + cursorShape: Qt.PointingHandCursor + propagateComposedEvents: true + onClicked: { + _calendar.open() + } + } + } + } + Popup { + id: _calendar + width: cal.width + height: cal.height + modal: true + focus: true + closePolicy: Popup.CloseOnReleaseOutside | Popup.CloseOnEscape + background: Item{} + anchors.centerIn: parent + Calendar { + id: cal + anchors.centerIn: parent + onClicked: { + dateString = Qt.formatDateTime(date, "MM/dd/yyyy") + _calendar.close() + } + style: CalendarStyle { + gridVisible: false + dayDelegate: Rectangle { + gradient: Gradient { + GradientStop { + position: 0.00 + color: styleData.selected ? "#111" : (styleData.visibleMonth && styleData.valid ? "#444" : "#666"); + } + GradientStop { + position: 1.00 + color: styleData.selected ? "#444" : (styleData.visibleMonth && styleData.valid ? "#111" : "#666"); + } + GradientStop { + position: 1.00 + color: styleData.selected ? "#777" : (styleData.visibleMonth && styleData.valid ? "#111" : "#666"); + } + } + + Label { + text: styleData.date.getDate() + anchors.centerIn: parent + color: styleData.valid ? "white" : "grey" + } + + Rectangle { + width: parent.width + height: 1 + color: "#555" + anchors.bottom: parent.bottom + } + + Rectangle { + width: 1 + height: parent.height + color: "#555" + anchors.right: parent.right + } + } + } + } + } + Rectangle { + width: parent.width + height: 80 + anchors { + bottom: parent.bottom + bottomMargin: 36 + } + color:"#EAEAEA" + radius: 8 + Row { + anchors.fill: parent + anchors.margins: 12 + spacing: 8 + QImage { + anchors.verticalCenter: parent.verticalCenter + width: 36; height: 36; + source: "qrc:/Images/Images/info-60px.png" + } + QLato { + anchors.verticalCenter: parent.verticalCenter + text: STR.STR_QML_856 + width: 660 + height: 56 + wrapMode: Text.WordWrap + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + } + } + } + } + bottomRight: QTextButton { + width: 195 + height: 48 + label.text: STR.STR_QML_857 + label.font.pixelSize: 16 + type: eTypeE + onButtonClicked: { + _Activation.nextClicked() + } + } + onPrevClicked: fclose() + onNextClicked: { + ServiceSetting.qInheritanceActivationDate = dateString + fclose() + } + } + + QOnScreenContentTypeB { + id: _Message + visible: ServiceSetting.qInheritancePlan === ServiceType.IE_LEAVE_MESSAGE + width: popupWidth + height: popupHeight + anchors.centerIn: parent + label.text: STR.STR_QML_920 + onCloseClicked: fclose() + content: Item { + Column { + anchors.fill: parent + anchors.top: parent.top + anchors.topMargin: -16 + spacing: 24 + QLato { + width: 539 + height: 56 + text: STR.STR_QML_859 + anchors.left: parent.left + font.weight: Font.Normal + wrapMode: Text.WrapAnywhere + lineHeight: 28 + lineHeightMode: Text.FixedHeight + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + } + QTextAreaBoxTypeA { + label: STR.STR_QML_860 + optional: " (optional)" + boxWidth: 539 + boxHeight: 276 + isValid: true + textInputted: message + onTextInputtedChanged: { + message = textInputted + } + + input.verticalAlignment: Text.AlignTop + input.wrapMode: Text.WrapAtWordBoundaryOrAnywhere + } + } + } + bottomRight: QTextButton { + width: 195 + height: 48 + label.text: STR.STR_QML_861 + label.font.pixelSize: 16 + type: eTypeE + onButtonClicked: { + _Message.nextClicked() + } + } + onPrevClicked: fclose() + onNextClicked: { + ServiceSetting.qInheritanceNote = message + fclose() + } + } + + QOnScreenContentTypeB { + id: _Period + visible: ServiceSetting.qInheritancePlan === ServiceType.IE_BUFFER_PERIOD + width: popupWidth + height: popupHeight + anchors.centerIn: parent + label.text: STR.STR_QML_862 + onCloseClicked: fclose() + content: Item { + Column { + anchors.fill: parent + anchors.top: parent.top + anchors.topMargin: -16 + spacing: 24 + QLato { + width: 539 + height: 140 + text: STR.STR_QML_863 + anchors.left: parent.left + font.weight: Font.Normal + lineHeight: 28 + lineHeightMode: Text.FixedHeight + wrapMode: Text.WrapAnywhere + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + } + Item { + width: 539 + height: 212 + Column { + anchors.fill: parent + spacing: 16 + QListView { + id: questions + width: 539 + height: childrenRect.height + spacing: 8 + clip: true + model: UserWallet.periods + interactive: false + delegate: QRadioButtonTypeE { + id: btn + width: 539 + height: 60 + label: modelData.display_name + fontFamily: "Lato" + fontPixelSize: 16 + fontWeight: btn.selected ? Font.ExtraBold : Font.DemiBold + selected: period_id === modelData.id + textBadge: modelData.is_recommended ? STR.STR_QML_879 : "" + onButtonClicked: { + period = modelData.display_name + period_id = modelData.id + } + } + } + } + } + } + } + bottomRight: QTextButton { + width: 195 + height: 48 + label.text: STR.STR_QML_864 + label.font.pixelSize: 16 + type: eTypeE + onButtonClicked: { + _Period.nextClicked() + } + } + onPrevClicked: fclose() + onNextClicked: { + ServiceSetting.qInheritancePeriod = period + ServiceSetting.qInheritancePeriodId = period_id + fclose() + } + } + + QOnScreenContentTypeB { + id: _Notification + visible: ServiceSetting.qInheritancePlan === ServiceType.IE_NOTIFICATION + width: popupWidth + height: popupHeight + anchors.centerIn: parent + label.text: STR.STR_QML_865 + onCloseClicked: fclose() + content: Item { + Column { + anchors.fill: parent + anchors.top: parent.top + anchors.topMargin: -16 + spacing: 24 + QLato { + width: 539 + height: 56 + text: STR.STR_QML_866 + anchors.left: parent.left + font.weight: Font.Normal + wrapMode: Text.WrapAnywhere + lineHeight: 28 + lineHeightMode: Text.FixedHeight + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + } + QTextInputBoxTypeB { + label: STR.STR_QML_867 + boxWidth: 539 + boxHeight: 116 + isValid: true + textInputted: email + onTextInputtedChanged: { + email = textInputted + } + input.verticalAlignment: Text.AlignTop + input.wrapMode: Text.WrapAtWordBoundaryOrAnywhere + } + QCheckBoxButton{ + id: notify + width: 539 + height: 24 + label: STR.STR_QML_868 + checked: ServiceSetting.qInheritanceIsNotify + onButtonClicked: { + isNotify = checked + } + } + } + Rectangle { + width: parent.width + height: 80 + anchors { + bottom: parent.bottom + bottomMargin: 36 + } + color:"#FDEBD2" + radius: 8 + Row { + anchors.fill: parent + anchors.margins: 12 + spacing: 8 + QImage { + anchors.verticalCenter: parent.verticalCenter + width: 36; height: 36; + source: "qrc:/Images/Images/warning-dark.svg" + } + QLato { + anchors.verticalCenter: parent.verticalCenter + text: STR.STR_QML_869 + width: 660 + height: 56 + wrapMode: Text.WordWrap + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + } + } + } + } + + bottomRight: Row { + spacing: 12 + QTextButton { + width: 239 + height: 48 + label.text: STR.STR_QML_871 + label.font.pixelSize: 16 + type: eTypeB + onButtonClicked: { + ServiceSetting.qInheritanceIsNotify = false + ServiceSetting.qInheritanceEmail = "" + fclose() + } + } + QTextButton { + width: 259 + height: 48 + label.text: STR.STR_QML_870 + label.font.pixelSize: 16 + type: eTypeE + onButtonClicked: { + _Notification.nextClicked() + } + } + } + onPrevClicked: fclose() + onNextClicked: { + ServiceSetting.qInheritanceIsNotify = isNotify + ServiceSetting.qInheritanceEmail = email + fclose() + } + } +} diff --git a/Qml/Screens/OnlineMode/SCR_INHERITANCE_TRANSACTION_DETAILS.qml b/Qml/Screens/OnlineMode/SCR_INHERITANCE_TRANSACTION_DETAILS.qml index 874b9ad8..60c6ebcd 100644 --- a/Qml/Screens/OnlineMode/SCR_INHERITANCE_TRANSACTION_DETAILS.qml +++ b/Qml/Screens/OnlineMode/SCR_INHERITANCE_TRANSACTION_DETAILS.qml @@ -88,10 +88,10 @@ QScreen { var activeLink = "" switch(AppSetting.primaryServer){ case NUNCHUCKTYPE.MAIN: - activeLink = BLOCKSTREAM_MAINNET + AppModel.transactionInfo.txid + activeLink = EXPLORER_MAINNET + AppModel.transactionInfo.txid break; case NUNCHUCKTYPE.TESTNET: - activeLink = BLOCKSTREAM_TESTNET + AppModel.transactionInfo.txid + activeLink = EXPLORER_TESTNET + AppModel.transactionInfo.txid break; case NUNCHUCKTYPE.SIGNET: activeLink = AppSetting.signetStream + AppModel.transactionInfo.txid diff --git a/Qml/Screens/OnlineMode/SCR_INHERITANCE_WITHDRAW_BALANCE.qml b/Qml/Screens/OnlineMode/SCR_INHERITANCE_WITHDRAW_BALANCE.qml index bb26e62e..e9a1d8b6 100644 --- a/Qml/Screens/OnlineMode/SCR_INHERITANCE_WITHDRAW_BALANCE.qml +++ b/Qml/Screens/OnlineMode/SCR_INHERITANCE_WITHDRAW_BALANCE.qml @@ -68,10 +68,10 @@ QScreen { labelTop: model.wallet_name labelCenter: qsTr("%1/%2 %3").arg(model.wallet_M).arg(model.wallet_N).arg(STR.STR_QML_069) labelBottom: model.wallet_Balance + RoomWalletData.unitValue - walletIcon: model.wallet_isSharedWallet ? "qrc:/Images/Images/OnlineMode/Joint wallet_031F2B.png" : + icon: model.wallet_isSharedWallet ? "qrc:/Images/Images/OnlineMode/Joint wallet_031F2B.png" : model.wallet_isAssistedWallet ? "qrc:/Images/Images/OnlineMode/Joint wallet_031F2B.png" : model.wallet_Escrow ? "qrc:/Images/Images/OnlineMode/Escrow Wallet.png" : "" - walletType: model.wallet_isSharedWallet ? STR.STR_QML_438 : + type: model.wallet_isSharedWallet ? STR.STR_QML_438 : model.wallet_isAssistedWallet ? STR.STR_QML_679 : "" selected: currentSelect === index onButtonClicked: { diff --git a/Qml/Screens/OnlineMode/SCR_LOGIN_ONLINE.qml b/Qml/Screens/OnlineMode/SCR_LOGIN_ONLINE.qml index 091e0469..579670d4 100644 --- a/Qml/Screens/OnlineMode/SCR_LOGIN_ONLINE.qml +++ b/Qml/Screens/OnlineMode/SCR_LOGIN_ONLINE.qml @@ -789,6 +789,8 @@ QScreen { source: Draco.stayLoggedIn ? "qrc:/Images/Images/Checked_n.png" : "qrc:/Images/Images/UnChecked_n.png" MouseArea { anchors.fill: parent + hoverEnabled: true + cursorShape: Qt.PointingHandCursor onClicked: {Draco.stayLoggedIn = !Draco.stayLoggedIn} } } @@ -800,6 +802,12 @@ QScreen { font.family: "Lato" font.pixelSize: 16 font.weight: Font.DemiBold + MouseArea { + anchors.fill: parent + hoverEnabled: true + cursorShape: Qt.PointingHandCursor + onClicked: {Draco.stayLoggedIn = !Draco.stayLoggedIn} + } } } QText { diff --git a/Qml/Screens/OnlineMode/SCR_LOGIN_WITH_SOFTWARE_KEY.qml b/Qml/Screens/OnlineMode/SCR_LOGIN_WITH_SOFTWARE_KEY.qml index 7a171850..d0dfdda7 100644 --- a/Qml/Screens/OnlineMode/SCR_LOGIN_WITH_SOFTWARE_KEY.qml +++ b/Qml/Screens/OnlineMode/SCR_LOGIN_WITH_SOFTWARE_KEY.qml @@ -79,6 +79,14 @@ QScreen { } primary_key_name.showError = false; } + onEnterKeyRequest: { + commonError.visible = false + commonError.text = "" + var signIn = {"primary_key":primary_key, + "passphrase":_passphrase.textInputted + } + QMLHandle.sendEvent(EVT.EVT_PRIMARY_KEY_SIGNIN_ACCOUNT_REQUEST, signIn) + } } QText { id: commonError @@ -107,6 +115,8 @@ QScreen { source: Draco.stayLoggedIn ? "qrc:/Images/Images/Checked_n.png" : "qrc:/Images/Images/UnChecked_n.png" MouseArea { anchors.fill: parent + hoverEnabled: true + cursorShape: Qt.PointingHandCursor onClicked: {Draco.stayLoggedIn = !Draco.stayLoggedIn} } } @@ -118,6 +128,12 @@ QScreen { font.family: "Lato" font.pixelSize: 16 font.weight: Font.Normal + MouseArea { + anchors.fill: parent + hoverEnabled: true + cursorShape: Qt.PointingHandCursor + onClicked: {Draco.stayLoggedIn = !Draco.stayLoggedIn} + } } } } diff --git a/Qml/Screens/OnlineMode/SCR_SELECT_WALLET_CO_SIGN_POLICE.qml b/Qml/Screens/OnlineMode/SCR_SELECT_WALLET_CO_SIGN_POLICE.qml index 2201ef96..25c09c46 100644 --- a/Qml/Screens/OnlineMode/SCR_SELECT_WALLET_CO_SIGN_POLICE.qml +++ b/Qml/Screens/OnlineMode/SCR_SELECT_WALLET_CO_SIGN_POLICE.qml @@ -61,10 +61,10 @@ QScreen { labelTop: model.wallet_name labelCenter: qsTr("%1/%2 %3").arg(model.wallet_M).arg(model.wallet_N).arg(STR.STR_QML_069) labelBottom: model.wallet_Balance + RoomWalletData.unitValue - walletIcon: model.wallet_isSharedWallet ? "qrc:/Images/Images/OnlineMode/Joint wallet_031F2B.png" : + icon: model.wallet_isSharedWallet ? "qrc:/Images/Images/OnlineMode/Joint wallet_031F2B.png" : model.wallet_isAssistedWallet ? "qrc:/Images/Images/OnlineMode/Joint wallet_031F2B.png" : model.wallet_Escrow ? "qrc:/Images/Images/OnlineMode/Escrow Wallet.png" : "" - walletType: model.wallet_isSharedWallet ? STR.STR_QML_438 : + type: model.wallet_isSharedWallet ? STR.STR_QML_438 : model.wallet_isAssistedWallet ? STR.STR_QML_679 : "" selected: currentSelect === index onButtonClicked: { diff --git a/Qml/Screens/OnlineMode/SCR_SELECT_YOUR_LOCKDOWN_PERIOD.qml b/Qml/Screens/OnlineMode/SCR_SELECT_YOUR_LOCKDOWN_PERIOD.qml index 230e8a3b..acc1b6f0 100644 --- a/Qml/Screens/OnlineMode/SCR_SELECT_YOUR_LOCKDOWN_PERIOD.qml +++ b/Qml/Screens/OnlineMode/SCR_SELECT_YOUR_LOCKDOWN_PERIOD.qml @@ -34,7 +34,7 @@ import "../../../localization/STR_QML.js" as STR QScreen { id: _period property int questionSelected: 0 - property var qSelected : UserWallet.lockdownPeriods[questionSelected] + property var qSelected : UserWallet.periods[questionSelected] QOnScreenContentTypeB { width: popupWidth height: popupHeight @@ -66,7 +66,7 @@ QScreen { height: childrenRect.height spacing: 8 clip: true - model: UserWallet.lockdownPeriods + model: UserWallet.periods interactive: false delegate: Item { id: questionsdlg diff --git a/Qml/Screens/OnlineMode/SCR_SERVICE_SETTINGS.qml b/Qml/Screens/OnlineMode/SCR_SERVICE_SETTINGS.qml index fc3ddfa7..821d908e 100644 --- a/Qml/Screens/OnlineMode/SCR_SERVICE_SETTINGS.qml +++ b/Qml/Screens/OnlineMode/SCR_SERVICE_SETTINGS.qml @@ -151,21 +151,30 @@ QScreen { readonly property int _EMERGENCY_LOCKDOWN: 1 readonly property int _KEY_RECOVERY: 2 readonly property int _INHERITANCE_PLANING: 3 - readonly property int _CLAIM_AN_INHERITANCE: 4 - readonly property int _YOUR_SUBSCRIPTION: 5 - readonly property int _PLATFORM_KEY_CO_SIGNING_POLICIES: 6 - readonly property int _GET_ADDITIONAL_WALLETS: 7 - readonly property int _ORDER_NEW_HARDWARE: 8 - readonly property int _MANAGE_SUBSCRIPTION: 9 function isHoneyBadger(){ return ClientController.user.plan_slug === "honey_badger" } - + readonly property int _VIEW_INHERITANCE_PLANING: 4 + readonly property int _CLAIM_AN_INHERITANCE: 5 + readonly property int _YOUR_SUBSCRIPTION: 6 + readonly property int _PLATFORM_KEY_CO_SIGNING_POLICIES: 7 + readonly property int _GET_ADDITIONAL_WALLETS: 8 + readonly property int _ORDER_NEW_HARDWARE: 9 + readonly property int _MANAGE_SUBSCRIPTION: 10 readonly property var setting_map: [ {screen:_EMERGENCY, visible: true, enable:false, title:STR.STR_QML_702, icon: "qrc:/Images/Images/emergency-light.svg" ,action: function(){} }, {screen:_EMERGENCY_LOCKDOWN, visible: true, enable:true, title:STR.STR_QML_697, icon: "" ,action: function(){} }, {screen:_KEY_RECOVERY, visible: true, enable:true, title:STR.STR_QML_698, icon: "" ,action: function(){} }, {screen:_INHERITANCE_PLANING, visible: isHoneyBadger(), enable:false, title:STR.STR_QML_736, icon: "qrc:/Images/Images/inheritance-light.svg" ,action: function(){} }, + {screen:_VIEW_INHERITANCE_PLANING, visible: isHoneyBadger() && ServiceSetting.qAssistedSetuped.length > 0, enable:true, title:STR.STR_QML_875, icon: "" ,action: function(){ + ServiceSetting.qInheritanceWalletName = "" + if (ServiceSetting.qAssistedSetuped.length > 1) { + GlobalData.serviceIndex = _VIEW_INHERITANCE_PLANING + } else if (ServiceSetting.qAssistedSetuped.length === 1) { + QMLHandle.sendEvent(EVT.EVT_SERVICE_SELECT_WALLET_REQUEST, ServiceSetting.qAssistedSetuped[0]) + GlobalData.serviceIndex = _VIEW_INHERITANCE_PLANING + } + } }, {screen:_CLAIM_AN_INHERITANCE, visible: isHoneyBadger(), enable:true, title:STR.STR_QML_737, icon: "" ,action: function(){ GlobalData.serviceIndex = _CLAIM_AN_INHERITANCE ServiceSetting.claimInheritanceStatus = ServiceType.CI_NONE @@ -176,7 +185,14 @@ QScreen { var screenObj = { "state_id" : EVT.STATE_ID_SCR_SERVICE_SETTINGS } QMLHandle.sendEvent(EVT.EVT_REENTER_YOUR_PASSWORD_REQUEST,screenObj) } }, - {screen:_GET_ADDITIONAL_WALLETS,visible: false, enable:false, title:STR.STR_QML_707, icon: "" ,action: function(){} }, + {screen:_GET_ADDITIONAL_WALLETS,visible: true, enable:true, title:STR.STR_QML_707, icon: "" ,action: function(){ + UserWallet.additionalGetWalletConfig() + _InfoVer.link = "https://nunchuk.io/claim"; + var remainCount = ServiceSetting.qRemainingAssistedWalletCount; + _InfoVer.contentText = (remainCount > 1 ? STR.STR_QML_841 : STR.STR_QML_842).arg(remainCount); + _InfoVer.labels = [STR.STR_QML_341,STR.STR_QML_683]; + _InfoVer.open(); + } }, {screen:_ORDER_NEW_HARDWARE, visible: true, enable:true, title:STR.STR_QML_700, icon: "" ,action: function(){_InfoVer.link = "https://nunchuk.io/hardware-replacement";_InfoVer.contentText = STR.STR_QML_735;_InfoVer.labels = [STR.STR_QML_341,STR.STR_QML_683];_InfoVer.open();} }, {screen:_MANAGE_SUBSCRIPTION, visible: true, enable:true, title:STR.STR_QML_682, icon: "" ,action: function(){_InfoVer.link = "https://nunchuk.io/my-plan";_InfoVer.contentText = STR.STR_QML_684;_InfoVer.labels = [STR.STR_QML_341,STR.STR_QML_683];_InfoVer.open();}} ] @@ -590,6 +606,57 @@ QScreen { } } } + Item { + anchors.fill: parent + visible: GlobalData.serviceIndex === itemsSetting._VIEW_INHERITANCE_PLANING + enabled: visible + QViewInheritancePlaning { + anchors.fill: parent + visible: ServiceSetting.qInheritanceWalletName !== "" + } + QSelectAnAssistedWallet { + visible: ServiceSetting.qAssistedSetuped.length > 1 && ServiceSetting.qInheritanceWalletName === "" + } + Connections { + target: UserWallet + onSecurityQuestionChanged: { + if (GlobalData.serviceIndex === itemsSetting._VIEW_INHERITANCE_PLANING) { + _Security.action = function() { + QMLHandle.sendEvent(EVT.EVT_INHERITANCE_PLAN_FINALIZE_REQUEST, 3) + } + _Security.open(); + } + } + onSecurityQuestionClosed: { + if (GlobalData.serviceIndex === itemsSetting._VIEW_INHERITANCE_PLANING) { + _Security.close() + } + } + onInheritanceDummyTransactionAlert: { + if (GlobalData.serviceIndex === itemsSetting._VIEW_INHERITANCE_PLANING) { + _info1.contentText = STR.STR_QML_897 + _info1.open(); + } + } + onInheritanceInvalidActivationDateAlert: { + if (GlobalData.serviceIndex === itemsSetting._VIEW_INHERITANCE_PLANING) { + _info1.contentText = STR.STR_QML_896 + _info1.open(); + } + } + onInheritanceDiscardChangeAlert: { + if (GlobalData.serviceIndex === itemsSetting._VIEW_INHERITANCE_PLANING) { + _confirm.title = STR.STR_QML_024 + _confirm.contentText = STR.STR_QML_919 + _confirm.open(); + _confirm.fClose = function() { + ServiceSetting.qInheritanceWalletName = "" + GlobalData.serviceIndex = itemsSetting._CLAIM_AN_INHERITANCE + } + } + } + } + } Item { anchors.fill: parent visible: GlobalData.serviceIndex === itemsSetting._CLAIM_AN_INHERITANCE @@ -1088,6 +1155,9 @@ QScreen { } onSecurityQuestionChanged: { if (GlobalData.serviceIndex === itemsSetting._PLATFORM_KEY_CO_SIGNING_POLICIES) { + _Security.action = function() { + QMLHandle.sendEvent(EVT.EVT_CO_SIGNING_SERVER_KEY_UPDATE_SUCCEED) + } _Security.open(); } } @@ -1498,8 +1568,19 @@ QScreen { close() } } + QConfirmYesNoPopup{ + id:_confirm + property var fClose + contentText: STR.STR_QML_919 + onConfirmNo: close() + onConfirmYes: { + close() + fClose() + } + } QPopupEmpty { id: _Security + property var action content: QAnswerSecurityQuestion { id:_popup width: 600 @@ -1527,7 +1608,7 @@ QScreen { } onNextClicked: { - QMLHandle.sendEvent(EVT.EVT_CO_SIGNING_SERVER_KEY_UPDATE_SUCCEED) + _Security.action() _popup.clearText() } } diff --git a/Qml/Screens/OnlineMode/SCR_SHARE_YOUR_SECRETS.qml b/Qml/Screens/OnlineMode/SCR_SHARE_YOUR_SECRETS.qml new file mode 100644 index 00000000..7b86293e --- /dev/null +++ b/Qml/Screens/OnlineMode/SCR_SHARE_YOUR_SECRETS.qml @@ -0,0 +1,272 @@ +/************************************************************************** + * This file is part of the Nunchuk software (https://nunchuk.io/) * + * Copyright (C) 2020-2022 Enigmo * + * Copyright (C) 2022 Nunchuk * + * * + * This program is free software; you can redistribute it and/or * + * modify it under the terms of the GNU General Public License * + * as published by the Free Software Foundation; either version 3 * + * of the License, or (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + * * + **************************************************************************/ +import QtQuick 2.4 +import QtQuick.Controls 2.3 +import QtGraphicalEffects 1.12 +import HMIEVENTS 1.0 +import EWARNING 1.0 +import NUNCHUCKTYPE 1.0 +import DataPool 1.0 +import "../../Components/origins" +import "../../Components/customizes" +import "../../Components/customizes/Chats" +import "../../Components/customizes/Texts" +import "../../Components/customizes/Buttons" +import "../../Components/customizes/services" +import "../../../localization/STR_QML.js" as STR + +QScreen { + function fclose() { + QMLHandle.sendEvent(EVT.EVT_CLOSE_TO_SERVICE_SETTINGS_REQUEST, EVT.STATE_ID_SCR_SHARE_YOUR_SECRETS) + } + property string option: STR.STR_QML_881 + property string selectedOption: "" + + function findObj(obj, _property) { + if (obj.hasOwnProperty(_property)) return obj + else return findObj(obj.parent, _property) + } + + QOnScreenContentTypeB { + id: _Option + visible: selectedOption === "" + width: popupWidth + height: popupHeight + anchors.centerIn: parent + label.text: STR.STR_QML_847 + onCloseClicked: fclose() + content: Item { + Column { + anchors.fill: parent + anchors.top: parent.top + anchors.topMargin: -16 + spacing: 24 + QLato { + width: 539 + height: 56 + text: STR.STR_QML_880 + anchors.left: parent.left + font.weight: Font.Normal + lineHeight: 28 + lineHeightMode: Text.FixedHeight + wrapMode: Text.WrapAnywhere + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + } + Flickable { + width: 549 + height: 440 + contentWidth: width + contentHeight: _colum.childrenRect.height + ScrollBar.vertical: ScrollBar { active: true } + clip: true + Column { + id: _colum + anchors.fill: parent + spacing: 16 + QRadioButtonTypeF { + width: 539 + height: 116 + selected: option === labelTop + labelTop: STR.STR_QML_881 + labelBottom: STR.STR_QML_882 + onButtonClicked: { option = labelTop; } + } + QRadioButtonTypeF { + width: 539 + height: 144 + selected: option === labelTop + labelTop: STR.STR_QML_883 + labelBottom: STR.STR_QML_884 + onButtonClicked: { option = labelTop; } + } + QRadioButtonTypeF { + width: 539 + height: 172 + selected: option === labelTop + labelTop: STR.STR_QML_885 + labelBottom: STR.STR_QML_886 + onButtonClicked: { option = labelTop; } + } + } + } + } + } + bottomRight: QTextButton { + width: 98 + height: 48 + label.text: STR.STR_QML_097 + label.font.pixelSize: 16 + type: eTypeE + onButtonClicked: { + _Option.nextClicked() + } + } + onPrevClicked: fclose() + onNextClicked: { + selectedOption = option + } + } + + QOnScreenContentTypeB { + visible: selectedOption === label.text + width: popupWidth + height: popupHeight + anchors.centerIn: parent + label.text: STR.STR_QML_881 + onCloseClicked: fclose() + content: Item { + Row { + spacing: 36 + Rectangle { + width: 346 + height: 512 + radius: 24 + color: "#D0E2FF" + QImage { + width: 153 + height: 214 + anchors.centerIn: parent + source: "qrc:/Images/Images/inheritance_backup_password.svg" + } + } + QInheritanceDetails { + width: 346 + height: 512 + title: STR.STR_QML_887 + warning: STR.STR_QML_890 + } + } + } + bottomRight: QTextButton { + width: 71 + height: 48 + label.text: STR.STR_QML_777 + label.font.pixelSize: 16 + type: eTypeE + onButtonClicked: { + findObj(parent, "nextClicked").nextClicked() + fclose() + } + } + bottomLeft: Item {} + onPrevClicked: fclose() + onNextClicked: { + AppModel.qInheritanceSecret = selectedOption + } + } + + QOnScreenContentTypeB { + visible: selectedOption === label.text + width: popupWidth + height: popupHeight + anchors.centerIn: parent + label.text: STR.STR_QML_883 + onCloseClicked: fclose() + content: Item { + Row { + spacing: 36 + Rectangle { + width: 346 + height: 512 + radius: 24 + color: "#D0E2FF" + QImage { + width: 153 + height: 214 + anchors.centerIn: parent + source: "qrc:/Images/Images/inheritance_backup_password.svg" + } + } + QInheritanceDetails { + width: 346 + height: 512 + title: STR.STR_QML_891 + warning: STR.STR_QML_893 + } + } + } + bottomRight: QTextButton { + width: 71 + height: 48 + label.text: STR.STR_QML_777 + label.font.pixelSize: 16 + type: eTypeE + onButtonClicked: { + findObj(parent, "nextClicked").nextClicked() + fclose() + } + } + bottomLeft: Item {} + onPrevClicked: fclose() + onNextClicked: { + AppModel.qInheritanceSecret = selectedOption + } + } + + QOnScreenContentTypeB { + visible: selectedOption === label.text + width: popupWidth + height: popupHeight + anchors.centerIn: parent + label.text: STR.STR_QML_885 + onCloseClicked: fclose() + content: Item { + Row { + spacing: 36 + Rectangle { + width: 346 + height: 512 + radius: 24 + color: "#D0E2FF" + QImage { + width: 153 + height: 214 + anchors.centerIn: parent + source: "qrc:/Images/Images/inheritance_backup_password.svg" + } + } + QInheritanceDetails { + width: 346 + height: 512 + title: STR.STR_QML_892 + warning: STR.STR_QML_894 + } + } + } + bottomRight: QTextButton { + width: 71 + height: 48 + label.text: STR.STR_QML_777 + label.font.pixelSize: 16 + type: eTypeE + onButtonClicked: { + findObj(parent, "nextClicked").nextClicked() + fclose() + } + } + bottomLeft: Item {} + onPrevClicked: fclose() + onNextClicked: { + AppModel.qInheritanceSecret = selectedOption + } + } + +} diff --git a/Views/Common/ViewStates.h b/Views/Common/ViewStates.h index 720c49de..36618711 100644 --- a/Views/Common/ViewStates.h +++ b/Views/Common/ViewStates.h @@ -25,10 +25,14 @@ #include "ViewsDefines.h" #include "ViewsEnums.h" #include "STATE_ID_ROOT.h" +#include "STATE_ID_SCR_ADD_COLDCARD.h" +#include "STATE_ID_SCR_ADD_COLDCARD_ASK.h" +#include "STATE_ID_SCR_ADD_COLDCARD_EXIST.h" #include "STATE_ID_SCR_ADD_HARDWARE_SIGNER.h" #include "STATE_ID_SCR_ADD_HARDWARE_SIGNER_TO_WALLET.h" #include "STATE_ID_SCR_ADD_LEDGER.h" #include "STATE_ID_SCR_ADD_LEDGER_ASK.h" +#include "STATE_ID_SCR_ADD_LEDGER_EXIST.h" #include "STATE_ID_SCR_ADD_MASTER_SIGNER_RESULT.h" #include "STATE_ID_SCR_ADD_NEW_SIGNER.h" #include "STATE_ID_SCR_ADD_NEW_SIGNER_TO_WALLET.h" @@ -36,6 +40,7 @@ #include "STATE_ID_SCR_ADD_REMOTE_SIGNER_RESULT.h" #include "STATE_ID_SCR_ADD_TREZOR.h" #include "STATE_ID_SCR_ADD_TREZOR_ASK.h" +#include "STATE_ID_SCR_ADD_TREZOR_EXIST.h" #include "STATE_ID_SCR_ADD_WALLET.h" #include "STATE_ID_SCR_ADD_WALLET_CONFIRMATION.h" #include "STATE_ID_SCR_ADD_WALLET_SIGNER_CONFIGURATION.h" @@ -50,6 +55,7 @@ #include "STATE_ID_SCR_CREATE_SHARED_WALLET.h" #include "STATE_ID_SCR_CREATE_TRANSACTION.h" #include "STATE_ID_SCR_DUMMY_TRANSACTION_INFO.h" +#include "STATE_ID_SCR_EDIT_YOUR_INHERITANCE_PLAN.h" #include "STATE_ID_SCR_ENTER_BACKUP_PASSWORD.h" #include "STATE_ID_SCR_HOME.h" #include "STATE_ID_SCR_HOME_ONLINE.h" @@ -82,6 +88,7 @@ #include "STATE_ID_SCR_SERVICE_SETTINGS.h" #include "STATE_ID_SCR_SHARED_WALLET_CONFIGURE.h" #include "STATE_ID_SCR_SHARED_WL_DEVICE_REGISTRATION.h" +#include "STATE_ID_SCR_SHARE_YOUR_SECRETS.h" #include "STATE_ID_SCR_SIGN_IN.h" #include "STATE_ID_SCR_SIGN_IN_BY_IMPORTING_THE_PRIMARY_KEY.h" #include "STATE_ID_SCR_SIGN_IN_MANUALLY.h" diff --git a/Views/Common/ViewsDefines.h b/Views/Common/ViewsDefines.h index 56a8eb64..9942630a 100644 --- a/Views/Common/ViewsDefines.h +++ b/Views/Common/ViewsDefines.h @@ -23,10 +23,14 @@ #define VIEWSDEFINES_H #define ROOT "" +#define SCR_ADD_COLDCARD "qrc:/Qml/Screens/OnlineMode/SCR_ADD_COLDCARD.qml" +#define SCR_ADD_COLDCARD_ASK "qrc:/Qml/Screens/OnlineMode/SCR_ADD_COLDCARD_ASK.qml" +#define SCR_ADD_COLDCARD_EXIST "qrc:/Qml/Screens/OnlineMode/SCR_ADD_COLDCARD_EXIST.qml" #define SCR_ADD_HARDWARE_SIGNER "qrc:/Qml/Screens/LocalMode/SCR_ADD_HARDWARE_SIGNER.qml" #define SCR_ADD_HARDWARE_SIGNER_TO_WALLET "qrc:/Qml/Screens/LocalMode/SCR_ADD_HARDWARE_SIGNER_TO_WALLET.qml" #define SCR_ADD_LEDGER "qrc:/Qml/Screens/OnlineMode/SCR_ADD_LEDGER.qml" #define SCR_ADD_LEDGER_ASK "qrc:/Qml/Screens/OnlineMode/SCR_ADD_LEDGER_ASK.qml" +#define SCR_ADD_LEDGER_EXIST "qrc:/Qml/Screens/OnlineMode/SCR_ADD_LEDGER_EXIST.qml" #define SCR_ADD_MASTER_SIGNER_RESULT "qrc:/Qml/Screens/LocalMode/SCR_ADD_MASTER_SIGNER_RESULT.qml" #define SCR_ADD_NEW_SIGNER "qrc:/Qml/Screens/LocalMode/SCR_ADD_NEW_SIGNER.qml" #define SCR_ADD_NEW_SIGNER_TO_WALLET "qrc:/Qml/Screens/LocalMode/SCR_ADD_NEW_SIGNER_TO_WALLET.qml" @@ -34,6 +38,7 @@ #define SCR_ADD_REMOTE_SIGNER_RESULT "qrc:/Qml/Screens/LocalMode/SCR_ADD_REMOTE_SIGNER_RESULT.qml" #define SCR_ADD_TREZOR "qrc:/Qml/Screens/OnlineMode/SCR_ADD_TREZOR.qml" #define SCR_ADD_TREZOR_ASK "qrc:/Qml/Screens/OnlineMode/SCR_ADD_TREZOR_ASK.qml" +#define SCR_ADD_TREZOR_EXIST "qrc:/Qml/Screens/OnlineMode/SCR_ADD_TREZOR_EXIST.qml" #define SCR_ADD_WALLET "qrc:/Qml/Screens/LocalMode/SCR_ADD_WALLET.qml" #define SCR_ADD_WALLET_CONFIRMATION "qrc:/Qml/Screens/LocalMode/SCR_ADD_WALLET_CONFIRMATION.qml" #define SCR_ADD_WALLET_SIGNER_CONFIGURATION "qrc:/Qml/Screens/LocalMode/SCR_ADD_WALLET_SIGNER_CONFIGURATION.qml" @@ -47,8 +52,9 @@ #define SCR_CREATE_NEW_SEED "qrc:/Qml/Screens/LocalMode/SCR_CREATE_NEW_SEED.qml" #define SCR_CREATE_SHARED_WALLET "qrc:/Qml/Screens/OnlineMode/SCR_CREATE_SHARED_WALLET.qml" #define SCR_CREATE_TRANSACTION "qrc:/Qml/Screens/LocalMode/SCR_CREATE_TRANSACTION.qml" -#define SCR_DUMMY_TRANSACTION_INFO "qrc:/Qml/Screens/OnlineMode/SCR_DUMMY_TRANSACTION_INFO.qml" -#define SCR_ENTER_BACKUP_PASSWORD "qrc:/Qml/Screens/OnlineMode/SCR_ENTER_BACKUP_PASSWORD.qml" +#define SCR_DUMMY_TRANSACTION_INFO "qrc:/Qml/Screens/OnlineMode/SCR_DUMMY_TRANSACTION_INFO.qml" +#define SCR_EDIT_YOUR_INHERITANCE_PLAN "qrc:/Qml/Screens/OnlineMode/SCR_EDIT_YOUR_INHERITANCE_PLAN.qml" +#define SCR_ENTER_BACKUP_PASSWORD "qrc:/Qml/Screens/OnlineMode/SCR_ENTER_BACKUP_PASSWORD.qml" #define SCR_HOME "qrc:/Qml/Screens/LocalMode/SCR_HOME.qml" #define SCR_HOME_ONLINE "qrc:/Qml/Screens/OnlineMode/SCR_HOME_ONLINE.qml" #define SCR_INPUT_PASSPHRASE "qrc:/Qml/Screens/LocalMode/SCR_INPUT_PASSPHRASE.qml" @@ -77,6 +83,7 @@ #define SCR_SERVICE_SETTINGS "qrc:/Qml/Screens/OnlineMode/SCR_SERVICE_SETTINGS.qml" #define SCR_SHARED_WALLET_CONFIGURE "qrc:/Qml/Screens/OnlineMode/SCR_SHARED_WALLET_CONFIGURE.qml" #define SCR_SHARED_WL_DEVICE_REGISTRATION "qrc:/Qml/Screens/OnlineMode/SCR_SHARED_WL_DEVICE_REGISTRATION.qml" +#define SCR_SHARE_YOUR_SECRETS "qrc:/Qml/Screens/OnlineMode/SCR_SHARE_YOUR_SECRETS.qml" #define SCR_SIGN_IN "qrc:/Qml/Screens/OnlineMode/SCR_SIGN_IN.qml" #define SCR_SIGN_IN_BY_IMPORTING_THE_PRIMARY_KEY "qrc:/Qml/Screens/OnlineMode/SCR_SIGN_IN_BY_IMPORTING_THE_PRIMARY_KEY.qml" #define SCR_SIGN_IN_MANUALLY "qrc:/Qml/Screens/OnlineMode/SCR_SIGN_IN_MANUALLY.qml" diff --git a/Views/Common/ViewsEnums.h b/Views/Common/ViewsEnums.h index 5a74b98a..b3b7b711 100644 --- a/Views/Common/ViewsEnums.h +++ b/Views/Common/ViewsEnums.h @@ -100,6 +100,13 @@ class E: public QObject Q_ENUMS(EVT_STATE_ID_SCR_ADD_LEDGER) Q_ENUMS(EVT_STATE_ID_SCR_ADD_TREZOR) Q_ENUMS(EVT_STATE_ID_SCR_SELECT_WALLET_CO_SIGN_POLICE) + Q_ENUMS(EVT_STATE_ID_SCR_EDIT_YOUR_INHERITANCE_PLAN) + Q_ENUMS(EVT_STATE_ID_SCR_SHARE_YOUR_SECRETS) + Q_ENUMS(EVT_STATE_ID_SCR_ADD_COLDCARD_ASK) + Q_ENUMS(EVT_STATE_ID_SCR_ADD_COLDCARD) + Q_ENUMS(EVT_STATE_ID_SCR_ADD_LEDGER_EXIST) + Q_ENUMS(EVT_STATE_ID_SCR_ADD_TREZOR_EXIST) + Q_ENUMS(EVT_STATE_ID_SCR_ADD_COLDCARD_EXIST) public: enum EVT_STATE_ID_REGISTED { @@ -177,749 +184,814 @@ class E: public QObject STATE_ID_SCR_ADD_LEDGER , // 71 STATE_ID_SCR_ADD_TREZOR , // 72 STATE_ID_SCR_SELECT_WALLET_CO_SIGN_POLICE , // 73 - EVT_STATE_ID_REGISTED_MAX , // 74 + STATE_ID_SCR_EDIT_YOUR_INHERITANCE_PLAN , // 74 + STATE_ID_SCR_SHARE_YOUR_SECRETS , // 75 + STATE_ID_SCR_ADD_COLDCARD_ASK , // 76 + STATE_ID_SCR_ADD_COLDCARD , // 77 + STATE_ID_SCR_ADD_LEDGER_EXIST , // 78 + STATE_ID_SCR_ADD_TREZOR_EXIST , // 79 + STATE_ID_SCR_ADD_COLDCARD_EXIST , // 80 + EVT_STATE_ID_REGISTED_MAX , // 81 }; enum EVT_STATE_ID_ROOT { - EVT_STATE_ID_ROOT_MIN=EVT_STATE_ID_REGISTED_MAX+1, // 75 - EVT_STARTING_APPLICATION_LOCALMODE , // 76 - EVT_STARTING_APPLICATION_ONLINEMODE , // 77 - EVT_STARTING_APPLICATION_ONLINE_HWL , // 78 - EVT_SETTING_ACCOUNT_CHANGE_PASSWORD , // 79 - EVT_ONS_CLOSE_ALL_REQUEST , // 80 - EVT_ROOT_SIGN_IN_PRIMARY_KEY_REQUEST , // 81 - EVT_ROOT_CREATE_PRIMARY_KEY_REQUEST , // 82 - EVT_GOTO_HOME_WALLET_TAB , // 83 - EVT_ONS_CLOSE_REQUEST , // 84 - EVT_LOGIN_DB_REQUEST , // 85 - EVT_ROOT_PROMT_PIN , // 86 - EVT_ROOT_PROMT_PASSPHRASE , // 87 - EVT_LOGIN_MATRIX_REQUEST , // 88 - EVT_GOTO_HOME_CHAT_TAB , // 89 - EVT_ONLINE_ONS_CLOSE_REQUEST , // 90 - EVT_SHOW_TOAST_MESSAGE , // 91 - EVT_ROOT_UPDATE_PROFILE , // 92 - EVT_SHOW_CREATE_ACCOUNT_REQUEST , // 93 - EVT_GOTO_APP_SETTINGS_TAB , // 94 - EVT_SIGN_IN_REQUEST , // 95 - EVT_ROOT_ENTRY_PRIMARY_KEY_REQUEST , // 96 - EVT_LOGIN_WITH_SOFTWARE_KEY_REQUEST , // 97 - EVT_GOTO_SERVICE_SETTING_TAB , // 98 - EVT_CLOSE_TO_SERVICE_SETTINGS_REQUEST , // 99 - EVT_NUNCHUK_LOGIN_SUCCEEDED , // 100 - EVT_STATE_ID_ROOT_MAX , // 101 + EVT_STATE_ID_ROOT_MIN=EVT_STATE_ID_REGISTED_MAX+1, // 82 + EVT_STARTING_APPLICATION_LOCALMODE , // 83 + EVT_STARTING_APPLICATION_ONLINEMODE , // 84 + EVT_STARTING_APPLICATION_ONLINE_HWL , // 85 + EVT_SETTING_ACCOUNT_CHANGE_PASSWORD , // 86 + EVT_ONS_CLOSE_ALL_REQUEST , // 87 + EVT_ROOT_SIGN_IN_PRIMARY_KEY_REQUEST , // 88 + EVT_ROOT_CREATE_PRIMARY_KEY_REQUEST , // 89 + EVT_GOTO_HOME_WALLET_TAB , // 90 + EVT_ONS_CLOSE_REQUEST , // 91 + EVT_LOGIN_DB_REQUEST , // 92 + EVT_ROOT_PROMT_PIN , // 93 + EVT_ROOT_PROMT_PASSPHRASE , // 94 + EVT_LOGIN_MATRIX_REQUEST , // 95 + EVT_GOTO_HOME_CHAT_TAB , // 96 + EVT_ONLINE_ONS_CLOSE_REQUEST , // 97 + EVT_SHOW_TOAST_MESSAGE , // 98 + EVT_ROOT_UPDATE_PROFILE , // 99 + EVT_SHOW_CREATE_ACCOUNT_REQUEST , // 100 + EVT_GOTO_APP_SETTINGS_TAB , // 101 + EVT_SIGN_IN_REQUEST , // 102 + EVT_ROOT_ENTRY_PRIMARY_KEY_REQUEST , // 103 + EVT_LOGIN_WITH_SOFTWARE_KEY_REQUEST , // 104 + EVT_GOTO_SERVICE_SETTING_TAB , // 105 + EVT_CLOSE_TO_SERVICE_SETTINGS_REQUEST , // 106 + EVT_NUNCHUK_LOGIN_SUCCEEDED , // 107 + EVT_STATE_ID_ROOT_MAX , // 108 }; enum EVT_STATE_ID_SCR_HOME { - EVT_STATE_ID_SCR_HOME_MIN=EVT_STATE_ID_ROOT_MAX+1, // 102 - EVT_HOME_WALLET_SELECTED , // 103 - EVT_HOME_WALLET_COPY_ADDRESS , // 104 - EVT_HOME_SETTING_REQUEST , // 105 - EVT_HOME_DISPLAY_ADDRESS , // 106 - EVT_HOME_IMPORT_PSBT , // 107 - EVT_HOME_EXPORT_BSMS , // 108 - EVT_HOME_ADD_WALLET_REQUEST , // 109 - EVT_HOME_MASTER_SIGNER_INFO_REQUEST , // 110 - EVT_HOME_SEND_REQUEST , // 111 - EVT_HOME_RECEIVE_REQUEST , // 112 - EVT_HOME_TRANSACTION_HISTORY_REQUEST , // 113 - EVT_HOME_WALLET_INFO_REQUEST , // 114 - EVT_HOME_TRANSACTION_INFO_REQUEST , // 115 - EVT_HOME_REMOTE_SIGNER_INFO_REQUEST , // 116 - EVT_HOME_ADD_NEW_SIGNER_REQUEST , // 117 - EVT_HOME_COLDCARD_NFC_SIGNER_INFO_REQUEST , // 118 - EVT_ASK_LEDGER_REQ , // 119 - EVT_ASK_TREZOR_REQ , // 120 - EVT_STATE_ID_SCR_HOME_MAX , // 121 + EVT_STATE_ID_SCR_HOME_MIN=EVT_STATE_ID_ROOT_MAX+1, // 109 + EVT_HOME_WALLET_SELECTED , // 110 + EVT_HOME_WALLET_COPY_ADDRESS , // 111 + EVT_HOME_SETTING_REQUEST , // 112 + EVT_HOME_DISPLAY_ADDRESS , // 113 + EVT_HOME_IMPORT_PSBT , // 114 + EVT_HOME_EXPORT_BSMS , // 115 + EVT_HOME_ADD_WALLET_REQUEST , // 116 + EVT_HOME_MASTER_SIGNER_INFO_REQUEST , // 117 + EVT_HOME_SEND_REQUEST , // 118 + EVT_HOME_RECEIVE_REQUEST , // 119 + EVT_HOME_TRANSACTION_HISTORY_REQUEST , // 120 + EVT_HOME_WALLET_INFO_REQUEST , // 121 + EVT_HOME_TRANSACTION_INFO_REQUEST , // 122 + EVT_HOME_REMOTE_SIGNER_INFO_REQUEST , // 123 + EVT_HOME_ADD_NEW_SIGNER_REQUEST , // 124 + EVT_HOME_COLDCARD_NFC_SIGNER_INFO_REQUEST , // 125 + EVT_ASK_LEDGER_REQ , // 126 + EVT_ASK_TREZOR_REQ , // 127 + EVT_EXIST_LEDGER_REQ , // 128 + EVT_EXIST_TREZOR_REQ , // 129 + EVT_EXIST_COLDCARD_REQ , // 130 + EVT_ASK_COLDCARD_REQ , // 131 + EVT_STATE_ID_SCR_HOME_MAX , // 132 }; enum EVT_STATE_ID_SCR_ADD_WALLET { - EVT_STATE_ID_SCR_ADD_WALLET_MIN=EVT_STATE_ID_SCR_HOME_MAX+1, // 122 - EVT_ADD_WALLET_IMPORT , // 123 - EVT_ADD_WALLET_BACK_REQUEST , // 124 - EVT_ADD_WALLET_SIGNER_CONFIGURATION_REQUEST , // 125 - EVT_ADD_WALLET_IMPORT_SUCCEED , // 126 - EVT_STATE_ID_SCR_ADD_WALLET_MAX , // 127 + EVT_STATE_ID_SCR_ADD_WALLET_MIN=EVT_STATE_ID_SCR_HOME_MAX+1, // 133 + EVT_ADD_WALLET_IMPORT , // 134 + EVT_ADD_WALLET_BACK_REQUEST , // 135 + EVT_ADD_WALLET_SIGNER_CONFIGURATION_REQUEST , // 136 + EVT_ADD_WALLET_IMPORT_SUCCEED , // 137 + EVT_STATE_ID_SCR_ADD_WALLET_MAX , // 138 }; enum EVT_STATE_ID_SCR_ADD_HARDWARE_SIGNER { - EVT_STATE_ID_SCR_ADD_HARDWARE_SIGNER_MIN=EVT_STATE_ID_SCR_ADD_WALLET_MAX+1, // 128 - EVT_ADD_HARDWARE_SIGNER_ADD_MASTER_SIGNER_REQUEST , // 129 - EVT_ADD_HARDWARE_SIGNER_REFRESH_REQUEST , // 130 - EVT_ADD_HARDWARE_SIGNER_ADD_REMOTE_SIGNER_REQUEST , // 131 - EVT_ADD_HARDWARE_SIGNER_PROMT_PIN_REQUEST , // 132 - EVT_ADD_HARDWARE_SIGNER_SEND_PIN_REQUEST , // 133 - EVT_ADD_MASTER_SIGNER_RESULT , // 134 - EVT_ADD_REMOTE_SIGNER_RESULT , // 135 - EVT_ADD_HARDWARE_SIGNER_BACK_REQUEST , // 136 - EVT_STATE_ID_SCR_ADD_HARDWARE_SIGNER_MAX , // 137 + EVT_STATE_ID_SCR_ADD_HARDWARE_SIGNER_MIN=EVT_STATE_ID_SCR_ADD_WALLET_MAX+1, // 139 + EVT_ADD_HARDWARE_SIGNER_ADD_MASTER_SIGNER_REQUEST , // 140 + EVT_ADD_HARDWARE_SIGNER_REFRESH_REQUEST , // 141 + EVT_ADD_HARDWARE_SIGNER_ADD_REMOTE_SIGNER_REQUEST , // 142 + EVT_ADD_HARDWARE_SIGNER_PROMT_PIN_REQUEST , // 143 + EVT_ADD_HARDWARE_SIGNER_SEND_PIN_REQUEST , // 144 + EVT_ADD_MASTER_SIGNER_RESULT , // 145 + EVT_ADD_REMOTE_SIGNER_RESULT , // 146 + EVT_ADD_HARDWARE_SIGNER_BACK_REQUEST , // 147 + EVT_STATE_ID_SCR_ADD_HARDWARE_SIGNER_MAX , // 148 }; enum EVT_STATE_ID_SCR_MASTER_SIGNER_INFO { - EVT_STATE_ID_SCR_MASTER_SIGNER_INFO_MIN=EVT_STATE_ID_SCR_ADD_HARDWARE_SIGNER_MAX+1, // 138 - EVT_MASTER_SIGNER_INFO_EDIT_NAME , // 139 - EVT_MASTER_SIGNER_INFO_HEALTH_CHECK , // 140 - EVT_MASTER_SIGNER_INFO_REMOVE_REQUEST , // 141 - EVT_MASTER_SIGNER_INFO_PROMT_PIN , // 142 - EVT_MASTER_SIGNER_INFO_SEND_PIN , // 143 - EVT_MASTER_SIGNER_INFO_SEND_PASSPHRASE , // 144 - EVT_MASTER_SIGNER_INFO_GET_XPUBS , // 145 - EVT_MASTER_SIGNER_INFO_BACK_REQUEST , // 146 - EVT_MASTER_SIGNER_INFO_BACK_WALLET_INFO , // 147 - EVT_STATE_ID_SCR_MASTER_SIGNER_INFO_MAX , // 148 + EVT_STATE_ID_SCR_MASTER_SIGNER_INFO_MIN=EVT_STATE_ID_SCR_ADD_HARDWARE_SIGNER_MAX+1, // 149 + EVT_MASTER_SIGNER_INFO_EDIT_NAME , // 150 + EVT_MASTER_SIGNER_INFO_HEALTH_CHECK , // 151 + EVT_MASTER_SIGNER_INFO_REMOVE_REQUEST , // 152 + EVT_MASTER_SIGNER_INFO_PROMT_PIN , // 153 + EVT_MASTER_SIGNER_INFO_SEND_PIN , // 154 + EVT_MASTER_SIGNER_INFO_SEND_PASSPHRASE , // 155 + EVT_MASTER_SIGNER_INFO_GET_XPUBS , // 156 + EVT_MASTER_SIGNER_INFO_BACK_REQUEST , // 157 + EVT_MASTER_SIGNER_INFO_BACK_WALLET_INFO , // 158 + EVT_STATE_ID_SCR_MASTER_SIGNER_INFO_MAX , // 159 }; enum EVT_STATE_ID_SCR_ADD_WALLET_SIGNER_CONFIGURATION { - EVT_STATE_ID_SCR_ADD_WALLET_SIGNER_CONFIGURATION_MIN=EVT_STATE_ID_SCR_MASTER_SIGNER_INFO_MAX+1, // 149 - EVT_SIGNER_CONFIGURATION_SELECT_MASTER_SIGNER , // 150 - EVT_SIGNER_CONFIGURATION_REMOVE_SIGNER , // 151 - EVT_SIGNER_CONFIGURATION_SELECT_REMOTE_SIGNER , // 152 - EVT_SIGNER_CONFIGURATION_MASTER_SIGNER_SEND_PASSPHRASE , // 153 - EVT_SIGNER_CONFIGURATION_TRY_REVIEW , // 154 - EVT_ADD_WALLET_SIGNER_CONFIGURATION_BACK , // 155 - EVT_ADD_WALLET_SIGNER_CONFIGURATION_REVIEW , // 156 - EVT_ADD_SIGNER_TO_WALLET_REQUEST , // 157 - EVT_STATE_ID_SCR_ADD_WALLET_SIGNER_CONFIGURATION_MAX , // 158 + EVT_STATE_ID_SCR_ADD_WALLET_SIGNER_CONFIGURATION_MIN=EVT_STATE_ID_SCR_MASTER_SIGNER_INFO_MAX+1, // 160 + EVT_SIGNER_CONFIGURATION_SELECT_MASTER_SIGNER , // 161 + EVT_SIGNER_CONFIGURATION_REMOVE_SIGNER , // 162 + EVT_SIGNER_CONFIGURATION_SELECT_REMOTE_SIGNER , // 163 + EVT_SIGNER_CONFIGURATION_MASTER_SIGNER_SEND_PASSPHRASE , // 164 + EVT_SIGNER_CONFIGURATION_TRY_REVIEW , // 165 + EVT_ADD_WALLET_SIGNER_CONFIGURATION_BACK , // 166 + EVT_ADD_WALLET_SIGNER_CONFIGURATION_REVIEW , // 167 + EVT_ADD_SIGNER_TO_WALLET_REQUEST , // 168 + EVT_STATE_ID_SCR_ADD_WALLET_SIGNER_CONFIGURATION_MAX , // 169 }; enum EVT_STATE_ID_SCR_RECEIVE { - EVT_STATE_ID_SCR_RECEIVE_MIN=EVT_STATE_ID_SCR_ADD_WALLET_SIGNER_CONFIGURATION_MAX+1, // 159 - EVT_BTN_GEN_NEW_ADDRESS , // 160 - EVT_RECEIVE_COPY_ADDRESS , // 161 - EVT_RECEIVE_SET_QUICK_RECEIVE_ADDRESS , // 162 - EVT_RECEIVE_DISPLAY_ADDRESS , // 163 - EVT_RECEIVE_ADDRESS_BALANCE , // 164 - EVT_RECEIVE_BACK_REQUEST , // 165 - EVT_STATE_ID_SCR_RECEIVE_MAX , // 166 + EVT_STATE_ID_SCR_RECEIVE_MIN=EVT_STATE_ID_SCR_ADD_WALLET_SIGNER_CONFIGURATION_MAX+1, // 170 + EVT_BTN_GEN_NEW_ADDRESS , // 171 + EVT_RECEIVE_COPY_ADDRESS , // 172 + EVT_RECEIVE_SET_QUICK_RECEIVE_ADDRESS , // 173 + EVT_RECEIVE_DISPLAY_ADDRESS , // 174 + EVT_RECEIVE_ADDRESS_BALANCE , // 175 + EVT_RECEIVE_BACK_REQUEST , // 176 + EVT_STATE_ID_SCR_RECEIVE_MAX , // 177 }; enum EVT_STATE_ID_SCR_SEND { - EVT_STATE_ID_SCR_SEND_MIN=EVT_STATE_ID_SCR_RECEIVE_MAX+1, // 167 - EVT_SEND_ADD_DESTINATION_REQUEST , // 168 - EVT_SEND_CREATE_TRANSACTION_REQUEST , // 169 - EVT_SEND_BACK_REQUEST , // 170 - EVT_SEND_CREATE_TRANSACTION_SUCCEED , // 171 - EVT_SEND_BACK_HOME_SHARED_WL , // 172 - EVT_STATE_ID_SCR_SEND_MAX , // 173 + EVT_STATE_ID_SCR_SEND_MIN=EVT_STATE_ID_SCR_RECEIVE_MAX+1, // 178 + EVT_SEND_ADD_DESTINATION_REQUEST , // 179 + EVT_SEND_CREATE_TRANSACTION_REQUEST , // 180 + EVT_SEND_BACK_REQUEST , // 181 + EVT_SEND_CREATE_TRANSACTION_SUCCEED , // 182 + EVT_SEND_BACK_HOME_SHARED_WL , // 183 + EVT_STATE_ID_SCR_SEND_MAX , // 184 }; enum EVT_STATE_ID_SCR_CREATE_TRANSACTION { - EVT_STATE_ID_SCR_CREATE_TRANSACTION_MIN=EVT_STATE_ID_SCR_SEND_MAX+1, // 174 - EVT_CREATE_TRANSACTION_MAKE_DRAFT_TX , // 175 - EVT_CREATE_TRANSACTION_SAVE_REQUEST , // 176 - EVT_CREATE_TRANSACTION_UTXO_SORT_REQUEST , // 177 - EVT_CREATE_TRANSACTION_SIGN_REQUEST , // 178 - EVT_CREATE_TRANSACTION_BACK_REQUEST , // 179 - EVT_CREATE_TRANSACTION_SIGN_SUCCEED , // 180 - EVR_CREATE_TRANSACTION_BACK_UTXO_CONSILIDATE , // 181 - EVT_STATE_ID_SCR_CREATE_TRANSACTION_MAX , // 182 + EVT_STATE_ID_SCR_CREATE_TRANSACTION_MIN=EVT_STATE_ID_SCR_SEND_MAX+1, // 185 + EVT_CREATE_TRANSACTION_MAKE_DRAFT_TX , // 186 + EVT_CREATE_TRANSACTION_SAVE_REQUEST , // 187 + EVT_CREATE_TRANSACTION_UTXO_SORT_REQUEST , // 188 + EVT_CREATE_TRANSACTION_SIGN_REQUEST , // 189 + EVT_CREATE_TRANSACTION_BACK_REQUEST , // 190 + EVT_CREATE_TRANSACTION_SIGN_SUCCEED , // 191 + EVR_CREATE_TRANSACTION_BACK_UTXO_CONSILIDATE , // 192 + EVT_STATE_ID_SCR_CREATE_TRANSACTION_MAX , // 193 }; enum EVT_STATE_ID_SCR_TRANSACTION_INFO { - EVT_STATE_ID_SCR_TRANSACTION_INFO_MIN=EVT_STATE_ID_SCR_CREATE_TRANSACTION_MAX+1, // 183 - EVT_TRANSACTION_SIGN_REQUEST , // 184 - EVT_TRANSACTION_EXPORT_REQUEST , // 185 - EVT_TRANSACTION_EXPORT_QRCODE , // 186 - EVT_TRANSACTION_IMPORT_REQUEST , // 187 - EVT_TRANSACTION_IMPORT_QRCODE , // 188 - EVT_TRANSACTION_BROADCAST_REQUEST , // 189 - EVT_TRANSACTION_SET_MEMO_REQUEST , // 190 - EVT_TRANSACTION_SCAN_DEVICE_REQUEST , // 191 - EVT_TRANSACTION_REMOVE_REQUEST , // 192 - EVT_TRANSACTION_SEND_PIN_REQUEST , // 193 - EVT_TRANSACTION_PROMT_PIN_REQUEST , // 194 - EVT_TRANSACTION_VERIFY_ADDRESS , // 195 - EVT_TRANSACTION_SEND_PASSPHRASE , // 196 - EVT_TRANSACTION_CANCEL_REQUEST , // 197 - EVT_TRANSACTION_INFO_BACK_REQUEST , // 198 - EVT_TRANSACTION_INFO_BACK_TO_CREATE_TRANSACTION_REQUEST , // 199 - EVT_TRANSACTION_REPLACE_BY_FEE_REQUEST , // 200 - EVT_TRANSACTION_INFO_BACK_UTXO_INFO , // 201 - EVT_STATE_ID_SCR_TRANSACTION_INFO_MAX , // 202 + EVT_STATE_ID_SCR_TRANSACTION_INFO_MIN=EVT_STATE_ID_SCR_CREATE_TRANSACTION_MAX+1, // 194 + EVT_TRANSACTION_SIGN_REQUEST , // 195 + EVT_TRANSACTION_EXPORT_REQUEST , // 196 + EVT_TRANSACTION_EXPORT_QRCODE , // 197 + EVT_TRANSACTION_IMPORT_REQUEST , // 198 + EVT_TRANSACTION_IMPORT_QRCODE , // 199 + EVT_TRANSACTION_BROADCAST_REQUEST , // 200 + EVT_TRANSACTION_SET_MEMO_REQUEST , // 201 + EVT_TRANSACTION_SCAN_DEVICE_REQUEST , // 202 + EVT_TRANSACTION_REMOVE_REQUEST , // 203 + EVT_TRANSACTION_SEND_PIN_REQUEST , // 204 + EVT_TRANSACTION_PROMT_PIN_REQUEST , // 205 + EVT_TRANSACTION_VERIFY_ADDRESS , // 206 + EVT_TRANSACTION_SEND_PASSPHRASE , // 207 + EVT_TRANSACTION_CANCEL_REQUEST , // 208 + EVT_TRANSACTION_INFO_BACK_REQUEST , // 209 + EVT_TRANSACTION_INFO_BACK_TO_CREATE_TRANSACTION_REQUEST , // 210 + EVT_TRANSACTION_REPLACE_BY_FEE_REQUEST , // 211 + EVT_TRANSACTION_INFO_BACK_UTXO_INFO , // 212 + EVT_STATE_ID_SCR_TRANSACTION_INFO_MAX , // 213 }; enum EVT_STATE_ID_SCR_TRANSACTION_HISTORY { - EVT_STATE_ID_SCR_TRANSACTION_HISTORY_MIN=EVT_STATE_ID_SCR_TRANSACTION_INFO_MAX+1, // 203 - EVT_TRANSACTION_HISTORY_SORT_REQUEST , // 204 - EVT_TRANSACTION_HISTORY_BACK_REQUEST , // 205 - EVT_TRANSACTION_INFO_ITEM_SELECTED , // 206 - EVT_STATE_ID_SCR_TRANSACTION_HISTORY_MAX , // 207 + EVT_STATE_ID_SCR_TRANSACTION_HISTORY_MIN=EVT_STATE_ID_SCR_TRANSACTION_INFO_MAX+1, // 214 + EVT_TRANSACTION_HISTORY_SORT_REQUEST , // 215 + EVT_TRANSACTION_HISTORY_BACK_REQUEST , // 216 + EVT_TRANSACTION_INFO_ITEM_SELECTED , // 217 + EVT_STATE_ID_SCR_TRANSACTION_HISTORY_MAX , // 218 }; enum EVT_STATE_ID_SCR_APP_SETTINGS { - EVT_STATE_ID_SCR_APP_SETTINGS_MIN=EVT_STATE_ID_SCR_TRANSACTION_HISTORY_MAX+1, // 208 - EVT_APP_SETTING_DELETE_ACCOUNT_REQUEST , // 209 - EVT_APP_SETTING_CHANGE_PASSPHRASE , // 210 - EVT_APP_SETTING_REQUEST_RESTART , // 211 - EVT_APP_SETTING_REQUEST_RESCAN , // 212 - EVT_APP_SETTING_DELETE_PRIMARY_KEY_ACCOUNT_REQUEST , // 213 - EVT_APP_SETTING_BACK_REQUEST , // 214 - EVT_APP_SETTING_BACK_TO_ONLINE_MODE , // 215 - EVT_SHOW_REPLACE_PRIMARY_KEY_REQUEST , // 216 - EVT_STATE_ID_SCR_APP_SETTINGS_MAX , // 217 + EVT_STATE_ID_SCR_APP_SETTINGS_MIN=EVT_STATE_ID_SCR_TRANSACTION_HISTORY_MAX+1, // 219 + EVT_APP_SETTING_DELETE_ACCOUNT_REQUEST , // 220 + EVT_APP_SETTING_CHANGE_PASSPHRASE , // 221 + EVT_APP_SETTING_REQUEST_RESTART , // 222 + EVT_APP_SETTING_REQUEST_RESCAN , // 223 + EVT_APP_SETTING_DELETE_PRIMARY_KEY_ACCOUNT_REQUEST , // 224 + EVT_APP_SETTING_BACK_REQUEST , // 225 + EVT_APP_SETTING_BACK_TO_ONLINE_MODE , // 226 + EVT_SHOW_REPLACE_PRIMARY_KEY_REQUEST , // 227 + EVT_STATE_ID_SCR_APP_SETTINGS_MAX , // 228 }; enum EVT_STATE_ID_SCR_ADD_REMOTE_SIGNER_RESULT { - EVT_STATE_ID_SCR_ADD_REMOTE_SIGNER_RESULT_MIN=EVT_STATE_ID_SCR_APP_SETTINGS_MAX+1, // 218 - EVT_REMOTE_SIGNER_RESULT_HEALTH_CHECK , // 219 - EVT_REMOTE_SIGNER_RESULT_EDIT_NAME , // 220 - EVT_REMOTE_SIGNER_RESULT_IMPORT_SIGNATURE , // 221 - EVT_REMOTE_SIGNER_RESULT_EXPORT_MESSAGE , // 222 - EVT_REMOTE_SIGNER_RESULT_GET_XPUBS , // 223 - EVT_REMOTE_SIGNER_RESULT_DELETE_REQUEST , // 224 - EVT_REMOTE_SIGNER_RESULT_CONFIRM_ADD_TO_WALLET_SIGNER_CONFIG , // 225 - EVT_STATE_ID_SCR_ADD_REMOTE_SIGNER_RESULT_MAX , // 226 + EVT_STATE_ID_SCR_ADD_REMOTE_SIGNER_RESULT_MIN=EVT_STATE_ID_SCR_APP_SETTINGS_MAX+1, // 229 + EVT_REMOTE_SIGNER_RESULT_HEALTH_CHECK , // 230 + EVT_REMOTE_SIGNER_RESULT_EDIT_NAME , // 231 + EVT_REMOTE_SIGNER_RESULT_IMPORT_SIGNATURE , // 232 + EVT_REMOTE_SIGNER_RESULT_EXPORT_MESSAGE , // 233 + EVT_REMOTE_SIGNER_RESULT_GET_XPUBS , // 234 + EVT_REMOTE_SIGNER_RESULT_DELETE_REQUEST , // 235 + EVT_REMOTE_SIGNER_RESULT_CONFIRM_ADD_TO_WALLET_SIGNER_CONFIG , // 236 + EVT_STATE_ID_SCR_ADD_REMOTE_SIGNER_RESULT_MAX , // 237 }; enum EVT_STATE_ID_SCR_UTXOS { - EVT_STATE_ID_SCR_UTXOS_MIN=EVT_STATE_ID_SCR_ADD_REMOTE_SIGNER_RESULT_MAX+1, // 227 - EVT_UTXOS_SORT_REQUEST , // 228 - EVT_UTXOS_BACK_REQUEST , // 229 - EVT_UTXOS_CONSOLIDATE_REQUEST , // 230 - EVT_UTXOS_ITEM_SELECTED , // 231 - EVT_UTXO_OUTPUT_BACK_SHARED_WALLET , // 232 - EVT_STATE_ID_SCR_UTXOS_MAX , // 233 + EVT_STATE_ID_SCR_UTXOS_MIN=EVT_STATE_ID_SCR_ADD_REMOTE_SIGNER_RESULT_MAX+1, // 238 + EVT_UTXOS_SORT_REQUEST , // 239 + EVT_UTXOS_BACK_REQUEST , // 240 + EVT_UTXOS_CONSOLIDATE_REQUEST , // 241 + EVT_UTXOS_ITEM_SELECTED , // 242 + EVT_UTXO_OUTPUT_BACK_SHARED_WALLET , // 243 + EVT_STATE_ID_SCR_UTXOS_MAX , // 244 }; enum EVT_STATE_ID_SCR_WALLET_INFO { - EVT_STATE_ID_SCR_WALLET_INFO_MIN=EVT_STATE_ID_SCR_UTXOS_MAX+1, // 234 - EVT_WALLET_INFO_EDIT_NAME , // 235 - EVT_WALLET_INFO_REMOVE , // 236 - EVT_WALLET_INFO_EXPORT_DB , // 237 - EVT_WALLET_INFO_EXPORT_CSV , // 238 - EVT_WALLET_INFO_EXPORT_DESCRIPTOR , // 239 - EVT_WALLET_INFO_EXPORT_COLDCARD , // 240 - EVT_WALLET_INFO_EXPORT_QRCODE , // 241 - EVT_WALLET_INFO_SIGNER_INFO_REQUEST , // 242 - EVT_WALLET_INFO_EDIT_DESCRIPTION , // 243 - EVT_WALLET_INFO_IMPORT_PSBT , // 244 - EVT_WALLET_INFO_REFRESH_WALLET_REQUEST , // 245 - EVT_WALLET_INFO_GAP_LIMIT_REQUEST , // 246 - EVT_WALLET_INFO_BACK_REQUEST , // 247 - EVT_WALLET_INFO_UTXOS_REQUEST , // 248 - EVT_WALLET_INFO_CHANGE_ADDRESS_REQUEST , // 249 - EVT_WALLET_INFO_MASTER_SIGNER_INFO_REQUEST , // 250 - EVT_WALLET_INFO_REMOTE_SIGNER_INFO_REQUEST , // 251 - EVT_STATE_ID_SCR_WALLET_INFO_MAX , // 252 + EVT_STATE_ID_SCR_WALLET_INFO_MIN=EVT_STATE_ID_SCR_UTXOS_MAX+1, // 245 + EVT_WALLET_INFO_EDIT_NAME , // 246 + EVT_WALLET_INFO_REMOVE , // 247 + EVT_WALLET_INFO_EXPORT_DB , // 248 + EVT_WALLET_INFO_EXPORT_CSV , // 249 + EVT_WALLET_INFO_EXPORT_DESCRIPTOR , // 250 + EVT_WALLET_INFO_EXPORT_COLDCARD , // 251 + EVT_WALLET_INFO_EXPORT_QRCODE , // 252 + EVT_WALLET_INFO_SIGNER_INFO_REQUEST , // 253 + EVT_WALLET_INFO_EDIT_DESCRIPTION , // 254 + EVT_WALLET_INFO_IMPORT_PSBT , // 255 + EVT_WALLET_INFO_REFRESH_WALLET_REQUEST , // 256 + EVT_WALLET_INFO_GAP_LIMIT_REQUEST , // 257 + EVT_WALLET_INFO_BACK_REQUEST , // 258 + EVT_WALLET_INFO_UTXOS_REQUEST , // 259 + EVT_WALLET_INFO_CHANGE_ADDRESS_REQUEST , // 260 + EVT_WALLET_INFO_MASTER_SIGNER_INFO_REQUEST , // 261 + EVT_WALLET_INFO_REMOTE_SIGNER_INFO_REQUEST , // 262 + EVT_STATE_ID_SCR_WALLET_INFO_MAX , // 263 }; enum EVT_STATE_ID_SCR_ADD_WALLET_CONFIRMATION { - EVT_STATE_ID_SCR_ADD_WALLET_CONFIRMATION_MIN=EVT_STATE_ID_SCR_WALLET_INFO_MAX+1, // 253 - EVT_ADD_WALLET_CONFIRM_CREATE , // 254 - EVT_ADD_WALLET_TOP_UP_XPUBS_REQUEST , // 255 - EVT_ADD_WALLET_DOWNLOAD_DESCRIPTOR , // 256 - EVT_ADD_WALLET_GENERATE_SIGNER , // 257 - EVT_ADD_WALLET_GET_WALLET_DESCRIPTOR , // 258 - EVT_ADD_WALLET_COPY_WALLET_DESCRIPTOR , // 259 - EVT_ADD_WALLET_CONFIRMATION_BACK_REQUEST , // 260 - EVT_ADD_WALLET_SUCCESSFULLY , // 261 - EVT_STATE_ID_SCR_ADD_WALLET_CONFIRMATION_MAX , // 262 + EVT_STATE_ID_SCR_ADD_WALLET_CONFIRMATION_MIN=EVT_STATE_ID_SCR_WALLET_INFO_MAX+1, // 264 + EVT_ADD_WALLET_CONFIRM_CREATE , // 265 + EVT_ADD_WALLET_TOP_UP_XPUBS_REQUEST , // 266 + EVT_ADD_WALLET_DOWNLOAD_DESCRIPTOR , // 267 + EVT_ADD_WALLET_GENERATE_SIGNER , // 268 + EVT_ADD_WALLET_GET_WALLET_DESCRIPTOR , // 269 + EVT_ADD_WALLET_COPY_WALLET_DESCRIPTOR , // 270 + EVT_ADD_WALLET_CONFIRMATION_BACK_REQUEST , // 271 + EVT_ADD_WALLET_SUCCESSFULLY , // 272 + EVT_STATE_ID_SCR_ADD_WALLET_CONFIRMATION_MAX , // 273 }; enum EVT_STATE_ID_SCR_ADD_HARDWARE_SIGNER_TO_WALLET { - EVT_STATE_ID_SCR_ADD_HARDWARE_SIGNER_TO_WALLET_MIN=EVT_STATE_ID_SCR_ADD_WALLET_CONFIRMATION_MAX+1, // 263 - EVT_ADD_HARDWARE_SIGNER_TO_WALLET_MASTER_SIGNER , // 264 - EVT_ADD_HARDWARE_SIGNER_TO_WALLET_REMOTE_SIGNER , // 265 - EVT_ADD_HARDWARE_SIGNER_TO_WALLET_MASTER_SIGNER_REFRESH , // 266 - EVT_ADD_HARDWARE_SIGNER_TO_WALLET_SEND_PIN , // 267 - EVT_ADD_HARDWARE_SIGNER_TO_WALLET_PROMT_PIN , // 268 - EVT_ADD_HARDWARE_SIGNER_TO_WALLET_REMOTE_SIGNER_RESULT , // 269 - EVT_ADD_HARDWARE_SIGNER_TO_WALLET_MASTER_SIGNER_RESULT , // 270 - EVT_ADD_HARDWARE_SIGNER_TO_WALLET_BACK , // 271 - EVT_STATE_ID_SCR_ADD_HARDWARE_SIGNER_TO_WALLET_MAX , // 272 + EVT_STATE_ID_SCR_ADD_HARDWARE_SIGNER_TO_WALLET_MIN=EVT_STATE_ID_SCR_ADD_WALLET_CONFIRMATION_MAX+1, // 274 + EVT_ADD_HARDWARE_SIGNER_TO_WALLET_MASTER_SIGNER , // 275 + EVT_ADD_HARDWARE_SIGNER_TO_WALLET_REMOTE_SIGNER , // 276 + EVT_ADD_HARDWARE_SIGNER_TO_WALLET_MASTER_SIGNER_REFRESH , // 277 + EVT_ADD_HARDWARE_SIGNER_TO_WALLET_SEND_PIN , // 278 + EVT_ADD_HARDWARE_SIGNER_TO_WALLET_PROMT_PIN , // 279 + EVT_ADD_HARDWARE_SIGNER_TO_WALLET_REMOTE_SIGNER_RESULT , // 280 + EVT_ADD_HARDWARE_SIGNER_TO_WALLET_MASTER_SIGNER_RESULT , // 281 + EVT_ADD_HARDWARE_SIGNER_TO_WALLET_BACK , // 282 + EVT_STATE_ID_SCR_ADD_HARDWARE_SIGNER_TO_WALLET_MAX , // 283 }; enum EVT_STATE_ID_SCR_WALLET_CHANGE_ADDRESSES { - EVT_STATE_ID_SCR_WALLET_CHANGE_ADDRESSES_MIN=EVT_STATE_ID_SCR_ADD_HARDWARE_SIGNER_TO_WALLET_MAX+1, // 273 - EVT_WALLET_CHANGE_ADDRESSES_GEN_NEW_ADDRESS , // 274 - EVT_WALLET_CHANGE_ADDRESSES_COPY , // 275 - EVT_WALLET_CHANGE_ADDRESS_BACK_REQUEST , // 276 - EVT_CHANGE_ADDRESS_BACK_SHARED_WALLET , // 277 - EVT_STATE_ID_SCR_WALLET_CHANGE_ADDRESSES_MAX , // 278 + EVT_STATE_ID_SCR_WALLET_CHANGE_ADDRESSES_MIN=EVT_STATE_ID_SCR_ADD_HARDWARE_SIGNER_TO_WALLET_MAX+1, // 284 + EVT_WALLET_CHANGE_ADDRESSES_GEN_NEW_ADDRESS , // 285 + EVT_WALLET_CHANGE_ADDRESSES_COPY , // 286 + EVT_WALLET_CHANGE_ADDRESS_BACK_REQUEST , // 287 + EVT_CHANGE_ADDRESS_BACK_SHARED_WALLET , // 288 + EVT_STATE_ID_SCR_WALLET_CHANGE_ADDRESSES_MAX , // 289 }; enum EVT_STATE_ID_SCR_ADD_MASTER_SIGNER_RESULT { - EVT_STATE_ID_SCR_ADD_MASTER_SIGNER_RESULT_MIN=EVT_STATE_ID_SCR_WALLET_CHANGE_ADDRESSES_MAX+1, // 279 - EVT_ADD_MASTER_SIGNER_RESULT_RUN_HEALTHCHECK , // 280 - EVT_ADD_MASTER_SIGNER_RESULT_PROMT_PIN , // 281 - EVT_ADD_MASTER_SIGNER_RESULT_GET_XPUBS , // 282 - EVT_ADD_MASTER_SIGNER_INFO_REMOVE_REQUEST , // 283 - EVT_ADD_MASTER_SIGNER_FINISHED , // 284 - EVT_ADD_MASTER_SIGNER_RESULT_CONFIRM_ADD_TO_WALLET_CONFIGURATION , // 285 - EVT_STATE_ID_SCR_ADD_MASTER_SIGNER_RESULT_MAX , // 286 + EVT_STATE_ID_SCR_ADD_MASTER_SIGNER_RESULT_MIN=EVT_STATE_ID_SCR_WALLET_CHANGE_ADDRESSES_MAX+1, // 290 + EVT_ADD_MASTER_SIGNER_RESULT_RUN_HEALTHCHECK , // 291 + EVT_ADD_MASTER_SIGNER_RESULT_PROMT_PIN , // 292 + EVT_ADD_MASTER_SIGNER_RESULT_GET_XPUBS , // 293 + EVT_ADD_MASTER_SIGNER_INFO_REMOVE_REQUEST , // 294 + EVT_ADD_MASTER_SIGNER_FINISHED , // 295 + EVT_ADD_MASTER_SIGNER_RESULT_CONFIRM_ADD_TO_WALLET_CONFIGURATION , // 296 + EVT_STATE_ID_SCR_ADD_MASTER_SIGNER_RESULT_MAX , // 297 }; enum EVT_STATE_ID_SCR_REMOTE_SIGNER_INFO { - EVT_STATE_ID_SCR_REMOTE_SIGNER_INFO_MIN=EVT_STATE_ID_SCR_ADD_MASTER_SIGNER_RESULT_MAX+1, // 287 - EVT_REMOTE_SIGNER_INFO_HEALTH_CHECK , // 288 - EVT_REMOTE_SIGNER_INFO_EDIT_NAME , // 289 - EVT_REMOTE_SIGNER_INFO_IMPORT_SIGNATURE , // 290 - EVT_REMOTE_SIGNER_INFO_EXPORT_MESSAGE , // 291 - EVT_REMOTE_SIGNER_INFO_DELETE_REQUEST , // 292 - EVT_REMOTE_SIGNER_INFO_GET_XPUBS , // 293 - EVT_REMOTE_SIGNER_INFO_BACK_WALLET_INFO , // 294 - EVT_REMOTE_SIGNER_INFO_BACK_HOME , // 295 - EVT_STATE_ID_SCR_REMOTE_SIGNER_INFO_MAX , // 296 + EVT_STATE_ID_SCR_REMOTE_SIGNER_INFO_MIN=EVT_STATE_ID_SCR_ADD_MASTER_SIGNER_RESULT_MAX+1, // 298 + EVT_REMOTE_SIGNER_INFO_HEALTH_CHECK , // 299 + EVT_REMOTE_SIGNER_INFO_EDIT_NAME , // 300 + EVT_REMOTE_SIGNER_INFO_IMPORT_SIGNATURE , // 301 + EVT_REMOTE_SIGNER_INFO_EXPORT_MESSAGE , // 302 + EVT_REMOTE_SIGNER_INFO_DELETE_REQUEST , // 303 + EVT_REMOTE_SIGNER_INFO_GET_XPUBS , // 304 + EVT_REMOTE_SIGNER_INFO_BACK_WALLET_INFO , // 305 + EVT_REMOTE_SIGNER_INFO_BACK_HOME , // 306 + EVT_STATE_ID_SCR_REMOTE_SIGNER_INFO_MAX , // 307 }; enum EVT_STATE_ID_SCR_UNLOCK_DB { - EVT_STATE_ID_SCR_UNLOCK_DB_MIN=EVT_STATE_ID_SCR_REMOTE_SIGNER_INFO_MAX+1, // 297 - EVT_LOGIN_PERFORM_PASSWORD_REQUEST , // 298 - EVT_STATE_ID_SCR_UNLOCK_DB_MAX , // 299 + EVT_STATE_ID_SCR_UNLOCK_DB_MIN=EVT_STATE_ID_SCR_REMOTE_SIGNER_INFO_MAX+1, // 308 + EVT_LOGIN_PERFORM_PASSWORD_REQUEST , // 309 + EVT_STATE_ID_SCR_UNLOCK_DB_MAX , // 310 }; enum EVT_STATE_ID_SCR_CONSOLIDATE_OUTPUT { - EVT_STATE_ID_SCR_CONSOLIDATE_OUTPUT_MIN=EVT_STATE_ID_SCR_UNLOCK_DB_MAX+1, // 300 - EVT_CONSOLIDATE_MAKE_TRANSACTION , // 301 - EVT_CONSOLIDATE_BACK_REQUEST , // 302 - EVT_CONSOLIDATE_MAKE_TRANSACTION_SUCCEED , // 303 - EVT_STATE_ID_SCR_CONSOLIDATE_OUTPUT_MAX , // 304 + EVT_STATE_ID_SCR_CONSOLIDATE_OUTPUT_MIN=EVT_STATE_ID_SCR_UNLOCK_DB_MAX+1, // 311 + EVT_CONSOLIDATE_MAKE_TRANSACTION , // 312 + EVT_CONSOLIDATE_BACK_REQUEST , // 313 + EVT_CONSOLIDATE_MAKE_TRANSACTION_SUCCEED , // 314 + EVT_STATE_ID_SCR_CONSOLIDATE_OUTPUT_MAX , // 315 }; enum EVT_STATE_ID_SCR_UTXO_OUTPUT { - EVT_STATE_ID_SCR_UTXO_OUTPUT_MIN=EVT_STATE_ID_SCR_CONSOLIDATE_OUTPUT_MAX+1, // 305 - EVT_UTXO_INFO_CHECKOUT_TX_RELATED , // 306 - EVT_UTXO_INFO_BACK_REQUEST , // 307 - EVT_UTXO_INFO_VIEW_TX_RELATED , // 308 - EVT_STATE_ID_SCR_UTXO_OUTPUT_MAX , // 309 + EVT_STATE_ID_SCR_UTXO_OUTPUT_MIN=EVT_STATE_ID_SCR_CONSOLIDATE_OUTPUT_MAX+1, // 316 + EVT_UTXO_INFO_CHECKOUT_TX_RELATED , // 317 + EVT_UTXO_INFO_BACK_REQUEST , // 318 + EVT_UTXO_INFO_VIEW_TX_RELATED , // 319 + EVT_STATE_ID_SCR_UTXO_OUTPUT_MAX , // 320 }; enum EVT_STATE_ID_SCR_INPUT_PIN { - EVT_STATE_ID_SCR_INPUT_PIN_MIN=EVT_STATE_ID_SCR_UTXO_OUTPUT_MAX+1, // 310 - EVT_INPUT_PIN_SEND_PIN , // 311 - EVT_INPUT_PIN_CLOSE , // 312 - EVT_STATE_ID_SCR_INPUT_PIN_MAX , // 313 + EVT_STATE_ID_SCR_INPUT_PIN_MIN=EVT_STATE_ID_SCR_UTXO_OUTPUT_MAX+1, // 321 + EVT_INPUT_PIN_SEND_PIN , // 322 + EVT_INPUT_PIN_CLOSE , // 323 + EVT_STATE_ID_SCR_INPUT_PIN_MAX , // 324 }; enum EVT_STATE_ID_SCR_ADD_NEW_SIGNER { - EVT_STATE_ID_SCR_ADD_NEW_SIGNER_MIN=EVT_STATE_ID_SCR_INPUT_PIN_MAX+1, // 314 - EVT_ADD_HARDWARE_SIGNER_REQUEST , // 315 - EVT_ADD_NEW_SIGNER_BACK_REQUEST , // 316 - EVT_ADD_NEW_SIGNER_SOFTWARE_SIGNER_NEW_SEED , // 317 - EVT_ADD_NEW_SIGNER_SOFTWARE_SIGNER_EXIST_SEED , // 318 - EVT_ADD_NEW_SIGNER_BACK_TO_HOME_ONLINE , // 319 - EVT_STATE_ID_SCR_ADD_NEW_SIGNER_MAX , // 320 + EVT_STATE_ID_SCR_ADD_NEW_SIGNER_MIN=EVT_STATE_ID_SCR_INPUT_PIN_MAX+1, // 325 + EVT_ADD_HARDWARE_SIGNER_REQUEST , // 326 + EVT_ADD_NEW_SIGNER_BACK_REQUEST , // 327 + EVT_ADD_NEW_SIGNER_SOFTWARE_SIGNER_NEW_SEED , // 328 + EVT_ADD_NEW_SIGNER_SOFTWARE_SIGNER_EXIST_SEED , // 329 + EVT_ADD_NEW_SIGNER_BACK_TO_HOME_ONLINE , // 330 + EVT_STATE_ID_SCR_ADD_NEW_SIGNER_MAX , // 331 }; enum EVT_STATE_ID_SCR_ADD_NEW_SOFTWARE_SIGNER { - EVT_STATE_ID_SCR_ADD_NEW_SOFTWARE_SIGNER_MIN=EVT_STATE_ID_SCR_ADD_NEW_SIGNER_MAX+1, // 321 - EVT_ADD_NEW_SOFTWARE_SIGNER_BACK , // 322 - EVT_CREATE_NEW_SEED , // 323 - EVT_ADD_NEW_SOFTWARE_SIGNER_TO_WALLET_BACK , // 324 - EVT_NEW_SOFTWARE_SIGNER_BACK_TO_WALLET_SIGNER_CONFIGURATION , // 325 - EVT_STATE_ID_SCR_ADD_NEW_SOFTWARE_SIGNER_MAX , // 326 + EVT_STATE_ID_SCR_ADD_NEW_SOFTWARE_SIGNER_MIN=EVT_STATE_ID_SCR_ADD_NEW_SIGNER_MAX+1, // 332 + EVT_ADD_NEW_SOFTWARE_SIGNER_BACK , // 333 + EVT_CREATE_NEW_SEED , // 334 + EVT_ADD_NEW_SOFTWARE_SIGNER_TO_WALLET_BACK , // 335 + EVT_NEW_SOFTWARE_SIGNER_BACK_TO_WALLET_SIGNER_CONFIGURATION , // 336 + EVT_STATE_ID_SCR_ADD_NEW_SOFTWARE_SIGNER_MAX , // 337 }; enum EVT_STATE_ID_SCR_RECOVER_SOFTWARE_SIGNER { - EVT_STATE_ID_SCR_RECOVER_SOFTWARE_SIGNER_MIN=EVT_STATE_ID_SCR_ADD_NEW_SOFTWARE_SIGNER_MAX+1, // 327 - EVT_RECOVER_SOFTWARE_SIGNER_REQUEST , // 328 - EVT_RECOVER_SOFTWARE_SIGNER_BACK , // 329 - EVT_RECOVER_SOFTWARE_SIGNER_SUCCEED , // 330 - EVT_RECOVER_SOFTWARE_SIGNER_TO_WALLET_BACK , // 331 - EVT_RECOVER_SOFTWARE_SIGNER_BACK_TO_WALLET_SIGNER_CONFIGURATION , // 332 - EVT_STATE_ID_SCR_RECOVER_SOFTWARE_SIGNER_MAX , // 333 + EVT_STATE_ID_SCR_RECOVER_SOFTWARE_SIGNER_MIN=EVT_STATE_ID_SCR_ADD_NEW_SOFTWARE_SIGNER_MAX+1, // 338 + EVT_RECOVER_SOFTWARE_SIGNER_REQUEST , // 339 + EVT_RECOVER_SOFTWARE_SIGNER_BACK , // 340 + EVT_RECOVER_SOFTWARE_SIGNER_SUCCEED , // 341 + EVT_RECOVER_SOFTWARE_SIGNER_TO_WALLET_BACK , // 342 + EVT_RECOVER_SOFTWARE_SIGNER_BACK_TO_WALLET_SIGNER_CONFIGURATION , // 343 + EVT_STATE_ID_SCR_RECOVER_SOFTWARE_SIGNER_MAX , // 344 }; enum EVT_STATE_ID_SCR_CREATE_NEW_SEED { - EVT_STATE_ID_SCR_CREATE_NEW_SEED_MIN=EVT_STATE_ID_SCR_RECOVER_SOFTWARE_SIGNER_MAX+1, // 334 - EVT_CREATE_NEW_SEED_BACK , // 335 - EVT_CREATE_NEW_SEED_SUCCEED , // 336 - EVT_NEW_SEED_BACK_TO_WALLET_SIGNER_CONFIGURATION , // 337 - EVT_STATE_ID_SCR_CREATE_NEW_SEED_MAX , // 338 + EVT_STATE_ID_SCR_CREATE_NEW_SEED_MIN=EVT_STATE_ID_SCR_RECOVER_SOFTWARE_SIGNER_MAX+1, // 345 + EVT_CREATE_NEW_SEED_BACK , // 346 + EVT_CREATE_NEW_SEED_SUCCEED , // 347 + EVT_NEW_SEED_BACK_TO_WALLET_SIGNER_CONFIGURATION , // 348 + EVT_STATE_ID_SCR_CREATE_NEW_SEED_MAX , // 349 }; enum EVT_STATE_ID_SCR_SOFTWARE_SIGNER_CONFIGURATION { - EVT_STATE_ID_SCR_SOFTWARE_SIGNER_CONFIGURATION_MIN=EVT_STATE_ID_SCR_CREATE_NEW_SEED_MAX+1, // 339 - EVT_SOFTWARE_SIGNER_REQUEST_CREATE , // 340 - EVT_ADD_SOFTWARE_SIGNER_RESULT , // 341 - EVT_SOFTWARE_SIGNER_CONFIGURATION_BACK , // 342 - EVT_SOFTWARE_SIGNER_CONFIGURATION_BACK_TO_WALLET_SIGNER_CONFIGURATION , // 343 - EVT_PRIMARY_KEY_CONFIGURATION_REQUEST , // 344 - EVT_STATE_ID_SCR_SOFTWARE_SIGNER_CONFIGURATION_MAX , // 345 + EVT_STATE_ID_SCR_SOFTWARE_SIGNER_CONFIGURATION_MIN=EVT_STATE_ID_SCR_CREATE_NEW_SEED_MAX+1, // 350 + EVT_SOFTWARE_SIGNER_REQUEST_CREATE , // 351 + EVT_ADD_SOFTWARE_SIGNER_RESULT , // 352 + EVT_SOFTWARE_SIGNER_CONFIGURATION_BACK , // 353 + EVT_SOFTWARE_SIGNER_CONFIGURATION_BACK_TO_WALLET_SIGNER_CONFIGURATION , // 354 + EVT_PRIMARY_KEY_CONFIGURATION_REQUEST , // 355 + EVT_STATE_ID_SCR_SOFTWARE_SIGNER_CONFIGURATION_MAX , // 356 }; enum EVT_STATE_ID_SCR_ADD_NEW_SIGNER_TO_WALLET { - EVT_STATE_ID_SCR_ADD_NEW_SIGNER_TO_WALLET_MIN=EVT_STATE_ID_SCR_SOFTWARE_SIGNER_CONFIGURATION_MAX+1, // 346 - EVT_ADD_SIGNER_TO_WALLET_BACK_REQUEST , // 347 - EVT_ADD_HARDWARE_SIGNER_TO_WALLET , // 348 - EVT_ADD_NEW_SOFTWARE_SIGNER_TO_WALLET , // 349 - EVT_RECOVER_SOFTWARE_SIGNER_TO_WALLET , // 350 - EVT_STATE_ID_SCR_ADD_NEW_SIGNER_TO_WALLET_MAX , // 351 + EVT_STATE_ID_SCR_ADD_NEW_SIGNER_TO_WALLET_MIN=EVT_STATE_ID_SCR_SOFTWARE_SIGNER_CONFIGURATION_MAX+1, // 357 + EVT_ADD_SIGNER_TO_WALLET_BACK_REQUEST , // 358 + EVT_ADD_HARDWARE_SIGNER_TO_WALLET , // 359 + EVT_ADD_NEW_SOFTWARE_SIGNER_TO_WALLET , // 360 + EVT_RECOVER_SOFTWARE_SIGNER_TO_WALLET , // 361 + EVT_STATE_ID_SCR_ADD_NEW_SIGNER_TO_WALLET_MAX , // 362 }; enum EVT_STATE_ID_SCR_INPUT_PASSPHRASE { - EVT_STATE_ID_SCR_INPUT_PASSPHRASE_MIN=EVT_STATE_ID_SCR_ADD_NEW_SIGNER_TO_WALLET_MAX+1, // 352 - EVT_INPUT_PASSPHRASE_SEND_PASSPHRASE , // 353 - EVT_INPUT_PASSPHRASE_CLOSE , // 354 - EVT_STATE_ID_SCR_INPUT_PASSPHRASE_MAX , // 355 + EVT_STATE_ID_SCR_INPUT_PASSPHRASE_MIN=EVT_STATE_ID_SCR_ADD_NEW_SIGNER_TO_WALLET_MAX+1, // 363 + EVT_INPUT_PASSPHRASE_SEND_PASSPHRASE , // 364 + EVT_INPUT_PASSPHRASE_CLOSE , // 365 + EVT_STATE_ID_SCR_INPUT_PASSPHRASE_MAX , // 366 }; enum EVT_STATE_ID_SCR_LOGIN_ONLINE { - EVT_STATE_ID_SCR_LOGIN_ONLINE_MIN=EVT_STATE_ID_SCR_INPUT_PASSPHRASE_MAX+1, // 356 - EVT_LOGIN_ONLINE_CREATE_ACCOUNT , // 357 - EVT_LOGIN_ONLINE_SIGN_IN , // 358 - EVT_LOGIN_ONLINE_SWITCH_LOCAL_MODE , // 359 - EVT_LOGIN_ONLINE_CHANGE_PASSWORD , // 360 - EVT_LOGIN_ONLINE_FORGOT_PASSWORD , // 361 - EVT_LOGIN_ONLINE_RECOVER_PASSWORD , // 362 - EVT_LOGIN_ONLINE_STAY_SIGNED_IN , // 363 - EVT_LOGIN_ONLINE_VERIFY_NEW_DEVICE , // 364 - EVT_LOGIN_ONLINE_RESEND_CONFIRM_CODE , // 365 - EVT_STATE_ID_SCR_LOGIN_ONLINE_MAX , // 366 + EVT_STATE_ID_SCR_LOGIN_ONLINE_MIN=EVT_STATE_ID_SCR_INPUT_PASSPHRASE_MAX+1, // 367 + EVT_LOGIN_ONLINE_CREATE_ACCOUNT , // 368 + EVT_LOGIN_ONLINE_SIGN_IN , // 369 + EVT_LOGIN_ONLINE_SWITCH_LOCAL_MODE , // 370 + EVT_LOGIN_ONLINE_CHANGE_PASSWORD , // 371 + EVT_LOGIN_ONLINE_FORGOT_PASSWORD , // 372 + EVT_LOGIN_ONLINE_RECOVER_PASSWORD , // 373 + EVT_LOGIN_ONLINE_STAY_SIGNED_IN , // 374 + EVT_LOGIN_ONLINE_VERIFY_NEW_DEVICE , // 375 + EVT_LOGIN_ONLINE_RESEND_CONFIRM_CODE , // 376 + EVT_STATE_ID_SCR_LOGIN_ONLINE_MAX , // 377 }; enum EVT_STATE_ID_SCR_HOME_ONLINE { - EVT_STATE_ID_SCR_HOME_ONLINE_MIN=EVT_STATE_ID_SCR_LOGIN_ONLINE_MAX+1, // 367 - EVT_HOME_ONLINE_ADD_SIGNER , // 368 - EVT_HOME_ONLINE_CREATE_CHAT_ROOM , // 369 - EVT_HOME_ONLINE_CREATE_DIRECT_CHAT , // 370 - EVT_HOME_ONLINE_DELETE_DIRECT_ROOM , // 371 - EVT_HOME_ONLINE_DELETE_ROOM , // 372 - EVT_HOME_ONLINE_SEND_CHAT_CONTENT , // 373 - EVT_HOME_ONLINE_CANCEL_SHARED_WL , // 374 - EVT_HOME_ONLINE_CREATE_SHARED_WALLET , // 375 - EVT_HOME_ONLINE_CANCEL_TRANSACTION , // 376 - EVT_HOME_ONLINE_SERVICE_SUPPORT_REQ , // 377 - EVT_HOME_ONLINE_ADD_CONTACT , // 378 - EVT_HOME_SHOW_ALL_PENDING_CONTACT , // 379 - EVT_HOME_ONLINE_SIGNER_AVAILABLE_FOR_SWL , // 380 - EVT_HOME_SHARED_WALLET_CONFIGURE , // 381 - EVT_HOME_BACKUP_SHARED_WALLET , // 382 - EVT_HOME_ONLINE_SIGNER_UNAVAILABLE_FOR_SWL , // 383 - EVT_HOME_SHARED_WL_SEND_REQUEST , // 384 - EVT_HOME_ONLINE_TRANSACTION_INFO_REQUEST , // 385 - EVT_STATE_ID_SCR_HOME_ONLINE_MAX , // 386 + EVT_STATE_ID_SCR_HOME_ONLINE_MIN=EVT_STATE_ID_SCR_LOGIN_ONLINE_MAX+1, // 378 + EVT_HOME_ONLINE_ADD_SIGNER , // 379 + EVT_HOME_ONLINE_CREATE_CHAT_ROOM , // 380 + EVT_HOME_ONLINE_CREATE_DIRECT_CHAT , // 381 + EVT_HOME_ONLINE_DELETE_DIRECT_ROOM , // 382 + EVT_HOME_ONLINE_DELETE_ROOM , // 383 + EVT_HOME_ONLINE_SEND_CHAT_CONTENT , // 384 + EVT_HOME_ONLINE_CANCEL_SHARED_WL , // 385 + EVT_HOME_ONLINE_CREATE_SHARED_WALLET , // 386 + EVT_HOME_ONLINE_CANCEL_TRANSACTION , // 387 + EVT_HOME_ONLINE_SERVICE_SUPPORT_REQ , // 388 + EVT_HOME_ONLINE_ADD_CONTACT , // 389 + EVT_HOME_SHOW_ALL_PENDING_CONTACT , // 390 + EVT_HOME_ONLINE_SIGNER_AVAILABLE_FOR_SWL , // 391 + EVT_HOME_SHARED_WALLET_CONFIGURE , // 392 + EVT_HOME_BACKUP_SHARED_WALLET , // 393 + EVT_HOME_ONLINE_SIGNER_UNAVAILABLE_FOR_SWL , // 394 + EVT_HOME_SHARED_WL_SEND_REQUEST , // 395 + EVT_HOME_ONLINE_TRANSACTION_INFO_REQUEST , // 396 + EVT_STATE_ID_SCR_HOME_ONLINE_MAX , // 397 }; enum EVT_STATE_ID_SCR_ONLINE_ADD_CONTACTS { - EVT_STATE_ID_SCR_ONLINE_ADD_CONTACTS_MIN=EVT_STATE_ID_SCR_HOME_ONLINE_MAX+1, // 387 - EVT_ONLINE_ADD_CONTACTS_SEARCH_ID , // 388 - EVT_ONLINE_ADD_CONTACTS_SEND_INVITATION , // 389 - EVT_ONLINE_ADD_CONTACTS_BACK , // 390 - EVT_STATE_ID_SCR_ONLINE_ADD_CONTACTS_MAX , // 391 + EVT_STATE_ID_SCR_ONLINE_ADD_CONTACTS_MIN=EVT_STATE_ID_SCR_HOME_ONLINE_MAX+1, // 398 + EVT_ONLINE_ADD_CONTACTS_SEARCH_ID , // 399 + EVT_ONLINE_ADD_CONTACTS_SEND_INVITATION , // 400 + EVT_ONLINE_ADD_CONTACTS_BACK , // 401 + EVT_STATE_ID_SCR_ONLINE_ADD_CONTACTS_MAX , // 402 }; enum EVT_STATE_ID_SCR_PENDING_REQUEST { - EVT_STATE_ID_SCR_PENDING_REQUEST_MIN=EVT_STATE_ID_SCR_ONLINE_ADD_CONTACTS_MAX+1, // 392 - EVT_PENDING_REQUEST_ACCEPT , // 393 - EVT_PENDING_REQUEST_IGNORE , // 394 - EVT_PENDING_REQUEST_BACK , // 395 - EVT_STATE_ID_SCR_PENDING_REQUEST_MAX , // 396 + EVT_STATE_ID_SCR_PENDING_REQUEST_MIN=EVT_STATE_ID_SCR_ONLINE_ADD_CONTACTS_MAX+1, // 403 + EVT_PENDING_REQUEST_ACCEPT , // 404 + EVT_PENDING_REQUEST_IGNORE , // 405 + EVT_PENDING_REQUEST_BACK , // 406 + EVT_STATE_ID_SCR_PENDING_REQUEST_MAX , // 407 }; enum EVT_STATE_ID_SCR_CREATE_SHARED_WALLET { - EVT_STATE_ID_SCR_CREATE_SHARED_WALLET_MIN=EVT_STATE_ID_SCR_PENDING_REQUEST_MAX+1, // 397 - EVT_CREATE_SHARED_WALLET_REQUEST , // 398 - EVT_CANCEL_SHARED_WALLET_REQUEST , // 399 - EVT_CREATE_SHARED_WALLET_BACK , // 400 - EVT_CREATE_SHARED_WALLET_REQUEST_CONFIGURATION , // 401 - EVT_RECOVER_SHARED_WALLET_REQUEST , // 402 - EVT_STATE_ID_SCR_CREATE_SHARED_WALLET_MAX , // 403 + EVT_STATE_ID_SCR_CREATE_SHARED_WALLET_MIN=EVT_STATE_ID_SCR_PENDING_REQUEST_MAX+1, // 408 + EVT_CREATE_SHARED_WALLET_REQUEST , // 409 + EVT_CANCEL_SHARED_WALLET_REQUEST , // 410 + EVT_CREATE_SHARED_WALLET_BACK , // 411 + EVT_CREATE_SHARED_WALLET_REQUEST_CONFIGURATION , // 412 + EVT_RECOVER_SHARED_WALLET_REQUEST , // 413 + EVT_STATE_ID_SCR_CREATE_SHARED_WALLET_MAX , // 414 }; enum EVT_STATE_ID_SCR_CONFIGURE_SHARED_WALLET { - EVT_STATE_ID_SCR_CONFIGURE_SHARED_WALLET_MIN=EVT_STATE_ID_SCR_CREATE_SHARED_WALLET_MAX+1, // 404 - EVT_CONFIGURE_SHARED_WALLET_REQUEST , // 405 - EVT_CONFIGURE_SHARED_WALLET_BACK , // 406 - EVT_CONFIGURE_SHARED_WALLET_REVIEW_REQUEST , // 407 - EVT_STATE_ID_SCR_CONFIGURE_SHARED_WALLET_MAX , // 408 + EVT_STATE_ID_SCR_CONFIGURE_SHARED_WALLET_MIN=EVT_STATE_ID_SCR_CREATE_SHARED_WALLET_MAX+1, // 415 + EVT_CONFIGURE_SHARED_WALLET_REQUEST , // 416 + EVT_CONFIGURE_SHARED_WALLET_BACK , // 417 + EVT_CONFIGURE_SHARED_WALLET_REVIEW_REQUEST , // 418 + EVT_STATE_ID_SCR_CONFIGURE_SHARED_WALLET_MAX , // 419 }; enum EVT_STATE_ID_SCR_REVIEW_SHARED_WALLET { - EVT_STATE_ID_SCR_REVIEW_SHARED_WALLET_MIN=EVT_STATE_ID_SCR_CONFIGURE_SHARED_WALLET_MAX+1, // 409 - EVT_REVIEW_SHARED_WALLET_BACK , // 410 - EVT_REVIEW_SHARED_WALLET_INVITE_SIGNER , // 411 - EVT_STATE_ID_SCR_REVIEW_SHARED_WALLET_MAX , // 412 + EVT_STATE_ID_SCR_REVIEW_SHARED_WALLET_MIN=EVT_STATE_ID_SCR_CONFIGURE_SHARED_WALLET_MAX+1, // 420 + EVT_REVIEW_SHARED_WALLET_BACK , // 421 + EVT_REVIEW_SHARED_WALLET_INVITE_SIGNER , // 422 + EVT_STATE_ID_SCR_REVIEW_SHARED_WALLET_MAX , // 423 }; enum EVT_STATE_ID_SCR_ASSIGN_SIGNER_TO_SHARED_WALLET { - EVT_STATE_ID_SCR_ASSIGN_SIGNER_TO_SHARED_WALLET_MIN=EVT_STATE_ID_SCR_REVIEW_SHARED_WALLET_MAX+1, // 413 - EVT_ASSIGN_SIGNER_TO_SHARED_REQUEST , // 414 - EVT_ASSIGN_SIGNER_TO_SHARED_WALLET_BACK_REVIEW_WALLET , // 415 - EVT_ASSIGN_SIGNER_TO_SHARED_BACK_WALLET_CONFIG , // 416 - EVT_STATE_ID_SCR_ASSIGN_SIGNER_TO_SHARED_WALLET_MAX , // 417 + EVT_STATE_ID_SCR_ASSIGN_SIGNER_TO_SHARED_WALLET_MIN=EVT_STATE_ID_SCR_REVIEW_SHARED_WALLET_MAX+1, // 424 + EVT_ASSIGN_SIGNER_TO_SHARED_REQUEST , // 425 + EVT_ASSIGN_SIGNER_TO_SHARED_WALLET_BACK_REVIEW_WALLET , // 426 + EVT_ASSIGN_SIGNER_TO_SHARED_BACK_WALLET_CONFIG , // 427 + EVT_STATE_ID_SCR_ASSIGN_SIGNER_TO_SHARED_WALLET_MAX , // 428 }; enum EVT_STATE_ID_SCR_SHARED_WALLET_CONFIGURE { - EVT_STATE_ID_SCR_SHARED_WALLET_CONFIGURE_MIN=EVT_STATE_ID_SCR_ASSIGN_SIGNER_TO_SHARED_WALLET_MAX+1, // 418 - EVT_SHARED_WALLET_FINALIZE_WALLET , // 419 - EVT_SHARED_WALLET_CONFIGURE_CANCEL , // 420 - EVT_SHARED_WALLET_CONFIGURE_EXPORT_COLDCARD , // 421 - EVT_SHARED_WALLET_CONFIGURE_EXPORT_QRCODE , // 422 - EVT_SHARED_WALLET_CONFIGURE_DELETE_SWL , // 423 - EVT_SHARED_WALLET_CONFIGURE_EXPORT_BSMS , // 424 - EVT_SHARED_WALLET_CONFIGURE_BACK , // 425 - EVT_SHARED_WALLET_ADD_SIGNER_REQUEST , // 426 - EVT_SHARED_WALLET_UTXO_OUTPUT , // 427 - EVT_SHARED_WALLET_CHANGE_ADDRESS , // 428 - EVT_STATE_ID_SCR_SHARED_WALLET_CONFIGURE_MAX , // 429 + EVT_STATE_ID_SCR_SHARED_WALLET_CONFIGURE_MIN=EVT_STATE_ID_SCR_ASSIGN_SIGNER_TO_SHARED_WALLET_MAX+1, // 429 + EVT_SHARED_WALLET_FINALIZE_WALLET , // 430 + EVT_SHARED_WALLET_CONFIGURE_CANCEL , // 431 + EVT_SHARED_WALLET_CONFIGURE_EXPORT_COLDCARD , // 432 + EVT_SHARED_WALLET_CONFIGURE_EXPORT_QRCODE , // 433 + EVT_SHARED_WALLET_CONFIGURE_DELETE_SWL , // 434 + EVT_SHARED_WALLET_CONFIGURE_EXPORT_BSMS , // 435 + EVT_SHARED_WALLET_CONFIGURE_BACK , // 436 + EVT_SHARED_WALLET_ADD_SIGNER_REQUEST , // 437 + EVT_SHARED_WALLET_UTXO_OUTPUT , // 438 + EVT_SHARED_WALLET_CHANGE_ADDRESS , // 439 + EVT_STATE_ID_SCR_SHARED_WALLET_CONFIGURE_MAX , // 440 }; enum EVT_STATE_ID_SCR_BACKUP_SHARED_WALLET { - EVT_STATE_ID_SCR_BACKUP_SHARED_WALLET_MIN=EVT_STATE_ID_SCR_SHARED_WALLET_CONFIGURE_MAX+1, // 430 - EVT_BACKUP_SHARED_WALLET_REQUEST , // 431 - EVT_BACKUP_SHARED_WALLET_SKIP , // 432 - EVT_BACKUP_SHARED_WALLET_EXPORT_BSMS , // 433 - EVT_BACKUP_SHARED_WALLET_BACK , // 434 - EVT_BACKUP_WALLET_DEVICE_REGISTRATION , // 435 - EVT_STATE_ID_SCR_BACKUP_SHARED_WALLET_MAX , // 436 + EVT_STATE_ID_SCR_BACKUP_SHARED_WALLET_MIN=EVT_STATE_ID_SCR_SHARED_WALLET_CONFIGURE_MAX+1, // 441 + EVT_BACKUP_SHARED_WALLET_REQUEST , // 442 + EVT_BACKUP_SHARED_WALLET_SKIP , // 443 + EVT_BACKUP_SHARED_WALLET_EXPORT_BSMS , // 444 + EVT_BACKUP_SHARED_WALLET_BACK , // 445 + EVT_BACKUP_WALLET_DEVICE_REGISTRATION , // 446 + EVT_STATE_ID_SCR_BACKUP_SHARED_WALLET_MAX , // 447 }; enum EVT_STATE_ID_SCR_SHARED_WL_DEVICE_REGISTRATION { - EVT_STATE_ID_SCR_SHARED_WL_DEVICE_REGISTRATION_MIN=EVT_STATE_ID_SCR_BACKUP_SHARED_WALLET_MAX+1, // 437 - EVT_SHARED_WALLET_EXPORT_COLDCARD , // 438 - EVT_SHARED_WALLET_EXPORT_QRCODE , // 439 - EVT_SHARED_WALLET_SKIP_REGISTRATION , // 440 - EVT_SHARED_WL_DEVICE_REGISTRAION_BACK , // 441 - EVT_STATE_ID_SCR_SHARED_WL_DEVICE_REGISTRATION_MAX , // 442 + EVT_STATE_ID_SCR_SHARED_WL_DEVICE_REGISTRATION_MIN=EVT_STATE_ID_SCR_BACKUP_SHARED_WALLET_MAX+1, // 448 + EVT_SHARED_WALLET_EXPORT_COLDCARD , // 449 + EVT_SHARED_WALLET_EXPORT_QRCODE , // 450 + EVT_SHARED_WALLET_SKIP_REGISTRATION , // 451 + EVT_SHARED_WL_DEVICE_REGISTRAION_BACK , // 452 + EVT_STATE_ID_SCR_SHARED_WL_DEVICE_REGISTRATION_MAX , // 453 }; enum EVT_STATE_ID_SCR_STARTING_CREATE_SIGNER { - EVT_STATE_ID_SCR_STARTING_CREATE_SIGNER_MIN=EVT_STATE_ID_SCR_SHARED_WL_DEVICE_REGISTRATION_MAX+1, // 443 - EVT_STARTING_CREATE_SIGNER_DUMMY , // 444 - EVT_STARTING_CREATE_SIGNER_BACK , // 445 - EVT_ONLINE_MODE_ADD_NEW_SIGNER , // 446 - EVT_STATE_ID_SCR_STARTING_CREATE_SIGNER_MAX , // 447 + EVT_STATE_ID_SCR_STARTING_CREATE_SIGNER_MIN=EVT_STATE_ID_SCR_SHARED_WL_DEVICE_REGISTRATION_MAX+1, // 454 + EVT_STARTING_CREATE_SIGNER_DUMMY , // 455 + EVT_STARTING_CREATE_SIGNER_BACK , // 456 + EVT_ONLINE_MODE_ADD_NEW_SIGNER , // 457 + EVT_STATE_ID_SCR_STARTING_CREATE_SIGNER_MAX , // 458 }; enum EVT_STATE_ID_TOAST_MESSAGE_DISPLAY { - EVT_STATE_ID_TOAST_MESSAGE_DISPLAY_MIN=EVT_STATE_ID_SCR_STARTING_CREATE_SIGNER_MAX+1, // 448 - EVT_CLOSE_TOAST_MESSAGE , // 449 - EVT_STATE_ID_TOAST_MESSAGE_DISPLAY_MAX , // 450 + EVT_STATE_ID_TOAST_MESSAGE_DISPLAY_MIN=EVT_STATE_ID_SCR_STARTING_CREATE_SIGNER_MAX+1, // 459 + EVT_CLOSE_TOAST_MESSAGE , // 460 + EVT_STATE_ID_TOAST_MESSAGE_DISPLAY_MAX , // 461 }; enum EVT_STATE_ID_SCR_RECOVER_SHARED_WALLET { - EVT_STATE_ID_SCR_RECOVER_SHARED_WALLET_MIN=EVT_STATE_ID_TOAST_MESSAGE_DISPLAY_MAX+1, // 451 - EVT_IMPORT_BSMS_SHARED_WALLET , // 452 - EVT_IMPORT_QR_SHARED_WALLET , // 453 - EVT_IMPORT_SHARED_WALLET_SUCCEED , // 454 - EVT_RECOVER_SHARED_WALLET_BACK , // 455 - EVT_STATE_ID_SCR_RECOVER_SHARED_WALLET_MAX , // 456 + EVT_STATE_ID_SCR_RECOVER_SHARED_WALLET_MIN=EVT_STATE_ID_TOAST_MESSAGE_DISPLAY_MAX+1, // 462 + EVT_IMPORT_BSMS_SHARED_WALLET , // 463 + EVT_IMPORT_QR_SHARED_WALLET , // 464 + EVT_IMPORT_SHARED_WALLET_SUCCEED , // 465 + EVT_RECOVER_SHARED_WALLET_BACK , // 466 + EVT_STATE_ID_SCR_RECOVER_SHARED_WALLET_MAX , // 467 }; enum EVT_STATE_ID_SCR_PRIMARY_KEY_ACCOUNT { - EVT_STATE_ID_SCR_PRIMARY_KEY_ACCOUNT_MIN=EVT_STATE_ID_SCR_RECOVER_SHARED_WALLET_MAX+1, // 457 - EVT_SELECT_PRIMARY_KEY_ACCOUNT_REQUEST , // 458 - EVT_PRIMARY_KEY_BACK_TO_CREATE_ACCOUNT , // 459 - EVT_PRIMARY_KEY_ACCOUNT_BACK , // 460 - EVT_ADD_PRIMARY_KEY_REQUEST , // 461 - EVT_SHOW_SIGN_IN_BY_IMPORTING_THE_PRIMARY_KEY_REQUEST , // 462 - EVT_SCR_SIGN_IN_MANUALLY_REQUEST , // 463 - EVT_PRIMARY_KEY_BACK_TO_SIGN_IN , // 464 - EVT_STATE_ID_SCR_PRIMARY_KEY_ACCOUNT_MAX , // 465 + EVT_STATE_ID_SCR_PRIMARY_KEY_ACCOUNT_MIN=EVT_STATE_ID_SCR_RECOVER_SHARED_WALLET_MAX+1, // 468 + EVT_SELECT_PRIMARY_KEY_ACCOUNT_REQUEST , // 469 + EVT_PRIMARY_KEY_BACK_TO_CREATE_ACCOUNT , // 470 + EVT_PRIMARY_KEY_ACCOUNT_BACK , // 471 + EVT_ADD_PRIMARY_KEY_REQUEST , // 472 + EVT_SHOW_SIGN_IN_BY_IMPORTING_THE_PRIMARY_KEY_REQUEST , // 473 + EVT_SCR_SIGN_IN_MANUALLY_REQUEST , // 474 + EVT_PRIMARY_KEY_BACK_TO_SIGN_IN , // 475 + EVT_STATE_ID_SCR_PRIMARY_KEY_ACCOUNT_MAX , // 476 }; enum EVT_STATE_ID_SCR_CREATE_ACCOUNT { - EVT_STATE_ID_SCR_CREATE_ACCOUNT_MIN=EVT_STATE_ID_SCR_PRIMARY_KEY_ACCOUNT_MAX+1, // 466 - EVT_CREATE_ACCOUNT_REQUEST , // 467 - EVT_CREATE_PRIMARY_KEY_REQUEST , // 468 - EVT_CREATE_ACCOUNT_PRIMARY_KEY_REQUEST , // 469 - EVT_CHANGE_PASSWORD_SHOW_REQUEST , // 470 - EVT_STATE_ID_SCR_CREATE_ACCOUNT_MAX , // 471 + EVT_STATE_ID_SCR_CREATE_ACCOUNT_MIN=EVT_STATE_ID_SCR_PRIMARY_KEY_ACCOUNT_MAX+1, // 477 + EVT_CREATE_ACCOUNT_REQUEST , // 478 + EVT_CREATE_PRIMARY_KEY_REQUEST , // 479 + EVT_CREATE_ACCOUNT_PRIMARY_KEY_REQUEST , // 480 + EVT_CHANGE_PASSWORD_SHOW_REQUEST , // 481 + EVT_STATE_ID_SCR_CREATE_ACCOUNT_MAX , // 482 }; enum EVT_STATE_ID_SCR_CHANGE_PASSWORD { - EVT_STATE_ID_SCR_CHANGE_PASSWORD_MIN=EVT_STATE_ID_SCR_CREATE_ACCOUNT_MAX+1, // 472 - EVT_CHANGE_PASSWORD_REQUEST , // 473 - EVT_CHANGE_PASSWORD_BACK , // 474 - EVT_CHANGE_PASSWORD_SUCCESS , // 475 - EVT_STATE_ID_SCR_CHANGE_PASSWORD_MAX , // 476 + EVT_STATE_ID_SCR_CHANGE_PASSWORD_MIN=EVT_STATE_ID_SCR_CREATE_ACCOUNT_MAX+1, // 483 + EVT_CHANGE_PASSWORD_REQUEST , // 484 + EVT_CHANGE_PASSWORD_BACK , // 485 + EVT_CHANGE_PASSWORD_SUCCESS , // 486 + EVT_STATE_ID_SCR_CHANGE_PASSWORD_MAX , // 487 }; enum EVT_STATE_ID_SCR_SIGN_IN_BY_IMPORTING_THE_PRIMARY_KEY { - EVT_STATE_ID_SCR_SIGN_IN_BY_IMPORTING_THE_PRIMARY_KEY_MIN=EVT_STATE_ID_SCR_CHANGE_PASSWORD_MAX+1, // 477 - EVT_PRIMARY_KEY_ENTER_PASSPHRASE_REQUEST , // 478 - EVT_PRIMARY_KEY_ENTER_PASSPHRASE_SIGN_IN_REQUEST , // 479 - EVT_IMPORT_PRIMARY_KEY_WITH_SEED_REQUEST , // 480 - EVT_PRIMARY_KEY_ENTER_PASSPHRASE_SUCCEED , // 481 - EVT_SIGN_IN_BY_IMPORTING_THE_PRIMARY_KEY_BACK , // 482 - EVT_STATE_ID_SCR_SIGN_IN_BY_IMPORTING_THE_PRIMARY_KEY_MAX , // 483 + EVT_STATE_ID_SCR_SIGN_IN_BY_IMPORTING_THE_PRIMARY_KEY_MIN=EVT_STATE_ID_SCR_CHANGE_PASSWORD_MAX+1, // 488 + EVT_PRIMARY_KEY_ENTER_PASSPHRASE_REQUEST , // 489 + EVT_PRIMARY_KEY_ENTER_PASSPHRASE_SIGN_IN_REQUEST , // 490 + EVT_IMPORT_PRIMARY_KEY_WITH_SEED_REQUEST , // 491 + EVT_PRIMARY_KEY_ENTER_PASSPHRASE_SUCCEED , // 492 + EVT_SIGN_IN_BY_IMPORTING_THE_PRIMARY_KEY_BACK , // 493 + EVT_STATE_ID_SCR_SIGN_IN_BY_IMPORTING_THE_PRIMARY_KEY_MAX , // 494 }; enum EVT_STATE_ID_SCR_SIGN_IN_MANUALLY { - EVT_STATE_ID_SCR_SIGN_IN_MANUALLY_MIN=EVT_STATE_ID_SCR_SIGN_IN_BY_IMPORTING_THE_PRIMARY_KEY_MAX+1, // 484 - EVT_ADD_PRIMARY_KEY_ACCOUNT_REQUEST , // 485 - EVT_PRIMARY_KEY_CHECK_USERNAME_REQUEST , // 486 - EVT_CHALLENGE_MESSAGE_REFRESH_REQUEST , // 487 - EVT_ADD_PRIMARY_KEY_ACCOUNT_SUCCEED , // 488 - EVT_STATE_ID_SCR_SIGN_IN_MANUALLY_MAX , // 489 + EVT_STATE_ID_SCR_SIGN_IN_MANUALLY_MIN=EVT_STATE_ID_SCR_SIGN_IN_BY_IMPORTING_THE_PRIMARY_KEY_MAX+1, // 495 + EVT_ADD_PRIMARY_KEY_ACCOUNT_REQUEST , // 496 + EVT_PRIMARY_KEY_CHECK_USERNAME_REQUEST , // 497 + EVT_CHALLENGE_MESSAGE_REFRESH_REQUEST , // 498 + EVT_ADD_PRIMARY_KEY_ACCOUNT_SUCCEED , // 499 + EVT_STATE_ID_SCR_SIGN_IN_MANUALLY_MAX , // 500 }; enum EVT_STATE_ID_SCR_LOGIN_WITH_SOFTWARE_KEY { - EVT_STATE_ID_SCR_LOGIN_WITH_SOFTWARE_KEY_MIN=EVT_STATE_ID_SCR_SIGN_IN_MANUALLY_MAX+1, // 490 - EVT_PRIMARY_KEY_SIGNIN_ACCOUNT_REQUEST , // 491 - EVT_LOGIN_WITH_SOFTWARE_KEY_BACK , // 492 - EVT_LOGIN_WITH_SOFTWARE_KEY_SUCCEED , // 493 - EVT_STATE_ID_SCR_LOGIN_WITH_SOFTWARE_KEY_MAX , // 494 + EVT_STATE_ID_SCR_LOGIN_WITH_SOFTWARE_KEY_MIN=EVT_STATE_ID_SCR_SIGN_IN_MANUALLY_MAX+1, // 501 + EVT_PRIMARY_KEY_SIGNIN_ACCOUNT_REQUEST , // 502 + EVT_LOGIN_WITH_SOFTWARE_KEY_BACK , // 503 + EVT_LOGIN_WITH_SOFTWARE_KEY_SUCCEED , // 504 + EVT_STATE_ID_SCR_LOGIN_WITH_SOFTWARE_KEY_MAX , // 505 }; enum EVT_STATE_ID_SCR_REPLACE_PRIMARY_KEY { - EVT_STATE_ID_SCR_REPLACE_PRIMARY_KEY_MIN=EVT_STATE_ID_SCR_LOGIN_WITH_SOFTWARE_KEY_MAX+1, // 495 - EVT_REPLACE_PRIMARY_KEY_REQUEST , // 496 - EVT_STATE_ID_SCR_REPLACE_PRIMARY_KEY_MAX , // 497 + EVT_STATE_ID_SCR_REPLACE_PRIMARY_KEY_MIN=EVT_STATE_ID_SCR_LOGIN_WITH_SOFTWARE_KEY_MAX+1, // 506 + EVT_REPLACE_PRIMARY_KEY_REQUEST , // 507 + EVT_STATE_ID_SCR_REPLACE_PRIMARY_KEY_MAX , // 508 }; enum EVT_STATE_ID_SCR_PRIMARY_KEY_CONFIGURATION { - EVT_STATE_ID_SCR_PRIMARY_KEY_CONFIGURATION_MIN=EVT_STATE_ID_SCR_REPLACE_PRIMARY_KEY_MAX+1, // 498 - EVT_PRIMARY_KEY_SIGN_IN_REQUEST , // 499 - EVT_PRIMARY_KEY_SIGN_IN_SUCCEED , // 500 - EVT_PRIMARY_KEY_CONFIGURATION_BACK , // 501 - EVT_PRIMARY_KEY_CONFIGURATION_FINISHED , // 502 - EVT_STATE_ID_SCR_PRIMARY_KEY_CONFIGURATION_MAX , // 503 + EVT_STATE_ID_SCR_PRIMARY_KEY_CONFIGURATION_MIN=EVT_STATE_ID_SCR_REPLACE_PRIMARY_KEY_MAX+1, // 509 + EVT_PRIMARY_KEY_SIGN_IN_REQUEST , // 510 + EVT_PRIMARY_KEY_SIGN_IN_SUCCEED , // 511 + EVT_PRIMARY_KEY_CONFIGURATION_BACK , // 512 + EVT_PRIMARY_KEY_CONFIGURATION_FINISHED , // 513 + EVT_STATE_ID_SCR_PRIMARY_KEY_CONFIGURATION_MAX , // 514 }; enum EVT_STATE_ID_SCR_SIGN_IN { - EVT_STATE_ID_SCR_SIGN_IN_MIN=EVT_STATE_ID_SCR_PRIMARY_KEY_CONFIGURATION_MAX+1, // 504 - EVT_SIGN_IN_PASSWORD_REQUEST , // 505 - EVT_SIGN_IN_PRIMARY_KEY_REQUEST , // 506 - EVT_SHOW_SIGN_IN_PRIMARY_KEY_REQUEST , // 507 - EVT_STATE_ID_SCR_SIGN_IN_MAX , // 508 + EVT_STATE_ID_SCR_SIGN_IN_MIN=EVT_STATE_ID_SCR_PRIMARY_KEY_CONFIGURATION_MAX+1, // 515 + EVT_SIGN_IN_PASSWORD_REQUEST , // 516 + EVT_SIGN_IN_PRIMARY_KEY_REQUEST , // 517 + EVT_SHOW_SIGN_IN_PRIMARY_KEY_REQUEST , // 518 + EVT_STATE_ID_SCR_SIGN_IN_MAX , // 519 }; enum EVT_STATE_ID_SCR_UPDATE_PROFILE { - EVT_STATE_ID_SCR_UPDATE_PROFILE_MIN=EVT_STATE_ID_SCR_SIGN_IN_MAX+1, // 509 - EVT_UPDATE_PROFILE_REQUEST , // 510 - EVT_UPDATE_PROFILE_BACK , // 511 - EVT_STATE_ID_SCR_UPDATE_PROFILE_MAX , // 512 + EVT_STATE_ID_SCR_UPDATE_PROFILE_MIN=EVT_STATE_ID_SCR_SIGN_IN_MAX+1, // 520 + EVT_UPDATE_PROFILE_REQUEST , // 521 + EVT_UPDATE_PROFILE_BACK , // 522 + EVT_STATE_ID_SCR_UPDATE_PROFILE_MAX , // 523 }; enum EVT_STATE_ID_SCR_TAPSIGNER_RECOVERED_SUCCESS { - EVT_STATE_ID_SCR_TAPSIGNER_RECOVERED_SUCCESS_MIN=EVT_STATE_ID_SCR_UPDATE_PROFILE_MAX+1, // 513 - EVT_TAPSIGNER_RECOVERED_KEY_INFO_REQUEST , // 514 - EVT_STATE_ID_SCR_TAPSIGNER_RECOVERED_SUCCESS_MAX , // 515 + EVT_STATE_ID_SCR_TAPSIGNER_RECOVERED_SUCCESS_MIN=EVT_STATE_ID_SCR_UPDATE_PROFILE_MAX+1, // 524 + EVT_TAPSIGNER_RECOVERED_KEY_INFO_REQUEST , // 525 + EVT_STATE_ID_SCR_TAPSIGNER_RECOVERED_SUCCESS_MAX , // 526 }; enum EVT_STATE_ID_SCR_ENTER_BACKUP_PASSWORD { - EVT_STATE_ID_SCR_ENTER_BACKUP_PASSWORD_MIN=EVT_STATE_ID_SCR_TAPSIGNER_RECOVERED_SUCCESS_MAX+1, // 516 - EVT_INPUT_BACKUP_PASSWORD_REQUEST , // 517 - EVT_ENTER_BACKUP_PASSWORD_BACK , // 518 - EVT_TAPSIGNER_RECOVERED_SUCCESS_REQUEST , // 519 - EVT_STATE_ID_SCR_ENTER_BACKUP_PASSWORD_MAX , // 520 + EVT_STATE_ID_SCR_ENTER_BACKUP_PASSWORD_MIN=EVT_STATE_ID_SCR_TAPSIGNER_RECOVERED_SUCCESS_MAX+1, // 527 + EVT_INPUT_BACKUP_PASSWORD_REQUEST , // 528 + EVT_ENTER_BACKUP_PASSWORD_BACK , // 529 + EVT_TAPSIGNER_RECOVERED_SUCCESS_REQUEST , // 530 + EVT_STATE_ID_SCR_ENTER_BACKUP_PASSWORD_MAX , // 531 }; enum EVT_STATE_ID_SCR_KEY_RECOVERY_ANSER_SECURITY_QUESTION { - EVT_STATE_ID_SCR_KEY_RECOVERY_ANSER_SECURITY_QUESTION_MIN=EVT_STATE_ID_SCR_ENTER_BACKUP_PASSWORD_MAX+1, // 521 - EVT_INPUT_KEY_RECOVERY_ANSER_REQUEST , // 522 - EVT_ANSER_SECURITY_QUESTION_BACK , // 523 - EVT_ENTER_BACKUP_PASSWORD_RERQUEST , // 524 - EVT_STATE_ID_SCR_KEY_RECOVERY_ANSER_SECURITY_QUESTION_MAX , // 525 + EVT_STATE_ID_SCR_KEY_RECOVERY_ANSER_SECURITY_QUESTION_MIN=EVT_STATE_ID_SCR_ENTER_BACKUP_PASSWORD_MAX+1, // 532 + EVT_INPUT_KEY_RECOVERY_ANSER_REQUEST , // 533 + EVT_ANSER_SECURITY_QUESTION_BACK , // 534 + EVT_ENTER_BACKUP_PASSWORD_RERQUEST , // 535 + EVT_STATE_ID_SCR_KEY_RECOVERY_ANSER_SECURITY_QUESTION_MAX , // 536 }; enum EVT_STATE_ID_SCR_KEY_RECOVERY { - EVT_STATE_ID_SCR_KEY_RECOVERY_MIN=EVT_STATE_ID_SCR_KEY_RECOVERY_ANSER_SECURITY_QUESTION_MAX+1, // 526 - EVT_INPUT_TAPSIGNER_SELECT_REQUEST , // 527 - EVT_ANSER_SECURITY_QUESTION_REQUEST , // 528 - EVT_STATE_ID_SCR_KEY_RECOVERY_MAX , // 529 + EVT_STATE_ID_SCR_KEY_RECOVERY_MIN=EVT_STATE_ID_SCR_KEY_RECOVERY_ANSER_SECURITY_QUESTION_MAX+1, // 537 + EVT_INPUT_TAPSIGNER_SELECT_REQUEST , // 538 + EVT_ANSER_SECURITY_QUESTION_REQUEST , // 539 + EVT_STATE_ID_SCR_KEY_RECOVERY_MAX , // 540 }; enum EVT_STATE_ID_SCR_REENTER_YOUR_PASSWORD { - EVT_STATE_ID_SCR_REENTER_YOUR_PASSWORD_MIN=EVT_STATE_ID_SCR_KEY_RECOVERY_MAX+1, // 530 - EVT_INPUT_PASSWORD_REQUEST , // 531 - EVT_REENTER_YOUR_PASSWORD_BACK , // 532 - EVT_KEY_RECOVERY_REQUEST , // 533 - EVT_SELECT_YOUR_LOCKDOWN_PERIOD_REQUEST , // 534 - EVT_WALLET_CO_SIGN_POLICE_REQUEST , // 535 - EVT_STATE_ID_SCR_REENTER_YOUR_PASSWORD_MAX , // 536 + EVT_STATE_ID_SCR_REENTER_YOUR_PASSWORD_MIN=EVT_STATE_ID_SCR_KEY_RECOVERY_MAX+1, // 541 + EVT_INPUT_PASSWORD_REQUEST , // 542 + EVT_REENTER_YOUR_PASSWORD_BACK , // 543 + EVT_KEY_RECOVERY_REQUEST , // 544 + EVT_SELECT_YOUR_LOCKDOWN_PERIOD_REQUEST , // 545 + EVT_WALLET_CO_SIGN_POLICE_REQUEST , // 546 + EVT_STATE_ID_SCR_REENTER_YOUR_PASSWORD_MAX , // 547 }; enum EVT_STATE_ID_SCR_SERVICE_SETTINGS { - EVT_STATE_ID_SCR_SERVICE_SETTINGS_MIN=EVT_STATE_ID_SCR_REENTER_YOUR_PASSWORD_MAX+1, // 537 - EVT_CLAIM_INHERITANCE_CHECK_REQUEST , // 538 - EVT_CO_SIGNING_SERVER_KEY_UPDATE_REQUEST , // 539 - EVT_CO_SIGNING_SERVER_KEY_UPDATE_SUCCEED , // 540 - EVT_REENTER_YOUR_PASSWORD_REQUEST , // 541 - EVT_SERVICE_SUPPORT_REQUEST , // 542 - EVT_INHERITANCE_WITHDRAW_BALANCE_REQUEST , // 543 - EVT_STATE_ID_SCR_SERVICE_SETTINGS_MAX , // 544 + EVT_STATE_ID_SCR_SERVICE_SETTINGS_MIN=EVT_STATE_ID_SCR_REENTER_YOUR_PASSWORD_MAX+1, // 548 + EVT_CLAIM_INHERITANCE_CHECK_REQUEST , // 549 + EVT_CO_SIGNING_SERVER_KEY_UPDATE_REQUEST , // 550 + EVT_CO_SIGNING_SERVER_KEY_UPDATE_SUCCEED , // 551 + EVT_SERVICE_SELECT_WALLET_REQUEST , // 552 + EVT_INHERITANCE_PLAN_FINALIZE_REQUEST , // 553 + EVT_REENTER_YOUR_PASSWORD_REQUEST , // 554 + EVT_SERVICE_SUPPORT_REQUEST , // 555 + EVT_INHERITANCE_WITHDRAW_BALANCE_REQUEST , // 556 + EVT_EDIT_YOUR_INHERITANCE_PLAN_REQUEST , // 557 + EVT_SHARE_YOUR_SECRET_REQUEST , // 558 + EVT_STATE_ID_SCR_SERVICE_SETTINGS_MAX , // 559 }; enum EVT_STATE_ID_SCR_SELECT_YOUR_LOCKDOWN_PERIOD { - EVT_STATE_ID_SCR_SELECT_YOUR_LOCKDOWN_PERIOD_MIN=EVT_STATE_ID_SCR_SERVICE_SETTINGS_MAX+1, // 545 - EVT_INPUT_DAYS_VALUE_REQUEST , // 546 - EVT_LOCKDOWN_ANSER_SECURITY_QUESTION_REQUEST , // 547 - EVT_DUMMY_TRANSACTION_INFO_REQUEST , // 548 - EVT_STATE_ID_SCR_SELECT_YOUR_LOCKDOWN_PERIOD_MAX , // 549 + EVT_STATE_ID_SCR_SELECT_YOUR_LOCKDOWN_PERIOD_MIN=EVT_STATE_ID_SCR_SERVICE_SETTINGS_MAX+1, // 560 + EVT_INPUT_DAYS_VALUE_REQUEST , // 561 + EVT_LOCKDOWN_ANSER_SECURITY_QUESTION_REQUEST , // 562 + EVT_DUMMY_TRANSACTION_INFO_REQUEST , // 563 + EVT_STATE_ID_SCR_SELECT_YOUR_LOCKDOWN_PERIOD_MAX , // 564 }; enum EVT_STATE_ID_SCR_LOCKDOWN_ANSER_SECURITY_QUESTION { - EVT_STATE_ID_SCR_LOCKDOWN_ANSER_SECURITY_QUESTION_MIN=EVT_STATE_ID_SCR_SELECT_YOUR_LOCKDOWN_PERIOD_MAX+1, // 550 - EVT_INPUT_LOCKDOWN_ANSER_REQUEST , // 551 - EVT_LOCKDOWN_ANSER_SECURITY_QUESTION_BACK , // 552 - SCR_LOCKDOWN_SUCCESS_REQUEST , // 553 - EVT_STATE_ID_SCR_LOCKDOWN_ANSER_SECURITY_QUESTION_MAX , // 554 + EVT_STATE_ID_SCR_LOCKDOWN_ANSER_SECURITY_QUESTION_MIN=EVT_STATE_ID_SCR_SELECT_YOUR_LOCKDOWN_PERIOD_MAX+1, // 565 + EVT_INPUT_LOCKDOWN_ANSER_REQUEST , // 566 + EVT_LOCKDOWN_ANSER_SECURITY_QUESTION_BACK , // 567 + SCR_LOCKDOWN_SUCCESS_REQUEST , // 568 + EVT_STATE_ID_SCR_LOCKDOWN_ANSER_SECURITY_QUESTION_MAX , // 569 }; enum EVT_STATE_ID_SCR_LOCKDOWN_SUCCESS { - EVT_STATE_ID_SCR_LOCKDOWN_SUCCESS_MIN=EVT_STATE_ID_SCR_LOCKDOWN_ANSER_SECURITY_QUESTION_MAX+1, // 555 - EVT_LOCKDOWN_SUCCESS_CLOSE_REQUEST , // 556 - EVT_STATE_ID_SCR_LOCKDOWN_SUCCESS_MAX , // 557 + EVT_STATE_ID_SCR_LOCKDOWN_SUCCESS_MIN=EVT_STATE_ID_SCR_LOCKDOWN_ANSER_SECURITY_QUESTION_MAX+1, // 570 + EVT_LOCKDOWN_SUCCESS_CLOSE_REQUEST , // 571 + EVT_STATE_ID_SCR_LOCKDOWN_SUCCESS_MAX , // 572 }; enum EVT_STATE_ID_SCR_DUMMY_TRANSACTION_INFO { - EVT_STATE_ID_SCR_DUMMY_TRANSACTION_INFO_MIN=EVT_STATE_ID_SCR_LOCKDOWN_SUCCESS_MAX+1, // 558 - EVT_DUMMY_TRANSACTION_SIGN_REQUEST , // 559 - EVT_DUMMY_TRANSACTION_SIGN_CONFIRM_REQUEST , // 560 - EVT_DUMMY_TRANSACTION_VERIFY_ADDRESS , // 561 - EVT_DUMMY_TRANSACTION_SET_MEMO_REQUEST , // 562 - EVT_DUMMY_TRANSACTION_SCAN_DEVICE_REQUEST , // 563 - EVT_DUMMY_TRANSACTION_INFO_BACK , // 564 - EVT_DUMMY_TRANSACTION_LOCKDOWN_SUCCEEDED_REQUEST , // 565 - EVT_STATE_ID_SCR_DUMMY_TRANSACTION_INFO_MAX , // 566 + EVT_STATE_ID_SCR_DUMMY_TRANSACTION_INFO_MIN=EVT_STATE_ID_SCR_LOCKDOWN_SUCCESS_MAX+1, // 573 + EVT_DUMMY_TRANSACTION_SIGN_REQUEST , // 574 + EVT_DUMMY_TRANSACTION_SIGN_CONFIRM_REQUEST , // 575 + EVT_DUMMY_TRANSACTION_VERIFY_ADDRESS , // 576 + EVT_DUMMY_TRANSACTION_SET_MEMO_REQUEST , // 577 + EVT_DUMMY_TRANSACTION_SCAN_DEVICE_REQUEST , // 578 + EVT_DUMMY_TRANSACTION_INFO_BACK , // 579 + EVT_DUMMY_TRANSACTION_LOCKDOWN_SUCCEEDED_REQUEST , // 580 + EVT_STATE_ID_SCR_DUMMY_TRANSACTION_INFO_MAX , // 581 }; enum EVT_STATE_ID_SCR_INHERITANCE_CONFIRM_TRANSACTION { - EVT_STATE_ID_SCR_INHERITANCE_CONFIRM_TRANSACTION_MIN=EVT_STATE_ID_SCR_DUMMY_TRANSACTION_INFO_MAX+1, // 567 - EVT_INHERITANCE_CREATE_DRAFT_TX_FEE_REQ , // 568 - EVT_INHERITANCE_TRANSACTION_DETAILS_REQUEST , // 569 - EVT_INHERITANCE_CONFIRM_TRANSACTION_BACK , // 570 - EVT_STATE_ID_SCR_INHERITANCE_CONFIRM_TRANSACTION_MAX , // 571 + EVT_STATE_ID_SCR_INHERITANCE_CONFIRM_TRANSACTION_MIN=EVT_STATE_ID_SCR_DUMMY_TRANSACTION_INFO_MAX+1, // 582 + EVT_INHERITANCE_CREATE_DRAFT_TX_FEE_REQ , // 583 + EVT_INHERITANCE_TRANSACTION_DETAILS_REQUEST , // 584 + EVT_INHERITANCE_CONFIRM_TRANSACTION_BACK , // 585 + EVT_STATE_ID_SCR_INHERITANCE_CONFIRM_TRANSACTION_MAX , // 586 }; enum EVT_STATE_ID_SCR_INHERITANCE_TRANSACTION_DETAILS { - EVT_STATE_ID_SCR_INHERITANCE_TRANSACTION_DETAILS_MIN=EVT_STATE_ID_SCR_INHERITANCE_CONFIRM_TRANSACTION_MAX+1, // 572 - EVT_INHERITANCE_TRANSACTION_DETAILS_BACK , // 573 - EVT_STATE_ID_SCR_INHERITANCE_TRANSACTION_DETAILS_MAX , // 574 + EVT_STATE_ID_SCR_INHERITANCE_TRANSACTION_DETAILS_MIN=EVT_STATE_ID_SCR_INHERITANCE_CONFIRM_TRANSACTION_MAX+1, // 587 + EVT_INHERITANCE_TRANSACTION_DETAILS_BACK , // 588 + EVT_STATE_ID_SCR_INHERITANCE_TRANSACTION_DETAILS_MAX , // 589 }; enum EVT_STATE_ID_SCR_INHERITANCE_WITHDRAW_BALANCE { - EVT_STATE_ID_SCR_INHERITANCE_WITHDRAW_BALANCE_MIN=EVT_STATE_ID_SCR_INHERITANCE_TRANSACTION_DETAILS_MAX+1, // 575 - EVT_INHERITANCE_CREATE_DRAFT_TX_REQUEST , // 576 - EVT_INHERITANCE_NEW_TRANSACTION_REQ , // 577 - EVT_INHERITANCE_WITHDRAW_BALANCE_BACK , // 578 - EVT_INHERITANCE_CONFIRM_TRANSACTION_REQUEST , // 579 - EVT_STATE_ID_SCR_INHERITANCE_WITHDRAW_BALANCE_MAX , // 580 + EVT_STATE_ID_SCR_INHERITANCE_WITHDRAW_BALANCE_MIN=EVT_STATE_ID_SCR_INHERITANCE_TRANSACTION_DETAILS_MAX+1, // 590 + EVT_INHERITANCE_CREATE_DRAFT_TX_REQUEST , // 591 + EVT_INHERITANCE_NEW_TRANSACTION_REQ , // 592 + EVT_INHERITANCE_WITHDRAW_BALANCE_BACK , // 593 + EVT_INHERITANCE_CONFIRM_TRANSACTION_REQUEST , // 594 + EVT_STATE_ID_SCR_INHERITANCE_WITHDRAW_BALANCE_MAX , // 595 }; enum EVT_STATE_ID_SCR_ADD_LEDGER_ASK { - EVT_STATE_ID_SCR_ADD_LEDGER_ASK_MIN=EVT_STATE_ID_SCR_INHERITANCE_WITHDRAW_BALANCE_MAX+1, // 581 - EVT_ADD_LEDGER_REQUEST , // 582 - EVT_STATE_ID_SCR_ADD_LEDGER_ASK_MAX , // 583 + EVT_STATE_ID_SCR_ADD_LEDGER_ASK_MIN=EVT_STATE_ID_SCR_INHERITANCE_WITHDRAW_BALANCE_MAX+1, // 596 + EVT_ADD_LEDGER_REQUEST , // 597 + EVT_STATE_ID_SCR_ADD_LEDGER_ASK_MAX , // 598 }; enum EVT_STATE_ID_SCR_ADD_TREZOR_ASK { - EVT_STATE_ID_SCR_ADD_TREZOR_ASK_MIN=EVT_STATE_ID_SCR_ADD_LEDGER_ASK_MAX+1, // 584 - EVT_ADD_TREZOR_REQUEST , // 585 - EVT_STATE_ID_SCR_ADD_TREZOR_ASK_MAX , // 586 + EVT_STATE_ID_SCR_ADD_TREZOR_ASK_MIN=EVT_STATE_ID_SCR_ADD_LEDGER_ASK_MAX+1, // 599 + EVT_ADD_TREZOR_REQUEST , // 600 + EVT_STATE_ID_SCR_ADD_TREZOR_ASK_MAX , // 601 }; enum EVT_STATE_ID_SCR_ADD_LEDGER { - EVT_STATE_ID_SCR_ADD_LEDGER_MIN=EVT_STATE_ID_SCR_ADD_TREZOR_ASK_MAX+1, // 587 - EVT_SCAN_LEDGER_DEVICE_REQUEST , // 588 - EVT_ADD_LEDGER_DEVICE_REQUEST , // 589 - EVT_STATE_ID_SCR_ADD_LEDGER_MAX , // 590 + EVT_STATE_ID_SCR_ADD_LEDGER_MIN=EVT_STATE_ID_SCR_ADD_TREZOR_ASK_MAX+1, // 602 + EVT_SCAN_LEDGER_DEVICE_REQUEST , // 603 + EVT_ADD_LEDGER_DEVICE_REQUEST , // 604 + EVT_STATE_ID_SCR_ADD_LEDGER_MAX , // 605 }; enum EVT_STATE_ID_SCR_ADD_TREZOR { - EVT_STATE_ID_SCR_ADD_TREZOR_MIN=EVT_STATE_ID_SCR_ADD_LEDGER_MAX+1, // 591 - EVT_SCAN_TREZOR_DEVICE_REQUEST , // 592 - EVT_ADD_TREZOR_DEVICE_REQUEST , // 593 - EVT_STATE_ID_SCR_ADD_TREZOR_MAX , // 594 + EVT_STATE_ID_SCR_ADD_TREZOR_MIN=EVT_STATE_ID_SCR_ADD_LEDGER_MAX+1, // 606 + EVT_SCAN_TREZOR_DEVICE_REQUEST , // 607 + EVT_ADD_TREZOR_DEVICE_REQUEST , // 608 + EVT_STATE_ID_SCR_ADD_TREZOR_MAX , // 609 }; enum EVT_STATE_ID_SCR_SELECT_WALLET_CO_SIGN_POLICE { - EVT_STATE_ID_SCR_SELECT_WALLET_CO_SIGN_POLICE_MIN=EVT_STATE_ID_SCR_ADD_TREZOR_MAX+1, // 595 - EVT_SELECT_WALLET_REQUEST , // 596 - EVT_STATE_ID_SCR_SELECT_WALLET_CO_SIGN_POLICE_MAX , // 597 + EVT_STATE_ID_SCR_SELECT_WALLET_CO_SIGN_POLICE_MIN=EVT_STATE_ID_SCR_ADD_TREZOR_MAX+1, // 610 + EVT_SELECT_WALLET_REQUEST , // 611 + EVT_STATE_ID_SCR_SELECT_WALLET_CO_SIGN_POLICE_MAX , // 612 + }; + enum EVT_STATE_ID_SCR_EDIT_YOUR_INHERITANCE_PLAN + { + EVT_STATE_ID_SCR_EDIT_YOUR_INHERITANCE_PLAN_MIN=EVT_STATE_ID_SCR_SELECT_WALLET_CO_SIGN_POLICE_MAX+1, // 613 + EVT_UPDATE_ACTIVATION_DATE_REQUEST , // 614 + EVT_UPDATE_MESSAGE_REQUEST , // 615 + EVT_UPDATE_BUFFER_PERIOD_REQUEST , // 616 + EVT_UPDATE_NOTIFICATION_PREFERENCE_REQ , // 617 + EVT_NOT_UPDATE_ANY_NOTI_REQ , // 618 + EVT_STATE_ID_SCR_EDIT_YOUR_INHERITANCE_PLAN_MAX , // 619 + }; + enum EVT_STATE_ID_SCR_SHARE_YOUR_SECRETS + { + EVT_STATE_ID_SCR_SHARE_YOUR_SECRETS_MIN=EVT_STATE_ID_SCR_EDIT_YOUR_INHERITANCE_PLAN_MAX+1, // 620 + EVT_UPDATE_YOUR_SECRET_REQUEST , // 621 + EVT_STATE_ID_SCR_SHARE_YOUR_SECRETS_MAX , // 622 + }; + enum EVT_STATE_ID_SCR_ADD_COLDCARD_ASK + { + EVT_STATE_ID_SCR_ADD_COLDCARD_ASK_MIN=EVT_STATE_ID_SCR_SHARE_YOUR_SECRETS_MAX+1, // 623 + EVT_ADD_COLDCARD_REQUEST , // 624 + EVT_STATE_ID_SCR_ADD_COLDCARD_ASK_MAX , // 625 + }; + enum EVT_STATE_ID_SCR_ADD_COLDCARD + { + EVT_STATE_ID_SCR_ADD_COLDCARD_MIN=EVT_STATE_ID_SCR_ADD_COLDCARD_ASK_MAX+1, // 626 + EVT_SCAN_COLDCARD_DEVICE_REQUEST , // 627 + EVT_ADD_COLDCARD_DEVICE_REQUEST , // 628 + EVT_STATE_ID_SCR_ADD_COLDCARD_MAX , // 629 + }; + enum EVT_STATE_ID_SCR_ADD_LEDGER_EXIST + { + EVT_STATE_ID_SCR_ADD_LEDGER_EXIST_MIN=EVT_STATE_ID_SCR_ADD_COLDCARD_MAX+1, // 630 + EVT_ADD_EXIST_LEDGER_REQUEST , // 631 + EVT_ADD_NEW_LEDGER_REQUEST , // 632 + EVT_STATE_ID_SCR_ADD_LEDGER_EXIST_MAX , // 633 + }; + enum EVT_STATE_ID_SCR_ADD_TREZOR_EXIST + { + EVT_STATE_ID_SCR_ADD_TREZOR_EXIST_MIN=EVT_STATE_ID_SCR_ADD_LEDGER_EXIST_MAX+1, // 634 + EVT_ADD_EXIST_TREZOR_REQUEST , // 635 + EVT_ADD_NEW_TREZOR_REQUEST , // 636 + EVT_STATE_ID_SCR_ADD_TREZOR_EXIST_MAX , // 637 + }; + enum EVT_STATE_ID_SCR_ADD_COLDCARD_EXIST + { + EVT_STATE_ID_SCR_ADD_COLDCARD_EXIST_MIN=EVT_STATE_ID_SCR_ADD_TREZOR_EXIST_MAX+1, // 638 + EVT_ADD_EXIST_COLDCARD_REQUEST , // 639 + EVT_ADD_NEW_COLDCARD_REQUEST , // 640 + EVT_STATE_ID_SCR_ADD_COLDCARD_EXIST_MAX , // 641 }; }; diff --git a/Views/Diagram/NunchuckDiagram.asta b/Views/Diagram/NunchuckDiagram.asta index d0dc48f3..5dd54d0d 100644 Binary files a/Views/Diagram/NunchuckDiagram.asta and b/Views/Diagram/NunchuckDiagram.asta differ diff --git a/Views/Diagram/NunchuckDiagram.xml b/Views/Diagram/NunchuckDiagram.xml index c45e9104..2458c19a 100644 --- a/Views/Diagram/NunchuckDiagram.xml +++ b/Views/Diagram/NunchuckDiagram.xml @@ -356,8 +356,12 @@ - + + + + + @@ -4442,19 +4446,25 @@ - + + + + + - + + + @@ -4508,6 +4518,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -4796,16 +4834,16 @@ - + - + @@ -4893,6 +4931,7 @@ + @@ -4943,6 +4982,7 @@ + @@ -5018,6 +5058,317 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -8179,32 +8530,202 @@ - - - - - - - - - - - - - - - - - -8201.806766957703 - -1973.8221633573712 - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -8201.806766957703 + -1973.8221633573712 + + + + + + + + @@ -8234,8 +8755,12 @@ - + + + + + @@ -9532,8 +10057,10 @@ - + + + @@ -9766,10 +10293,10 @@ - - + + @@ -9817,7 +10344,7 @@ -3646.8758764194818 - 2059.46239167257 + 2219.839750163136 @@ -9837,7 +10364,7 @@ -2731.1615907051964 - 2052.319534529713 + 2220.2440628316 @@ -9849,6 +10376,7 @@ + @@ -9856,7 +10384,7 @@ -3646.547469194523 - 2269.298188060091 + 2429.675546550657 @@ -9868,6 +10396,7 @@ + @@ -9875,7 +10404,7 @@ -2731.161590705196 - 2269.4623916725704 + 2437.386919974457 @@ -9897,116 +10426,254 @@ -962.4290370851568 - + - + - - - - + + + - + + - -3334.2902932741144 - -701.6562500151983 + 4063.4741650019196 + -900.2512342192765 - - - - -3465.4366360765816 - -613.8537542150955 - - - 106.49867374005294 - -31.653404067197187 - - - - - - - - -3521.195481659506 - -615.3068792150955 - - - 0.7007847597562482 - 0.23755083629371543 - - - 0.4999999999999999 - 0.1514222546285936 - - - -3521.195481659506 - -615.3068792150955 - - - + + - + - - - - + + + - + + - -3334.2902932741144 - -701.6562500151983 + 4063.170140845742 + -665.9117155961767 - - - - -3416.6932082294265 - -574.9310010848872 - - - 11.936339522546405 - -29.88505747126436 - - - - - - - - -3468.6313790954036 - -576.3841260848872 - - - 0.05632437549992315 - 0.4247036321628312 - - - 0.774557769456627 - 0.5 - - - -3468.6313790954036 - -576.3841260848872 - - - + + - + - - - + + + + + + + + + + -1801.170795701778 + 2437.466541366987 + + + + + + + + + + + + + + + + + + + -1801.1707957017784 + 2220.3236842241295 + + + + + + + + + + + + + + + + + + + -3646.453814569703 + 2039.7826521713905 + + + + + + + + + + + + + + + + + + + -2731.3594749470617 + 2040.2032022964195 + + + + + + + + + + + + + + + + + + + -1801.1707957017782 + 2039.78265217139 + + + + + + + + + + + + + + + + + + -3334.2902932741144 + -701.6562500151983 + + + + + -3465.4366360765816 + -613.8537542150955 + + + 106.49867374005294 + -31.653404067197187 + + + + + + + + -3521.195481659506 + -615.3068792150955 + + + 0.7007847597562482 + 0.23755083629371543 + + + 0.4999999999999999 + 0.1514222546285936 + + + -3521.195481659506 + -615.3068792150955 + + + + + + + + + + + + + + + + + + -3334.2902932741144 + -701.6562500151983 + + + + + -3416.6932082294265 + -574.9310010848872 + + + 11.936339522546405 + -29.88505747126436 + + + + + + + + -3468.6313790954036 + -576.3841260848872 + + + 0.05632437549992315 + 0.4247036321628312 + + + 0.774557769456627 + 0.5 + + + -3468.6313790954036 + -576.3841260848872 + + + + + + + + + + + + @@ -10016,7 +10683,7 @@ -701.6562500151983 - + -3263.720099783978 151.24276517468422 @@ -10074,7 +10741,7 @@ -701.6562500151983 - + -3300.3752721977708 201.30950309789685 @@ -10132,7 +10799,7 @@ -701.6562500151983 - + -4025.858169082271 -45.62217743994472 @@ -10175,7 +10842,7 @@ -701.6562500151983 - + -4135.358169082271 -45.62217743994472 @@ -10218,7 +10885,7 @@ -701.6562500151983 - + -4001.5976339008776 -590.6012374151242 @@ -10261,7 +10928,7 @@ -701.6562500151983 - + -4588.967982269121 -543.1036283238357 @@ -10311,7 +10978,7 @@ -701.6562500151983 - + -4550.765506583886 -584.1292693494768 @@ -10361,7 +11028,7 @@ -701.6562500151983 - + -3781.6313790954027 281.7354294057032 @@ -10404,7 +11071,7 @@ -701.6562500151983 - + -4058.896569990833 281.7354294057032 @@ -10447,7 +11114,7 @@ -697.1107954697438 - + -1984.4200166608694 -606.1922695046433 @@ -10490,7 +11157,7 @@ -697.1107954697438 - + -1958.4200166608694 -568.6571484166282 @@ -10533,7 +11200,7 @@ -697.1107954697438 - + -920.2899035516436 -725.550841097089 @@ -10576,7 +11243,7 @@ -697.1107954697438 - + -1500.1558264929793 -725.550841097089 @@ -10619,7 +11286,7 @@ -697.1107954697438 - + -3315.847955490415 -677.3342736809511 @@ -10677,7 +11344,7 @@ -697.1107954697438 - + -879.351963353248 -371.21915424301585 @@ -10720,7 +11387,7 @@ -697.1107954697438 - + -1429.4740034672288 960.2456015034014 @@ -10770,7 +11437,7 @@ -697.1107954697438 - + -752.4577489822182 1060.2456015034013 @@ -10828,7 +11495,7 @@ -697.1107954697438 - + -4653.890837923096 -236.30685241647302 @@ -10867,7 +11534,7 @@ -697.1107954697438 - + -4656.890837923096 -284.1641345101294 @@ -10906,7 +11573,7 @@ -697.1107954697438 - + -3439.088367287303 -780.1689771295894 @@ -10960,7 +11627,7 @@ -697.1107954697438 - + -5255.802841817371 -56.38024610783256 @@ -11003,7 +11670,7 @@ -697.1107954697438 - + -5604.078703886336 -56.38024610783256 @@ -11046,7 +11713,7 @@ -697.1107954697438 - + -4991.015329810498 458.4836088756332 @@ -11104,7 +11771,7 @@ -697.1107954697438 - + -5061.681996477164 248.07292199643342 @@ -11158,7 +11825,7 @@ -697.1107954697438 - + -4066.678678624242 -590.6012374151242 @@ -11201,7 +11868,7 @@ -697.1107954697438 - + -5183.002908335401 -661.5062753953052 @@ -11244,7 +11911,7 @@ -697.1107954697438 - + -5639.175322128504 -661.5062753953052 @@ -11287,7 +11954,7 @@ -697.1107954697438 - + -4670.441156136609 -304.8065514706275 @@ -11341,7 +12008,7 @@ -697.1107954697438 - + -4880.441156136609 -165.90251657422627 @@ -11395,7 +12062,7 @@ -697.1107954697438 - + -4022.7490550219 -1439.8727559557838 @@ -11453,7 +12120,7 @@ -697.1107954697438 - + -2739.9841864450864 352.7882200288675 @@ -11496,7 +12163,7 @@ -697.1107954697438 - + -3185.6856170253577 32.91579937266545 @@ -11554,7 +12221,7 @@ -697.1107954697438 - + -2073.403245404529 -45.51654719046505 @@ -11608,7 +12275,7 @@ -697.1107954697438 - + -1752.0211115196848 504.2718242731226 @@ -11658,7 +12325,7 @@ -697.1107954697438 - + -1506.1724761737607 -371.21915424301585 @@ -11701,7 +12368,7 @@ -697.1107954697438 - + -4282.055711405376 -1348.4009403407922 @@ -11759,7 +12426,7 @@ -697.1107954697438 - + -6308.295283512095 1012.1499364604692 @@ -11821,7 +12488,7 @@ -697.1107954697438 - + -4454.075208127684 624.1001437629707 @@ -11875,7 +12542,7 @@ -697.1107954697438 - + -4474.842972606101 740.3192959189714 @@ -11929,7 +12596,7 @@ -697.1107954697438 - + -5886.247958636628 1069.7005049108807 @@ -11987,7 +12654,7 @@ -697.1107954697438 - + -5943.273006957754 1119.7005049108807 @@ -12045,7 +12712,7 @@ -697.1107954697438 - + -4560.719833599496 -962.8294344195647 @@ -12103,7 +12770,7 @@ -697.1107954697438 - + -3079.9028171392406 -1457.8916969890574 @@ -12157,7 +12824,7 @@ -697.1107954697438 - + -5132.85798739706 169.43523766029574 @@ -12200,7 +12867,7 @@ -697.1107954697438 - + -5577.843062023925 169.43523766029574 @@ -12243,7 +12910,7 @@ -697.1107954697438 - + -4702.8047604943995 360.47656701048686 @@ -12289,7 +12956,7 @@ -697.1107954697438 - + -4666.5884336158015 299.51207266539507 @@ -12335,7 +13002,7 @@ -697.1107954697438 - + -5745.891419549895 468.6543410400628 @@ -12389,7 +13056,7 @@ -697.1107954697438 - + -5840.891419549895 462.10619674191867 @@ -12443,7 +13110,7 @@ -697.1107954697438 - + -6082.513041171516 30.646382803747372 @@ -12497,7 +13164,7 @@ -697.1107954697438 - + -6134.567095225569 38.717014554805246 @@ -12551,7 +13218,7 @@ -697.1107954697438 - + -4172.487432044621 -473.6097165263192 @@ -12609,7 +13276,7 @@ -697.1107954697438 - + -1929.900103661164 556.9271752366052 @@ -12663,7 +13330,7 @@ -697.1107954697438 - + -3402.358169082272 151.04923552755167 @@ -12721,7 +13388,7 @@ -697.1107954697438 - + -3322.478720473633 206.48217202544276 @@ -12779,7 +13446,7 @@ -697.1107954697438 - + -253.58393141203692 -1414.0137126630211 @@ -12833,7 +13500,7 @@ -697.1107954697438 - + -256.5996510851721 -1278.0323744257933 @@ -12887,7 +13554,7 @@ -697.1107954697438 - + -2097.9622528579835 23.236635594918766 @@ -12930,7 +13597,7 @@ -697.1107954697438 - + -2485.860889521144 23.236635594918766 @@ -12973,7 +13640,7 @@ -697.1107954697438 - + -3242.356730883347 -232.66985136607218 @@ -13027,7 +13694,7 @@ -697.1107954697438 - + -3239.356730883347 -173.15455797735405 @@ -13081,7 +13748,7 @@ -697.1107954697438 - + -3048.4231188109125 480.60966615364754 @@ -13139,7 +13806,7 @@ -697.1107954697438 - + -3085.4744008621938 652.7078750098394 @@ -13197,7 +13864,7 @@ -697.1107954697438 - + -1926.4385651996251 501.7285568993941 @@ -13251,7 +13918,7 @@ -697.1107954697438 - + -1868.9550487161089 665.9876123661734 @@ -13305,7 +13972,7 @@ -697.1107954697438 - + -1512.4481751037233 1296.681105023576 @@ -13348,7 +14015,7 @@ -697.1107954697438 - + -1551.4481751037233 1343.399175135743 @@ -13391,7 +14058,7 @@ -697.1107954697438 - + -1642.2169126975837 1660.9235803859483 @@ -13434,7 +14101,7 @@ -697.1107954697438 - + -1011.6627627625651 1433.737730963425 @@ -13473,7 +14140,7 @@ -697.1107954697438 - + -2773.988747497373 1763.9876145555859 @@ -13531,7 +14198,7 @@ -697.1107954697438 - + -806.041938240259 21.737629164096518 @@ -13574,7 +14241,7 @@ -697.1107954697438 - + -1142.249319614799 21.737629164096518 @@ -13617,7 +14284,7 @@ -697.1107954697438 - + -1834.5771584480074 525.1658878667756 @@ -13671,7 +14338,7 @@ -697.1107954697438 - + -1831.4964345090943 603.4755051010169 @@ -13725,7 +14392,7 @@ -697.1107954697438 - + -1763.2355649438766 804.4631891798043 @@ -13779,7 +14446,7 @@ -697.1107954697438 - + -1756.4275682373125 874.1818397172829 @@ -13833,7 +14500,7 @@ -697.1107954697438 - + -499.7653268651295 1433.737730963425 @@ -13876,7 +14543,7 @@ -697.1107954697438 - + -345.35860923001815 163.78380386749075 @@ -13930,7 +14597,7 @@ -697.1107954697438 - + -452.9172566805271 311.9876993086604 @@ -13984,7 +14651,7 @@ -697.1107954697438 - + -337.39864010951464 1286.8591832127308 @@ -14042,7 +14709,7 @@ -697.1107954697438 - + -330.56707512277876 1514.0428183626534 @@ -14100,7 +14767,7 @@ -697.1107954697438 - + 257.13795957375004 -1457.8916969890574 @@ -14154,7 +14821,7 @@ -697.1107954697438 - + 258.2493184903812 -1487.6235292075517 @@ -14208,7 +14875,7 @@ -230.80644764365695 - + -6459.860056649477 2281.5494614086574 @@ -14262,7 +14929,7 @@ -230.80644764365695 - + -6703.964278115455 3085.3172385884677 @@ -14316,7 +14983,7 @@ -230.80644764365695 - + -5263.873653276649 2885.700492070512 @@ -14370,7 +15037,7 @@ -230.80644764365695 - + -5175.901199428103 3018.126942853542 @@ -14424,7 +15091,7 @@ -230.80644764365695 - + -5226.9932801638915 3127.123723366318 @@ -14478,7 +15145,7 @@ -230.80644764365695 - + -5156.881345860535 3173.327337343403 @@ -14532,7 +15199,7 @@ -230.80644764365695 - + -5509.37683853562 3434.1281216501175 @@ -14582,7 +15249,7 @@ -230.80644764365695 - + -5503.7164611771295 3517.1469895746463 @@ -14632,7 +15299,7 @@ -230.80644764365695 - + -4230.307071417519 3560.695527606189 @@ -14675,7 +15342,7 @@ -230.80644764365695 - + -4122.307071417519 3464.2687430588385 @@ -14718,7 +15385,7 @@ -230.80644764365695 - + -3062.0778501203467 3447.583246095677 @@ -14761,7 +15428,7 @@ -230.80644764365695 - + -2957.0778501203467 3506.15216432241 @@ -14800,7 +15467,7 @@ -230.80644764365695 - + -1800.0667195724104 3447.583246095677 @@ -14843,7 +15510,7 @@ -230.80644764365695 - + -1923.0667195724104 3505.708187392518 @@ -14886,7 +15553,7 @@ -230.80644764365695 - + -6781.703738249707 3245.393768196993 @@ -14940,7 +15607,7 @@ -230.80644764365695 - + -5837.844119851388 4088.1368066114255 @@ -14990,7 +15657,7 @@ -230.80644764365695 - + -5881.658933727741 4126.633216758953 @@ -15040,7 +15707,7 @@ -230.80644764365695 - + -5965.482339875752 4447.461374452067 @@ -15090,7 +15757,7 @@ -230.80644764365695 - + -5920.206477806786 4381.313394382259 @@ -15140,7 +15807,7 @@ 269.19355235634305 - + -4149.405628017125 4663.04291019314 @@ -15183,7 +15850,7 @@ 269.19355235634305 - + -4145.405628017125 4556.439136608235 @@ -15226,7 +15893,7 @@ -230.80644764365695 - + -5406.7537562565085 3211.5549685803385 @@ -15280,7 +15947,7 @@ -230.80644764365695 - + -5321.7537562565085 3256.6605917749175 @@ -15330,7 +15997,7 @@ -230.80644764365695 - + -3145.9148011327825 1952.6609553925746 @@ -15384,7 +16051,7 @@ -230.80644764365695 - + -3143.084952132618 2065.2083815227265 @@ -15438,7 +16105,7 @@ -230.80644764365695 - + -7043.549830511265 -1269.6444507754513 @@ -15496,7 +16163,7 @@ -215.4731143103237 - + -2272.998604210608 4219.512962385836 @@ -15546,7 +16213,7 @@ -215.4731143103237 - + -2473.225238382363 4157.295745097037 @@ -15596,7 +16263,7 @@ -215.4731143103237 - + -7300.243013950485 2729.03277051553 @@ -15654,7 +16321,7 @@ -215.4731143103237 - + -7404.760255329797 2642.388850564707 @@ -15712,7 +16379,7 @@ -215.4731143103237 - + -7290.66966545596 2784.628427190492 @@ -15766,7 +16433,7 @@ -215.4731143103237 - + -6942.645772682066 2788.0327653344266 @@ -15820,7 +16487,7 @@ -215.4731143103237 - + -6456.794201297476 1795.9786742819442 @@ -15874,7 +16541,7 @@ -215.4731143103237 - + -6460.794201297476 1709.7919167262721 @@ -15928,7 +16595,7 @@ -215.4731143103237 - + -4429.535277573868 2184.099947725079 @@ -15994,7 +16661,7 @@ -215.4731143103237 - + -4517.918530579889 2088.483224995943 @@ -16060,7 +16727,7 @@ -215.4731143103237 - + -6685.046712819636 932.6164080173463 @@ -16118,7 +16785,7 @@ -213.62126245847196 - + -2416.6737484329474 4823.492554588166 @@ -16172,7 +16839,7 @@ -213.62126245847196 - + -2487.9026978647216 4854.600199280906 @@ -16226,7 +16893,7 @@ -213.62126245847196 - + -2681.960465821991 3846.5164410677285 @@ -16276,7 +16943,7 @@ -213.62126245847196 - + -4237.829818440684 3682.4903994010606 @@ -16326,7 +16993,7 @@ -213.62126245847196 - + -6560.812909679041 1167.7752106723938 @@ -16376,7 +17043,7 @@ -213.62126245847196 - + -6007.7359321759295 1318.703320754818 @@ -16419,7 +17086,7 @@ -213.62126245847196 - + -6457.379070948662 1328.6568313190594 @@ -16469,7 +17136,7 @@ -213.62126245847196 - + -5536.988109512843 1219.5490988973236 @@ -16508,7 +17175,7 @@ -213.62126245847196 - + -5484.125177517524 1131.0649012154113 @@ -16558,7 +17225,7 @@ -213.62126245847196 - + -4794.95435488778 1367.8370093456629 @@ -16604,7 +17271,7 @@ -213.62126245847196 - + -5516.673968473389 1327.6254267835866 @@ -16654,7 +17321,7 @@ -213.62126245847196 - + -3263.7324593698077 1417.3089673257386 @@ -16708,7 +17375,7 @@ -213.62126245847196 - + -5647.619914419336 1513.2046413196654 @@ -16762,7 +17429,7 @@ -213.62126245847196 - + -4632.361832030409 583.2397431546501 @@ -16812,7 +17479,7 @@ -213.62126245847196 - + -5387.924660475141 1436.60464296955 @@ -16858,7 +17525,7 @@ -213.62126245847196 - + -5606.265866987975 1586.5197190629665 @@ -16912,7 +17579,7 @@ -213.62126245847196 - + -4558.427699319827 753.9231999441894 @@ -16966,7 +17633,7 @@ -213.62126245847196 - + -6374.078827771604 1714.198518546094 @@ -17016,7 +17683,7 @@ -213.62126245847196 - + -4512.318918608709 1371.587817876014 @@ -17066,7 +17733,7 @@ -213.62126245847196 - + -3129.383556528758 783.1344758081772 @@ -17116,7 +17783,7 @@ -213.62126245847196 - + -3423.2334063786075 165.00655256608093 @@ -17166,7 +17833,7 @@ -213.62126245847196 - + -1039.7638805580716 1779.1146585707766 @@ -17209,7 +17876,7 @@ -213.62126245847196 - + -523.3915040328209 1779.1146585707766 @@ -17248,7 +17915,7 @@ -213.62126245847196 - + -4039.7162301622766 1959.6067177570753 @@ -17298,7 +17965,7 @@ -213.62126245847196 - + -3235.822129371775 1318.0296144242288 @@ -17348,7 +18015,7 @@ -213.62126245847196 - + -1343.9718586787073 -1364.2228558068791 @@ -17402,7 +18069,7 @@ -213.62126245847196 - + -6396.438530896242 -1204.0747388879583 @@ -17452,7 +18119,7 @@ -213.62126245847196 - + -4321.673537095424 3765.4541742766833 @@ -17498,7 +18165,7 @@ -213.62126245847196 - + -2075.8320865528135 -1408.5820071041821 @@ -17548,7 +18215,7 @@ -213.62126245847196 - + -6526.8869621242775 1446.475820753974 @@ -17598,7 +18265,7 @@ -213.62126245847196 - + -6512.333269423029 1991.8860241708394 @@ -17648,7 +18315,7 @@ -213.62126245847196 - + -3250.2744822175355 21.71846323604845 @@ -17702,7 +18369,7 @@ 22.09302325581382 - + 1026.273416459941 -1348.1173173684087 @@ -17752,7 +18419,7 @@ 22.09302325581382 - + 870.1264400096215 -1008.3064719154979 @@ -17795,7 +18462,7 @@ 22.09302325581382 - + 1145.9280323193702 -1008.3064719154979 @@ -17838,7 +18505,7 @@ 22.09302325581382 - + 938.1553685391564 -719.5831471470816 @@ -17881,7 +18548,7 @@ 22.09302325581382 - + 813.7070926770875 -437.7855165076786 @@ -17924,7 +18591,7 @@ 22.09302325581382 - + 1111.7760581943287 -437.7855165076786 @@ -17963,7 +18630,7 @@ 22.09302325581382 - + 813.5168580232298 -177.6889569490936 @@ -18002,7 +18669,7 @@ 22.09302325581382 - + 1144.7668580232298 -177.6889569490936 @@ -18045,7 +18712,7 @@ 22.09302325581382 - + 776.3918580232298 85.65707847346994 @@ -18084,7 +18751,7 @@ 22.09302325581382 - + -375.55158934690064 657.6785960582204 @@ -18130,7 +18797,7 @@ 22.09302325581382 - + 1643.125696738587 -875.0515015774615 @@ -18176,7 +18843,7 @@ 22.09302325581382 - + 1512.2021872567798 -441.14091646826904 @@ -18219,7 +18886,7 @@ 22.09302325581382 - + 1912.8020405207017 -441.14091646826904 @@ -18258,7 +18925,7 @@ 22.09302325581382 - + 1801.6373102061239 -177.62535150316262 @@ -18297,7 +18964,7 @@ 0.0 - + 1204.4745789449794 -1391.6112459205128 @@ -18347,7 +19014,7 @@ 0.0 - + 2333.890846477955 -547.9047874785633 @@ -18393,7 +19060,7 @@ 0.0 - + 2556.265356721765 -612.1922695046433 @@ -18439,7 +19106,7 @@ 0.0 - + 2281.003358471995 -44.00153749861454 @@ -18485,7 +19152,7 @@ 0.0 - + -3623.349045874398 -948.1614090354324 @@ -18539,7 +19206,7 @@ 0.0 - + -350.72536076022334 3085.317238588468 @@ -18589,10 +19256,10 @@ 0.0 - + - 2293.860013979096 - -1077.726708552884 + 2285.8957143122925 + -1061.7981092192765 @@ -18601,11 +19268,11 @@ 3431.0722774944293 - -1079.179833552884 + -1063.2512342192765 0.5 - 0.8712670807744111 + 0.963908879879362 0.24440368966322618 @@ -18613,7 +19280,7 @@ 3431.0722774944293 - -1079.179833552884 + -1063.2512342192765 @@ -18635,10 +19302,10 @@ 0.0 - + - 2477.2982141627544 - -1141.5614422535343 + 2439.0966580660374 + -1081.7981092192765 @@ -18646,20 +19313,20 @@ - 3682.113944161096 - -1143.0145672535343 + 3665.4741650019196 + -1083.2512342192765 - 0.5875998921948712 + 0.5648518396734657 0.5 0.5 - 0.5 + 0.8475875421839786 - 3682.113944161096 - -1143.0145672535343 + 3665.4741650019196 + -1083.2512342192765 @@ -18681,7 +19348,7 @@ 0.0 - + 3066.0722774944293 -695.563694834209 @@ -18724,7 +19391,7 @@ 0.0 - + 3072.0722774944293 -445.08535935587327 @@ -18767,7 +19434,7 @@ 0.0 - + 3467.9927312632703 -695.563694834209 @@ -18810,7 +19477,7 @@ 0.0 - + 3473.9927312632703 -445.08535935587327 @@ -18846,13 +19513,13 @@ 0.0 - 0.0 + 160.37735849056617 - + -3503.456026076672 - 2229.0840442603835 + 2389.4614027509497 @@ -18885,13 +19552,13 @@ 0.0 - 0.0 + 167.92452830188677 - + -2586.905943974866 - 2225.594717495195 + 2393.5192457970816 @@ -18927,10 +19594,10 @@ 0.0 - + - -3325.825806486113 - 565.8801979894706 + -3082.8221293717747 + 571.4635801681345 @@ -18940,8 +19607,10 @@ -3684.2568905406188 -353.177161639123 - -3146.825806486113 + -2903.8221293717747 -353.177161639123 + -2903.8221293717747 + 2283.090379557189 0.47193026947985595 @@ -18954,8 +19623,10 @@ -3684.2568905406188 -353.177161639123 - -3146.825806486113 + -2903.8221293717747 -353.177161639123 + -2903.8221293717747 + 2283.090379557189 @@ -18977,10 +19648,10 @@ 0.0 - + - -2834.441191101497 - 317.1164617257342 + -2927.192349580143 + 488.09499925050017 @@ -18990,8 +19661,10 @@ -3684.2568905406188 -353.177161639123 - -2656.441191101497 + -2749.192349580143 -353.177161639123 + -2749.192349580143 + 2283.4946922256527 0.47193026947985595 @@ -19004,8 +19677,10 @@ -3684.2568905406188 -353.177161639123 - -2656.441191101497 + -2749.192349580143 -353.177161639123 + -2749.192349580143 + 2283.4946922256527 @@ -19027,7 +19702,7 @@ 0.0 - + 1725.0896016325148 -926.0021073686953 @@ -19047,6 +19722,503 @@ + + + + + + + + + + + + + + + + 0.0 + 0.0 + + + + + 2833.2396160560106 + -1114.2981092192767 + + + + + + + + 4429.21490574266 + -1115.7512342192767 + + + 0.5 + 0.6585653684289791 + + + 0.5 + 0.5 + + + 4429.21490574266 + -1115.7512342192767 + + + + + + + + + + + + + + + + + + 0.0 + 0.0 + + + + + 2883.726346031542 + -1149.0080654441579 + + + + + + + + 4030.223761630707 + -1150.4611904441579 + 4030.223761630707 + -579.9429655961767 + + + 0.5 + 0.45668994145766023 + + + 0.5 + 0.5 + + + 4030.223761630707 + -1150.4611904441579 + 4030.223761630707 + -579.9429655961767 + + + + + + + + + + + + + + + + + + 929.990795003418 + 168.00414969441636 + + + + + -1675.9151489714482 + 2393.598867189611 + + + + + + + + 0.5 + 0.5 + + + 0.5 + 0.5 + + + + + + + + + + + + + + + + + + + 0.0 + 0.0 + + + + + -4401.319377949687 + 1126.394921313783 + + + + + + + + -4212.319377949687 + -227.20841163912303 + -4212.319377949687 + 2103.0332815654433 + + + 0.5 + 0.5 + + + 0.7248830755901606 + 0.4999999999999991 + + + -4212.319377949687 + -227.20841163912303 + -4212.319377949687 + 2103.0332815654433 + + + + + + + + + + + + + + + + + + 0.0 + 0.0 + + + + + -4290.090574126027 + 1730.6548748557566 + + + + + + + + -4102.090574126027 + -227.20841163912303 + -4102.090574126027 + 2011.5968768453554 + -2375.103828216732 + 2011.5968768453554 + + + 0.5 + 0.5 + + + 0.5 + 0.5 + + + -4102.090574126027 + -227.20841163912303 + -4102.090574126027 + 2011.5968768453554 + -2375.103828216732 + 2011.5968768453554 + + + + + + + + + + + + + + + + + + 0.0 + 0.0 + + + + + -4157.40714316109 + 2027.7443516861108 + + + + + + + + -4118.2017308908635 + -227.20841163912303 + -4118.2017308908635 + 2026.2912266861108 + -1444.9151489714482 + 2026.2912266861108 + + + 0.5 + 0.5 + + + 0.5 + 0.5 + + + -4118.2017308908635 + -227.20841163912303 + -4118.2017308908635 + 2026.2912266861108 + -1444.9151489714482 + 2026.2912266861108 + + + + + + + + + + + + + + + + + + 0.0 + 0.0 + + + + + -3950.4236644760795 + 2309.554766115036 + + + + + + + + -3702.423664476079 + 2123.370760910181 + -3702.423664476079 + 2492.92617594471 + + + 0.49999999999999967 + 0.6607689879102607 + + + 0.5 + 0.5 + + + -3702.423664476079 + 2123.370760910181 + -3702.423664476079 + 2492.92617594471 + + + + + + + + + + + + + + + + + + 0.0 + 0.0 + + + + + -3013.6027689536913 + 2313.5562222602784 + + + + + + + + -2766.6027689536913 + 2123.370760910181 + -2766.6027689536913 + 2500.63754936851 + + + 0.4719302694798556 + 0.6574445140745228 + + + 0.528069730520144 + 0.5 + + + -2766.6027689536913 + 2123.370760910181 + -2766.6027689536913 + 2500.63754936851 + + + + + + + + + + + + + + + + + + 0.0 + 0.0 + + + + + -2122.0917264798663 + 2303.3283511632417 + + + + + + + + -1856.0917264798663 + 2103.033281565443 + -1856.0917264798663 + 2500.7171707610396 + + + 0.5 + 0.5 + + + 0.5 + 0.5 + + + -1856.0917264798663 + 2103.033281565443 + -1856.0917264798663 + 2500.7171707610396 + + + + + + + + + + + + + + + + + + 0.0 + 0.0 + + + + + -2963.6027689536913 + 1405.2651450114752 + + + + + + + + -2766.6027689536913 + -227.20841163912303 + -2766.6027689536913 + 1979.8344235739798 + -1410.6955266591508 + 1979.8344235739798 + + + 0.5 + 0.5 + + + 0.5480267788403651 + 0.4999999999999991 + + + -2766.6027689536913 + -227.20841163912303 + -2766.6027689536913 + 1979.8344235739798 + -1410.6955266591508 + 1979.8344235739798 + + diff --git a/Views/STATE_ID_SCR_ADD_COLDCARD.cpp b/Views/STATE_ID_SCR_ADD_COLDCARD.cpp new file mode 100644 index 00000000..4f737cfa --- /dev/null +++ b/Views/STATE_ID_SCR_ADD_COLDCARD.cpp @@ -0,0 +1,64 @@ +/************************************************************************* +* This file is part of the Nunchuk software (https://nunchuk.io/) * +* Copyright (C) 2020-2022 Enigmo * +* Copyright (C) 2022 Nunchuk * +* * +* This program is free software; you can redistribute it and/or * +* modify it under the terms of the GNU General Public License * +* as published by the Free Software Foundation; either version 3 * +* of the License, or (at your option) any later version. * +* * +* This program is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; without even the implied warranty of * +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +* GNU General Public License for more details. * +* * +* You should have received a copy of the GNU General Public License * +* along with this program. If not, see . * +* * +**************************************************************************/ + + +#include "STATE_ID_SCR_ADD_COLDCARD.h" +#include "Models/AppModel.h" +#include "localization/STR_CPP.h" + +void SCR_ADD_COLDCARD_Entry(QVariant msg) { + Q_UNUSED(msg); + AppModel::instance()->setNewKeySignMessage(""); + AppModel::instance()->setAddSignerWizard(0); + AppModel::instance()->setAddSignerPercentage(0); +} + +void SCR_ADD_COLDCARD_Exit(QVariant msg) { + Q_UNUSED(msg); + AppModel::instance()->setNewKeySignMessage(""); + AppModel::instance()->setAddSignerWizard(0); + AppModel::instance()->setAddSignerPercentage(0); +} + +void EVT_SCAN_COLDCARD_DEVICE_REQUEST_HANDLER(QVariant msg) { + Q_UNUSED(msg); + AppModel::instance()->startScanDevices(E::STATE_ID_SCR_ADD_HARDWARE_SIGNER); +} + +void EVT_ADD_COLDCARD_DEVICE_REQUEST_HANDLER(QVariant msg) { + DBG_INFO << msg; + QString signerNameInputted = msg.toMap().value("signerNameInputted").toString(); + int deviceIndexSelected = msg.toMap().value("deviceIndexSelected").toInt(); + if (AppModel::instance()->deviceList()) { + QDevicePtr selectedDv = AppModel::instance()->deviceList()->getDeviceByIndex(deviceIndexSelected); + if (selectedDv) { + if (selectedDv.data()->needsPinSent() || selectedDv.data()->needsPassPhraseSent()) { + AppModel::instance()->showToast(0, + 0, + EWARNING::WarningType::WARNING_MSG, + STR_CPP_095); + } else { + AppModel::instance()->setAddSignerWizard(2);//_LOADING: 2 + AppModel::instance()->startCreateMasterSigner(signerNameInputted, deviceIndexSelected); + } + } + } +} + diff --git a/Views/STATE_ID_SCR_ADD_COLDCARD.h b/Views/STATE_ID_SCR_ADD_COLDCARD.h new file mode 100644 index 00000000..6b3ddc0e --- /dev/null +++ b/Views/STATE_ID_SCR_ADD_COLDCARD.h @@ -0,0 +1,35 @@ +/************************************************************************* +* This file is part of the Nunchuk software (https://nunchuk.io/) * +* Copyright (C) 2020-2022 Enigmo * +* Copyright (C) 2022 Nunchuk * +* * +* This program is free software; you can redistribute it and/or * +* modify it under the terms of the GNU General Public License * +* as published by the Free Software Foundation; either version 3 * +* of the License, or (at your option) any later version. * +* * +* This program is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; without even the implied warranty of * +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +* GNU General Public License for more details. * +* * +* You should have received a copy of the GNU General Public License * +* along with this program. If not, see . * +* * +**************************************************************************/ + + +#ifndef STATE_ID_SCR_ADD_COLDCARD_H +#define STATE_ID_SCR_ADD_COLDCARD_H + +#include +#include +#include "ViewsDefines.h" +#include "ViewsEnums.h" + +void SCR_ADD_COLDCARD_Entry(QVariant msg); +void SCR_ADD_COLDCARD_Exit(QVariant msg); +void EVT_SCAN_COLDCARD_DEVICE_REQUEST_HANDLER(QVariant msg); +void EVT_ADD_COLDCARD_DEVICE_REQUEST_HANDLER(QVariant msg); + +#endif // STATE_ID_SCR_ADD_COLDCARD_H diff --git a/Views/STATE_ID_SCR_ADD_COLDCARD_ASK.cpp b/Views/STATE_ID_SCR_ADD_COLDCARD_ASK.cpp new file mode 100644 index 00000000..665d59e9 --- /dev/null +++ b/Views/STATE_ID_SCR_ADD_COLDCARD_ASK.cpp @@ -0,0 +1,35 @@ +/************************************************************************* +* This file is part of the Nunchuk software (https://nunchuk.io/) * +* Copyright (C) 2020-2022 Enigmo * +* Copyright (C) 2022 Nunchuk * +* * +* This program is free software; you can redistribute it and/or * +* modify it under the terms of the GNU General Public License * +* as published by the Free Software Foundation; either version 3 * +* of the License, or (at your option) any later version. * +* * +* This program is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; without even the implied warranty of * +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +* GNU General Public License for more details. * +* * +* You should have received a copy of the GNU General Public License * +* along with this program. If not, see . * +* * +**************************************************************************/ + + +#include "STATE_ID_SCR_ADD_COLDCARD_ASK.h" + +void SCR_ADD_COLDCARD_ASK_Entry(QVariant msg) { + +} + +void SCR_ADD_COLDCARD_ASK_Exit(QVariant msg) { + +} + +void EVT_ADD_COLDCARD_REQUEST_HANDLER(QVariant msg) { + +} + diff --git a/Views/STATE_ID_SCR_ADD_COLDCARD_ASK.h b/Views/STATE_ID_SCR_ADD_COLDCARD_ASK.h new file mode 100644 index 00000000..d5a4d0fa --- /dev/null +++ b/Views/STATE_ID_SCR_ADD_COLDCARD_ASK.h @@ -0,0 +1,34 @@ +/************************************************************************* +* This file is part of the Nunchuk software (https://nunchuk.io/) * +* Copyright (C) 2020-2022 Enigmo * +* Copyright (C) 2022 Nunchuk * +* * +* This program is free software; you can redistribute it and/or * +* modify it under the terms of the GNU General Public License * +* as published by the Free Software Foundation; either version 3 * +* of the License, or (at your option) any later version. * +* * +* This program is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; without even the implied warranty of * +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +* GNU General Public License for more details. * +* * +* You should have received a copy of the GNU General Public License * +* along with this program. If not, see . * +* * +**************************************************************************/ + + +#ifndef STATE_ID_SCR_ADD_COLDCARD_ASK_H +#define STATE_ID_SCR_ADD_COLDCARD_ASK_H + +#include +#include +#include "ViewsDefines.h" +#include "ViewsEnums.h" + +void SCR_ADD_COLDCARD_ASK_Entry(QVariant msg); +void SCR_ADD_COLDCARD_ASK_Exit(QVariant msg); +void EVT_ADD_COLDCARD_REQUEST_HANDLER(QVariant msg); + +#endif // STATE_ID_SCR_ADD_COLDCARD_ASK_H diff --git a/Views/STATE_ID_SCR_ADD_COLDCARD_EXIST.cpp b/Views/STATE_ID_SCR_ADD_COLDCARD_EXIST.cpp new file mode 100644 index 00000000..96b3e696 --- /dev/null +++ b/Views/STATE_ID_SCR_ADD_COLDCARD_EXIST.cpp @@ -0,0 +1,44 @@ +/************************************************************************* +* This file is part of the Nunchuk software (https://nunchuk.io/) * +* Copyright (C) 2020-2022 Enigmo * +* Copyright (C) 2022 Nunchuk * +* * +* This program is free software; you can redistribute it and/or * +* modify it under the terms of the GNU General Public License * +* as published by the Free Software Foundation; either version 3 * +* of the License, or (at your option) any later version. * +* * +* This program is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; without even the implied warranty of * +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +* GNU General Public License for more details. * +* * +* You should have received a copy of the GNU General Public License * +* along with this program. If not, see . * +* * +**************************************************************************/ + + +#include "STATE_ID_SCR_ADD_COLDCARD_EXIST.h" +#include "AppModel.h" +#include "Chats/QUserWallets.h" + +void SCR_ADD_COLDCARD_EXIST_Entry(QVariant msg) { + +} + +void SCR_ADD_COLDCARD_EXIST_Exit(QVariant msg) { + +} + +void EVT_ADD_EXIST_COLDCARD_REQUEST_HANDLER(QVariant msg) { + DBG_INFO << msg; + QMasterSignerPtr signer = AppModel::instance()->masterSignerList()->getMasterSignerByXfp(msg.toString()); + AppModel::instance()->setMasterSignerInfo(signer); + QUserWallets::instance()->addKeyRequested(); +} + +void EVT_ADD_NEW_COLDCARD_REQUEST_HANDLER(QVariant msg) { + +} + diff --git a/Views/STATE_ID_SCR_ADD_COLDCARD_EXIST.h b/Views/STATE_ID_SCR_ADD_COLDCARD_EXIST.h new file mode 100644 index 00000000..ff727e3c --- /dev/null +++ b/Views/STATE_ID_SCR_ADD_COLDCARD_EXIST.h @@ -0,0 +1,35 @@ +/************************************************************************* +* This file is part of the Nunchuk software (https://nunchuk.io/) * +* Copyright (C) 2020-2022 Enigmo * +* Copyright (C) 2022 Nunchuk * +* * +* This program is free software; you can redistribute it and/or * +* modify it under the terms of the GNU General Public License * +* as published by the Free Software Foundation; either version 3 * +* of the License, or (at your option) any later version. * +* * +* This program is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; without even the implied warranty of * +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +* GNU General Public License for more details. * +* * +* You should have received a copy of the GNU General Public License * +* along with this program. If not, see . * +* * +**************************************************************************/ + + +#ifndef STATE_ID_SCR_ADD_COLDCARD_EXIST_H +#define STATE_ID_SCR_ADD_COLDCARD_EXIST_H + +#include +#include +#include "ViewsDefines.h" +#include "ViewsEnums.h" + +void SCR_ADD_COLDCARD_EXIST_Entry(QVariant msg); +void SCR_ADD_COLDCARD_EXIST_Exit(QVariant msg); +void EVT_ADD_EXIST_COLDCARD_REQUEST_HANDLER(QVariant msg); +void EVT_ADD_NEW_COLDCARD_REQUEST_HANDLER(QVariant msg); + +#endif // STATE_ID_SCR_ADD_COLDCARD_EXIST_H diff --git a/Views/STATE_ID_SCR_ADD_LEDGER.cpp b/Views/STATE_ID_SCR_ADD_LEDGER.cpp index bf659607..db4700dc 100644 --- a/Views/STATE_ID_SCR_ADD_LEDGER.cpp +++ b/Views/STATE_ID_SCR_ADD_LEDGER.cpp @@ -45,18 +45,19 @@ void EVT_SCAN_LEDGER_DEVICE_REQUEST_HANDLER(QVariant msg) void EVT_ADD_LEDGER_DEVICE_REQUEST_HANDLER(QVariant msg) { + DBG_INFO << msg; QString signerNameInputted = msg.toMap().value("signerNameInputted").toString(); int deviceIndexSelected = msg.toMap().value("deviceIndexSelected").toInt(); - if(AppModel::instance()->deviceList()){ - QDevicePtr selectedDv = AppModel::instance()->deviceList()->getDeviceByIndex(deviceIndexSelected) ; - if(selectedDv){ - if(selectedDv.data()->needsPinSent() || selectedDv.data()->needsPassPhraseSent()){ + if (AppModel::instance()->deviceList()) { + QDevicePtr selectedDv = AppModel::instance()->deviceList()->getDeviceByIndex(deviceIndexSelected); + if (selectedDv) { + if (selectedDv.data()->needsPinSent() || selectedDv.data()->needsPassPhraseSent()) { AppModel::instance()->showToast(0, 0, EWARNING::WarningType::WARNING_MSG, STR_CPP_095); - } - else{ + } else { + AppModel::instance()->setAddSignerWizard(2);//_LOADING: 2 AppModel::instance()->startCreateMasterSigner(signerNameInputted, deviceIndexSelected); } } diff --git a/Views/STATE_ID_SCR_ADD_LEDGER_EXIST.cpp b/Views/STATE_ID_SCR_ADD_LEDGER_EXIST.cpp new file mode 100644 index 00000000..2fea9c23 --- /dev/null +++ b/Views/STATE_ID_SCR_ADD_LEDGER_EXIST.cpp @@ -0,0 +1,44 @@ +/************************************************************************* +* This file is part of the Nunchuk software (https://nunchuk.io/) * +* Copyright (C) 2020-2022 Enigmo * +* Copyright (C) 2022 Nunchuk * +* * +* This program is free software; you can redistribute it and/or * +* modify it under the terms of the GNU General Public License * +* as published by the Free Software Foundation; either version 3 * +* of the License, or (at your option) any later version. * +* * +* This program is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; without even the implied warranty of * +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +* GNU General Public License for more details. * +* * +* You should have received a copy of the GNU General Public License * +* along with this program. If not, see . * +* * +**************************************************************************/ + + +#include "STATE_ID_SCR_ADD_LEDGER_EXIST.h" +#include "AppModel.h" +#include "Chats/QUserWallets.h" + +void SCR_ADD_LEDGER_EXIST_Entry(QVariant msg) { + +} + +void SCR_ADD_LEDGER_EXIST_Exit(QVariant msg) { + +} + +void EVT_ADD_EXIST_LEDGER_REQUEST_HANDLER(QVariant msg) { + DBG_INFO << msg; + QMasterSignerPtr signer = AppModel::instance()->masterSignerList()->getMasterSignerByXfp(msg.toString()); + AppModel::instance()->setMasterSignerInfo(signer); + QUserWallets::instance()->addKeyRequested(); +} + +void EVT_ADD_NEW_LEDGER_REQUEST_HANDLER(QVariant msg) { + +} + diff --git a/Views/STATE_ID_SCR_ADD_LEDGER_EXIST.h b/Views/STATE_ID_SCR_ADD_LEDGER_EXIST.h new file mode 100644 index 00000000..06bc4e9b --- /dev/null +++ b/Views/STATE_ID_SCR_ADD_LEDGER_EXIST.h @@ -0,0 +1,35 @@ +/************************************************************************* +* This file is part of the Nunchuk software (https://nunchuk.io/) * +* Copyright (C) 2020-2022 Enigmo * +* Copyright (C) 2022 Nunchuk * +* * +* This program is free software; you can redistribute it and/or * +* modify it under the terms of the GNU General Public License * +* as published by the Free Software Foundation; either version 3 * +* of the License, or (at your option) any later version. * +* * +* This program is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; without even the implied warranty of * +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +* GNU General Public License for more details. * +* * +* You should have received a copy of the GNU General Public License * +* along with this program. If not, see . * +* * +**************************************************************************/ + + +#ifndef STATE_ID_SCR_ADD_LEDGER_EXIST_H +#define STATE_ID_SCR_ADD_LEDGER_EXIST_H + +#include +#include +#include "ViewsDefines.h" +#include "ViewsEnums.h" + +void SCR_ADD_LEDGER_EXIST_Entry(QVariant msg); +void SCR_ADD_LEDGER_EXIST_Exit(QVariant msg); +void EVT_ADD_EXIST_LEDGER_REQUEST_HANDLER(QVariant msg); +void EVT_ADD_NEW_LEDGER_REQUEST_HANDLER(QVariant msg); + +#endif // STATE_ID_SCR_ADD_LEDGER_EXIST_H diff --git a/Views/STATE_ID_SCR_ADD_TREZOR.cpp b/Views/STATE_ID_SCR_ADD_TREZOR.cpp index 3366cb14..55cd7889 100644 --- a/Views/STATE_ID_SCR_ADD_TREZOR.cpp +++ b/Views/STATE_ID_SCR_ADD_TREZOR.cpp @@ -45,18 +45,19 @@ void EVT_SCAN_TREZOR_DEVICE_REQUEST_HANDLER(QVariant msg) void EVT_ADD_TREZOR_DEVICE_REQUEST_HANDLER(QVariant msg) { + DBG_INFO; QString signerNameInputted = msg.toMap().value("signerNameInputted").toString(); int deviceIndexSelected = msg.toMap().value("deviceIndexSelected").toInt(); - if(AppModel::instance()->deviceList()){ - QDevicePtr selectedDv = AppModel::instance()->deviceList()->getDeviceByIndex(deviceIndexSelected) ; - if(selectedDv){ + if (AppModel::instance()->deviceList()) { + QDevicePtr selectedDv = AppModel::instance()->deviceList()->getDeviceByIndex(deviceIndexSelected); + if (selectedDv) { if(selectedDv.data()->needsPinSent() || selectedDv.data()->needsPassPhraseSent()){ AppModel::instance()->showToast(0, 0, EWARNING::WarningType::WARNING_MSG, STR_CPP_095); - } - else{ + } else { + AppModel::instance()->setAddSignerWizard(2);//_LOADING: 2 AppModel::instance()->startCreateMasterSigner(signerNameInputted, deviceIndexSelected); } } diff --git a/Views/STATE_ID_SCR_ADD_TREZOR_EXIST.cpp b/Views/STATE_ID_SCR_ADD_TREZOR_EXIST.cpp new file mode 100644 index 00000000..8e0d0168 --- /dev/null +++ b/Views/STATE_ID_SCR_ADD_TREZOR_EXIST.cpp @@ -0,0 +1,44 @@ +/************************************************************************* +* This file is part of the Nunchuk software (https://nunchuk.io/) * +* Copyright (C) 2020-2022 Enigmo * +* Copyright (C) 2022 Nunchuk * +* * +* This program is free software; you can redistribute it and/or * +* modify it under the terms of the GNU General Public License * +* as published by the Free Software Foundation; either version 3 * +* of the License, or (at your option) any later version. * +* * +* This program is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; without even the implied warranty of * +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +* GNU General Public License for more details. * +* * +* You should have received a copy of the GNU General Public License * +* along with this program. If not, see . * +* * +**************************************************************************/ + + +#include "STATE_ID_SCR_ADD_TREZOR_EXIST.h" +#include "AppModel.h" +#include "Chats/QUserWallets.h" + +void SCR_ADD_TREZOR_EXIST_Entry(QVariant msg) { + +} + +void SCR_ADD_TREZOR_EXIST_Exit(QVariant msg) { + +} + +void EVT_ADD_EXIST_TREZOR_REQUEST_HANDLER(QVariant msg) { + DBG_INFO << msg; + QMasterSignerPtr signer = AppModel::instance()->masterSignerList()->getMasterSignerByXfp(msg.toString()); + AppModel::instance()->setMasterSignerInfo(signer); + QUserWallets::instance()->addKeyRequested(); +} + +void EVT_ADD_NEW_TREZOR_REQUEST_HANDLER(QVariant msg) { + +} + diff --git a/Views/STATE_ID_SCR_ADD_TREZOR_EXIST.h b/Views/STATE_ID_SCR_ADD_TREZOR_EXIST.h new file mode 100644 index 00000000..ce6f350e --- /dev/null +++ b/Views/STATE_ID_SCR_ADD_TREZOR_EXIST.h @@ -0,0 +1,35 @@ +/************************************************************************* +* This file is part of the Nunchuk software (https://nunchuk.io/) * +* Copyright (C) 2020-2022 Enigmo * +* Copyright (C) 2022 Nunchuk * +* * +* This program is free software; you can redistribute it and/or * +* modify it under the terms of the GNU General Public License * +* as published by the Free Software Foundation; either version 3 * +* of the License, or (at your option) any later version. * +* * +* This program is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; without even the implied warranty of * +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +* GNU General Public License for more details. * +* * +* You should have received a copy of the GNU General Public License * +* along with this program. If not, see . * +* * +**************************************************************************/ + + +#ifndef STATE_ID_SCR_ADD_TREZOR_EXIST_H +#define STATE_ID_SCR_ADD_TREZOR_EXIST_H + +#include +#include +#include "ViewsDefines.h" +#include "ViewsEnums.h" + +void SCR_ADD_TREZOR_EXIST_Entry(QVariant msg); +void SCR_ADD_TREZOR_EXIST_Exit(QVariant msg); +void EVT_ADD_EXIST_TREZOR_REQUEST_HANDLER(QVariant msg); +void EVT_ADD_NEW_TREZOR_REQUEST_HANDLER(QVariant msg); + +#endif // STATE_ID_SCR_ADD_TREZOR_EXIST_H diff --git a/Views/STATE_ID_SCR_ADD_WALLET.cpp b/Views/STATE_ID_SCR_ADD_WALLET.cpp index 031ac3ee..c34245a0 100644 --- a/Views/STATE_ID_SCR_ADD_WALLET.cpp +++ b/Views/STATE_ID_SCR_ADD_WALLET.cpp @@ -72,7 +72,7 @@ void EVT_ADD_WALLET_IMPORT_HANDLER(QVariant msg) { if(walletImported && importmsg.type() == (int)EWARNING::WarningType::NONE_MSG){ AppModel::instance()->walletList()->addWallet(walletImported); AppModel::instance()->resetSignersChecked(); - AppModel::instance()->walletList()->requestSort(WalletListModel::WalletRoles::wallet_Name_Role, Qt::AscendingOrder); + AppModel::instance()->walletList()->requestSort(WalletListModel::WalletRoles::wallet_createDate_Role, Qt::AscendingOrder); int index = AppModel::instance()->walletList()->getWalletIndexById(walletImported.data()->id()); if(-1 != index){ AppModel::instance()->setWalletListCurrentIndex(index); diff --git a/Views/STATE_ID_SCR_ADD_WALLET_CONFIRMATION.cpp b/Views/STATE_ID_SCR_ADD_WALLET_CONFIRMATION.cpp index e4f3aff6..2a078657 100644 --- a/Views/STATE_ID_SCR_ADD_WALLET_CONFIRMATION.cpp +++ b/Views/STATE_ID_SCR_ADD_WALLET_CONFIRMATION.cpp @@ -51,41 +51,57 @@ void EVT_ADD_WALLET_TOP_UP_XPUBS_REQUEST_HANDLER(QVariant msg) { int signer_index = msg.toInt(); if(signer_index >= 0 && AppModel::instance()->newWalletInfo() && AppModel::instance()->newWalletInfo()->singleSignersAssigned()){ QSingleSignerPtr it = AppModel::instance()->newWalletInfo()->singleSignersAssigned()->getSingleSignerByIndex(signer_index); - QWarningMessage warningmsg; - bridge::nunchukCacheMasterSignerXPub(it.data()->masterSignerId(), warningmsg); - if((int)EWARNING::WarningType::NONE_MSG == warningmsg.type()){ - int numberSignerRequired = AppModel::instance()->newWalletInfo()->n(); - bool escrow = AppModel::instance()->newWalletInfo()->escrow(); - ENUNCHUCK::WalletType walletType = escrow ? ENUNCHUCK::WalletType::ESCROW : - numberSignerRequired > 1 ? ENUNCHUCK::WalletType::MULTI_SIG - : ENUNCHUCK::WalletType::SINGLE_SIG; - ENUNCHUCK::AddressType addressType = (ENUNCHUCK::AddressType)AppModel::instance()->newWalletInfo()->addressType().toInt(); - warningmsg.resetWarningMessage(); - QSingleSignerPtr signer = bridge::nunchukGetUnusedSignerFromMasterSigner(it.data()->masterSignerId(), - walletType, - addressType, - warningmsg); - if(signer && warningmsg.type() == (int)EWARNING::WarningType::NONE_MSG){ - AppModel::instance()->newWalletInfo()->singleSignersAssigned()->replaceSingleSigner(msg.toInt(), signer); - AppModel::instance()->showToast(0, - STR_CPP_097, - EWARNING::WarningType::SUCCESS_MSG, - STR_CPP_097); + if(it){ + QWarningMessage warningmsg; + bridge::nunchukCacheMasterSignerXPub(it.data()->masterSignerId(), warningmsg); + if((int)EWARNING::WarningType::NONE_MSG == warningmsg.type()){ + int numberSignerRequired = AppModel::instance()->newWalletInfo()->n(); + bool escrow = AppModel::instance()->newWalletInfo()->escrow(); + ENUNCHUCK::WalletType walletType = escrow ? ENUNCHUCK::WalletType::ESCROW : + numberSignerRequired > 1 ? ENUNCHUCK::WalletType::MULTI_SIG + : ENUNCHUCK::WalletType::SINGLE_SIG; + ENUNCHUCK::AddressType addressType = (ENUNCHUCK::AddressType)AppModel::instance()->newWalletInfo()->addressType().toInt(); + warningmsg.resetWarningMessage(); + QSingleSignerPtr signer{nullptr}; + if(((int)ENUNCHUCK::SignerType::SOFTWARE == it.data()->signerType()) + || (int)ENUNCHUCK::SignerType::HARDWARE == it.data()->signerType() + || (int)ENUNCHUCK::SignerType::NFC == it.data()->signerType()){ + if (AppModel::instance()->getIsPremiumUser() && (int)ENUNCHUCK::SignerType::NFC == it.data()->signerType()) { + signer = bridge::nunchukGetDefaultSignerFromMasterSigner(it.data()->masterSignerId(), + walletType, + addressType, + warningmsg); + } + else { + signer = bridge::nunchukGetUnusedSignerFromMasterSigner(it.data()->masterSignerId(), + walletType, + addressType, + warningmsg); + } + + if(signer && warningmsg.type() == (int)EWARNING::WarningType::NONE_MSG){ + AppModel::instance()->newWalletInfo()->singleSignersAssigned()->replaceSingleSigner(msg.toInt(), signer); + AppModel::instance()->showToast(0, + STR_CPP_097, + EWARNING::WarningType::SUCCESS_MSG, + STR_CPP_097); + } + else{ + it.data()->setNeedTopUpXpub(true); + AppModel::instance()->showToast(warningmsg.code(), + warningmsg.what(), + (EWARNING::WarningType)warningmsg.type(), + STR_CPP_069.arg(it.data()->masterFingerPrint().toUpper())); + } + } } else{ - it.data()->setNeedTopUpXpub(true); AppModel::instance()->showToast(warningmsg.code(), warningmsg.what(), (EWARNING::WarningType)warningmsg.type(), - STR_CPP_069.arg(it.data()->masterFingerPrint().toUpper())); + STR_CPP_070.arg(it.data()->masterFingerPrint().toUpper())); } } - else{ - AppModel::instance()->showToast(warningmsg.code(), - warningmsg.what(), - (EWARNING::WarningType)warningmsg.type(), - STR_CPP_070.arg(it.data()->masterFingerPrint().toUpper())); - } } if(AppModel::instance()->newWalletInfo()){ bool needTopUp = AppModel::instance()->newWalletInfo()->singleSignersAssigned()->needTopUpXpubs(); diff --git a/Views/STATE_ID_SCR_ADD_WALLET_SIGNER_CONFIGURATION.cpp b/Views/STATE_ID_SCR_ADD_WALLET_SIGNER_CONFIGURATION.cpp index fb65a034..9d7889c8 100644 --- a/Views/STATE_ID_SCR_ADD_WALLET_SIGNER_CONFIGURATION.cpp +++ b/Views/STATE_ID_SCR_ADD_WALLET_SIGNER_CONFIGURATION.cpp @@ -45,6 +45,7 @@ void EVT_SIGNER_CONFIGURATION_SELECT_MASTER_SIGNER_HANDLER(QVariant msg) { signer.data()->setDevicetype(ret.data()->device()->type()); signer.data()->setCardId(ret.data()->device()->cardId()); signer.data()->setMasterFingerPrint(ret.data()->fingerPrint()); + signer.data()->setDerivationPath(ret.data()->device()->path()); if(signer){ AppModel::instance()->newWalletInfo()->singleSignersAssigned()->addSingleSigner(signer); } @@ -113,35 +114,36 @@ void EVT_SIGNER_CONFIGURATION_TRY_REVIEW_HANDLER(QVariant msg) { DBG_INFO << msg; if(AppModel::instance()->newWalletInfo() && AppModel::instance()->newWalletInfo()->singleSignersAssigned()){ int numberSignerRequired = AppModel::instance()->newWalletInfo()->n(); - DBG_INFO << "numberSignerRequired " << numberSignerRequired; bool escrow = AppModel::instance()->newWalletInfo()->escrow(); ENUNCHUCK::WalletType walletType = escrow ? ENUNCHUCK::WalletType::ESCROW : numberSignerRequired > 1 ? ENUNCHUCK::WalletType::MULTI_SIG : ENUNCHUCK::WalletType::SINGLE_SIG; ENUNCHUCK::AddressType addressType = (ENUNCHUCK::AddressType)AppModel::instance()->newWalletInfo()->addressType().toInt(); - DBG_INFO << "addressType " << (int)addressType; for (int i = 0; i < AppModel::instance()->newWalletInfo()->singleSignersAssigned()->rowCount(); i++) { QSingleSignerPtr it = AppModel::instance()->newWalletInfo()->singleSignersAssigned()->getSingleSignerByIndex(i); - DBG_INFO << "signerType " << it.data()->signerType() << it.data()->isPrimaryKey(); - if(it && !((int)ENUNCHUCK::SignerType::AIRGAP == it.data()->signerType())){ - if(!(it.data()->needTopUpXpub())){ - // Request cached xpub - QWarningMessage warningmsg; - QSingleSignerPtr signer = bridge::nunchukGetUnusedSignerFromMasterSigner(it.data()->masterSignerId(), - walletType, - addressType, - warningmsg); - if(signer && warningmsg.type() == (int)EWARNING::WarningType::NONE_MSG){ - signer.data()->setIsPrimaryKey(it.data()->isPrimaryKey()); - AppModel::instance()->newWalletInfo()->singleSignersAssigned()->replaceSingleSigner(i, signer); - AppModel::instance()->showToast(0, - STR_CPP_067, - EWARNING::WarningType::SUCCESS_MSG, - STR_CPP_067); - } - else{ - it.data()->setNeedTopUpXpub(true); - } + if((it && (int)ENUNCHUCK::SignerType::SOFTWARE == it.data()->signerType()) + || (int)ENUNCHUCK::SignerType::HARDWARE == it.data()->signerType() + || (int)ENUNCHUCK::SignerType::NFC == it.data()->signerType()){ + QSingleSignerPtr signer{nullptr}; + QWarningMessage warningmsg; + if (AppModel::instance()->getIsPremiumUser() && (int)ENUNCHUCK::SignerType::NFC == it.data()->signerType()) { + signer = bridge::nunchukGetDefaultSignerFromMasterSigner(it.data()->masterSignerId(), + walletType, + addressType, + warningmsg); + } + else { + signer = bridge::nunchukGetUnusedSignerFromMasterSigner(it.data()->masterSignerId(), + walletType, + addressType, + warningmsg); + } + if(signer && warningmsg.type() == (int)EWARNING::WarningType::NONE_MSG){ + signer.data()->setIsPrimaryKey(it.data()->isPrimaryKey()); + AppModel::instance()->newWalletInfo()->singleSignersAssigned()->replaceSingleSigner(i, signer); + } + else{ + it.data()->setNeedTopUpXpub(true); } } } diff --git a/Views/STATE_ID_SCR_CONSOLIDATE_OUTPUT.cpp b/Views/STATE_ID_SCR_CONSOLIDATE_OUTPUT.cpp index 9a16a810..1cf96e16 100644 --- a/Views/STATE_ID_SCR_CONSOLIDATE_OUTPUT.cpp +++ b/Views/STATE_ID_SCR_CONSOLIDATE_OUTPUT.cpp @@ -67,7 +67,8 @@ void EVT_CONSOLIDATE_MAKE_TRANSACTION_HANDLER(QVariant msg) { it.data()->address(), it.data()->amountSats(), it.data()->height(), - it.data()->memo()); + it.data()->memo(), + it.data()->status()); } } } diff --git a/Views/STATE_ID_SCR_CREATE_TRANSACTION.cpp b/Views/STATE_ID_SCR_CREATE_TRANSACTION.cpp index 2ece3603..8656c934 100644 --- a/Views/STATE_ID_SCR_CREATE_TRANSACTION.cpp +++ b/Views/STATE_ID_SCR_CREATE_TRANSACTION.cpp @@ -87,7 +87,8 @@ void EVT_CREATE_TRANSACTION_SIGN_REQUEST_HANDLER(QVariant msg) { it.data()->address(), it.data()->amountSats(), it.data()->height(), - it.data()->memo()); + it.data()->memo(), + it.data()->status()); } } } @@ -208,7 +209,8 @@ void EVT_CREATE_TRANSACTION_MAKE_DRAFT_TX_HANDLER(QVariant msg) { it.data()->address(), it.data()->amountSats(), it.data()->height(), - it.data()->memo()); + it.data()->memo(), + it.data()->status()); } } } diff --git a/Views/STATE_ID_SCR_EDIT_YOUR_INHERITANCE_PLAN.cpp b/Views/STATE_ID_SCR_EDIT_YOUR_INHERITANCE_PLAN.cpp new file mode 100644 index 00000000..4173cb76 --- /dev/null +++ b/Views/STATE_ID_SCR_EDIT_YOUR_INHERITANCE_PLAN.cpp @@ -0,0 +1,51 @@ +/************************************************************************* +* This file is part of the Nunchuk software (https://nunchuk.io/) * +* Copyright (C) 2020-2022 Enigmo * +* Copyright (C) 2022 Nunchuk * +* * +* This program is free software; you can redistribute it and/or * +* modify it under the terms of the GNU General Public License * +* as published by the Free Software Foundation; either version 3 * +* of the License, or (at your option) any later version. * +* * +* This program is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; without even the implied warranty of * +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +* GNU General Public License for more details. * +* * +* You should have received a copy of the GNU General Public License * +* along with this program. If not, see . * +* * +**************************************************************************/ + + +#include "STATE_ID_SCR_EDIT_YOUR_INHERITANCE_PLAN.h" + +void SCR_EDIT_YOUR_INHERITANCE_PLAN_Entry(QVariant msg) { + +} + +void SCR_EDIT_YOUR_INHERITANCE_PLAN_Exit(QVariant msg) { + +} + +void EVT_UPDATE_ACTIVATION_DATE_REQUEST_HANDLER(QVariant msg) { + +} + +void EVT_UPDATE_MESSAGE_REQUEST_HANDLER(QVariant msg) { + +} + +void EVT_UPDATE_BUFFER_PERIOD_REQUEST_HANDLER(QVariant msg) { + +} + +void EVT_UPDATE_NOTIFICATION_PREFERENCE_REQ_HANDLER(QVariant msg) { + +} + +void EVT_NOT_UPDATE_ANY_NOTI_REQ_HANDLER(QVariant msg) { + +} + diff --git a/Views/STATE_ID_SCR_EDIT_YOUR_INHERITANCE_PLAN.h b/Views/STATE_ID_SCR_EDIT_YOUR_INHERITANCE_PLAN.h new file mode 100644 index 00000000..44b5a46b --- /dev/null +++ b/Views/STATE_ID_SCR_EDIT_YOUR_INHERITANCE_PLAN.h @@ -0,0 +1,38 @@ +/************************************************************************* +* This file is part of the Nunchuk software (https://nunchuk.io/) * +* Copyright (C) 2020-2022 Enigmo * +* Copyright (C) 2022 Nunchuk * +* * +* This program is free software; you can redistribute it and/or * +* modify it under the terms of the GNU General Public License * +* as published by the Free Software Foundation; either version 3 * +* of the License, or (at your option) any later version. * +* * +* This program is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; without even the implied warranty of * +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +* GNU General Public License for more details. * +* * +* You should have received a copy of the GNU General Public License * +* along with this program. If not, see . * +* * +**************************************************************************/ + + +#ifndef STATE_ID_SCR_EDIT_YOUR_INHERITANCE_PLAN_H +#define STATE_ID_SCR_EDIT_YOUR_INHERITANCE_PLAN_H + +#include +#include +#include "ViewsDefines.h" +#include "ViewsEnums.h" + +void SCR_EDIT_YOUR_INHERITANCE_PLAN_Entry(QVariant msg); +void SCR_EDIT_YOUR_INHERITANCE_PLAN_Exit(QVariant msg); +void EVT_UPDATE_ACTIVATION_DATE_REQUEST_HANDLER(QVariant msg); +void EVT_UPDATE_MESSAGE_REQUEST_HANDLER(QVariant msg); +void EVT_UPDATE_BUFFER_PERIOD_REQUEST_HANDLER(QVariant msg); +void EVT_UPDATE_NOTIFICATION_PREFERENCE_REQ_HANDLER(QVariant msg); +void EVT_NOT_UPDATE_ANY_NOTI_REQ_HANDLER(QVariant msg); + +#endif // STATE_ID_SCR_EDIT_YOUR_INHERITANCE_PLAN_H diff --git a/Views/STATE_ID_SCR_HOME.cpp b/Views/STATE_ID_SCR_HOME.cpp index c7c2a377..c60724af 100644 --- a/Views/STATE_ID_SCR_HOME.cpp +++ b/Views/STATE_ID_SCR_HOME.cpp @@ -141,10 +141,11 @@ void EVT_HOME_ADD_NEW_SIGNER_REQUEST_HANDLER(QVariant msg) { void EVT_HOME_IMPORT_PSBT_HANDLER(QVariant msg) { QString file_path = qUtils::QGetFilePath(msg.toString()); - if (file_path != "" && AppModel::instance()->walletInfo()){ - QString wallet_id = AppModel::instance()->walletInfo()->id(); + QWalletPtr w = AppModel::instance()->walletInfoPtr(); + if (file_path != "" && w){ + QString wallet_id = w->id(); QWarningMessage msgwarning; - QTransactionPtr trans = bridge::nunchukImportTransaction(wallet_id, file_path, msgwarning); + QTransactionPtr trans = bridge::nunchukImportTransaction(wallet_id, file_path, w->isAssistedWallet(), msgwarning); if((int)EWARNING::WarningType::NONE_MSG == msgwarning.type()){ if(trans){ AppModel::instance()->setTransactionInfo(trans); @@ -190,12 +191,20 @@ void EVT_HOME_COLDCARD_NFC_SIGNER_INFO_REQUEST_HANDLER(QVariant msg) { } void EVT_ASK_LEDGER_REQ_HANDLER(QVariant msg) { - } +void EVT_ASK_TREZOR_REQ_HANDLER(QVariant msg) { +} +void EVT_ASK_COLDCARD_REQ_HANDLER(QVariant msg) +{ +} -void EVT_ASK_TREZOR_REQ_HANDLER(QVariant msg) { +void EVT_EXIST_LEDGER_REQ_HANDLER(QVariant msg) { +} +void EVT_EXIST_TREZOR_REQ_HANDLER(QVariant msg) { } +void EVT_EXIST_COLDCARD_REQ_HANDLER(QVariant msg) { +} diff --git a/Views/STATE_ID_SCR_HOME.h b/Views/STATE_ID_SCR_HOME.h index d70e47f0..8a34aa68 100644 --- a/Views/STATE_ID_SCR_HOME.h +++ b/Views/STATE_ID_SCR_HOME.h @@ -47,5 +47,9 @@ void EVT_HOME_ADD_NEW_SIGNER_REQUEST_HANDLER(QVariant msg); void EVT_HOME_COLDCARD_NFC_SIGNER_INFO_REQUEST_HANDLER(QVariant msg); void EVT_ASK_LEDGER_REQ_HANDLER(QVariant msg); void EVT_ASK_TREZOR_REQ_HANDLER(QVariant msg); +void EVT_ASK_COLDCARD_REQ_HANDLER(QVariant msg); +void EVT_EXIST_LEDGER_REQ_HANDLER(QVariant msg); +void EVT_EXIST_TREZOR_REQ_HANDLER(QVariant msg); +void EVT_EXIST_COLDCARD_REQ_HANDLER(QVariant msg); #endif // STATE_ID_SCR_HOME_H diff --git a/Views/STATE_ID_SCR_REENTER_YOUR_PASSWORD.cpp b/Views/STATE_ID_SCR_REENTER_YOUR_PASSWORD.cpp index 9a77bd6b..f478015d 100644 --- a/Views/STATE_ID_SCR_REENTER_YOUR_PASSWORD.cpp +++ b/Views/STATE_ID_SCR_REENTER_YOUR_PASSWORD.cpp @@ -21,6 +21,7 @@ #include "QQuickViewer.h" #include "Draco.h" #include "Chats/QUserWallets.h" +#include "ServiceSetting.h" static QVariant passWordObject = QVariant(); void SCR_REENTER_YOUR_PASSWORD_Entry(QVariant msg) { @@ -76,6 +77,13 @@ void EVT_INPUT_PASSWORD_REQUEST_HANDLER(QVariant msg) { } } break; + case E::STATE_ID_SCR_EDIT_YOUR_INHERITANCE_PLAN: { + QString walletName = passWordObject.toMap().value("walletName").toString(); + if (QUserWallets::instance()->requestInheritancePlanVerifyPassword(password)) { + ServiceSetting::instance()->setInheritanceWalletName(walletName); + QQuickViewer::instance()->sendEvent(E::EVT_CLOSE_TO_SERVICE_SETTINGS_REQUEST); + } + }break; default: break; } diff --git a/Views/STATE_ID_SCR_SERVICE_SETTINGS.cpp b/Views/STATE_ID_SCR_SERVICE_SETTINGS.cpp index 9702b239..92d53bd4 100644 --- a/Views/STATE_ID_SCR_SERVICE_SETTINGS.cpp +++ b/Views/STATE_ID_SCR_SERVICE_SETTINGS.cpp @@ -81,3 +81,36 @@ void EVT_CO_SIGNING_SERVER_KEY_UPDATE_SUCCEED_HANDLER(QVariant msg) QUserWallets::instance()->serverKeyUpdatePoliciesSucceed(); } } + +void EVT_EDIT_YOUR_INHERITANCE_PLAN_REQUEST_HANLDER(QVariant msg) { + ServiceSetting::instance()->setInheritancePlan(msg.toInt()); +} + +void EVT_SHARE_YOUR_SECRET_REQUEST_HANDLER(QVariant msg) { + +} + +void EVT_SERVICE_SELECT_WALLET_REQUEST_HANDLER(QVariant msg) { + QWalletPtr wallet = AppModel::instance()->walletList()->getWalletById(msg.toString()); + if (!wallet.isNull() && QUserWallets::instance()->inheritanceGetPlan(wallet->id())) { + QMap data; + data["state_id"] = E::STATE_ID_SCR_EDIT_YOUR_INHERITANCE_PLAN; + data["walletName"] = wallet->name(); + ServiceSetting::instance()->setInheritanceWalletId(wallet->id()); + QQuickViewer::instance()->sendEvent(E::EVT_REENTER_YOUR_PASSWORD_REQUEST, data); + } +} + +void EVT_INHERITANCE_PLAN_FINALIZE_REQUEST_HANDLER(QVariant msg) { + int option = msg.toInt(); + if (option == 2) { + emit QUserWallets::instance()->inheritanceDiscardChangeAlert(); + } else if(option == 1) { + QUserWallets::instance()->inheritancePlanFinalizeChanges(); + } else if(option == 3) { + if (QUserWallets::instance()->secQuesAnswer()) { + QUserWallets::instance()->inheritancePlanUpdate(); + } + } +} + diff --git a/Views/STATE_ID_SCR_SERVICE_SETTINGS.h b/Views/STATE_ID_SCR_SERVICE_SETTINGS.h index 39f69058..aa16316a 100644 --- a/Views/STATE_ID_SCR_SERVICE_SETTINGS.h +++ b/Views/STATE_ID_SCR_SERVICE_SETTINGS.h @@ -32,8 +32,12 @@ void SCR_SERVICE_SETTINGS_Exit(QVariant msg); void EVT_CLAIM_INHERITANCE_CHECK_REQUEST_HANDLER(QVariant msg); void EVT_CO_SIGNING_SERVER_KEY_UPDATE_REQUEST_HANDLER(QVariant msg); void EVT_CO_SIGNING_SERVER_KEY_UPDATE_SUCCEED_HANDLER(QVariant msg); +void EVT_SERVICE_SELECT_WALLET_REQUEST_HANDLER(QVariant msg); +void EVT_INHERITANCE_PLAN_FINALIZE_REQUEST_HANDLER(QVariant msg); void EVT_REENTER_YOUR_PASSWORD_REQUEST_HANDLER(QVariant msg); void EVT_SERVICE_SUPPORT_REQUEST_HANDLER(QVariant msg); void EVT_INHERITANCE_WITHDRAW_BALANCE_REQUEST_HANDLER(QVariant msg); +void EVT_EDIT_YOUR_INHERITANCE_PLAN_REQUEST_HANLDER(QVariant msg); +void EVT_SHARE_YOUR_SECRET_REQUEST_HANDLER(QVariant msg); #endif // STATE_ID_SCR_SERVICE_SETTINGS_H diff --git a/Views/STATE_ID_SCR_SHARE_YOUR_SECRETS.cpp b/Views/STATE_ID_SCR_SHARE_YOUR_SECRETS.cpp new file mode 100644 index 00000000..4d98136c --- /dev/null +++ b/Views/STATE_ID_SCR_SHARE_YOUR_SECRETS.cpp @@ -0,0 +1,35 @@ +/************************************************************************* +* This file is part of the Nunchuk software (https://nunchuk.io/) * +* Copyright (C) 2020-2022 Enigmo * +* Copyright (C) 2022 Nunchuk * +* * +* This program is free software; you can redistribute it and/or * +* modify it under the terms of the GNU General Public License * +* as published by the Free Software Foundation; either version 3 * +* of the License, or (at your option) any later version. * +* * +* This program is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; without even the implied warranty of * +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +* GNU General Public License for more details. * +* * +* You should have received a copy of the GNU General Public License * +* along with this program. If not, see . * +* * +**************************************************************************/ + + +#include "STATE_ID_SCR_SHARE_YOUR_SECRETS.h" + +void SCR_SHARE_YOUR_SECRETS_Entry(QVariant msg) { + +} + +void SCR_SHARE_YOUR_SECRETS_Exit(QVariant msg) { + +} + +void EVT_UPDATE_YOUR_SECRET_REQUEST_HANDLER(QVariant msg) { + +} + diff --git a/Views/STATE_ID_SCR_SHARE_YOUR_SECRETS.h b/Views/STATE_ID_SCR_SHARE_YOUR_SECRETS.h new file mode 100644 index 00000000..cc63b075 --- /dev/null +++ b/Views/STATE_ID_SCR_SHARE_YOUR_SECRETS.h @@ -0,0 +1,34 @@ +/************************************************************************* +* This file is part of the Nunchuk software (https://nunchuk.io/) * +* Copyright (C) 2020-2022 Enigmo * +* Copyright (C) 2022 Nunchuk * +* * +* This program is free software; you can redistribute it and/or * +* modify it under the terms of the GNU General Public License * +* as published by the Free Software Foundation; either version 3 * +* of the License, or (at your option) any later version. * +* * +* This program is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; without even the implied warranty of * +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +* GNU General Public License for more details. * +* * +* You should have received a copy of the GNU General Public License * +* along with this program. If not, see . * +* * +**************************************************************************/ + + +#ifndef STATE_ID_SCR_SHARE_YOUR_SECRETS_H +#define STATE_ID_SCR_SHARE_YOUR_SECRETS_H + +#include +#include +#include "ViewsDefines.h" +#include "ViewsEnums.h" + +void SCR_SHARE_YOUR_SECRETS_Entry(QVariant msg); +void SCR_SHARE_YOUR_SECRETS_Exit(QVariant msg); +void EVT_UPDATE_YOUR_SECRET_REQUEST_HANDLER(QVariant msg); + +#endif // STATE_ID_SCR_SHARE_YOUR_SECRETS_H diff --git a/Views/STATE_ID_SCR_TRANSACTION_INFO.cpp b/Views/STATE_ID_SCR_TRANSACTION_INFO.cpp index a219eb9d..d90f7f7f 100644 --- a/Views/STATE_ID_SCR_TRANSACTION_INFO.cpp +++ b/Views/STATE_ID_SCR_TRANSACTION_INFO.cpp @@ -111,10 +111,11 @@ void EVT_TRANSACTION_EXPORT_REQUEST_HANDLER(QVariant msg) { void EVT_TRANSACTION_IMPORT_REQUEST_HANDLER(QVariant msg) { QString file_path = qUtils::QGetFilePath(msg.toString()); - if (file_path != "" && AppModel::instance()->walletInfo()){ - QString wallet_id = AppModel::instance()->walletInfo()->id(); + QWalletPtr w = AppModel::instance()->walletInfoPtr(); + if (file_path != "" && w){ + QString wallet_id = w->id(); QWarningMessage msgwarning; - QTransactionPtr trans = bridge::nunchukImportTransaction(wallet_id, file_path, msgwarning); + QTransactionPtr trans = bridge::nunchukImportTransaction(wallet_id, file_path, w->isAssistedWallet(), msgwarning); if(trans){ AppModel::instance()->setTransactionInfo(trans); AppModel::instance()->requestSyncWalletDb(wallet_id); diff --git a/Views/STATE_ID_SCR_WALLET_INFO.cpp b/Views/STATE_ID_SCR_WALLET_INFO.cpp index e6820fc4..6db7fbca 100644 --- a/Views/STATE_ID_SCR_WALLET_INFO.cpp +++ b/Views/STATE_ID_SCR_WALLET_INFO.cpp @@ -41,7 +41,7 @@ void EVT_WALLET_INFO_EDIT_NAME_HANDLER(QVariant msg) { AppModel::instance()->walletList()->updateName(AppModel::instance()->walletInfo()->id(), msg.toString()); if(AppModel::instance()->walletList()){ QString wallet_id = AppModel::instance()->walletInfo()->id(); - AppModel::instance()->walletList()->requestSort(WalletListModel::WalletRoles::wallet_Name_Role, Qt::AscendingOrder); + AppModel::instance()->walletList()->requestSort(WalletListModel::WalletRoles::wallet_createDate_Role, Qt::AscendingOrder); int index = AppModel::instance()->walletList()->getWalletIndexById(wallet_id); if(-1 != index){ AppModel::instance()->setWalletListCurrentIndex(index); @@ -222,10 +222,11 @@ void EVT_WALLET_INFO_EXPORT_QRCODE_HANDLER(QVariant msg) { void EVT_WALLET_INFO_IMPORT_PSBT_HANDLER(QVariant msg) { QString file_path = qUtils::QGetFilePath(msg.toString()); - if (file_path != "" && AppModel::instance()->walletInfo()){ - QString wallet_id = AppModel::instance()->walletInfo()->id(); + QWalletPtr w = AppModel::instance()->walletInfoPtr(); + if (file_path != "" && w){ + QString wallet_id = w->id(); QWarningMessage msgwarning; - QTransactionPtr trans = bridge::nunchukImportTransaction(wallet_id, file_path, msgwarning); + QTransactionPtr trans = bridge::nunchukImportTransaction(wallet_id, file_path, w->isAssistedWallet(), msgwarning); if((int)EWARNING::WarningType::NONE_MSG == msgwarning.type()){ if(trans){ AppModel::instance()->setTransactionInfo(trans); @@ -258,6 +259,7 @@ void EVT_WALLET_INFO_GAP_LIMIT_REQUEST_HANDLER(QVariant msg) if (AppModel::instance()->walletInfo()){ QString wallet_id = AppModel::instance()->walletInfo()->id(); uint gap_limit = msg.toUInt(); - bridge::nunchukUpdateWalletGapLimit(wallet_id,gap_limit); + bridge::nunchukUpdateWalletGapLimit(wallet_id, gap_limit); + AppModel::instance()->walletInfo()->setGapLimit(gap_limit); } } diff --git a/Views/Views.h b/Views/Views.h index a1835889..5bc0aed2 100644 --- a/Views/Views.h +++ b/Views/Views.h @@ -101,6 +101,13 @@ static const APPLICATION_STATE STATE_ID_SCR_ADD_TREZOR_ASK static const APPLICATION_STATE STATE_ID_SCR_ADD_LEDGER = {E::STATE_ID_SCR_ADD_LEDGER , SCR_ADD_LEDGER_Entry , SCR_ADD_LEDGER_Exit , LAYER::LAYER_ONSCREEN, LIMIT::NONE , SCR_ADD_LEDGER }; static const APPLICATION_STATE STATE_ID_SCR_ADD_TREZOR = {E::STATE_ID_SCR_ADD_TREZOR , SCR_ADD_TREZOR_Entry , SCR_ADD_TREZOR_Exit , LAYER::LAYER_ONSCREEN, LIMIT::NONE , SCR_ADD_TREZOR }; static const APPLICATION_STATE STATE_ID_SCR_SELECT_WALLET_CO_SIGN_POLICE = {E::STATE_ID_SCR_SELECT_WALLET_CO_SIGN_POLICE , SCR_SELECT_WALLET_CO_SIGN_POLICE_Entry , SCR_SELECT_WALLET_CO_SIGN_POLICE_Exit , LAYER::LAYER_ONSCREEN, LIMIT::NONE , SCR_SELECT_WALLET_CO_SIGN_POLICE }; +static const APPLICATION_STATE STATE_ID_SCR_EDIT_YOUR_INHERITANCE_PLAN = {E::STATE_ID_SCR_EDIT_YOUR_INHERITANCE_PLAN , SCR_EDIT_YOUR_INHERITANCE_PLAN_Entry , SCR_EDIT_YOUR_INHERITANCE_PLAN_Exit , LAYER::LAYER_ONSCREEN, LIMIT::NONE , SCR_EDIT_YOUR_INHERITANCE_PLAN }; +static const APPLICATION_STATE STATE_ID_SCR_SHARE_YOUR_SECRETS = {E::STATE_ID_SCR_SHARE_YOUR_SECRETS , SCR_SHARE_YOUR_SECRETS_Entry , SCR_SHARE_YOUR_SECRETS_Exit , LAYER::LAYER_ONSCREEN, LIMIT::NONE , SCR_SHARE_YOUR_SECRETS }; +static const APPLICATION_STATE STATE_ID_SCR_ADD_COLDCARD_ASK = {E::STATE_ID_SCR_ADD_COLDCARD_ASK , SCR_ADD_COLDCARD_ASK_Entry , SCR_ADD_COLDCARD_ASK_Exit , LAYER::LAYER_ONSCREEN, LIMIT::NONE , SCR_ADD_COLDCARD_ASK }; +static const APPLICATION_STATE STATE_ID_SCR_ADD_COLDCARD = {E::STATE_ID_SCR_ADD_COLDCARD , SCR_ADD_COLDCARD_Entry , SCR_ADD_COLDCARD_Exit , LAYER::LAYER_ONSCREEN, LIMIT::NONE , SCR_ADD_COLDCARD }; +static const APPLICATION_STATE STATE_ID_SCR_ADD_LEDGER_EXIST = {E::STATE_ID_SCR_ADD_LEDGER_EXIST , SCR_ADD_LEDGER_EXIST_Entry , SCR_ADD_LEDGER_EXIST_Exit , LAYER::LAYER_ONSCREEN, LIMIT::NONE , SCR_ADD_LEDGER_EXIST }; +static const APPLICATION_STATE STATE_ID_SCR_ADD_TREZOR_EXIST = {E::STATE_ID_SCR_ADD_TREZOR_EXIST , SCR_ADD_TREZOR_EXIST_Entry , SCR_ADD_TREZOR_EXIST_Exit , LAYER::LAYER_ONSCREEN, LIMIT::NONE , SCR_ADD_TREZOR_EXIST }; +static const APPLICATION_STATE STATE_ID_SCR_ADD_COLDCARD_EXIST = {E::STATE_ID_SCR_ADD_COLDCARD_EXIST , SCR_ADD_COLDCARD_EXIST_Entry , SCR_ADD_COLDCARD_EXIST_Exit , LAYER::LAYER_ONSCREEN, LIMIT::NONE , SCR_ADD_COLDCARD_EXIST }; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// static const STATE_TRIGGER STATE_ID_ROOT_trigger[25] = @@ -135,6 +142,32 @@ static const STATE_TRIGGER STATE_ID_ROOT_trigger[25] = //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +static const STATE_TRIGGER STATE_ID_SCR_ADD_COLDCARD_trigger[2] = +{ + {E::EVT_SCAN_COLDCARD_DEVICE_REQUEST, EVT_SCAN_COLDCARD_DEVICE_REQUEST_HANDLER, NULL }, + {E::EVT_ADD_COLDCARD_DEVICE_REQUEST , EVT_ADD_COLDCARD_DEVICE_REQUEST_HANDLER , NULL }, +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +static const STATE_TRIGGER STATE_ID_SCR_ADD_COLDCARD_ASK_trigger[1] = +{ + {E::EVT_ADD_COLDCARD_REQUEST, EVT_ADD_COLDCARD_REQUEST_HANDLER, &STATE_ID_SCR_ADD_COLDCARD }, +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +static const STATE_TRIGGER STATE_ID_SCR_ADD_COLDCARD_EXIST_trigger[2] = +{ + {E::EVT_ADD_EXIST_COLDCARD_REQUEST, EVT_ADD_EXIST_COLDCARD_REQUEST_HANDLER, NULL }, + {E::EVT_ADD_NEW_COLDCARD_REQUEST , EVT_ADD_NEW_COLDCARD_REQUEST_HANDLER , &STATE_ID_SCR_ADD_COLDCARD }, +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + static const STATE_TRIGGER STATE_ID_SCR_ADD_HARDWARE_SIGNER_trigger[8] = { {E::EVT_ADD_HARDWARE_SIGNER_ADD_MASTER_SIGNER_REQUEST, EVT_ADD_HARDWARE_SIGNER_ADD_MASTER_SIGNER_REQUEST_HANDLER, NULL }, @@ -182,6 +215,15 @@ static const STATE_TRIGGER STATE_ID_SCR_ADD_LEDGER_ASK_trigger[1] = //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +static const STATE_TRIGGER STATE_ID_SCR_ADD_LEDGER_EXIST_trigger[2] = +{ + {E::EVT_ADD_EXIST_LEDGER_REQUEST, EVT_ADD_EXIST_LEDGER_REQUEST_HANDLER, NULL }, + {E::EVT_ADD_NEW_LEDGER_REQUEST , EVT_ADD_NEW_LEDGER_REQUEST_HANDLER , &STATE_ID_SCR_ADD_LEDGER }, +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + static const STATE_TRIGGER STATE_ID_SCR_ADD_MASTER_SIGNER_RESULT_trigger[6] = { {E::EVT_ADD_MASTER_SIGNER_RESULT_RUN_HEALTHCHECK , EVT_ADD_MASTER_SIGNER_RESULT_RUN_HEALTHCHECK_HANDLER , NULL }, @@ -260,6 +302,15 @@ static const STATE_TRIGGER STATE_ID_SCR_ADD_TREZOR_ASK_trigger[1] = //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +static const STATE_TRIGGER STATE_ID_SCR_ADD_TREZOR_EXIST_trigger[2] = +{ + {E::EVT_ADD_EXIST_TREZOR_REQUEST, EVT_ADD_EXIST_TREZOR_REQUEST_HANDLER, NULL }, + {E::EVT_ADD_NEW_TREZOR_REQUEST , EVT_ADD_NEW_TREZOR_REQUEST_HANDLER , &STATE_ID_SCR_ADD_TREZOR }, +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + static const STATE_TRIGGER STATE_ID_SCR_ADD_WALLET_trigger[4] = { {E::EVT_ADD_WALLET_IMPORT , EVT_ADD_WALLET_IMPORT_HANDLER , NULL }, @@ -429,6 +480,18 @@ static const STATE_TRIGGER STATE_ID_SCR_DUMMY_TRANSACTION_INFO_trigger[7] = //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +static const STATE_TRIGGER STATE_ID_SCR_EDIT_YOUR_INHERITANCE_PLAN_trigger[5] = +{ + {E::EVT_UPDATE_ACTIVATION_DATE_REQUEST , EVT_UPDATE_ACTIVATION_DATE_REQUEST_HANDLER , NULL }, + {E::EVT_UPDATE_MESSAGE_REQUEST , EVT_UPDATE_MESSAGE_REQUEST_HANDLER , NULL }, + {E::EVT_UPDATE_BUFFER_PERIOD_REQUEST , EVT_UPDATE_BUFFER_PERIOD_REQUEST_HANDLER , NULL }, + {E::EVT_UPDATE_NOTIFICATION_PREFERENCE_REQ, EVT_UPDATE_NOTIFICATION_PREFERENCE_REQ_HANDLER, NULL }, + {E::EVT_NOT_UPDATE_ANY_NOTI_REQ , EVT_NOT_UPDATE_ANY_NOTI_REQ_HANDLER , NULL }, +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + static const STATE_TRIGGER STATE_ID_SCR_ENTER_BACKUP_PASSWORD_trigger[3] = { {E::EVT_INPUT_BACKUP_PASSWORD_REQUEST , EVT_INPUT_BACKUP_PASSWORD_REQUEST_HANDLER , NULL }, @@ -439,7 +502,7 @@ static const STATE_TRIGGER STATE_ID_SCR_ENTER_BACKUP_PASSWORD_trigger[3] = //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -static const STATE_TRIGGER STATE_ID_SCR_HOME_trigger[18] = +static const STATE_TRIGGER STATE_ID_SCR_HOME_trigger[22] = { {E::EVT_HOME_WALLET_SELECTED , EVT_HOME_WALLET_SELECTED_HANDLER , NULL }, {E::EVT_HOME_WALLET_COPY_ADDRESS , EVT_HOME_WALLET_COPY_ADDRESS_HANDLER , NULL }, @@ -459,6 +522,10 @@ static const STATE_TRIGGER STATE_ID_SCR_HOME_trigger[18] = {E::EVT_HOME_COLDCARD_NFC_SIGNER_INFO_REQUEST, EVT_HOME_COLDCARD_NFC_SIGNER_INFO_REQUEST_HANDLER, &STATE_ID_SCR_MASTER_SIGNER_INFO }, {E::EVT_ASK_LEDGER_REQ , EVT_ASK_LEDGER_REQ_HANDLER , &STATE_ID_SCR_ADD_LEDGER_ASK }, {E::EVT_ASK_TREZOR_REQ , EVT_ASK_TREZOR_REQ_HANDLER , &STATE_ID_SCR_ADD_TREZOR_ASK }, + {E::EVT_EXIST_LEDGER_REQ , EVT_EXIST_LEDGER_REQ_HANDLER , &STATE_ID_SCR_ADD_LEDGER_EXIST }, + {E::EVT_EXIST_TREZOR_REQ , EVT_EXIST_TREZOR_REQ_HANDLER , &STATE_ID_SCR_ADD_TREZOR_EXIST }, + {E::EVT_EXIST_COLDCARD_REQ , EVT_EXIST_COLDCARD_REQ_HANDLER , &STATE_ID_SCR_ADD_COLDCARD_EXIST }, + {E::EVT_ASK_COLDCARD_REQ , EVT_ASK_COLDCARD_REQ_HANDLER , &STATE_ID_SCR_ADD_COLDCARD_ASK }, }; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -770,14 +837,18 @@ static const STATE_TRIGGER STATE_ID_SCR_SEND_trigger[5] = //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -static const STATE_TRIGGER STATE_ID_SCR_SERVICE_SETTINGS_trigger[6] = +static const STATE_TRIGGER STATE_ID_SCR_SERVICE_SETTINGS_trigger[10] = { {E::EVT_CLAIM_INHERITANCE_CHECK_REQUEST , EVT_CLAIM_INHERITANCE_CHECK_REQUEST_HANDLER , NULL }, {E::EVT_CO_SIGNING_SERVER_KEY_UPDATE_REQUEST, EVT_CO_SIGNING_SERVER_KEY_UPDATE_REQUEST_HANDLER, NULL }, {E::EVT_CO_SIGNING_SERVER_KEY_UPDATE_SUCCEED, EVT_CO_SIGNING_SERVER_KEY_UPDATE_SUCCEED_HANDLER, NULL }, + {E::EVT_SERVICE_SELECT_WALLET_REQUEST , EVT_SERVICE_SELECT_WALLET_REQUEST_HANDLER , NULL }, + {E::EVT_INHERITANCE_PLAN_FINALIZE_REQUEST , EVT_INHERITANCE_PLAN_FINALIZE_REQUEST_HANDLER , NULL }, {E::EVT_REENTER_YOUR_PASSWORD_REQUEST , EVT_REENTER_YOUR_PASSWORD_REQUEST_HANDLER , &STATE_ID_SCR_REENTER_YOUR_PASSWORD }, {E::EVT_SERVICE_SUPPORT_REQUEST , EVT_SERVICE_SUPPORT_REQUEST_HANDLER , &STATE_ID_SCR_HOME_ONLINE }, {E::EVT_INHERITANCE_WITHDRAW_BALANCE_REQUEST, EVT_INHERITANCE_WITHDRAW_BALANCE_REQUEST_HANDLER, &STATE_ID_SCR_INHERITANCE_WITHDRAW_BALANCE }, + {E::EVT_EDIT_YOUR_INHERITANCE_PLAN_REQUEST , EVT_EDIT_YOUR_INHERITANCE_PLAN_REQUEST_HANLDER , &STATE_ID_SCR_EDIT_YOUR_INHERITANCE_PLAN }, + {E::EVT_SHARE_YOUR_SECRET_REQUEST , EVT_SHARE_YOUR_SECRET_REQUEST_HANDLER , &STATE_ID_SCR_SHARE_YOUR_SECRETS }, }; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -811,6 +882,14 @@ static const STATE_TRIGGER STATE_ID_SCR_SHARED_WL_DEVICE_REGISTRATION_trigger[4] //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +static const STATE_TRIGGER STATE_ID_SCR_SHARE_YOUR_SECRETS_trigger[1] = +{ + {E::EVT_UPDATE_YOUR_SECRET_REQUEST, EVT_UPDATE_YOUR_SECRET_REQUEST_HANDLER, NULL }, +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + static const STATE_TRIGGER STATE_ID_SCR_SIGN_IN_trigger[3] = { {E::EVT_SIGN_IN_PASSWORD_REQUEST , EVT_SIGN_IN_PASSWORD_REQUEST_HANDLER , NULL }, @@ -991,7 +1070,7 @@ static const STATE_TRIGGER STATE_ID_TOAST_MESSAGE_DISPLAY_trigger[1] = //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -static const STATE_SYSTEM STATE_ALL[73] = +static const STATE_SYSTEM STATE_ALL[80] = { {E::STATE_ID_ROOT , STATE_ID_ROOT_trigger , ALEN(STATE_ID_ROOT_trigger) , &STATE_ID_ROOT }, {E::STATE_ID_SCR_HOME , STATE_ID_SCR_HOME_trigger , ALEN(STATE_ID_SCR_HOME_trigger) , &STATE_ID_SCR_HOME }, @@ -1066,6 +1145,13 @@ static const STATE_SYSTEM STATE_ALL[73] = {E::STATE_ID_SCR_ADD_LEDGER , STATE_ID_SCR_ADD_LEDGER_trigger , ALEN(STATE_ID_SCR_ADD_LEDGER_trigger) , &STATE_ID_SCR_ADD_LEDGER }, {E::STATE_ID_SCR_ADD_TREZOR , STATE_ID_SCR_ADD_TREZOR_trigger , ALEN(STATE_ID_SCR_ADD_TREZOR_trigger) , &STATE_ID_SCR_ADD_TREZOR }, {E::STATE_ID_SCR_SELECT_WALLET_CO_SIGN_POLICE , STATE_ID_SCR_SELECT_WALLET_CO_SIGN_POLICE_trigger , ALEN(STATE_ID_SCR_SELECT_WALLET_CO_SIGN_POLICE_trigger) , &STATE_ID_SCR_SELECT_WALLET_CO_SIGN_POLICE }, + {E::STATE_ID_SCR_EDIT_YOUR_INHERITANCE_PLAN , STATE_ID_SCR_EDIT_YOUR_INHERITANCE_PLAN_trigger , ALEN(STATE_ID_SCR_EDIT_YOUR_INHERITANCE_PLAN_trigger) , &STATE_ID_SCR_EDIT_YOUR_INHERITANCE_PLAN }, + {E::STATE_ID_SCR_SHARE_YOUR_SECRETS , STATE_ID_SCR_SHARE_YOUR_SECRETS_trigger , ALEN(STATE_ID_SCR_SHARE_YOUR_SECRETS_trigger) , &STATE_ID_SCR_SHARE_YOUR_SECRETS }, + {E::STATE_ID_SCR_ADD_COLDCARD_ASK , STATE_ID_SCR_ADD_COLDCARD_ASK_trigger , ALEN(STATE_ID_SCR_ADD_COLDCARD_ASK_trigger) , &STATE_ID_SCR_ADD_COLDCARD_ASK }, + {E::STATE_ID_SCR_ADD_COLDCARD , STATE_ID_SCR_ADD_COLDCARD_trigger , ALEN(STATE_ID_SCR_ADD_COLDCARD_trigger) , &STATE_ID_SCR_ADD_COLDCARD }, + {E::STATE_ID_SCR_ADD_LEDGER_EXIST , STATE_ID_SCR_ADD_LEDGER_EXIST_trigger , ALEN(STATE_ID_SCR_ADD_LEDGER_EXIST_trigger) , &STATE_ID_SCR_ADD_LEDGER_EXIST }, + {E::STATE_ID_SCR_ADD_TREZOR_EXIST , STATE_ID_SCR_ADD_TREZOR_EXIST_trigger , ALEN(STATE_ID_SCR_ADD_TREZOR_EXIST_trigger) , &STATE_ID_SCR_ADD_TREZOR_EXIST }, + {E::STATE_ID_SCR_ADD_COLDCARD_EXIST , STATE_ID_SCR_ADD_COLDCARD_EXIST_trigger , ALEN(STATE_ID_SCR_ADD_COLDCARD_EXIST_trigger) , &STATE_ID_SCR_ADD_COLDCARD_EXIST }, }; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/contrib/libnunchuk b/contrib/libnunchuk index 0b2e64eb..8a0fef6d 160000 --- a/contrib/libnunchuk +++ b/contrib/libnunchuk @@ -1 +1 @@ -Subproject commit 0b2e64ebe357a6f5245fe607f56baa1763f60acf +Subproject commit 8a0fef6d135ce8a8cd95a99494d86ac0b66c1878 diff --git a/ifaces/Chats/matrixbrigde.cpp b/ifaces/Chats/matrixbrigde.cpp index 5aa75ef4..650c4749 100644 --- a/ifaces/Chats/matrixbrigde.cpp +++ b/ifaces/Chats/matrixbrigde.cpp @@ -70,16 +70,8 @@ QNunchukMatrixEvent matrixbrigde::JoinWallet(const QString &room_id, QWarningMessage &msg) { if(signer){ - nunchuk::SingleSigner singlesinger(signer.data()->name().toStdString(), - signer.data()->xpub().toStdString(), - signer.data()->publickey().toStdString(), - signer.data()->derivationPath().toStdString(), - signer.data()->masterFingerPrint().toStdString(), - signer.data()->lastHealthCheckDateTime().toTime_t(), - signer.data()->masterSignerId().toStdString()); - singlesinger.set_type(nunchuk::SignerType(signer.data()->signerType())); nunchuk::NunchukMatrixEvent e = matrixifaces::instance()->JoinWallet(room_id.toStdString(), - singlesinger, + signer->originSingleSigner(), msg); return QNunchukMatrixEvent(e); } @@ -328,9 +320,6 @@ QRoomWalletPtr matrixbrigde::ReloadRoomWallet( QNunchukRoom * const room) for (SignerAssigned signer : ret.data()->walletSigners()->fullList()) { AppModel::instance()->walletList()->updateSignerOfRoomWallet(wallet_id, signer); } - if(AppModel::instance()->walletList()->rowCount() == 1){ - AppModel::instance()->setWalletListCurrentIndex(0); - } } } return ret; @@ -352,8 +341,7 @@ QRoomTransactionModelPtr matrixbrigde::GetPendingTransactions(const QString &roo { QWarningMessage msg; QRoomTransactionModelPtr ret = QRoomTransactionModelPtr(new QRoomTransactionModel()) ; - std::vector results = matrixifaces::instance()->GetPendingTransactions(room_id.toStdString(), - msg); + std::vector results = matrixifaces::instance()->GetPendingTransactions(room_id.toStdString(), msg); if((int)EWARNING::WarningType::NONE_MSG == msg.type()){ foreach (nunchuk::RoomTransaction room_tx, results) { QWarningMessage txWarning; diff --git a/ifaces/Draco.cpp b/ifaces/Draco.cpp index 5266b80d..b61c8345 100644 --- a/ifaces/Draco.cpp +++ b/ifaces/Draco.cpp @@ -70,10 +70,12 @@ Draco *Draco::instance() void Draco::refreshContacts() { - CLIENT_INSTANCE->syncContacts(getContacts()); - CLIENT_INSTANCE->syncContactsSent(getContactsSent()); - CLIENT_INSTANCE->syncContactsReceived(getContactsReceived()); - CLIENT_INSTANCE->syncDevices(getDevices()); + QtConcurrent::run([this]() { + CLIENT_INSTANCE->syncContacts(getContacts()); + CLIENT_INSTANCE->syncContactsSent(getContactsSent()); + CLIENT_INSTANCE->syncContactsReceived(getContactsReceived()); + CLIENT_INSTANCE->syncDevices(getDevices()); + }); } bool Draco::getCurrencies(QJsonObject &output, QString &errormsg) @@ -186,7 +188,6 @@ void Draco::verifyNewDevice(const QString &pin) this->setDracoToken(dataObj["tokenId"].toString()); this->setExpireSec(dataObj["expireInSeconds"].toInt()); this->getMe(); - this->getCurrentUserSubscription(); CLIENT_INSTANCE->setIsNewDevice(true); } emit verifyNewDeviceResult(reply_code, response_code, response_msg); @@ -252,14 +253,17 @@ void Draco::cancelFriendRequest(const QString &contact_id) QString reply_msg = ""; QJsonObject jsonObj = deleteSync(commands[CMD_IDX::CANCEL_REQUEST_FRIEND], data, reply_code, reply_msg); if(reply_code == DRACO_CODE::SUCCESSFULL){ +#if 0 //FIXME Performance QJsonObject errorObj = jsonObj["error"].toObject(); int response_code = errorObj["code"].toInt(); QString response_msg = errorObj["message"].toString(); +#endif } } QJsonObject Draco::postSync(const QString &cmd, QJsonObject data, int& reply_code, QString &reply_msg) { + FuncTime f(QString("POST %1").arg(cmd)); QJsonObject ret; qApp->setOverrideCursor(Qt::WaitCursor); std::unique_ptr manager(new QNetworkAccessManager); @@ -272,6 +276,8 @@ QJsonObject Draco::postSync(const QString &cmd, QJsonObject data, int& reply_cod requester_.setRawHeader("x-nc-app-version", qApp->applicationVersion().toUtf8()); requester_.setRawHeader("x-nc-device-class", "Desktop"); requester_.setRawHeader("x-nc-os-name", QSysInfo::productType().toUtf8()); + qint64 maximumBufferSize = 1024 * 1024; + requester_.setAttribute(QNetworkRequest::MaximumDownloadBufferSizeAttribute, maximumBufferSize); manager->setCookieJar(new QNetworkCookieJar(manager.get())); std::unique_ptr> reply(manager->post(requester_, QJsonDocument(data).toJson())); QEventLoop eventLoop; @@ -300,12 +306,22 @@ QJsonObject Draco::postSync(const QString &cmd, QJsonObject data, int& reply_cod return ret; } -QJsonObject Draco::postSync(const QString &cmd, QMap params, QJsonObject data, int &reply_code, QString &reply_msg) +QJsonObject Draco::postSync(const QString &cmd, QMap paramsQuery, QMap paramsHeader, QJsonObject data, int &reply_code, QString &reply_msg) { + FuncTime f(QString("POST %1").arg(cmd)); QJsonObject ret; qApp->setOverrideCursor(Qt::WaitCursor); std::unique_ptr manager(new QNetworkAccessManager); - QNetworkRequest requester_(QUrl::fromUserInput(commandByNetwork(cmd))); + QUrl url = QUrl::fromUserInput(commandByNetwork(cmd)); + if(!paramsQuery.isEmpty()){ + QUrlQuery params; + foreach(const QString& key, paramsQuery.keys()) { + QString value = paramsQuery.value(key); + params.addQueryItem(key, value); + } + url.setQuery(params); + } + QNetworkRequest requester_(url); QString headerData = QString("Bearer %1").arg(this->dracoToken()); requester_.setRawHeader("Authorization", headerData.toLocal8Bit()); requester_.setHeader(QNetworkRequest::ContentTypeHeader, "application/json"); @@ -314,9 +330,11 @@ QJsonObject Draco::postSync(const QString &cmd, QMap params, Q requester_.setRawHeader("x-nc-app-version", qApp->applicationVersion().toUtf8()); requester_.setRawHeader("x-nc-device-class", "Desktop"); requester_.setRawHeader("x-nc-os-name", QSysInfo::productType().toUtf8()); + qint64 maximumBufferSize = 1024 * 1024; + requester_.setAttribute(QNetworkRequest::MaximumDownloadBufferSizeAttribute, maximumBufferSize); // Add addional params - for(QString param : params.keys()) { - requester_.setRawHeader(QByteArray::fromStdString(param.toStdString()), QByteArray::fromStdString(params.value(param).toStdString())); + for(QString param : paramsHeader.keys()) { + requester_.setRawHeader(QByteArray::fromStdString(param.toStdString()), QByteArray::fromStdString(paramsHeader.value(param).toStdString())); } manager->setCookieJar(new QNetworkCookieJar(manager.get())); std::unique_ptr> reply(manager->post(requester_, QJsonDocument(data).toJson())); @@ -348,6 +366,7 @@ QJsonObject Draco::postSync(const QString &cmd, QMap params, Q QJsonObject Draco::getSync(const QString &cmd, QJsonObject data, int &reply_code, QString &reply_msg) { + FuncTime f(QString("GET %1").arg(cmd)); QJsonObject ret; OurSharedPointer manager(new QNetworkAccessManager); QUrl url = QUrl::fromUserInput(commandByNetwork(cmd)); @@ -368,6 +387,8 @@ QJsonObject Draco::getSync(const QString &cmd, QJsonObject data, int &reply_code requester_.setRawHeader("x-nc-app-version", qApp->applicationVersion().toUtf8()); requester_.setRawHeader("x-nc-device-class", "Desktop"); requester_.setRawHeader("x-nc-os-name", QSysInfo::productType().toUtf8()); + qint64 maximumBufferSize = 1024 * 1024; + requester_.setAttribute(QNetworkRequest::MaximumDownloadBufferSizeAttribute, maximumBufferSize); manager->setCookieJar(new QNetworkCookieJar(manager.get())); OurSharedPointer reply(manager->get(requester_)); QEventLoop eventLoop; @@ -397,6 +418,7 @@ QJsonObject Draco::getSync(const QString &cmd, QJsonObject data, int &reply_code QJsonObject Draco::putSync(const QString &cmd, QJsonObject data, int &reply_code, QString &reply_msg) { + FuncTime f(QString("PUT %1").arg(cmd)); QJsonObject ret; qApp->setOverrideCursor(Qt::WaitCursor); std::unique_ptr manager(new QNetworkAccessManager); @@ -409,6 +431,8 @@ QJsonObject Draco::putSync(const QString &cmd, QJsonObject data, int &reply_code requester_.setRawHeader("x-nc-app-version", qApp->applicationVersion().toUtf8()); requester_.setRawHeader("x-nc-device-class", "Desktop"); requester_.setRawHeader("x-nc-os-name", QSysInfo::productType().toUtf8()); + qint64 maximumBufferSize = 1024 * 1024; + requester_.setAttribute(QNetworkRequest::MaximumDownloadBufferSizeAttribute, maximumBufferSize); manager->setCookieJar(new QNetworkCookieJar(manager.get())); std::unique_ptr> reply(manager->put(requester_, QJsonDocument(data).toJson())); QEventLoop eventLoop; @@ -439,6 +463,7 @@ QJsonObject Draco::putSync(const QString &cmd, QJsonObject data, int &reply_code QJsonObject Draco::putSync(const QString &cmd, QMap params, QJsonObject data, int &reply_code, QString &reply_msg) { + FuncTime f(QString("PUT %1").arg(cmd)); QJsonObject ret; qApp->setOverrideCursor(Qt::WaitCursor); std::unique_ptr manager(new QNetworkAccessManager); @@ -452,6 +477,8 @@ QJsonObject Draco::putSync(const QString &cmd, QMap params, QJ requester_.setRawHeader("x-nc-app-version", qApp->applicationVersion().toUtf8()); requester_.setRawHeader("x-nc-device-class", "Desktop"); requester_.setRawHeader("x-nc-os-name", QSysInfo::productType().toUtf8()); + qint64 maximumBufferSize = 1024 * 1024; + requester_.setAttribute(QNetworkRequest::MaximumDownloadBufferSizeAttribute, maximumBufferSize); // Add addional params for(QString param : params.keys()) { requester_.setRawHeader(QByteArray::fromStdString(param.toStdString()), QByteArray::fromStdString(params.value(param).toStdString())); @@ -486,6 +513,7 @@ QJsonObject Draco::putSync(const QString &cmd, QMap params, QJ QJsonObject Draco::deleteSync(const QString &cmd, QJsonObject data, int &reply_code, QString &reply_msg) { + FuncTime f(QString("DELETE %1").arg(cmd)); QJsonObject ret; qApp->setOverrideCursor(Qt::WaitCursor); std::unique_ptr manager(new QNetworkAccessManager); @@ -498,6 +526,8 @@ QJsonObject Draco::deleteSync(const QString &cmd, QJsonObject data, int &reply_c requester_.setRawHeader("x-nc-app-version", qApp->applicationVersion().toUtf8()); requester_.setRawHeader("x-nc-device-class", "Desktop"); requester_.setRawHeader("x-nc-os-name", QSysInfo::productType().toUtf8()); + qint64 maximumBufferSize = 1024 * 1024; + requester_.setAttribute(QNetworkRequest::MaximumDownloadBufferSizeAttribute, maximumBufferSize); manager->setCookieJar(new QNetworkCookieJar(manager.get())); std::unique_ptr> reply(manager->sendCustomRequest(requester_, "DELETE", QJsonDocument(data).toJson())); QEventLoop eventLoop; @@ -690,7 +720,6 @@ void Draco::singin(const QString& email, const QString& password) this->setExpireSec(dataObj["expireInSeconds"].toInt()); this->setEmailRequested(email); this->getMe(); - this->getCurrentUserSubscription(); } else if(response_code == DRACO_CODE::LOGIN_NEW_DEVICE){ QJsonObject detailsObj = errorObj["details"].toObject(); @@ -776,7 +805,6 @@ void Draco::changePassword(const QString& oldpassword, const QString& newpasswor if(response_code == DRACO_CODE::RESPONSE_OK){ this->setPid(newpassword); this->getMe(); - this->getCurrentUserSubscription(); } emit changePasswordResult(reply_code, response_code, response_msg); } @@ -808,6 +836,10 @@ void Draco::getMe() user.login_type = userObj["login_type"].toString(); AppModel::instance()->startCheckAuthorize(); CLIENT_INSTANCE->setIsNunchukLoggedIn(true); + if(0 != QString::compare(user.email, AppSetting::instance()->groupSetting(), Qt::CaseInsensitive)){ + AppSetting::instance()->setGroupSetting(user.email); + } + getCurrentUserSubscription(); } else if(response_code == DRACO_CODE::UNAUTHORIZED){ CLIENT_INSTANCE->requestSignout(); @@ -817,6 +849,7 @@ void Draco::getMe() DBG_INFO << response_code; } } + CLIENT_INSTANCE->setMe(user); } @@ -847,6 +880,10 @@ void Draco::getMepKey(const QString &public_address) user.login_type = userObj["login_type"].toString(); CLIENT_INSTANCE->setMe(user); AppModel::instance()->startCheckAuthorize(); + CLIENT_INSTANCE->setIsNunchukLoggedIn(true); + if(0 != QString::compare(user.email, AppSetting::instance()->groupSetting(), Qt::CaseInsensitive)){ + AppSetting::instance()->setGroupSetting(user.email); + } } else if(response_code == DRACO_CODE::UNAUTHORIZED){ CLIENT_INSTANCE->requestSignout(); @@ -1364,7 +1401,6 @@ void Draco::pkey_signup(const QString &address, const QString &username, const Q this->setDracoToken(dataObj["tokenId"].toString()); this->setExpireSec(dataObj["expireInSeconds"].toInt()); this->getMe(); - this->getCurrentUserSubscription(); AppModel::instance()->setPrimaryKey(username); } } @@ -1399,7 +1435,6 @@ bool Draco::pkey_signin(const QString &address, const QString &username, const Q this->setDracoToken(dataObj["tokenId"].toString()); this->setExpireSec(dataObj["expireInSeconds"].toInt()); this->getMe(); - this->getCurrentUserSubscription(); AppModel::instance()->setPrimaryKey(username); } else if(response_code == DRACO_CODE::LOGIN_NEW_DEVICE){ @@ -1560,7 +1595,7 @@ void Draco::getCurrentUserSubscription() QString reply_msg = ""; QString cmd = commands[CMD_IDX::USER_SUBCRIPTIONS_CURRENT]; QJsonObject jsonObj = getSync(cmd, QJsonObject(), reply_code, reply_msg); - if(reply_code == DRACO_CODE::SUCCESSFULL){ + if (reply_code == DRACO_CODE::SUCCESSFULL) { QJsonObject errorObj = jsonObj["error"].toObject(); int response_code = errorObj["code"].toInt(); if(response_code == DRACO_CODE::RESPONSE_OK){ @@ -1569,10 +1604,39 @@ void Draco::getCurrentUserSubscription() ServiceSetting::instance()->setIsSubscriber(true); return; } + else { + if (AppSetting::instance()->primaryServer() == (int)nunchuk::Chain::TESTNET){ + if (getTestNetUserSubscription()) { + return; + } + } + } } ServiceSetting::instance()->setIsSubscriber(false); } + +bool Draco::getTestNetUserSubscription() +{ + int reply_code = -1; + QString reply_msg = ""; + QString cmd = commands[CMD_IDX::USER_SUBCRIPTIONS_TESTNET]; + QJsonObject jsonObj = getSync(cmd, QJsonObject(), reply_code, reply_msg); + DBG_INFO << jsonObj; + if (reply_code == DRACO_CODE::SUCCESSFULL) { + QJsonObject errorObj = jsonObj["error"].toObject(); + int response_code = errorObj["code"].toInt(); + if(response_code == DRACO_CODE::RESPONSE_OK){ + QJsonObject dataObj = jsonObj["data"].toObject(); + CLIENT_INSTANCE->setSubCur(dataObj); + ServiceSetting::instance()->setIsSubscriber(true); + return true; + } + } + ServiceSetting::instance()->setIsSubscriber(false); + return false; +} + QJsonObject Draco::getAssistedWallets() { int reply_code = -1; @@ -1706,7 +1770,6 @@ QJsonObject Draco::assistedWalletGetListTx(const QString &wallet_id) if(reply_code == DRACO_CODE::SUCCESSFULL){ QJsonObject errorObj = jsonObj["error"].toObject(); int response_code = errorObj["code"].toInt(); - QString response_msg = errorObj["message"].toString(); if(response_code == DRACO_CODE::RESPONSE_OK){ QJsonObject data = jsonObj.value("data").toObject(); return data; @@ -1756,6 +1819,127 @@ void Draco::assistedSyncTx(const QString &wallet_id, const QString &transaction_ } } +QJsonObject Draco::assistedWalletGetListKey() +{ + QJsonObject data; + data["statuses"] = "PENDING"; + int reply_code = -1; + QString reply_msg = ""; + QJsonObject jsonObj = getSync(commands[CMD_IDX::ASSISTED_WALLET_GET_LIST_KEY], data, reply_code, reply_msg); + if(reply_code == DRACO_CODE::SUCCESSFULL){ + QJsonObject errorObj = jsonObj["error"].toObject(); + int response_code = errorObj["code"].toInt(); + if(response_code == DRACO_CODE::RESPONSE_OK){ + QJsonObject data = jsonObj.value("data").toObject(); + return data; + } + qInfo() << errorObj; + } + return QJsonObject(); +} + +bool Draco::assistedWalletAddKey(const QString &request_id, const QJsonObject& data) +{ + int reply_code = -1; + QString reply_msg = ""; + QMap paramsQuery; + paramsQuery["request_id"] = request_id; + QJsonObject jsonObj = postSync(commands[CMD_IDX::ASSISTED_WALLET_ADD_KEY], paramsQuery, {}, data, reply_code, reply_msg); + if(reply_code == DRACO_CODE::SUCCESSFULL){ + QJsonObject errorObj = jsonObj["error"].toObject(); + int response_code = errorObj["code"].toInt(); + if(response_code == DRACO_CODE::RESPONSE_OK){ + return true; + } + qInfo() << errorObj; + } + return false; +} + +bool Draco::assistedWalletRemoveId(const QString &request_id) +{ + QJsonObject data; + int reply_code = -1; + QString reply_msg = ""; + QString cmd = commands[CMD_IDX::ASSISTED_WALLET_REMOVE_ID]; + cmd.replace("{request_id}", request_id); + QJsonObject jsonObj = deleteSync(cmd, data, reply_code, reply_msg); + if(reply_code == DRACO_CODE::SUCCESSFULL){ + QJsonObject errorObj = jsonObj["error"].toObject(); + int response_code = errorObj["code"].toInt(); + if(response_code == DRACO_CODE::RESPONSE_OK){ + return true; + } + } + return false; +} + +QJsonObject Draco::assistedGetWalletConfig() +{ + int reply_code = -1; + QString reply_msg = ""; + QJsonObject jsonObj = getSync(commands[CMD_IDX::ASSISTED_WALLET_GET_CONFIG], {}, reply_code, reply_msg); + if(reply_code == DRACO_CODE::SUCCESSFULL){ + QJsonObject errorObj = jsonObj["error"].toObject(); + int response_code = errorObj["code"].toInt(); + if(response_code == DRACO_CODE::RESPONSE_OK){ + QJsonObject data = jsonObj.value("data").toObject(); + return data; + } + DBG_INFO << errorObj; + } + return {}; +} + +bool Draco::assistedWalletUpdateName(const QString &wallet_id, const QString &name, const QString &description, const QStringList& signerNames) +{ + QJsonObject data; + data["name"] = name; + data["description"] = description; + QJsonObject signers; + for(int i = 0; i < signerNames.size(); i++) + { + QJsonObject key; + key["name"] = signerNames.at(i); + signers[QString("additionalProp%1").arg(i+1)] = key; + } + data["signers"] = signers; + int reply_code = -1; + QString reply_msg = ""; + QString cmd = commands[CMD_IDX::ASSISTED_WALLET_UPDATE_NAME]; + cmd.replace("{wallet_id_or_local_id}", wallet_id); + QJsonObject jsonObj = putSync(cmd, data, reply_code, reply_msg); + if(reply_code == DRACO_CODE::SUCCESSFULL){ + QJsonObject errorObj = jsonObj["error"].toObject(); + int response_code = errorObj["code"].toInt(); + if(response_code == DRACO_CODE::RESPONSE_OK){ + return true; + } + DBG_INFO << errorObj; + } + return false; +} + +bool Draco::assistedKeyUpdateName(const QString &fingerPrint, const QString &name) +{ + QJsonObject data; + data["name"] = name; + int reply_code = -1; + QString reply_msg = ""; + QString cmd = commands[CMD_IDX::ASSISTED_KEY_UPDATE_NAME]; + cmd.replace("{xfp}", fingerPrint); + QJsonObject jsonObj = putSync(cmd, data, reply_code, reply_msg); + if(reply_code == DRACO_CODE::SUCCESSFULL){ + QJsonObject errorObj = jsonObj["error"].toObject(); + int response_code = errorObj["code"].toInt(); + if(response_code == DRACO_CODE::RESPONSE_OK){ + return true; + } + DBG_INFO << errorObj; + } + return false; +} + bool Draco::verifyPasswordToken(const QString& password, const int action, QString& errormsg_or_token) { int reply_code = -1; @@ -1949,7 +2133,7 @@ bool Draco::lockdownByAnswerSecQues(const QString &passwordToken, params["Security-Question-token"] = secQuesToken; int reply_code = -1; QString reply_msg = ""; - QJsonObject jsonObj = postSync(commands[CMD_IDX::LOCKDOWN_SET], params, data, reply_code, reply_msg); + QJsonObject jsonObj = postSync(commands[CMD_IDX::LOCKDOWN_SET], {}, params, data, reply_code, reply_msg); if(reply_code == DRACO_CODE::SUCCESSFULL){ QJsonObject errorObj = jsonObj["error"].toObject(); int response_code = errorObj["code"].toInt(); @@ -1992,7 +2176,7 @@ bool Draco::lockdownBySignDummyTx(const QStringList &signatures, int reply_code = -1; QString reply_msg = ""; - QJsonObject jsonObj = postSync(commands[CMD_IDX::LOCKDOWN_SET], params, data, reply_code, reply_msg); + QJsonObject jsonObj = postSync(commands[CMD_IDX::LOCKDOWN_SET], {}, params, data, reply_code, reply_msg); qInfo() << jsonObj; if(reply_code == DRACO_CODE::SUCCESSFULL){ QJsonObject errorObj = jsonObj["error"].toObject(); @@ -2039,7 +2223,7 @@ bool Draco::userKeysDownloadBackup(const QString &verify_token, int reply_code = -1; QString reply_msg = ""; - QJsonObject jsonObj = postSync(cmd, params, data, reply_code, reply_msg); + QJsonObject jsonObj = postSync(cmd, {}, params, data, reply_code, reply_msg); if(reply_code == DRACO_CODE::SUCCESSFULL){ QJsonObject errorObj = jsonObj["error"].toObject(); int response_code = errorObj["code"].toInt(); @@ -2117,7 +2301,7 @@ bool Draco::inheritanceClaimStatus(const QJsonObject& data, const QString& autho QString cmd = commands[CMD_IDX::INHERITANCE_CLAIM_STATUS]; int reply_code = -1; QString reply_msg = ""; - QJsonObject jsonObj = postSync(cmd, params, data, reply_code, reply_msg); + QJsonObject jsonObj = postSync(cmd, {}, params, data, reply_code, reply_msg); if(reply_code == DRACO_CODE::SUCCESSFULL){ QJsonObject errorObj = jsonObj["error"].toObject(); int response_code = errorObj["code"].toInt(); @@ -2142,7 +2326,7 @@ bool Draco::inheritanceCreateTx(const QJsonObject& data, const QString& autho, Q QString cmd = commands[CMD_IDX::INHERITANCE_CREATE_TX]; int reply_code = -1; QString reply_msg = ""; - QJsonObject jsonObj = postSync(cmd, params, data, reply_code, reply_msg); + QJsonObject jsonObj = postSync(cmd, {}, params, data, reply_code, reply_msg); if(reply_code == DRACO_CODE::SUCCESSFULL){ QJsonObject errorObj = jsonObj["error"].toObject(); int response_code = errorObj["code"].toInt(); @@ -2207,6 +2391,34 @@ bool Draco::inheritanceGetPlan(const QString& wallet_id, QJsonObject &output, QS return false; } +bool Draco::inheritancePlanUpdate(const QString &passwordToken, const QString &secQuesToken, const QStringList &signatures, const QJsonObject data, QJsonObject &output, QString &errormsg) +{ + int reply_code = -1; + QString reply_msg = ""; + QMap params; + for (int i = 0; i < signatures.count(); i++) { + params[QString("AuthorizationX-%1").arg(i+1)] = signatures.at(i); + } + params["Verify-token"] = passwordToken; + params["Security-Question-token"] = secQuesToken; + + QJsonObject jsonObj = putSync(commands[CMD_IDX::INHERITANCE_PLAN_UPDATE], params, data, reply_code, reply_msg); + if(reply_code == DRACO_CODE::SUCCESSFULL){ + QJsonObject errorObj = jsonObj["error"].toObject(); + int response_code = errorObj["code"].toInt(); + QString response_msg = errorObj["message"].toString(); + if(response_code == DRACO_CODE::RESPONSE_OK){ + output = jsonObj["data"].toObject(); + return true; + } else { + errormsg = response_msg; + return false; + } + } + errormsg = reply_msg; + return false; +} + bool Draco::inheritanceFakeUpdate() { QJsonObject data; @@ -2228,6 +2440,55 @@ bool Draco::inheritanceFakeUpdate() return false; } +bool Draco::inheritancePlanRequiredSignatures(const QJsonObject &data, ReqiredSignaturesInfo& output, QString &errormsg) +{ + int reply_code = -1; + QString reply_msg = ""; + QJsonObject jsonObj = postSync(commands[CMD_IDX::INHERITANCE_PLAN_REQUIRED_SIGNATURES], data, reply_code, reply_msg); + if(reply_code == DRACO_CODE::SUCCESSFULL){ + QJsonObject errorObj = jsonObj["error"].toObject(); + int response_code = errorObj["code"].toInt(); + QString response_msg = errorObj["message"].toString(); + if(response_code == DRACO_CODE::RESPONSE_OK){ + QJsonObject dataObj = jsonObj["data"].toObject(); + QJsonObject resultObj = dataObj["result"].toObject(); + DBG_INFO << resultObj; + output.type = required_signatures_type[resultObj["type"].toString()]; + output.required_signatures = resultObj["required_signatures"].toInt(); + output.required_answers = resultObj["required_answers"].toInt(); + return true; + } else { + errormsg = response_msg; + DBG_INFO << response_code << response_msg; + } + } + return false; +} + +bool Draco::inheritancePlanBufferPeriod(QJsonArray& output, QString& errormsg) +{ + int reply_code = -1; + QString reply_msg = ""; + QJsonObject jsonObj = getSync(commands[CMD_IDX::INHERITANCE_PLAN_BUFFER_PERIODS], QJsonObject(), reply_code, reply_msg); + if(reply_code == DRACO_CODE::SUCCESSFULL){ + QJsonObject errorObj = jsonObj["error"].toObject(); + int response_code = errorObj["code"].toInt(); + QString response_msg = errorObj["message"].toString(); + if(response_code == DRACO_CODE::RESPONSE_OK){ + QJsonObject dataObj = jsonObj["data"].toObject(); + QJsonArray periods = dataObj["periods"].toArray(); + output = periods; + return true; + } + else{ + errormsg = response_msg; + return false; + } + } + errormsg = reply_msg; + return false; +} + bool Draco::serverKeysGet(const QString &id_or_xfp, QJsonObject &output, QString &errormsg) { int reply_code = -1; diff --git a/ifaces/Draco.h b/ifaces/Draco.h index 91b6f812..13147825 100644 --- a/ifaces/Draco.h +++ b/ifaces/Draco.h @@ -113,6 +113,7 @@ class Draco : public QObject // USER_SUBSCRIPTION void getCurrentUserSubscription(); + bool getTestNetUserSubscription(); // ASSISTED_WALLETS QJsonObject getAssistedWallets(); @@ -124,6 +125,12 @@ class Draco : public QObject QJsonObject assistedWalletGetListTx(const QString &wallet_id); QJsonObject assistedWalletDeleteListTx(const QString &wallet_id, const int offset, const int limit); void assistedSyncTx(const QString &wallet_id, const QString &transaction_id, const QString &psbt); + QJsonObject assistedWalletGetListKey(); + bool assistedWalletAddKey(const QString &request_id, const QJsonObject& data); + bool assistedWalletRemoveId(const QString &request_id); + QJsonObject assistedGetWalletConfig(); + bool assistedWalletUpdateName(const QString &wallet_id, const QString &name, const QString &description, const QStringList& signerNames); + bool assistedKeyUpdateName(const QString &fingerPrint, const QString &name); bool verifyPasswordToken(const QString &password, const int action, QString &errormsg_or_token); QString randomNonce(); @@ -192,8 +199,19 @@ class Draco : public QObject QJsonObject& output, QString& errormsg); + bool inheritancePlanUpdate(const QString& passwordToken, + const QString& secQuesToken, + const QStringList &signatures, + const QJsonObject data, + QJsonObject& output, + QString& errormsg); + bool inheritanceFakeUpdate(); + bool inheritancePlanRequiredSignatures(const QJsonObject& data, ReqiredSignaturesInfo& output, QString& errormsg); + + bool inheritancePlanBufferPeriod(QJsonArray& output, QString& errormsg); + bool serverKeysGet(const QString & id_or_xfp, QJsonObject& output, QString& errormsg); @@ -215,7 +233,7 @@ class Draco : public QObject Draco(); ~Draco(); QJsonObject postSync(const QString &cmd, QJsonObject data, int &reply_code, QString &reply_msg); - QJsonObject postSync(const QString &cmd, QMap params, QJsonObject data, int &reply_code, QString &reply_msg); + QJsonObject postSync(const QString &cmd, QMap paramsQuery, QMap paramsHeader, QJsonObject data, int &reply_code, QString &reply_msg); QJsonObject getSync(const QString &cmd, QJsonObject data, int &reply_code, QString &reply_msg); QJsonObject putSync(const QString &cmd, QJsonObject data, int &reply_code, QString &reply_msg); QJsonObject putSync(const QString &cmd, QMap params, QJsonObject data, int &reply_code, QString &reply_msg); diff --git a/ifaces/DracoDefines.h b/ifaces/DracoDefines.h index e9cf60bd..a8938e3a 100644 --- a/ifaces/DracoDefines.h +++ b/ifaces/DracoDefines.h @@ -110,6 +110,7 @@ enum CMD_IDX { // USER_SUBSCRIPTION USER_SUBCRIPTIONS_CURRENT, + USER_SUBCRIPTIONS_TESTNET, // ASSISTED_WALLETS ASSISTED_WALLET_GET, @@ -120,6 +121,12 @@ enum CMD_IDX { ASSISTED_WALLET_GET_TX, ASSISTED_WALLET_GET_LIST_TX, ASSISTED_WALLET_DELETE_LIST_TX, + ASSISTED_WALLET_ADD_KEY, + ASSISTED_WALLET_GET_LIST_KEY, + ASSISTED_WALLET_REMOVE_ID, + ASSISTED_WALLET_GET_CONFIG, + ASSISTED_WALLET_UPDATE_NAME, + ASSISTED_KEY_UPDATE_NAME, // SEC_QUES SEC_QUES_GET, @@ -134,6 +141,7 @@ enum CMD_IDX { LOCKDOWN_REQUIRED_SIGNATURES, LOCKDOWN_GET_PERIOD, + //GET_RANDOM_NONCE GET_RANDOM_NONCE, VERIFY_PASSWORD_TOKEN, @@ -147,6 +155,9 @@ enum CMD_IDX { INHERITANCE_CHECK, INHERITANCE_GET_PLAN, INHERITANCE_FAKE_UPDATE, + INHERITANCE_PLAN_REQUIRED_SIGNATURES, + INHERITANCE_PLAN_UPDATE, + INHERITANCE_PLAN_BUFFER_PERIODS, //SERVER_KEYS SERVER_KEYS_GET, @@ -233,6 +244,7 @@ const QMap commands { // USER_SUBSCRIPTION { CMD_IDX::USER_SUBCRIPTIONS_CURRENT , QString("%1/%2").arg(DRAGON_SUBSCRIPTIONS_URL).arg("current") }, + { CMD_IDX::USER_SUBCRIPTIONS_TESTNET , QString("%1/%2").arg(DRAGON_SUBSCRIPTIONS_URL).arg("testnet") }, // ASSISTED_WALLETS { CMD_IDX::ASSISTED_WALLET_GET , QString("%1/%2").arg(DRAGON_USER_WALLETS_URL).arg("wallets") }, @@ -243,6 +255,12 @@ const QMap commands { { CMD_IDX::ASSISTED_WALLET_SIGN_TX , QString("%1/%2").arg(DRAGON_USER_WALLETS_URL).arg("wallets/{wallet_id_or_local_id}/transactions/{transaction_id}/sign") }, { CMD_IDX::ASSISTED_WALLET_CANCEL_TX , QString("%1/%2").arg(DRAGON_USER_WALLETS_URL).arg("wallets/{wallet_id_or_local_id}/transactions/{transaction_id}") }, { CMD_IDX::ASSISTED_WALLET_GET_TX , QString("%1/%2").arg(DRAGON_USER_WALLETS_URL).arg("wallets/{wallet_id_or_local_id}/transactions/{transaction_id}") }, + { CMD_IDX::ASSISTED_WALLET_ADD_KEY , QString("%1/%2").arg(DRAGON_USER_WALLETS_URL).arg("draft-wallets/add-key") }, + { CMD_IDX::ASSISTED_WALLET_GET_LIST_KEY , QString("%1/%2").arg(DRAGON_USER_WALLETS_URL).arg("draft-wallets/request-add-key") }, + { CMD_IDX::ASSISTED_WALLET_REMOVE_ID , QString("%1/%2").arg(DRAGON_USER_WALLETS_URL).arg("draft-wallets/request-add-key/{request_id}") }, + { CMD_IDX::ASSISTED_WALLET_GET_CONFIG , QString("%1/%2").arg(DRAGON_USER_WALLETS_URL).arg("configs") }, + { CMD_IDX::ASSISTED_KEY_UPDATE_NAME , QString("%1/%2").arg(DRAGON_USER_WALLETS_URL).arg("wallet-keys/{xfp}") }, + { CMD_IDX::ASSISTED_WALLET_UPDATE_NAME , QString("%1/%2").arg(DRAGON_USER_WALLETS_URL).arg("wallets/{wallet_id_or_local_id}") }, // SEC_QUES { CMD_IDX::SEC_QUES_GET , QString("%1/%2").arg(DRAGON_USER_WALLETS_URL).arg("security-questions") }, @@ -270,6 +288,9 @@ const QMap commands { { CMD_IDX::INHERITANCE_CHECK , QString("%1/%2").arg(DRAGON_USER_WALLETS_URL).arg("inheritance/check") }, { CMD_IDX::INHERITANCE_GET_PLAN , QString("%1/%2").arg(DRAGON_USER_WALLETS_URL).arg("inheritance") }, { CMD_IDX::INHERITANCE_FAKE_UPDATE , QString("%1/%2").arg(DRAGON_USER_WALLETS_URL).arg("inheritance/fake-update") }, + { CMD_IDX::INHERITANCE_PLAN_REQUIRED_SIGNATURES , QString("%1/%2").arg(DRAGON_USER_WALLETS_URL).arg("inheritance/calculate-required-signatures") }, + { CMD_IDX::INHERITANCE_PLAN_UPDATE , QString("%1/%2").arg(DRAGON_USER_WALLETS_URL).arg("inheritance") }, + { CMD_IDX::INHERITANCE_PLAN_BUFFER_PERIODS , QString("%1/%2").arg(DRAGON_USER_WALLETS_URL).arg("inheritance/buffer-period") }, //SERVER_KEYS /v1.1/user-wallets/server-keys/{key_id_or_xfp} { CMD_IDX::SERVER_KEYS_GET , QString("%1/%2").arg(DRAGON_USER_WALLETS_URL).arg("server-keys/{key_id_or_xfp}") }, diff --git a/ifaces/bridgeifaces.cpp b/ifaces/bridgeifaces.cpp index 714ee90a..3dea928d 100644 --- a/ifaces/bridgeifaces.cpp +++ b/ifaces/bridgeifaces.cpp @@ -30,6 +30,7 @@ void bridge::nunchukMakeInstance(const QString& passphrase, QWarningMessage& msg) { + FuncTime f(__PRETTY_FUNCTION__); AppModel::instance()->requestClearData(); bool encrypted = (passphrase == "") ? false : true; AppSetting::instance()->setGroupSetting(""); @@ -113,6 +114,7 @@ void bridge::nunchukMakeInstanceForAccount(const QString &account, const QString &passphrase, QWarningMessage &msg) { + FuncTime f(__PRETTY_FUNCTION__); AppModel::instance()->requestClearData(); bool encrypted = (passphrase == "") ? false : true; AppSetting::instance()->setGroupSetting(account); @@ -210,7 +212,7 @@ QWalletListModelPtr bridge::nunchukGetWallets() { if((int)EWARNING::WarningType::NONE_MSG == msg.type()){ QWalletListModelPtr walletList(new WalletListModel()); for (nunchuk::Wallet it : resultWallets) { - walletList.data()->addWallet(convertWallet(it)); + walletList.data()->addWallet(bridge::convertWallet(it)); } return walletList; } @@ -228,7 +230,7 @@ QWalletListModelPtr bridge::nunchukConvertWallets(std::vector l { QWalletListModelPtr walletList(new WalletListModel()); for (nunchuk::Wallet it : list) { - walletList.data()->addWallet(convertWallet(it)); + walletList.data()->addWallet(bridge::convertWallet(it)); } return walletList; } @@ -236,22 +238,7 @@ QWalletListModelPtr bridge::nunchukConvertWallets(std::vector l QWalletPtr bridge::convertWallet(const nunchuk::Wallet &wallet) { QWalletPtr to = QWalletPtr(new Wallet()); - to.data()->setId(QString::fromStdString(wallet.get_id())); - to.data()->setM(wallet.get_m()); - to.data()->setN(wallet.get_n()); - to.data()->setName(QString::fromStdString(wallet.get_name())); - to.data()->setAddressType(QString::number((int)wallet.get_address_type())); - to.data()->setBalance(wallet.get_unconfirmed_balance()); - to.data()->setCreateDate(QDateTime::fromTime_t(wallet.get_create_date())); - to.data()->setEscrow(wallet.is_escrow()); - to.data()->setGapLimit(wallet.get_gap_limit()); - to.data()->setDescription(QString::fromStdString(wallet.get_description())); - QSingleSignerListModelPtr signersAssinged( new SingleSignerListModel); - for (nunchuk::SingleSigner signer : wallet.get_signers()) { - QSingleSignerPtr ret = QSingleSignerPtr(new QSingleSigner(signer)); - signersAssinged.data()->addSingleSigner(ret); - } - to.data()->setSigners(signersAssinged); + to.data()->convert(wallet); return to; } @@ -274,31 +261,7 @@ QMasterSignerListModelPtr bridge::nunchukGetMasterSigners() { QWarningMessage msg; std::vector masterSignerList_result = nunchukiface::instance()->GetMasterSigners(msg); AppModel::instance()->setSoftwareSignerDeviceList(QDeviceListModelPtr(new DeviceListModel())); - if((int)EWARNING::WarningType::NONE_MSG == msg.type()){ - QMasterSignerListModelPtr masterSignerlist(new MasterSignerListModel()); - for (nunchuk::MasterSigner it : masterSignerList_result) { - QMasterSignerPtr signer = QMasterSignerPtr(new QMasterSigner(it)); - int signer_type = (int)it.get_type(); - if(signer_type == (int)ENUNCHUCK::SignerType::SERVER){ - continue; - } - if(signer_type == (int)ENUNCHUCK::SignerType::SOFTWARE){ - AppModel::instance()->softwareSignerDeviceList()->addDevice(QDevicePtr(new QDevice(it.get_device()))); - } - if(signer_type == (int)ENUNCHUCK::SignerType::NFC){ - QWarningMessage msgGetTap; - nunchuk::TapsignerStatus tapsigner = nunchukiface::instance()->GetTapsignerStatusFromMasterSigner(it.get_device().get_master_fingerprint(), msgGetTap); - if((int)EWARNING::WarningType::NONE_MSG == msgGetTap.type()){ - signer.data()->device()->setCardId(QString::fromStdString(tapsigner.get_card_ident())); - } - } - masterSignerlist.data()->addMasterSigner(signer); - } - return masterSignerlist; - } - else{ - return NULL; - } + return nunchukConvertMasterSigners(masterSignerList_result); } std::vector bridge::nunchukGetOriginMasterSigners(QWarningMessage& msg) @@ -380,15 +343,7 @@ nunchuk::HealthStatus bridge::nunchukHealthCheckSingleSigner(const QSingleSigner QString message = signer.data()->message(); QString signature = signer.data()->signature(); DBG_INFO << message << signature; - nunchuk::SingleSigner singlesinger(signer.data()->name().toStdString(), - signer.data()->xpub().toStdString(), - signer.data()->publickey().toStdString(), - signer.data()->derivationPath().toStdString(), - signer.data()->masterFingerPrint().toStdString(), - signer.data()->lastHealthCheckDateTime().toTime_t(), - signer.data()->masterSignerId().toStdString()); - singlesinger.set_type(nunchuk::SignerType(signer.data()->signerType())); - return nunchukiface::instance()->HealthCheckSingleSigner(singlesinger, + return nunchukiface::instance()->HealthCheckSingleSigner(signer->singleSigner(), message.toStdString(), signature.toStdString(), msg); @@ -497,6 +452,25 @@ QSingleSignerPtr bridge::nunchukGetUnusedSignerFromMasterSigner(const QString &m } } +QSingleSignerPtr bridge::nunchukGetDefaultSignerFromMasterSigner(const QString &mastersigner_id, + const ENUNCHUCK::WalletType &wallet_type, + const ENUNCHUCK::AddressType &address_type, + QWarningMessage &msg) +{ + DBG_INFO << mastersigner_id; + nunchuk::SingleSigner signer = nunchukiface::instance()->GetDefaultSignerFromMasterSigner(mastersigner_id.toStdString(), + (nunchuk::WalletType)wallet_type, + (nunchuk::AddressType)address_type, + msg); + if((int)EWARNING::WarningType::NONE_MSG == msg.type()){ + QSingleSignerPtr ret = QSingleSignerPtr(new QSingleSigner(signer)); + return ret; + } + else{ + return QSingleSignerPtr(); + } +} + QSingleSignerPtr bridge::nunchukCreateSigner(const QString &name, const QString &xpub, const QString &public_key, @@ -537,84 +511,13 @@ nunchuk::SingleSigner bridge::nunchukCreateOriginSigner(const QString &name, msg); } -QWalletPtr bridge::nunchukCreateWallet(const QString &name, - int m, - int n, - SingleSignerListModel* signers, - ENUNCHUCK::AddressType address_type, - bool is_escrow, - const QString& desc, - QWarningMessage& msg) -{ - std::vector signerList; - for (int i = 0; i < signers->rowCount(); i++) { - QSingleSignerPtr singlerSigner = signers->getSingleSignerByIndex(i); - nunchuk::SingleSigner nunchukSigner(singlerSigner.data()->name().toStdString(), - singlerSigner.data()->xpub().toStdString(), - singlerSigner.data()->publickey().toStdString(), - singlerSigner.data()->derivationPath().toStdString(), - singlerSigner.data()->masterFingerPrint().toStdString(), - singlerSigner.data()->lastHealthCheckDateTime().toTime_t(), - singlerSigner.data()->masterSignerId().toStdString()); - nunchukSigner.set_type(nunchuk::SignerType(singlerSigner.data()->signerType())); - signerList.push_back(nunchukSigner); - } - nunchuk::Wallet walletResult = nunchukiface::instance()->CreateWallet(name.toStdString(), - m, - n, - signerList, - (nunchuk::AddressType)address_type, - is_escrow, - desc.toStdString(), - msg); - - if((int)EWARNING::WarningType::NONE_MSG == msg.type()){ - QSingleSignerListModelPtr signersAssinged( new SingleSignerListModel); - for (nunchuk::SingleSigner signer : walletResult.get_signers()) { - QSingleSignerPtr ret = QSingleSignerPtr(new QSingleSigner(signer)); - signersAssinged.data()->addSingleSigner(ret); - } - - QWalletPtr ret = QWalletPtr(new Wallet(QString::fromStdString(walletResult.get_id()), - walletResult.get_m(), - walletResult.get_n(), - QString::fromStdString(walletResult.get_name()), - QString::number((int)walletResult.get_address_type()), - walletResult.get_unconfirmed_balance(), - QDateTime::fromTime_t(walletResult.get_create_date()), - walletResult.is_escrow(), - signersAssinged, - QString::fromStdString(walletResult.get_description()))); - return ret; - } - else { - return NULL; - } -} - QWalletPtr bridge::nunchukCreateWallet(const nunchuk::Wallet &wallet, bool allow_used_signer, QWarningMessage &msg) { nunchuk::Wallet walletResult = nunchukiface::instance()->CreateWallet(wallet, allow_used_signer, msg); if((int)EWARNING::WarningType::NONE_MSG == msg.type()){ - QSingleSignerListModelPtr signersAssinged( new SingleSignerListModel); - for (nunchuk::SingleSigner signer : walletResult.get_signers()) { - QSingleSignerPtr ret = QSingleSignerPtr(new QSingleSigner(signer)); - signersAssinged.data()->addSingleSigner(ret); - } - - QWalletPtr ret = QWalletPtr(new Wallet(QString::fromStdString(walletResult.get_id()), - walletResult.get_m(), - walletResult.get_n(), - QString::fromStdString(walletResult.get_name()), - QString::number((int)walletResult.get_address_type()), - walletResult.get_unconfirmed_balance(), - QDateTime::fromTime_t(walletResult.get_create_date()), - walletResult.is_escrow(), - signersAssinged, - QString::fromStdString(walletResult.get_description()))); - return ret; + return bridge::convertWallet(walletResult); } else { return NULL; @@ -630,23 +533,10 @@ nunchuk::Wallet bridge::nunchukCreateOriginWallet(const QString &name, const QString &desc, QWarningMessage &msg) { - std::vector signerList; - for (int i = 0; i < signers->rowCount(); i++) { - QSingleSignerPtr singlerSigner = signers->getSingleSignerByIndex(i); - nunchuk::SingleSigner nunchukSigner(singlerSigner.data()->name().toStdString(), - singlerSigner.data()->xpub().toStdString(), - singlerSigner.data()->publickey().toStdString(), - singlerSigner.data()->derivationPath().toStdString(), - singlerSigner.data()->masterFingerPrint().toStdString(), - singlerSigner.data()->lastHealthCheckDateTime().toTime_t(), - singlerSigner.data()->masterSignerId().toStdString()); - nunchukSigner.set_type(nunchuk::SignerType(singlerSigner.data()->signerType())); - signerList.push_back(nunchukSigner); - } return nunchukiface::instance()->CreateWallet(name.toStdString(), m, n, - signerList, + signers->signers(), (nunchuk::AddressType)address_type, is_escrow, desc.toStdString(), @@ -663,23 +553,10 @@ QString bridge::nunchukDraftWallet(const QString &name, const QString &desc, QWarningMessage &msg) { - std::vector signerList; - for (int i = 0; i < signers->rowCount(); i++) { - QSingleSignerPtr singlerSigner = signers->getSingleSignerByIndex(i); - nunchuk::SingleSigner nunchukSigner(singlerSigner.data()->name().toStdString(), - singlerSigner.data()->xpub().toStdString(), - singlerSigner.data()->publickey().toStdString(), - singlerSigner.data()->derivationPath().toStdString(), - singlerSigner.data()->masterFingerPrint().toStdString(), - singlerSigner.data()->lastHealthCheckDateTime().toTime_t(), - singlerSigner.data()->masterSignerId().toStdString()); - nunchukSigner.set_type(nunchuk::SignerType(singlerSigner.data()->signerType())); - signerList.push_back(nunchukSigner); - } string ret = nunchukiface::instance()->DraftWallet(name.toStdString(), m, n, - signerList, + signers->signers(), (nunchuk::AddressType)address_type, is_escrow, desc.toStdString(), @@ -761,25 +638,9 @@ QWalletPtr bridge::nunchukImportWallet(const QString &dbFile, { nunchuk::Wallet walletResult = nunchukiface::instance()->ImportWalletDb(dbFile.toStdString(), msg); if((int)EWARNING::WarningType::NONE_MSG == msg.type()){ - QSingleSignerListModelPtr signersAssinged( new SingleSignerListModel); - for (nunchuk::SingleSigner signer : walletResult.get_signers()) { - QSingleSignerPtr ret = QSingleSignerPtr(new QSingleSigner(signer)); - signersAssinged.data()->addSingleSigner(ret); - } - - QWalletPtr ret = QWalletPtr(new Wallet(QString::fromStdString(walletResult.get_id()), - walletResult.get_m(), - walletResult.get_n(), - QString::fromStdString(walletResult.get_name()), - QString::number((int)walletResult.get_address_type()), - walletResult.get_unconfirmed_balance(), - QDateTime::fromTime_t(walletResult.get_create_date()), - walletResult.is_escrow(), - signersAssinged, - QString::fromStdString(walletResult.get_description()))); bool needTopUp = AppModel::instance()->newWalletInfo()->singleSignersAssigned()->needTopUpXpubs(); AppModel::instance()->newWalletInfo()->setCapableCreate(!needTopUp); - return ret; + return bridge::convertWallet(walletResult); } else { return NULL; @@ -797,25 +658,9 @@ QWalletPtr bridge::nunchukImportWalletDescriptor(const QString &dbFile, description.toStdString(), msg); if((int)EWARNING::WarningType::NONE_MSG == msg.type()){ - QSingleSignerListModelPtr signersAssinged( new SingleSignerListModel); - for (nunchuk::SingleSigner signer : walletResult.get_signers()) { - QSingleSignerPtr ret = QSingleSignerPtr(new QSingleSigner(signer)); - signersAssinged.data()->addSingleSigner(ret); - } - - QWalletPtr ret = QWalletPtr(new Wallet(QString::fromStdString(walletResult.get_id()), - walletResult.get_m(), - walletResult.get_n(), - QString::fromStdString(walletResult.get_name()), - QString::number((int)walletResult.get_address_type()), - walletResult.get_unconfirmed_balance(), - QDateTime::fromTime_t(walletResult.get_create_date()), - walletResult.is_escrow(), - signersAssinged, - QString::fromStdString(walletResult.get_description()))); bool needTopUp = AppModel::instance()->newWalletInfo()->singleSignersAssigned()->needTopUpXpubs(); AppModel::instance()->newWalletInfo()->setCapableCreate(!needTopUp); - return ret; + return bridge::convertWallet(walletResult); } else { return NULL; @@ -879,7 +724,7 @@ bool bridge::nunchukExportTransaction(const QString &wallet_id, msg); } -QTransactionPtr bridge::nunchukImportTransaction(const QString &wallet_id, const QString &file_path, QWarningMessage& msg) +QTransactionPtr bridge::nunchukImportTransaction(const QString &wallet_id, const QString &file_path, bool isAssisted, QWarningMessage& msg) { nunchuk::Transaction trans_result = nunchukiface::instance()->ImportTransaction(wallet_id.toStdString(), file_path.toStdString(), @@ -906,6 +751,12 @@ QTransactionPtr bridge::nunchukImportTransaction(const QString &wallet_id, const } } } + if (isAssisted) { + Draco::instance()->assistedWalletCreateTx(wallet_id, final->psbt(), final->memo()); + QJsonObject data = Draco::instance()->assistedWalletGetTx(wallet_id, final->txid()); + DBG_INFO << data; + final->setServerKeyMessage(data); + } return final; } else{ @@ -1022,13 +873,16 @@ bool bridge::nunchukDeleteRemoteSigner(const QString &master_fingerprint, const return nunchukiface::instance()->DeleteRemoteSigner(master_fingerprint.toStdString(), derivation_path.toStdString(), msg); } -void bridge::nunchukUpdateMasterSigner(const QMasterSignerPtr &signer ) +void bridge::nunchukUpdateMasterSigner(const QMasterSignerPtr &signer, bool sync) { if(signer){ QtConcurrent::run([signer]() { QWarningMessage msg; nunchukiface::instance()->UpdateMasterSigner(signer.data()->originMasterSigner(), msg); }); + if (sync) { + Draco::instance()->assistedKeyUpdateName(signer->fingerPrint(), signer->name()); + } } } @@ -1046,7 +900,7 @@ void bridge::nunchukDeleteAllWallet() } } -void bridge::nunchukUpdateWalletName(const QString &wallet_id, const QString &name) +void bridge::nunchukUpdateWalletName(const QString &wallet_id, const QString &name, bool sync) { QWarningMessage msg; nunchuk::Wallet wallet = nunchukiface::instance()->GetWallet(wallet_id.toStdString(), msg); @@ -1056,6 +910,13 @@ void bridge::nunchukUpdateWalletName(const QString &wallet_id, const QString &na QWarningMessage msgupdate; nunchukiface::instance()->UpdateWallet(wallet, msgupdate); }); + QStringList names {}; + for (nunchuk::SingleSigner signer : wallet.get_signers()) { + names.append(QString::fromStdString(signer.get_name())); + } + if (sync) { + Draco::instance()->assistedWalletUpdateName(wallet_id, QString::fromStdString(wallet.get_name()), QString::fromStdString(wallet.get_description()), names); + } } } @@ -1069,6 +930,11 @@ void bridge::nunchukUpdateWalletDescription(const QString &wallet_id, const QStr QWarningMessage msgupdate; nunchukiface::instance()->UpdateWallet(wallet, msgupdate); }); + QStringList names {}; + for (nunchuk::SingleSigner signer : wallet.get_signers()) { + names.append(QString::fromStdString(signer.get_name())); + } + Draco::instance()->assistedWalletUpdateName(wallet_id, QString::fromStdString(wallet.get_name()), QString::fromStdString(wallet.get_description()), names); } } @@ -1120,12 +986,14 @@ QUTXOListModelPtr bridge::nunchukGetUnspentOutputs(const QString &walletId) if((int)EWARNING::WarningType::NONE_MSG == msg.type()){ QUTXOListModelPtr ret = QUTXOListModelPtr(new UTXOListModel()); for (nunchuk::UnspentOutput it : utxo_result) { + DBG_INFO << it.get_amount() << it.get_height() << (int)it.get_status(); ret.data()->addUTXO(QString::fromStdString(it.get_txid()), it.get_vout(), QString::fromStdString(it.get_address()), it.get_amount(), it.get_height(), - QString::fromStdString(it.get_memo())); + QString::fromStdString(it.get_memo()), + (int)it.get_status()); } return ret; } @@ -1171,6 +1039,13 @@ QTransactionPtr bridge::nunchukDraftTransaction(const QString &wallet_id, if((int)EWARNING::WarningType::NONE_MSG == msg.type()){ QTransactionPtr final = bridge::convertTransaction(trans_result, wallet_id); final.data()->setStatus((int)nunchuk::TransactionStatus::PENDING_SIGNATURES); + nunchuk::Amount packageFeeRate{0}; + if (nunchukiface::instance()->IsCPFP(wallet_id.toStdString(), trans_result, packageFeeRate, msg)) { + // Show package fee rate in UI + final.data()->setPackageFeeRate(packageFeeRate); + } else { + // Do nothing + } return final; } else{ @@ -1368,15 +1243,7 @@ QSingleSignerListModelPtr bridge::nunchukGetRemoteSigners() QWarningMessage msg; std::vector remoteignerList_result = nunchukiface::instance()->GetRemoteSigners(msg); if((int)EWARNING::WarningType::NONE_MSG == msg.type()){ - QSingleSignerListModelPtr remoteSignerlist(new SingleSignerListModel()); - for (nunchuk::SingleSigner signer : remoteignerList_result) { - if((int)signer.get_type() == (int)ENUNCHUCK::SignerType::SERVER){ - continue; - } - QSingleSignerPtr ret = QSingleSignerPtr(new QSingleSigner(signer)); - remoteSignerlist.data()->addSingleSigner(ret); - } - return remoteSignerlist; + return bridge::nunchukConvertRemoteSigners(remoteignerList_result); } else{ return NULL; @@ -1396,19 +1263,25 @@ QSingleSignerListModelPtr bridge::nunchukConvertRemoteSigners(std::vectoraddSingleSigner(ret); } return remoteSignerlist; } -void bridge::nunchukUpdateRemoteSigner(const QSingleSignerPtr &signer) +void bridge::nunchukUpdateRemoteSigner(const QSingleSignerPtr &signer, bool sync) { if(signer) { QtConcurrent::run([signer]() { QWarningMessage msg; nunchukiface::instance()->UpdateRemoteSigner(signer.data()->originSingleSigner(), msg); }); + if (sync) { + Draco::instance()->assistedKeyUpdateName(signer->masterFingerPrint(), signer->name()); + } } } @@ -1554,25 +1427,9 @@ QWalletPtr bridge::nunchukImportCoboWallet(const QStringList &qr_data, description.toStdString(), msg); if((int)EWARNING::WarningType::NONE_MSG == msg.type()){ - QSingleSignerListModelPtr signersAssinged( new SingleSignerListModel); - for (nunchuk::SingleSigner signer : walletResult.get_signers()) { - QSingleSignerPtr ret = QSingleSignerPtr(new QSingleSigner(signer)); - signersAssinged.data()->addSingleSigner(ret); - } - - QWalletPtr ret = QWalletPtr(new Wallet(QString::fromStdString(walletResult.get_id()), - walletResult.get_m(), - walletResult.get_n(), - QString::fromStdString(walletResult.get_name()), - QString::number((int)walletResult.get_address_type()), - walletResult.get_unconfirmed_balance(), - QDateTime::fromTime_t(walletResult.get_create_date()), - walletResult.is_escrow(), - signersAssinged, - QString::fromStdString(walletResult.get_description()))); bool needTopUp = AppModel::instance()->newWalletInfo()->singleSignersAssigned()->needTopUpXpubs(); AppModel::instance()->newWalletInfo()->setCapableCreate(!needTopUp); - return ret; + return bridge::convertWallet(walletResult); } else { return NULL; @@ -1587,25 +1444,9 @@ QWalletPtr bridge::nunchukImportWalletConfigFile(const QString &file_path, description.toStdString(), msg); if((int)EWARNING::WarningType::NONE_MSG == msg.type()){ - QSingleSignerListModelPtr signersAssinged( new SingleSignerListModel); - for (nunchuk::SingleSigner signer : walletResult.get_signers()) { - QSingleSignerPtr ret = QSingleSignerPtr(new QSingleSigner(signer)); - signersAssinged.data()->addSingleSigner(ret); - } - - QWalletPtr ret = QWalletPtr(new Wallet(QString::fromStdString(walletResult.get_id()), - walletResult.get_m(), - walletResult.get_n(), - QString::fromStdString(walletResult.get_name()), - QString::number((int)walletResult.get_address_type()), - walletResult.get_unconfirmed_balance(), - QDateTime::fromTime_t(walletResult.get_create_date()), - walletResult.is_escrow(), - signersAssinged, - QString::fromStdString(walletResult.get_description()))); bool needTopUp = AppModel::instance()->newWalletInfo()->singleSignersAssigned()->needTopUpXpubs(); AppModel::instance()->newWalletInfo()->setCapableCreate(!needTopUp); - return ret; + return bridge::convertWallet(walletResult); } else { return NULL; @@ -1775,25 +1616,9 @@ QWalletPtr bridge::nunchukImportKeystoneWallet(const QList &qr_data, description.toStdString(), msg); if((int)EWARNING::WarningType::NONE_MSG == msg.type()){ - QSingleSignerListModelPtr signersAssinged( new SingleSignerListModel); - for (nunchuk::SingleSigner signer : walletResult.get_signers()) { - QSingleSignerPtr ret = QSingleSignerPtr(new QSingleSigner(signer)); - signersAssinged.data()->addSingleSigner(ret); - } - - QWalletPtr ret = QWalletPtr(new Wallet(QString::fromStdString(walletResult.get_id()), - walletResult.get_m(), - walletResult.get_n(), - QString::fromStdString(walletResult.get_name()), - QString::number((int)walletResult.get_address_type()), - walletResult.get_unconfirmed_balance(), - QDateTime::fromTime_t(walletResult.get_create_date()), - walletResult.is_escrow(), - signersAssinged, - QString::fromStdString(walletResult.get_description()))); bool needTopUp = AppModel::instance()->newWalletInfo()->singleSignersAssigned()->needTopUpXpubs(); AppModel::instance()->newWalletInfo()->setCapableCreate(!needTopUp); - return ret; + return bridge::convertWallet(walletResult); } else { return NULL; @@ -1997,7 +1822,7 @@ void bridge::assistedWalletUpdateTx(const QString& wallet_id, const nunchuk::Tra QString reject_msg = transaction.value("reject_msg").toString(); - long int broadcast_time_milis = static_cast(transaction.value("broadcast_time_milis").toInt()); + long int broadcast_time_milis = static_cast(transaction.value("broadcast_time_milis").toDouble()); // honey badger feature: schedule broadcast long int current_time_stamp_milis = static_cast(std::time(nullptr)) * 1000; @@ -2006,11 +1831,9 @@ void bridge::assistedWalletUpdateTx(const QString& wallet_id, const nunchuk::Tra nunchukUpdateTransactionSchedule(wallet_id, QString::fromStdString(tx.get_txid()), broadcast_time_milis/1000,msg); } - if (status == "PENDING_CONFIRMATION" || - status == "CONFIRMED" || - status == "NETWORK_REJECTED") { + if (status == "PENDING_CONFIRMATION" || status == "CONFIRMED" || status == "NETWORK_REJECTED") { nunchukImportPsbt(wallet_id, psbt,msg); - nunchukUpdateTransaction(wallet_id, QString::fromStdString(tx.get_txid()), transaction_id, hex, reject_msg,msg); + nunchukUpdateTransaction(wallet_id, QString::fromStdString(tx.get_txid()), transaction_id, hex, reject_msg, msg); } else if (status == "READY_TO_BROADCAST" || status == "PENDING_SIGNATURES") { auto tx = nunchukImportPsbt(wallet_id, psbt,msg); diff --git a/ifaces/bridgeifaces.h b/ifaces/bridgeifaces.h index e5d5cd21..f9610c75 100644 --- a/ifaces/bridgeifaces.h +++ b/ifaces/bridgeifaces.h @@ -62,6 +62,7 @@ class ENUNCHUCK: public QObject WALLET_TAB, SERVICE_TAB, CHAT_TAB, + SETTING_TAB, }; enum class AddressType { @@ -238,7 +239,7 @@ bool nunchukDeleteWallet(const QString& wallet_id, QWarningMessage &msg); void nunchukDeleteAllWallet(); -void nunchukUpdateWalletName(const QString& wallet_id, const QString &name); +void nunchukUpdateWalletName(const QString& wallet_id, const QString &name, bool sync = true); void nunchukUpdateWalletDescription(const QString &wallet_id, const QString &description); @@ -286,15 +287,20 @@ QSingleSignerPtr nunchukGetUnusedSignerFromMasterSigner(const QString& mastersig const ENUNCHUCK::AddressType& address_type, QWarningMessage &msg); +QSingleSignerPtr nunchukGetDefaultSignerFromMasterSigner(const QString& mastersigner_id, + const ENUNCHUCK::WalletType& wallet_type, + const ENUNCHUCK::AddressType& address_type, + QWarningMessage &msg); + bool nunchukDeleteMasterSigner(const QString& mastersigner_id); bool nunchukDeletePrimaryKey(); bool nunchukDeleteRemoteSigner(const QString& master_fingerprint, const QString& derivation_path); -void nunchukUpdateMasterSigner(const QMasterSignerPtr &signer); +void nunchukUpdateMasterSigner(const QMasterSignerPtr &signer, bool sync = true); -void nunchukUpdateRemoteSigner(const QSingleSignerPtr &signer); +void nunchukUpdateRemoteSigner(const QSingleSignerPtr &signer, bool sync = true); bool nunchukHasSinger(const nunchuk::SingleSigner& signer); @@ -318,15 +324,6 @@ nunchuk::SingleSigner nunchukCreateOriginSigner(const QString& name, const QString& master_fingerprint, QWarningMessage &msg); -QWalletPtr nunchukCreateWallet(const QString& name, - int m, - int n, - SingleSignerListModel* signers, - ENUNCHUCK::AddressType address_type, - bool is_escrow, - const QString &desc, - QWarningMessage &msg); - QWalletPtr nunchukCreateWallet(const nunchuk::Wallet& wallet, bool allow_used_signer, QWarningMessage &msg); @@ -396,6 +393,7 @@ bool nunchukExportTransaction(const QString& wallet_id, QTransactionPtr nunchukImportTransaction(const QString& wallet_id, const QString& file_path, + bool isAssisted, QWarningMessage &msg); QTransactionPtr nunchukUpdateTransaction(const QString& wallet_id, diff --git a/ifaces/nunchuckiface.cpp b/ifaces/nunchuckiface.cpp index 3f96cda6..0d570e9d 100644 --- a/ifaces/nunchuckiface.cpp +++ b/ifaces/nunchuckiface.cpp @@ -124,7 +124,7 @@ bool nunchukiface::SetPassphrase(const std::string &passphrase, QWarningMessage& nunchuk::Wallet nunchukiface::CreateWallet(const std::string &name, int m, int n, - std::vector &signers, + const std::vector &signers, nunchuk::AddressType address_type, bool is_escrow, const std::string &desc, @@ -167,7 +167,7 @@ nunchuk::Wallet nunchukiface::CreateWallet(const nunchuk::Wallet &wallet, bool a std::string nunchukiface::DraftWallet(const std::string &name, int m, int n, - std::vector &signers, + const std::vector &signers, nunchuk::AddressType address_type, bool is_escrow, const std::string &desc, @@ -391,6 +391,22 @@ nunchuk::SingleSigner nunchukiface::GetSignerFromMasterSigner(const std::string return ret; } +nunchuk::SingleSigner nunchukiface::GetSignerFromMasterSigner(const std::string &mastersigner_id, + const std::string &derivation_path, + QWarningMessage& msg) +{ + nunchuk::SingleSigner ret("","","","","",0,""); + try { + if(nunchuk_instance_[nunchukMode()]){ + ret = nunchuk_instance_[nunchukMode()]->GetSignerFromMasterSigner(mastersigner_id, derivation_path); + } + } + catch (std::exception &e) { + DBG_INFO << "THROW EXCEPTION" << e.what(); msg.setWarningMessage(-1, e.what(), EWARNING::WarningType::EXCEPTION_MSG); + } + return ret; +} + nunchuk::SingleSigner nunchukiface::CreateSigner(const std::string &name, const std::string &xpub, const std::string &public_key, @@ -2126,13 +2142,31 @@ std::string nunchukiface::SignHealthCheckMessage(const nunchuk::SingleSigner &si return ret; } -nunchuk::SingleSigner nunchukiface::GetDefaultSignerFromMasterSigner(const std::string &mastersigner_id, - QWarningMessage& msg) +nunchuk::SingleSigner nunchukiface::GetDefaultSignerFromMasterSigner(const std::string &mastersigner_id, const nunchuk::WalletType &wallet_type, const nunchuk::AddressType &address_type, QWarningMessage &msg) { nunchuk::SingleSigner ret("","","","","",0,""); try { if(nunchuk_instance_[nunchukMode()]){ - ret = nunchuk_instance_[nunchukMode()]->GetDefaultSignerFromMasterSigner(mastersigner_id, nunchuk::WalletType::MULTI_SIG, nunchuk::AddressType::ANY); + ret = nunchuk_instance_[nunchukMode()]->GetDefaultSignerFromMasterSigner(mastersigner_id, wallet_type, address_type); + } + } + catch (std::exception &e) { + DBG_INFO << "THROW EXCEPTION" << e.what(); msg.setWarningMessage(-1, e.what(), EWARNING::WarningType::EXCEPTION_MSG); + } + return ret; +} + +nunchuk::SingleSigner nunchukiface::GetDefaultSignerFromMasterSigner(const std::string &mastersigner_id, QWarningMessage& msg) +{ + return GetDefaultSignerFromMasterSigner(mastersigner_id, nunchuk::WalletType::MULTI_SIG, nunchuk::AddressType::ANY, msg); +} + +bool nunchukiface::IsCPFP(const std::string &wallet_id, const nunchuk::Transaction &tx, nunchuk::Amount &package_fee_rate, QWarningMessage& msg) +{ + bool ret {false}; + try { + if(nunchuk_instance_[nunchukMode()]){ + ret = nunchuk_instance_[nunchukMode()]->IsCPFP(wallet_id, tx, package_fee_rate); } } catch (std::exception &e) { diff --git a/ifaces/nunchuckiface.h b/ifaces/nunchuckiface.h index 3d77a371..77d3f472 100644 --- a/ifaces/nunchuckiface.h +++ b/ifaces/nunchuckiface.h @@ -57,7 +57,7 @@ class nunchukiface nunchuk::Wallet CreateWallet(const std::string& name, int m, int n, - std::vector& signers, + const std::vector& signers, nunchuk::AddressType address_type, bool is_escrow, const std::string& desc, @@ -70,7 +70,7 @@ class nunchukiface std::string DraftWallet(const std::string& name, int m, int n, - std::vector& signers, + const std::vector& signers, nunchuk::AddressType address_type, bool is_escrow, const std::string& desc, @@ -113,6 +113,10 @@ class nunchukiface int index, QWarningMessage& msg); + nunchuk::SingleSigner GetSignerFromMasterSigner(const std::string &mastersigner_id, + const std::string &derivation_path, + QWarningMessage& msg); + nunchuk::SingleSigner CreateSigner(const std::string& name, const std::string& xpub, const std::string& public_key, @@ -457,9 +461,18 @@ class nunchukiface const std::string& message, QWarningMessage& msg); + nunchuk::SingleSigner GetDefaultSignerFromMasterSigner(const std::string &mastersigner_id, + const nunchuk::WalletType& wallet_type, + const nunchuk::AddressType& address_type, + QWarningMessage& msg); + nunchuk::SingleSigner GetDefaultSignerFromMasterSigner(const std::string &mastersigner_id, QWarningMessage& msg); + bool IsCPFP(const std::string& wallet_id, + const nunchuk::Transaction& tx, + nunchuk::Amount& package_fee_rate, + QWarningMessage& msg); private: nunchukiface(); ~nunchukiface(); diff --git a/ifaces/nunchucklistener.cpp b/ifaces/nunchucklistener.cpp index 2f813e79..488d19ef 100644 --- a/ifaces/nunchucklistener.cpp +++ b/ifaces/nunchucklistener.cpp @@ -30,6 +30,7 @@ void balance_listener(std::string id, nunchuk::Amount balance) void balances_listener(string id, nunchuk::Amount balance, nunchuk::Amount unconfirmed_balance) { + DBG_INFO; bridge::nunchukBalanceChanged(QString::fromStdString(id), static_cast(unconfirmed_balance)); } @@ -40,6 +41,7 @@ void devices_listener(std::string fingerprint, bool connected) void transaction_listener(std::string tx_id, nunchuk::TransactionStatus status, std::string wallet_id) { + DBG_INFO; bridge::nunchukTransactionChanged(QString::fromStdString(tx_id), (int)status, QString::fromStdString(wallet_id)); } diff --git a/ifaces/qUtils.cpp b/ifaces/qUtils.cpp index 7ece802e..068f733b 100644 --- a/ifaces/qUtils.cpp +++ b/ifaces/qUtils.cpp @@ -22,6 +22,7 @@ #include "AppModel.h" #include "QOutlog.h" #include +#include qint64 qUtils::QAmountFromValue(const QString &value, const bool allow_negative) { qint64 ret = -1; @@ -431,3 +432,43 @@ int qUtils::Precision(double input) } return qMax(lastDigit,2); } + +QJsonObject qUtils::GetJsonObject(QString text) +{ + QJsonObject obj; + QJsonDocument doc = QJsonDocument::fromJson(text.toUtf8()); + + // check validity of the document + if(!doc.isNull()) + { + if(doc.isObject()) + { + obj = doc.object(); + } + else + { + qDebug() << "Document is not an object"; + } + } + else + { + qDebug() << "Invalid JSON...\n"; + } + return obj; +} + +uint qUtils::GetTimeSecond(QString time_str) +{ + QStringList list = time_str.split("/"); + QString month = list.at(0); + QString day = list.at(1); + QString year = list.at(2); + QDate date(year.toInt(), month.toInt(), day.toInt()); + QDateTime time(date); + return time.toTime_t(); +} + +uint qUtils::GetCurrentTimeSecond() +{ + return QDateTime::currentDateTime().toTime_t(); +} diff --git a/ifaces/qUtils.h b/ifaces/qUtils.h index 8829e74e..4572a989 100644 --- a/ifaces/qUtils.h +++ b/ifaces/qUtils.h @@ -115,6 +115,11 @@ QString currencyLocale(qint64 amountSats); bool verifyCheckSum(const QByteArray& data, const QByteArray& expectedCheckSum); int Precision(double input); + +QJsonObject GetJsonObject(QString text); + +uint GetTimeSecond(QString time_str); +uint GetCurrentTimeSecond(); } #endif // QUTILS_H diff --git a/localization/STR_CPP.h b/localization/STR_CPP.h index 33660bf7..5b2269aa 100644 --- a/localization/STR_CPP.h +++ b/localization/STR_CPP.h @@ -121,4 +121,6 @@ const static QString STR_CPP_115 = QString("Invalid password. Unable to restore const static QString STR_CPP_116 = QString("The Magic Phrase you entered does not match the one that you requested."); const static QString STR_CPP_117 = QString("Policies have been updated"); const static QString STR_CPP_118 = QString("Could not claim inheritance"); +const static QString STR_CPP_119 = QString("The inheritance plan has been updated"); +const static QString STR_CPP_120 = QString("Invalid activation time"); #endif // STR_CPP_H diff --git a/localization/STR_QML.js b/localization/STR_QML.js index dbc64415..cf0a5b0e 100644 --- a/localization/STR_QML.js +++ b/localization/STR_QML.js @@ -70,7 +70,7 @@ var STR_QML_041 = qsTr("Import DB") var STR_QML_042 = qsTr("NEXT: Key Setup") //SCR_ADD_WALLET_SIGNER_CONFIGURATION.qml -var STR_QML_043 = qsTr("Choose from Existing Keys") +var STR_QML_043 = qsTr("Choose from existing keys") var STR_QML_044 = qsTr("Hardware") var STR_QML_045 = qsTr("Air-gapped") var STR_QML_046 = qsTr("Software") @@ -131,7 +131,7 @@ var STR_QML_096 = qsTr("To unlock the device, you might need to enter a PIN%1 remaining assisted wallets. You can get additional wallets through our website. Sign in and navigate to the Plan and Invoices page.") +var STR_QML_842 = qsTr("You have %1 remaining assisted wallet. You can get additional wallet through our website. Sign in and navigate to the Plan and Invoices page.") +//================= +var STR_QML_843 = qsTr("Review your plan") +var STR_QML_844 = qsTr("Cancel inheritance plan") +var STR_QML_845 = qsTr("Wallet subject to inheritance:") +var STR_QML_846 = qsTr("View claiming instructions") +var STR_QML_847 = qsTr("Share your secrets") +var STR_QML_848 = qsTr("Activation Date") +var STR_QML_849 = qsTr("Edit") +var STR_QML_850 = qsTr("Note to Beneficiary or Trustee") +var STR_QML_851 = qsTr("Buffer period") +var STR_QML_852 = qsTr("Nofication preferences") +var STR_QML_853 = qsTr("Continue to finalize changes") +//=================== +var STR_QML_854 = qsTr("Set up an Activation Date") +var STR_QML_855 = qsTr("Only on or after this date, a Beneficiary or Trustee can claim the inheritance. \n +You can change the Activation Date later via the Services tab.") +var STR_QML_856 = qsTr("Even with the correct Magic Phrase and Backup Password, one cannot claim the inheritance before this date.") +var STR_QML_857 = qsTr("Update activation date") +var STR_QML_858 = qsTr("Would you like to leave a message?") +var STR_QML_859 = qsTr("After the Beneficiary or Trustee claims the inheritance, they will be able to \n \ +see this message.") +var STR_QML_860 = qsTr("Note") +var STR_QML_861 = qsTr("Update message") +var STR_QML_862 = qsTr("Set up buffer period") +var STR_QML_863 = qsTr("A buffer period is extra time that you can add after the claimant has provided \n \ +the secrets and before the inheritance can be claimed. The buffer period \n \ +helps you prevent unauthorized claims. \n \ +\n \ +An email notification will be sent when the buffer period begins.") + +var STR_QML_864 = qsTr("Update buffer period") +var STR_QML_865 = qsTr("Notification preferences") +var STR_QML_866 = qsTr("On the Activation Date, would you like us to notify the Beneficiary or Trustee of the inheritance plan? If so, please provide an email address.") +var STR_QML_867 = qsTr("Beneficiary’s or Trustee’s email address") +var STR_QML_868 = qsTr("Also notify them today") +var STR_QML_869 = qsTr("You are still personally responsible for sharing the Magic Phrase and Backup Password with the Beneficiary or Trustee. The notification email won’t include these information.") +var STR_QML_870 = qsTr("Update notification preferences") +var STR_QML_871 = qsTr("I don’t want any notifications") + +var STR_QML_872 = qsTr("Are you sure want to discard the changes?") +var STR_QML_873 = qsTr("Moving the Activation Date earlier requires signing a dummy transaction. Please do so via the mobile app.") +var STR_QML_874 = qsTr("Canceling the inheritance requires signing a dummy transaction. Please do so via the mobile app.") +var STR_QML_875 = qsTr("View inheritance plan") + +var STR_QML_876 = qsTr("30-day buffer") +var STR_QML_877 = qsTr("7-day buffer") +var STR_QML_878 = qsTr("I don’t need a buffer period") +var STR_QML_879 = qsTr("Recommended") + +var STR_QML_880 = qsTr("The Magic Phrase and Backup Password must be shared with the party or \n \ +parties eligible for the inheritance. Please select your option:") + +var STR_QML_881 = qsTr("Direct inheritance") +var STR_QML_882 = qsTr("The Beneficiary has full control over the inheritance. Upon the \n \ +Activation Date, they can claim the inheritance for themselves.") + +var STR_QML_883 = qsTr("Indirect inheritance") +var STR_QML_884 = qsTr("A Trustee has full control over the inheritance. Upon the Activation \n \ +Date, the Trustee can help the Beneficiary claim the inheritance on their behalf.") + +var STR_QML_885 = qsTr("Joint control") +var STR_QML_886 = qsTr("The Beneficiary and the Trustee have joint control over the \n \ +inheritance. Upon the Activation Date, the Beneficiary and Trustee \n \ +will need to combine their secrets in order to claim the \n \ +inheritance.") + +var STR_QML_887 = qsTr("Please share these two secrets with the \n \ +Beneficiary:") +var STR_QML_888 = qsTr("The plan’s Magic Phrase.") +var STR_QML_889 = qsTr("The Backup Password for the encrypted \n \ +backup, which can be found on the back of \n \ +the TAPSIGNER designated for inheritance. \n \ +(It might be listed under “Backup key”).") +var STR_QML_890 = qsTr("You are solely responsible for sharing \n \ +the Magic Phrase and Backup \n \ +Password with the Beneficiary. Failure to \n \ +share will result in the inheritance \n \ +being unclaimable.") +var STR_QML_891 = qsTr("Please share these two secrets with the Trustee:") +var STR_QML_892 = qsTr("Please share one secret with the Beneficiary and \n \ +the other secret with the Trustee. Neither party \n \ +should have both secrets.") +var STR_QML_893 = qsTr("You are solely responsible for sharing the Magic Phrase and Backup \n \ +Password with the Trustee. Failure to \n \ +share will result in the inheritance \n \ +being unclaimable.") +var STR_QML_894 = qsTr("You are solely responsible for sharing \n \ +the Magic Phrase and Backup \n \ +Password with the Beneficiary and the \n \ +Trustee. Failure to share will result in \n \ +the inheritance being unclaimable.") + +var STR_QML_895 = qsTr("This transaction includes unconfirmed coins.") +var STR_QML_896 = qsTr("Moving the Activation Date earlier requires signing a dummy transaction. Please do so via the mobile app.") +var STR_QML_897 = qsTr("Canceling the inheritance requires signing a dummy transaction. Please do so via the mobile app.") +var STR_QML_898 = qsTr("Wired") +var STR_QML_899 = qsTr("Add existing key") +var STR_QML_900 = qsTr("Take me to add a new key") +var STR_QML_901 = qsTr("Do you want to add an existing key?") +var STR_QML_902 = qsTr("We noticed that you already have a Ledger in your key manager") + +var STR_QML_903 = qsTr("Add COLDCARD to your assisted wallet") +var STR_QML_904 = qsTr("Add COLDCARD") +var STR_QML_905 = qsTr("It looks like you want to add COLDCARD as a hardware key to an assisted wallet. Would you like to do it now?") +var STR_QML_906 = qsTr("No COLDCARD devices have been detected. Please try again.") + +var STR_QML_907 = qsTr("Initialize COLDCARD") +var STR_QML_908 = qsTr("Refer to this starter guide.") +var STR_QML_909 = qsTr("Unlock COLDCARD") +var STR_QML_910 = qsTr("You might need to enter a PIN and/or a PASSPHRASE directly on COLDCARD.") +var STR_QML_911 = qsTr("Please ensure that the COLDCARD device is connected to this computer, and click on Refresh") +var STR_QML_912 = qsTr("Adding COLDCARD...") +var STR_QML_913 = qsTr("COLDCARD added successfully") +var STR_QML_914 = qsTr("No COLDCARD devices have been detected. Please try again.") +var STR_QML_915 = qsTr("We noticed that you already have a Trezor in your key manager") +var STR_QML_916 = qsTr("We noticed that you already have a COLDCARD in your key manager") +var STR_QML_917 = qsTr("(The Backup Password is printed on the back of the \n +inheritance key)") +var STR_QML_918 = qsTr("There no assisted wallet") +var STR_QML_919 = qsTr("Are you sure want to discard the changes?") +var STR_QML_920 = qsTr("Would you like to leave a message?") +var STR_QML_921 = qsTr("No buffer") diff --git a/main.cpp b/main.cpp index 2c315cef..80be572c 100644 --- a/main.cpp +++ b/main.cpp @@ -154,8 +154,9 @@ int main(int argc, char* argv[]) #else QQuickViewer::instance()->registerContextProperty("SIGNET_SERVER", ""); #endif - QQuickViewer::instance()->registerContextProperty("BLOCKSTREAM_TESTNET", BLOCKSTREAM_TESTNET); - QQuickViewer::instance()->registerContextProperty("BLOCKSTREAM_MAINNET", BLOCKSTREAM_MAINNET); + QQuickViewer::instance()->registerContextProperty("EXPLORER_TESTNET", EXPLORER_TESTNET); + QQuickViewer::instance()->registerContextProperty("EXPLORER_MAINNET", EXPLORER_MAINNET); + QQuickViewer::instance()->registerContextProperty("EXPLORER_SIGNNET", EXPLORER_SIGNNET); QQuickViewer::instance()->registerContextProperty("MAX_UNUSED_ADDR", MAX_UNUSED_ADDR); QQuickViewer::instance()->registerContextProperty("AppModel", QVariant::fromValue(AppModel::instance())); QQuickViewer::instance()->registerContextProperty("AppSetting", QVariant::fromValue(AppSetting::instance())); @@ -184,14 +185,16 @@ int main(int argc, char* argv[]) } , Qt::QueuedConnection); QObject::connect(QQuickViewer::instance()->getQuickWindow(), &QQuickView::windowStateChanged, [=](int windowState) { - static int state = -1; - if (state != windowState) { - state = windowState; - if (windowState == Qt::WindowNoState) { - Draco::instance()->checkForUpdate(); + QtConcurrent::run([windowState]() { + static int state = -1; + if (state != windowState) { + state = windowState; + if (windowState == Qt::WindowNoState) { + Draco::instance()->checkForUpdate(); + } } - } }); + }); QQuickViewer::instance()->show(); return app.exec(); } diff --git a/qml.qrc b/qml.qrc index 9b42addd..6052c876 100644 --- a/qml.qrc +++ b/qml.qrc @@ -223,6 +223,28 @@ Qml/Components/customizes/QAddAssistedWalletSigner.qml Qml/Components/customizes/QProgressbarTypeA.qml Qml/Screens/OnlineMode/SCR_SELECT_WALLET_CO_SIGN_POLICE.qml + Qml/Screens/OnlineMode/SCR_EDIT_YOUR_INHERITANCE_PLAN.qml + Qml/Screens/OnlineMode/SCR_SHARE_YOUR_SECRETS.qml + Qml/Components/customizes/services/QViewInheritancePlaning.qml + Qml/Components/customizes/services/QSelectAnAssistedWallet.qml + Qml/Components/customizes/Buttons/QLinearGradient.qml + Qml/Components/customizes/Buttons/QAssistedWalletDelegate.qml + Qml/Components/customizes/Texts/QTextLink.qml + Qml/Components/customizes/Texts/QTextInputBoxTypeE.qml + Qml/Components/customizes/Texts/QTextAreaBoxTypeA.qml + Qml/Components/origins/QTextArea.qml + Qml/Components/customizes/Texts/QTextAreaBoxTypeB.qml + Qml/Components/customizes/Buttons/QRadioButtonTypeE.qml + Qml/Components/customizes/Texts/QTextAreaBoxTypeC.qml + Qml/Components/customizes/Buttons/QCheckBoxButton.qml + Qml/Components/customizes/Buttons/QRadioButtonTypeF.qml + Qml/Components/customizes/services/QInheritanceDetails.qml + Qml/Screens/OnlineMode/SCR_ADD_COLDCARD.qml + Qml/Screens/OnlineMode/SCR_ADD_COLDCARD_ASK.qml + Qml/Screens/OnlineMode/SCR_ADD_COLDCARD_EXIST.qml + Qml/Screens/OnlineMode/SCR_ADD_LEDGER_EXIST.qml + Qml/Screens/OnlineMode/SCR_ADD_TREZOR_EXIST.qml + Qml/Components/customizes/QAddAnExistingKey.qml Images/services-light.svg @@ -453,6 +475,18 @@ Images/OnlineMode/help_outline_24px.svg Images/ExportFile.svg Images/ledger-illustration.svg + Images/more-horizontal-dark.svg + Images/close-24px.svg + Images/calendar-dark.svg + Images/change-password-dark.svg + Images/star-dark.svg + Images/wallet-brand-icon.svg + Images/calendar-dark.png + Images/star-dark.png + Images/inheritance_backup_password.svg + Images/trezor-illustration.svg + Images/Device_Icons/Ledger.svg + Images/coldcard-illustration.svg Info.plist