testing beta update to 9014002, frequent beta update check, no creating .desktop file for beta

This commit is contained in:
John Preston 2015-12-04 17:29:57 +03:00
parent 8552b8421b
commit c8c13219ed
5 changed files with 9 additions and 8 deletions

View file

@ -174,7 +174,7 @@ int main(int argc, char *argv[])
} else if (string("-dev") == argv[i]) {
DevChannel = true;
} else if (string("-beta") == argv[i] && i + 1 < argc) {
BetaVersion = QString(argv[i + 1]).toLongLong();
BetaVersion = QString(argv[i + 1]).toULongLong();
if (BetaVersion > version * 1000ULL && BetaVersion < (version + 1) * 1000ULL) {
DevChannel = false;
BetaSignature = countBetaVersionSignature(BetaVersion);

View file

@ -210,14 +210,14 @@ void Application::updateGotCurrent() {
cSetLastUpdateCheck(unixtime());
QRegularExpressionMatch m = QRegularExpression(qsl("^\\s*(\\d+)\\s*:\\s*([\\x21-\\x7f]+)\\s*$")).match(QString::fromUtf8(updateReply->readAll()));
if (m.hasMatch()) {
int32 currentVersion = m.captured(1).toInt();
uint64 currentVersion = m.captured(1).toULongLong();
QString url = m.captured(2);
bool betaVersion = false;
if (url.startsWith(qstr("beta_"))) {
betaVersion = true;
url = url.mid(5) + '_' + countBetaVersionSignature(currentVersion);
}
if ((!betaVersion || cBetaVersion()) && currentVersion > (betaVersion ? cBetaVersion() : AppVersion)) {
if ((!betaVersion || cBetaVersion()) && currentVersion > (betaVersion ? cBetaVersion() : uint64(AppVersion))) {
updateThread = new QThread();
connect(updateThread, SIGNAL(finished()), updateThread, SLOT(deleteLater()));
updateDownloader = new UpdateDownloader(updateThread, url);
@ -549,8 +549,9 @@ void Application::startUpdateCheck(bool forceWait) {
updateCheckTimer.stop();
if (updateRequestId || updateThread || updateReply || !cAutoUpdate()) return;
int32 updateInSecs = cLastUpdateCheck() + UpdateDelayConstPart + (rand() % UpdateDelayRandPart) - unixtime();
bool sendRequest = (updateInSecs <= 0 || updateInSecs > (UpdateDelayConstPart + UpdateDelayRandPart));
int32 constDelay = cBetaVersion() ? 600 : UpdateDelayConstPart, randDelay = cBetaVersion() ? 300 : UpdateDelayRandPart;
int32 updateInSecs = cLastUpdateCheck() + constDelay + (rand() % randDelay) - unixtime();
bool sendRequest = (updateInSecs <= 0 || updateInSecs > (constDelay + randDelay));
if (!sendRequest && !forceWait) {
QDir updates(cWorkingDir() + "tupdates");
if (updates.exists()) {

View file

@ -23,7 +23,7 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
static const int32 AppVersion = 9014;
static const wchar_t *AppVersionStr = L"0.9.14";
static const bool DevVersion = true;
#define BETA_VERSION (9014001ULL) // just comment this line to build public version
#define BETA_VERSION (9014002ULL) // just comment this line to build public version
static const wchar_t *AppNameOld = L"Telegram Win (Unofficial)";
static const wchar_t *AppName = L"Telegram Desktop";

View file

@ -1167,7 +1167,7 @@ namespace {
void psRegisterCustomScheme() {
#ifndef TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME
QString home(_psHomeDir());
if (home.isEmpty()) return;
if (home.isEmpty() || cBetaVersion()) return; // don't update desktop file for beta version
DEBUG_LOG(("App Info: placing .desktop file"));
if (QDir(home + qsl(".local/")).exists()) {

View file

@ -3,4 +3,4 @@ AppVersionStrMajor 0.9
AppVersionStrSmall 0.9.14
AppVersionStr 0.9.14
DevChannel 1
BetaVersion 9014001
BetaVersion 9014002