From 957bec04bdc1c9981f9cc78c77e065e101cd8708 Mon Sep 17 00:00:00 2001 From: John Preston Date: Thu, 31 Oct 2019 20:22:57 +0300 Subject: [PATCH] Update library to use wallet_id. --- Wallet/SourceFiles/wallet/application.cpp | 44 ++++++++++++++--------- Wallet/lib_tl | 2 +- Wallet/lib_ton | 2 +- Wallet/lib_wallet | 2 +- 4 files changed, 30 insertions(+), 20 deletions(-) diff --git a/Wallet/SourceFiles/wallet/application.cpp b/Wallet/SourceFiles/wallet/application.cpp index c5601ef..0ecfa41 100644 --- a/Wallet/SourceFiles/wallet/application.cpp +++ b/Wallet/SourceFiles/wallet/application.cpp @@ -101,26 +101,36 @@ not_null Application::walletUpdateInfo() { } void Application::openWallet() { + const auto showError = [=](Ton::Error error) { + const auto text = (error.type == Ton::Error::Type::IO) + ? ("IO error at path: " + error.details) + : (error.type == Ton::Error::Type::TonLib) + ? ("Library error, details: " + error.details) + : ("Global Password didn't work."); + const auto solution = "\n\nTry deleting all at " + _path; + criticalError(text + solution); + }; + auto started = [=](Ton::Result<> result) { + if (!result) { + showError(result.error()); + return; + } + _window = std::make_unique( + _wallet.get(), + walletUpdateInfo()); + handleLaunchCommand(); + }; auto opened = [=](Ton::Result<> result) { if (!result) { - const auto text = (result.error().type == Ton::Error::Type::IO) - ? ("IO error at path: " + result.error().details) - : (result.error().type == Ton::Error::Type::TonLib) - ? ("Library error, details: " + result.error().details) - : ("Global Password didn't work.\n\nTry deleting all at " - + _path); - criticalError(text); - } else { - if (_wallet->settings().useNetworkCallbacks) { - auto copy = _wallet->settings(); - copy.useNetworkCallbacks = false; - _wallet->updateSettings(copy, nullptr); - } - _window = std::make_unique( - _wallet.get(), - walletUpdateInfo()); - handleLaunchCommand(); + showError(result.error()); + return; + } + if (_wallet->settings().useNetworkCallbacks) { + auto copy = _wallet->settings(); + copy.useNetworkCallbacks = false; + _wallet->updateSettings(copy, nullptr); } + _wallet->start(started); }; _wallet->open(QByteArray(), GetDefaultSettings(), std::move(opened)); } diff --git a/Wallet/lib_tl b/Wallet/lib_tl index b106082..2272e8a 160000 --- a/Wallet/lib_tl +++ b/Wallet/lib_tl @@ -1 +1 @@ -Subproject commit b106082b8fcbe338ae6a20bd5c25d9169a3866ce +Subproject commit 2272e8abff0d4faa7c5f9ae89e11d4cf558f52f0 diff --git a/Wallet/lib_ton b/Wallet/lib_ton index 3757695..c934a02 160000 --- a/Wallet/lib_ton +++ b/Wallet/lib_ton @@ -1 +1 @@ -Subproject commit 375769565133459a4c96eeda75d8c71fcb93f420 +Subproject commit c934a025221c8ee329a5a5b6e1cfca080f578cea diff --git a/Wallet/lib_wallet b/Wallet/lib_wallet index e699883..386f631 160000 --- a/Wallet/lib_wallet +++ b/Wallet/lib_wallet @@ -1 +1 @@ -Subproject commit e699883fccf7f1d8416fbf80af6ed4bf7a530133 +Subproject commit 386f63154748ad1e2cc405a1f287ddeb2cf81c43