From 2253cd86e536052b420f6169a474811b300373e1 Mon Sep 17 00:00:00 2001
From: John Preston <johnprestonmail@gmail.com>
Date: Wed, 13 Apr 2022 09:14:30 +0400
Subject: [PATCH] Add an icon to a webview bot button.

---
 Telegram/Resources/icons/inline_button_web.png    | Bin 0 -> 239 bytes
 Telegram/Resources/icons/inline_button_web@2x.png | Bin 0 -> 298 bytes
 Telegram/Resources/icons/inline_button_web@3x.png | Bin 0 -> 393 bytes
 .../history/view/history_view_message.cpp         |   4 ++++
 Telegram/SourceFiles/ui/chat/chat.style           |   1 +
 Telegram/SourceFiles/ui/chat/chat_style.cpp       |   1 +
 Telegram/SourceFiles/ui/chat/chat_style.h         |   4 ++++
 7 files changed, 10 insertions(+)
 create mode 100644 Telegram/Resources/icons/inline_button_web.png
 create mode 100644 Telegram/Resources/icons/inline_button_web@2x.png
 create mode 100644 Telegram/Resources/icons/inline_button_web@3x.png

diff --git a/Telegram/Resources/icons/inline_button_web.png b/Telegram/Resources/icons/inline_button_web.png
new file mode 100644
index 0000000000000000000000000000000000000000..bfecfa02f46f083795d73ebe4b71493f484d199b
GIT binary patch
literal 239
zcmeAS@N?(olHy`uVBq!ia0vp^AT}2V6Od#Ih<F907>k44ofy`glX(f`xTHpSruq6Z
zXaU(A42<oW3@jieKr98s3=GT*7#Wy>G$TlC0TW!7YXLKY4N_=bvEwU{iu81G43Usb
z*3i)S@#*R5dL9N57B9nusm&T}UWQDOJUbY<16~0oUSC`594ss%vSjsY?n!K?OifG{
zcrx#F$W-$QOc6Y_BywNfU#=3?O^pI(0RkFF8|)((oO#lI*w<~G2C~f4)z4*}Q$iB}
DbVE3c

literal 0
HcmV?d00001

diff --git a/Telegram/Resources/icons/inline_button_web@2x.png b/Telegram/Resources/icons/inline_button_web@2x.png
new file mode 100644
index 0000000000000000000000000000000000000000..9d33b92355e95d41642d4d85b4556eccb149d70b
GIT binary patch
literal 298
zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc1SFYWcSQjy#^NA%Cx&(BWL^R}E~ycoX}-P;
zT0k}j17mw80}DtA5K93u0|WB{Mh0de%?J`(zyy~SS-^~7gA{JM`{6H;n&Ro=7-Av#
zcFIBC1_d71=sSFRJqN^ePU+lns80^+R9trI>O79W>-U>52nKqsoN_7ZHZP;(5eEjY
zOb0cghk<F6409M$wmh6OSuW1){oIEiC+&I?Z!<Nn$<zJu-s_Y2y9Jt*uFstLvr#hG
zYT43l^%ZkgChj#exbyz<;W|&hy$#y_MXR?Sli+3F<6U%aQ>#7WKlyzNnX7-=yS!Pj
Q*$U)NPgg&ebxsLQ07`3JN&o-=

literal 0
HcmV?d00001

diff --git a/Telegram/Resources/icons/inline_button_web@3x.png b/Telegram/Resources/icons/inline_button_web@3x.png
new file mode 100644
index 0000000000000000000000000000000000000000..c820324d23d996fbad9a1f2b5dbc4ef31af1c744
GIT binary patch
literal 393
zcmeAS@N?(olHy`uVBq!ia0vp^av;pX1SGcvS$+jljKx9jP7LeL$-D$|Tv8)E(|mmy
zw18|52FCVG1{RPKAeI7R1_tH@j10^`nh_+nfC(-uw}2VJ1}Qw{XwC|xK6|=2hIsJ4
zowir7MM0qT={X^v6TBIR+;m)TZ(wO>TGJk}>cZ~h4;6BroUamOIk#?u{D%vv-H)!%
zS~hc8=Dg?Ud)o>e8b0}af3qtu_PX>Lm6Av?23hgR2RyCvtr?hp%e6UbK2>{|?bNYq
z6${IxpihbBleUH>e18+eUt@cO)ogL+w$wL|J+@vuHsi-r$KC5*Z_E97^X=ou|C42o
z?|r<d^}~#5GLN@@Z8M$lfkl>WqlBby%9*AV#}1|=f3J%-y>U&mdphZZ(D&pWWfMgY
zDn&k1xT}8EK;j0|SHC%&J984`bqeqB{o0qVv!LM?m+^YOR~p}nK5=hbQP|wj@%slT
O7(8A5T-G@yGywpUDwHh%

literal 0
HcmV?d00001

diff --git a/Telegram/SourceFiles/history/view/history_view_message.cpp b/Telegram/SourceFiles/history/view/history_view_message.cpp
index be923897f..f525acddb 100644
--- a/Telegram/SourceFiles/history/view/history_view_message.cpp
+++ b/Telegram/SourceFiles/history/view/history_view_message.cpp
@@ -143,6 +143,8 @@ void KeyboardStyle::paintButtonIcon(
 		case Type::Buy: return &st->msgBotKbPaymentIcon();
 		case Type::SwitchInlineSame:
 		case Type::SwitchInline: return &st->msgBotKbSwitchPmIcon();
+		case Type::WebView:
+		case Type::SimpleWebView: return &st->msgBotKbWebviewIcon();
 		}
 		return nullptr;
 	}();
@@ -174,6 +176,8 @@ int KeyboardStyle::minButtonWidth(
 	case Type::Callback:
 	case Type::CallbackWithPassword:
 	case Type::Game: iconWidth = st::historySendingInvertedIcon.width(); break;
+	case Type::WebView:
+	case Type::SimpleWebView: iconWidth = st::msgBotKbWebviewIcon.width(); break;
 	}
 	if (iconWidth > 0) {
 		result = std::max(result, 2 * iconWidth + 4 * int(st::msgBotKbIconPadding));
diff --git a/Telegram/SourceFiles/ui/chat/chat.style b/Telegram/SourceFiles/ui/chat/chat.style
index 57b996bc6..d835af71f 100644
--- a/Telegram/SourceFiles/ui/chat/chat.style
+++ b/Telegram/SourceFiles/ui/chat/chat.style
@@ -483,6 +483,7 @@ msgBotKbIconPadding: 2px;
 msgBotKbUrlIcon: icon {{ "inline_button_url", msgBotKbIconFg }};
 msgBotKbSwitchPmIcon: icon {{ "inline_button_switch", msgBotKbIconFg }};
 msgBotKbPaymentIcon: icon {{ "inline_button_card", msgBotKbIconFg }};
+msgBotKbWebviewIcon: icon {{ "inline_button_web", msgBotKbIconFg }};
 msgBotKbButton: BotKeyboardButton {
 	margin: 5px;
 	padding: 10px;
diff --git a/Telegram/SourceFiles/ui/chat/chat_style.cpp b/Telegram/SourceFiles/ui/chat/chat_style.cpp
index 91b6fabaa..5c2a9c270 100644
--- a/Telegram/SourceFiles/ui/chat/chat_style.cpp
+++ b/Telegram/SourceFiles/ui/chat/chat_style.cpp
@@ -124,6 +124,7 @@ ChatStyle::ChatStyle() {
 	make(_msgBotKbUrlIcon, st::msgBotKbUrlIcon);
 	make(_msgBotKbPaymentIcon, st::msgBotKbPaymentIcon);
 	make(_msgBotKbSwitchPmIcon, st::msgBotKbSwitchPmIcon);
+	make(_msgBotKbWebviewIcon, st::msgBotKbWebviewIcon);
 	make(_historyFastCommentsIcon, st::historyFastCommentsIcon);
 	make(_historyFastShareIcon, st::historyFastShareIcon);
 	make(_historyGoToOriginalIcon, st::historyGoToOriginalIcon);
diff --git a/Telegram/SourceFiles/ui/chat/chat_style.h b/Telegram/SourceFiles/ui/chat/chat_style.h
index 49e629f93..e9e176542 100644
--- a/Telegram/SourceFiles/ui/chat/chat_style.h
+++ b/Telegram/SourceFiles/ui/chat/chat_style.h
@@ -232,6 +232,9 @@ public:
 	[[nodiscard]] const style::icon &msgBotKbSwitchPmIcon() const {
 		return _msgBotKbSwitchPmIcon;
 	}
+	[[nodiscard]] const style::icon &msgBotKbWebviewIcon() const {
+		return _msgBotKbWebviewIcon;
+	}
 	[[nodiscard]] const style::icon &historyFastCommentsIcon() const {
 		return _historyFastCommentsIcon;
 	}
@@ -326,6 +329,7 @@ private:
 	style::icon _msgBotKbUrlIcon = { Qt::Uninitialized };
 	style::icon _msgBotKbPaymentIcon = { Qt::Uninitialized };
 	style::icon _msgBotKbSwitchPmIcon = { Qt::Uninitialized };
+	style::icon _msgBotKbWebviewIcon = { Qt::Uninitialized };
 	style::icon _historyFastCommentsIcon = { Qt::Uninitialized };
 	style::icon _historyFastShareIcon = { Qt::Uninitialized };
 	style::icon _historyGoToOriginalIcon = { Qt::Uninitialized };