mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Register tg:// scheme on first launch.
Also, allow disabling tg:// re-registration on update.
This commit is contained in:
parent
8cbeadc68a
commit
17bb430006
3 changed files with 21 additions and 2 deletions
|
@ -19,6 +19,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "base/battery_saving.h"
|
#include "base/battery_saving.h"
|
||||||
#include "base/event_filter.h"
|
#include "base/event_filter.h"
|
||||||
#include "base/concurrent_timer.h"
|
#include "base/concurrent_timer.h"
|
||||||
|
#include "base/options.h"
|
||||||
#include "base/qt_signal_producer.h"
|
#include "base/qt_signal_producer.h"
|
||||||
#include "base/timer.h"
|
#include "base/timer.h"
|
||||||
#include "base/unixtime.h"
|
#include "base/unixtime.h"
|
||||||
|
@ -140,10 +141,18 @@ void SetCrashAnnotationsGL() {
|
||||||
#endif // DESKTOP_APP_USE_ANGLE
|
#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
|
} // namespace
|
||||||
|
|
||||||
Application *Application::Instance = nullptr;
|
Application *Application::Instance = nullptr;
|
||||||
|
|
||||||
|
const char kOptionSkipUrlSchemeRegister[] = "skip-url-scheme-register";
|
||||||
|
|
||||||
struct Application::Private {
|
struct Application::Private {
|
||||||
base::Timer quitTimer;
|
base::Timer quitTimer;
|
||||||
UiIntegration uiIntegration;
|
UiIntegration uiIntegration;
|
||||||
|
@ -263,12 +272,12 @@ void Application::run() {
|
||||||
|
|
||||||
if (const auto old = Local::oldSettingsVersion()) {
|
if (const auto old = Local::oldSettingsVersion()) {
|
||||||
if (old < AppVersion) {
|
if (old < AppVersion) {
|
||||||
InvokeQueued(this, [] { RegisterUrlScheme(); });
|
autoRegisterUrlScheme();
|
||||||
Platform::NewVersionLaunched(old);
|
Platform::NewVersionLaunched(old);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Initial launch.
|
// Initial launch.
|
||||||
InvokeQueued(this, [] { RegisterUrlScheme(); });
|
autoRegisterUrlScheme();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cAutoStart() && !Platform::AutostartSupported()) {
|
if (cAutoStart() && !Platform::AutostartSupported()) {
|
||||||
|
@ -410,6 +419,12 @@ void Application::run() {
|
||||||
processCreatedWindow(_lastActivePrimaryWindow);
|
processCreatedWindow(_lastActivePrimaryWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Application::autoRegisterUrlScheme() {
|
||||||
|
if (!OptionSkipUrlSchemeRegister.value()) {
|
||||||
|
InvokeQueued(this, [] { RegisterUrlScheme(); });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Application::showAccount(not_null<Main::Account*> account) {
|
void Application::showAccount(not_null<Main::Account*> account) {
|
||||||
if (const auto separate = separateWindowFor(account)) {
|
if (const auto separate = separateWindowFor(account)) {
|
||||||
_lastActivePrimaryWindow = separate;
|
_lastActivePrimaryWindow = separate;
|
||||||
|
|
|
@ -126,6 +126,8 @@ enum class QuitReason {
|
||||||
QtQuitEvent,
|
QtQuitEvent,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
extern const char kOptionSkipUrlSchemeRegister[];
|
||||||
|
|
||||||
class Application final : public QObject {
|
class Application final : public QObject {
|
||||||
public:
|
public:
|
||||||
struct ProxyChange {
|
struct ProxyChange {
|
||||||
|
@ -349,6 +351,7 @@ private:
|
||||||
friend bool IsAppLaunched();
|
friend bool IsAppLaunched();
|
||||||
friend Application &App();
|
friend Application &App();
|
||||||
|
|
||||||
|
void autoRegisterUrlScheme();
|
||||||
void clearEmojiSourceImages();
|
void clearEmojiSourceImages();
|
||||||
[[nodiscard]] auto prepareEmojiSourceImages()
|
[[nodiscard]] auto prepareEmojiSourceImages()
|
||||||
-> std::shared_ptr<Ui::Emoji::UniversalImages>;
|
-> std::shared_ptr<Ui::Emoji::UniversalImages>;
|
||||||
|
|
|
@ -152,6 +152,7 @@ void SetupExperimental(
|
||||||
addToggle(kOptionAutoScrollInactiveChat);
|
addToggle(kOptionAutoScrollInactiveChat);
|
||||||
addToggle(Window::Notifications::kOptionGNotification);
|
addToggle(Window::Notifications::kOptionGNotification);
|
||||||
addToggle(Core::kOptionFreeType);
|
addToggle(Core::kOptionFreeType);
|
||||||
|
addToggle(Core::kOptionSkipUrlSchemeRegister);
|
||||||
addToggle(Data::kOptionExternalVideoPlayer);
|
addToggle(Data::kOptionExternalVideoPlayer);
|
||||||
addToggle(Window::kOptionNewWindowsSizeAsFirst);
|
addToggle(Window::kOptionNewWindowsSizeAsFirst);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue