From 73ece917247d550140c0ae193746ebf66cca1081 Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Mon, 17 Feb 2020 17:43:00 +0200 Subject: =?UTF-8?q?SL-11867=20Show=20=E2=80=9CUnable=20to=20buy=E2=80=9D?= =?UTF-8?q?=20message=20via=20notification?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- indra/newview/llfloaterbuycurrency.cpp | 37 +++++----------------------------- 1 file changed, 5 insertions(+), 32 deletions(-) (limited to 'indra/newview/llfloaterbuycurrency.cpp') diff --git a/indra/newview/llfloaterbuycurrency.cpp b/indra/newview/llfloaterbuycurrency.cpp index 91436e52fe..25348474a1 100644 --- a/indra/newview/llfloaterbuycurrency.cpp +++ b/indra/newview/llfloaterbuycurrency.cpp @@ -74,7 +74,6 @@ public: void onClickBuy(); void onClickCancel(); - void onClickErrorWeb(); }; LLFloater* LLFloaterBuyCurrency::buildFloater(const LLSD& key) @@ -132,7 +131,6 @@ BOOL LLFloaterBuyCurrencyUI::postBuild() getChild("buy_btn")->setCommitCallback( boost::bind(&LLFloaterBuyCurrencyUI::onClickBuy, this)); getChild("cancel_btn")->setCommitCallback( boost::bind(&LLFloaterBuyCurrencyUI::onClickCancel, this)); - getChild("error_web")->setCommitCallback( boost::bind(&LLFloaterBuyCurrencyUI::onClickErrorWeb, this)); center(); @@ -173,7 +171,6 @@ void LLFloaterBuyCurrencyUI::updateUI() // hide most widgets - we'll turn them on as needed next getChildView("info_buying")->setVisible(FALSE); - getChildView("info_cannot_buy")->setVisible(FALSE); getChildView("info_need_more")->setVisible(FALSE); getChildView("purchase_warning_repurchase")->setVisible(FALSE); getChildView("purchase_warning_notenough")->setVisible(FALSE); @@ -183,32 +180,16 @@ void LLFloaterBuyCurrencyUI::updateUI() if (hasError) { // display an error from the server - getChildView("normal_background")->setVisible(FALSE); - getChildView("error_background")->setVisible(TRUE); - getChildView("info_cannot_buy")->setVisible(TRUE); - getChildView("cannot_buy_message")->setVisible(TRUE); - getChildView("balance_label")->setVisible(FALSE); - getChildView("balance_amount")->setVisible(FALSE); - getChildView("buying_label")->setVisible(FALSE); - getChildView("buying_amount")->setVisible(FALSE); - getChildView("total_label")->setVisible(FALSE); - getChildView("total_amount")->setVisible(FALSE); - - LLTextBox* message = getChild("cannot_buy_message"); - if (message) - { - message->setText(mManager.errorMessage()); - } - - getChildView("error_web")->setVisible( !mManager.errorURI().empty()); + LLSD args; + args["TITLE"] = getString("info_cannot_buy"); + args["MESSAGE"] = mManager.errorMessage(); + LLNotificationsUtil::add("CouldNotBuyCurrency", args); + closeFloater(); } else { // display the main Buy L$ interface getChildView("normal_background")->setVisible(TRUE); - getChildView("error_background")->setVisible(FALSE); - getChildView("cannot_buy_message")->setVisible(FALSE); - getChildView("error_web")->setVisible(FALSE); if (mHasTarget) { @@ -278,14 +259,6 @@ void LLFloaterBuyCurrencyUI::onClickCancel() LLStatusBar::sendMoneyBalanceRequest(); } -void LLFloaterBuyCurrencyUI::onClickErrorWeb() -{ - LLWeb::loadURL(mManager.errorURI()); - closeFloater(); - // Update L$ balance - LLStatusBar::sendMoneyBalanceRequest(); -} - // static void LLFloaterBuyCurrency::buyCurrency() { -- cgit v1.2.3 From 1fb0e233ff67ada0c6d6351494a4b61ce7ff71e1 Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Thu, 3 Sep 2020 17:29:06 +0300 Subject: SL-13814 Clarify dialog for insufficient L$ balance --- indra/newview/llfloaterbuycurrency.cpp | 61 +++++++++++++++++++++++++--------- 1 file changed, 46 insertions(+), 15 deletions(-) (limited to 'indra/newview/llfloaterbuycurrency.cpp') diff --git a/indra/newview/llfloaterbuycurrency.cpp b/indra/newview/llfloaterbuycurrency.cpp index 25348474a1..b039475389 100644 --- a/indra/newview/llfloaterbuycurrency.cpp +++ b/indra/newview/llfloaterbuycurrency.cpp @@ -32,6 +32,8 @@ #include "llcurrencyuimanager.h" #include "llfloater.h" #include "llfloaterreg.h" +#include "lllayoutstack.h" +#include "lliconctrl.h" #include "llnotificationsutil.h" #include "llstatusbar.h" #include "lltextbox.h" @@ -60,6 +62,7 @@ public: bool mHasTarget; std::string mTargetName; S32 mTargetPrice; + S32 mRequiredAmount; public: void noTarget(); @@ -68,6 +71,7 @@ public: virtual BOOL postBuild(); void updateUI(); + void collapsePanels(bool collapse); virtual void draw(); virtual BOOL canClose(); @@ -92,7 +96,9 @@ LLFloater* LLFloaterBuyCurrency::buildFloater(const LLSD& key) LLFloaterBuyCurrencyUI::LLFloaterBuyCurrencyUI(const LLSD& key) : LLFloater(key), mChildren(*this), - mManager(*this) + mManager(*this), + mHasTarget(false), + mTargetPrice(0) { } @@ -104,7 +110,8 @@ LLFloaterBuyCurrencyUI::~LLFloaterBuyCurrencyUI() void LLFloaterBuyCurrencyUI::noTarget() { mHasTarget = false; - mManager.setAmount(STANDARD_BUY_AMOUNT); + mTargetPrice = 0; + mManager.setAmount(0); } void LLFloaterBuyCurrencyUI::target(const std::string& name, S32 price) @@ -120,7 +127,8 @@ void LLFloaterBuyCurrencyUI::target(const std::string& name, S32 price) need = 0; } - mManager.setAmount(need + MINIMUM_BALANCE_AMOUNT); + mRequiredAmount = need + MINIMUM_BALANCE_AMOUNT; + mManager.setAmount(0); } @@ -175,7 +183,6 @@ void LLFloaterBuyCurrencyUI::updateUI() getChildView("purchase_warning_repurchase")->setVisible(FALSE); getChildView("purchase_warning_notenough")->setVisible(FALSE); getChildView("contacting")->setVisible(FALSE); - getChildView("buy_action")->setVisible(FALSE); if (hasError) { @@ -208,8 +215,8 @@ void LLFloaterBuyCurrencyUI::updateUI() { if (mHasTarget) { - getChildView("buy_action")->setVisible( true); - getChild("buy_action")->setTextArg("[ACTION]", mTargetName); + getChild("target_price")->setTextArg("[AMT]", llformat("%d", mTargetPrice)); + getChild("required_amount")->setTextArg("[AMT]", llformat("%d", mRequiredAmount)); } } @@ -230,18 +237,40 @@ void LLFloaterBuyCurrencyUI::updateUI() if (mHasTarget) { - if (total >= mTargetPrice) - { - getChildView("purchase_warning_repurchase")->setVisible( true); - } - else - { - getChildView("purchase_warning_notenough")->setVisible( true); - } + getChildView("purchase_warning_repurchase")->setVisible( !getChildView("currency_links")->getVisible()); } } - getChildView("getting_data")->setVisible( !mManager.canBuy() && !hasError); + getChildView("getting_data")->setVisible( !mManager.canBuy() && !hasError && !getChildView("currency_est")->getVisible()); +} + +void LLFloaterBuyCurrencyUI::collapsePanels(bool collapse) +{ + LLLayoutPanel* price_panel = getChild("layout_panel_price"); + + if (price_panel->isCollapsed() == collapse) + return; + + LLLayoutStack* outer_stack = getChild("outer_stack"); + LLLayoutPanel* required_panel = getChild("layout_panel_required"); + LLLayoutPanel* msg_panel = getChild("layout_panel_msg"); + + S32 delta_height = price_panel->getRect().getHeight() + required_panel->getRect().getHeight() + msg_panel->getRect().getHeight(); + delta_height *= (collapse ? -1 : 1); + + LLIconCtrl* icon = getChild("normal_background"); + LLRect rect = icon->getRect(); + icon->setRect(rect.setOriginAndSize(rect.mLeft, rect.mBottom - delta_height, rect.getWidth(), rect.getHeight() + delta_height)); + + outer_stack->collapsePanel(price_panel, collapse); + outer_stack->collapsePanel(required_panel, collapse); + outer_stack->collapsePanel(msg_panel, collapse); + + outer_stack->updateLayout(); + + LLRect floater_rect = getRect(); + floater_rect.mBottom -= delta_height; + setShape(floater_rect, false); } void LLFloaterBuyCurrencyUI::onClickBuy() @@ -265,6 +294,7 @@ void LLFloaterBuyCurrency::buyCurrency() LLFloaterBuyCurrencyUI* ui = LLFloaterReg::showTypedInstance("buy_currency"); ui->noTarget(); ui->updateUI(); + ui->collapsePanels(true); } // static @@ -273,6 +303,7 @@ void LLFloaterBuyCurrency::buyCurrency(const std::string& name, S32 price) LLFloaterBuyCurrencyUI* ui = LLFloaterReg::showTypedInstance("buy_currency"); ui->target(name, price); ui->updateUI(); + ui->collapsePanels(false); } -- cgit v1.2.3 From 9dd18e51c897fa9c3e1dab7c5abbc771c98361db Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Thu, 3 Sep 2020 19:39:57 +0300 Subject: SL-13814 mac build fix --- indra/newview/llfloaterbuycurrency.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/newview/llfloaterbuycurrency.cpp') diff --git a/indra/newview/llfloaterbuycurrency.cpp b/indra/newview/llfloaterbuycurrency.cpp index b039475389..b183ba6912 100644 --- a/indra/newview/llfloaterbuycurrency.cpp +++ b/indra/newview/llfloaterbuycurrency.cpp @@ -44,7 +44,6 @@ #include "llwindow.h" #include "llappviewer.h" -static const S32 STANDARD_BUY_AMOUNT = 2000; static const S32 MINIMUM_BALANCE_AMOUNT = 0; class LLFloaterBuyCurrencyUI -- cgit v1.2.3 From 749464660f6241730231d9621e9bf05ba983480d Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Fri, 4 Sep 2020 19:55:26 +0300 Subject: SL-13814 Updated label text --- indra/newview/llfloaterbuycurrency.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'indra/newview/llfloaterbuycurrency.cpp') diff --git a/indra/newview/llfloaterbuycurrency.cpp b/indra/newview/llfloaterbuycurrency.cpp index b183ba6912..dfc755c370 100644 --- a/indra/newview/llfloaterbuycurrency.cpp +++ b/indra/newview/llfloaterbuycurrency.cpp @@ -59,7 +59,6 @@ public: LLCurrencyUIManager mManager; bool mHasTarget; - std::string mTargetName; S32 mTargetPrice; S32 mRequiredAmount; @@ -116,9 +115,13 @@ void LLFloaterBuyCurrencyUI::noTarget() void LLFloaterBuyCurrencyUI::target(const std::string& name, S32 price) { mHasTarget = true; - mTargetName = name; mTargetPrice = price; + if (!name.empty()) + { + getChild("target_price_label")->setValue(name); + } + S32 balance = gStatusBar->getBalance(); S32 need = price - balance; if (need < 0) -- cgit v1.2.3 From 2c0814b00a26d99de00161f9307e706a49251017 Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Tue, 22 Sep 2020 18:26:23 +0300 Subject: SL-13335 Friendlier L$ Buy flow when no payment method on file --- indra/newview/llfloaterbuycurrency.cpp | 66 +++++++++++++++++++++++++++++----- 1 file changed, 58 insertions(+), 8 deletions(-) (limited to 'indra/newview/llfloaterbuycurrency.cpp') diff --git a/indra/newview/llfloaterbuycurrency.cpp b/indra/newview/llfloaterbuycurrency.cpp index dfc755c370..a3e9161ee8 100644 --- a/indra/newview/llfloaterbuycurrency.cpp +++ b/indra/newview/llfloaterbuycurrency.cpp @@ -290,22 +290,72 @@ void LLFloaterBuyCurrencyUI::onClickCancel() LLStatusBar::sendMoneyBalanceRequest(); } +LLFetchAvatarPaymentInfo* LLFloaterBuyCurrency::sPropertiesRequest = NULL; + // static void LLFloaterBuyCurrency::buyCurrency() { - LLFloaterBuyCurrencyUI* ui = LLFloaterReg::showTypedInstance("buy_currency"); - ui->noTarget(); - ui->updateUI(); - ui->collapsePanels(true); + delete sPropertiesRequest; + sPropertiesRequest = new LLFetchAvatarPaymentInfo(false); } // static void LLFloaterBuyCurrency::buyCurrency(const std::string& name, S32 price) { - LLFloaterBuyCurrencyUI* ui = LLFloaterReg::showTypedInstance("buy_currency"); - ui->target(name, price); - ui->updateUI(); - ui->collapsePanels(false); + delete sPropertiesRequest; + sPropertiesRequest = new LLFetchAvatarPaymentInfo(true, name, price); } +// static +void LLFloaterBuyCurrency::handleBuyCurrency(bool has_piof, bool has_target, const std::string& name, S32 price) +{ + delete sPropertiesRequest; + sPropertiesRequest = NULL; + if (has_piof) + { + LLFloaterBuyCurrencyUI* ui = LLFloaterReg::showTypedInstance("buy_currency"); + if (has_target) + { + ui->target(name, price); + } + else + { + ui->noTarget(); + } + ui->updateUI(); + ui->collapsePanels(!has_target); + } + else + { + LLFloaterReg::showInstance("add_payment_method"); + } +} + +LLFetchAvatarPaymentInfo::LLFetchAvatarPaymentInfo(bool has_target, const std::string& name, S32 price) +: mAvatarID(gAgent.getID()), + mHasTarget(has_target), + mPrice(price), + mName(name) +{ + LLAvatarPropertiesProcessor* processor = LLAvatarPropertiesProcessor::getInstance(); + // register ourselves as an observer + processor->addObserver(mAvatarID, this); + // send a request (duplicates will be suppressed inside the avatar + // properties processor) + processor->sendAvatarPropertiesRequest(mAvatarID); +} + +LLFetchAvatarPaymentInfo::~LLFetchAvatarPaymentInfo() +{ + LLAvatarPropertiesProcessor::getInstance()->removeObserver(mAvatarID, this); +} + +void LLFetchAvatarPaymentInfo::processProperties(void* data, EAvatarProcessorType type) +{ + if (data && type == APT_PROPERTIES) + { + LLAvatarData* avatar_data = static_cast(data); + LLFloaterBuyCurrency::handleBuyCurrency(LLAvatarPropertiesProcessor::hasPaymentInfoOnFile(avatar_data), mHasTarget, mName, mPrice); + } +} -- cgit v1.2.3 From 71537daefda469c390b10f48bd01c9a2d59b8624 Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Fri, 2 Oct 2020 18:53:36 +0300 Subject: SL-14057 FIXED The viewer crashes when trying to make a transaction exceeding the L$ balance --- indra/newview/llfloaterbuycurrency.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llfloaterbuycurrency.cpp') diff --git a/indra/newview/llfloaterbuycurrency.cpp b/indra/newview/llfloaterbuycurrency.cpp index a3e9161ee8..5ee6f122bf 100644 --- a/indra/newview/llfloaterbuycurrency.cpp +++ b/indra/newview/llfloaterbuycurrency.cpp @@ -307,7 +307,7 @@ void LLFloaterBuyCurrency::buyCurrency(const std::string& name, S32 price) } // static -void LLFloaterBuyCurrency::handleBuyCurrency(bool has_piof, bool has_target, const std::string& name, S32 price) +void LLFloaterBuyCurrency::handleBuyCurrency(bool has_piof, bool has_target, const std::string name, S32 price) { delete sPropertiesRequest; sPropertiesRequest = NULL; -- cgit v1.2.3 From 4afbe638d9965578d53822300e41b00155df5386 Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Tue, 6 Oct 2020 15:56:11 +0300 Subject: SL-14067 FIXED The 'Unable to Buy' (L$) error persists until relogin --- indra/newview/llfloaterbuycurrency.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview/llfloaterbuycurrency.cpp') diff --git a/indra/newview/llfloaterbuycurrency.cpp b/indra/newview/llfloaterbuycurrency.cpp index 5ee6f122bf..0cfac166c7 100644 --- a/indra/newview/llfloaterbuycurrency.cpp +++ b/indra/newview/llfloaterbuycurrency.cpp @@ -193,6 +193,7 @@ void LLFloaterBuyCurrencyUI::updateUI() args["TITLE"] = getString("info_cannot_buy"); args["MESSAGE"] = mManager.errorMessage(); LLNotificationsUtil::add("CouldNotBuyCurrency", args); + mManager.clearError(); closeFloater(); } else -- cgit v1.2.3