Basic changelogs
This commit is contained in:
parent
fe75a9f0b7
commit
3642db51d7
9 changed files with 88 additions and 9 deletions
|
|
@ -2280,6 +2280,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
"ktg_about_text1_tdesktop" = "Telegram Desktop";
|
||||
"ktg_about_text3" = "Visit {channel_link} or {faq_link} for more info.";
|
||||
"ktg_about_text3_channel" = "Kotatogram channel";
|
||||
"ktg_new_version" = "Kotatogram Desktop has been updated to {version} (TD {td_version})\n\nFull version history is available here:\n{link}";
|
||||
|
||||
// Replaces
|
||||
"ktg_open_from_tray" = "Open Kotatogram";
|
||||
|
|
@ -2295,7 +2296,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
"ktg_passcode_about" = "When a local passcode is set, a lock icon appears at the top of your chats list. Click it to lock the app.\n\nNote: if you forget your local passcode, you'll need to relogin in Kotatogram Desktop.";
|
||||
"ktg_message_unsupported" = "This message is not supported by your version of Kotatogram Desktop. Please update to the latest version in Settings, or install it from {link}";
|
||||
"ktg_bot_share_location_unavailable" = "Sorry, location sharing is currently unavailable in Kotatogram Desktop.";
|
||||
"ktg_new_version_wrap" = "Kotatogram Desktop was rebased on Telegram Desktop {version}\n\n{changes}\n\nFull version history is available here:\n{link}";
|
||||
"ktg_theme_editor_need_unlock" = "You need to unlock Kotatogram to save your theme.";
|
||||
"ktg_payments_not_supported" = "Sorry, Kotatogram Desktop doesn't support payments yet. Please use one of our mobile apps to do this.";
|
||||
"ktg_no_mic_permission" = "Kotatogram needs access to your microphone so that you can make calls and record voice messages.";
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
"ktg_about_text1": "Экспериментальный неофициальный форк {tdesktop_link}.",
|
||||
"ktg_about_text3": "Посетите {channel_link} или {faq_link} (англ.), чтобы узнать больше.",
|
||||
"ktg_about_text3_channel": "канал Kotatogram",
|
||||
"ktg_new_version": "Kotatogram Desktop обновлён до версии {version} (TD {td_version})\n\nПолную историю изменений можно прочитать здесь:\n{link}",
|
||||
"ktg_open_from_tray": "Открыть Kotatogram",
|
||||
"ktg_quit_from_tray": "Закрыть Kotatogram",
|
||||
"ktg_tray_icon_text": "Kotatogram продолжает работать,\nВы можете изменить это в настройках.\nЕсли значок исчезнет из области уведомлений,\nего можно перенести из скрытых значков.",
|
||||
|
|
@ -22,7 +23,6 @@
|
|||
"ktg_passcode_about": "Когда код-пароль включен, в списке чатов появляется значок замка для блокировки и разблокировки приложения.\n\nВажно: если Вы забудете код-пароль, нужно будет выйти и заново авторизоваться в Kotatogram Desktop.",
|
||||
"ktg_message_unsupported": "Это сообщение не поддерживается в вашей версии Kotatogram. Пожалуйста, обновитесь до последней версии через Настройки или установите её по ссылке {link}",
|
||||
"ktg_bot_share_location_unavailable": "В Kotatogram Desktop пока нельзя делиться геопозицией.",
|
||||
"ktg_new_version_wrap": "Kotatogram Desktop обновил исходники Telegram Desktop до {version}\n\n{changes}\n\nВся история изменений доступна здесь:\n{link}",
|
||||
"ktg_theme_editor_need_unlock": "Чтобы сохранить тему, необходимо разблокировать приложение.",
|
||||
"ktg_payments_not_supported": "К сожалению, Kotatogram Desktop ещё не поддерживает платежи. Пожалуйста, используйте для этого мобильные приложения.",
|
||||
"ktg_no_mic_permission": "Чтобы Вы могли пользоваться звонками и записывать голосовые сообщения, Kotatogram требуется доступ к микрофону.",
|
||||
|
|
|
|||
|
|
@ -64,25 +64,57 @@ QString FormatVersionPrecise(int version) {
|
|||
|
||||
} // namespace
|
||||
|
||||
Changelogs::Changelogs(not_null<Main::Session*> session, int oldVersion)
|
||||
Changelogs::Changelogs(not_null<Main::Session*> session, int oldVersion, int oldKotatoVersion)
|
||||
: _session(session)
|
||||
, _oldVersion(oldVersion) {
|
||||
, _oldVersion(oldVersion)
|
||||
, _oldKotatoVersion(oldKotatoVersion) {
|
||||
|
||||
_session->data().chatsListChanges(
|
||||
) | rpl::filter([](Data::Folder *folder) {
|
||||
return !folder;
|
||||
}) | rpl::start_with_next([=] {
|
||||
requestCloudLogs();
|
||||
addKotatoLogs();
|
||||
}, _chatsSubscription);
|
||||
}
|
||||
|
||||
std::unique_ptr<Changelogs> Changelogs::Create(
|
||||
not_null<Main::Session*> session) {
|
||||
const auto oldVersion = Local::oldMapVersion();
|
||||
return (oldVersion > 0 && oldVersion < AppVersion)
|
||||
? std::make_unique<Changelogs>(session, oldVersion)
|
||||
const auto oldKotatoVersion = Local::oldKotatoVersion();
|
||||
return (!cKotatoFirstRun() && oldKotatoVersion < AppKotatoVersion)
|
||||
? std::make_unique<Changelogs>(session, oldVersion, oldKotatoVersion)
|
||||
: nullptr;
|
||||
}
|
||||
|
||||
void Changelogs::addKotatoLogs() {
|
||||
_chatsSubscription.destroy();
|
||||
|
||||
auto baseLang = Lang::Current().baseId();
|
||||
auto currentLang = Lang::Current().id();
|
||||
QString channelLink;
|
||||
|
||||
for (const auto language : { "ru", "uk", "be" }) {
|
||||
if (baseLang.startsWith(QLatin1String(language)) || currentLang == QString(language)) {
|
||||
channelLink = "https://t.me/kotatogram_ru";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (channelLink.isEmpty()) {
|
||||
channelLink = "https://t.me/kotatogram";
|
||||
}
|
||||
|
||||
const auto text = tr::ktg_new_version(
|
||||
tr::now,
|
||||
lt_version,
|
||||
QString::fromLatin1(AppKotatoVersionStr),
|
||||
lt_td_version,
|
||||
QString::fromLatin1(AppVersionStr),
|
||||
lt_link,
|
||||
channelLink);
|
||||
addLocalLog(text.trimmed());
|
||||
}
|
||||
|
||||
void Changelogs::requestCloudLogs() {
|
||||
_chatsSubscription.destroy();
|
||||
|
||||
|
|
@ -121,7 +153,7 @@ void Changelogs::addLocalLogs() {
|
|||
addBetaLogs();
|
||||
}
|
||||
if (!_addedSomeLocal) {
|
||||
const auto text = tr::ktg_new_version_wrap(
|
||||
const auto text = tr::lng_new_version_wrap(
|
||||
tr::now,
|
||||
lt_version,
|
||||
QString::fromLatin1(AppVersionStr),
|
||||
|
|
|
|||
|
|
@ -17,12 +17,13 @@ namespace Core {
|
|||
|
||||
class Changelogs : public base::has_weak_ptr, private base::Subscriber {
|
||||
public:
|
||||
Changelogs(not_null<Main::Session*> session, int oldVersion);
|
||||
Changelogs(not_null<Main::Session*> session, int oldVersion, int oldKotatoVersion);
|
||||
|
||||
static std::unique_ptr<Changelogs> Create(
|
||||
not_null<Main::Session*> session);
|
||||
|
||||
private:
|
||||
void addKotatoLogs();
|
||||
void requestCloudLogs();
|
||||
void addLocalLogs();
|
||||
void addLocalLog(const QString &text);
|
||||
|
|
@ -31,6 +32,7 @@ private:
|
|||
|
||||
const not_null<Main::Session*> _session;
|
||||
const int _oldVersion = 0;
|
||||
const int _oldKotatoVersion = 0;
|
||||
rpl::lifetime _chatsSubscription;
|
||||
bool _addedSomeLocal = false;
|
||||
|
||||
|
|
|
|||
|
|
@ -97,8 +97,10 @@ void Manager::write(bool force) {
|
|||
bool Manager::readCustomFile() {
|
||||
QFile file(CustomFilePath());
|
||||
if (!file.exists()) {
|
||||
cSetKotatoFirstRun(true);
|
||||
return false;
|
||||
}
|
||||
cSetKotatoFirstRun(false);
|
||||
if (!file.open(QIODevice::ReadOnly)) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -207,6 +207,8 @@ rpl::producer<> UpdatedRecentEmoji() {
|
|||
return UpdatesRecentEmoji.events();
|
||||
}
|
||||
|
||||
bool gKotatoFirstRun = true;
|
||||
|
||||
QString gMainFont, gSemiboldFont, gMonospaceFont;
|
||||
bool gSemiboldFontIsBold = false;
|
||||
|
||||
|
|
|
|||
|
|
@ -179,6 +179,8 @@ inline void ValidateScale() {
|
|||
style::SetScale(cEvalScale(cConfigScale()));
|
||||
}
|
||||
|
||||
DeclareSetting(bool, KotatoFirstRun);
|
||||
|
||||
DeclareSetting(QString, MainFont);
|
||||
DeclareSetting(QString, SemiboldFont);
|
||||
DeclareSetting(bool, SemiboldFontIsBold);
|
||||
|
|
|
|||
|
|
@ -702,6 +702,7 @@ FileKey _languagesKey = 0;
|
|||
|
||||
bool _mapChanged = false;
|
||||
int32 _oldMapVersion = 0, _oldSettingsVersion = 0;
|
||||
int32 _oldKotatoVersion = 0;
|
||||
|
||||
enum class WriteMapWhen {
|
||||
Now,
|
||||
|
|
@ -2578,6 +2579,9 @@ void readLangPack();
|
|||
void start() {
|
||||
Expects(!_manager);
|
||||
|
||||
_oldKotatoVersion = readKotatoVersion();
|
||||
writeKotatoVersion(AppKotatoVersion);
|
||||
|
||||
_manager = new internal::Manager();
|
||||
_localLoader = new TaskQueue(kFileLoaderQueueStopTimeout);
|
||||
|
||||
|
|
@ -2917,6 +2921,10 @@ int32 oldSettingsVersion() {
|
|||
return _oldSettingsVersion;
|
||||
}
|
||||
|
||||
int32 oldKotatoVersion() {
|
||||
return _oldKotatoVersion;
|
||||
}
|
||||
|
||||
void writeDrafts(const PeerId &peer, const MessageDraft &localDraft, const MessageDraft &editDraft) {
|
||||
if (!_working()) return;
|
||||
|
||||
|
|
@ -4967,6 +4975,32 @@ bool decrypt(const void *src, void *dst, uint32 len, const void *key128) {
|
|||
return true;
|
||||
}
|
||||
|
||||
qint32 readKotatoVersion() {
|
||||
qint32 version = 0;
|
||||
QFile f(cWorkingDir() + qsl("tdata/ktg_version"));
|
||||
if (f.open(QIODevice::ReadOnly)) {
|
||||
QDataStream stream(&f);
|
||||
stream.setVersion(QDataStream::Qt_5_1);
|
||||
while (!stream.atEnd()) {
|
||||
stream >> version;
|
||||
break;
|
||||
}
|
||||
f.close();
|
||||
}
|
||||
|
||||
return version;
|
||||
}
|
||||
|
||||
void writeKotatoVersion(int version) {
|
||||
qint32 writtenVersion = version;
|
||||
QFile f(cWorkingDir() + qsl("tdata/ktg_version"));
|
||||
if (f.open(QIODevice::WriteOnly)) {
|
||||
QDataStream stream(&f);
|
||||
stream << writtenVersion;
|
||||
f.close();
|
||||
}
|
||||
}
|
||||
|
||||
struct ClearManagerData {
|
||||
QThread *thread;
|
||||
QMutex mutex;
|
||||
|
|
|
|||
|
|
@ -98,6 +98,8 @@ int32 oldMapVersion();
|
|||
|
||||
int32 oldSettingsVersion();
|
||||
|
||||
int32 oldKotatoVersion();
|
||||
|
||||
struct MessageDraft {
|
||||
MessageDraft(MsgId msgId = 0, TextWithTags textWithTags = TextWithTags(), bool previewCancelled = false)
|
||||
: msgId(msgId)
|
||||
|
|
@ -184,6 +186,9 @@ bool isBotTrusted(UserData *bot);
|
|||
bool encrypt(const void *src, void *dst, uint32 len, const void *key128);
|
||||
bool decrypt(const void *src, void *dst, uint32 len, const void *key128);
|
||||
|
||||
qint32 readKotatoVersion();
|
||||
void writeKotatoVersion(int version);
|
||||
|
||||
namespace internal {
|
||||
|
||||
class Manager : public QObject {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue