From e712a51833eb7d6e491c792b4d965a8d42a5bcec Mon Sep 17 00:00:00 2001
From: John Preston <johnprestonmail@gmail.com>
Date: Sun, 7 Oct 2018 12:02:10 +0300
Subject: [PATCH] Disable animations on login (support).

---
 Telegram/SourceFiles/intro/introwidget.cpp | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/Telegram/SourceFiles/intro/introwidget.cpp b/Telegram/SourceFiles/intro/introwidget.cpp
index 6ba5520ec..de62031bf 100644
--- a/Telegram/SourceFiles/intro/introwidget.cpp
+++ b/Telegram/SourceFiles/intro/introwidget.cpp
@@ -42,6 +42,14 @@ namespace {
 
 constexpr str_const kDefaultCountry = "US";
 
+void DisableAnimationsOnLogin() {
+	anim::SetDisabled(true);
+	Local::writeSettings();
+
+	cSetAutoPlayGif(false);
+	Local::writeUserSettings();
+}
+
 } // namespace
 
 Widget::Widget(QWidget *parent) : RpWidget(parent)
@@ -619,8 +627,13 @@ void Widget::Step::finish(const MTPUser &user, QImage &&photo) {
 	App::wnd()->setupMain();
 
 	// "this" is already deleted here by creating the main widget.
-	if (AuthSession::Exists() && !photo.isNull()) {
-		Auth().api().uploadPeerPhoto(Auth().user(), std::move(photo));
+	if (AuthSession::Exists()) {
+		if (!photo.isNull()) {
+			Auth().api().uploadPeerPhoto(Auth().user(), std::move(photo));
+		}
+		if (Auth().supportMode()) {
+			DisableAnimationsOnLogin();
+		}
 	}
 }