Compare commits

..

21 Commits

Author SHA1 Message Date
John Preston
a50310f0c1 Beta version 3.1.2 (Windows only).
- Control video in fullscreen mode using arrows and numbers.
- Open locations in browser if default Bing Maps is not installed.
- Reconnect without timeout when network availability changes.
- Crash fixes.
2021-09-26 17:24:09 +04:00
John Preston
eb02a7861a Add modern C++/WinRT headers path to Telegram project. 2021-09-26 17:20:22 +04:00
John Preston
8759ca4577 Rewrite bingmaps check to C++/WinRT. 2021-09-26 17:17:57 +04:00
Hermesis
d5c6d9a231 Open map in browser if default "bingmaps:" handler is not found 2021-09-26 17:16:38 +04:00
John Preston
63f179e93e Add Windows network reachability backend. 2021-09-26 14:31:54 +04:00
Hermesis
cfcc1b1ce7 Control video in fullscreen mode using arrows and numbers 2021-09-26 14:07:02 +04:00
John Preston
da1945d0ca Add some more information for an assertion violation. 2021-09-25 22:49:51 +04:00
John Preston
12252ef1aa One more attempt of OpenGL context loss crash fix. 2021-09-25 22:39:49 +04:00
John Preston
1eef94e8d9 Fix possible crash in delayed typing updates. 2021-09-25 22:39:11 +04:00
Ilya Fedin
0984e631fa Use opus built with cmake on Windows 2021-09-25 15:35:32 +04:00
John Preston
ec064a904d Version 3.1.1.
- Crash fixes.
2021-09-24 08:47:02 +04:00
John Preston
b47692e920 Update patches revision. 2021-09-24 08:46:52 +04:00
John Preston
132f127f3f Add some assertions to debug a crash. 2021-09-24 08:44:22 +04:00
John Preston
5c44b851fe One more attempt to fix crashes on context loss. 2021-09-23 17:39:39 +04:00
John Preston
2f5bed2899 Skip "contact joined" toast if disabled in Settings.
The chats still appear (they are server-side), but skip the toast.
2021-09-23 17:37:29 +04:00
John Preston
cf76933352 Fix saving tray "Toggle notifications" on relaunch.
Fixes https://bugs.telegram.org/c/9509
2021-09-22 14:03:41 +04:00
John Preston
eaa4c5e5b1 Fix caching by making a fake dir ThirdParty/gyp. 2021-09-22 12:42:59 +04:00
John Preston
a4b5b6e370 Fix crash in lottie destructor.
Fixes #16985.
2021-09-21 21:29:59 +04:00
John Preston
c1be1ca4ae Add ./build/prepare/linux.sh which builds docker. 2021-09-21 18:11:24 +04:00
Ilya Fedin
b2df781b76 Fix icon for Quit Telegram taskbar item in snap 2021-09-20 15:09:42 +03:00
Ilya Fedin
38815c1ca8 Backport fonts hook from snapcraft extensions 2021-09-20 11:40:03 +03:00
29 changed files with 200 additions and 53 deletions

View File

@@ -259,12 +259,16 @@ jobs:
- name: Opus.
if: steps.cache-opus.outputs.cache-hit != 'true'
run: |
git clone %GIT%/telegramdesktop/opus.git
git clone -b v1.3.1 %GIT%/xiph/opus.git
cd opus
git checkout tdesktop
cd win32\VS2015
msbuild -m opus.sln /property:Configuration=Debug /property:Platform="Win32"
msbuild -m opus.sln /property:Configuration=Release /property:Platform="Win32"
cmake -B out . ^
-A Win32 ^
-DCMAKE_INSTALL_PREFIX=%LibrariesPath%/local/opus ^
-DCMAKE_C_FLAGS_DEBUG="/MTd /Zi /Ob0 /Od /RTC1" ^
-DCMAKE_C_FLAGS_RELEASE="/MT /O2 /Ob2 /DNDEBUG"
cmake --build out --config Debug
cmake --build out --config Release
cmake --install out --config Release
- name: Rnnoise.
run: |

View File

@@ -43,6 +43,8 @@ include(cmake/generate_appdata_changelog.cmake)
if (WIN32)
include(cmake/generate_midl.cmake)
generate_midl(Telegram ${src_loc}/platform/win/windows_quiethours.idl)
nuget_add_winrt(Telegram)
endif()
set_target_properties(Telegram PROPERTIES AUTOMOC ON AUTORCC ON)

View File

@@ -9,7 +9,7 @@
<Identity Name="TelegramMessengerLLP.TelegramDesktop"
ProcessorArchitecture="ARCHITECTURE"
Publisher="CN=536BC709-8EE1-4478-AF22-F0F0F26FF64A"
Version="3.1.0.0" />
Version="3.1.2.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,1,0,0
PRODUCTVERSION 3,1,0,0
FILEVERSION 3,1,2,0
PRODUCTVERSION 3,1,2,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.1.0.0"
VALUE "FileVersion", "3.1.2.0"
VALUE "LegalCopyright", "Copyright (C) 2014-2021"
VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "3.1.0.0"
VALUE "ProductVersion", "3.1.2.0"
END
END
BLOCK "VarFileInfo"

View File

@@ -35,8 +35,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 3,1,0,0
PRODUCTVERSION 3,1,0,0
FILEVERSION 3,1,2,0
PRODUCTVERSION 3,1,2,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.1.0.0"
VALUE "FileVersion", "3.1.2.0"
VALUE "LegalCopyright", "Copyright (C) 2014-2021"
VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "3.1.0.0"
VALUE "ProductVersion", "3.1.2.0"
END
END
BLOCK "VarFileInfo"

View File

@@ -58,6 +58,16 @@ std::map<int, const char*> BetaLogs() {
{
3000005,
"- Add support for Emoji 13.1."
},
{
3001002,
"- Control video in fullscreen mode using arrows and numbers.\n"
"- Open locations in browser if default Bing Maps is not installed.\n"
"- Reconnect without timeout when network availability changes.\n"
"- Crash fixes."
}
};
};

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 = 3001000;
constexpr auto AppVersionStr = "3.1";
constexpr auto AppBetaVersion = false;
constexpr auto AppVersion = 3001002;
constexpr auto AppVersionStr = "3.1.2";
constexpr auto AppBetaVersion = true;
constexpr auto AppAlphaVersion = TDESKTOP_ALPHA_VERSION;

View File

@@ -341,6 +341,9 @@ enum class MessageFlag : uint32 {
// Fake message for some UI element.
FakeHistoryItem = (1U << 27),
// Contact sign-up message, notification should be skipped for Silent.
IsContactSignUp = (1U << 28),
};
inline constexpr bool is_flag_type(MessageFlag) { return true; }
using MessageFlags = base::flags<MessageFlag>;

View File

@@ -12,6 +12,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
namespace Editor {
QImage ImageModified(QImage image, const PhotoModifications &mods) {
Expects(!image.isNull());
if (!mods) {
return image;
}

View File

@@ -459,6 +459,17 @@ bool HistoryItem::isScheduled() const {
&& (_flags & MessageFlag::IsOrWasScheduled);
}
bool HistoryItem::skipNotification() const {
if (isSilent() && (_flags & MessageFlag::IsContactSignUp)) {
return true;
} else if (const auto forwarded = Get<HistoryMessageForwarded>()) {
if (forwarded->imported) {
return true;
}
}
return false;
}
void HistoryItem::destroy() {
_history->destroyMessage(this);
}

View File

@@ -109,6 +109,7 @@ public:
[[nodiscard]] bool isAdminLogEntry() const;
[[nodiscard]] bool isFromScheduled() const;
[[nodiscard]] bool isScheduled() const;
[[nodiscard]] bool skipNotification() const;
void addLogEntryOriginal(
WebPageId localId,

View File

@@ -554,6 +554,8 @@ void HistoryService::applyAction(const MTPMessageAction &action) {
_flags |= MessageFlag::IsGroupEssential;
}, [&](const MTPDmessageActionChannelMigrateFrom &) {
_flags |= MessageFlag::IsGroupEssential;
}, [&](const MTPDmessageActionContactSignUp &) {
_flags |= MessageFlag::IsContactSignUp;
}, [](const auto &) {
});
}

View File

@@ -1411,15 +1411,16 @@ bool HistoryWidget::updateStickersByEmoji() {
}
void HistoryWidget::fieldChanged() {
const auto typing = (_history
&& !_inlineBot
&& !_editMsgId
&& (_textUpdateEvents & TextUpdateEvent::SendTyping));
const auto updateTyping = (_textUpdateEvents & TextUpdateEvent::SendTyping);
InvokeQueued(this, [=] {
updateInlineBotQuery();
const auto choosingSticker = updateStickersByEmoji();
if (!choosingSticker && typing) {
if (_history
&& !_inlineBot
&& !_editMsgId
&& !choosingSticker
&& updateTyping) {
session().sendProgressManager().update(
_history,
Api::SendProgressType::Typing);

View File

@@ -779,7 +779,7 @@ void MainWindow::toggleDisplayNotifyFromTray() {
settings.setRememberedFlashBounceNotifyFromTray(false);
}
}
account().session().saveSettings();
Core::App().saveSettingsDelayed();
using Change = Window::Notifications::ChangeType;
auto &notifications = Core::App().notifications();
notifications.notifySettingsChanged(Change::DesktopEnabled);

View File

@@ -94,6 +94,7 @@ constexpr auto kPreloadCount = 3;
constexpr auto kMaxZoomLevel = 7; // x8
constexpr auto kZoomToScreenLevel = 1024;
constexpr auto kOverlayLoaderPriority = 2;
constexpr auto kSeekTimeMs = 5 * crl::time(1000);
// macOS OpenGL renderer fails to render larger texture
// even though it reports that max texture size is 16384.
@@ -3002,6 +3003,23 @@ void OverlayWidget::playbackPauseResume() {
}
}
void OverlayWidget::seekRelativeTime(crl::time time) {
Expects(_streamed != nullptr);
const auto newTime = std::clamp(
_streamed->instance.info().video.state.position + time,
crl::time(0),
_streamed->instance.info().video.state.duration);
restartAtSeekPosition(newTime);
}
void OverlayWidget::restartAtProgress(float64 progress) {
Expects(_streamed != nullptr);
restartAtSeekPosition(_streamed->instance.info().video.state.duration
* std::clamp(progress, 0., 1.));
}
void OverlayWidget::restartAtSeekPosition(crl::time position) {
Expects(_streamed != nullptr);
@@ -3737,7 +3755,21 @@ void OverlayWidget::handleKeyPress(not_null<QKeyEvent*> e) {
} else if (_fullScreenVideo) {
if (key == Qt::Key_Escape) {
playbackToggleFullScreen();
} else if (key == Qt::Key_0) {
activateControls();
restartAtSeekPosition(0);
} else if (key >= Qt::Key_1 && key <= Qt::Key_9) {
activateControls();
const auto index = int(key - Qt::Key_0);
restartAtProgress(index / 10.0);
} else if (key == Qt::Key_Left) {
activateControls();
seekRelativeTime(-kSeekTimeMs);
} else if (key == Qt::Key_Right) {
activateControls();
seekRelativeTime(kSeekTimeMs);
}
return;
}
}

View File

@@ -294,6 +294,8 @@ private:
void setZoomLevel(int newZoom, bool force = false);
void updatePlaybackState();
void seekRelativeTime(crl::time time);
void restartAtProgress(float64 progress);
void restartAtSeekPosition(crl::time position);
void refreshClipControllerGeometry();

View File

@@ -12,6 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "platform/win/windows_app_user_model_id.h"
#include "platform/win/windows_dlls.h"
#include "base/platform/base_platform_info.h"
#include "base/platform/win/base_windows_winrt.h"
#include "base/call_delayed.h"
#include "lang/lang_keys.h"
#include "mainwindow.h"
@@ -28,6 +29,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include <qpa/qplatformnativeinterface.h>
#include <Shobjidl.h>
#include <ShObjIdl_core.h>
#include <shellapi.h>
#include <roapi.h>
@@ -546,5 +548,29 @@ void psSendToMenu(bool send, bool silent) {
}
bool psLaunchMaps(const Data::LocationPoint &point) {
return QDesktopServices::openUrl(qsl("bingmaps:?lvl=16&collection=point.%1_%2_Point").arg(point.latAsString()).arg(point.lonAsString()));
const auto aar = base::WinRT::TryCreateInstance<
IApplicationAssociationRegistration
>(CLSID_ApplicationAssociationRegistration);
if (!aar) {
return false;
}
auto handler = (LPWSTR)nullptr;
const auto guard = gsl::finally([&] {
if (handler) {
::CoTaskMemFree(handler);
}
});
const auto result = aar->QueryCurrentDefault(
L"bingmaps",
AT_URLPROTOCOL,
AL_EFFECTIVE,
&handler);
if (FAILED(result) || !handler) {
return false;
}
const auto url = u"bingmaps:?lvl=16&collection=point.%1_%2_Point"_q;
return QDesktopServices::openUrl(
url.arg(point.latAsString()).arg(point.lonAsString()));
}

View File

@@ -14,6 +14,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/image/image_prepare.h"
#include "ui/chat/attach/attach_extensions.h"
#include "ui/chat/attach/attach_prepare.h"
#include "core/crash_reports.h"
#include <QtCore/QSemaphore>
#include <QtCore/QMimeData>
@@ -40,6 +41,8 @@ bool HasExtensionFrom(const QString &file, const QStringList &extensions) {
bool ValidPhotoForAlbum(
const Image &image,
const QString &mime) {
Expects(!image.data.isNull());
if (image.animated
|| Core::IsMimeSticker(mime)
|| (!mime.isEmpty() && !mime.startsWith(u"image/"))) {
@@ -228,6 +231,8 @@ PreparedList PrepareMediaFromImage(
QImage &&image,
QByteArray &&content,
int previewWidth) {
Expects(!image.isNull());
auto result = PreparedList();
auto file = PreparedFile(QString());
file.content = content;
@@ -288,6 +293,7 @@ void PrepareDetails(PreparedFile &file, int previewWidth) {
using Song = PreparedFileInformation::Song;
if (const auto image = std::get_if<Image>(
&file.information->media)) {
Assert(!image->data.isNull());
if (ValidPhotoForAlbum(*image, file.information->filemime)) {
UpdateImageDetails(file, previewWidth);
file.type = PreparedFile::Type::Photo;
@@ -317,14 +323,29 @@ void UpdateImageDetails(PreparedFile &file, int previewWidth) {
if (!image) {
return;
}
const auto &preview = image->modifications
Assert(!image->data.isNull());
auto preview = image->modifications
? Editor::ImageModified(image->data, image->modifications)
: image->data;
Assert(!preview.isNull());
file.shownDimensions = PrepareShownDimensions(preview);
file.preview = Images::prepareOpaque(preview.scaledToWidth(
std::min(previewWidth, style::ConvertScale(preview.width()))
* cIntRetinaFactor(),
Qt::SmoothTransformation));
const auto toWidth = std::min(
previewWidth,
style::ConvertScale(preview.width())
) * cIntRetinaFactor();
const auto scaled = preview.scaledToWidth(
toWidth,
Qt::SmoothTransformation);
if (scaled.isNull()) {
CrashReports::SetAnnotation("Info", QString("%1x%2:%3*%4->%5;%6x%7"
).arg(preview.width()).arg(preview.height()
).arg(previewWidth).arg(cIntRetinaFactor()
).arg(toWidth
).arg(scaled.width()).arg(scaled.height()));
Unexpected("Scaled is null.");
}
Assert(!scaled.isNull());
file.preview = Images::prepareOpaque(scaled);
Assert(!file.preview.isNull());
file.preview.setDevicePixelRatio(cRetinaFactor());
}

View File

@@ -98,25 +98,21 @@ System::SkipState System::skipNotification(
not_null<HistoryItem*> item) const {
const auto history = item->history();
const auto notifyBy = item->specialNotificationPeer();
if (App::quitting() || !history->currentNotification()) {
if (App::quitting()
|| !history->currentNotification()
|| item->skipNotification()) {
return { SkipState::Skip };
} else if (!Core::App().settings().notifyFromAll()
&& &history->session().account() != &Core::App().domain().active()) {
return { SkipState::Skip };
}
const auto scheduled = item->out() && item->isFromScheduled();
if (const auto forwarded = item->Get<HistoryMessageForwarded>()) {
if (forwarded->imported) {
return { SkipState::Skip };
}
}
history->owner().requestNotifySettings(history->peer);
if (notifyBy) {
history->owner().requestNotifySettings(notifyBy);
}
const auto scheduled = item->out() && item->isFromScheduled();
if (history->owner().notifyMuteUnknown(history->peer)) {
return { SkipState::Unknown, item->isSilent() };
} else if (!history->owner().notifyIsMuted(history->peer)) {

View File

@@ -29,7 +29,7 @@ ENV LibrariesPath /usr/src/Libraries
WORKDIR $LibrariesPath
FROM builder AS patches
RUN git clone $GIT/desktop-app/patches.git && cd patches && git checkout 01779db1de
RUN git clone $GIT/desktop-app/patches.git && cd patches && git checkout 9d2a07ba8b
FROM builder AS extra-cmake-modules

View File

@@ -0,0 +1,7 @@
set -e
FullExecPath=$PWD
pushd `dirname $0` > /dev/null
FullScriptPath=`pwd`
popd > /dev/null
./build/docker/centos_env/prepare.sh

View File

@@ -379,7 +379,7 @@ def runStages():
stage('patches', """
git clone https://github.com/desktop-app/patches.git
cd patches
git checkout 1a1d9e6d2c
git checkout 97eee9f4e5
""")
stage('depot_tools', """
@@ -396,6 +396,7 @@ depends:patches/gyp.diff
git apply $LIBS_DIR/patches/gyp.diff
mac:
python3 -m pip install git+https://github.com/nodejs/gyp-next@v0.10.0
mkdir gyp
""", 'ThirdParty')
stage('yasm', """
@@ -498,13 +499,18 @@ mac:
""")
stage('opus', """
git clone -b td-v1.3.1 https://github.com/telegramdesktop/opus.git
git clone -b v1.3.1 https://github.com/xiph/opus.git
cd opus
win:
cd win32\\VS2015
msbuild opus.sln /property:Configuration=Debug /property:Platform="%WIN32X64%"
cmake -B out . ^
-A %WIN32X64% ^
-DCMAKE_INSTALL_PREFIX=%LIBS_DIR%/local/opus ^
-DCMAKE_C_FLAGS_DEBUG="/MTd /Zi /Ob0 /Od /RTC1" ^
-DCMAKE_C_FLAGS_RELEASE="/MT /O2 /Ob2 /DNDEBUG"
cmake --build out --config Debug
release:
msbuild opus.sln /property:Configuration=Release /property:Platform="%WIN32X64%"
cmake --build out --config Release
cmake --install out --config Release
mac:
./autogen.sh
CFLAGS="$MIN_VER $UNGUARDED" CPPFLAGS="$MIN_VER $UNGUARDED" LDFLAGS="$MIN_VER" ./configure --prefix=$USED_PREFIX
@@ -806,6 +812,7 @@ win:
release:
SET CONFIGURATIONS=-debug-and-release
win:
""" + removeDir("\"%LIBS_DIR%\\Qt-5.15.2\"") + """
SET ANGLE_DIR=%LIBS_DIR%\\tg_angle
SET ANGLE_LIBS_DIR=%ANGLE_DIR%\\out
SET MOZJPEG_DIR=%LIBS_DIR%\\mozjpeg

View File

@@ -1,7 +1,7 @@
AppVersion 3001000
AppVersion 3001002
AppVersionStrMajor 3.1
AppVersionStrSmall 3.1
AppVersionStr 3.1.0
BetaChannel 0
AppVersionStrSmall 3.1.2
AppVersionStr 3.1.2
BetaChannel 1
AlphaVersion 0
AppVersionOriginal 3.1
AppVersionOriginal 3.1.2.beta

View File

@@ -1,3 +1,14 @@
3.1.2 beta (26.09.21)
- Control video in fullscreen mode using arrows and numbers.
- Open locations in browser if default Bing Maps is not installed.
- Reconnect without timeout when network availability changes.
- Crash fixes.
3.1.1 (24.09.21)
- Crash fixes.
3.1 (19.09.21)
- Some animated emoji now have extra effects.

2
cmake

Submodule cmake updated: dbc1e4fb35...1dacc0ac4f

View File

@@ -42,7 +42,16 @@ apps:
slots:
- tdesktop-mpris
hooks:
configure:
command-chain:
- bin/hooks-configure-desktop
plugs:
- desktop
plugs:
desktop:
mount-host-font-cache: false
# Support for common GTK themes
# https://forum.snapcraft.io/t/how-to-use-the-system-gtk-theme-via-the-gtk-common-themes-snap/6235
gsettings:
@@ -134,7 +143,7 @@ parts:
snapcraftctl set-version "$version"
sed -i 's|^Icon=.*|Icon=${SNAP}/meta/gui/icon.png|g' lib/xdg/telegramdesktop.desktop
sed -i 's|^Icon=telegram$|Icon=${SNAP}/meta/gui/icon.png|g' lib/xdg/telegramdesktop.desktop
override-build: |
snapcraftctl build
rm -rf "$SNAPCRAFT_PART_INSTALL/usr/share/icons"