void LLMarketplaceInventoryImporter::updateImport() { const bool in_progress = LLMarketplaceImport::inProgress(); if (in_progress && !LLMarketplaceImport::resultPending()) { const bool polling_status = LLMarketplaceImport::pollStatus(); if (!polling_status) { reinitializeAndTriggerImport(); } } if (mImportInProgress != in_progress) { mImportInProgress = in_progress; // 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) { // Follow up with auto trigger of import if (mAutoTriggerImport) { mAutoTriggerImport = false; mImportInProgress = triggerImport(); } } else if (mErrorInitSignal) { (*mErrorInitSignal)(LLMarketplaceImport::getResultStatus(), LLMarketplaceImport::getResults()); } } } // Make sure we trigger the status change with the final state (in case of auto trigger after initialize) if (mStatusChangedSignal) { (*mStatusChangedSignal)(mImportInProgress); } } }
bool LLMarketplaceInventoryImporter::triggerImport() { const bool import_triggered = LLMarketplaceImport::triggerImport(); if (!import_triggered) { reinitializeAndTriggerImport(); } return import_triggered; }
void LLMarketplaceInventoryImporter::updateImport() { const bool in_progress = LLMarketplaceImport::inProgress(); if (in_progress && !LLMarketplaceImport::resultPending()) { const bool polling_status = LLMarketplaceImport::pollStatus(); if (!polling_status) { reinitializeAndTriggerImport(); } } if (mImportInProgress != in_progress) { mImportInProgress = in_progress; // 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()); } } } } // Make sure we trigger the status change with the final state (in case of auto trigger after initialize) if (mStatusChangedSignal) { (*mStatusChangedSignal)(mImportInProgress); } } }