mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-07-28 00:12:26 +00:00
Add proxy auto-rotation option.
This commit is contained in:
@@ -27,6 +27,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "core/sandbox.h"
|
||||
#include "core/local_url_handlers.h"
|
||||
#include "core/launcher.h"
|
||||
#include "core/proxy_rotation_manager.h"
|
||||
#include "core/ui_integration.h"
|
||||
#include "chat_helpers/emoji_keywords.h"
|
||||
#include "chat_helpers/stickers_emoji_image_loader.h"
|
||||
@@ -146,6 +147,7 @@ struct Application::Private {
|
||||
base::Timer quitTimer;
|
||||
UiIntegration uiIntegration;
|
||||
Settings settings;
|
||||
std::unique_ptr<ProxyRotationManager> proxyRotation;
|
||||
};
|
||||
|
||||
Application::Application()
|
||||
@@ -173,6 +175,7 @@ Application::Application()
|
||||
, _setupEmailLock(false)
|
||||
, _autoLockTimer([=] { checkAutoLock(); }) {
|
||||
Ui::Integration::Set(&_private->uiIntegration);
|
||||
_private->proxyRotation = std::make_unique<ProxyRotationManager>();
|
||||
|
||||
_platformIntegration->init();
|
||||
|
||||
@@ -234,6 +237,7 @@ Application::~Application() {
|
||||
// Domain::finish() and there is a violation on Ensures(started()).
|
||||
closeAdditionalWindows();
|
||||
|
||||
_private->proxyRotation = nullptr;
|
||||
_domain->finish();
|
||||
|
||||
Local::finish();
|
||||
@@ -833,6 +837,17 @@ void Application::setCurrentProxy(
|
||||
refreshGlobalProxy();
|
||||
_proxyChanges.fire({ was, now });
|
||||
my.connectionTypeChangesNotify();
|
||||
proxyRotationSettingsChanged();
|
||||
}
|
||||
|
||||
void Application::proxyRotationSettingsChanged() {
|
||||
_private->proxyRotation->settingsChanged();
|
||||
}
|
||||
|
||||
void Application::checkProxyRotation(
|
||||
not_null<Main::Account*> account,
|
||||
int32 state) {
|
||||
_private->proxyRotation->handleConnectionStateChanged(account, state);
|
||||
}
|
||||
|
||||
auto Application::proxyChanges() const -> rpl::producer<ProxyChange> {
|
||||
|
||||
Reference in New Issue
Block a user