Alpha 1.0.25: Edit phone number in Settings.

Also fix build for GCC.
Also add scripts for GitHub releases management.
This commit is contained in:
John Preston 2017-03-21 22:48:04 +03:00
parent 743743ca10
commit 6601a00eea
14 changed files with 324 additions and 56 deletions

View File

@ -9,7 +9,7 @@
<Identity Name="TelegramDesktop" <Identity Name="TelegramDesktop"
ProcessorArchitecture="x64" ProcessorArchitecture="x64"
Publisher="CN=Telegram Messenger LLP, O=Telegram Messenger LLP, L=London, C=GB" Publisher="CN=Telegram Messenger LLP, O=Telegram Messenger LLP, L=London, C=GB"
Version="1.0.24.0" /> Version="1.0.25.0" />
<Properties> <Properties>
<DisplayName>Telegram Desktop</DisplayName> <DisplayName>Telegram Desktop</DisplayName>
<PublisherDisplayName>Telegram Messenger LLP</PublisherDisplayName> <PublisherDisplayName>Telegram Messenger LLP</PublisherDisplayName>

View File

@ -34,8 +34,8 @@ IDI_ICON1 ICON "..\\art\\icon256.ico"
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,24,0 FILEVERSION 1,0,25,0
PRODUCTVERSION 1,0,24,0 PRODUCTVERSION 1,0,25,0
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -52,10 +52,10 @@ BEGIN
BEGIN BEGIN
VALUE "CompanyName", "Telegram Messenger LLP" VALUE "CompanyName", "Telegram Messenger LLP"
VALUE "FileDescription", "Telegram Desktop" VALUE "FileDescription", "Telegram Desktop"
VALUE "FileVersion", "1.0.24.0" VALUE "FileVersion", "1.0.25.0"
VALUE "LegalCopyright", "Copyright (C) 2014-2017" VALUE "LegalCopyright", "Copyright (C) 2014-2017"
VALUE "ProductName", "Telegram Desktop" VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "1.0.24.0" VALUE "ProductVersion", "1.0.25.0"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

View File

@ -25,8 +25,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,24,0 FILEVERSION 1,0,25,0
PRODUCTVERSION 1,0,24,0 PRODUCTVERSION 1,0,25,0
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -43,10 +43,10 @@ BEGIN
BEGIN BEGIN
VALUE "CompanyName", "Telegram Messenger LLP" VALUE "CompanyName", "Telegram Messenger LLP"
VALUE "FileDescription", "Telegram Desktop Updater" VALUE "FileDescription", "Telegram Desktop Updater"
VALUE "FileVersion", "1.0.24.0" VALUE "FileVersion", "1.0.25.0"
VALUE "LegalCopyright", "Copyright (C) 2014-2017" VALUE "LegalCopyright", "Copyright (C) 2014-2017"
VALUE "ProductName", "Telegram Desktop" VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "1.0.24.0" VALUE "ProductVersion", "1.0.25.0"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

View File

@ -53,7 +53,8 @@ void createErrorLabel(QWidget *parent, object_ptr<Ui::WidgetFadeWrap<Ui::FlatLab
class ChangePhoneBox::EnterPhone : public BoxContent { class ChangePhoneBox::EnterPhone : public BoxContent {
public: public:
using BoxContent::BoxContent; EnterPhone(QWidget*) {
}
void setInnerFocus() override { void setInnerFocus() override {
_phone->setFocusFast(); _phone->setFocusFast();

View File

@ -24,7 +24,8 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
class ChangePhoneBox : public BoxContent { class ChangePhoneBox : public BoxContent {
public: public:
using BoxContent::BoxContent; ChangePhoneBox(QWidget*) {
}
protected: protected:
void prepare() override; void prepare() override;

View File

@ -24,7 +24,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#define BETA_VERSION_MACRO (0ULL) #define BETA_VERSION_MACRO (0ULL)
constexpr int AppVersion = 1000024; constexpr int AppVersion = 1000025;
constexpr str_const AppVersionStr = "1.0.24"; constexpr str_const AppVersionStr = "1.0.25";
constexpr bool AppAlphaVersion = true; constexpr bool AppAlphaVersion = true;
constexpr uint64 AppBetaVersion = BETA_VERSION_MACRO; constexpr uint64 AppBetaVersion = BETA_VERSION_MACRO;

View File

@ -637,8 +637,8 @@ void Messenger::checkMapVersion() {
if (Local::oldMapVersion() < AppVersion) { if (Local::oldMapVersion() < AppVersion) {
if (Local::oldMapVersion()) { if (Local::oldMapVersion()) {
QString versionFeatures; QString versionFeatures;
if ((cAlphaVersion() || cBetaVersion()) && Local::oldMapVersion() < 1000024) { if ((cAlphaVersion() || cBetaVersion()) && Local::oldMapVersion() < 1000025) {
versionFeatures = QString::fromUtf8("\xE2\x80\x94 Added Last Seen and Group Invite privacy settings."); versionFeatures = QString::fromUtf8("\xE2\x80\x94 Edit your account phone number in Settings.");
} else if (!(cAlphaVersion() || cBetaVersion()) && Local::oldMapVersion() < 1000012) { } else if (!(cAlphaVersion() || cBetaVersion()) && Local::oldMapVersion() < 1000012) {
versionFeatures = langNewVersionText(); versionFeatures = langNewVersionText();
} else { } else {

View File

@ -271,11 +271,6 @@ if %BuildUWP% equ 0 (
) else ( ) else (
xcopy "%DeployPath%\%BetaKeyFile%" "%FinalDeployPath%\" /Y xcopy "%DeployPath%\%BetaKeyFile%" "%FinalDeployPath%\" /Y
) )
xcopy "%DeployPath%\%BinaryName%.pdb" "%FinalDeployPath%\"
xcopy "%DeployPath%\%BinaryName%.exe.pdb" "%FinalDeployPath%\"
xcopy "%DeployPath%\Updater.exe" "%FinalDeployPath%\"
xcopy "%DeployPath%\Updater.pdb" "%FinalDeployPath%\"
xcopy "%DeployPath%\Updater.exe.pdb" "%FinalDeployPath%\"
) )
echo Version %AppVersionStrFull% is ready! echo Version %AppVersionStrFull% is ready!

View File

@ -80,8 +80,6 @@ elif [ "$BuildTarget" == "macstore" ]; then
echo "Building version $AppVersionStrFull for Mac App Store.." echo "Building version $AppVersionStrFull for Mac App Store.."
ReleasePath="$HomePath/../out/Release" ReleasePath="$HomePath/../out/Release"
BinaryName="Telegram Desktop" BinaryName="Telegram Desktop"
DropboxPath="/Volumes/Storage/Dropbox/Telegram/deploy/$AppVersionStrMajor"
DropboxDeployPath="$DropboxPath/$AppVersionStrFull"
else else
Error "Invalid target!" Error "Invalid target!"
fi fi
@ -344,7 +342,6 @@ if [ "$BuildTarget" == "mac" ] || [ "$BuildTarget" == "mac32" ] || [ "$BuildTarg
cp -v "$DeployPath/$UpdateFile" "$DeployToPath/" cp -v "$DeployPath/$UpdateFile" "$DeployToPath/"
cp -v "$DeployPath/$SetupFile" "$DeployToPath/" cp -v "$DeployPath/$SetupFile" "$DeployToPath/"
cp -rv "$DeployPath/$BinaryName.app.dSYM" "$DeployToPath/"
if [ "$BetaVersion" != "0" ]; then if [ "$BetaVersion" != "0" ]; then
cp -v "$DeployPath/$BetaKeyFile" "$DeployToPath/" cp -v "$DeployPath/$BetaKeyFile" "$DeployToPath/"
fi fi
@ -358,10 +355,6 @@ if [ "$BuildTarget" == "mac" ] || [ "$BuildTarget" == "mac32" ] || [ "$BuildTarg
rm "$ReleasePath/$BinaryName.app/Contents/MacOS/$BinaryName" rm "$ReleasePath/$BinaryName.app/Contents/MacOS/$BinaryName"
rm "$ReleasePath/$BinaryName.app/Contents/Info.plist" rm "$ReleasePath/$BinaryName.app/Contents/Info.plist"
rm -rf "$ReleasePath/$BinaryName.app/Contents/_CodeSignature" rm -rf "$ReleasePath/$BinaryName.app/Contents/_CodeSignature"
mkdir -p "$DropboxDeployPath"
cp -rv "$DeployPath/$BinaryName.app" "$DropboxDeployPath/"
cp -rv "$DeployPath/$BinaryName.app.dSYM" "$DropboxDeployPath/"
fi fi
fi fi

View File

@ -94,10 +94,6 @@ elif [ "$BuildTarget" == "mac" ]; then
WinSetupFile="tsetup.$AppVersionStrFull.exe" WinSetupFile="tsetup.$AppVersionStrFull.exe"
WinPortableFile="tportable.$AppVersionStrFull.zip" WinPortableFile="tportable.$AppVersionStrFull.zip"
WinRemoteFolder="tsetup" WinRemoteFolder="tsetup"
DropboxPath="/Volumes/Storage/Dropbox/Telegram/deploy/$AppVersionStrMajor"
DropboxDeployPath="$DropboxPath/$AppVersionStrFull"
DropboxSetupFile="$SetupFile"
DropboxMac32SetupFile="$Mac32SetupFile"
BackupPath="/Volumes/Storage/backup/$AppVersionStrMajor/$AppVersionStrFull" BackupPath="/Volumes/Storage/backup/$AppVersionStrMajor/$AppVersionStrFull"
elif [ "$BuildTarget" == "mac32" ] || [ "$BuildTarget" = "macstore" ]; then elif [ "$BuildTarget" == "mac32" ] || [ "$BuildTarget" = "macstore" ]; then
Error "No need to deploy this target." Error "No need to deploy this target."
@ -128,10 +124,8 @@ if [ "$BetaVersion" != "0" ]; then
SetupFile="tbeta${BetaVersion}_${BetaSignature}.tar.xz" SetupFile="tbeta${BetaVersion}_${BetaSignature}.tar.xz"
elif [ "$BuildTarget" == "mac" ]; then elif [ "$BuildTarget" == "mac" ]; then
SetupFile="tbeta${BetaVersion}_${BetaSignature}.zip" SetupFile="tbeta${BetaVersion}_${BetaSignature}.zip"
DropboxSetupFile="tbeta${BetaVersion}_${BetaSignature}_mac.zip"
Mac32UpdateFile="${Mac32UpdateFile}_${BetaSignature}" Mac32UpdateFile="${Mac32UpdateFile}_${BetaSignature}"
Mac32SetupFile="tbeta${BetaVersion}_${BetaSignature}.zip" Mac32SetupFile="tbeta${BetaVersion}_${BetaSignature}.zip"
DropboxMac32SetupFile="tbeta${BetaVersion}_${BetaSignature}_mac32.zip"
WinUpdateFile="${WinUpdateFile}_${BetaSignature}" WinUpdateFile="${WinUpdateFile}_${BetaSignature}"
WinPortableFile="tbeta${BetaVersion}_${BetaSignature}.zip" WinPortableFile="tbeta${BetaVersion}_${BetaSignature}.zip"
fi fi
@ -180,8 +174,6 @@ fi
Error "$WinPortableFile not found!" Error "$WinPortableFile not found!"
fi fi
fi fi
mkdir -p "$DropboxDeployPath"
fi fi
#fi #fi
@ -208,36 +200,18 @@ if [ "$BuildTarget" == "linux" ] || [ "$BuildTarget" == "linux32" ] || [ "$Build
fi fi
if [ "$DeployMac" == "1" ]; then if [ "$DeployMac" == "1" ]; then
if [ -d "$DropboxDeployPath/Telegram.app.dSYM" ]; then
rm -rf "$DropboxDeployPath/Telegram.app.dSYM"
fi
cp -rv "$DeployPath/Telegram.app.dSYM" "$DropboxDeployPath/"
if [ "$BetaVersion" == "0" ]; then if [ "$BetaVersion" == "0" ]; then
mkdir -p "$BackupPath/tmac" mkdir -p "$BackupPath/tmac"
mv -v "$DeployPath/$SetupFile" "$BackupPath/tmac/" mv -v "$DeployPath/$SetupFile" "$BackupPath/tmac/"
fi fi
fi fi
if [ "$DeployMac32" == "1" ]; then if [ "$DeployMac32" == "1" ]; then
if [ -d "$DropboxDeployPath/Telegram32.app.dSYM" ]; then
rm -rf "$DropboxDeployPath/Telegram32.app.dSYM"
fi
mv -v "$Mac32DeployPath/Telegram.app.dSYM" "$DropboxDeployPath/Telegram32.app.dSYM"
if [ "$BetaVersion" == "0" ]; then if [ "$BetaVersion" == "0" ]; then
mkdir -p "$BackupPath/tmac32" mkdir -p "$BackupPath/tmac32"
mv -v "$Mac32DeployPath/$Mac32SetupFile" "$BackupPath/tmac32/" mv -v "$Mac32DeployPath/$Mac32SetupFile" "$BackupPath/tmac32/"
fi fi
fi fi
if [ "$DeployWin" == "1" ]; then if [ "$DeployWin" == "1" ]; then
if [ -f "$WinDeployPath/Telegram.pdb" ]; then
mv -v "$WinDeployPath/Telegram.pdb" "$DropboxDeployPath/"
elif [ ! -f "$DropboxDeployPath/Telegram.pdb" ]; then
echo "Warning: Telegram.pdb not found."
fi
if [ -f "$WinDeployPath/Updater.pdb" ]; then
mv -v "$WinDeployPath/Updater.pdb" "$DropboxDeployPath/"
elif [ ! -f "$DropboxDeployPath/Updater.pdb" ]; then
echo "Warning: Updater.pdb not found."
fi
if [ "$BetaVersion" == "0" ]; then if [ "$BetaVersion" == "0" ]; then
mkdir -p "$BackupPath/tsetup" mkdir -p "$BackupPath/tsetup"
mv -v "$WinDeployPath/$WinSetupFile" "$BackupPath/tsetup/" mv -v "$WinDeployPath/$WinSetupFile" "$BackupPath/tsetup/"

256
Telegram/build/release.py Normal file
View File

@ -0,0 +1,256 @@
import os, sys, requests, pprint, re, json
from uritemplate import URITemplate, expand
from subprocess import call
changelog_file = '../../changelog.txt'
token_file = '../../../TelegramPrivate/github-releases-token.txt'
version = ''
commit = ''
for arg in sys.argv:
if re.match(r'\d+\.\d+', arg):
version = arg
elif re.match(r'^[a-f0-9]{40}$', arg):
commit = arg
# thanks http://stackoverflow.com/questions/13909900/progress-of-python-requests-post
class upload_in_chunks(object):
def __init__(self, filename, chunksize=1 << 13):
self.filename = filename
self.chunksize = chunksize
self.totalsize = os.path.getsize(filename)
self.readsofar = 0
def __iter__(self):
with open(self.filename, 'rb') as file:
while True:
data = file.read(self.chunksize)
if not data:
sys.stderr.write("\n")
break
self.readsofar += len(data)
percent = self.readsofar * 1e2 / self.totalsize
sys.stderr.write("\r{percent:3.0f}%".format(percent=percent))
yield data
def __len__(self):
return self.totalsize
class IterableToFileAdapter(object):
def __init__(self, iterable):
self.iterator = iter(iterable)
self.length = len(iterable)
def read(self, size=-1): # TBD: add buffer for `len(data) > size` case
return next(self.iterator, b'')
def __len__(self):
return self.length
def checkResponseCode(result, right_code):
if (result.status_code != right_code):
print('Wrong result code: ' + str(result.status_code) + ', should be ' + str(right_code))
sys.exit(1)
pp = pprint.PrettyPrinter(indent=2)
url = 'https://api.github.com/'
version_parts = version.split('.')
stable = 1
alpha = 0
dev = 0
if len(version_parts) < 2:
print('Error: expected at least major version ' + version)
sys.exit(1)
if len(version_parts) > 4:
print('Error: bad version passed ' + version)
sys.exit(1)
version_major = version_parts[0] + '.' + version_parts[1]
if len(version_parts) == 2:
version = version_major + '.0'
version_full = version
else:
version = version_major + '.' + version_parts[2]
version_full = version
if len(version_parts) == 4:
if version_parts[3] == 'dev':
dev = 1
stable = 0
version_full = version + '.dev'
elif version_parts[3] == 'alpha':
alpha = 1
stable = 0
version_full = version + '.alpha'
else:
print('Error: unexpected version part ' + version_parts[3])
sys.exit(1)
access_token = ''
if os.path.isfile(token_file):
with open(token_file) as f:
for line in f:
access_token = line.replace('\n', '')
if access_token == '':
print('Access token not found!')
sys.exit(1)
print('Version: ' + version_full);
local_folder = '/Volumes/Storage/backup/' + version_major + '/' + version_full
if stable == 1:
if os.path.isdir(local_folder + '.dev'):
dev = 1
stable = 0
version_full = version + '.dev'
local_folder = local_folder + '.dev'
elif os.path.isdir(local_folder + '.alpha'):
alpha = 1
stable = 0
version_full = version + '.alpha'
local_folder = local_folder + '.alpha'
if not os.path.isdir(local_folder):
print('Storage path not found!')
sys.exit(1)
local_folder = local_folder + '/'
files = []
files.append({
'local': 'tsetup.' + version_full + '.exe',
'remote': 'tsetup.' + version_full + '.exe',
'backup_folder': 'tsetup',
'mime': 'application/octet-stream',
'label': 'Windows: Installer',
})
files.append({
'local': 'tportable.' + version_full + '.zip',
'remote': 'tportable.' + version_full + '.zip',
'backup_folder': 'tsetup',
'mime': 'application/zip',
'label': 'Windows: Portable',
})
files.append({
'local': 'tsetup.' + version_full + '.dmg',
'remote': 'tsetup.' + version_full + '.dmg',
'backup_folder': 'tmac',
'mime': 'application/octet-stream',
'label': 'macOS and OS X 10.8+: Installer',
})
files.append({
'local': 'tsetup32.' + version_full + '.dmg',
'remote': 'tsetup32.' + version_full + '.dmg',
'backup_folder': 'tmac32',
'mime': 'application/octet-stream',
'label': 'OS X 10.6 and 10.7: Installer',
})
files.append({
'local': 'tsetup.' + version_full + '.tar.xz',
'remote': 'tsetup.' + version_full + '.tar.xz',
'backup_folder': 'tlinux',
'mime': 'application/octet-stream',
'label': 'Linux 64 bit: Binary',
})
files.append({
'local': 'tsetup32.' + version_full + '.tar.xz',
'remote': 'tsetup32.' + version_full + '.tar.xz',
'backup_folder': 'tlinux32',
'mime': 'application/octet-stream',
'label': 'Linux 32 bit: Binary',
})
r = requests.get(url + 'repos/telegramdesktop/tdesktop/releases/tags/v' + version)
if r.status_code == 404:
print('Release not found, creating.')
if commit == '':
print('Error: specify the commit.')
sys.exit(1)
if not os.path.isfile(changelog_file):
print('Error: Changelog file not found.')
sys.exit(1)
changelog = ''
started = 0
with open(changelog_file) as f:
for line in f:
if started == 1:
if re.match(r'^\d+\.\d+', line):
break;
if re.match(r'^\s+$', line):
continue
changelog += line
else:
if re.match(r'^\d+\.\d+', line):
if line[0:len(version) + 1] == version + ' ':
started = 1
elif line[0:len(version_major) + 1] == version_major + ' ':
if version_major + '.0' == version:
started = 1
if started != 1:
print('Error: Changelog not found.')
sys.exit(1)
changelog = changelog.strip()
print('Changelog: ');
print(changelog);
r = requests.post(url + 'repos/telegramdesktop/tdesktop/releases', headers={'Authorization': 'token ' + access_token}, data=json.dumps({
'tag_name': 'v' + version,
'target_commitish': commit,
'name': 'v ' + version,
'body': changelog,
'prerelease': (dev == 1 or alpha == 1),
}))
checkResponseCode(r, 201)
r = requests.get(url + 'repos/telegramdesktop/tdesktop/releases/tags/v' + version)
checkResponseCode(r, 200);
release_data = r.json()
#pp.pprint(release_data)
release_id = release_data['id']
print('Release ID: ' + str(release_id))
r = requests.get(url + 'repos/telegramdesktop/tdesktop/releases/' + str(release_id) + '/assets');
checkResponseCode(r, 200);
assets = release_data['assets']
for asset in assets:
name = asset['name']
found = 0
for file in files:
if file['remote'] == name:
print('Already uploaded: ' + name)
file['already'] = 1
found = 1
break
if found == 0:
print('Warning: strange asset: ' + name)
for file in files:
if 'already' in file:
continue
file_path = local_folder + file['backup_folder'] + '/' + file['local']
if not os.path.isfile(file_path):
print('Warning: file not found ' + file['local'])
continue
upload_url = expand(release_data['upload_url'], {'name': file['remote'], 'label': file['label']}) + '&access_token=' + access_token;
content = upload_in_chunks(file_path, 10)
print('Uploading: ' + file['remote'] + ' (' + str(round(len(content) / 10000) / 100.) + ' MB)')
r = requests.post(upload_url, headers={"Content-Type": file['mime']}, data=IterableToFileAdapter(content))
checkResponseCode(r, 201)
print('Success! Removing.')
return_code = call(["rm", file_path])
if return_code != 0:
print('Bad rm code: ' + str(return_code))
sys.exit(1)
sys.exit()

44
Telegram/build/release.sh Executable file
View File

@ -0,0 +1,44 @@
set -e
FullExecPath=$PWD
pushd `dirname $0` > /dev/null
FullScriptPath=`pwd`
popd > /dev/null
Param1="$1"
Param2="$2"
Param3="$3"
Param4="$4"
if [ ! -d "$FullScriptPath/../../../TelegramPrivate" ]; then
echo ""
echo "This script is for building the production version of Telegram Desktop."
echo ""
echo "For building custom versions please visit the build instructions page at:"
echo "https://github.com/telegramdesktop/tdesktop/#build-instructions"
exit
fi
Error () {
cd $FullExecPath
echo "$1"
exit 1
}
while IFS='' read -r line || [[ -n "$line" ]]; do
set $line
eval $1="$2"
done < "$FullScriptPath/version"
VersionForPacker="$AppVersion"
if [ "$BetaVersion" != "0" ]; then
Error "No releases for closed beta versions"
elif [ "$AlphaChannel" == "0" ]; then
AppVersionStrFull="$AppVersionStr"
AlphaBetaParam=''
else
AppVersionStrFull="$AppVersionStr.alpha"
AlphaBetaParam='-alpha'
fi
cd "$FullScriptPath"
python release.py $AppVersionStr $Param1 $Param2 $Param3 $Param4

View File

@ -1,6 +1,6 @@
AppVersion 1000024 AppVersion 1000025
AppVersionStrMajor 1.0 AppVersionStrMajor 1.0
AppVersionStrSmall 1.0.24 AppVersionStrSmall 1.0.25
AppVersionStr 1.0.24 AppVersionStr 1.0.25
AlphaChannel 1 AlphaChannel 1
BetaVersion 0 BetaVersion 0

View File

@ -1,3 +1,7 @@
1.0.25 alpha (21.03.17)
- Edit your account phone number in Settings.
1.0.24 alpha (19.03.17) 1.0.24 alpha (19.03.17)
- Added Last Seen and Group Invite privacy settings. - Added Last Seen and Group Invite privacy settings.