DD-22 : WIP : Fix initialization glitch and got rid of old Merchant Outbox remnants in Marketplace
parent
6d7b33f77e
commit
fc4939033e
|
|
@ -160,8 +160,7 @@ public:
|
|||
|
||||
if (added_category_type == LLFolderType::FT_MARKETPLACE_LISTINGS)
|
||||
{
|
||||
//mMarketplaceListingsFloater->initializeMarketPlace();
|
||||
LLMarketplaceData::instance().initializeSLM();
|
||||
mMarketplaceListingsFloater->initializeMarketPlace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -235,11 +234,9 @@ void LLFloaterMarketplaceListings::onOpen(const LLSD& key)
|
|||
//
|
||||
// Initialize the Market Place or go update the marketplace listings
|
||||
//
|
||||
//if (LLMarketplaceInventoryImporter::getInstance()->getMarketPlaceStatus() == MarketplaceStatusCodes::MARKET_PLACE_NOT_INITIALIZED)
|
||||
if (LLMarketplaceData::instance().getSLMStatus() == MarketplaceStatusCodes::MARKET_PLACE_NOT_INITIALIZED)
|
||||
{
|
||||
//initializeMarketPlace();
|
||||
LLMarketplaceData::instance().initializeSLM();
|
||||
initializeMarketPlace();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -272,7 +269,6 @@ void LLFloaterMarketplaceListings::fetchContents()
|
|||
|
||||
void LLFloaterMarketplaceListings::setup()
|
||||
{
|
||||
//if (LLMarketplaceInventoryImporter::getInstance()->getMarketPlaceStatus() != MarketplaceStatusCodes::MARKET_PLACE_MERCHANT)
|
||||
if (LLMarketplaceData::instance().getSLMStatus() != MarketplaceStatusCodes::MARKET_PLACE_MERCHANT)
|
||||
{
|
||||
// If we are *not* a merchant or we have no market place connection established yet, do nothing
|
||||
|
|
@ -327,18 +323,7 @@ void LLFloaterMarketplaceListings::setup()
|
|||
|
||||
void LLFloaterMarketplaceListings::initializeMarketPlace()
|
||||
{
|
||||
//
|
||||
// Initialize the marketplace import API
|
||||
//
|
||||
LLMarketplaceInventoryImporter& importer = LLMarketplaceInventoryImporter::instance();
|
||||
|
||||
if (!importer.isInitialized())
|
||||
{
|
||||
importer.setInitializationErrorCallback(boost::bind(&LLFloaterMarketplaceListings::initializationReportError, this, _1, _2));
|
||||
importer.setStatusChangedCallback(boost::bind(&LLFloaterMarketplaceListings::importStatusChanged, this, _1));
|
||||
importer.setStatusReportCallback(boost::bind(&LLFloaterMarketplaceListings::importReportResults, this, _1, _2));
|
||||
importer.initialize();
|
||||
}
|
||||
LLMarketplaceData::instance().initializeSLM(boost::bind(&LLFloaterMarketplaceListings::updateView, this));
|
||||
}
|
||||
|
||||
S32 LLFloaterMarketplaceListings::getFolderCount()
|
||||
|
|
@ -379,9 +364,27 @@ void LLFloaterMarketplaceListings::updateView()
|
|||
std::string tooltip;
|
||||
|
||||
const LLSD& subs = getMarketplaceStringSubstitutions();
|
||||
//U32 mkt_status = LLMarketplaceInventoryImporter::getInstance()->getMarketPlaceStatus();
|
||||
U32 mkt_status = LLMarketplaceData::instance().getSLMStatus();
|
||||
|
||||
// Get or create the root folder if we are a merchant and it hasn't been done already
|
||||
if (mRootFolderId.isNull() && (mkt_status == MarketplaceStatusCodes::MARKET_PLACE_MERCHANT))
|
||||
{
|
||||
setup();
|
||||
}
|
||||
|
||||
// Update the bottom initializing status and progress dial
|
||||
if (mkt_status == MarketplaceStatusCodes::MARKET_PLACE_INITIALIZING)
|
||||
{
|
||||
setStatusString(getString("MarketplaceListingsInitializing"));
|
||||
mInventoryInitializationInProgress->setVisible(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
setStatusString("");
|
||||
mInventoryInitializationInProgress->setVisible(false);
|
||||
}
|
||||
|
||||
// Update the top message or flip to the tabs and folders view
|
||||
// *TODO : check those messages and create better appropriate ones in strings.xml
|
||||
if (mRootFolderId.notNull())
|
||||
{
|
||||
|
|
@ -483,38 +486,6 @@ void LLFloaterMarketplaceListings::onChanged()
|
|||
}
|
||||
}
|
||||
|
||||
void LLFloaterMarketplaceListings::initializationReportError(U32 status, const LLSD& content)
|
||||
{
|
||||
updateView();
|
||||
}
|
||||
|
||||
void LLFloaterMarketplaceListings::importStatusChanged(bool inProgress)
|
||||
{
|
||||
//if (mRootFolderId.isNull() && (LLMarketplaceInventoryImporter::getInstance()->getMarketPlaceStatus() == MarketplaceStatusCodes::MARKET_PLACE_MERCHANT))
|
||||
if (mRootFolderId.isNull() && (LLMarketplaceData::instance().getSLMStatus() == MarketplaceStatusCodes::MARKET_PLACE_MERCHANT))
|
||||
{
|
||||
setup();
|
||||
}
|
||||
|
||||
if (inProgress)
|
||||
{
|
||||
setStatusString(getString("MarketplaceListingsInitializing"));
|
||||
mInventoryInitializationInProgress->setVisible(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
setStatusString("");
|
||||
mInventoryInitializationInProgress->setVisible(false);
|
||||
}
|
||||
|
||||
updateView();
|
||||
}
|
||||
|
||||
void LLFloaterMarketplaceListings::importReportResults(U32 status, const LLSD& content)
|
||||
{
|
||||
updateView();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// LLFloaterAssociateListing
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -94,9 +94,6 @@ protected:
|
|||
void setup();
|
||||
void fetchContents();
|
||||
|
||||
void importReportResults(U32 status, const LLSD& content);
|
||||
void importStatusChanged(bool inProgress);
|
||||
void initializationReportError(U32 status, const LLSD& content);
|
||||
void setStatusString(const std::string& statusString);
|
||||
|
||||
void onClose(bool app_quitting);
|
||||
|
|
|
|||
|
|
@ -602,7 +602,8 @@ LLMarketplaceTuple::LLMarketplaceTuple(const LLUUID& folder_id, S32 listing_id,
|
|||
|
||||
// Data map
|
||||
LLMarketplaceData::LLMarketplaceData() :
|
||||
mMarketPlaceStatus(MarketplaceStatusCodes::MARKET_PLACE_NOT_INITIALIZED)
|
||||
mMarketPlaceStatus(MarketplaceStatusCodes::MARKET_PLACE_NOT_INITIALIZED),
|
||||
mStatusUpdatedSignal(NULL)
|
||||
{
|
||||
mTestCurrentMarketplaceID = 1234567;
|
||||
}
|
||||
|
|
@ -612,9 +613,14 @@ S32 LLMarketplaceData::getTestMarketplaceID()
|
|||
return mTestCurrentMarketplaceID++;
|
||||
}
|
||||
|
||||
void LLMarketplaceData::initializeSLM()
|
||||
void LLMarketplaceData::initializeSLM(const status_updated_signal_t::slot_type& cb)
|
||||
{
|
||||
mMarketPlaceStatus = MarketplaceStatusCodes::MARKET_PLACE_INITIALIZING;
|
||||
if (mStatusUpdatedSignal == NULL)
|
||||
{
|
||||
mStatusUpdatedSignal = new status_updated_signal_t();
|
||||
}
|
||||
mStatusUpdatedSignal->connect(cb);
|
||||
|
||||
// Get DirectDelivery cap
|
||||
std::string url = "";
|
||||
|
|
@ -638,6 +644,17 @@ void LLMarketplaceData::initializeSLM()
|
|||
LLHTTPClient::get(url, new LLSLMMerchantResponder(), LLSD());
|
||||
}
|
||||
|
||||
void LLMarketplaceData::setSLMStatus(U32 status)
|
||||
{
|
||||
mMarketPlaceStatus = status; /* call cb if status is "done" */
|
||||
|
||||
// Make sure we trigger the status change with the current state
|
||||
if (mStatusUpdatedSignal)
|
||||
{
|
||||
(*mStatusUpdatedSignal)();
|
||||
}
|
||||
}
|
||||
|
||||
// Creation / Deletion
|
||||
bool LLMarketplaceData::addListing(const LLUUID& folder_id)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -146,9 +146,10 @@ public:
|
|||
LLMarketplaceData();
|
||||
|
||||
// SLM
|
||||
typedef boost::signals2::signal<void ()> status_updated_signal_t;
|
||||
U32 getSLMStatus() const { return mMarketPlaceStatus; }
|
||||
void setSLMStatus(U32 status) { mMarketPlaceStatus = status; }
|
||||
void initializeSLM();
|
||||
void setSLMStatus(U32 status);
|
||||
void initializeSLM(const status_updated_signal_t::slot_type& cb);
|
||||
|
||||
bool isEmpty() { return (mMarketplaceItems.size() == 0); }
|
||||
|
||||
|
|
@ -179,6 +180,7 @@ public:
|
|||
private:
|
||||
marketplace_items_list_t mMarketplaceItems;
|
||||
U32 mMarketPlaceStatus;
|
||||
status_updated_signal_t * mStatusUpdatedSignal;
|
||||
// Merov : This is for test only, waiting for SLM API
|
||||
S32 mTestCurrentMarketplaceID;
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue