Skip to content

Commit

Permalink
allow disable desktop and viewer upgrades
Browse files Browse the repository at this point in the history
  • Loading branch information
lurume84 committed Apr 25, 2020
1 parent 8c49dec commit 3e94a94
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 21 deletions.
25 changes: 15 additions & 10 deletions src/DesktopCore/Upgrade/Agents/UpgradeDesktopAgent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,27 @@ namespace desktop { namespace core { namespace agent {
, m_folderOperationService(std::move(folderOperationService))
, m_applicationService(std::move(applicationService))
, m_iniFileService(std::move(iniFileService))
, m_enabled(true)
, m_enabled(false)
{
armTimer(1);
auto documents = m_applicationService->getMyDocuments();

boost::thread t(boost::bind(&boost::asio::io_service::run, &m_ioService));
m_backgroundThread.swap(t);
if (m_iniFileService->get<bool>(documents + "Bling.ini", "UpgradeDesktop", "Enabled", true))
{
m_enabled = true;

auto documents = m_applicationService->getMyDocuments();
armTimer(1);

m_host = m_iniFileService->get<std::string>(documents + "Bling.ini", "UpgradeDesktop", "Host", "api.github.com");
m_repository = m_iniFileService->get<std::string>(documents + "Bling.ini", "UpgradeDesktop", "Repository", "/repos/lurume84/bling-desktop/releases/latest");
m_inFolder = m_iniFileService->get<std::string>(documents + "Bling.ini", "UpgradeDesktop", "Input", documents + "Download\\Versions\\Desktop\\");
boost::thread t(boost::bind(&boost::asio::io_service::run, &m_ioService));
m_backgroundThread.swap(t);

boost::filesystem::create_directories(m_inFolder);
m_host = m_iniFileService->get<std::string>(documents + "Bling.ini", "UpgradeDesktop", "Host", "api.github.com");
m_repository = m_iniFileService->get<std::string>(documents + "Bling.ini", "UpgradeDesktop", "Repository", "/repos/lurume84/bling-desktop/releases/latest");
m_inFolder = m_iniFileService->get<std::string>(documents + "Bling.ini", "UpgradeDesktop", "Input", documents + "Download\\Versions\\Desktop\\");

service::LogService::info("Desktop Upgrades from {}{} to {}", m_host, m_repository, m_inFolder);
boost::filesystem::create_directories(m_inFolder);

service::LogService::info("Desktop Upgrades from {}{} to {}", m_host, m_repository, m_inFolder);
}
}

UpgradeDesktopAgent::~UpgradeDesktopAgent()
Expand Down
27 changes: 16 additions & 11 deletions src/DesktopCore/Upgrade/Agents/UpgradeViewerAgent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,28 @@ namespace desktop { namespace core { namespace agent {
, m_folderOperationService(std::move(folderOperationService))
, m_applicationService(std::move(applicationService))
, m_iniFileService(std::move(iniFileService))
, m_enabled(true)
, m_enabled(false)
{
armTimer(5);
auto documents = m_applicationService->getMyDocuments();

boost::thread t(boost::bind(&boost::asio::io_service::run, &m_ioService));
m_backgroundThread.swap(t);
if (m_iniFileService->get<bool>(documents + "Bling.ini", "UpgradeViewer", "Enabled", true))
{
m_enabled = true;

auto documents = m_applicationService->getMyDocuments();
armTimer(5);

m_host = m_iniFileService->get<std::string>(documents + "Bling.ini", "UpgradeViewer", "Host", "api.github.com");
m_repository = m_iniFileService->get<std::string>(documents + "Bling.ini", "UpgradeViewer", "Repository", "/repos/lurume84/bling-viewer/releases/latest");
m_inFolder = m_iniFileService->get<std::string>(documents + "Bling.ini", "UpgradeViewer", "Input", documents + "Download\\Versions\\Viewer\\");
m_outFolder = m_iniFileService->get<std::string>(documents + "Bling.ini", "UpgradeViewer", "Output", m_applicationService->getViewerFolder());
boost::thread t(boost::bind(&boost::asio::io_service::run, &m_ioService));
m_backgroundThread.swap(t);

boost::filesystem::create_directories(m_inFolder);
m_host = m_iniFileService->get<std::string>(documents + "Bling.ini", "UpgradeViewer", "Host", "api.github.com");
m_repository = m_iniFileService->get<std::string>(documents + "Bling.ini", "UpgradeViewer", "Repository", "/repos/lurume84/bling-viewer/releases/latest");
m_inFolder = m_iniFileService->get<std::string>(documents + "Bling.ini", "UpgradeViewer", "Input", documents + "Download\\Versions\\Viewer\\");
m_outFolder = m_iniFileService->get<std::string>(documents + "Bling.ini", "UpgradeViewer", "Output", m_applicationService->getViewerFolder());

service::LogService::info("Viewer Upgrades from {}{} to {}", m_host, m_repository, m_inFolder);
boost::filesystem::create_directories(m_inFolder);

service::LogService::info("Viewer Upgrades from {}{} to {}", m_host, m_repository, m_inFolder);
}
}

UpgradeViewerAgent::~UpgradeViewerAgent()
Expand Down

0 comments on commit 3e94a94

Please sign in to comment.