Merge tag 'v5.2.2' into dev

This commit is contained in:
AlexeyZavar
2024-07-02 22:53:41 +03:00
51 changed files with 408 additions and 176 deletions
+23 -3
View File
@@ -19,6 +19,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "base/battery_saving.h"
#include "base/event_filter.h"
#include "base/concurrent_timer.h"
#include "base/options.h"
#include "base/qt_signal_producer.h"
#include "base/timer.h"
#include "base/unixtime.h"
@@ -144,10 +145,18 @@ void SetCrashAnnotationsGL() {
#endif // DESKTOP_APP_USE_ANGLE
}
base::options::toggle OptionSkipUrlSchemeRegister({
.id = kOptionSkipUrlSchemeRegister,
.name = "Skip URL scheme register",
.description = "Don't re-register tg:// URL scheme on autoupdate.",
});
} // namespace
Application *Application::Instance = nullptr;
const char kOptionSkipUrlSchemeRegister[] = "skip-url-scheme-register";
struct Application::Private {
base::Timer quitTimer;
UiIntegration uiIntegration;
@@ -265,9 +274,14 @@ void Application::run() {
refreshGlobalProxy(); // Depends on app settings being read.
if (const auto old = Local::oldSettingsVersion(); old < AppVersion) {
InvokeQueued(this, [] { RegisterUrlScheme(); });
Platform::NewVersionLaunched(old);
if (const auto old = Local::oldSettingsVersion()) {
if (old < AppVersion) {
autoRegisterUrlScheme();
Platform::NewVersionLaunched(old);
}
} else {
// Initial launch.
autoRegisterUrlScheme();
}
if (cAutoStart() && !Platform::AutostartSupported()) {
@@ -409,6 +423,12 @@ void Application::run() {
processCreatedWindow(_lastActivePrimaryWindow);
}
void Application::autoRegisterUrlScheme() {
if (!OptionSkipUrlSchemeRegister.value()) {
InvokeQueued(this, [] { RegisterUrlScheme(); });
}
}
void Application::showAccount(not_null<Main::Account*> account) {
if (const auto separate = separateWindowFor(account)) {
_lastActivePrimaryWindow = separate;