summaryrefslogtreecommitdiff
path: root/indra/newview/llmarketplacefunctions.cpp
diff options
context:
space:
mode:
authorMerov Linden <merov@lindenlab.com>2015-03-05 21:58:57 -0800
committerMerov Linden <merov@lindenlab.com>2015-03-05 21:58:57 -0800
commitdf918447b7f804bb02f81ebc6f5f22babc8bb2d1 (patch)
tree9545a95c72e227009a55d22c0ad35728ceeb1891 /indra/newview/llmarketplacefunctions.cpp
parent50a5aefb6fcfd0b4c87e5d0aea6c171ae460f3a5 (diff)
DD-339 : Adding loading indicator to marketplace floater when the listings data and inventory data are being fetched
Diffstat (limited to 'indra/newview/llmarketplacefunctions.cpp')
-rwxr-xr-xindra/newview/llmarketplacefunctions.cpp35
1 files changed, 24 insertions, 11 deletions
diff --git a/indra/newview/llmarketplacefunctions.cpp b/indra/newview/llmarketplacefunctions.cpp
index c0823cf1de..ab3be79a2e 100755
--- a/indra/newview/llmarketplacefunctions.cpp
+++ b/indra/newview/llmarketplacefunctions.cpp
@@ -154,10 +154,6 @@ void log_SLM_infos(const std::string& request, const std::string& url, const std
}
}
-// Merov: This is a temporary hack used by dev while secondlife-staging is down...
-// *TODO : Suppress that before shipping!
-static bool sBypassMerchant = false;
-
class LLSLMGetMerchantResponder : public LLHTTPClient::Responder
{
LOG_CLASS(LLSLMGetMerchantResponder);
@@ -168,13 +164,7 @@ public:
protected:
virtual void httpFailure()
{
- if (sBypassMerchant)
- {
- // *TODO : Suppress that before shipping!
- log_SLM_infos("Get /merchant", getStatus(), "SLM Connection error bypassed (debug only)");
- LLMarketplaceData::instance().setSLMStatus(MarketplaceStatusCodes::MARKET_PLACE_MERCHANT);
- }
- else if (HTTP_NOT_FOUND == getStatus())
+ if (HTTP_NOT_FOUND == getStatus())
{
log_SLM_infos("Get /merchant", getStatus(), "User is not a merchant");
LLMarketplaceData::instance().setSLMStatus(MarketplaceStatusCodes::MARKET_PLACE_NOT_MERCHANT);
@@ -222,6 +212,7 @@ public:
if (!isGoodStatus())
{
log_SLM_warning("Get /listings", getStatus(), getReason(), "", body);
+ LLMarketplaceData::instance().setSLMDataFetched(MarketplaceFetchCodes::MARKET_FETCH_FAILED);
update_marketplace_category(mExpectedFolderId, false);
gInventory.notifyObservers();
return;
@@ -232,6 +223,7 @@ public:
if (!reader.parse(body,root))
{
log_SLM_warning("Get /listings", getStatus(), "Json parsing failed", reader.getFormatedErrorMessages(), body);
+ LLMarketplaceData::instance().setSLMDataFetched(MarketplaceFetchCodes::MARKET_FETCH_FAILED);
update_marketplace_category(mExpectedFolderId, false);
gInventory.notifyObservers();
return;
@@ -263,6 +255,7 @@ public:
}
// Update all folders under the root
+ LLMarketplaceData::instance().setSLMDataFetched(MarketplaceFetchCodes::MARKET_FETCH_DONE);
update_marketplace_category(mExpectedFolderId, false);
gInventory.notifyObservers();
}
@@ -1194,7 +1187,9 @@ LLMarketplaceTuple::LLMarketplaceTuple(const LLUUID& folder_id, S32 listing_id,
// Data map
LLMarketplaceData::LLMarketplaceData() :
mMarketPlaceStatus(MarketplaceStatusCodes::MARKET_PLACE_NOT_INITIALIZED),
+ mMarketPlaceDataFetched(MarketplaceFetchCodes::MARKET_FETCH_NOT_DONE),
mStatusUpdatedSignal(NULL),
+ mDataFetchedSignal(NULL),
mDirtyCount(false)
{
mInventoryObserver = new LLMarketplaceInventoryObserver;
@@ -1232,6 +1227,15 @@ void LLMarketplaceData::initializeSLM(const status_updated_signal_t::slot_type&
}
}
+void LLMarketplaceData::setDataFetchedSignal(const status_updated_signal_t::slot_type& cb)
+{
+ if (mDataFetchedSignal == NULL)
+ {
+ mDataFetchedSignal = new status_updated_signal_t();
+ }
+ mDataFetchedSignal->connect(cb);
+}
+
// Get/Post/Put requests to the SLM Server using the SLM API
void LLMarketplaceData::getSLMListings()
{
@@ -1397,6 +1401,15 @@ void LLMarketplaceData::setSLMStatus(U32 status)
}
}
+void LLMarketplaceData::setSLMDataFetched(U32 status)
+{
+ mMarketPlaceDataFetched = status;
+ if (mDataFetchedSignal)
+ {
+ (*mDataFetchedSignal)();
+ }
+}
+
// Creation / Deletion / Update
// Methods publicly called
bool LLMarketplaceData::createListing(const LLUUID& folder_id)