2017-12-29 18:17:07 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
2018-01-03 10:23:14 +00:00
|
|
|
the official desktop application for the Telegram messaging service.
|
2017-12-29 18:17:07 +00:00
|
|
|
|
2018-01-03 10:23:14 +00:00
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
2017-12-29 18:17:07 +00:00
|
|
|
*/
|
|
|
|
#include "core/changelogs.h"
|
|
|
|
|
|
|
|
#include "lang/lang_keys.h"
|
2020-06-15 16:25:02 +00:00
|
|
|
#include "core/application.h"
|
2020-06-18 18:04:16 +00:00
|
|
|
#include "main/main_domain.h"
|
2020-06-09 16:57:05 +00:00
|
|
|
#include "main/main_session.h"
|
2020-06-18 18:04:16 +00:00
|
|
|
#include "storage/storage_domain.h"
|
2018-01-04 10:22:53 +00:00
|
|
|
#include "data/data_session.h"
|
2017-12-29 18:17:07 +00:00
|
|
|
#include "mainwindow.h"
|
|
|
|
#include "apiwrap.h"
|
|
|
|
|
|
|
|
namespace Core {
|
|
|
|
namespace {
|
|
|
|
|
2018-09-26 14:58:09 +00:00
|
|
|
std::map<int, const char*> BetaLogs() {
|
2017-12-29 18:17:07 +00:00
|
|
|
return {
|
2020-11-02 09:36:33 +00:00
|
|
|
{
|
|
|
|
2004006,
|
|
|
|
"- Fix image compression option when sending files with drag-n-drop.\n"
|
|
|
|
|
|
|
|
"- Fix caption text selection in media albums.\n"
|
|
|
|
|
|
|
|
"- Fix drafts display in personal chats in the chats list.\n"
|
|
|
|
|
|
|
|
"- Bug fixes and other minor improvements.\n"
|
|
|
|
},
|
2020-11-06 06:46:45 +00:00
|
|
|
{
|
|
|
|
2004008,
|
|
|
|
"- Upgrade several third party libraries to latest versions.\n"
|
|
|
|
},
|
2020-11-17 15:20:22 +00:00
|
|
|
{
|
|
|
|
2004010,
|
|
|
|
"- Use inline bots and sticker by emoji suggestions in channel comments.\n"
|
|
|
|
|
|
|
|
"- Lock voice message recording, listen to your voice message before sending.\n"
|
|
|
|
},
|
2020-11-19 16:05:16 +00:00
|
|
|
{
|
|
|
|
2004011,
|
|
|
|
"- Improve locked voice message recording.\n"
|
|
|
|
|
|
|
|
"- Fix main window closing to tray on Windows.\n"
|
|
|
|
|
|
|
|
"- Fix crash in bot command sending.\n"
|
|
|
|
|
|
|
|
"- Fix adding additional photos when sending an album to a group with enabled slow mode.\n"
|
|
|
|
},
|
2020-12-08 18:32:11 +00:00
|
|
|
{
|
|
|
|
2004012,
|
|
|
|
"- Voice chats in groups. (alpha version)\n"
|
|
|
|
},
|
2020-12-14 17:05:24 +00:00
|
|
|
{
|
|
|
|
2004014,
|
|
|
|
"- Create voice chats in legacy groups.\n"
|
|
|
|
|
|
|
|
"- Fix sticker pack opening.\n"
|
|
|
|
|
|
|
|
"- Fix group status display.\n"
|
2020-12-30 13:53:37 +00:00
|
|
|
|
2020-12-14 17:05:24 +00:00
|
|
|
"- Fix group members display.\n"
|
|
|
|
},
|
2020-12-19 08:44:34 +00:00
|
|
|
{
|
|
|
|
2004015,
|
|
|
|
"- Improve design of voice chats.\n"
|
|
|
|
|
|
|
|
"- Fix sending of voice messages as replies.\n"
|
|
|
|
|
|
|
|
"- Fix 'Open With' menu position in macOS.\n"
|
|
|
|
|
|
|
|
"- Fix freeze on secondary screen disconnect.\n"
|
|
|
|
},
|
2020-12-25 14:30:41 +00:00
|
|
|
{
|
|
|
|
2005002,
|
|
|
|
"- Fix possible crash in video calls.\n"
|
|
|
|
|
|
|
|
"- Fix possible crash in connecting to voice chats.\n"
|
|
|
|
|
|
|
|
"- Use different audio module code on Windows in calls.\n"
|
2020-12-30 13:53:37 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
2005003,
|
|
|
|
"- Allow using mouse buttons in Push-to-Talk shortcut.\n"
|
|
|
|
|
|
|
|
"- Fix blurred thumbnails in Shared Links section.\n"
|
|
|
|
},
|
2021-01-07 16:02:21 +00:00
|
|
|
{
|
|
|
|
2005004,
|
|
|
|
"- Implement new audio module code for calls and voice chats.\n"
|
|
|
|
|
|
|
|
"- Allow retracting votes from polls in comments to channel posts.\n"
|
|
|
|
|
|
|
|
"- Show small voice chat button for empty voice chats.\n"
|
|
|
|
|
|
|
|
"- Fix media viewer updating when screen resolution is changed.\n"
|
|
|
|
},
|
2021-01-10 08:30:58 +00:00
|
|
|
{
|
|
|
|
2005005,
|
|
|
|
"- Fix recording of audio in voice chats.\n"
|
|
|
|
|
|
|
|
"- Fix media viewer zoom and crashing.\n"
|
|
|
|
},
|
2021-01-22 15:00:11 +00:00
|
|
|
{
|
|
|
|
2005006,
|
|
|
|
"- Press Up arrow to edit your last sent comment.\n"
|
|
|
|
|
|
|
|
"- Add more information to date tooltips "
|
|
|
|
"in Recent Actions and channel comments.\n"
|
|
|
|
|
|
|
|
"- Bug and crash fixes.\n"
|
2021-03-13 16:16:23 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
2006002,
|
|
|
|
"- Fix text disappearing because of cloud drafts sync.\n"
|
2021-03-16 15:13:15 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
2006003,
|
|
|
|
"- Fix audio device selection in voice chats.\n"
|
|
|
|
|
|
|
|
"- Fix blinking self profile photo "
|
|
|
|
"in case the profile photo privacy is used.\n"
|
|
|
|
|
|
|
|
"- Fix voice chat admin menu on macOS.\n"
|
|
|
|
},
|
2021-03-16 20:02:05 +00:00
|
|
|
{
|
|
|
|
2006004,
|
|
|
|
"- Fix freeze in voice chats.\n"
|
2021-03-16 20:07:08 +00:00
|
|
|
|
|
|
|
"- Make default interface scale 110% on macOS Retina screens.\n"
|
2021-03-16 20:02:05 +00:00
|
|
|
},
|
2021-03-17 17:16:55 +00:00
|
|
|
{
|
|
|
|
2006005,
|
|
|
|
"- Improvements and fixes in new voice chat features.\n"
|
|
|
|
},
|
2021-03-18 14:05:43 +00:00
|
|
|
{
|
|
|
|
2006007,
|
|
|
|
"- Improve voice chat participants list updating.\n"
|
|
|
|
},
|
2021-03-18 18:48:56 +00:00
|
|
|
{
|
|
|
|
2006008,
|
|
|
|
"- Fix connecting and getting allowed to speak on voice chats.\n"
|
|
|
|
|
|
|
|
"- MPRIS support on Linux.\n"
|
|
|
|
},
|
2021-05-03 20:27:59 +00:00
|
|
|
{
|
|
|
|
2007005,
|
|
|
|
"- Add \"Voice chats\" filter in \"Recent actions\" for channels.\n"
|
|
|
|
|
|
|
|
"- Write local drafts to disk on a background thread.\n"
|
|
|
|
|
|
|
|
"- Support autoupdate for Telegram in write-protected folders on Linux.\n"
|
|
|
|
|
|
|
|
"- Fix crash in native notifications on Linux.\n"
|
|
|
|
|
|
|
|
"- Fix crash in file dialog on Linux.\n"
|
|
|
|
},
|
2017-12-29 18:17:07 +00:00
|
|
|
};
|
2019-07-04 14:59:42 +00:00
|
|
|
};
|
2017-12-29 18:17:07 +00:00
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
2019-07-24 11:45:24 +00:00
|
|
|
Changelogs::Changelogs(not_null<Main::Session*> session, int oldVersion)
|
2017-12-29 18:17:07 +00:00
|
|
|
: _session(session)
|
|
|
|
, _oldVersion(oldVersion) {
|
2019-04-18 08:28:43 +00:00
|
|
|
_session->data().chatsListChanges(
|
|
|
|
) | rpl::filter([](Data::Folder *folder) {
|
|
|
|
return !folder;
|
|
|
|
}) | rpl::start_with_next([=] {
|
|
|
|
requestCloudLogs();
|
|
|
|
}, _chatsSubscription);
|
2017-12-29 18:17:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
std::unique_ptr<Changelogs> Changelogs::Create(
|
2019-07-24 11:45:24 +00:00
|
|
|
not_null<Main::Session*> session) {
|
2020-06-18 18:04:16 +00:00
|
|
|
auto &local = Core::App().domain().local();
|
2020-06-15 16:25:02 +00:00
|
|
|
const auto oldVersion = local.oldVersion();
|
|
|
|
local.clearOldVersion();
|
2017-12-29 18:17:07 +00:00
|
|
|
return (oldVersion > 0 && oldVersion < AppVersion)
|
|
|
|
? std::make_unique<Changelogs>(session, oldVersion)
|
|
|
|
: nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Changelogs::requestCloudLogs() {
|
2019-04-18 08:28:43 +00:00
|
|
|
_chatsSubscription.destroy();
|
2017-12-29 18:17:07 +00:00
|
|
|
|
|
|
|
const auto callback = [this](const MTPUpdates &result) {
|
|
|
|
_session->api().applyUpdates(result);
|
|
|
|
|
|
|
|
auto resultEmpty = true;
|
|
|
|
switch (result.type()) {
|
|
|
|
case mtpc_updateShortMessage:
|
|
|
|
case mtpc_updateShortChatMessage:
|
|
|
|
case mtpc_updateShort:
|
|
|
|
resultEmpty = false;
|
|
|
|
break;
|
|
|
|
case mtpc_updatesCombined:
|
2019-07-05 13:38:38 +00:00
|
|
|
resultEmpty = result.c_updatesCombined().vupdates().v.isEmpty();
|
2017-12-29 18:17:07 +00:00
|
|
|
break;
|
|
|
|
case mtpc_updates:
|
2019-07-05 13:38:38 +00:00
|
|
|
resultEmpty = result.c_updates().vupdates().v.isEmpty();
|
2017-12-29 18:17:07 +00:00
|
|
|
break;
|
|
|
|
case mtpc_updatesTooLong:
|
|
|
|
case mtpc_updateShortSentMessage:
|
|
|
|
LOG(("API Error: Bad updates type in app changelog."));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (resultEmpty) {
|
|
|
|
addLocalLogs();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
_session->api().requestChangelog(
|
|
|
|
FormatVersionPrecise(_oldVersion),
|
2018-06-04 15:35:11 +00:00
|
|
|
crl::guard(this, callback));
|
2017-12-29 18:17:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Changelogs::addLocalLogs() {
|
2018-09-26 15:11:16 +00:00
|
|
|
if (AppBetaVersion || cAlphaVersion()) {
|
2018-09-26 14:58:09 +00:00
|
|
|
addBetaLogs();
|
2017-12-29 18:17:07 +00:00
|
|
|
}
|
|
|
|
if (!_addedSomeLocal) {
|
2019-06-19 16:39:25 +00:00
|
|
|
const auto text = tr::lng_new_version_wrap(
|
|
|
|
tr::now,
|
2017-12-29 18:17:07 +00:00
|
|
|
lt_version,
|
2018-11-08 05:50:18 +00:00
|
|
|
QString::fromLatin1(AppVersionStr),
|
2017-12-29 18:17:07 +00:00
|
|
|
lt_changes,
|
2019-06-19 15:09:03 +00:00
|
|
|
tr::lng_new_version_minor(tr::now),
|
2017-12-29 18:17:07 +00:00
|
|
|
lt_link,
|
2021-02-04 16:42:32 +00:00
|
|
|
Core::App().changelogLink());
|
2017-12-29 18:17:07 +00:00
|
|
|
addLocalLog(text.trimmed());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Changelogs::addLocalLog(const QString &text) {
|
|
|
|
auto textWithEntities = TextWithEntities{ text };
|
|
|
|
TextUtilities::ParseEntities(textWithEntities, TextParseLinks);
|
2019-02-11 12:50:35 +00:00
|
|
|
_session->data().serviceNotification(textWithEntities);
|
2017-12-29 18:17:07 +00:00
|
|
|
_addedSomeLocal = true;
|
|
|
|
};
|
|
|
|
|
2018-09-26 14:58:09 +00:00
|
|
|
void Changelogs::addBetaLogs() {
|
2019-01-13 08:03:34 +00:00
|
|
|
for (const auto [version, changes] : BetaLogs()) {
|
2018-09-26 14:58:09 +00:00
|
|
|
addBetaLog(version, changes);
|
2017-12-29 18:17:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-09-26 14:58:09 +00:00
|
|
|
void Changelogs::addBetaLog(int changeVersion, const char *changes) {
|
2017-12-29 18:17:07 +00:00
|
|
|
if (_oldVersion >= changeVersion) {
|
|
|
|
return;
|
|
|
|
}
|
2020-07-02 18:11:53 +00:00
|
|
|
const auto text = [&] {
|
|
|
|
static const auto simple = u"\n- "_q;
|
|
|
|
static const auto separator = QString::fromUtf8("\n\xE2\x80\xA2 ");
|
|
|
|
auto result = QString::fromUtf8(changes).trimmed();
|
|
|
|
if (result.startsWith(simple.midRef(1))) {
|
2020-07-02 19:02:59 +00:00
|
|
|
result = separator.mid(1) + result.mid(simple.size() - 1);
|
2020-07-02 18:11:53 +00:00
|
|
|
}
|
|
|
|
return result.replace(simple, separator);
|
|
|
|
}();
|
2017-12-29 18:17:07 +00:00
|
|
|
const auto version = FormatVersionDisplay(changeVersion);
|
2020-07-02 18:11:53 +00:00
|
|
|
const auto log = qsl("New in version %1:\n\n").arg(version) + text;
|
|
|
|
addLocalLog(log);
|
2017-12-29 18:17:07 +00:00
|
|
|
}
|
|
|
|
|
2020-09-08 15:01:12 +00:00
|
|
|
QString FormatVersionDisplay(int version) {
|
|
|
|
return QString::number(version / 1000000)
|
|
|
|
+ '.' + QString::number((version % 1000000) / 1000)
|
|
|
|
+ ((version % 1000)
|
|
|
|
? ('.' + QString::number(version % 1000))
|
|
|
|
: QString());
|
|
|
|
}
|
|
|
|
|
|
|
|
QString FormatVersionPrecise(int version) {
|
|
|
|
return QString::number(version / 1000000)
|
|
|
|
+ '.' + QString::number((version % 1000000) / 1000)
|
|
|
|
+ '.' + QString::number(version % 1000);
|
|
|
|
}
|
|
|
|
|
2017-12-29 18:17:07 +00:00
|
|
|
} // namespace Core
|