Compare commits

..

43 Commits

Author SHA1 Message Date
John Preston
d679703bbf Version 2.1.6.
- Fix automatic downloads on Windows by clean rebuild.
2020-05-14 01:16:13 +04:00
John Preston
66a3e36024 Version 2.1.5.
- Disable the taskbar icon flash or the dock icon bounce
in Settings > Notifications.
- View messages containing long monospace texts in wide bubbles.
- Bug fixes and other minor improvements.
2020-05-13 18:22:05 +04:00
John Preston
31e38e1690 Fix layout of community transfer error box. 2020-05-13 18:19:09 +04:00
John Preston
da10059f45 Update lib_lottie, hide rlottie dependency. 2020-05-13 17:07:26 +04:00
John Preston
cb5863177f Apply edition updates to search result previews. 2020-05-12 20:29:18 +04:00
John Preston
84399286c1 Update build instructions. 2020-05-12 19:43:39 +04:00
John Preston
2e92441b3a Add input method field text edit workaround. 2020-05-12 19:26:50 +04:00
John Preston
7883f97c94 Use precise sync of the server unixtime. 2020-05-12 17:33:06 +04:00
Ilya Fedin
297b5d6a76 Update submodules 2020-05-12 17:32:40 +04:00
Ilya Fedin
492dc2568c Add DESKTOP_APP_USE_PACKAGED support for Windows 2020-05-12 17:32:40 +04:00
John Preston
547c657b1a Don't reset search results on dialogs re-open. 2020-05-12 16:30:31 +04:00
John Preston
c478d96385 Add debug logs for chats reading requests. 2020-05-12 16:18:19 +04:00
John Preston
2ede53e0ee Always try to open new provided URL.
Fixes #6941.
2020-05-12 16:15:22 +04:00
John Preston
6f760d513e Add a checkbox to disable taskbar flash.
Also add ability to set urgent flag for the window on Linux.

Fixes #223, fixes #897, fixes #906.
2020-05-12 14:16:24 +04:00
John Preston
f4f6550d66 Clear fake-unread status when switching folders. 2020-05-12 12:18:52 +04:00
John Preston
c7878f9d21 Pause by-emoji stickers on sticker preview. 2020-05-12 12:18:31 +04:00
John Preston
cd75a45673 Disable create polls in support accounts. 2020-05-12 11:26:47 +04:00
John Preston
07e3671ca8 Allow monospace blocks to extend bubble width.
This partially fixes #2060 instead of additional settings from #7822.
2020-05-12 11:07:41 +04:00
23rd
295aa644bf Fixed master branch updater Github Action. 2020-05-12 09:55:36 +04:00
John Preston
b5b78c0ade Update submodules. 2020-05-12 09:44:24 +04:00
John Preston
f5c0e5d31d Remove unnecessary include. 2020-05-12 09:43:54 +04:00
root
246ed43046 Remove replyTo from switchInlineBotButton in same peer 2020-05-12 09:29:30 +04:00
Ilya Fedin
701e1d7b4d Add fcitx5 support 2020-05-12 09:26:04 +04:00
Ilya Fedin
9cbe899688 Fix call window hiding when compositing is not supported 2020-05-12 09:17:27 +04:00
Ilya Fedin
7409d615a3 Add a cheat code to enable freetype on Windows and macOS 2020-05-10 17:09:59 +04:00
John Preston
c9553c2d4c Version 2.1.4.
- Improve bold font selection.
2020-05-08 20:34:00 +04:00
John Preston
bedefaee4d Version 2.1.3.
- Added support for new emoji.
- Channels to which you can't post will no longer be suggested when forwarding.
- Improved font selection and bold font support for CJK and Farsi.
2020-05-08 16:48:56 +04:00
John Preston
5d3b8f02fc Add Vazir font as a fallback for Farsi. 2020-05-08 13:38:23 +04:00
John Preston
5120d3ef2c Skip channels without write access in forward box. 2020-05-08 13:35:16 +04:00
John Preston
82a372873f Add two local urls to open language selection box.
tg://setlanguage and tg://settings/language

Fixes #7831.
2020-05-08 13:03:49 +04:00
Ilya Fedin
d1d1f83881 Remove outdated LIBGL_ALWAYS_INDIRECT hack 2020-05-08 12:54:21 +04:00
Ilya Fedin
78c3c86fe6 Check only if at least one audio device is exist on startup
This makes https://github.com/telegramdesktop/tdesktop/issues/1548 don't affect on startup, but only when capture feature is used
2020-05-08 12:50:25 +04:00
Ilya Fedin
447d4e6c47 Remove Portaudio from building instructions
Since it loaded at runtime with dlopen anyway and headers from the system package are OK
2020-05-08 12:49:21 +04:00
John Preston
d0e3d15e8e Update supported systems information. 2020-05-08 12:27:55 +04:00
John Preston
0251f58bf2 Use Semibold in names, use Bold in messages.
Fixes #7813, fixes #7823.
2020-05-08 12:12:47 +04:00
John Preston
36997f084a Automatically load and apply old emoji set by id. 2020-05-08 11:22:22 +04:00
John Preston
942fcb9aae Add new emoji sets file ids. 2020-05-07 19:05:57 +04:00
John Preston
6232dce1a3 Update emoji in the built-in data and sprites. 2020-05-06 19:29:02 +04:00
23rd
0c0fc46b90 Added Github Action that updates code in master branch. 2020-05-06 13:29:17 +04:00
23rd
dcf737bebe Fixed Linux build instruction. 2020-05-06 00:36:48 +03:00
23rd
919834093e Added TG for macOS version check to issue closer. 2020-05-05 18:22:54 +04:00
John Preston
99ccd49e13 Version 2.1.2: Update patches revision in docs. 2020-05-05 18:14:38 +04:00
John Preston
29896b2efd Version 2.1.2: Update Mac App Store build script. 2020-05-05 17:35:42 +04:00
109 changed files with 1480 additions and 972 deletions

View File

@@ -14,6 +14,22 @@ jobs:
echo $tag
echo ::set-env name=LATEST_TAG::$tag
- name: Get the latest macOS version.
shell: python
run: |
import subprocess;
from xml.dom import minidom;
url = "https://osx.telegram.org/updates/versions.xml";
subprocess.check_call("wget %s" % url, shell=True);
xmldoc = minidom.parse('versions.xml');
itemlist = xmldoc.getElementsByTagName('enclosure');
ver = itemlist[0].attributes['sparkle:shortVersionString'].value;
print(ver);
subprocess.check_call("echo ::set-env name=%s::%s" % ("LATEST_MACOS", ver), shell=True);
- name: Check a version from an issue.
uses: actions/github-script@0.4.0
with:
@@ -75,10 +91,20 @@ jobs:
let issueNum = firstNum(issueVer);
let latestNum = firstNum(latestVer);
if (issueNum <= latestNum && issueNum < 5) {
let macos_ver = process.env.LATEST_MACOS;
console.log("Telegram for MacOS version from website: " + macos_ver);
if (issueNum <= latestNum && issueNum < macos_ver) {
console.log("Seems the version of this issue is fine!");
return;
}
if (issueNum > macos_ver) {
let message = `Seems like it's neither the Telegram Desktop\
nor the Telegram for macOS version.
`;
console.log(message);
return;
}
let message = `
Sorry, but according to the version you specify in this issue, \
@@ -87,7 +113,7 @@ jobs:
You can report your issue to [the group](https://t.me/macswift) \
or to [the repository of Telegram for macOS](https://github.com/overtake/TelegramSwift).
If I made a mistake and closed your issue wrongly, please reopen it. Thanks!
**If I made a mistake and closed your issue wrongly, please reopen it. Thanks!**
`;
let params = {

View File

@@ -335,19 +335,6 @@ jobs:
sudo cp -R ffmpeg-cache/. /
- name: PortAudio.
run: |
cd $LibrariesPath
git clone https://git.assembla.com/portaudio.git
cd portaudio
git checkout 396fe4b669
./configure
make -j$(nproc)
sudo make install
cd ..
rm -rf portaudio
- name: OpenAL Soft.
run: |
cd $LibrariesPath
@@ -428,8 +415,8 @@ jobs:
git clone -b v5.12.8 --depth=1 git://code.qt.io/qt/qt5.git qt_${QT}
cd qt_${QT}
perl init-repository --module-subset=qtbase,qtwayland,qtimageformats,qtsvg
git submodule update qtbase qtwayland qtimageformats qtsvg
perl init-repository --module-subset=qtbase,qtwayland,qtimageformats,qtsvg,qtx11extras
git submodule update qtbase qtwayland qtimageformats qtsvg qtx11extras
cd qtbase
git apply ../../patches/qtbase_${QT}.diff
cd ../

35
.github/workflows/master_updater.yml vendored Normal file
View File

@@ -0,0 +1,35 @@
name: Master branch updater.
on:
release:
types: released
jobs:
updater:
runs-on: ubuntu-latest
env:
SKIP: "0"
to_branch: "master"
steps:
- uses: actions/checkout@v1
if: env.SKIP == '0'
- name: Push the code to the master branch.
if: env.SKIP == '0'
run: |
token=${{ secrets.TOKEN_FOR_MASTER_UPDATER }}
if [ -z "${token}" ]; then
echo "Token is unset. Nothing to do."
exit 0
fi
url=https://x-access-token:$token@github.com/$GITHUB_REPOSITORY
latest_tag=$(git describe --tags --abbrev=0)
echo "Latest tag: $latest_tag"
git remote set-url origin $url
git remote -v
git checkout master
git merge $latest_tag
git push origin HEAD:refs/heads/$to_branch
echo "Done!"

3
.gitmodules vendored
View File

@@ -91,3 +91,6 @@
[submodule "Telegram/ThirdParty/libqtxdg"]
path = Telegram/ThirdParty/libqtxdg
url = https://github.com/lxqt/libqtxdg.git
[submodule "Telegram/ThirdParty/fcitx5-qt"]
path = Telegram/ThirdParty/fcitx5-qt
url = https://github.com/fcitx/fcitx5-qt.git

View File

@@ -13,18 +13,27 @@ The source code is published under GPLv3 with OpenSSL exception, the license is
## Supported systems
* Windows XP - Windows 10 (**not** RT)
* Mac OS X 10.8 - Mac OS X 10.15
* Mac OS X 10.6 - Mac OS X 10.7 (separate build)
* Ubuntu 12.04 - Ubuntu 20.04
* Fedora 22 - Fedora 31
* [Snappy](https://snapcraft.io/telegram-desktop)
* [Flathub](https://flathub.org/apps/details/org.telegram.desktop)
The latest version is available for
* [Windows 7 and above](https://telegram.org/dl/desktop/win) ([portable](https://telegram.org/dl/desktop/win_portable))
* [macOS 10.12 and above](https://telegram.org/dl/desktop/mac)
* [OS X 10.10 and 10.11](https://telegram.org/dl/desktop/osx)
* [Linux static build for 64 bit](https://telegram.org/dl/desktop/linux) ([32 bit](https://telegram.org/dl/desktop/linux32))
* [Snap](https://snapcraft.io/telegram-desktop)
* [Flatpak](https://flathub.org/apps/details/org.telegram.desktop)
## Old system versions
Version **1.8.15** was the last that supports older systems
* [Windows XP and Vista](https://updates.tdesktop.com/tsetup/tsetup.1.8.15.exe) ([portable](https://updates.tdesktop.com/tsetup/tportable.1.8.15.zip))
* [OS X 10.8 and 10.9](https://updates.tdesktop.com/tmac/tsetup.1.8.15.dmg)
* [OS X 10.6 and 10.7](https://updates.tdesktop.com/tmac32/tsetup32.1.8.15.dmg)
## Third-party
* Qt 5.12.8 and 5.6.2, slightly patched ([LGPL](http://doc.qt.io/qt-5/lgpl.html))
* OpenSSL 1.1.1 ([OpenSSL License](https://www.openssl.org/source/license.html))
* Qt 5.12.8, 5.6.2 and 5.3.2 slightly patched ([LGPL](http://doc.qt.io/qt-5/lgpl.html))
* OpenSSL 1.1.1 and 1.0.1 ([OpenSSL License](https://www.openssl.org/source/license.html))
* zlib 1.2.11 ([zlib License](http://www.zlib.net/zlib_license.html))
* LZMA SDK 9.20 ([public domain](http://www.7-zip.org/sdk.html))
* liblzma ([public domain](http://tukaani.org/xz/))
@@ -39,6 +48,7 @@ The source code is published under GPLv3 with OpenSSL exception, the license is
* Mapbox Variant ([BSD License](https://github.com/mapbox/variant/blob/master/LICENSE))
* Range-v3 ([Boost License](https://github.com/ericniebler/range-v3/blob/master/LICENSE.txt))
* Open Sans font ([Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0.html))
* Vazir font ([License](https://github.com/rastikerdar/vazir-font/blob/master/LICENSE))
* Emoji alpha codes ([MIT License](https://github.com/emojione/emojione/blob/master/extras/alpha-codes/LICENSE.md))
* Catch test framework ([Boost License](https://github.com/philsquared/Catch/blob/master/LICENSE.txt))
* xxHash ([BSD License](https://github.com/Cyan4973/xxHash/blob/dev/LICENSE))

View File

@@ -90,7 +90,7 @@ if (LINUX)
PRIVATE
desktop-app::external_statusnotifieritem
desktop-app::external_dbusmenu_qt
desktop-app::external_fcitx_qt5
desktop-app::external_fcitx5_qt5
desktop-app::external_hime_qt
)
endif()
@@ -138,7 +138,7 @@ endif()
if (DESKTOP_APP_USE_PACKAGED)
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
find_package(Threads)
find_package(Threads REQUIRED)
target_link_libraries(Telegram
PRIVATE
@@ -1042,6 +1042,8 @@ PRIVATE
qrc/emoji_3.qrc
qrc/emoji_4.qrc
qrc/emoji_5.qrc
qrc/emoji_6.qrc
qrc/emoji_7.qrc
qrc/emoji_preview.qrc
qrc/telegram/telegram.qrc
qrc/telegram/sounds.qrc
@@ -1210,6 +1212,10 @@ if ((NOT DESKTOP_APP_DISABLE_AUTOUPDATE OR NOT LINUX) AND NOT build_macstore AND
set_target_properties(Updater PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${output_folder})
if (WIN32 AND NOT CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
target_link_options(Updater PRIVATE -municode)
endif()
if (LINUX)
target_link_options(Updater PRIVATE -static-libstdc++)
endif()

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 MiB

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 MiB

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 MiB

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 894 KiB

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 862 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

View File

@@ -300,6 +300,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_settings_notifications_position" = "Location on the screen";
"lng_settings_notifications_count" = "Notifications count";
"lng_settings_sound_notify" = "Play sound";
"lng_settings_alert_windows" = "Flash the taskbar icon";
"lng_settings_alert_mac" = "Bounce the dock icon";
"lng_settings_alert_linux" = "Draw attention to the window";
"lng_settings_badge_title" = "Badge counter";
"lng_settings_include_muted" = "Include muted chats in unread count";
"lng_settings_count_unread" = "Count unread messages";

View File

@@ -0,0 +1,5 @@
<RCC>
<qresource prefix="/gui">
<file alias="emoji/emoji_6.webp">../emoji/emoji_6.webp</file>
</qresource>
</RCC>

View File

@@ -0,0 +1,5 @@
<RCC>
<qresource prefix="/gui">
<file alias="emoji/emoji_7.webp">../emoji/emoji_7.webp</file>
</qresource>
</RCC>

View File

@@ -9,7 +9,7 @@
<Identity Name="TelegramMessengerLLP.TelegramDesktop"
ProcessorArchitecture="ARCHITECTURE"
Publisher="CN=536BC709-8EE1-4478-AF22-F0F0F26FF64A"
Version="2.1.2.0" />
Version="2.1.6.0" />
<Properties>
<DisplayName>Telegram Desktop</DisplayName>
<PublisherDisplayName>Telegram FZ-LLC</PublisherDisplayName>

View File

@@ -6,7 +6,18 @@
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "winres.h"
#if defined(__MINGW64__) || defined(__MINGW32__)
// MinGW-w64, MinGW
#if defined(__has_include) && __has_include(<winres.h>)
#include <winres.h>
#else
#include <afxres.h>
#include <winresrc.h>
#endif
#else
// MSVC, Windows SDK
#include <winres.h>
#endif
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
@@ -33,8 +44,8 @@ IDI_ICON1 ICON "..\\art\\icon256.ico"
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 2,1,2,0
PRODUCTVERSION 2,1,2,0
FILEVERSION 2,1,6,0
PRODUCTVERSION 2,1,6,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -51,10 +62,10 @@ BEGIN
BEGIN
VALUE "CompanyName", "Telegram FZ-LLC"
VALUE "FileDescription", "Telegram Desktop"
VALUE "FileVersion", "2.1.2.0"
VALUE "FileVersion", "2.1.6.0"
VALUE "LegalCopyright", "Copyright (C) 2014-2020"
VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "2.1.2.0"
VALUE "ProductVersion", "2.1.6.0"
END
END
BLOCK "VarFileInfo"

View File

@@ -6,7 +6,18 @@
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "winres.h"
#if defined(__MINGW64__) || defined(__MINGW32__)
// MinGW-w64, MinGW
#if defined(__has_include) && __has_include(<winres.h>)
#include <winres.h>
#else
#include <afxres.h>
#include <winresrc.h>
#endif
#else
// MSVC, Windows SDK
#include <winres.h>
#endif
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
@@ -24,8 +35,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 2,1,2,0
PRODUCTVERSION 2,1,2,0
FILEVERSION 2,1,6,0
PRODUCTVERSION 2,1,6,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -42,10 +53,10 @@ BEGIN
BEGIN
VALUE "CompanyName", "Telegram FZ-LLC"
VALUE "FileDescription", "Telegram Desktop Updater"
VALUE "FileVersion", "2.1.2.0"
VALUE "FileVersion", "2.1.6.0"
VALUE "LegalCopyright", "Copyright (C) 2014-2020"
VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "2.1.2.0"
VALUE "ProductVersion", "2.1.6.0"
END
END
BLOCK "VarFileInfo"

View File

@@ -268,7 +268,7 @@ int main(int argc, char *argv[])
cout << "Compression start, size: " << resultSize << "\n";
QByteArray compressed, resultCheck;
#ifdef Q_OS_WIN // use Lzma SDK for win
#if defined Q_OS_WIN && !defined DESKTOP_APP_USE_PACKAGED // use Lzma SDK for win
const int32 hSigLen = 128, hShaLen = 20, hPropsLen = LZMA_PROPS_SIZE, hOriginalSizeLen = sizeof(int32), hSize = hSigLen + hShaLen + hPropsLen + hOriginalSizeLen; // header
compressed.resize(hSize + resultSize + 1024 * 1024); // rsa signature + sha1 + lzma props + max compressed size

View File

@@ -27,7 +27,7 @@ extern "C" {
#include <openssl/evp.h>
} // extern "C"
#ifdef Q_OS_WIN // use Lzma SDK for win
#if defined Q_OS_WIN && !defined DESKTOP_APP_USE_PACKAGED // use Lzma SDK for win
#include <LzmaLib.h>
#else
#include <lzma.h>

View File

@@ -82,6 +82,7 @@ MTPVector<MTPMessageEntity> EntitiesToMTP(
if (entity.length() <= 0) continue;
if (option == ConvertOption::SkipLocal
&& entity.type() != EntityType::Bold
//&& entity.type() != EntityType::Semibold // Not in API.
&& entity.type() != EntityType::Italic
&& entity.type() != EntityType::Underline
&& entity.type() != EntityType::StrikeOut

View File

@@ -915,7 +915,7 @@ blockUserConfirmation: FlatLabel(boxLabel) {
minWidth: 240px;
}
transferCheckWidth: 300px;
transferCheckWidth: 320px;
slowmodeLabelsMargin: margins(0px, 5px, 0px, 0px);
slowmodeLabel: LabelSimple(defaultLabelSimple) {

View File

@@ -83,7 +83,7 @@ private:
void show(anim::type animated);
void destroy(FnMut<void()> done);
[[nodisacrd]] bool hasShadow() const;
[[nodiscard]] bool hasShadow() const;
void createShadow();
void destroyShadow();

View File

@@ -584,5 +584,9 @@ void ChooseRecipientBoxController::rowClicked(not_null<PeerListRow*> row) {
auto ChooseRecipientBoxController::createRow(
not_null<History*> history) -> std::unique_ptr<Row> {
return std::make_unique<Row>(history);
const auto peer = history->peer;
const auto skip = peer->isChannel()
&& !peer->isMegagroup()
&& !peer->canWrite();
return skip ? nullptr : std::make_unique<Row>(history);
}

View File

@@ -463,6 +463,8 @@ void Panel::toggleOpacityAnimation(bool visible) {
_visible ? 1. : 0.,
st::callPanelDuration,
_visible ? anim::easeOutCirc : anim::easeInCirc);
} else if (!isHidden() && !_visible) {
hide();
}
if (isHidden() && _visible) {
show();

View File

@@ -40,15 +40,15 @@ inline auto PreviewPath(int i) {
const auto kSets = {
Set{ {0, 0, 0, "Mac"}, PreviewPath(0) },
Set{ {1, 246, 7'336'383, "Android"}, PreviewPath(1) },
Set{ {2, 206, 5'038'738, "Twemoji"}, PreviewPath(2) },
Set{ {3, 238, 6'992'260, "JoyPixels"}, PreviewPath(3) },
Set{ {1, 713, 7'313'166, "Android"}, PreviewPath(1) },
Set{ {2, 714, 4'690'333, "Twemoji"}, PreviewPath(2) },
Set{ {3, 716, 5'968'021, "JoyPixels"}, PreviewPath(3) },
};
using Loading = MTP::DedicatedLoader::Progress;
using SetState = BlobState;
class Loader : public BlobLoader {
class Loader final : public BlobLoader {
public:
Loader(
QObject *parent,
@@ -60,6 +60,9 @@ public:
void destroy() override;
void unpack(const QString &path) override;
private:
void fail() override;
};
class Inner : public Ui::RpWidget {
@@ -155,12 +158,14 @@ bool UnpackSet(const QString &path, const QString &folder) {
return UnpackBlob(path, folder, GoodSetPartName);
}
Loader::Loader(
QObject *parent,
int id,
MTP::DedicatedLoader::Location location,
const QString &folder,
int size) : BlobLoader(parent, id, location, folder, size) {
int size)
: BlobLoader(parent, id, location, folder, size) {
}
void Loader::unpack(const QString &path) {
@@ -190,6 +195,11 @@ void Loader::destroy() {
SetGlobalLoader(nullptr);
}
void Loader::fail() {
ClearNeedSwitchToId();
BlobLoader::fail();
}
Inner::Inner(QWidget *parent) : RpWidget(parent) {
setupContent();
}
@@ -401,12 +411,7 @@ void Row::setupHandler() {
}
void Row::load() {
SetGlobalLoader(base::make_unique_q<Loader>(
App::main(),
_id,
GetDownloadLocation(_id),
internal::SetDataPath(_id),
GetDownloadSize(_id)));
LoadAndSwitchTo(_id);
}
void Row::setupLabels(const Set &set) {
@@ -538,5 +543,20 @@ void ManageSetsBox::prepare() {
setDimensionsToContent(st::boxWidth, inner);
}
void LoadAndSwitchTo(int id) {
Expects(App::main() != nullptr);
if (!ranges::contains(kSets, id, &Set::id)) {
ClearNeedSwitchToId();
return;
}
SetGlobalLoader(base::make_unique_q<Loader>(
App::main(),
id,
GetDownloadLocation(id),
internal::SetDataPath(id),
GetDownloadSize(id)));
}
} // namespace Emoji
} // namespace Ui

View File

@@ -21,5 +21,7 @@ protected:
};
void LoadAndSwitchTo(int id);
} // namespace Emoji
} // namespace Ui

View File

@@ -20,9 +20,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/widgets/scroll_area.h"
#include "ui/image/image.h"
#include "ui/ui_utility.h"
#include "main/main_session.h"
#include "chat_helpers/stickers.h"
#include "base/unixtime.h"
#include "window/window_session_controller.h"
#include "facades.h"
#include "app.h"
#include "styles/style_history.h"
@@ -33,14 +33,15 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
FieldAutocomplete::FieldAutocomplete(
QWidget *parent,
not_null<Main::Session*> session)
not_null<Window::SessionController*> controller)
: RpWidget(parent)
, _session(session)
, _controller(controller)
, _scroll(this, st::mentionScroll) {
_scroll->setGeometry(rect());
_inner = _scroll->setOwnedWidget(
object_ptr<internal::FieldAutocompleteInner>(
_controller,
this,
&_mrows,
&_hrows,
@@ -169,7 +170,7 @@ inline int indexOfInFirstN(const T &v, const U &elem, int last) {
internal::StickerRows FieldAutocomplete::getStickerSuggestions() {
const auto list = Stickers::GetListByEmoji(
_session,
&_controller->session(),
_emoji,
_stickersSeed
);
@@ -584,12 +585,14 @@ bool FieldAutocomplete::eventFilter(QObject *obj, QEvent *e) {
namespace internal {
FieldAutocompleteInner::FieldAutocompleteInner(
not_null<Window::SessionController*> controller,
not_null<FieldAutocomplete*> parent,
not_null<MentionRows*> mrows,
not_null<HashtagRows*> hrows,
not_null<BotCommandRows*> brows,
not_null<StickerRows*> srows)
: _parent(parent)
: _controller(controller)
, _parent(parent)
, _mrows(mrows)
, _hrows(hrows)
, _brows(brows)
@@ -665,7 +668,6 @@ void FieldAutocompleteInner::paintEvent(QPaintEvent *e) {
}
if (sticker.animated && sticker.animated->ready()) {
const auto frame = sticker.animated->frame();
sticker.animated->markFrameShown();
const auto size = frame.size() / cIntRetinaFactor();
const auto ppos = pos + QPoint(
(st::stickerPanSize.width() - size.width()) / 2,
@@ -673,6 +675,11 @@ void FieldAutocompleteInner::paintEvent(QPaintEvent *e) {
p.drawImage(
QRect(ppos, size),
frame);
const auto paused = _controller->isGifPausedAtLeastFor(
Window::GifPauseReason::SavedGifs);
if (!paused) {
sticker.animated->markFrameShown();
}
} else if (const auto image = document->getStickerSmall()) {
QPoint ppos = pos + QPoint((st::stickerPanSize.width() - w) / 2, (st::stickerPanSize.height() - h) / 2);
p.drawPixmapLeft(ppos, width(), image->pix(document->stickerSetOrigin(), w, h));

View File

@@ -22,9 +22,9 @@ class SinglePlayer;
class FrameRenderer;
} // namespace Lottie;
namespace Main {
class Session;
} // namespace Main
namespace Window {
class SessionController;
} // namespace Window
namespace internal {
@@ -46,7 +46,9 @@ class FieldAutocomplete final : public Ui::RpWidget {
Q_OBJECT
public:
FieldAutocomplete(QWidget *parent, not_null<Main::Session*> session);
FieldAutocomplete(
QWidget *parent,
not_null<Window::SessionController*> controller);
~FieldAutocomplete();
bool clearFilteredBotCommands();
@@ -109,7 +111,7 @@ private:
void recount(bool resetScroll = false);
internal::StickerRows getStickerSuggestions();
const not_null<Main::Session*> _session;
const not_null<Window::SessionController*> _controller;
QPixmap _cache;
internal::MentionRows _mrows;
internal::HashtagRows _hrows;
@@ -160,6 +162,7 @@ class FieldAutocompleteInner final
public:
FieldAutocompleteInner(
not_null<Window::SessionController*> controller,
not_null<FieldAutocomplete*> parent,
not_null<MentionRows*> mrows,
not_null<HashtagRows*> hrows,
@@ -204,11 +207,12 @@ private:
void repaintSticker(not_null<DocumentData*> document);
std::shared_ptr<Lottie::FrameRenderer> getLottieRenderer();
not_null<FieldAutocomplete*> _parent;
not_null<MentionRows*> _mrows;
not_null<HashtagRows*> _hrows;
not_null<BotCommandRows*> _brows;
not_null<StickerRows*> _srows;
const not_null<Window::SessionController*> _controller;
const not_null<FieldAutocomplete*> _parent;
const not_null<MentionRows*> _mrows;
const not_null<HashtagRows*> _hrows;
const not_null<BotCommandRows*> _brows;
const not_null<StickerRows*> _srows;
rpl::lifetime _stickersLifetime;
std::weak_ptr<Lottie::FrameRenderer> _lottieRenderer;
int _stickersPerRow = 1;

View File

@@ -518,6 +518,21 @@ void Application::switchTestMode() {
App::restart();
}
void Application::switchFreeType() {
if (cUseFreeType()) {
QFile(cWorkingDir() + qsl("tdata/withfreetype")).remove();
cSetUseFreeType(false);
} else {
QFile f(cWorkingDir() + qsl("tdata/withfreetype"));
if (f.open(QIODevice::WriteOnly)) {
f.write("1");
f.close();
}
cSetUseFreeType(true);
}
App::restart();
}
void Application::writeInstallBetaVersionsSetting() {
_launcher->writeInstallBetaVersionsSetting();
}

View File

@@ -215,6 +215,7 @@ public:
void switchDebugMode();
void switchTestMode();
void switchFreeType();
void writeInstallBetaVersionsSetting();
void call_handleUnreadCounterUpdate();

View File

@@ -34,26 +34,47 @@ private:
static constexpr auto kForwardArgumentCount = 1;
int _count = 0;
char *_arguments[kForwardArgumentCount + 1] = { nullptr };
std::vector<QByteArray> _owned;
std::vector<char*> _arguments;
void pushArgument(const char *text);
};
FilteredCommandLineArguments::FilteredCommandLineArguments(
int argc,
char **argv)
: _count(std::clamp(argc, 0, kForwardArgumentCount)) {
char **argv) {
// For now just pass only the first argument, the executable path.
for (auto i = 0; i != _count; ++i) {
_arguments[i] = argv[i];
for (auto i = 0; i != kForwardArgumentCount; ++i) {
pushArgument(argv[i]);
}
#if defined Q_OS_WIN || defined Q_OS_MAC
if (cUseFreeType()) {
pushArgument("-platform");
#ifdef Q_OS_WIN
pushArgument("windows:fontengine=freetype");
#else // Q_OS_WIN
pushArgument("cocoa:fontengine=freetype");
#endif // !Q_OS_WIN
}
#endif // Q_OS_WIN || Q_OS_MAC
pushArgument(nullptr);
}
int &FilteredCommandLineArguments::count() {
_count = _arguments.size() - 1;
return _count;
}
char **FilteredCommandLineArguments::values() {
return _arguments;
return _arguments.data();
}
void FilteredCommandLineArguments::pushArgument(const char *text) {
_owned.emplace_back(text);
_arguments.push_back(_owned.back().data());
}
QString DebugModeSettingPath() {
@@ -82,6 +103,12 @@ void ComputeTestMode() {
}
}
void ComputeFreeType() {
if (QFile(cWorkingDir() + qsl("tdata/withfreetype")).exists()) {
cSetUseFreeType(true);
}
}
QString InstallBetaVersionsSettingPath() {
return cWorkingDir() + qsl("tdata/devversion");
}
@@ -301,6 +328,7 @@ void Launcher::workingFolderReady() {
ComputeTestMode();
ComputeDebugMode();
ComputeFreeType();
ComputeInstallBetaVersions();
ComputeInstallationTag();
}
@@ -382,6 +410,7 @@ void Launcher::processArguments() {
auto parseMap = std::map<QByteArray, KeyFormat> {
{ "-testmode" , KeyFormat::NoValues },
{ "-debug" , KeyFormat::NoValues },
{ "-freetype" , KeyFormat::NoValues },
{ "-many" , KeyFormat::NoValues },
{ "-key" , KeyFormat::OneValue },
{ "-autostart" , KeyFormat::NoValues },
@@ -423,6 +452,7 @@ void Launcher::processArguments() {
SetUpdaterDisabledAtStartup();
}
gTestMode = parseResult.contains("-testmode");
gUseFreeType = parseResult.contains("-freetype");
Logs::SetDebugEnabled(parseResult.contains("-debug"));
gManyInstance = parseResult.contains("-many");
gKeyFile = parseResult.value("-key", {}).join(QString()).toLower();

View File

@@ -21,6 +21,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "boxes/connection_box.h"
#include "boxes/sticker_set_box.h"
#include "boxes/sessions_box.h"
#include "boxes/language_box.h"
#include "passport/passport_form_controller.h"
#include "window/window_session_controller.h"
#include "data/data_session.h"
@@ -101,12 +102,21 @@ bool ShowTheme(
return true;
}
void ShowLanguagesBox() {
static auto Guard = base::binary_guard();
Guard = LanguageBox::Show();
}
bool SetLanguage(
Main::Session *session,
const Match &match,
const QVariant &context) {
const auto languageId = match->captured(1);
Lang::CurrentCloudManager().switchWithWarning(languageId);
if (match->capturedRef(1).isEmpty()) {
ShowLanguagesBox();
} else {
const auto languageId = match->captured(2);
Lang::CurrentCloudManager().switchWithWarning(languageId);
}
return true;
}
@@ -351,6 +361,9 @@ bool ResolveSettings(
if (section == qstr("devices")) {
Ui::show(Box<SessionsBox>(session));
return true;
} else if (section == qstr("language")) {
ShowLanguagesBox();
return true;
}
const auto type = (section == qstr("folders"))
? ::Settings::Type::Folders
@@ -441,7 +454,7 @@ const std::vector<LocalUrlHandler> &LocalUrlHandlers() {
ShowTheme
},
{
qsl("^setlanguage/?\\?lang=([a-zA-Z0-9\\.\\_\\-]+)(&|$)"),
qsl("^setlanguage/?(\\?lang=([a-zA-Z0-9\\.\\_\\-]+))?(&|$)"),
SetLanguage
},
{
@@ -481,7 +494,7 @@ const std::vector<LocalUrlHandler> &LocalUrlHandlers() {
ResolvePrivatePost
},
{
qsl("^settings(/folders|/devices)?$"),
qsl("^settings(/folders|/devices|/language)?$"),
ResolveSettings
},
{

View File

@@ -373,11 +373,8 @@ void Sandbox::readClients() {
toSend.append(_escapeFrom7bit(cmds.mid(from + 5, to - from - 5)));
}
} else if (cmd.startsWith(qsl("OPEN:"))) {
auto activateRequired = true;
if (cStartUrl().isEmpty()) {
startUrl = _escapeFrom7bit(cmds.mid(from + 5, to - from - 5)).mid(0, 8192);
activateRequired = StartUrlRequiresActivate(startUrl);
}
startUrl = _escapeFrom7bit(cmds.mid(from + 5, to - from - 5)).mid(0, 8192);
auto activateRequired = StartUrlRequiresActivate(startUrl);
if (activateRequired) {
execExternal("show");
}

View File

@@ -33,11 +33,11 @@ extern "C" {
#include <openssl/err.h>
} // extern "C"
#ifdef Q_OS_WIN // use Lzma SDK for win
#if defined Q_OS_WIN && !defined DESKTOP_APP_USE_PACKAGED // use Lzma SDK for win
#include <LzmaLib.h>
#else // Q_OS_WIN
#else // Q_OS_WIN && !DESKTOP_APP_USE_PACKAGED
#include <lzma.h>
#endif // else of Q_OS_WIN
#endif // else of Q_OS_WIN && !DESKTOP_APP_USE_PACKAGED
namespace Core {
namespace {
@@ -252,11 +252,11 @@ bool UnpackUpdate(const QString &filepath) {
return false;
}
#ifdef Q_OS_WIN // use Lzma SDK for win
#if defined Q_OS_WIN && !defined DESKTOP_APP_USE_PACKAGED // use Lzma SDK for win
const int32 hSigLen = 128, hShaLen = 20, hPropsLen = LZMA_PROPS_SIZE, hOriginalSizeLen = sizeof(int32), hSize = hSigLen + hShaLen + hPropsLen + hOriginalSizeLen; // header
#else // Q_OS_WIN
#else // Q_OS_WIN && !DESKTOP_APP_USE_PACKAGED
const int32 hSigLen = 128, hShaLen = 20, hPropsLen = 0, hOriginalSizeLen = sizeof(int32), hSize = hSigLen + hShaLen + hOriginalSizeLen; // header
#endif // Q_OS_WIN
#endif // Q_OS_WIN && !DESKTOP_APP_USE_PACKAGED
QByteArray compressed = input.readAll();
int32 compressedLen = compressed.size() - hSize;
@@ -311,14 +311,14 @@ bool UnpackUpdate(const QString &filepath) {
uncompressed.resize(uncompressedLen);
size_t resultLen = uncompressed.size();
#ifdef Q_OS_WIN // use Lzma SDK for win
#if defined Q_OS_WIN && !defined DESKTOP_APP_USE_PACKAGED // use Lzma SDK for win
SizeT srcLen = compressedLen;
int uncompressRes = LzmaUncompress((uchar*)uncompressed.data(), &resultLen, (const uchar*)(compressed.constData() + hSize), &srcLen, (const uchar*)(compressed.constData() + hSigLen + hShaLen), LZMA_PROPS_SIZE);
if (uncompressRes != SZ_OK) {
LOG(("Update Error: could not uncompress lzma, code: %1").arg(uncompressRes));
return false;
}
#else // Q_OS_WIN
#else // Q_OS_WIN && !DESKTOP_APP_USE_PACKAGED
lzma_stream stream = LZMA_STREAM_INIT;
lzma_ret ret = lzma_stream_decoder(&stream, UINT64_MAX, LZMA_CONCATENATED);
@@ -361,7 +361,7 @@ bool UnpackUpdate(const QString &filepath) {
LOG(("Error in decompression: %1 (error code %2)").arg(msg).arg(res));
return false;
}
#endif // Q_OS_WIN
#endif // Q_OS_WIN && !DESKTOP_APP_USE_PACKAGED
tempDir.mkdir(tempDir.absolutePath());

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 = 2001002;
constexpr auto AppVersionStr = "2.1.2";
constexpr auto AppVersion = 2001006;
constexpr auto AppVersionStr = "2.1.6";
constexpr auto AppBetaVersion = false;
constexpr auto AppAlphaVersion = TDESKTOP_ALPHA_VERSION;

View File

@@ -66,23 +66,32 @@ void Histories::clearAll() {
}
void Histories::readInbox(not_null<History*> history) {
DEBUG_LOG(("Reading: readInbox called."));
if (history->lastServerMessageKnown()) {
const auto last = history->lastServerMessage();
DEBUG_LOG(("Reading: last known, reading till %1."
).arg(last ? last->id : 0));
readInboxTill(history, last ? last->id : 0);
return;
} else if (history->loadedAtBottom()) {
if (const auto lastId = history->maxMsgId()) {
DEBUG_LOG(("Reading: loaded at bottom, maxMsgId %1."
).arg(lastId));
readInboxTill(history, lastId);
return;
} else if (history->loadedAtTop()) {
DEBUG_LOG(("Reading: loaded at bottom, loaded at top."));
readInboxTill(history, 0);
return;
}
DEBUG_LOG(("Reading: loaded at bottom, but requesting entry."));
}
requestDialogEntry(history, [=] {
Expects(history->lastServerMessageKnown());
const auto last = history->lastServerMessage();
DEBUG_LOG(("Reading: got entry, reading till %1."
).arg(last ? last->id : 0));
readInboxTill(history, last ? last->id : 0);
});
}
@@ -135,10 +144,20 @@ void Histories::readInboxTill(
bool force) {
Expects(IsServerMsgId(tillId) || (!tillId && !force));
DEBUG_LOG(("Reading: readInboxTill %1, force %2."
).arg(tillId
).arg(Logs::b(force)));
const auto syncGuard = gsl::finally([&] {
DEBUG_LOG(("Reading: in guard, unread %1."
).arg(history->unreadCount()));
if (history->unreadCount() > 0) {
if (const auto last = history->lastServerMessage()) {
DEBUG_LOG(("Reading: checking last %1 and %2."
).arg(last->id
).arg(tillId));
if (last->id == tillId) {
DEBUG_LOG(("Reading: locally marked as read."));
history->setUnreadCount(0);
history->updateChatListEntry();
}
@@ -150,14 +169,21 @@ void Histories::readInboxTill(
const auto needsRequest = history->readInboxTillNeedsRequest(tillId);
if (!needsRequest && !force) {
DEBUG_LOG(("Reading: readInboxTill finish 1."));
return;
} else if (!history->trackUnreadMessages()) {
DEBUG_LOG(("Reading: readInboxTill finish 2."));
return;
}
const auto maybeState = lookup(history);
if (maybeState && maybeState->sentReadTill >= tillId) {
DEBUG_LOG(("Reading: readInboxTill finish 3 with %1."
).arg(maybeState->sentReadTill));
return;
} else if (maybeState && maybeState->willReadTill >= tillId) {
DEBUG_LOG(("Reading: readInboxTill finish 4 with %1 and force %2."
).arg(maybeState->sentReadTill
).arg(Logs::b(force)));
if (force) {
sendPendingReadInbox(history);
}
@@ -171,23 +197,35 @@ void Histories::readInboxTill(
&& stillUnread
&& history->unreadCountKnown()
&& *stillUnread == history->unreadCount()) {
DEBUG_LOG(("Reading: count didn't change so just update till %1"
).arg(tillId));
history->setInboxReadTill(tillId);
return;
}
auto &state = maybeState ? *maybeState : _states[history];
state.willReadTill = tillId;
if (force || !stillUnread || !*stillUnread) {
DEBUG_LOG(("Reading: will read till %1 with still unread %2"
).arg(tillId
).arg(stillUnread.value_or(-666)));
state.willReadWhen = 0;
sendReadRequests();
if (!stillUnread) {
return;
}
} else if (!state.willReadWhen) {
DEBUG_LOG(("Reading: will read till %1 with postponed").arg(tillId));
state.willReadWhen = crl::now() + kReadRequestTimeout;
if (!_readRequestsTimer.isActive()) {
_readRequestsTimer.callOnce(kReadRequestTimeout);
}
} else {
DEBUG_LOG(("Reading: will read till %1 postponed already"
).arg(tillId));
}
DEBUG_LOG(("Reading: marking now with till %1 and still %2"
).arg(tillId
).arg(*stillUnread));
history->setInboxReadTill(tillId);
history->setUnreadCount(*stillUnread);
history->updateChatListEntry();
@@ -399,6 +437,9 @@ void Histories::requestFakeChatListMessage(
void Histories::sendPendingReadInbox(not_null<History*> history) {
if (const auto state = lookup(history)) {
DEBUG_LOG(("Reading: send pending now with till %1 and when %2"
).arg(state->willReadTill
).arg(state->willReadWhen));
if (state->willReadTill && state->willReadWhen) {
state->willReadWhen = 0;
sendReadRequests();
@@ -407,6 +448,7 @@ void Histories::sendPendingReadInbox(not_null<History*> history) {
}
void Histories::sendReadRequests() {
DEBUG_LOG(("Reading: send requests with count %1.").arg(_states.size()));
if (_states.empty()) {
return;
}
@@ -414,10 +456,14 @@ void Histories::sendReadRequests() {
auto next = std::optional<crl::time>();
for (auto &[history, state] : _states) {
if (!state.willReadTill) {
DEBUG_LOG(("Reading: skipping zero till."));
continue;
} else if (state.willReadWhen <= now) {
DEBUG_LOG(("Reading: sending with till %1."
).arg(state.willReadTill));
sendReadRequest(history, state);
} else if (!next || *next > state.willReadWhen) {
DEBUG_LOG(("Reading: scheduling for later send."));
next = state.willReadWhen;
}
}
@@ -434,7 +480,11 @@ void Histories::sendReadRequest(not_null<History*> history, State &state) {
const auto tillId = state.sentReadTill = base::take(state.willReadTill);
state.willReadWhen = 0;
state.sentReadDone = false;
DEBUG_LOG(("Reading: sending request now with till %1."
).arg(tillId));
sendRequest(history, RequestType::ReadInbox, [=](Fn<void()> finish) {
DEBUG_LOG(("Reading: sending request invoked with till %1."
).arg(tillId));
const auto finished = [=] {
const auto state = lookup(history);
Assert(state != nullptr);

View File

@@ -770,7 +770,7 @@ int PeerData::slowmodeSecondsLeft() const {
bool PeerData::canSendPolls() const {
if (const auto user = asUser()) {
return user->isBot();
return user->isBot() && !user->isSupport();
} else if (const auto chat = asChat()) {
return chat->canSendPolls();
} else if (const auto channel = asChannel()) {

View File

@@ -1549,6 +1549,17 @@ void InnerWidget::repaintDialogRow(RowDescriptor row) {
updateDialogRow(row);
}
void InnerWidget::refreshDialogRow(RowDescriptor row) {
if (row.fullId) {
for (const auto &result : _searchResults) {
if (result->item()->fullId() == row.fullId) {
result->invalidateCache();
}
}
}
repaintDialogRow(row);
}
void InnerWidget::updateSearchResult(not_null<PeerData*> peer) {
if (_state == WidgetState::Filtered) {
if (!_peerSearchResults.empty()) {

View File

@@ -92,6 +92,7 @@ public:
void removeDialog(Key key);
void repaintDialogRow(FilterId filterId, not_null<Row*> row);
void repaintDialogRow(RowDescriptor row);
void refreshDialogRow(RowDescriptor row);
void dragLeft();

View File

@@ -121,6 +121,11 @@ public:
return _item;
}
void invalidateCache() {
_cacheFor = nullptr;
_cache = Ui::Text::String();
}
private:
friend class Layout::RowPainter;

View File

@@ -549,6 +549,10 @@ void Widget::repaintDialogRow(RowDescriptor row) {
_inner->repaintDialogRow(row);
}
void Widget::refreshDialogRow(RowDescriptor row) {
_inner->refreshDialogRow(row);
}
void Widget::jumpToTop() {
if (session().supportMode()) {
return;
@@ -674,7 +678,6 @@ void Widget::animationCallback() {
updateControlsVisibility(true);
applyFilterUpdate();
if (!_filter->hasFocus()) {
if (App::wnd()) App::wnd()->setInnerFocus();
}

View File

@@ -64,6 +64,7 @@ public:
void removeDialog(Key key);
void repaintDialogRow(FilterId filterId, not_null<Row*> row);
void repaintDialogRow(RowDescriptor row);
void refreshDialogRow(RowDescriptor row);
void jumpToTop();

View File

@@ -381,7 +381,9 @@ struct Data {
bool VoiceMsgPlaybackDoubled = false;
bool SoundNotify = true;
bool DesktopNotify = true;
bool FlashBounceNotify = true;
bool RestoreSoundNotifyFromTray = false;
bool RestoreFlashBounceNotifyFromTray = false;
DBINotifyView NotifyView = dbinvShowPreview;
bool NativeNotifications = false;
int NotificationsCount = 3;
@@ -508,7 +510,9 @@ DefineRefVar(Global, base::Observable<void>, DownloadPathChanged);
DefineVar(Global, bool, VoiceMsgPlaybackDoubled);
DefineVar(Global, bool, SoundNotify);
DefineVar(Global, bool, DesktopNotify);
DefineVar(Global, bool, FlashBounceNotify);
DefineVar(Global, bool, RestoreSoundNotifyFromTray);
DefineVar(Global, bool, RestoreFlashBounceNotifyFromTray);
DefineVar(Global, DBINotifyView, NotifyView);
DefineVar(Global, bool, NativeNotifications);
DefineVar(Global, int, NotificationsCount);

View File

@@ -210,7 +210,9 @@ DeclareRefVar(base::Observable<void>, DownloadPathChanged);
DeclareVar(bool, VoiceMsgPlaybackDoubled);
DeclareVar(bool, SoundNotify);
DeclareVar(bool, DesktopNotify);
DeclareVar(bool, FlashBounceNotify);
DeclareVar(bool, RestoreSoundNotifyFromTray);
DeclareVar(bool, RestoreFlashBounceNotifyFromTray);
DeclareVar(DBINotifyView, NotifyView);
DeclareVar(bool, NativeNotifications);
DeclareVar(int, NotificationsCount);

View File

@@ -478,7 +478,7 @@ void InnerWidget::updateEmptyText() {
options.flags |= TextParseMarkdown;
auto hasSearch = !_searchQuery.isEmpty();
auto hasFilter = (_filter.flags != 0) || !_filter.allUsers;
auto text = Ui::Text::Bold((hasSearch || hasFilter)
auto text = Ui::Text::Semibold((hasSearch || hasFilter)
? tr::lng_admin_log_no_results_title(tr::now)
: tr::lng_admin_log_no_events_title(tr::now));
auto description = hasSearch

View File

@@ -1622,6 +1622,9 @@ bool History::readInboxTillNeedsRequest(MsgId tillId) {
if (unreadMark()) {
owner().histories().changeDialogUnreadMark(this, false);
}
DEBUG_LOG(("Reading: readInboxTillNeedsRequest is_server %1, before %2."
).arg(Logs::b(IsServerMsgId(tillId))
).arg(_inboxReadBefore.value_or(-666)));
return IsServerMsgId(tillId) && (_inboxReadBefore.value_or(1) <= tillId);
}
@@ -1639,10 +1642,17 @@ bool History::unreadCountRefreshNeeded(MsgId readTillId) const {
std::optional<int> History::countStillUnreadLocal(MsgId readTillId) const {
if (isEmpty() || !folderKnown()) {
DEBUG_LOG(("Reading: countStillUnreadLocal unknown %1 and %2."
).arg(Logs::b(isEmpty())
).arg(Logs::b(folderKnown())));
return std::nullopt;
}
if (_inboxReadBefore) {
const auto before = *_inboxReadBefore;
DEBUG_LOG(("Reading: check before %1 with min %2 and max %3."
).arg(before
).arg(minMsgId()
).arg(maxMsgId()));
if (minMsgId() <= before && maxMsgId() >= readTillId) {
auto result = 0;
for (const auto &block : blocks) {
@@ -1658,12 +1668,19 @@ std::optional<int> History::countStillUnreadLocal(MsgId readTillId) const {
}
}
}
DEBUG_LOG(("Reading: check before result %1 with existing %2"
).arg(result
).arg(_unreadCount.value_or(-666)));
if (_unreadCount) {
return std::max(*_unreadCount - result, 0);
}
}
}
const auto minimalServerId = minMsgId();
DEBUG_LOG(("Reading: check at end loaded from %1 loaded %2 - %3"
).arg(minimalServerId
).arg(Logs::b(loadedAtBottom())
).arg(Logs::b(loadedAtTop())));
if (!loadedAtBottom()
|| (!loadedAtTop() && !minimalServerId)
|| minimalServerId > readTillId) {
@@ -1682,6 +1699,7 @@ std::optional<int> History::countStillUnreadLocal(MsgId readTillId) const {
}
}
}
DEBUG_LOG(("Reading: check at end counted %1").arg(result));
return result;
}

View File

@@ -267,7 +267,7 @@ PeerData *HistoryItem::displayFrom() const {
void HistoryItem::invalidateChatListEntry() {
if (const auto main = App::main()) {
// #TODO feeds search results
main->repaintDialogRow({ history(), fullId() });
main->refreshDialogRow({ history(), fullId() });
}
// invalidate cache for drawInDialog

View File

@@ -263,7 +263,7 @@ HistoryWidget::HistoryWidget(
, _scroll(this, st::historyScroll, false)
, _historyDown(_scroll, st::historyToDown)
, _unreadMentions(_scroll, st::historyUnreadMentions)
, _fieldAutocomplete(this, &session())
, _fieldAutocomplete(this, controller)
, _supportAutocomplete(session().supportMode()
? object_ptr<Support::Autocomplete>(this, &session())
: nullptr)
@@ -1433,8 +1433,7 @@ bool HistoryWidget::notify_switchInlineBotButtonReceived(const QString &query, U
if (_history) {
TextWithTags textWithTags = { '@' + samePeerBot->username + ' ' + query, TextWithTags::Tags() };
MessageCursor cursor = { textWithTags.text.size(), textWithTags.text.size(), QFIXED_MAX };
auto replyTo = _history->peer->isUser() ? 0 : samePeerReplyTo;
_history->setLocalDraft(std::make_unique<Data::Draft>(textWithTags, replyTo, cursor, false));
_history->setLocalDraft(std::make_unique<Data::Draft>(textWithTags, 0, cursor, false));
applyDraft();
return true;
}

View File

@@ -104,7 +104,9 @@ class HistoryWidget final
public:
using FieldHistoryAction = Ui::InputField::HistoryAction;
HistoryWidget(QWidget *parent, not_null<Window::SessionController*> controller);
HistoryWidget(
QWidget *parent,
not_null<Window::SessionController*> controller);
void start();

View File

@@ -1464,6 +1464,12 @@ int Message::plainMaxWidth() const {
+ st::msgPadding.right();
}
int Message::monospaceMaxWidth() const {
return st::msgPadding.left()
+ (hasVisibleText() ? message()->_text.countMaxMonospaceWidth() : 0)
+ st::msgPadding.right();
}
void Message::initLogEntryOriginal() {
if (const auto log = message()->Get<HistoryMessageLogEntryOriginal>()) {
AddComponents(LogEntryOriginal::Bit());
@@ -1787,7 +1793,7 @@ QRect Message::countGeometry() const {
// contentLeft += st::msgPhotoSkip - (hmaxwidth - hwidth);
}
accumulate_min(contentWidth, maxWidth());
accumulate_min(contentWidth, st::msgMaxWidth);
accumulate_min(contentWidth, _bubbleWidthLimit);
if (mediaWidth < contentWidth) {
const auto textualWidth = plainMaxWidth();
if (mediaWidth < textualWidth
@@ -1829,7 +1835,8 @@ int Message::resizeContentGetHeight(int newWidth) {
contentWidth -= st::msgPhotoSkip;
}
accumulate_min(contentWidth, maxWidth());
accumulate_min(contentWidth, st::msgMaxWidth);
_bubbleWidthLimit = std::max(st::msgMaxWidth, monospaceMaxWidth());
accumulate_min(contentWidth, _bubbleWidthLimit);
if (mediaDisplayed) {
media->resizeGetHeight(contentWidth);
if (media->width() < contentWidth) {

View File

@@ -157,8 +157,9 @@ private:
const HistoryMessageEdited *displayedEditBadge() const;
HistoryMessageEdited *displayedEditBadge();
void initTime();
int timeLeft() const;
int plainMaxWidth() const;
[[nodiscard]] int timeLeft() const;
[[nodiscard]] int plainMaxWidth() const;
[[nodiscard]] int monospaceMaxWidth() const;
WebPage *logEntryOriginal() const;
@@ -167,6 +168,7 @@ private:
mutable ClickHandlerPtr _rightActionLink;
mutable ClickHandlerPtr _fastReplyLink;
int _bubbleWidthLimit = 0;
};

View File

@@ -53,7 +53,7 @@ namespace {
auto link = Ui::Text::Link(
tr::lng_about_random_send(tr::now).toUpper());
link.entities.push_back(
EntityInText(EntityType::Bold, 0, link.text.size()));
EntityInText(EntityType::Semibold, 0, link.text.size()));
config.text.append(' ').append(std::move(link));
config.filter = crl::guard(&history->session(), [=](
const ClickHandlerPtr &handler,

View File

@@ -269,7 +269,7 @@ void QrWidget::setupControls() {
st::introQrStepMargins);
const auto number = Ui::CreateChild<Ui::FlatLabel>(
steps,
rpl::single(Ui::Text::Bold(QString::number(++index) + ".")),
rpl::single(Ui::Text::Semibold(QString::number(++index) + ".")),
st::defaultFlatLabel);
rpl::combine(
number->widthValue(),

View File

@@ -21,6 +21,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/effects/slide_animation.h"
#include "data/data_user.h"
#include "data/data_auto_download.h"
#include "window/window_controller.h"
#include "window/themes/window_theme.h"
#include "facades.h"
#include "app.h"
@@ -39,6 +40,7 @@ void PrepareSupportMode() {
Global::SetDesktopNotify(false);
Global::SetSoundNotify(false);
Global::SetFlashBounceNotify(false);
Auth().settings().autoDownload() = Full::FullDisabled();
Local::writeUserSettings();
}
@@ -140,7 +142,7 @@ void Step::finish(const MTPUser &user, QImage &&photo) {
const auto weak = base::make_weak(account.get());
account->createSession(user);
Local::writeMtpData();
App::wnd()->setupMain();
App::wnd()->controller().setupMain();
// "this" is already deleted here by creating the main widget.
if (weak && account->sessionExists()) {

View File

@@ -2190,6 +2190,10 @@ void MainWidget::repaintDialogRow(Dialogs::RowDescriptor row) {
_dialogs->repaintDialogRow(row);
}
void MainWidget::refreshDialogRow(Dialogs::RowDescriptor row) {
_dialogs->refreshDialogRow(row);
}
void MainWidget::windowShown() {
_history->windowShown();
}

View File

@@ -137,6 +137,7 @@ public:
void removeDialog(Dialogs::Key key);
void repaintDialogRow(FilterId filterId, not_null<Dialogs::Row*> row);
void repaintDialogRow(Dialogs::RowDescriptor row);
void refreshDialogRow(Dialogs::RowDescriptor row);
void windowShown();

View File

@@ -757,7 +757,8 @@ void MainWindow::toggleDisplayNotifyFromTray() {
return;
}
bool soundNotifyChanged = false;
auto soundNotifyChanged = false;
auto flashBounceNotifyChanged = false;
Global::SetDesktopNotify(!Global::DesktopNotify());
if (Global::DesktopNotify()) {
if (Global::RestoreSoundNotifyFromTray() && !Global::SoundNotify()) {
@@ -765,6 +766,12 @@ void MainWindow::toggleDisplayNotifyFromTray() {
Global::SetRestoreSoundNotifyFromTray(false);
soundNotifyChanged = true;
}
if (Global::RestoreFlashBounceNotifyFromTray()
&& !Global::FlashBounceNotify()) {
Global::SetFlashBounceNotify(true);
Global::SetRestoreFlashBounceNotifyFromTray(false);
flashBounceNotifyChanged = true;
}
} else {
if (Global::SoundNotify()) {
Global::SetSoundNotify(false);
@@ -773,13 +780,23 @@ void MainWindow::toggleDisplayNotifyFromTray() {
} else {
Global::SetRestoreSoundNotifyFromTray(false);
}
if (Global::FlashBounceNotify()) {
Global::SetFlashBounceNotify(false);
Global::SetRestoreFlashBounceNotifyFromTray(true);
flashBounceNotifyChanged = true;
} else {
Global::SetRestoreFlashBounceNotifyFromTray(false);
}
}
Local::writeUserSettings();
account().session().notifications().settingsChanged().notify(
Window::Notifications::ChangeType::DesktopEnabled);
using Change = Window::Notifications::ChangeType;
auto &changes = account().session().notifications().settingsChanged();
changes.notify(Change::DesktopEnabled);
if (soundNotifyChanged) {
account().session().notifications().settingsChanged().notify(
Window::Notifications::ChangeType::SoundEnabled);
changes.notify(Change::SoundEnabled);
}
if (flashBounceNotifyChanged) {
changes.notify(Change::FlashBounceEnabled);
}
}

View File

@@ -62,13 +62,13 @@ Instance::Instance() : _inner(new Inner(&_thread)) {
void Instance::check() {
_available = false;
if (auto device = alcCaptureOpenDevice(nullptr, kCaptureFrequency, AL_FORMAT_MONO16, kCaptureFrequency / 5)) {
auto error = ErrorHappened(device);
alcCaptureCloseDevice(device);
_available = !error;
} else {
LOG(("Audio Error: Could not open capture device!"));
if (auto device = alcGetString(0, ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER)) {
if (!QString::fromLocal8Bit(device).isEmpty()) {
_available = true;
return;
}
}
LOG(("Audio Error: No capture device found!"));
}
Instance::~Instance() {

View File

@@ -544,7 +544,7 @@ void Widget::handleSongChange() {
textWithEntities.text = name + ' ' + date();
textWithEntities.entities.append(EntityInText(
EntityType::Bold,
EntityType::Semibold,
0,
name.size(),
QString()));
@@ -565,7 +565,12 @@ void Widget::handleSongChange() {
: TextUtilities::Clean(song->title);
auto dash = QString::fromUtf8(" \xe2\x80\x93 ");
textWithEntities.text = song->performer + dash + title;
textWithEntities.entities.append({ EntityType::Bold, 0, song->performer.size(), QString() });
textWithEntities.entities.append({
EntityType::Semibold,
0,
song->performer.size(),
QString()
});
}
}
_nameLabel->setMarkedText(textWithEntities);

View File

@@ -37,8 +37,8 @@ public:
void process(std::vector<FFmpeg::Packet> &&packets);
[[nodisacrd]] rpl::producer<> checkNextFrame() const;
[[nodisacrd]] rpl::producer<> waitingForData() const;
[[nodiscard]] rpl::producer<> checkNextFrame() const;
[[nodiscard]] rpl::producer<> waitingForData() const;
void pause(crl::time time);
void resume(crl::time time);

View File

@@ -40,6 +40,7 @@ constexpr auto kTestModeDcIdShift = 10000;
constexpr auto kCheckSentRequestsEach = 1 * crl::time(1000);
constexpr auto kKeyOldEnoughForDestroy = 60 * crl::time(1000);
constexpr auto kSentContainerLives = 600 * crl::time(1000);
constexpr auto kFastRequestDuration = crl::time(500);
// If we can't connect for this time we will ask _instance to update config.
constexpr auto kRequestConfigTimeout = 8 * crl::time(1000);
@@ -57,6 +58,8 @@ constexpr auto kSendStateRequestWaiting = crl::time(1000);
// How much time to wait for some more requests, when sending msg acks.
constexpr auto kAckSendWaiting = 10 * crl::time(1000);
auto SyncTimeRequestDuration = kFastRequestDuration;
using namespace details;
[[nodiscard]] QString LogIdsVector(const QVector<MTPlong> &ids) {
@@ -1467,8 +1470,12 @@ SessionPrivate::HandleResult SessionPrivate::handleOneReceived(
return badTime ? HandleResult::Ignored : HandleResult::Success;
}
if (badTime && !requestsFixTimeSalt(ids, serverTime, serverSalt)) {
return HandleResult::Ignored;
if (badTime) {
if (!requestsFixTimeSalt(ids, serverTime, serverSalt)) {
return HandleResult::Ignored;
}
} else {
correctUnixtimeByFastRequest(ids, serverTime);
}
requestsAcked(ids);
} return HandleResult::Success;
@@ -1520,7 +1527,8 @@ SessionPrivate::HandleResult SessionPrivate::handleOneReceived(
if (serverSalt) {
_sessionSalt = serverSalt;
}
base::unixtime::update(serverTime, true);
correctUnixtimeWithBadLocal(serverTime);
DEBUG_LOG(("Message Info: unixtime updated, now %1, resending in container...").arg(serverTime));
@@ -1530,7 +1538,7 @@ SessionPrivate::HandleResult SessionPrivate::handleOneReceived(
if (serverSalt) {
_sessionSalt = serverSalt;
}
base::unixtime::update(serverTime, true);
correctUnixtimeWithBadLocal(serverTime);
badTime = false;
}
LOG(("Message Info: bad message notification received, msgId %1, error_code %2").arg(data.vbad_msg_id().v).arg(errorCode));
@@ -1580,7 +1588,7 @@ SessionPrivate::HandleResult SessionPrivate::handleOneReceived(
}
_sessionSalt = data.vnew_server_salt().v;
base::unixtime::update(serverTime);
correctUnixtimeWithBadLocal(serverTime);
if (setState(ConnectedState, ConnectingState)) {
resendAll();
@@ -1612,7 +1620,7 @@ SessionPrivate::HandleResult SessionPrivate::handleOneReceived(
if (serverSalt) {
_sessionSalt = serverSalt; // requestsFixTimeSalt with no lookup
}
base::unixtime::update(serverTime, true);
correctUnixtimeWithBadLocal(serverTime);
DEBUG_LOG(("Message Info: unixtime updated from mtpc_msgs_state_info, now %1").arg(serverTime));
@@ -1956,20 +1964,48 @@ mtpBuffer SessionPrivate::ungzip(const mtpPrime *from, const mtpPrime *end) cons
}
bool SessionPrivate::requestsFixTimeSalt(const QVector<MTPlong> &ids, int32 serverTime, uint64 serverSalt) {
uint32 idsCount = ids.size();
for (uint32 i = 0; i < idsCount; ++i) {
if (wasSent(ids[i].v)) {// found such msg_id in recent acked requests or in recent sent requests
for (const auto &id : ids) {
if (wasSent(id.v)) {
// Found such msg_id in recent acked or in recent sent requests.
if (serverSalt) {
_sessionSalt = serverSalt;
}
base::unixtime::update(serverTime, true);
correctUnixtimeWithBadLocal(serverTime);
return true;
}
}
return false;
}
void SessionPrivate::correctUnixtimeByFastRequest(
const QVector<MTPlong> &ids,
TimeId serverTime) {
const auto now = crl::now();
QReadLocker locker(_sessionData->haveSentMutex());
const auto &haveSent = _sessionData->haveSentMap();
for (const auto &id : ids) {
const auto i = haveSent.find(id.v);
if (i == haveSent.end()) {
continue;
}
const auto duration = (now - i->second->lastSentTime);
if (duration < 0 || duration > SyncTimeRequestDuration) {
continue;
}
locker.unlock();
SyncTimeRequestDuration = duration;
base::unixtime::update(serverTime, true);
return;
}
}
void SessionPrivate::correctUnixtimeWithBadLocal(TimeId serverTime) {
SyncTimeRequestDuration = kFastRequestDuration;
base::unixtime::update(serverTime, true);
}
void SessionPrivate::requestsAcked(const QVector<MTPlong> &ids, bool byResponse) {
uint32 idsCount = ids.size();

View File

@@ -139,6 +139,12 @@ private:
// if badTime received - search for ids in sessionData->haveSent and sessionData->wereAcked and sync time/salt, return true if found
bool requestsFixTimeSalt(const QVector<MTPlong> &ids, int32 serverTime, uint64 serverSalt);
// if we had a confirmed fast request use its unixtime as a correct one.
void correctUnixtimeByFastRequest(
const QVector<MTPlong> &ids,
TimeId serverTime);
void correctUnixtimeWithBadLocal(TimeId serverTime);
// remove msgs with such ids from sessionData->haveSent, add to sessionData->wereAcked
void requestsAcked(const QVector<MTPlong> &ids, bool byResponse = false);

View File

@@ -55,13 +55,27 @@ TextWithEntities ComposeNameWithEntities(DocumentData *document) {
result.text = document->filename().isEmpty()
? qsl("Unknown File")
: document->filename();
result.entities.push_back({ EntityType::Bold, 0, result.text.size() });
result.entities.push_back({
EntityType::Semibold,
0,
result.text.size()
});
} else if (song->performer.isEmpty()) {
result.text = song->title;
result.entities.push_back({ EntityType::Bold, 0, result.text.size() });
result.entities.push_back({
EntityType::Semibold,
0,
result.text.size()
});
} else {
result.text = song->performer + QString::fromUtf8(" \xe2\x80\x93 ") + (song->title.isEmpty() ? qsl("Unknown Track") : song->title);
result.entities.push_back({ EntityType::Bold, 0, song->performer.size() });
result.text = song->performer
+ QString::fromUtf8(" \xe2\x80\x93 ")
+ (song->title.isEmpty() ? qsl("Unknown Track") : song->title);
result.entities.push_back({
EntityType::Semibold,
0,
song->performer.size()
});
}
return result;
}

View File

@@ -457,15 +457,11 @@ bool SkipAudio() {
}
bool SkipToast() {
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION
if (Supported()
&& GetCapabilities().contains(qsl("inhibitions"))
&& !InhibitedNotSupported) {
return Inhibited();
}
#endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION
return SkipAudio();
}
return false;
bool SkipFlashBounce() {
return SkipAudio();
}
bool Supported() {

View File

@@ -19,9 +19,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
namespace Platform {
namespace Notifications {
inline void FlashBounce() {
}
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION
class NotificationData : public QObject {
Q_OBJECT

View File

@@ -623,10 +623,6 @@ namespace Platform {
void start() {
LOG(("Launcher filename: %1").arg(GetLauncherFilename()));
if (InAppImage()) {
qputenv("LIBGL_ALWAYS_INDIRECT", "1");
}
#ifdef TDESKTOP_USE_FONTCONFIG_FALLBACK
FallbackFontConfig();
#endif // TDESKTOP_USE_FONTCONFIG_FALLBACK

View File

@@ -13,9 +13,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
namespace Platform {
namespace Notifications {
bool SkipAudio();
bool SkipToast();
class Manager : public Window::Notifications::NativeManager, public base::has_weak_ptr {
public:
Manager(Window::Notifications::System *system);

View File

@@ -143,6 +143,10 @@ bool SkipToast() {
return DoNotDisturbEnabled;
}
bool SkipFlashBounce() {
return SkipAudio();
}
bool Supported() {
return Platform::IsMac10_8OrGreater();
}
@@ -154,10 +158,6 @@ std::unique_ptr<Window::Notifications::Manager> Create(Window::Notifications::Sy
return nullptr;
}
void FlashBounce() {
[NSApp requestUserAttention:NSInformationalRequest];
}
class Manager::Private : public QObject, private base::Subscriber {
public:
Private(Manager *manager);

View File

@@ -12,12 +12,13 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
namespace Platform {
namespace Notifications {
bool SkipAudio();
bool SkipToast();
[[nodiscard]] bool SkipAudio();
[[nodiscard]] bool SkipToast();
[[nodiscard]] bool SkipFlashBounce();
bool Supported();
std::unique_ptr<Window::Notifications::Manager> Create(Window::Notifications::System *system);
void FlashBounce();
[[nodiscard]] bool Supported();
[[nodiscard]] std::unique_ptr<Window::Notifications::Manager> Create(
Window::Notifications::System *system);
} // namespace Notifications
} // namespace Platform

View File

@@ -10,6 +10,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "platform/win/windows_dlls.h"
#include "media/audio/media_audio.h"
#include <initguid.h>
#include <mmdeviceapi.h>
#include <audioclient.h>

View File

@@ -117,7 +117,13 @@ void UnsafeOpenEmailLink(const QString &email) {
auto wstringUrl = url.toString(QUrl::FullyEncoded).toStdWString();
if (Dlls::SHOpenWithDialog) {
OPENASINFO info;
info.oaifInFlags = OAIF_ALLOW_REGISTRATION | OAIF_REGISTER_EXT | OAIF_EXEC | OAIF_FILE_IS_URI | OAIF_URL_PROTOCOL;
info.oaifInFlags = OAIF_ALLOW_REGISTRATION
| OAIF_REGISTER_EXT
| OAIF_EXEC
#if WINVER >= 0x0602
| OAIF_FILE_IS_URI
#endif // WINVER >= 0x602
| OAIF_URL_PROTOCOL;
info.pcszClass = NULL;
info.pcszFile = wstringUrl.c_str();
Dlls::SHOpenWithDialog(0, &info);

View File

@@ -35,8 +35,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include <roapi.h>
#include <wrl/client.h>
#include "platform/win/wrapper_wrl_implements_h.h"
#include <windows.ui.notifications.h>
#include <Windowsx.h>
#include <VersionHelpers.h>
@@ -47,10 +45,28 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#undef min
#undef max
// WM_POINTER support from Windows 8 onwards (WINVER >= 0x0602)
#ifndef WM_POINTERUPDATE
# define WM_NCPOINTERUPDATE 0x0241
# define WM_NCPOINTERDOWN 0x0242
# define WM_NCPOINTERUP 0x0243
# define WM_POINTERUPDATE 0x0245
# define WM_POINTERDOWN 0x0246
# define WM_POINTERUP 0x0247
# define WM_POINTERENTER 0x0249
# define WM_POINTERLEAVE 0x024A
# define WM_POINTERACTIVATE 0x024B
# define WM_POINTERCAPTURECHANGED 0x024C
# define WM_POINTERWHEEL 0x024E
# define WM_POINTERHWHEEL 0x024F
#endif // WM_POINTERUPDATE
HICON qt_pixmapToWinHICON(const QPixmap &);
using namespace Microsoft::WRL;
Q_DECLARE_METATYPE(QMargins);
namespace Platform {
namespace {
@@ -226,7 +242,7 @@ public:
destroy();
return false;
}
SetWindowLong(hwnds[i], GWL_HWNDPARENT, (LONG)hwnd);
SetWindowLongPtr(hwnds[i], GWLP_HWNDPARENT, (LONG)hwnd);
dcs[i] = CreateCompatibleDC(screenDC);
if (!dcs[i]) {
@@ -712,18 +728,18 @@ void MainWindow::workmodeUpdated(DBIWorkMode mode) {
switch (mode) {
case dbiwmWindowAndTray: {
psSetupTrayIcon();
HWND psOwner = (HWND)GetWindowLong(ps_hWnd, GWL_HWNDPARENT);
HWND psOwner = (HWND)GetWindowLongPtr(ps_hWnd, GWLP_HWNDPARENT);
if (psOwner) {
SetWindowLong(ps_hWnd, GWL_HWNDPARENT, 0);
SetWindowLongPtr(ps_hWnd, GWLP_HWNDPARENT, 0);
psRefreshTaskbarIcon();
}
} break;
case dbiwmTrayOnly: {
psSetupTrayIcon();
HWND psOwner = (HWND)GetWindowLong(ps_hWnd, GWL_HWNDPARENT);
HWND psOwner = (HWND)GetWindowLongPtr(ps_hWnd, GWLP_HWNDPARENT);
if (!psOwner) {
SetWindowLong(ps_hWnd, GWL_HWNDPARENT, (LONG)ps_tbHider_hWnd);
SetWindowLongPtr(ps_hWnd, GWLP_HWNDPARENT, (LONG)ps_tbHider_hWnd);
}
} break;
@@ -734,9 +750,9 @@ void MainWindow::workmodeUpdated(DBIWorkMode mode) {
}
trayIcon = 0;
HWND psOwner = (HWND)GetWindowLong(ps_hWnd, GWL_HWNDPARENT);
HWND psOwner = (HWND)GetWindowLongPtr(ps_hWnd, GWLP_HWNDPARENT);
if (psOwner) {
SetWindowLong(ps_hWnd, GWL_HWNDPARENT, 0);
SetWindowLongPtr(ps_hWnd, GWLP_HWNDPARENT, 0);
psRefreshTaskbarIcon();
}
} break;
@@ -874,7 +890,6 @@ void MainWindow::updateSystemMenu(Qt::WindowState state) {
}
}
Q_DECLARE_METATYPE(QMargins);
void MainWindow::psUpdateMargins() {
if (!ps_hWnd || _inUpdateMargins) return;
@@ -885,7 +900,7 @@ void MainWindow::psUpdateMargins() {
GetClientRect(ps_hWnd, &r);
a = r;
LONG style = GetWindowLong(ps_hWnd, GWL_STYLE), styleEx = GetWindowLong(ps_hWnd, GWL_EXSTYLE);
LONG style = GetWindowLongPtr(ps_hWnd, GWL_STYLE), styleEx = GetWindowLongPtr(ps_hWnd, GWL_EXSTYLE);
AdjustWindowRectEx(&a, style, false, styleEx);
QMargins margins = QMargins(a.left - r.left, a.top - r.top, r.right - a.right, r.bottom - a.bottom);
if (style & WS_MAXIMIZE) {

View File

@@ -20,6 +20,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include <roapi.h>
#include <wrl/client.h>
#ifndef __MINGW32__
#include "platform/win/wrapper_wrl_implements_h.h"
#include <windows.ui.notifications.h>
@@ -32,9 +34,12 @@ using namespace Microsoft::WRL;
using namespace ABI::Windows::UI::Notifications;
using namespace ABI::Windows::Data::Xml::Dom;
using namespace Windows::Foundation;
#endif // !__MINGW32__
namespace Platform {
namespace Notifications {
#ifndef __MINGW32__
namespace {
class StringReferenceWrapper {
@@ -302,40 +307,33 @@ void Check() {
}
} // namespace
#endif // !__MINGW32__
bool Supported() {
#ifndef __MINGW32__
if (!Checked) {
Checked = true;
Check();
}
return InitSucceeded;
#endif // !__MINGW32__
return false;
}
std::unique_ptr<Window::Notifications::Manager> Create(Window::Notifications::System *system) {
#ifndef __MINGW32__
if (Global::NativeNotifications() && Supported()) {
auto result = std::make_unique<Manager>(system);
if (result->init()) {
return std::move(result);
}
}
#endif // !__MINGW32__
return nullptr;
}
void FlashBounce() {
auto window = App::wnd();
if (!window || GetForegroundWindow() == window->psHwnd()) {
return;
}
FLASHWINFO info;
info.cbSize = sizeof(info);
info.hwnd = window->psHwnd();
info.dwFlags = FLASHW_ALL;
info.dwTimeout = 0;
info.uCount = 1;
FlashWindowEx(&info);
}
#ifndef __MINGW32__
class Manager::Private {
public:
using Type = Window::Notifications::CachedUserpics::Type;
@@ -612,6 +610,7 @@ void Manager::onBeforeNotificationActivated(PeerId peerId, MsgId msgId) {
void Manager::onAfterNotificationActivated(PeerId peerId, MsgId msgId) {
_private->afterNotificationActivated(peerId, msgId);
}
#endif // !__MINGW32__
namespace {
@@ -723,5 +722,9 @@ bool SkipToast() {
return false;
}
bool SkipFlashBounce() {
return SkipToast();
}
} // namespace Notifications
} // namespace Platform

View File

@@ -12,6 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
namespace Platform {
namespace Notifications {
#ifndef __MINGW32__
class Manager : public Window::Notifications::NativeManager {
public:
Manager(Window::Notifications::System *system);
@@ -41,6 +42,7 @@ private:
const std::unique_ptr<Private> _private;
};
#endif // !__MINGW32__
} // namespace Notifications
} // namespace Platform

View File

@@ -29,8 +29,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include <roapi.h>
#include <wrl/client.h>
#include "platform/win/wrapper_wrl_implements_h.h"
#include <windows.ui.notifications.h>
#include <openssl/conf.h>
#include <openssl/engine.h>
@@ -65,9 +63,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#endif
using namespace Microsoft::WRL;
using namespace ABI::Windows::UI::Notifications;
using namespace ABI::Windows::Data::Xml::Dom;
using namespace Windows::Foundation;
using namespace Platform;
namespace {
@@ -435,7 +430,7 @@ namespace {
WCHAR defaultStr[bufSize] = { 0 };
if (RegQueryValueEx(rkey, value, 0, &defaultType, (BYTE*)defaultStr, &defaultSize) != ERROR_SUCCESS || defaultType != REG_SZ || defaultSize != (v.size() + 1) * 2 || QString::fromStdWString(defaultStr) != v) {
WCHAR tmp[bufSize] = { 0 };
if (!v.isEmpty()) wsprintf(tmp, v.replace(QChar('%'), qsl("%%")).toStdWString().c_str());
if (!v.isEmpty()) StringCbPrintf(tmp, bufSize, v.replace(QChar('%'), qsl("%%")).toStdWString().c_str());
LSTATUS status = RegSetValueEx(rkey, value, 0, REG_SZ, (BYTE*)tmp, (wcslen(tmp) + 1) * sizeof(WCHAR));
if (status != ERROR_SUCCESS) {
QString msg = qsl("App Error: could not set %1, error %2").arg(value ? ('\'' + QString::fromStdWString(value) + '\'') : qsl("(Default)")).arg("%1: %2");

View File

@@ -13,8 +13,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include <roapi.h>
#include <wrl/client.h>
#include "platform/win/wrapper_wrl_implements_h.h"
#include <windows.ui.notifications.h>
using namespace Microsoft::WRL;
@@ -288,6 +286,7 @@ bool validateShortcut() {
PropVariantClear(&appIdPropVar);
if (!SUCCEEDED(hr)) return false;
#if WINVER >= 0x602
PROPVARIANT startPinPropVar;
hr = InitPropVariantFromUInt32(APPUSERMODEL_STARTPINOPTION_NOPINONINSTALL, &startPinPropVar);
if (!SUCCEEDED(hr)) return false;
@@ -295,6 +294,7 @@ bool validateShortcut() {
hr = propertyStore->SetValue(pkey_AppUserModel_StartPinOption, startPinPropVar);
PropVariantClear(&startPinPropVar);
if (!SUCCEEDED(hr)) return false;
#endif // WINVER >= 0x602
hr = propertyStore->Commit();
if (!SUCCEEDED(hr)) return false;

View File

@@ -15,6 +15,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include <RestartManager.h>
#include <psapi.h>
#ifdef __MINGW32__
#define __in
#endif
namespace Platform {
namespace Dlls {

View File

@@ -191,7 +191,7 @@ bool EventFilter::mainWindowEvent(
} return false;
case WM_SHOWWINDOW: {
LONG style = GetWindowLong(hWnd, GWL_STYLE);
LONG style = GetWindowLongPtr(hWnd, GWL_STYLE);
auto changes = ShadowsChange::Resized | ((wParam && !(style & (WS_MAXIMIZE | WS_MINIMIZE))) ? ShadowsChange::Shown : ShadowsChange::Hidden);
_window->shadowsUpdate(changes);
} return false;

View File

@@ -39,6 +39,7 @@ bool gStartInTray = false;
bool gAutoStart = false;
bool gSendToMenu = false;
bool gUseExternalVideoPlayer = false;
bool gUseFreeType = false;
bool gAutoUpdate = true;
TWindowPos gWindowPos;
LaunchMode gLaunchMode = LaunchModeNormal;

View File

@@ -42,6 +42,7 @@ DeclareSetting(bool, StartMinimized);
DeclareSetting(bool, StartInTray);
DeclareSetting(bool, SendToMenu);
DeclareSetting(bool, UseExternalVideoPlayer);
DeclareSetting(bool, UseFreeType);
enum LaunchMode {
LaunchModeNormal = 0,
LaunchModeAutoStart,

View File

@@ -126,6 +126,21 @@ auto GenerateCodes() {
codes.emplace(qsl("export"), [](SessionController *window) {
window->session().data().startExport();
});
#if defined Q_OS_WIN || defined Q_OS_MAC
codes.emplace(qsl("freetype"), [](SessionController *window) {
auto text = cUseFreeType()
#ifdef Q_OS_WIN
? qsl("Switch font engine to GDI?")
#else // Q_OS_WIN
? qsl("Switch font engine to Cocoa?")
#endif // !Q_OS_WIN
: qsl("Switch font engine to FreeType?");
Ui::show(Box<ConfirmBox>(text, [] {
Core::App().switchFreeType();
}));
});
#endif // Q_OS_WIN || Q_OS_MAC
auto audioFilters = qsl("Audio files (*.wav *.mp3);;") + FileDialog::AllFilesFilter();
auto audioKeys = {

View File

@@ -568,6 +568,13 @@ void SetupNotificationsContent(
const auto sound = addCheckbox(
tr::lng_settings_sound_notify(tr::now),
Global::SoundNotify());
const auto flashbounce = addCheckbox(
(Platform::IsWindows()
? tr::lng_settings_alert_windows
: Platform::IsMac()
? tr::lng_settings_alert_mac
: tr::lng_settings_alert_linux)(tr::now),
Global::FlashBounceNotify());
AddSkip(container, st::settingsCheckboxesSkip);
AddDivider(container);
@@ -714,6 +721,14 @@ void SetupNotificationsContent(
changed(Change::SoundEnabled);
}, sound->lifetime());
flashbounce->checkedChanges(
) | rpl::filter([](bool checked) {
return (checked != Global::FlashBounceNotify());
}) | rpl::start_with_next([=](bool checked) {
Global::SetFlashBounceNotify(checked);
changed(Change::FlashBounceEnabled);
}, flashbounce->lifetime());
muted->checkedChanges(
) | rpl::filter([=](bool checked) {
return (checked != session->settings().includeMutedCounter());
@@ -743,6 +758,8 @@ void SetupNotificationsContent(
preview->toggle(name->entity()->checked(), anim::type::normal);
} else if (change == Change::SoundEnabled) {
sound->setChecked(Global::SoundNotify());
} else if (change == Change::FlashBounceEnabled) {
flashbounce->setChecked(Global::FlashBounceNotify());
}
}, desktop->lifetime());

View File

@@ -649,7 +649,7 @@ enum {
dbiSendKeyOld = 0x05,
dbiAutoStart = 0x06,
dbiStartMinimized = 0x07,
dbiSoundNotify = 0x08,
dbiSoundFlashBounceNotify = 0x08,
dbiWorkMode = 0x09,
dbiSeenTrayTooltip = 0x0a,
dbiDesktopNotify = 0x0b,
@@ -1189,12 +1189,13 @@ bool _readSetting(quint32 blockId, QDataStream &stream, int version, ReadSetting
anim::SetDisabled(disabled == 1);
} break;
case dbiSoundNotify: {
case dbiSoundFlashBounceNotify: {
qint32 v;
stream >> v;
if (!_checkStreamStatus(stream)) return false;
Global::SetSoundNotify(v == 1);
Global::SetSoundNotify((v & 0x01) == 0x01);
Global::SetFlashBounceNotify((v & 0x02) == 0x00);
} break;
case dbiAutoDownloadOld: {
@@ -2202,6 +2203,9 @@ void _writeUserSettings() {
}
size += sizeof(quint32) + Serialize::bytearraySize(callSettings);
const auto soundFlashBounce = (Global::SoundNotify() ? 0x01 : 0x00)
| (Global::FlashBounceNotify() ? 0x00 : 0x02);
EncryptedDescriptor data(size);
data.stream
<< quint32(dbiTileBackground)
@@ -2209,7 +2213,7 @@ void _writeUserSettings() {
<< qint32(Window::Theme::Background()->tileNight() ? 1 : 0);
data.stream << quint32(dbiAdaptiveForWide) << qint32(Global::AdaptiveForWide() ? 1 : 0);
data.stream << quint32(dbiAutoLock) << qint32(Global::AutoLock());
data.stream << quint32(dbiSoundNotify) << qint32(Global::SoundNotify());
data.stream << quint32(dbiSoundFlashBounceNotify) << qint32(soundFlashBounce);
data.stream << quint32(dbiDesktopNotify) << qint32(Global::DesktopNotify());
data.stream << quint32(dbiNotifyView) << qint32(Global::NotifyView());
data.stream << quint32(dbiNativeNotifications) << qint32(Global::NativeNotifications());

View File

@@ -40,9 +40,9 @@ bool ExtractZipFile(zlib::FileToRead &zip, const QString path) {
} // namespace
bool UnpackBlob(
const QString &path,
const QString &folder,
Fn<bool(const QString &)> checkNameCallback) {
const QString &path,
const QString &folder,
Fn<bool(const QString &)> checkNameCallback) {
const auto bytes = ReadFinalFile(path);
if (bytes.isEmpty()) {
return false;

View File

@@ -27,6 +27,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "facades.h"
#include "app.h"
#include <QtGui/QWindow>
namespace Window {
namespace Notifications {
namespace {
@@ -290,7 +292,14 @@ void System::showNext() {
}
}
if (alert) {
Platform::Notifications::FlashBounce();
if (Global::FlashBounceNotify() && !Platform::Notifications::SkipFlashBounce()) {
if (const auto widget = App::wnd()) {
if (const auto window = widget->windowHandle()) {
window->alert(0);
// (window, SLOT(_q_clearAlert())); in the future.
}
}
}
if (Global::SoundNotify() && !Platform::Notifications::SkipAudio()) {
ensureSoundCreated();
_soundTrack->playOnce();

View File

@@ -32,6 +32,7 @@ namespace Notifications {
enum class ChangeType {
SoundEnabled,
FlashBounceEnabled,
IncludeMuted,
CountMessages,
DesktopEnabled,

View File

@@ -43,7 +43,7 @@ struct ParsedTheme {
const QByteArray &value);
[[nodiscard]] QByteArray WriteCloudToText(const Data::CloudTheme &cloud);
[[nodiscard]] Data::CloudTheme ReadCloudFromText(const QByteArray &text);
[[nodisacrd]] QByteArray StripCloudTextFields(const QByteArray &text);
[[nodiscard]] QByteArray StripCloudTextFields(const QByteArray &text);
class Editor : public TWidget {
public:

View File

@@ -13,6 +13,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/layers/box_content.h"
#include "ui/layers/layer_widget.h"
#include "ui/toast/toast.h"
#include "ui/emoji_config.h"
#include "chat_helpers/emoji_sets_manager.h"
#include "window/window_session_controller.h"
#include "window/themes/window_theme.h"
#include "window/themes/window_theme_editor.h"
@@ -82,6 +84,10 @@ void Controller::setupIntro() {
void Controller::setupMain() {
_widget.setupMain();
if (const auto id = Ui::Emoji::NeedToSwitchBackToId()) {
Ui::Emoji::LoadAndSwitchTo(id);
}
}
void Controller::showSettings() {

View File

@@ -242,6 +242,9 @@ bool SessionController::uniqueChatsInSearchResults() const {
}
void SessionController::openFolder(not_null<Data::Folder*> folder) {
if (_openedFolder.current() != folder) {
resetFakeUnreadWhileOpened();
}
setActiveChatsFilter(0);
_openedFolder = folder.get();
}
@@ -269,6 +272,12 @@ void SessionController::setActiveChatEntry(Dialogs::RowDescriptor row) {
}
}
void SessionController::resetFakeUnreadWhileOpened() {
if (const auto history = _activeChatEntry.current().key.history()) {
history->setFakeUnreadWhileOpened(false);
}
}
bool SessionController::chatEntryHistoryMove(int steps) {
if (_chatEntryHistory.empty()) {
return false;
@@ -781,6 +790,9 @@ FilterId SessionController::activeChatsFilterCurrent() const {
}
void SessionController::setActiveChatsFilter(FilterId id) {
if (activeChatsFilterCurrent() != id) {
resetFakeUnreadWhileOpened();
}
_activeChatsFilter.force_assign(id);
if (id) {
closeFolder();

View File

@@ -328,6 +328,7 @@ private:
void pushToChatEntryHistory(Dialogs::RowDescriptor row);
bool chatEntryHistoryMove(int steps);
void resetFakeUnreadWhileOpened();
const not_null<Controller*> _window;

View File

@@ -13,6 +13,12 @@ if [ ! -d "$FullScriptPath/../../../DesktopPrivate" ]; then
exit
fi
if [ "$1" == "request_uuid" ]; then
if [ "$2" != "" ]; then
NotarizeRequestId="$2"
fi
fi
Error () {
cd $FullExecPath
echo "$1"
@@ -260,96 +266,102 @@ if [ "$BuildTarget" == "mac" ] || [ "$BuildTarget" == "osx" ] || [ "$BuildTarget
Error "Backup path not found!"
fi
./configure.sh
if [ "$NotarizeRequestId" == "" ]; then
./configure.sh
cd $ProjectPath
cmake --build . --config Release --target Telegram
cd $ReleasePath
cd $ProjectPath
cmake --build . --config Release --target Telegram
if [ ! -d "$ReleasePath/$BinaryName.app" ]; then
Error "$BinaryName.app not found!"
fi
cd $ReleasePath
if [ ! -d "$ReleasePath/$BinaryName.app.dSYM" ]; then
Error "$BinaryName.app.dSYM not found!"
fi
if [ "$BuildTarget" == "mac" ] || [ "$BuildTarget" == "osx" ]; then
if [ ! -f "$ReleasePath/$BinaryName.app/Contents/Frameworks/Updater" ]; then
Error "Updater not found!"
if [ ! -d "$ReleasePath/$BinaryName.app" ]; then
Error "$BinaryName.app not found!"
fi
if [ ! -f "$ReleasePath/$BinaryName.app/Contents/Helpers/crashpad_handler" ]; then
Error "crashpad_handler not found!"
if [ ! -d "$ReleasePath/$BinaryName.app.dSYM" ]; then
Error "$BinaryName.app.dSYM not found!"
fi
fi
if [ "$BuildTarget" == "macstore" ]; then
if [ ! -d "$ReleasePath/$BinaryName.app/Contents/Frameworks/Breakpad.framework" ]; then
Error "Breakpad.framework not found!"
if [ "$BuildTarget" == "mac" ] || [ "$BuildTarget" == "osx" ]; then
if [ ! -f "$ReleasePath/$BinaryName.app/Contents/Frameworks/Updater" ]; then
Error "Updater not found!"
fi
if [ ! -f "$ReleasePath/$BinaryName.app/Contents/Helpers/crashpad_handler" ]; then
Error "crashpad_handler not found!"
fi
fi
fi
echo "Dumping debug symbols.."
"$HomePath/../../Libraries/macos/breakpad/src/tools/mac/dump_syms/build/Release/dump_syms" "$ReleasePath/$BinaryName.app.dSYM" > "$ReleasePath/$BinaryName.sym" 2>/dev/null
echo "Done!"
echo "Stripping the executable.."
strip "$ReleasePath/$BinaryName.app/Contents/MacOS/$BinaryName"
echo "Done!"
echo "Signing the application.."
if [ "$BuildTarget" == "mac" ] || [ "$BuildTarget" == "osx" ]; then
codesign --force --deep --timestamp --options runtime --sign "Developer ID Application: John Preston" "$ReleasePath/$BinaryName.app" --entitlements "$HomePath/Telegram/Telegram.entitlements"
elif [ "$BuildTarget" == "macstore" ]; then
codesign --force --deep --sign "3rd Party Mac Developer Application: TELEGRAM MESSENGER LLP (6N38VWS5BX)" "$ReleasePath/$BinaryName.app" --entitlements "$HomePath/Telegram/Telegram Lite.entitlements"
echo "Making an installer.."
productbuild --sign "3rd Party Mac Developer Installer: TELEGRAM MESSENGER LLP (6N38VWS5BX)" --component "$ReleasePath/$BinaryName.app" /Applications "$ReleasePath/$BinaryName.pkg"
fi
echo "Done!"
AppUUID=`dwarfdump -u "$ReleasePath/$BinaryName.app/Contents/MacOS/$BinaryName" | awk -F " " '{print $2}'`
DsymUUID=`dwarfdump -u "$ReleasePath/$BinaryName.app.dSYM" | awk -F " " '{print $2}'`
if [ "$AppUUID" != "$DsymUUID" ]; then
Error "UUID of binary '$AppUUID' and dSYM '$DsymUUID' differ!"
fi
if [ ! -f "$ReleasePath/$BinaryName.app/Contents/Resources/Icon.icns" ]; then
Error "Icon.icns not found in Resources!"
fi
if [ ! -f "$ReleasePath/$BinaryName.app/Contents/MacOS/$BinaryName" ]; then
Error "$BinaryName not found in MacOS!"
fi
if [ ! -d "$ReleasePath/$BinaryName.app/Contents/_CodeSignature" ]; then
Error "$BinaryName signature not found!"
fi
if [ "$BuildTarget" == "mac" ] || [ "$BuildTarget" == "osx" ]; then
if [ ! -f "$ReleasePath/$BinaryName.app/Contents/Frameworks/Updater" ]; then
Error "Updater not found in Frameworks!"
if [ "$BuildTarget" == "macstore" ]; then
if [ ! -d "$ReleasePath/$BinaryName.app/Contents/Frameworks/Breakpad.framework" ]; then
Error "Breakpad.framework not found!"
fi
fi
elif [ "$BuildTarget" == "macstore" ]; then
if [ ! -f "$ReleasePath/$BinaryName.pkg" ]; then
Error "$BinaryName.pkg not found!"
fi
fi
SymbolsHash=`head -n 1 "$ReleasePath/$BinaryName.sym" | awk -F " " 'END {print $4}'`
echo "Copying $BinaryName.sym to $DropboxSymbolsPath/$BinaryName/$SymbolsHash"
mkdir -p "$DropboxSymbolsPath/$BinaryName/$SymbolsHash"
cp "$ReleasePath/$BinaryName.sym" "$DropboxSymbolsPath/$BinaryName/$SymbolsHash/"
echo "Done!"
echo "Dumping debug symbols.."
"$HomePath/../../Libraries/macos/breakpad/src/tools/mac/dump_syms/build/Release/dump_syms" "$ReleasePath/$BinaryName.app.dSYM" > "$ReleasePath/$BinaryName.sym" 2>/dev/null
echo "Done!"
echo "Stripping the executable.."
strip "$ReleasePath/$BinaryName.app/Contents/MacOS/$BinaryName"
echo "Done!"
echo "Signing the application.."
if [ "$BuildTarget" == "mac" ] || [ "$BuildTarget" == "osx" ]; then
codesign --force --deep --timestamp --options runtime --sign "Developer ID Application: John Preston" "$ReleasePath/$BinaryName.app" --entitlements "$HomePath/Telegram/Telegram.entitlements"
elif [ "$BuildTarget" == "macstore" ]; then
codesign --force --deep --sign "3rd Party Mac Developer Application: Telegram FZ-LLC (C67CF9S4VU)" "$ReleasePath/$BinaryName.app" --entitlements "$HomePath/Telegram/Telegram Lite.entitlements"
echo "Making an installer.."
productbuild --sign "3rd Party Mac Developer Installer: Telegram FZ-LLC (C67CF9S4VU)" --component "$ReleasePath/$BinaryName.app" /Applications "$ReleasePath/$BinaryName.pkg"
fi
echo "Done!"
AppUUID=`dwarfdump -u "$ReleasePath/$BinaryName.app/Contents/MacOS/$BinaryName" | awk -F " " '{print $2}'`
DsymUUID=`dwarfdump -u "$ReleasePath/$BinaryName.app.dSYM" | awk -F " " '{print $2}'`
if [ "$AppUUID" != "$DsymUUID" ]; then
Error "UUID of binary '$AppUUID' and dSYM '$DsymUUID' differ!"
fi
if [ ! -f "$ReleasePath/$BinaryName.app/Contents/Resources/Icon.icns" ]; then
Error "Icon.icns not found in Resources!"
fi
if [ ! -f "$ReleasePath/$BinaryName.app/Contents/MacOS/$BinaryName" ]; then
Error "$BinaryName not found in MacOS!"
fi
if [ ! -d "$ReleasePath/$BinaryName.app/Contents/_CodeSignature" ]; then
Error "$BinaryName signature not found!"
fi
if [ "$BuildTarget" == "mac" ] || [ "$BuildTarget" == "osx" ]; then
if [ ! -f "$ReleasePath/$BinaryName.app/Contents/Frameworks/Updater" ]; then
Error "Updater not found in Frameworks!"
fi
elif [ "$BuildTarget" == "macstore" ]; then
if [ ! -f "$ReleasePath/$BinaryName.pkg" ]; then
Error "$BinaryName.pkg not found!"
fi
fi
SymbolsHash=`head -n 1 "$ReleasePath/$BinaryName.sym" | awk -F " " 'END {print $4}'`
echo "Copying $BinaryName.sym to $DropboxSymbolsPath/$BinaryName/$SymbolsHash"
mkdir -p "$DropboxSymbolsPath/$BinaryName/$SymbolsHash"
cp "$ReleasePath/$BinaryName.sym" "$DropboxSymbolsPath/$BinaryName/$SymbolsHash/"
echo "Done!"
fi
if [ "$BuildTarget" == "mac" ] || [ "$BuildTarget" == "osx" ]; then
cd "$ReleasePath"
if [ "$AlphaVersion" == "0" ]; then
cp -f tsetup_template.dmg tsetup.temp.dmg
TempDiskPath=`hdiutil attach -nobrowse -noautoopenrw -readwrite tsetup.temp.dmg | awk -F "\t" 'END {print $3}'`
cp -R "./$BinaryName.app" "$TempDiskPath/"
bless --folder "$TempDiskPath/" --openfolder "$TempDiskPath/"
hdiutil detach "$TempDiskPath"
hdiutil convert tsetup.temp.dmg -format UDZO -imagekey zlib-level=9 -ov -o "$SetupFile"
rm tsetup.temp.dmg
if [ "$NotarizeRequestId" == "" ]; then
if [ "$AlphaVersion" == "0" ]; then
cp -f tsetup_template.dmg tsetup.temp.dmg
TempDiskPath=`hdiutil attach -nobrowse -noautoopenrw -readwrite tsetup.temp.dmg | awk -F "\t" 'END {print $3}'`
cp -R "./$BinaryName.app" "$TempDiskPath/"
bless --folder "$TempDiskPath/" --openfolder "$TempDiskPath/"
hdiutil detach "$TempDiskPath"
hdiutil convert tsetup.temp.dmg -format UDZO -imagekey zlib-level=9 -ov -o "$SetupFile"
rm tsetup.temp.dmg
fi
fi
if [ "$AlphaVersion" != "0" ]; then
@@ -366,33 +378,40 @@ if [ "$BuildTarget" == "mac" ] || [ "$BuildTarget" == "osx" ] || [ "$BuildTarget
UpdateFile="${UpdateFile}_${AlphaSignature}"
SetupFile="talpha${AlphaVersion}_${AlphaSignature}.zip"
rm -rf "$ReleasePath/AlphaTemp"
mkdir "$ReleasePath/AlphaTemp"
mkdir "$ReleasePath/AlphaTemp/$BinaryName"
cp -r "$ReleasePath/$BinaryName.app" "$ReleasePath/AlphaTemp/$BinaryName/"
cd "$ReleasePath/AlphaTemp"
zip -r "$SetupFile" "$BinaryName"
mv "$SetupFile" "$ReleasePath/"
cd "$ReleasePath"
if [ "$NotarizeRequestId" == "" ]; then
rm -rf "$ReleasePath/AlphaTemp"
mkdir "$ReleasePath/AlphaTemp"
mkdir "$ReleasePath/AlphaTemp/$BinaryName"
cp -r "$ReleasePath/$BinaryName.app" "$ReleasePath/AlphaTemp/$BinaryName/"
cd "$ReleasePath/AlphaTemp"
zip -r "$SetupFile" "$BinaryName"
mv "$SetupFile" "$ReleasePath/"
cd "$ReleasePath"
fi
fi
if [ "$BuildTarget" == "mac" ]; then
echo "Beginning notarization process."
set +e
xcrun altool --notarize-app --primary-bundle-id "com.tdesktop.Telegram" --username "$AC_USERNAME" --password "@keychain:AC_PASSWORD" --file "$SetupFile" > request_uuid.txt
set -e
while IFS='' read -r line || [[ -n "$line" ]]; do
Prefix=$(echo $line | cut -d' ' -f 1)
Value=$(echo $line | cut -d' ' -f 3)
if [ "$Prefix" == "RequestUUID" ]; then
RequestUUID=$Value
if [ "$NotarizeRequestId" == "" ]; then
echo "Beginning notarization process."
set +e
xcrun altool --notarize-app --primary-bundle-id "com.tdesktop.Telegram" --username "$AC_USERNAME" --password "@keychain:AC_PASSWORD" --file "$SetupFile" > request_uuid.txt
set -e
while IFS='' read -r line || [[ -n "$line" ]]; do
Prefix=$(echo $line | cut -d' ' -f 1)
Value=$(echo $line | cut -d' ' -f 3)
if [ "$Prefix" == "RequestUUID" ]; then
RequestUUID=$Value
fi
done < "request_uuid.txt"
if [ "$RequestUUID" == "" ]; then
cat request_uuid.txt
Error "Could not extract Request UUID."
fi
done < "request_uuid.txt"
if [ "$RequestUUID" == "" ]; then
cat request_uuid.txt
Error "Could not extract Request UUID."
echo "Request UUID: $RequestUUID"
rm request_uuid.txt
else
RequestUUID=$NotarizeRequestId
echo "Continue notarization process with Request UUID: $RequestUUID"
fi
echo "Request UUID: $RequestUUID"
rm request_uuid.txt
RequestStatus=
LogFile=
@@ -419,7 +438,7 @@ if [ "$BuildTarget" == "mac" ] || [ "$BuildTarget" == "osx" ] || [ "$BuildTarget
echo "Notarization problems, response:"
cat request_result.txt
if [ "$LogFile" != "" ]; then
echo "Requesting log..."
echo "Requesting log: $LogFile"
curl $LogFile
fi
Error "Notarization FAILED."
@@ -427,7 +446,7 @@ if [ "$BuildTarget" == "mac" ] || [ "$BuildTarget" == "osx" ] || [ "$BuildTarget
rm request_result.txt
if [ "$LogFile" != "" ]; then
echo "Requesting log..."
echo "Requesting log: $LogFile"
curl $LogFile > request_log.txt
fi

View File

@@ -1,7 +1,7 @@
AppVersion 2001002
AppVersion 2001006
AppVersionStrMajor 2.1
AppVersionStrSmall 2.1.2
AppVersionStr 2.1.2
AppVersionStrSmall 2.1.6
AppVersionStr 2.1.6
BetaChannel 0
AlphaVersion 0
AppVersionOriginal 2.1.2
AppVersionOriginal 2.1.6

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More