Skip to content

Commit

Permalink
Disable update check for homebrew builds.
Browse files Browse the repository at this point in the history
  • Loading branch information
clangen committed Apr 13, 2023
1 parent fd06b85 commit 1c02219
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- libopenmpt@0.6.9
- asio@1.27.0
* update to PDCursesMod@4.3.6 for Windows builds
* disable update check for `homebrew` builds

--------------------------------------------------------------------------------

Expand Down
7 changes: 7 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,13 @@ add_definitions(
-D_WEBSOCKETPP_CPP11_RANDOM_DEVICE_
-DASIO_STANDALONE)

# disable update check for environments that we know will provided hosted,
# prebuilt binaries.
if (DEFINED ENV{HOMEBREW_PREFIX})
message(STATUS "[build] detected homebrew, disabling update check functionality.")
add_definitions(-DDISABLE_UPDATE_CHECK)
endif()

if (${BUILD_STANDALONE} MATCHES "true")
find_vendor_library(LIBCURL curl)
find_vendor_library(LIBSSL ssl)
Expand Down
2 changes: 2 additions & 0 deletions src/musikcube/app/layout/MainLayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ void MainLayout::OnTrackChanged(size_t index, musik::core::TrackPtr track) {
}

void MainLayout::RunUpdateCheck() {
#ifndef DISABLE_UPDATE_CHECK
if (!prefs->GetBool(cube::prefs::keys::AutoUpdateCheck, true)) {
return;
}
Expand All @@ -360,4 +361,5 @@ void MainLayout::RunUpdateCheck() {
UpdateCheck::ShowUpgradeAvailableOverlay(version, url);
}
});
#endif
}
13 changes: 12 additions & 1 deletion src/musikcube/app/layout/SettingsLayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,9 @@ static const std::string arrow = "> ";

static inline std::shared_ptr<ISchema> AdvancedSettingsSchema() {
auto schema = std::make_shared<TSchema<>>();
#ifndef DISABLE_UPDATE_CHECK
schema->AddBool(cube::prefs::keys::AutoUpdateCheck, false);
#endif
#ifdef ENABLE_MINIMIZE_TO_TRAY
schema->AddBool(cube::prefs::keys::MinimizeToTray, false);
schema->AddBool(cube::prefs::keys::StartMinimized, false);
Expand Down Expand Up @@ -310,6 +312,7 @@ void SettingsLayout::OnAdvancedSettingsActivate(cursespp::TextLabel* label) {
}

void SettingsLayout::OnUpdateDropdownActivate(cursespp::TextLabel* label) {
#ifndef DISABLE_UPDATE_CHECK
updateCheck.Run([this](bool updateRequired, std::string version, std::string url) {
if (updateRequired) {
UpdateCheck::ShowUpgradeAvailableOverlay(version, url, false);
Expand All @@ -318,6 +321,7 @@ void SettingsLayout::OnUpdateDropdownActivate(cursespp::TextLabel* label) {
UpdateCheck::ShowNoUpgradeFoundOverlay();
}
});
#endif
}

void SettingsLayout::OnThemeDropdownActivate(cursespp::TextLabel* label) {
Expand Down Expand Up @@ -386,8 +390,9 @@ void SettingsLayout::OnLayout() {
this->saveSessionCheckbox->MoveAndResize(column2, y++, columnCx, kLabelHeight);
this->pluginsDropdown->MoveAndResize(column2, y++, columnCx, kLabelHeight);
this->advancedDropdown->MoveAndResize(column2, y++, columnCx, kLabelHeight);
#ifndef DISABLE_UPDATE_CHECK
this->updateDropdown->MoveAndResize(column2, y++, columnCx, kLabelHeight);

#endif
this->appVersion->MoveAndResize(0, cy - 1, cx, kLabelHeight);
}

Expand Down Expand Up @@ -445,9 +450,11 @@ void SettingsLayout::InitializeWindows() {
this->serverDropdown->Activated.connect(this, &SettingsLayout::OnServerDropdownActivate);
}

#ifndef DISABLE_UPDATE_CHECK
this->updateDropdown = std::make_shared<TextLabel>();
this->updateDropdown->SetText(arrow + _TSTR("settings_check_for_updates"));
this->updateDropdown->Activated.connect(this, &SettingsLayout::OnUpdateDropdownActivate);
#endif

this->advancedDropdown = std::make_shared<TextLabel>();
this->advancedDropdown->SetText(arrow + _TSTR("settings_advanced_settings"));
Expand Down Expand Up @@ -496,7 +503,9 @@ void SettingsLayout::InitializeWindows() {
this->saveSessionCheckbox->SetFocusOrder(order++);
this->pluginsDropdown->SetFocusOrder(order++);
this->advancedDropdown->SetFocusOrder(order++);
#ifndef DISABLE_UPDATE_CHECK
this->updateDropdown->SetFocusOrder(order++);
#endif

this->AddWindow(this->libraryTypeDropdown);
this->AddWindow(this->localLibraryLayout);
Expand Down Expand Up @@ -528,7 +537,9 @@ void SettingsLayout::InitializeWindows() {
this->AddWindow(this->saveSessionCheckbox);
this->AddWindow(this->pluginsDropdown);
this->AddWindow(this->advancedDropdown);
#ifndef DISABLE_UPDATE_CHECK
this->AddWindow(this->updateDropdown);
#endif
this->AddWindow(this->appVersion);
}

Expand Down

0 comments on commit 1c02219

Please sign in to comment.