Compare commits

..

13 Commits

Author SHA1 Message Date
John Preston
2f48bbd317 Version 3.4: Fix build with GCC. 2021-12-30 18:18:30 +03:00
John Preston
450f9ca91e Version 3.4: Update nimf submodule to clone fine on Windows. 2021-12-30 16:53:04 +03:00
John Preston
f86e2d98cc Version 3.4: Show mini-profiles from reactions overview. 2021-12-30 16:48:52 +03:00
John Preston
0cf85be86b Version 3.4.
- Send reactions to messages.
- Group and Channel admins can enable reactions in their chat
via '...' menu > Manage > Reactions.
- Select text when typing and choose 'Formatting > Spoiler' in
the context menu to hide some or all of the contents of a message.
- Click on the spoiler in chat to reveal its hidden text.
- Spoiler formatting hides text in chat,
as well as in the chat list and notifications.
2021-12-30 16:25:43 +03:00
John Preston
a15ef8bbc2 Check noforwards of specific messages in shared media. 2021-12-30 16:15:38 +03:00
John Preston
ecca60afe4 Some spoiler improvements. 2021-12-30 16:08:15 +03:00
John Preston
1ab0f840f3 Use reactions icon in context menu if more than 1 reaction type. 2021-12-30 16:08:15 +03:00
John Preston
3623fb1f9a Disable saveAs in media viewer if restricted. 2021-12-30 14:58:34 +03:00
John Preston
4cbfcc8dbc Disable reaction button on Call messages. 2021-12-30 14:33:11 +03:00
John Preston
90821428d3 Fix quick reaction button on Retina screens. 2021-12-30 14:33:11 +03:00
John Preston
c5468a1111 Fix spoilers in some cases. 2021-12-30 13:37:56 +03:00
John Preston
505ef04134 Show reaction button only when the cursor is over the message. 2021-12-30 13:37:39 +03:00
John Preston
f70c2adbdd Fix menu icons in proxy settings. 2021-12-30 13:37:17 +03:00
23 changed files with 126 additions and 97 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1016 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

@@ -10,7 +10,7 @@
<Identity Name="TelegramMessengerLLP.TelegramDesktop"
ProcessorArchitecture="ARCHITECTURE"
Publisher="CN=536BC709-8EE1-4478-AF22-F0F0F26FF64A"
Version="3.3.2.0" />
Version="3.4.0.0" />
<Properties>
<DisplayName>Telegram Desktop</DisplayName>
<PublisherDisplayName>Telegram Messenger LLP</PublisherDisplayName>

View File

@@ -44,8 +44,8 @@ IDI_ICON1 ICON "..\\art\\icon256.ico"
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 3,3,2,0
PRODUCTVERSION 3,3,2,0
FILEVERSION 3,4,0,0
PRODUCTVERSION 3,4,0,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -62,10 +62,10 @@ BEGIN
BEGIN
VALUE "CompanyName", "Telegram FZ-LLC"
VALUE "FileDescription", "Telegram Desktop"
VALUE "FileVersion", "3.3.2.0"
VALUE "FileVersion", "3.4.0.0"
VALUE "LegalCopyright", "Copyright (C) 2014-2021"
VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "3.3.2.0"
VALUE "ProductVersion", "3.4.0.0"
END
END
BLOCK "VarFileInfo"

View File

@@ -35,8 +35,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 3,3,2,0
PRODUCTVERSION 3,3,2,0
FILEVERSION 3,4,0,0
PRODUCTVERSION 3,4,0,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -53,10 +53,10 @@ BEGIN
BEGIN
VALUE "CompanyName", "Telegram FZ-LLC"
VALUE "FileDescription", "Telegram Desktop Updater"
VALUE "FileVersion", "3.3.2.0"
VALUE "FileVersion", "3.4.0.0"
VALUE "LegalCopyright", "Copyright (C) 2014-2021"
VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "3.3.2.0"
VALUE "ProductVersion", "3.4.0.0"
END
END
BLOCK "VarFileInfo"

View File

@@ -493,7 +493,9 @@ rpl::producer<Ui::WhoReadContent> WhoReacted(
[](const auto &pair) { return pair.second; });
// #TODO reactions
state->current.mostPopularReaction = item->reactions().front().first;
state->current.singleReaction = (list.size() == 1)
? list.front().first
: QString();
}
std::move(
idsWithReactions

View File

@@ -522,7 +522,7 @@ void ProxyRow::showMenu() {
const QString &text,
Fn<void()> callback,
const style::icon *icon) {
return _menu->addAction(text, std::move(callback));
return _menu->addAction(text, std::move(callback), icon);
};
addAction(tr::lng_proxy_menu_edit(tr::now), [=] {
_editClicks.fire({});

View File

@@ -22,7 +22,7 @@ constexpr auto AppId = "{53F49750-6209-4FBF-9CA8-7A333C87D1ED}"_cs;
constexpr auto AppNameOld = "Telegram Win (Unofficial)"_cs;
constexpr auto AppName = "Telegram Desktop"_cs;
constexpr auto AppFile = "Telegram"_cs;
constexpr auto AppVersion = 3003002;
constexpr auto AppVersionStr = "3.3.2";
constexpr auto AppBetaVersion = true;
constexpr auto AppVersion = 3004000;
constexpr auto AppVersionStr = "3.4";
constexpr auto AppBetaVersion = false;
constexpr auto AppAlphaVersion = TDESKTOP_ALPHA_VERSION;

View File

@@ -767,7 +767,14 @@ bool HistoryItem::suggestDeleteAllReport() const {
}
bool HistoryItem::canReact() const {
return isRegular() && !isService();
if (!isRegular() || isService()) {
return false;
} else if (const auto media = this->media()) {
if (media->call()) {
return false;
}
}
return true;
}
void HistoryItem::addReaction(const QString &reaction) {

View File

@@ -1868,8 +1868,7 @@ Reactions::ButtonParameters Message::reactionButtonParameters(
: (QPoint(contentRect.width(), innerHeight)
+ st::reactionCornerCenter));
if (reactionState.itemId != result.context) {
const auto top = marginTop();
if (!QRect(0, top, width(), height() - top).contains(position)) {
if (!contentRect.contains(position)) {
return {};
}
}

View File

@@ -285,6 +285,7 @@ Manager::Manager(
_shadowBuffer = QImage(
_outer * ratio,
QImage::Format_ARGB32_Premultiplied);
_shadowBuffer.setDevicePixelRatio(ratio);
if (wheelEventsTarget) {
stealWheelEvents(wheelEventsTarget);
@@ -592,10 +593,8 @@ void Manager::paintButton(
paintAllEmoji(p, button, scale, mainEmojiPosition);
p.restore();
} else {
p.drawImage(
mainEmojiPosition,
_cacheParts,
validateEmoji(frameIndex, scale));
const auto source = validateEmoji(frameIndex, scale);
p.drawImage(mainEmojiPosition, _cacheParts, source);
}
if (opacity != 1.) {

View File

@@ -9,6 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "history/view/reactions/message_reactions_selector.h"
#include "boxes/peer_list_box.h"
#include "boxes/peers/prepare_short_info_box.h"
#include "window/window_session_controller.h"
#include "history/history_item.h"
#include "history/history.h"
@@ -23,6 +24,26 @@ namespace {
constexpr auto kPerPageFirst = 20;
constexpr auto kPerPage = 200;
class Row final : public PeerListRow {
public:
Row(not_null<PeerData*> peer, const QString &reaction);
QSize rightActionSize() const override;
QMargins rightActionMargins() const override;
bool rightActionDisabled() const override;
void rightActionPaint(
Painter &p,
int x,
int y,
int outerWidth,
bool selected,
bool actionSelected) override;
private:
EmojiPtr _emoji = nullptr;
};
class Controller final : public PeerListController {
public:
Controller(
@@ -62,6 +83,46 @@ private:
};
Row::Row(not_null<PeerData*> peer, const QString &reaction)
: PeerListRow(peer)
, _emoji(Ui::Emoji::Find(reaction)) {
}
QSize Row::rightActionSize() const {
const auto size = Ui::Emoji::GetSizeNormal() / style::DevicePixelRatio();
return _emoji ? QSize(size, size) : QSize();
}
QMargins Row::rightActionMargins() const {
if (!_emoji) {
return QMargins();
}
const auto size = Ui::Emoji::GetSizeNormal() / style::DevicePixelRatio();
return QMargins(
size / 2,
(st::defaultPeerList.item.height - size) / 2,
(size * 3) / 2,
0);
}
bool Row::rightActionDisabled() const {
return true;
}
void Row::rightActionPaint(
Painter &p,
int x,
int y,
int outerWidth,
bool selected,
bool actionSelected) {
if (!_emoji) {
return;
}
// #TODO reactions
Ui::Emoji::Draw(p, _emoji, Ui::Emoji::GetSizeNormal(), x, y);
}
Controller::Controller(
not_null<Window::SessionController*> window,
not_null<HistoryItem*> item,
@@ -177,9 +238,10 @@ void Controller::loadMore(const QString &offset) {
}
void Controller::rowClicked(not_null<PeerListRow*> row) {
const auto peerId = row->peer()->id;
crl::on_main(&session(), [=] {
_window->showPeerHistory(peerId);
const auto window = _window;
const auto peer = row->peer();
crl::on_main(window, [=] {
window->show(PrepareShortInfoBox(peer, window));
});
}
@@ -191,66 +253,6 @@ bool Controller::appendRow(not_null<UserData*> user, QString reaction) {
return true;
}
class Row final : public PeerListRow {
public:
Row(not_null<PeerData*> peer, const QString &reaction);
QSize rightActionSize() const override;
QMargins rightActionMargins() const override;
bool rightActionDisabled() const override;
void rightActionPaint(
Painter &p,
int x,
int y,
int outerWidth,
bool selected,
bool actionSelected) override;
private:
EmojiPtr _emoji = nullptr;
};
Row::Row(not_null<PeerData*> peer, const QString &reaction)
: PeerListRow(peer)
, _emoji(Ui::Emoji::Find(reaction)) {
}
QSize Row::rightActionSize() const {
const auto size = Ui::Emoji::GetSizeNormal() / style::DevicePixelRatio();
return _emoji ? QSize(size, size) : QSize();
}
QMargins Row::rightActionMargins() const {
if (!_emoji) {
return QMargins();
}
const auto size = Ui::Emoji::GetSizeNormal() / style::DevicePixelRatio();
return QMargins(
size / 2,
(st::defaultPeerList.item.height - size) / 2,
(size * 3) / 2,
0);
}
bool Row::rightActionDisabled() const {
return true;
}
void Row::rightActionPaint(
Painter &p,
int x,
int y,
int outerWidth,
bool selected,
bool actionSelected) {
if (!_emoji) {
return;
}
// #TODO reactions
Ui::Emoji::Draw(p, _emoji, Ui::Emoji::GetSizeNormal(), x, y);
}
std::unique_ptr<PeerListRow> Controller::createRow(
not_null<UserData*> user,
QString reaction) const {

View File

@@ -362,7 +362,7 @@ infoIconAdministrators: icon {{ "info/edit/group_manage_admins", infoIconFg, poi
infoIconBlacklist: icon {{ "info_blacklist", infoIconFg, point(-2px, -2px) }};
infoIconPermissions: icon {{ "info/edit/group_manage_permissions", infoIconFg, point(0px, -2px) }};
infoIconInviteLinks: icon {{ "info/edit/group_manage_links", infoIconFg, point(-2px, 0px) }};
infoIconReactions: icon {{ "menu/read_reactions", infoIconFg, point(2px, 4px) }};
infoIconReactions: icon {{ "info/edit/group_manage_reactions", infoIconFg, point(2px, 4px) }};
infoInformationIconPosition: point(25px, 12px);
infoNotificationsIconPosition: point(20px, 5px);
infoSharedMediaIconPosition: point(20px, 24px);

View File

@@ -1643,7 +1643,7 @@ void ListWidget::showContextMenu(
document,
DocumentSaveClickHandler::Mode::ToNewFile);
});
if (_peer->allowsForwarding()) {
if (_peer->allowsForwarding() && !item->forbidsForward()) {
_contextMenu->addAction(
(isVideo
? tr::lng_context_save_video(tr::now)

View File

@@ -1515,6 +1515,9 @@ void OverlayWidget::notifyFileDialogShown(bool shown) {
}
void OverlayWidget::saveAs() {
if (showCopyRestriction()) {
return;
}
QString file;
if (_document) {
const auto &location = _document->location(true);

View File

@@ -920,6 +920,9 @@ whoReadChecksDisabled: icon{{ "menu/read_ticks", menuFgDisabled }};
whoReadPlayed: icon{{ "menu/read_audio", menuSubmenuArrowFg }};
whoReadPlayedOver: icon{{ "menu/read_audio", menuSubmenuArrowFg }};
whoReadPlayedDisabled: icon {{ "menu/read_audio", menuFgDisabled }};
whoReadReactions: icon{{ "menu/read_reactions", menuSubmenuArrowFg }};
whoReadReactionsOver: icon{{ "menu/read_reactions", menuSubmenuArrowFg }};
whoReadReactionsDisabled: icon{{ "menu/read_reactions", menuFgDisabled }};
reactionsTabAll: icon {{ "menu/read_reactions", windowFg }};
reactionsTabAllSelected: icon {{ "menu/read_reactions", activeButtonFg }};

View File

@@ -400,7 +400,7 @@ void Action::paint(Painter &p) {
if (enabled) {
paintRipple(p, 0, 0);
}
if (const auto emoji = Emoji::Find(_content.mostPopularReaction)) {
if (const auto emoji = Emoji::Find(_content.singleReaction)) {
// #TODO reactions
const auto ratio = style::DevicePixelRatio();
const auto size = Emoji::GetSizeNormal();
@@ -409,7 +409,13 @@ void Action::paint(Painter &p) {
const auto y = (_height - (size / ratio)) / 2;
Emoji::Draw(p, emoji, size, x, y);
} else {
const auto &icon = (_content.type == WhoReadType::Seen)
const auto &icon = (_content.fullReactionsCount)
? (!enabled
? st::whoReadReactionsDisabled
: selected
? st::whoReadReactionsOver
: st::whoReadReactions)
: (_content.type == WhoReadType::Seen)
? (!enabled
? st::whoReadChecksDisabled
: selected

View File

@@ -40,7 +40,7 @@ enum class WhoReadType {
struct WhoReadContent {
std::vector<WhoReadParticipant> participants;
WhoReadType type = WhoReadType::Seen;
QString mostPopularReaction;
QString singleReaction;
int fullReactionsCount = 0;
bool unknown = false;
};

View File

@@ -1,7 +1,7 @@
AppVersion 3003002
AppVersionStrMajor 3.3
AppVersionStrSmall 3.3.2
AppVersionStr 3.3.2
BetaChannel 1
AppVersion 3004000
AppVersionStrMajor 3.4
AppVersionStrSmall 3.4
AppVersionStr 3.4.0
BetaChannel 0
AlphaVersion 0
AppVersionOriginal 3.3.2.beta
AppVersionOriginal 3.4

View File

@@ -1,3 +1,11 @@
3.4 (30.12.21)
- Send reactions to messages.
- Group and Channel admins can enable reactions in their chat via '...' menu > Manage > Reactions.
- Select text when typing and choose 'Formatting > Spoiler' in the context menu to hide some or all of the contents of a message.
- Click on the spoiler in chat to reveal its hidden text.
- Spoiler formatting hides text in chat, as well as in the chat list and notifications.
3.3.2 beta (29.12.21)
- Select text when typing and choose 'Formatting > Spoiler' in the context menu to hide some or all of the contents of a message.