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"
|
2021-10-19 13:00:21 +00:00
|
|
|
|
#include "base/qt_adapters.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 {
|
2021-08-17 09:42:56 +00:00
|
|
|
|
{
|
|
|
|
|
2009004,
|
2021-08-20 14:23:28 +00:00
|
|
|
|
"- Choose one from dozens of new gorgeous animated backgrounds"
|
|
|
|
|
" in Chat Settings > Chat background.\n"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
2009005,
|
|
|
|
|
"- Tile chat background patterns horizontally.\n"
|
|
|
|
|
|
|
|
|
|
"- Fix a rare crash in spellchecker on Windows.\n"
|
|
|
|
|
|
|
|
|
|
"- Fix animated chat backgrounds in Saved Messages.\n"
|
|
|
|
|
|
2021-08-31 07:37:31 +00:00
|
|
|
|
"- Fix \"Sorry, group is inaccessible\" message "
|
|
|
|
|
"in scheduled voice chats.\n",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
2009013,
|
|
|
|
|
"- See unread comments count when scrolling discussions in channels."
|
2021-08-17 09:42:56 +00:00
|
|
|
|
},
|
2021-09-10 10:14:43 +00:00
|
|
|
|
{
|
|
|
|
|
3000002,
|
|
|
|
|
"- Check who've seen your message in small groups "
|
|
|
|
|
"from the context menu.\n"
|
|
|
|
|
|
|
|
|
|
"- Enable recording with video in live streams and video chats."
|
2021-09-13 15:01:39 +00:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
3000004,
|
|
|
|
|
"- Fix a crash when joining video chat or live broadcast.\n"
|
|
|
|
|
|
|
|
|
|
"- Add a \"Close to Taskbar\" option when tray icon is disabled "
|
|
|
|
|
"(Windows and Linux)."
|
2021-09-17 07:57:42 +00:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
3000005,
|
|
|
|
|
"- Add support for Emoji 13.1."
|
2021-09-26 13:24:09 +00:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
3001002,
|
|
|
|
|
"- Control video in fullscreen mode using arrows and numbers.\n"
|
|
|
|
|
|
|
|
|
|
"- Open locations in browser if default Bing Maps is not installed.\n"
|
|
|
|
|
|
|
|
|
|
"- Reconnect without timeout when network availability changes.\n"
|
|
|
|
|
|
|
|
|
|
"- Crash fixes."
|
2021-09-28 18:00:51 +00:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
3001005,
|
|
|
|
|
"- Choose one of 8 new preset themes for any individual private chat.\n"
|
|
|
|
|
|
|
|
|
|
"- Click on '...' menu > 'Change Colors' to pick a theme.\n"
|
|
|
|
|
|
|
|
|
|
"- Both chat participants will see the same theme in that chat "
|
|
|
|
|
"– on all their devices.\n"
|
|
|
|
|
|
|
|
|
|
"- Each new theme features colorful gradient message bubbles, "
|
|
|
|
|
"beautifully animated backgrounds and unique background patterns.\n"
|
|
|
|
|
|
|
|
|
|
"- All chat themes have day and night versions and will follow "
|
|
|
|
|
"your overall dark mode settings.\n"
|
|
|
|
|
|
|
|
|
|
"- Implement main window rounded corners on Windows 11.\n"
|
|
|
|
|
|
|
|
|
|
"- Fix audio capture from AirPods on macOS.\n"
|
2021-10-06 07:07:38 +00:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
3001006,
|
|
|
|
|
"- Show small media previews in chats list.\n"
|
|
|
|
|
|
|
|
|
|
"- Show media album previews and caption text in chats list.\n"
|
|
|
|
|
|
|
|
|
|
"- Add \"Quick Reply\" and \"Mark as Read\" "
|
|
|
|
|
"to native Windows notifications.\n"
|
2021-10-31 06:48:00 +00:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
3001012,
|
|
|
|
|
"- Create special invite links that require admins "
|
|
|
|
|
"to approve users before they become members.\n"
|
|
|
|
|
|
|
|
|
|
"- Admins can view the applicants' profiles and bios "
|
|
|
|
|
"by tapping the Join Requests bar at the top of the chat.\n"
|
|
|
|
|
|
|
|
|
|
"- Add internal labels to your chat's Invite Links "
|
|
|
|
|
"to keep them organized.\n"
|
|
|
|
|
|
|
|
|
|
"- Run natively on Apple Silicon (macOS only).\n"
|
2021-11-02 07:28:53 +00:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
3001013,
|
|
|
|
|
"- Fix requests to groups / channels processing.\n"
|
|
|
|
|
|
|
|
|
|
"- Fix internal link previews with View Content button layout.\n"
|
|
|
|
|
|
|
|
|
|
"- Fix crash in messages search with imported messages results.\n"
|
|
|
|
|
|
|
|
|
|
"- Don't use fractional system UI scaling on Linux.\n"
|
|
|
|
|
|
|
|
|
|
"- Fix invite link icons on macOS.\n"
|
|
|
|
|
|
|
|
|
|
"- Several crash fixes.\n"
|
|
|
|
|
},
|
2021-11-26 19:06:39 +00:00
|
|
|
|
{
|
|
|
|
|
3002006,
|
|
|
|
|
"- Try out the new audio player with playlist shuffle and repeat.\n"
|
|
|
|
|
|
|
|
|
|
"- Give a custom name to your desktop session "
|
|
|
|
|
"to distinguish it in the sessions list.\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() {
|
2021-09-08 10:53:54 +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();
|
2021-10-19 13:00:21 +00:00
|
|
|
|
if (result.startsWith(base::StringViewMid(simple, 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);
|
2021-05-31 17:29:05 +00:00
|
|
|
|
const auto log = qsl("New in version %1 beta:\n\n").arg(version) + text;
|
2020-07-02 18:11:53 +00:00
|
|
|
|
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
|