2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Moved other authorizations api request to separated file.

This commit is contained in:
23rd
2020-09-08 18:01:12 +03:00
committed by John Preston
parent 0c4c4b2fcf
commit 6ac5f32796
9 changed files with 300 additions and 153 deletions

View File

@@ -98,20 +98,6 @@ std::map<int, const char*> BetaLogs() {
};
};
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);
}
} // namespace
Changelogs::Changelogs(not_null<Main::Session*> session, int oldVersion)
@@ -216,4 +202,18 @@ void Changelogs::addBetaLog(int changeVersion, const char *changes) {
addLocalLog(log);
}
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);
}
} // namespace Core

View File

@@ -15,6 +15,9 @@ class Session;
namespace Core {
[[nodiscard]] QString FormatVersionDisplay(int version);
[[nodiscard]] QString FormatVersionPrecise(int version);
class Changelogs : public base::has_weak_ptr, private base::Subscriber {
public:
Changelogs(not_null<Main::Session*> session, int oldVersion);

View File

@@ -13,6 +13,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "base/unixtime.h"
#include "storage/localstorage.h"
#include "core/application.h"
#include "core/changelogs.h"
#include "core/click_handler_types.h"
#include "mainwindow.h"
#include "main/main_account.h"
@@ -448,7 +449,7 @@ bool UnpackUpdate(const QString &filepath) {
// create tdata/version file
tempDir.mkdir(QDir(tempDirPath + qsl("/tdata")).absolutePath());
std::wstring versionString = ((version % 1000) ? QString("%1.%2.%3").arg(int(version / 1000000)).arg(int((version % 1000000) / 1000)).arg(int(version % 1000)) : QString("%1.%2").arg(int(version / 1000000)).arg(int((version % 1000000) / 1000))).toStdWString();
std::wstring versionString = FormatVersionDisplay(version).toStdWString();
const auto versionNum = VersionInt(version);
const auto versionLen = VersionInt(versionString.size() * sizeof(VersionChar));