From 6b8916e7604d47f37d30ae0c1a6ab2465da1f39d Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Sun, 5 Oct 2014 20:17:29 -0700 Subject: DD-170 : Handle 503 answer from SLM and added a MARKET_MERCHANT_NOT_MIGRATED state to the UI, showing only the relevant UI to the user (i.e. Merchant Outbox or Marketplace Listings). --- indra/newview/llviewermenu.cpp | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'indra/newview/llviewermenu.cpp') diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 38aaff9279..613ad00809 100755 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -88,6 +88,7 @@ #include "llinventoryfunctions.h" #include "llpanellogin.h" #include "llpanelblockedlist.h" +#include "llmarketplacefunctions.h" #include "llmenuoptionpathfindingrebakenavmesh.h" #include "llmoveview.h" #include "llparcel.h" @@ -98,6 +99,7 @@ #include "llspellcheckmenuhandler.h" #include "llstatusbar.h" #include "lltextureview.h" +#include "lltoolbarview.h" #include "lltoolcomp.h" #include "lltoolmgr.h" #include "lltoolpie.h" @@ -386,6 +388,37 @@ void set_underclothes_menu_options() } } +void set_merchant_menu() +{ + if (LLMarketplaceData::instance().getSLMStatus() == MarketplaceStatusCodes::MARKET_MERCHANT_NOT_MIGRATED) + { + // Merchant not migrated: show only the old Merchant Outbox menu + gMenuHolder->getChild("MerchantOutbox")->setVisible(TRUE); + } + else + { + // All other cases (new merchant, not merchant, migrated merchant): show the new Marketplace Listings menu and enable the tool + gMenuHolder->getChild("MarketplaceListings")->setVisible(TRUE); + LLCommand* command = LLCommandManager::instance().getCommand("marketplacelistings"); + gToolBarView->enableCommand(command->id(), true); + } +} + +void check_merchant_status() +{ + if (!gSavedSettings.getBOOL("InventoryOutboxDisplayBoth")) + { + // Hide both merchant related menu items + gMenuHolder->getChild("MerchantOutbox")->setVisible(FALSE); + gMenuHolder->getChild("MarketplaceListings")->setVisible(FALSE); + // Also disable the toolbar button for Marketplace Listings + LLCommand* command = LLCommandManager::instance().getCommand("marketplacelistings"); + gToolBarView->enableCommand(command->id(), false); + // Launch an SLM test connection to get the merchant status + LLMarketplaceData::instance().initializeSLM(boost::bind(&set_merchant_menu)); + } +} + void init_menus() { // Initialize actions -- cgit v1.3 From 5ded6ef85b971a2be9287f11be5acca2b343f364 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 6 Oct 2014 21:09:01 -0700 Subject: DD-170 : Rename enum for consistency --- indra/newview/llmarketplacefunctions.cpp | 2 +- indra/newview/llmarketplacefunctions.h | 2 +- indra/newview/lltoolmgr.cpp | 2 +- indra/newview/llviewermenu.cpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'indra/newview/llviewermenu.cpp') diff --git a/indra/newview/llmarketplacefunctions.cpp b/indra/newview/llmarketplacefunctions.cpp index 58a946e4e4..8988b80a4f 100755 --- a/indra/newview/llmarketplacefunctions.cpp +++ b/indra/newview/llmarketplacefunctions.cpp @@ -156,7 +156,7 @@ protected: else if (HTTP_SERVICE_UNAVAILABLE == getStatus()) { log_SLM_infos("Get /merchant", getStatus(), "Merchant is not migrated"); - LLMarketplaceData::instance().setSLMStatus(MarketplaceStatusCodes::MARKET_MERCHANT_NOT_MIGRATED); + LLMarketplaceData::instance().setSLMStatus(MarketplaceStatusCodes::MARKET_PLACE_NOT_MIGRATED_MERCHANT); } else { diff --git a/indra/newview/llmarketplacefunctions.h b/indra/newview/llmarketplacefunctions.h index ae58f5fc3c..f5b84fcdc3 100755 --- a/indra/newview/llmarketplacefunctions.h +++ b/indra/newview/llmarketplacefunctions.h @@ -68,7 +68,7 @@ namespace MarketplaceStatusCodes MARKET_PLACE_CONNECTION_FAILURE = 2, MARKET_PLACE_MERCHANT = 3, MARKET_PLACE_NOT_MERCHANT = 4, - MARKET_MERCHANT_NOT_MIGRATED = 5 + MARKET_PLACE_NOT_MIGRATED_MERCHANT = 5 }; } diff --git a/indra/newview/lltoolmgr.cpp b/indra/newview/lltoolmgr.cpp index f040a28837..3ecb4015ce 100755 --- a/indra/newview/lltoolmgr.cpp +++ b/indra/newview/lltoolmgr.cpp @@ -350,7 +350,7 @@ bool LLToolMgr::inBuildMode() bool LLToolMgr::canAccessMarketplace() { - return (LLMarketplaceData::instance().getSLMStatus() != MarketplaceStatusCodes::MARKET_MERCHANT_NOT_MIGRATED) || gSavedSettings.getBOOL("InventoryOutboxDisplayBoth"); + return (LLMarketplaceData::instance().getSLMStatus() != MarketplaceStatusCodes::MARKET_PLACE_NOT_MIGRATED_MERCHANT) || gSavedSettings.getBOOL("InventoryOutboxDisplayBoth"); } void LLToolMgr::toggleMarketplace(const LLSD& sdname) diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 613ad00809..b5262a7e1b 100755 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -390,7 +390,7 @@ void set_underclothes_menu_options() void set_merchant_menu() { - if (LLMarketplaceData::instance().getSLMStatus() == MarketplaceStatusCodes::MARKET_MERCHANT_NOT_MIGRATED) + if (LLMarketplaceData::instance().getSLMStatus() == MarketplaceStatusCodes::MARKET_PLACE_NOT_MIGRATED_MERCHANT) { // Merchant not migrated: show only the old Merchant Outbox menu gMenuHolder->getChild("MerchantOutbox")->setVisible(TRUE); -- cgit v1.3 From 8ca0ebbb8b3592f146f77e95a8b93ef4d37cf988 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 14 Oct 2014 21:32:00 -0700 Subject: DD-170 : Check the Merchant Outbox API and hide the menu item if getting 503. Show SLM always. --- indra/newview/llmarketplacefunctions.cpp | 85 ++++++++++++++++---------------- indra/newview/llmarketplacefunctions.h | 3 +- indra/newview/llviewermenu.cpp | 36 +++++++++++--- 3 files changed, 72 insertions(+), 52 deletions(-) (limited to 'indra/newview/llviewermenu.cpp') diff --git a/indra/newview/llmarketplacefunctions.cpp b/indra/newview/llmarketplacefunctions.cpp index 8988b80a4f..fbfddd09a5 100755 --- a/indra/newview/llmarketplacefunctions.cpp +++ b/indra/newview/llmarketplacefunctions.cpp @@ -666,7 +666,7 @@ namespace LLMarketplaceImport { if (gSavedSettings.getBOOL("InventoryOutboxLogging")) { - LL_INFOS() << " SLM POST clearing marketplace cookie due to client or server error" << LL_ENDL; + LL_INFOS() << " SLM POST : Clearing marketplace cookie due to client or server error" << LL_ENDL; } sMarketplaceCookie.clear(); } @@ -746,7 +746,7 @@ namespace LLMarketplaceImport S32 getResultStatus() { - return sImportResultStatus; + return sImportResultStatus; } const LLSD& getResults() @@ -989,47 +989,46 @@ void LLMarketplaceInventoryImporter::updateImport() // If we are no longer in progress if (!mImportInProgress) { - if (mInitialized) - { - // Report results - if (mStatusReportSignal) - { - (*mStatusReportSignal)(LLMarketplaceImport::getResultStatus(), LLMarketplaceImport::getResults()); - } - } - else - { - // Look for results success - mInitialized = LLMarketplaceImport::hasSessionCookie(); - - if (mInitialized) - { - mMarketPlaceStatus = MarketplaceStatusCodes::MARKET_PLACE_MERCHANT; - // Follow up with auto trigger of import - if (mAutoTriggerImport) - { - mAutoTriggerImport = false; - mImportInProgress = triggerImport(); - } - } - else - { - U32 status = LLMarketplaceImport::getResultStatus(); - if ((status == MarketplaceErrorCodes::IMPORT_FORBIDDEN) || - (status == MarketplaceErrorCodes::IMPORT_AUTHENTICATION_ERROR)) - { - mMarketPlaceStatus = MarketplaceStatusCodes::MARKET_PLACE_NOT_MERCHANT; - } - else - { - mMarketPlaceStatus = MarketplaceStatusCodes::MARKET_PLACE_CONNECTION_FAILURE; - } - if (mErrorInitSignal && (mMarketPlaceStatus == MarketplaceStatusCodes::MARKET_PLACE_CONNECTION_FAILURE)) - { - (*mErrorInitSignal)(LLMarketplaceImport::getResultStatus(), LLMarketplaceImport::getResults()); - } - } - } + // Look for results success + mInitialized = LLMarketplaceImport::hasSessionCookie(); + + // Report results + if (mStatusReportSignal) + { + (*mStatusReportSignal)(LLMarketplaceImport::getResultStatus(), LLMarketplaceImport::getResults()); + } + + if (mInitialized) + { + mMarketPlaceStatus = MarketplaceStatusCodes::MARKET_PLACE_MERCHANT; + // Follow up with auto trigger of import + if (mAutoTriggerImport) + { + mAutoTriggerImport = false; + mImportInProgress = triggerImport(); + } + } + else + { + U32 status = LLMarketplaceImport::getResultStatus(); + if ((status == MarketplaceErrorCodes::IMPORT_FORBIDDEN) || + (status == MarketplaceErrorCodes::IMPORT_AUTHENTICATION_ERROR)) + { + mMarketPlaceStatus = MarketplaceStatusCodes::MARKET_PLACE_NOT_MERCHANT; + } + else if (status == MarketplaceErrorCodes::IMPORT_SERVER_API_DISABLED) + { + mMarketPlaceStatus = MarketplaceStatusCodes::MARKET_PLACE_MIGRATED_MERCHANT; + } + else + { + mMarketPlaceStatus = MarketplaceStatusCodes::MARKET_PLACE_CONNECTION_FAILURE; + } + if (mErrorInitSignal && (mMarketPlaceStatus == MarketplaceStatusCodes::MARKET_PLACE_CONNECTION_FAILURE)) + { + (*mErrorInitSignal)(LLMarketplaceImport::getResultStatus(), LLMarketplaceImport::getResults()); + } + } } // Make sure we trigger the status change with the final state (in case of auto trigger after initialize) diff --git a/indra/newview/llmarketplacefunctions.h b/indra/newview/llmarketplacefunctions.h index f5b84fcdc3..18ff313555 100755 --- a/indra/newview/llmarketplacefunctions.h +++ b/indra/newview/llmarketplacefunctions.h @@ -68,7 +68,8 @@ namespace MarketplaceStatusCodes MARKET_PLACE_CONNECTION_FAILURE = 2, MARKET_PLACE_MERCHANT = 3, MARKET_PLACE_NOT_MERCHANT = 4, - MARKET_PLACE_NOT_MIGRATED_MERCHANT = 5 + MARKET_PLACE_NOT_MIGRATED_MERCHANT = 5, + MARKET_PLACE_MIGRATED_MERCHANT = 6 }; } diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index b5262a7e1b..1daa74c68f 100755 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -388,19 +388,33 @@ void set_underclothes_menu_options() } } -void set_merchant_menu() +void set_merchant_SLM_menu() { - if (LLMarketplaceData::instance().getSLMStatus() == MarketplaceStatusCodes::MARKET_PLACE_NOT_MIGRATED_MERCHANT) - { + // DD-170 : SLM Alpha and Beta program : for the moment, we always show the SLM menu and + // tools so that all merchants can try out the UI, even if not migrated. + // *TODO : Keep SLM UI hidden for non migrated merchant in released viewer + + //if (LLMarketplaceData::instance().getSLMStatus() == MarketplaceStatusCodes::MARKET_PLACE_NOT_MIGRATED_MERCHANT) + //{ // Merchant not migrated: show only the old Merchant Outbox menu - gMenuHolder->getChild("MerchantOutbox")->setVisible(TRUE); - } - else - { + // gMenuHolder->getChild("MerchantOutbox")->setVisible(TRUE); + //} + //else + //{ // All other cases (new merchant, not merchant, migrated merchant): show the new Marketplace Listings menu and enable the tool gMenuHolder->getChild("MarketplaceListings")->setVisible(TRUE); LLCommand* command = LLCommandManager::instance().getCommand("marketplacelistings"); gToolBarView->enableCommand(command->id(), true); + //} +} + +void set_merchant_outbox_menu(U32 status, const LLSD& content) +{ + // If the merchant is fully migrated, the API is disabled (503) and we won't show the old menu item. + // In all other cases, we show it. + if (status != MarketplaceErrorCodes::IMPORT_SERVER_API_DISABLED) + { + gMenuHolder->getChild("MerchantOutbox")->setVisible(TRUE); } } @@ -411,11 +425,17 @@ void check_merchant_status() // Hide both merchant related menu items gMenuHolder->getChild("MerchantOutbox")->setVisible(FALSE); gMenuHolder->getChild("MarketplaceListings")->setVisible(FALSE); + // Also disable the toolbar button for Marketplace Listings LLCommand* command = LLCommandManager::instance().getCommand("marketplacelistings"); gToolBarView->enableCommand(command->id(), false); + // Launch an SLM test connection to get the merchant status - LLMarketplaceData::instance().initializeSLM(boost::bind(&set_merchant_menu)); + LLMarketplaceData::instance().initializeSLM(boost::bind(&set_merchant_SLM_menu)); + + // Launch a Merchant Outbox test connection to get the migration status + LLMarketplaceInventoryImporter::instance().setStatusReportCallback(boost::bind(&set_merchant_outbox_menu,_1, _2)); + LLMarketplaceInventoryImporter::instance().initialize(); } } -- cgit v1.3 From 00f3850fe2e2527f7f0f663f94cdabc83949b946 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Sun, 14 Dec 2014 15:48:46 -0800 Subject: DD-299 : Suppress cap hardcoded fallback. Recheck cap after each teleport. --- indra/newview/llagent.cpp | 6 ++++++ indra/newview/llmarketplacefunctions.cpp | 19 ++++++++----------- indra/newview/llmarketplacefunctions.h | 2 +- indra/newview/llstartup.cpp | 7 ++----- indra/newview/llviewermenu.cpp | 21 +++++++++++++++------ 5 files changed, 32 insertions(+), 23 deletions(-) (limited to 'indra/newview/llviewermenu.cpp') diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index e5a90e8a28..392fe8fc2e 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -3867,6 +3867,12 @@ void LLAgent::handleTeleportFinished() LLNotificationsUtil::add("PreferredMaturityChanged", args); mIsMaturityRatingChangingDuringTeleport = false; } + + // Init SLM Marketplace connection so we know which UI should be used for the user as a merchant + // Note: Eventually, all merchant will be migrated to the new SLM system and there will be no reason to show the old UI at all. + // Note: Some regions will not support the SLM cap for a while so we need to do that check for each teleport. + // *TODO : Suppress that line from here once the whole grid migrated to SLM and move it to idle_startup() (llstartup.cpp) + check_merchant_status(); } void LLAgent::handleTeleportFailed() diff --git a/indra/newview/llmarketplacefunctions.cpp b/indra/newview/llmarketplacefunctions.cpp index d900d29925..c35b251c7e 100755 --- a/indra/newview/llmarketplacefunctions.cpp +++ b/indra/newview/llmarketplacefunctions.cpp @@ -1178,10 +1178,13 @@ void LLMarketplaceData::initializeSLM(const status_updated_signal_t::slot_type& else { // Initiate SLM connection and set responder - mMarketPlaceStatus = MarketplaceStatusCodes::MARKET_PLACE_INITIALIZING; std::string url = getSLMConnectURL("/merchant"); - log_SLM_infos("LLHTTPClient::get", url, ""); - LLHTTPClient::get(url, new LLSLMGetMerchantResponder(), LLSD()); + if (url != "") + { + mMarketPlaceStatus = MarketplaceStatusCodes::MARKET_PLACE_INITIALIZING; + log_SLM_infos("LLHTTPClient::get", url, ""); + LLHTTPClient::get(url, new LLSLMGetMerchantResponder(), LLSD()); + } } } @@ -1325,16 +1328,10 @@ std::string LLMarketplaceData::getSLMConnectURL(const std::string& route) { // Get DirectDelivery cap url = regionp->getCapability("DirectDelivery"); - // *TODO : Take this DirectDelivery cap coping mechanism hack out - if (url == "") - { - url = "https://marketplace.secondlife-staging.com/api/1/viewer/" + gAgentID.asString(); - } - else + if (url != "") { - llinfos << "Merov : DD cap = " << url << ", agent = " << gAgentID.asString() << llendl; + url += route; } - url += route; } return url; } diff --git a/indra/newview/llmarketplacefunctions.h b/indra/newview/llmarketplacefunctions.h index 391ab8a733..4aca88cba1 100755 --- a/indra/newview/llmarketplacefunctions.h +++ b/indra/newview/llmarketplacefunctions.h @@ -187,6 +187,7 @@ public: typedef boost::signals2::signal status_updated_signal_t; void initializeSLM(const status_updated_signal_t::slot_type& cb); U32 getSLMStatus() const { return mMarketPlaceStatus; } + void setSLMStatus(U32 status); void getSLMListings(); bool isEmpty() { return (mMarketplaceItems.size() == 0); } @@ -234,7 +235,6 @@ private: bool setCountOnHand(const LLUUID& folder_id, S32 count, bool update = true); // Private SLM API : package data and get/post/put requests to the SLM Server through the SLM API - void setSLMStatus(U32 status); void createSLMListing(const LLUUID& folder_id); void getSLMListing(S32 listing_id); void updateSLMListing(const LLUUID& folder_id, S32 listing_id, const LLUUID& version_id, bool is_listed, S32 count); diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index fa8a6eb87a..cfc654eb98 100755 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -1876,11 +1876,8 @@ bool idle_startup() display_startup(); - // Init SLM Marketplace connection so we know which UI should be used for the user as a merchant - // Note: Eventually, all merchant will be migrated to the new SLM system and there will be no - // reason to show the old UI at all. - // *TODO : Suppress the Merchant Outbox UI completely - check_merchant_status(); + // *TODO : Uncomment that line once the whole grid migrated to SLM and suppress it from LLAgent::handleTeleportFinished() (llagent.cpp) + //check_merchant_status(); display_startup(); diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 2fb1713062..1de615aa6e 100755 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -422,8 +422,10 @@ void check_merchant_status() { if (!gSavedSettings.getBOOL("InventoryOutboxDisplayBoth")) { - // Hide both merchant related menu items - gMenuHolder->getChild("MerchantOutbox")->setVisible(FALSE); + // Reset the SLM status: we actually want to check again, that's the point of calling check_merchant_status() + LLMarketplaceData::instance().setSLMStatus(MarketplaceStatusCodes::MARKET_PLACE_NOT_INITIALIZED); + + // Hide SLM related menu item gMenuHolder->getChild("MarketplaceListings")->setVisible(FALSE); // Also disable the toolbar button for Marketplace Listings @@ -432,10 +434,17 @@ void check_merchant_status() // Launch an SLM test connection to get the merchant status LLMarketplaceData::instance().initializeSLM(boost::bind(&set_merchant_SLM_menu)); - - // Launch a Merchant Outbox test connection to get the migration status - LLMarketplaceInventoryImporter::instance().setStatusReportCallback(boost::bind(&set_merchant_outbox_menu,_1, _2)); - LLMarketplaceInventoryImporter::instance().initialize(); + + // Do the Merchant Outbox init only once per session + if (LLMarketplaceInventoryImporter::instance().getMarketPlaceStatus() == MarketplaceStatusCodes::MARKET_PLACE_NOT_INITIALIZED) + { + // Hide merchant outbox related menu item + gMenuHolder->getChild("MerchantOutbox")->setVisible(FALSE); + + // Launch a Merchant Outbox test connection to get the migration status + LLMarketplaceInventoryImporter::instance().setStatusReportCallback(boost::bind(&set_merchant_outbox_menu,_1, _2)); + LLMarketplaceInventoryImporter::instance().initialize(); + } } } -- cgit v1.3