Skip to content

Commit

Permalink
Updated to 4.0.1.
Browse files Browse the repository at this point in the history
  • Loading branch information
23rd committed Jun 24, 2022
2 parents e28ec4e + 263ac2e commit bc8dd85
Show file tree
Hide file tree
Showing 53 changed files with 370 additions and 142 deletions.
34 changes: 0 additions & 34 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -1,34 +0,0 @@
name: Docker.

on:
push:
paths:
- '.github/workflows/docker.yml'
- 'Telegram/build/docker/centos_env/**'
pull_request:
paths:
- '.github/workflows/docker.yml'
- 'Telegram/build/docker/centos_env/**'

jobs:
docker:
name: Ubuntu
runs-on: ubuntu-latest

env:
IMAGE_TAG: ghcr.io/${{ github.repository }}/centos_env:latest

steps:
- name: Clone.
uses: actions/checkout@v2
with:
submodules: recursive

- name: Docker image build.
run: docker build -t $IMAGE_TAG --build-arg DEBUG= Telegram/build/docker/centos_env

- name: Push the Docker image.
if: ${{ github.ref_name == github.event.repository.default_branch }}
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin
docker push $IMAGE_TAG
1 change: 0 additions & 1 deletion Telegram/Resources/langs/lang.strings
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL

"lng_limits_increase" = "Increase Limit";

"lng_sticker_premium_title" = "With Effects";
"lng_sticker_premium_text" = "This pack contains premium stickers like this one.";
"lng_sticker_premium_view" = "View";
"lng_reaction_premium_info" = "Click on the reaction to preview the animation.";
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.0.0.0" />
Version="4.0.1.0" />
<Properties>
<DisplayName>Telegram Desktop</DisplayName>
<PublisherDisplayName>Telegram Messenger LLP</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,0,0,0
PRODUCTVERSION 4,0,0,0
FILEVERSION 4,0,1,0
PRODUCTVERSION 4,0,1,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -62,10 +62,10 @@ BEGIN
BEGIN
VALUE "CompanyName", ""
VALUE "FileDescription", "Telegram Desktop"
VALUE "FileVersion", "4.0.0.0"
VALUE "FileVersion", "4.0.1.0"
VALUE "LegalCopyright", "Copyright (C) 2014-2022"
VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "4.0.0.0"
VALUE "ProductVersion", "4.0.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,0,0,0
PRODUCTVERSION 4,0,0,0
FILEVERSION 4,0,1,0
PRODUCTVERSION 4,0,1,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -53,10 +53,10 @@ BEGIN
BEGIN
VALUE "CompanyName", ""
VALUE "FileDescription", "Telegram Desktop Updater"
VALUE "FileVersion", "4.0.0.0"
VALUE "FileVersion", "4.0.1.0"
VALUE "LegalCopyright", "Copyright (C) 2014-2022"
VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "4.0.0.0"
VALUE "ProductVersion", "4.0.1.0"
END
END
BLOCK "VarFileInfo"
Expand Down
14 changes: 11 additions & 3 deletions Telegram/SourceFiles/boxes/peer_list_box.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -654,9 +654,13 @@ void PeerListRow::invalidatePixmapsCache() {
}

int PeerListRow::nameIconWidth() const {
return (special() || !_peer->isVerified())
return special()
? 0
: st::dialogsVerifiedIcon.width();
: _peer->isVerified()
? st::dialogsVerifiedIcon.width()
: _peer->isPremium()
? st::dialogsPremiumIcon.width()
: 0;
}

void PeerListRow::paintNameIcon(
Expand All @@ -665,7 +669,11 @@ void PeerListRow::paintNameIcon(
int y,
int outerWidth,
bool selected) {
st::dialogsVerifiedIcon.paint(p, x, y, outerWidth);
if (_peer->isVerified()) {
st::dialogsVerifiedIcon.paint(p, x, y, outerWidth);
} else if (_peer->isPremium()) {
st::dialogsPremiumIcon.paint(p, x, y, outerWidth);
}
}

void PeerListRow::paintStatusText(
Expand Down
2 changes: 1 addition & 1 deletion Telegram/SourceFiles/boxes/peers/edit_participants_box.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1941,7 +1941,7 @@ auto ParticipantsBoxController::computeType(
? Badge::Fake
: user->isVerified()
? Badge::Verified
: (user->isPremium() && participant->session().premiumPossible())
: (user->isPremium() && participant->session().premiumBadgesShown())
? Badge::Premium
: Badge::None;
return result;
Expand Down
2 changes: 1 addition & 1 deletion Telegram/SourceFiles/boxes/peers/edit_peer_info_box.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ void Controller::refreshHistoryVisibility() {
const auto withUsername = _typeDataSavedValue
&& (_typeDataSavedValue->privacy == Privacy::HasUsername);
_controls.historyVisibilityWrap->toggle(
(withUsername
(!withUsername
&& !_channelHasLocationOriginalValue
&& (!_linkedChatSavedValue || !*_linkedChatSavedValue)),
anim::type::instant);
Expand Down
10 changes: 8 additions & 2 deletions Telegram/SourceFiles/core/click_handler_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,15 @@ void MentionClickHandler::onClick(ClickContext context) const {
const auto button = context.button;
if (button == Qt::LeftButton || button == Qt::MiddleButton) {
const auto my = context.other.value<ClickHandlerContext>();
if (const auto controller = my.sessionWindow.get()) {
const auto controller = my.sessionWindow.get();
const auto use = controller
? controller
: Core::App().activeWindow()
? Core::App().activeWindow()->sessionController()
: nullptr;
if (use) {
using Info = Window::SessionNavigation::PeerByLinkInfo;
controller->showPeerByLink(Info{
use->showPeerByLink(Info{
.usernameOrId = _tag.mid(1),
.resolveType = Window::ResolveType::Mention,
});
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 @@ -24,7 +24,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 = 4000000;
constexpr auto AppVersionStr = "4.0";
constexpr auto AppVersion = 4000001;
constexpr auto AppVersionStr = "4.0.1";
constexpr auto AppBetaVersion = false;
constexpr auto AppAlphaVersion = TDESKTOP_ALPHA_VERSION;
20 changes: 15 additions & 5 deletions Telegram/SourceFiles/dialogs/dialogs_widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,17 +263,27 @@ Widget::Widget(
const auto showAtMsgId = controller->uniqueChatsInSearchResults()
? ShowAtUnreadMsgId
: row.message.fullId.msg;
if (row.newWindow) {
if (row.newWindow && controller->canShowSeparateWindow(peer)) {
const auto active = controller->activeChatCurrent();
if (const auto history = active.history()) {
if (history->peer == peer) {
const auto fromActive = active.history()
? (active.history()->peer == peer)
: false;
const auto toSeparate = [=] {
Core::App().ensureSeparateWindowForPeer(
peer,
showAtMsgId);
};
if (fromActive) {
controller->window().preventOrInvoke([=] {
controller->content()->ui_showPeerHistory(
0,
Window::SectionShow::Way::ClearStack,
0);
}
toSeparate();
});
} else {
toSeparate();
}
Core::App().ensureSeparateWindowForPeer(peer, showAtMsgId);
} else {
controller->content()->choosePeer(peer->id, showAtMsgId);
}
Expand Down
3 changes: 3 additions & 0 deletions Telegram/SourceFiles/history/history_inner_widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1225,6 +1225,9 @@ HistoryInner::VideoUserpic *HistoryInner::validateVideoUserpic(
return i->second.get();
}
const auto repaint = [=] {
if (hasPendingResizedItems()) {
return;
}
enumerateUserpics([&](not_null<Element*> view, int userpicTop) {
// stop the enumeration if the userpic is below the painted rect
if (userpicTop >= _visibleAreaBottom) {
Expand Down
43 changes: 42 additions & 1 deletion Telegram/SourceFiles/history/history_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ For license and copyright information please follow this link:
#include "mainwidget.h"
#include "main/main_session.h"
#include "main/main_domain.h" // Core::App().domain().activate().
#include "menu/menu_ttl_validator.h"
#include "apiwrap.h"
#include "history/history.h"
#include "history/view/media/history_view_invoice.h"
Expand Down Expand Up @@ -1362,7 +1363,11 @@ void HistoryService::createFromMtp(const MTPDmessage &message) {

void HistoryService::createFromMtp(const MTPDmessageService &message) {
const auto type = message.vaction().type();
if (type == mtpc_messageActionGameScore) {
if (type == mtpc_messageActionSetChatTheme) {
setupChatThemeChange();
} else if (type == mtpc_messageActionSetMessagesTTL) {
setupTTLChange();
} else if (type == mtpc_messageActionGameScore) {
const auto &data = message.vaction().c_messageActionGameScore();
UpdateComponents(HistoryServiceGameScore::Bit());
Get<HistoryServiceGameScore>()->score = data.vscore().v;
Expand Down Expand Up @@ -1525,6 +1530,42 @@ void HistoryService::clearDependency() {
}
}

void HistoryService::setupChatThemeChange() {
if (const auto user = history()->peer->asUser()) {
auto link = std::make_shared<LambdaClickHandler>([=](
ClickContext context) {
const auto my = context.other.value<ClickHandlerContext>();
if (const auto controller = my.sessionWindow.get()) {
controller->toggleChooseChatTheme(user);
}
});

UpdateComponents(HistoryServiceChatThemeChange::Bit());
Get<HistoryServiceChatThemeChange>()->link = std::move(link);
} else {
RemoveComponents(HistoryServiceChatThemeChange::Bit());
}
}

void HistoryService::setupTTLChange() {
const auto peer = history()->peer;
auto link = std::make_shared<LambdaClickHandler>([=](
ClickContext context) {
const auto my = context.other.value<ClickHandlerContext>();
if (const auto controller = my.sessionWindow.get()) {
const auto validator = TTLMenu::TTLValidator(
std::make_shared<Window::Show>(controller),
peer);
if (validator.can()) {
validator.showBox();
}
}
});

UpdateComponents(HistoryServiceTTLChange::Bit());
Get<HistoryServiceTTLChange>()->link = std::move(link);
}

void HistoryService::dependencyItemRemoved(HistoryItem *dependency) {
clearDependency();
updateDependentText();
Expand Down
12 changes: 12 additions & 0 deletions Telegram/SourceFiles/history/history_service.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,16 @@ struct HistoryServiceOngoingCall
rpl::lifetime lifetime;
};

struct HistoryServiceChatThemeChange
: public RuntimeComponent<HistoryServiceChatThemeChange, HistoryItem> {
ClickHandlerPtr link;
};

struct HistoryServiceTTLChange
: public RuntimeComponent<HistoryServiceTTLChange, HistoryItem> {
ClickHandlerPtr link;
};

namespace HistoryView {
class ServiceMessagePainter;
} // namespace HistoryView
Expand Down Expand Up @@ -155,6 +165,8 @@ class HistoryService : public HistoryItem {
void updateDependentText();
void updateText(PreparedText &&text);
void clearDependency();
void setupChatThemeChange();
void setupTTLChange();

void createFromMtp(const MTPDmessage &message);
void createFromMtp(const MTPDmessageService &message);
Expand Down
40 changes: 29 additions & 11 deletions Telegram/SourceFiles/history/history_widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -757,8 +757,10 @@ HistoryWidget::HistoryWidget(
if (flags & PeerUpdateFlag::UnavailableReason) {
const auto unavailable = _peer->computeUnavailableReason();
if (!unavailable.isEmpty()) {
controller->showBackFromStack();
controller->show(Ui::MakeInformBox(unavailable));
closeCurrent();
if (const auto primary = Core::App().primaryWindow()) {
primary->show(Ui::MakeInformBox(unavailable));
}
return;
}
}
Expand Down Expand Up @@ -1627,6 +1629,12 @@ void HistoryWidget::fieldChanged() {
updateSendButtonType();
if (!HasSendText(_field)) {
_previewState = Data::PreviewState::Allowed;
_fieldIsEmpty = true;
} else if (_fieldIsEmpty) {
_fieldIsEmpty = false;
if (_kbShown) {
toggleKeyboard();
}
}
if (updateCmdStartShown()) {
updateControlsVisibility();
Expand Down Expand Up @@ -2956,7 +2964,7 @@ void HistoryWidget::unreadCountUpdated() {
if (_history->chatListUnreadMark()) {
crl::on_main(this, [=, history = _history] {
if (history == _history) {
controller()->showBackFromStack();
closeCurrent();
_cancelRequests.fire({});
}
});
Expand All @@ -2966,6 +2974,14 @@ void HistoryWidget::unreadCountUpdated() {
}
}

void HistoryWidget::closeCurrent() {
if (controller()->isPrimary()) {
controller()->showBackFromStack();
} else {
controller()->window().close();
}
}

void HistoryWidget::messagesFailed(const MTP::Error &error, int requestId) {
if (error.type() == qstr("CHANNEL_PRIVATE")
&& _peer->isChannel()
Expand All @@ -2975,13 +2991,15 @@ void HistoryWidget::messagesFailed(const MTP::Error &error, int requestId) {
|| error.type() == qstr("CHANNEL_PUBLIC_GROUP_NA")
|| error.type() == qstr("USER_BANNED_IN_CHANNEL")) {
auto was = _peer;
controller()->showBackFromStack();
Ui::ShowMultilineToast({
.parentOverride = Window::Show(controller()).toastParent(),
.text = { (was && was->isMegagroup())
? tr::lng_group_not_accessible(tr::now)
: tr::lng_channel_not_accessible(tr::now) },
});
closeCurrent();
if (const auto primary = Core::App().primaryWindow()) {
Ui::ShowMultilineToast({
.parentOverride = Window::Show(primary).toastParent(),
.text = { (was && was->isMegagroup())
? tr::lng_group_not_accessible(tr::now)
: tr::lng_channel_not_accessible(tr::now) },
});
}
return;
}

Expand All @@ -2996,7 +3014,7 @@ void HistoryWidget::messagesFailed(const MTP::Error &error, int requestId) {
_preloadDownRequest = 0;
} else if (_firstLoadRequest == requestId) {
_firstLoadRequest = 0;
controller()->showBackFromStack();
closeCurrent();
} else if (_delayedShowAtRequest == requestId) {
_delayedShowAtRequest = 0;
}
Expand Down
Loading

0 comments on commit bc8dd85

Please sign in to comment.