Skip to content

Commit

Permalink
Merge branch 'telegramdesktop-dev' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
xmdnx committed Oct 29, 2023
2 parents eee7fa0 + f5c13fd commit 1960b11
Show file tree
Hide file tree
Showing 27 changed files with 173 additions and 71 deletions.
2 changes: 2 additions & 0 deletions Telegram/Resources/langs/lang.strings
Original file line number Diff line number Diff line change
Expand Up @@ -1166,6 +1166,7 @@ https://github.com/rabbitGramDesktop/rabbitGramDesktop/blob/dev/LEGAL
"lng_mute_box_title" = "Mute notifications for...";

"lng_preview_loading" = "Getting Link Info...";
"lng_preview_cant" = "Could not generate preview for this link.";

"lng_profile_settings_section" = "Settings";
"lng_profile_bot_settings" = "Bot Settings";
Expand Down Expand Up @@ -2361,6 +2362,7 @@ https://github.com/rabbitGramDesktop/rabbitGramDesktop/blob/dev/LEGAL
"lng_saved_messages" = "Saved Messages";
"lng_saved_short" = "Save";
"lng_saved_forward_here" = "Forward messages here for quick access";
"lng_saved_quote_here" = "Quote here to save";

"lng_scheduled_messages" = "Scheduled Messages";
"lng_scheduled_messages_empty" = "No scheduled messages here yet...";
Expand Down
2 changes: 1 addition & 1 deletion Telegram/Resources/uwp/AppX/AppxManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<Identity Name="TelegramMessengerLLP.TelegramDesktop"
ProcessorArchitecture="ARCHITECTURE"
Publisher="CN=536BC709-8EE1-4478-AF22-F0F0F26FF64A"
Version="4.11.0.0" />
Version="4.11.1.0" />
<Properties>
<DisplayName>rabbitGram Desktop</DisplayName>
<PublisherDisplayName>xmdnx</PublisherDisplayName>
Expand Down
8 changes: 4 additions & 4 deletions Telegram/Resources/winrc/Telegram.rc
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ IDI_ICON1 ICON "..\\art\\icon256.ico"
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION 4,11,0,0
PRODUCTVERSION 4,11,0,0
FILEVERSION 4,11,1,0
PRODUCTVERSION 4,11,1,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -62,10 +62,10 @@ BEGIN
BEGIN
VALUE "CompanyName", "xmdnx"
VALUE "FileDescription", "rabbitGram Desktop"
VALUE "FileVersion", "4.11.0.0"
VALUE "FileVersion", "4.11.1.0"
VALUE "LegalCopyright", "Copyright (C) 2023"
VALUE "ProductName", "rabbitGram Desktop"
VALUE "ProductVersion", "4.11.0.0"
VALUE "ProductVersion", "4.11.1.0"
END
END
BLOCK "VarFileInfo"
Expand Down
8 changes: 4 additions & 4 deletions Telegram/Resources/winrc/Updater.rc
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION 4,11,0,0
PRODUCTVERSION 4,11,0,0
FILEVERSION 4,11,1,0
PRODUCTVERSION 4,11,1,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -53,10 +53,10 @@ BEGIN
BEGIN
VALUE "CompanyName", "xmdnx"
VALUE "FileDescription", "rabbitGram Desktop Updater"
VALUE "FileVersion", "4.11.0.0"
VALUE "FileVersion", "4.11.1.0"
VALUE "LegalCopyright", "Copyright (C) 2023"
VALUE "ProductName", "rabbitGram Desktop"
VALUE "ProductVersion", "4.11.0.0"
VALUE "ProductVersion", "4.11.1.0"
END
END
BLOCK "VarFileInfo"
Expand Down
1 change: 1 addition & 0 deletions Telegram/SourceFiles/apiwrap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3682,6 +3682,7 @@ void ApiWrap::sendMessage(MessageToSend &&message) {
Api::ConvertOption::SkipLocal);
if (!sentEntities.v.isEmpty()) {
sendFlags |= MTPmessages_SendMessage::Flag::f_entities;
mediaFlags |= MTPmessages_SendMedia::Flag::f_entities;
}
const auto clearCloudDraft = action.clearDraft;
const auto topicRootId = action.replyTo.topicRootId;
Expand Down
23 changes: 13 additions & 10 deletions Telegram/SourceFiles/boxes/peer_list_box.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ int PeerListController::descriptionTopSkipMin() const {
void PeerListBox::addSelectItem(
not_null<PeerData*> peer,
anim::type animated) {
const auto respect = _controller->respectSavedMessagesChat();
const auto respect = !_controller->savedMessagesChatStatus().isEmpty();
const auto text = (respect && peer->isSelf())
? tr::lng_saved_short(tr::now)
: (respect && peer->isRepliesChat())
Expand Down Expand Up @@ -580,8 +580,8 @@ void PeerListRow::refreshStatus() {
_statusType = StatusType::LastSeen;
_statusValidTill = 0;
if (auto user = peer()->asUser()) {
if (_isSavedMessagesChat) {
setStatusText(tr::lng_saved_forward_here(tr::now));
if (!_savedMessagesStatus.isEmpty()) {
setStatusText(_savedMessagesStatus);
} else {
auto time = base::unixtime::now();
setStatusText(Data::OnlineText(user, time));
Expand Down Expand Up @@ -614,7 +614,7 @@ void PeerListRow::refreshName(const style::PeerListItem &st) {
if (!_initialized) {
return;
}
const auto text = _isSavedMessagesChat
const auto text = !_savedMessagesStatus.isEmpty()
? tr::lng_saved_messages(tr::now)
: _isRepliesMessagesChat
? tr::lng_replies_messages(tr::now)
Expand Down Expand Up @@ -684,7 +684,7 @@ QString PeerListRow::generateName() {
}

QString PeerListRow::generateShortName() {
return _isSavedMessagesChat
return !_savedMessagesStatus.isEmpty()
? tr::lng_saved_short(tr::now)
: _isRepliesMessagesChat
? tr::lng_replies_messages(tr::now)
Expand All @@ -700,7 +700,7 @@ Ui::PeerUserpicView &PeerListRow::ensureUserpicView() {

PaintRoundImageCallback PeerListRow::generatePaintUserpicCallback(
bool forceRound) {
const auto saved = _isSavedMessagesChat;
const auto saved = !_savedMessagesStatus.isEmpty();
const auto replies = _isRepliesMessagesChat;
const auto peer = this->peer();
auto userpic = saved ? Ui::PeerUserpicView() : ensureUserpicView();
Expand Down Expand Up @@ -746,7 +746,9 @@ int PeerListRow::paintNameIconGetWidth(
int availableWidth,
int outerWidth,
bool selected) {
if (special() || _isSavedMessagesChat || _isRepliesMessagesChat) {
if (special()
|| !_savedMessagesStatus.isEmpty()
|| _isRepliesMessagesChat) {
return 0;
}
return _bagde.drawGetWidth(
Expand Down Expand Up @@ -856,7 +858,7 @@ void PeerListRow::paintDisabledCheckUserpic(
auto iconBorderPen = st.checkbox.check.border->p;
iconBorderPen.setWidth(st.checkbox.selectWidth);

if (_isSavedMessagesChat) {
if (!_savedMessagesStatus.isEmpty()) {
Ui::EmptyUserpic::PaintSavedMessages(p, userpicLeft, userpicTop, outerWidth, userpicRadius * 2);
} else if (_isRepliesMessagesChat) {
Ui::EmptyUserpic::PaintRepliesMessages(p, userpicLeft, userpicTop, outerWidth, userpicRadius * 2);
Expand Down Expand Up @@ -1048,9 +1050,10 @@ void PeerListContent::setRowHidden(not_null<PeerListRow*> row, bool hidden) {
}

void PeerListContent::addRowEntry(not_null<PeerListRow*> row) {
if (_controller->respectSavedMessagesChat() && !row->special()) {
const auto savedMessagesStatus = _controller->savedMessagesChatStatus();
if (!savedMessagesStatus.isEmpty() && !row->special()) {
if (row->peer()->isSelf()) {
row->setIsSavedMessagesChat(true);
row->setSavedMessagesChatStatus(savedMessagesStatus);
} else if (row->peer()->isRepliesChat()) {
row->setIsRepliesMessagesChat(true);
}
Expand Down
10 changes: 5 additions & 5 deletions Telegram/SourceFiles/boxes/peer_list_box.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ class PeerListRow {
void setIsSearchResult(bool isSearchResult) {
_isSearchResult = isSearchResult;
}
void setIsSavedMessagesChat(bool isSavedMessagesChat) {
_isSavedMessagesChat = isSavedMessagesChat;
void setSavedMessagesChatStatus(QString savedMessagesStatus) {
_savedMessagesStatus = savedMessagesStatus;
}
void setIsRepliesMessagesChat(bool isRepliesMessagesChat) {
_isRepliesMessagesChat = isRepliesMessagesChat;
Expand Down Expand Up @@ -278,12 +278,12 @@ class PeerListRow {
StatusType _statusType = StatusType::Online;
crl::time _statusValidTill = 0;
base::flat_set<QChar> _nameFirstLetters;
QString _savedMessagesStatus;
int _absoluteIndex = -1;
State _disabledState = State::Active;
bool _hidden : 1 = false;
bool _initialized : 1 = false;
bool _isSearchResult : 1 = false;
bool _isSavedMessagesChat : 1 = false;
bool _isRepliesMessagesChat : 1 = false;

};
Expand Down Expand Up @@ -517,8 +517,8 @@ class PeerListController : public PeerListSearchDelegate {
void peerListSearchAddRow(PeerListRowId id) override;
void peerListSearchRefreshRows() override;

[[nodiscard]] virtual bool respectSavedMessagesChat() const {
return false;
[[nodiscard]] virtual QString savedMessagesChatStatus() const {
return QString();
}
[[nodiscard]] virtual int customRowHeight() {
Unexpected("PeerListController::customRowHeight.");
Expand Down
8 changes: 6 additions & 2 deletions Telegram/SourceFiles/boxes/peer_list_controllers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ void ChatsListBoxController::rebuildRows() {
return count;
};
auto added = 0;
if (respectSavedMessagesChat()) {
if (!savedMessagesChatStatus().isEmpty()) {
if (appendRow(session().data().history(session().user()))) {
++added;
}
Expand All @@ -330,7 +330,7 @@ void ChatsListBoxController::rebuildRows() {
const auto history = static_cast<const Row&>(a).history();
return history->inChatList();
});
if (respectSavedMessagesChat()) {
if (!savedMessagesChatStatus().isEmpty()) {
delegate()->peerListPartitionRows([](const PeerListRow &a) {
return a.peer()->isSelf();
});
Expand Down Expand Up @@ -696,6 +696,10 @@ void ChooseRecipientBoxController::rowClicked(not_null<PeerListRow*> row) {
}
}

QString ChooseRecipientBoxController::savedMessagesChatStatus() const {
return tr::lng_saved_forward_here(tr::now);
}

auto ChooseRecipientBoxController::createRow(
not_null<History*> history) -> std::unique_ptr<Row> {
const auto peer = history->peer;
Expand Down
4 changes: 1 addition & 3 deletions Telegram/SourceFiles/boxes/peer_list_controllers.h
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,7 @@ class ChooseRecipientBoxController
Main::Session &session() const override;
void rowClicked(not_null<PeerListRow*> row) override;

bool respectSavedMessagesChat() const override {
return true;
}
QString savedMessagesChatStatus() const override;

protected:
void prepareViewHook() override;
Expand Down
4 changes: 2 additions & 2 deletions Telegram/SourceFiles/boxes/peers/choose_peer_box.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ class ChoosePeerBoxController final
Main::Session &session() const override;
void rowClicked(not_null<PeerListRow*> row) override;

bool respectSavedMessagesChat() const override {
return true;
QString savedMessagesChatStatus() const override {
return tr::lng_saved_forward_here(tr::now);
}

private:
Expand Down
15 changes: 15 additions & 0 deletions Telegram/SourceFiles/core/local_url_handlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,17 @@ bool OpenExternalLink(
context);
}

bool CopyPeerId(
Window::SessionController *controller,
const Match &match,
const QVariant &context) {
TextUtilities::SetClipboardText(TextForMimeData{ match->captured(1) });
if (controller) {
controller->showToast(tr::lng_text_copied(tr::now));
}
return true;
}

void ExportTestChatTheme(
not_null<Window::SessionController*> controller,
not_null<const Data::CloudTheme*> theme) {
Expand Down Expand Up @@ -985,6 +996,10 @@ const std::vector<LocalUrlHandler> &InternalUrlHandlers() {
u"^url:(.+)$"_q,
OpenExternalLink
},
{
u"^copy:(.+)$"_q,
CopyPeerId
}
};
return Result;
}
Expand Down
4 changes: 2 additions & 2 deletions Telegram/SourceFiles/core/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ constexpr auto AppId = "{4356CE01-4137-4C55-9F8B-FB4EEBB6EC0C}"_cs;
constexpr auto AppNameOld = "rabbitGram Win (Unofficial)"_cs;
constexpr auto AppName = "rabbitGram Desktop"_cs;
constexpr auto AppFile = "rabbitGram"_cs;
constexpr auto AppVersion = 4011000;
constexpr auto AppVersionStr = "4.11";
constexpr auto AppVersion = 4011001;
constexpr auto AppVersionStr = "4.11.1";
constexpr auto AppBetaVersion = false;
constexpr auto AppAlphaVersion = TDESKTOP_ALPHA_VERSION;
9 changes: 9 additions & 0 deletions Telegram/SourceFiles/data/data_web_page.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,15 @@ bool WebPageData::applyChanges(
}
return QString();
}();
const auto hasSiteName = !resultSiteName.isEmpty() ? 1 : 0;
const auto hasTitle = !resultTitle.isEmpty() ? 1 : 0;
const auto hasDescription = !newDescription.text.isEmpty() ? 1 : 0;
if (newDocument
|| !newCollage.items.empty()
|| !newPhoto
|| (hasSiteName + hasTitle + hasDescription < 2)) {
newHasLargeMedia = false;
}

if (type == newType
&& url == resultUrl
Expand Down
2 changes: 1 addition & 1 deletion Telegram/SourceFiles/history/history_inner_widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2380,7 +2380,7 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
};

const auto addReplyAction = [&](HistoryItem *item) {
if (!item) {
if (!item || !item->isRegular()) {
return;
}
const auto canSendReply = [&] {
Expand Down
Loading

0 comments on commit 1960b11

Please sign in to comment.