Implement compile-time flag to disable automatic update checks. (#4854)

Usage: `cmake -DCHATTERINO_UPDATER=OFF ..`

Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
Co-authored-by: Felanbird <41973452+Felanbird@users.noreply.github.com>
This commit is contained in:
Patrick Klein 2023-10-02 10:43:20 +01:00 committed by GitHub
parent bc218b4261
commit 5b17ae3f7e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 6 deletions

View file

@ -29,6 +29,7 @@
- Dev: Clarify signal connection lifetimes where applicable. (#4818) - Dev: Clarify signal connection lifetimes where applicable. (#4818)
- Dev: Laid the groundwork for advanced input completion strategies. (#4639, #4846, #4853) - Dev: Laid the groundwork for advanced input completion strategies. (#4639, #4846, #4853)
- Dev: Fixed flickering when running with Direct2D on Windows. (#4851) - Dev: Fixed flickering when running with Direct2D on Windows. (#4851)
- Dev: Add a compile-time flag `CHATTERINO_DISABLE_UPDATER` to disable update checks. (#4854)
## 2.4.6 ## 2.4.6

View file

@ -27,6 +27,9 @@ option(BUILD_SHARED_LIBS "" OFF)
option(CHATTERINO_LTO "Enable LTO for all targets" OFF) option(CHATTERINO_LTO "Enable LTO for all targets" OFF)
option(CHATTERINO_PLUGINS "Enable EXPERIMENTAL plugin support in Chatterino" OFF) option(CHATTERINO_PLUGINS "Enable EXPERIMENTAL plugin support in Chatterino" OFF)
option(CHATTERINO_UPDATER "Enable update checks" ON)
mark_as_advanced(CHATTERINO_UPDATER)
if(CHATTERINO_LTO) if(CHATTERINO_LTO)
include(CheckIPOSupported) include(CheckIPOSupported)
check_ipo_supported(RESULT CHATTERINO_ENABLE_LTO OUTPUT IPO_ERROR) check_ipo_supported(RESULT CHATTERINO_ENABLE_LTO OUTPUT IPO_ERROR)

View file

@ -1039,3 +1039,8 @@ if(CHATTERINO_ENABLE_LTO)
set_property(TARGET ${LIBRARY_PROJECT} set_property(TARGET ${LIBRARY_PROJECT}
PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE) PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
endif() endif()
if(NOT CHATTERINO_UPDATER)
message(STATUS "Disabling the updater.")
target_compile_definitions(${LIBRARY_PROJECT} PUBLIC CHATTERINO_DISABLE_UPDATER)
endif()

View file

@ -250,6 +250,7 @@ void Updates::installUpdates()
void Updates::checkForUpdates() void Updates::checkForUpdates()
{ {
#ifndef CHATTERINO_DISABLE_UPDATER
auto version = Version::instance(); auto version = Version::instance();
if (!version.isSupportedOS()) if (!version.isSupportedOS())
@ -345,6 +346,7 @@ void Updates::checkForUpdates()
}) })
.execute(); .execute();
this->setStatus_(Searching); this->setStatus_(Searching);
#endif
} }
Updates::Status Updates::getStatus() const Updates::Status Updates::getStatus() const