Skip to content

Commit

Permalink
testing beta update to 9014002, frequent beta update check, no creati…
Browse files Browse the repository at this point in the history
…ng .desktop file for beta
  • Loading branch information
john-preston committed Dec 4, 2015
1 parent 8552b84 commit c8c1321
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Telegram/SourceFiles/_other/packer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
9 changes: 5 additions & 4 deletions Telegram/SourceFiles/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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()) {
Expand Down
2 changes: 1 addition & 1 deletion Telegram/SourceFiles/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
2 changes: 1 addition & 1 deletion Telegram/SourceFiles/pspecific_linux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down
2 changes: 1 addition & 1 deletion Telegram/Version
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ AppVersionStrMajor 0.9
AppVersionStrSmall 0.9.14
AppVersionStr 0.9.14
DevChannel 1
BetaVersion 9014001
BetaVersion 9014002

0 comments on commit c8c1321

Please sign in to comment.